Skip to content

Commit ef75963

Browse files
committed
Only use the external controller if we embed an iframe
1 parent 382e747 commit ef75963

4 files changed

Lines changed: 28 additions & 35 deletions

File tree

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,18 @@ Copy the folder "thePlatform-video-manager" with all included files into the "wp
1717

1818
# == Screenshots ==
1919

20-
1. thePlatform's Setting screen
21-
2. View your media library, search for videos, and sort the returned media set
22-
3. Modify video metadata
20+
1. Manage and Edit Media in mpx
21+
2. Upload Media to mpx directly from WordPress
22+
3. Choosing different metadata fields
2323
4. Easily embed videos from mpx into your posts
24-
5. Upload media to your mpx account
2524

2625
# == Changelog ==
2726

2827
## = 2.1.0 =
2928
* Added Advanced Settings
3029
* Added new shortcode parameters
3130
* Simplified account settings
31+
* Added a new option to embed the PDK external controller in posts with our video player
3232

3333
## = 2.0.0 =
3434
* Removed 3rd party libraries in favor of native Wordpress look and feel
@@ -161,6 +161,7 @@ This plugin requires an account with thePlatform's mpx. Please contact your Acco
161161
## = Embedding Preferences =
162162
* Default Player - The default player used for embedding and in the Media Browser
163163
* Embed Tag Type - IFrame or Script embed
164+
* Use PDK External Controller - Load the external controller in posts that have our player as an IFrame
164165
* Media Embed Type - Embed Media by the Media PID, Release PID or Media GUID.
165166
* Player Embed Type - Video Only (/embed/) or Full Player
166167
* RSS Embed Type - In an RSS feed, provide a link back to the Article, or an iframe/script tag

readme.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@ View your content hosted by thePlatform and easily embed videos from your librar
1515
Copy the folder "thePlatform-video-manager" with all included files into the "wp-content/plugins" folder of WordPress. Activate the plugin and set your mpx credentials in the plugin settings interface.
1616

1717
== Screenshots ==
18-
thePlatform's Setting screen
19-
View your media library, search for videos, and sort the returned media set
20-
Modify video metadata
18+
Manage and Edit Media in mpx
19+
Upload Media to mpx directly from WordPress
20+
Choosing different metadata fields
2121
Easily embed videos from mpx into your posts
22-
Upload media to your mpx account
2322

2423
== Changelog ==
2524

2625
= 2.1.0 =
2726
Added Advanced Settings
2827
Added new shortcode parameters
2928
Simplified account settings
29+
Added a new option to embed the PDK external controller in posts with our video player
3030

3131
= 2.0.0 =
3232
Removed 3rd party libraries in favor of native Wordpress look and feel
@@ -159,6 +159,7 @@ mpx Account - The mpx account to upload and retrieve media from
159159
= Embedding Preferences =
160160
Default Player - The default player used for embedding and in the Media Browser
161161
Embed Tag Type - IFrame or Script embed
162+
Use PDK External Controller - Load the external controller in posts that have our as an IFrame
162163
Media Embed Type - Embed Media by the Media PID, Release PID or Media GUID.
163164
Player Embed Type - Video Only (/embed/) or Full Player
164165
RSS Embed Type - In an RSS feed, provide a link back to the Article, or an iframe/script tag

thePlatform-constants.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ function TP_PREFERENCES_OPTIONS_FIELDS() {
133133
),
134134
array(
135135
'id' => 'enqueue_external_controller',
136-
'title' => 'Enqueue PDK External Controller',
136+
'title' => 'Use PDK External Controller',
137137
'type' => 'boolean'
138138
),
139139
array(

thePlatform.php

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ function __construct() {
6262
add_action( 'admin_init', array( $this, 'register_scripts' ) );
6363
add_action( 'admin_init', array( $this, 'theplatform_register_plugin_settings' ) );
6464
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
65-
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_external_controller' ) );
6665

6766
if ( current_user_can( $this->tp_editor_cap ) ) {
6867
add_filter( 'media_upload_tabs', array( $this, 'tp_upload_tab' ) );
@@ -134,18 +133,6 @@ function admin_enqueue_scripts( $hook ) {
134133
}
135134
}
136135

137-
function enqueue_external_controller( $hook ) {
138-
$preferences = get_option( TP_PREFERENCES_OPTIONS_KEY );
139-
140-
if ( $preferences === false ) {
141-
return;
142-
}
143-
144-
if ( $preferences['enqueue_external_controller'] == 'true' ) {
145-
wp_enqueue_script( 'tp_pdk_external_controller_js', '//pdk.theplatform.com/pdk/tpPdkController.js' );
146-
}
147-
}
148-
149136
/**
150137
* Registers javascripts and css used throughout the plugin
151138
*/
@@ -660,19 +647,19 @@ function shortcode( $atts ) {
660647
}
661648

662649
list( $account, $width, $height, $media, $player, $mute, $autoplay, $tag, $embedded, $params, $playall, $instance ) = array_values( shortcode_atts( array(
663-
'account' => '',
664-
'width' => '',
665-
'height' => '',
666-
'media' => '',
667-
'player' => '',
668-
'mute' => '',
669-
'autoplay' => '',
670-
'tag' => '',
671-
'embedded' => '',
672-
'params' => '',
673-
'playall' => '',
674-
'instance' => '',
675-
), $atts ) );
650+
'account' => '',
651+
'width' => '',
652+
'height' => '',
653+
'media' => '',
654+
'player' => '',
655+
'mute' => '',
656+
'autoplay' => '',
657+
'tag' => '',
658+
'embedded' => '',
659+
'params' => '',
660+
'playall' => '',
661+
'instance' => '',
662+
), $atts ) );
676663

677664
if ( empty( $width ) ) {
678665
$width = (int) $this->preferences['default_width'];
@@ -719,6 +706,10 @@ function shortcode( $atts ) {
719706
$instance = mt_rand();
720707
}
721708

709+
if ( $this->preferences['enqueue_external_controller'] == 'true' && $tag == 'iframe' ) {
710+
wp_enqueue_script( 'tp_pdk_external_controller_js', '//pdk.theplatform.com/pdk/tpPdkController.js' );
711+
}
712+
722713

723714
if ( ! is_feed() ) {
724715
$output = $this->get_embed_shortcode( $account, $media, $player, $width, $height, $autoplay, $tag, $embedded, $mute, $params, $playall, $instance );

0 commit comments

Comments
 (0)