Version Description
- Enhancement: Strip tags from video ID, in case any have crept in
- Enhancement: Tidied some of the widget controls
- Enhancement: You can now specify YouTube short URLs as video IDs
- Bug: Removed reference to jscolor.js script, which isn't used
- Bug: Video IDs beginning with numbers are being confused with list numbers
- Bug: Corrected problem with random single videos being picked from a list
- Bug: Fixed problem with list where one video was being ignored and another repeated
- Bug: Modified widget code to allow for all states to be allowable. Defaults updated
- Bug: YouTube documentation states that if you don't specify the fullscreen parameter it will default to off. It doesn't. Corrected in the code
=
Download this release
Release Info
Developer | dartiss |
Plugin | YouTube Embed |
Version | 2.0.2 |
Comparing to | |
See all releases |
Code changes from version 2.0.1 to 2.0.2
- includes/admin-menu.php +0 -13
- includes/generate-embed-code.php +6 -6
- includes/generate-shorturl-code.php +1 -1
- includes/options-widgets.php +113 -52
- includes/shared.php +19 -2
- readme.txt +24 -9
- screenshot-6.png +0 -0
- youtube-embed.php +2 -2
includes/admin-menu.php
CHANGED
@@ -95,19 +95,6 @@ function ye_menu_css() {
|
|
95 |
}
|
96 |
add_action( 'admin_print_styles', 'ye_menu_css' );
|
97 |
|
98 |
-
/**
|
99 |
-
* Add JavaScript files
|
100 |
-
*
|
101 |
-
* Add JavaScript files to the admin screens
|
102 |
-
*
|
103 |
-
* @since 2.0
|
104 |
-
*/
|
105 |
-
|
106 |
-
function ye_menu_js() {
|
107 |
-
wp_enqueue_script( 'jscolor', WP_PLUGIN_URL . '/youtube-embed/js/jscolor.js' );
|
108 |
-
}
|
109 |
-
add_action( 'admin_print_scripts', 'ye_menu_js' );
|
110 |
-
|
111 |
/**
|
112 |
* Add Settings link to plugin list
|
113 |
*
|
95 |
}
|
96 |
add_action( 'admin_print_styles', 'ye_menu_css' );
|
97 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
/**
|
99 |
* Add Settings link to plugin list
|
100 |
*
|
includes/generate-embed-code.php
CHANGED
@@ -99,7 +99,7 @@ function ye_generate_youtube_code( $id = '', $type = '', $width = '', $height =
|
|
99 |
|
100 |
// Extract one video randomly
|
101 |
if ( $list_style == 'single' ) {
|
102 |
-
$id = array_rand( $list, 1 );
|
103 |
|
104 |
// Build the playlist
|
105 |
} else {
|
@@ -111,8 +111,8 @@ function ye_generate_youtube_code( $id = '', $type = '', $width = '', $height =
|
|
111 |
$loop = 1;
|
112 |
while ( $loop < count( $list ) ) {
|
113 |
if ( $playlist_ids != '' ) { $playlist_ids .= ','; }
|
114 |
-
$
|
115 |
-
$playlist_ids .= $
|
116 |
$loop ++;
|
117 |
}
|
118 |
}
|
@@ -175,7 +175,7 @@ function ye_generate_youtube_code( $id = '', $type = '', $width = '', $height =
|
|
175 |
if ( strpos( $template, '%video%' ) === false ) { $template = '%video%'; }
|
176 |
|
177 |
// If a multi-play list has been specified and EmbedPlus selected, use fallback embedding method instead
|
178 |
-
if ( ( $playlist_ids != '' ) && ( $type == 'm' ) && ( $
|
179 |
|
180 |
// If looping and no playlist has been generated, add the current ID
|
181 |
// This is a workaround for the AS3 player which won't otherwise loop
|
@@ -242,7 +242,7 @@ function ye_generate_youtube_code( $id = '', $type = '', $width = '', $height =
|
|
242 |
}
|
243 |
|
244 |
// Generate parameters to add to URL
|
245 |
-
if ( $fullscreen == 1 ) { $paras .= '&fs=1'; }
|
246 |
if ( $related != 1 ) { $paras .= '&rel=0'; }
|
247 |
if ( $autoplay == 1 ) { $paras .= '&autoplay=1'; $paras_ep .= '&autoplay=1'; }
|
248 |
if ( $loop == 1 ) { $paras .= '&loop=1'; }
|
@@ -385,7 +385,7 @@ function ye_validate_list( $name, $number ) {
|
|
385 |
$loop = 1;
|
386 |
while ( ( $loop <= $number ) && ( $list == '' ) ) {
|
387 |
$listfiles = get_option( 'youtube_embed_list' . $loop );
|
388 |
-
if ( ( $name == $loop ) or ( $name == 'List ' . $loop ) ) {
|
389 |
$list = $listfiles[ 'list' ];
|
390 |
} else {
|
391 |
$listname = strtolower( $listfiles[ 'name' ] );
|
99 |
|
100 |
// Extract one video randomly
|
101 |
if ( $list_style == 'single' ) {
|
102 |
+
$id = $list[ array_rand( $list, 1 ) ];
|
103 |
|
104 |
// Build the playlist
|
105 |
} else {
|
111 |
$loop = 1;
|
112 |
while ( $loop < count( $list ) ) {
|
113 |
if ( $playlist_ids != '' ) { $playlist_ids .= ','; }
|
114 |
+
$list_id = ye_extract_id( $list[ $loop ] );
|
115 |
+
$playlist_ids .= $list_id;
|
116 |
$loop ++;
|
117 |
}
|
118 |
}
|
175 |
if ( strpos( $template, '%video%' ) === false ) { $template = '%video%'; }
|
176 |
|
177 |
// If a multi-play list has been specified and EmbedPlus selected, use fallback embedding method instead
|
178 |
+
if ( ( $playlist_ids != '' ) && ( $type == 'm' ) && ( $list_style != 'single' ) ) { $type = $options[ 'fallback' ]; }
|
179 |
|
180 |
// If looping and no playlist has been generated, add the current ID
|
181 |
// This is a workaround for the AS3 player which won't otherwise loop
|
242 |
}
|
243 |
|
244 |
// Generate parameters to add to URL
|
245 |
+
if ( $fullscreen == 1 ) { $paras .= '&fs=1'; } else { $paras .= '&fs=0'; }
|
246 |
if ( $related != 1 ) { $paras .= '&rel=0'; }
|
247 |
if ( $autoplay == 1 ) { $paras .= '&autoplay=1'; $paras_ep .= '&autoplay=1'; }
|
248 |
if ( $loop == 1 ) { $paras .= '&loop=1'; }
|
385 |
$loop = 1;
|
386 |
while ( ( $loop <= $number ) && ( $list == '' ) ) {
|
387 |
$listfiles = get_option( 'youtube_embed_list' . $loop );
|
388 |
+
if ( ( $name == strval( $loop ) ) or ( $name == 'List ' . $loop ) ) {
|
389 |
$list = $listfiles[ 'list' ];
|
390 |
} else {
|
391 |
$listname = strtolower( $listfiles[ 'name' ] );
|
includes/generate-shorturl-code.php
CHANGED
@@ -16,7 +16,7 @@
|
|
16 |
*/
|
17 |
|
18 |
function ye_generate_shorturl_code( $id ) {
|
19 |
-
|
20 |
// Check that an ID has been specified
|
21 |
if ( $id == '' ) {
|
22 |
return ye_error( 'No video ID has been supplied' );
|
16 |
*/
|
17 |
|
18 |
function ye_generate_shorturl_code( $id ) {
|
19 |
+
|
20 |
// Check that an ID has been specified
|
21 |
if ( $id == '' ) {
|
22 |
return ye_error( 'No video ID has been supplied' );
|
includes/options-widgets.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
// Set default options
|
3 |
-
$default = array( 'titles' => 'YouTube', 'id' => '', 'type' => '
|
4 |
$instance = wp_parse_args( ( array ) $instance, $default );
|
5 |
$general = ye_set_general_defaults();
|
6 |
|
@@ -24,7 +24,9 @@ echo '</select></p>';
|
|
24 |
// Embed type field
|
25 |
$field_id = $this -> get_field_id( 'type' );
|
26 |
$field_name = $this -> get_field_name( 'type' );
|
27 |
-
echo "\r\n" . '<p><label for="' . $field_id . '">' . __( 'Embed Type' ) . ': </label><select name="' . $field_name . '" class="widefat" id="' . $field_id . '"><option value="
|
|
|
|
|
28 |
if ( attribute_escape( $instance[ 'type' ] ) == 'v' ) { echo " selected='selected'"; }
|
29 |
echo '>' . __( 'IFRAME' ) . '</option><option value="p"';
|
30 |
if ( attribute_escape( $instance[ 'type' ] ) == 'p' ) { echo " selected='selected'"; }
|
@@ -51,17 +53,25 @@ $field_id = $this -> get_field_id( 'height' );
|
|
51 |
$field_name = $this -> get_field_name( 'height' );
|
52 |
echo '<input type="text" size="3" maxlength="3" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape( $instance[ 'height' ] ) . '" /> pixels</p>';
|
53 |
|
54 |
-
|
55 |
-
$field_id = $this -> get_field_id( 'autoplay' );
|
56 |
-
$field_name = $this -> get_field_name( 'autoplay' );
|
57 |
-
echo "\r\n" . '<tr><td width="100%">' . __( 'Autoplay' ) . '</td><td><input type="checkbox" name="' . $field_name . '" id="' . $field_id . '" value="1" ';
|
58 |
-
if ( attribute_escape( $instance[ 'autoplay' ] ) == '1') { echo "checked='checked' "; }
|
59 |
-
echo '/></td></tr>';
|
60 |
|
61 |
// Start field
|
62 |
$field_id = $this -> get_field_id( 'start' );
|
63 |
$field_name = $this -> get_field_name( 'start' );
|
64 |
-
echo "\r\n" . '<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
|
66 |
?>
|
67 |
<h4><?php _e( 'Non-EmbedPlus Options' ); ?></h4>
|
@@ -70,7 +80,9 @@ echo "\r\n" . '<p><label for="' . $field_id . '">' . __( 'Start' ) . ': </label>
|
|
70 |
// Autohide field
|
71 |
$field_id = $this -> get_field_id( 'autohide' );
|
72 |
$field_name = $this -> get_field_name( 'autohide' );
|
73 |
-
echo "\r\n" . '<p><label for="' . $field_id . '">' . __( 'Auto hide' ) . ': </label><select name="' . $field_name . '" class="widefat" id="' . $field_id . '"><option value="
|
|
|
|
|
74 |
if ( attribute_escape( $instance[ 'autohide' ] ) == '0' ) { echo " selected='selected'"; }
|
75 |
echo '>' . __( 'Controls & progress bar visible' ) . '</option><option value="1"';
|
76 |
if ( attribute_escape( $instance[ 'autohide' ] ) == '1' ) { echo " selected='selected'"; }
|
@@ -81,7 +93,9 @@ echo '>' . __( 'Progress bar fades' ) . '</option></select></p>';
|
|
81 |
// List field
|
82 |
$field_id = $this -> get_field_id( 'list' );
|
83 |
$field_name = $this -> get_field_name( 'list' );
|
84 |
-
echo "\r\n" . '<p><label for="' . $field_id . '">' . __( 'List Playback' ) . ': </label><select name="' . $field_name . '" class="widefat" id="' . $field_id . '"><option value="
|
|
|
|
|
85 |
if ( attribute_escape( $instance[ 'list' ] ) == 'order' ) { echo " selected='selected'"; }
|
86 |
echo '>' . __( 'Play each video in order' ) . '</option><option value="random"';
|
87 |
if ( attribute_escape( $instance[ 'list' ] ) == 'random' ) { echo " selected='selected'"; }
|
@@ -94,21 +108,28 @@ echo "<table>\n";
|
|
94 |
// Controls field
|
95 |
$field_id = $this -> get_field_id( 'controls' );
|
96 |
$field_name = $this -> get_field_name( 'controls' );
|
97 |
-
echo "\r\n" . '<tr><td>' . __( 'Controls' ) . '</td><td><
|
98 |
-
if ( attribute_escape( $instance[ 'controls' ] ) == '
|
99 |
-
echo '
|
|
|
|
|
|
|
|
|
100 |
|
101 |
// Loop video field
|
102 |
$field_id = $this -> get_field_id( 'loop' );
|
103 |
$field_name = $this -> get_field_name( 'loop' );
|
104 |
-
echo "\r\n" . '<tr><td>' . __( 'Loop Video' ) . '</td><td><
|
105 |
-
if ( attribute_escape( $instance[ 'loop' ] ) == '
|
106 |
-
echo '
|
|
|
|
|
|
|
|
|
107 |
|
108 |
echo "</table>\n";
|
109 |
-
|
110 |
?>
|
111 |
-
<h4><?php _e( 'Non-EmbedPlus & HTML5 Options' ); ?></h4>
|
112 |
<?php
|
113 |
|
114 |
echo "<table>\n";
|
@@ -116,51 +137,79 @@ echo "<table>\n";
|
|
116 |
// Annotation field
|
117 |
$field_id = $this -> get_field_id( 'annotation' );
|
118 |
$field_name = $this -> get_field_name( 'annotation' );
|
119 |
-
echo "\r\n" . '<tr><td width="100%">' . __( 'Annotations' ) . '</td><td><
|
120 |
-
if ( attribute_escape( $instance[ 'annotation' ] ) == '
|
121 |
-
echo '
|
|
|
|
|
|
|
|
|
122 |
|
123 |
// Closed Caption field
|
124 |
$field_id = $this -> get_field_id( 'cc' );
|
125 |
$field_name = $this -> get_field_name( 'cc' );
|
126 |
-
echo "\r\n" . '<tr><td width="100%">' . __( 'Closed Captions' ) . '</td><td><
|
127 |
-
if ( attribute_escape( $instance[ 'cc' ] ) == '
|
128 |
-
echo '
|
|
|
|
|
|
|
|
|
129 |
|
130 |
// Disable keyboard field
|
131 |
$field_id = $this -> get_field_id( 'disablekb' );
|
132 |
$field_name = $this -> get_field_name( 'disablekb' );
|
133 |
-
echo "\r\n" . '<tr><td width="100%">' . __( 'Disable Keyboard' ) . '</td><td><
|
134 |
-
if ( attribute_escape( $instance[ 'disablekb' ] ) == '
|
135 |
-
echo '
|
|
|
|
|
|
|
|
|
136 |
|
137 |
// Fullscreen field
|
138 |
$field_id = $this -> get_field_id( 'fullscreen' );
|
139 |
$field_name = $this -> get_field_name( 'fullscreen' );
|
140 |
-
echo "\r\n" . '<tr><td width="100%">' . __( 'Fullscreen' ) . '</td><td><
|
141 |
-
if ( attribute_escape( $instance[ 'fullscreen' ] ) == '
|
142 |
-
echo '
|
|
|
|
|
|
|
|
|
143 |
|
144 |
// Information field
|
145 |
$field_id = $this -> get_field_id( 'info' );
|
146 |
$field_name = $this -> get_field_name( 'info' );
|
147 |
-
echo "\r\n" . '<tr><td width="100%">' . __( 'Information' ) . '</td><td><
|
148 |
-
if ( attribute_escape( $instance[ 'info' ] ) == '
|
149 |
-
echo '
|
|
|
|
|
|
|
|
|
150 |
|
151 |
// YouTube Link field
|
152 |
$field_id = $this -> get_field_id( 'link' );
|
153 |
$field_name = $this -> get_field_name( 'link' );
|
154 |
-
echo "\r\n" . '<tr><td width="100%">' . __( 'Link to YouTube' ) . '</td><td><
|
155 |
-
if ( attribute_escape( $instance[ 'link' ] ) == '
|
156 |
-
echo '
|
|
|
|
|
|
|
|
|
157 |
|
158 |
// Related videos field
|
159 |
$field_id = $this -> get_field_id( 'related' );
|
160 |
$field_name = $this -> get_field_name( 'related' );
|
161 |
-
echo "\r\n" . '<tr><td width="100%">' . __( 'Related Videos' ) . '</td><td><
|
162 |
-
if ( attribute_escape( $instance[ 'related' ] ) == '
|
163 |
-
echo '
|
|
|
|
|
|
|
|
|
164 |
|
165 |
echo "</table>\n";
|
166 |
|
@@ -168,33 +217,45 @@ echo "</table>\n";
|
|
168 |
<h4><?php _e('EmbedPlus Options'); ?></h4>
|
169 |
<?php
|
170 |
|
|
|
|
|
171 |
// Stop field
|
172 |
$field_id = $this -> get_field_id( 'stop' );
|
173 |
$field_name = $this -> get_field_name( 'stop' );
|
174 |
-
echo "\r\n" . '<
|
175 |
-
|
176 |
-
echo "<table>\n";
|
177 |
|
178 |
// HD field
|
179 |
$field_id = $this -> get_field_id( 'hd' );
|
180 |
$field_name = $this -> get_field_name( 'hd' );
|
181 |
-
echo "\r\n" . '<tr><td width="100%">' . __( 'Play HD' ) . '</td><td><
|
182 |
-
if ( attribute_escape( $instance[ 'hd' ] ) == '
|
183 |
-
echo '
|
|
|
|
|
|
|
|
|
184 |
|
185 |
// Reactions field
|
186 |
$field_id = $this -> get_field_id( 'react' );
|
187 |
$field_name = $this -> get_field_name( 'react' );
|
188 |
-
echo "\r\n" . '<tr><td width="100%">' . __( 'Real-time Reactions' ) . '</td><td><
|
189 |
-
if ( attribute_escape( $instance[ 'react' ] ) == '
|
190 |
-
echo '
|
|
|
|
|
|
|
|
|
191 |
|
192 |
// Sweetspot field
|
193 |
$field_id = $this -> get_field_id( 'sweetspot' );
|
194 |
$field_name = $this -> get_field_name( 'sweetspot' );
|
195 |
-
echo "\r\n" . '<tr><td width="100%">' . __( 'Sweet Spots' ) . '</td><td><
|
196 |
-
if ( attribute_escape( $instance[ 'sweetspot' ] ) == '
|
197 |
-
echo '
|
|
|
|
|
|
|
|
|
198 |
|
199 |
echo "</table>\n";
|
200 |
?>
|
1 |
<?php
|
2 |
// Set default options
|
3 |
+
$default = array( 'titles' => 'YouTube', 'id' => '', 'type' => '', 'width' => '', 'height' => '', 'fullscreen' => '', 'related' => '', 'autoplay' => '', 'loop' => '', 'start' => '', 'info' => '', 'annotation' => '', 'cc' => '', 'link' => '', 'react' => '', 'stop' => '', 'sweetspot' => '', 'disablekb' => '', 'autohide' => '', 'controls' => '', 'profile' => '0', 'list' => '', 'template' => '', 'hd' => '', 'style' => '' );
|
4 |
$instance = wp_parse_args( ( array ) $instance, $default );
|
5 |
$general = ye_set_general_defaults();
|
6 |
|
24 |
// Embed type field
|
25 |
$field_id = $this -> get_field_id( 'type' );
|
26 |
$field_name = $this -> get_field_name( 'type' );
|
27 |
+
echo "\r\n" . '<p><label for="' . $field_id . '">' . __( 'Embed Type' ) . ': </label><select name="' . $field_name . '" class="widefat" id="' . $field_id . '"><option value=""';
|
28 |
+
if ( attribute_escape( $instance[ 'type' ] ) == '' ) { echo " selected='selected'"; }
|
29 |
+
echo '>' . __( 'Profile default' ) . '</option><option value="v"';
|
30 |
if ( attribute_escape( $instance[ 'type' ] ) == 'v' ) { echo " selected='selected'"; }
|
31 |
echo '>' . __( 'IFRAME' ) . '</option><option value="p"';
|
32 |
if ( attribute_escape( $instance[ 'type' ] ) == 'p' ) { echo " selected='selected'"; }
|
53 |
$field_name = $this -> get_field_name( 'height' );
|
54 |
echo '<input type="text" size="3" maxlength="3" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape( $instance[ 'height' ] ) . '" /> pixels</p>';
|
55 |
|
56 |
+
echo "<table>\n";
|
|
|
|
|
|
|
|
|
|
|
57 |
|
58 |
// Start field
|
59 |
$field_id = $this -> get_field_id( 'start' );
|
60 |
$field_name = $this -> get_field_name( 'start' );
|
61 |
+
echo "\r\n" . '<tr><td width="100%">' . __( 'Start (seconds)' ) . '</td><td><input type="text" size="3" maxlength="3" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape( $instance[ 'start' ] ) . '" /></td></tr>';
|
62 |
+
|
63 |
+
// Autoplay field
|
64 |
+
$field_id = $this -> get_field_id( 'autoplay' );
|
65 |
+
$field_name = $this -> get_field_name( 'autoplay' );
|
66 |
+
echo "\r\n" . '<tr><td width="100%">' . __( 'Autoplay' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
|
67 |
+
if ( attribute_escape( $instance[ 'autoplay' ] ) == '' ) { echo " selected='selected'"; }
|
68 |
+
echo '>' . __( 'Profile default' ) . '</option><option value="0"';
|
69 |
+
if ( attribute_escape( $instance[ 'autoplay' ] ) == '0' ) { echo " selected='selected'"; }
|
70 |
+
echo '>' . __( 'No' ) . '</option><option value="1"';
|
71 |
+
if ( attribute_escape( $instance[ 'autoplay' ] ) == '1' ) { echo " selected='selected'"; }
|
72 |
+
echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
|
73 |
+
|
74 |
+
echo "</table>\n";
|
75 |
|
76 |
?>
|
77 |
<h4><?php _e( 'Non-EmbedPlus Options' ); ?></h4>
|
80 |
// Autohide field
|
81 |
$field_id = $this -> get_field_id( 'autohide' );
|
82 |
$field_name = $this -> get_field_name( 'autohide' );
|
83 |
+
echo "\r\n" . '<p><label for="' . $field_id . '">' . __( 'Auto hide' ) . ': </label><select name="' . $field_name . '" class="widefat" id="' . $field_id . '"><option value=""';
|
84 |
+
if ( attribute_escape( $instance[ 'autohide' ] ) == '' ) { echo " selected='selected'"; }
|
85 |
+
echo '>' . __( 'Profile default' ) . '</option><option value="0"';
|
86 |
if ( attribute_escape( $instance[ 'autohide' ] ) == '0' ) { echo " selected='selected'"; }
|
87 |
echo '>' . __( 'Controls & progress bar visible' ) . '</option><option value="1"';
|
88 |
if ( attribute_escape( $instance[ 'autohide' ] ) == '1' ) { echo " selected='selected'"; }
|
93 |
// List field
|
94 |
$field_id = $this -> get_field_id( 'list' );
|
95 |
$field_name = $this -> get_field_name( 'list' );
|
96 |
+
echo "\r\n" . '<p><label for="' . $field_id . '">' . __( 'List Playback' ) . ': </label><select name="' . $field_name . '" class="widefat" id="' . $field_id . '"><option value=""';
|
97 |
+
if ( attribute_escape( $instance[ 'list' ] ) == '' ) { echo " selected='selected'"; }
|
98 |
+
echo '>' . __( 'Profile default' ) . '</option><option value="order"';
|
99 |
if ( attribute_escape( $instance[ 'list' ] ) == 'order' ) { echo " selected='selected'"; }
|
100 |
echo '>' . __( 'Play each video in order' ) . '</option><option value="random"';
|
101 |
if ( attribute_escape( $instance[ 'list' ] ) == 'random' ) { echo " selected='selected'"; }
|
108 |
// Controls field
|
109 |
$field_id = $this -> get_field_id( 'controls' );
|
110 |
$field_name = $this -> get_field_name( 'controls' );
|
111 |
+
echo "\r\n" . '<tr><td width="100%">' . __( 'Controls' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
|
112 |
+
if ( attribute_escape( $instance[ 'controls' ] ) == '' ) { echo " selected='selected'"; }
|
113 |
+
echo '>' . __( 'Profile default' ) . '</option><option value="0"';
|
114 |
+
if ( attribute_escape( $instance[ 'controls' ] ) == '0' ) { echo " selected='selected'"; }
|
115 |
+
echo '>' . __( 'No' ) . '</option><option value="1"';
|
116 |
+
if ( attribute_escape( $instance[ 'controls' ] ) == '1' ) { echo " selected='selected'"; }
|
117 |
+
echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
|
118 |
|
119 |
// Loop video field
|
120 |
$field_id = $this -> get_field_id( 'loop' );
|
121 |
$field_name = $this -> get_field_name( 'loop' );
|
122 |
+
echo "\r\n" . '<tr><td width="100%">' . __( 'Loop Video' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
|
123 |
+
if ( attribute_escape( $instance[ 'loop' ] ) == '' ) { echo " selected='selected'"; }
|
124 |
+
echo '>' . __( 'Profile default' ) . '</option><option value="0"';
|
125 |
+
if ( attribute_escape( $instance[ 'loop' ] ) == '0' ) { echo " selected='selected'"; }
|
126 |
+
echo '>' . __( 'No' ) . '</option><option value="1"';
|
127 |
+
if ( attribute_escape( $instance[ 'loop' ] ) == '1' ) { echo " selected='selected'"; }
|
128 |
+
echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
|
129 |
|
130 |
echo "</table>\n";
|
|
|
131 |
?>
|
132 |
+
<h4><?php _e( 'Non-EmbedPlus & HTML5 Options' ); ?></h4>
|
133 |
<?php
|
134 |
|
135 |
echo "<table>\n";
|
137 |
// Annotation field
|
138 |
$field_id = $this -> get_field_id( 'annotation' );
|
139 |
$field_name = $this -> get_field_name( 'annotation' );
|
140 |
+
echo "\r\n" . '<tr><td width="100%">' . __( 'Annotations' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
|
141 |
+
if ( attribute_escape( $instance[ 'annotation' ] ) == '' ) { echo " selected='selected'"; }
|
142 |
+
echo '>' . __( 'Profile default' ) . '</option><option value="0"';
|
143 |
+
if ( attribute_escape( $instance[ 'annotation' ] ) == '0' ) { echo " selected='selected'"; }
|
144 |
+
echo '>' . __( 'No' ) . '</option><option value="1"';
|
145 |
+
if ( attribute_escape( $instance[ 'annotation' ] ) == '1' ) { echo " selected='selected'"; }
|
146 |
+
echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
|
147 |
|
148 |
// Closed Caption field
|
149 |
$field_id = $this -> get_field_id( 'cc' );
|
150 |
$field_name = $this -> get_field_name( 'cc' );
|
151 |
+
echo "\r\n" . '<tr><td width="100%">' . __( 'Closed Captions' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
|
152 |
+
if ( attribute_escape( $instance[ 'cc' ] ) == '' ) { echo " selected='selected'"; }
|
153 |
+
echo '>' . __( 'Profile default' ) . '</option><option value="0"';
|
154 |
+
if ( attribute_escape( $instance[ 'cc' ] ) == '0' ) { echo " selected='selected'"; }
|
155 |
+
echo '>' . __( 'No' ) . '</option><option value="1"';
|
156 |
+
if ( attribute_escape( $instance[ 'cc' ] ) == '1' ) { echo " selected='selected'"; }
|
157 |
+
echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
|
158 |
|
159 |
// Disable keyboard field
|
160 |
$field_id = $this -> get_field_id( 'disablekb' );
|
161 |
$field_name = $this -> get_field_name( 'disablekb' );
|
162 |
+
echo "\r\n" . '<tr><td width="100%">' . __( 'Disable Keyboard' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
|
163 |
+
if ( attribute_escape( $instance[ 'disablekb' ] ) == '' ) { echo " selected='selected'"; }
|
164 |
+
echo '>' . __( 'Profile default' ) . '</option><option value="0"';
|
165 |
+
if ( attribute_escape( $instance[ 'disablekb' ] ) == '0' ) { echo " selected='selected'"; }
|
166 |
+
echo '>' . __( 'No' ) . '</option><option value="1"';
|
167 |
+
if ( attribute_escape( $instance[ 'disablekb' ] ) == '1' ) { echo " selected='selected'"; }
|
168 |
+
echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
|
169 |
|
170 |
// Fullscreen field
|
171 |
$field_id = $this -> get_field_id( 'fullscreen' );
|
172 |
$field_name = $this -> get_field_name( 'fullscreen' );
|
173 |
+
echo "\r\n" . '<tr><td width="100%">' . __( 'Fullscreen' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
|
174 |
+
if ( attribute_escape( $instance[ 'fullscreen' ] ) == '' ) { echo " selected='selected'"; }
|
175 |
+
echo '>' . __( 'Profile default' ) . '</option><option value="0"';
|
176 |
+
if ( attribute_escape( $instance[ 'fullscreen' ] ) == '0' ) { echo " selected='selected'"; }
|
177 |
+
echo '>' . __( 'No' ) . '</option><option value="1"';
|
178 |
+
if ( attribute_escape( $instance[ 'fullscreen' ] ) == '1' ) { echo " selected='selected'"; }
|
179 |
+
echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
|
180 |
|
181 |
// Information field
|
182 |
$field_id = $this -> get_field_id( 'info' );
|
183 |
$field_name = $this -> get_field_name( 'info' );
|
184 |
+
echo "\r\n" . '<tr><td width="100%">' . __( 'Information' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
|
185 |
+
if ( attribute_escape( $instance[ 'info' ] ) == '' ) { echo " selected='selected'"; }
|
186 |
+
echo '>' . __( 'Profile default' ) . '</option><option value="0"';
|
187 |
+
if ( attribute_escape( $instance[ 'info' ] ) == '0' ) { echo " selected='selected'"; }
|
188 |
+
echo '>' . __( 'No' ) . '</option><option value="1"';
|
189 |
+
if ( attribute_escape( $instance[ 'info' ] ) == '1' ) { echo " selected='selected'"; }
|
190 |
+
echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
|
191 |
|
192 |
// YouTube Link field
|
193 |
$field_id = $this -> get_field_id( 'link' );
|
194 |
$field_name = $this -> get_field_name( 'link' );
|
195 |
+
echo "\r\n" . '<tr><td width="100%">' . __( 'Link to YouTube' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
|
196 |
+
if ( attribute_escape( $instance[ 'link' ] ) == '' ) { echo " selected='selected'"; }
|
197 |
+
echo '>' . __( 'Profile default' ) . '</option><option value="0"';
|
198 |
+
if ( attribute_escape( $instance[ 'link' ] ) == '0' ) { echo " selected='selected'"; }
|
199 |
+
echo '>' . __( 'No' ) . '</option><option value="1"';
|
200 |
+
if ( attribute_escape( $instance[ 'link' ] ) == '1' ) { echo " selected='selected'"; }
|
201 |
+
echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
|
202 |
|
203 |
// Related videos field
|
204 |
$field_id = $this -> get_field_id( 'related' );
|
205 |
$field_name = $this -> get_field_name( 'related' );
|
206 |
+
echo "\r\n" . '<tr><td width="100%">' . __( 'Related Videos' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
|
207 |
+
if ( attribute_escape( $instance[ 'related' ] ) == '' ) { echo " selected='selected'"; }
|
208 |
+
echo '>' . __( 'Profile default' ) . '</option><option value="0"';
|
209 |
+
if ( attribute_escape( $instance[ 'related' ] ) == '0' ) { echo " selected='selected'"; }
|
210 |
+
echo '>' . __( 'No' ) . '</option><option value="1"';
|
211 |
+
if ( attribute_escape( $instance[ 'related' ] ) == '1' ) { echo " selected='selected'"; }
|
212 |
+
echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
|
213 |
|
214 |
echo "</table>\n";
|
215 |
|
217 |
<h4><?php _e('EmbedPlus Options'); ?></h4>
|
218 |
<?php
|
219 |
|
220 |
+
echo "<table>\n";
|
221 |
+
|
222 |
// Stop field
|
223 |
$field_id = $this -> get_field_id( 'stop' );
|
224 |
$field_name = $this -> get_field_name( 'stop' );
|
225 |
+
echo "\r\n" . '<tr><td width="100%">' . __( 'Stop (seconds)' ) . '</td><td><input type="text" size="3" maxlength="3" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape( $instance[ 'stop' ] ) . '" /></td></tr>';
|
|
|
|
|
226 |
|
227 |
// HD field
|
228 |
$field_id = $this -> get_field_id( 'hd' );
|
229 |
$field_name = $this -> get_field_name( 'hd' );
|
230 |
+
echo "\r\n" . '<tr><td width="100%">' . __( 'Play HD' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
|
231 |
+
if ( attribute_escape( $instance[ 'hd' ] ) == '' ) { echo " selected='selected'"; }
|
232 |
+
echo '>' . __( 'Profile default' ) . '</option><option value="0"';
|
233 |
+
if ( attribute_escape( $instance[ 'hd' ] ) == '0' ) { echo " selected='selected'"; }
|
234 |
+
echo '>' . __( 'No' ) . '</option><option value="1"';
|
235 |
+
if ( attribute_escape( $instance[ 'hd' ] ) == '1' ) { echo " selected='selected'"; }
|
236 |
+
echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
|
237 |
|
238 |
// Reactions field
|
239 |
$field_id = $this -> get_field_id( 'react' );
|
240 |
$field_name = $this -> get_field_name( 'react' );
|
241 |
+
echo "\r\n" . '<tr><td width="100%">' . __( 'Real-time Reactions' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
|
242 |
+
if ( attribute_escape( $instance[ 'react' ] ) == '' ) { echo " selected='selected'"; }
|
243 |
+
echo '>' . __( 'Profile default' ) . '</option><option value="0"';
|
244 |
+
if ( attribute_escape( $instance[ 'react' ] ) == '0' ) { echo " selected='selected'"; }
|
245 |
+
echo '>' . __( 'No' ) . '</option><option value="1"';
|
246 |
+
if ( attribute_escape( $instance[ 'react' ] ) == '1' ) { echo " selected='selected'"; }
|
247 |
+
echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
|
248 |
|
249 |
// Sweetspot field
|
250 |
$field_id = $this -> get_field_id( 'sweetspot' );
|
251 |
$field_name = $this -> get_field_name( 'sweetspot' );
|
252 |
+
echo "\r\n" . '<tr><td width="100%">' . __( 'Sweet Spots' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
|
253 |
+
if ( attribute_escape( $instance[ 'sweetspot' ] ) == '' ) { echo " selected='selected'"; }
|
254 |
+
echo '>' . __( 'Profile default' ) . '</option><option value="0"';
|
255 |
+
if ( attribute_escape( $instance[ 'sweetspot' ] ) == '0' ) { echo " selected='selected'"; }
|
256 |
+
echo '>' . __( 'No' ) . '</option><option value="1"';
|
257 |
+
if ( attribute_escape( $instance[ 'sweetspot' ] ) == '1' ) { echo " selected='selected'"; }
|
258 |
+
echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
|
259 |
|
260 |
echo "</table>\n";
|
261 |
?>
|
includes/shared.php
CHANGED
@@ -47,6 +47,8 @@ function ye_get_parameters( $input, $para ) {
|
|
47 |
|
48 |
function ye_extract_id( $id ) {
|
49 |
|
|
|
|
|
50 |
// Check if it's the full URL, as found in address bar
|
51 |
$video_pos = strpos( $id, 'youtube.com/watch?', 0 );
|
52 |
|
@@ -60,7 +62,7 @@ function ye_extract_id( $id ) {
|
|
60 |
}
|
61 |
|
62 |
} else {
|
63 |
-
|
64 |
// Now check to see if it's a full URL, as used in the embed code
|
65 |
// Need to check both video and playlist formats
|
66 |
$video_pos = strpos( $id, "youtube.com/v/" );
|
@@ -74,13 +76,28 @@ function ye_extract_id( $id ) {
|
|
74 |
} else {
|
75 |
$id = substr( $id, $video_pos, $qmark_pos - $video_pos );
|
76 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
}
|
78 |
}
|
79 |
|
80 |
// Convert video ID characters
|
81 |
$id = str_replace( '–', '--', $id );
|
82 |
$id = str_replace( '×', 'x', $id );
|
83 |
-
|
84 |
return $id;
|
85 |
}
|
86 |
|
47 |
|
48 |
function ye_extract_id( $id ) {
|
49 |
|
50 |
+
$id = strip_tags( $id );
|
51 |
+
|
52 |
// Check if it's the full URL, as found in address bar
|
53 |
$video_pos = strpos( $id, 'youtube.com/watch?', 0 );
|
54 |
|
62 |
}
|
63 |
|
64 |
} else {
|
65 |
+
|
66 |
// Now check to see if it's a full URL, as used in the embed code
|
67 |
// Need to check both video and playlist formats
|
68 |
$video_pos = strpos( $id, "youtube.com/v/" );
|
76 |
} else {
|
77 |
$id = substr( $id, $video_pos, $qmark_pos - $video_pos );
|
78 |
}
|
79 |
+
|
80 |
+
} else {
|
81 |
+
|
82 |
+
// Check if it's a shortened URL
|
83 |
+
$video_pos = strpos( $id, 'youtu.be/', 0 );
|
84 |
+
|
85 |
+
if ( $video_pos !== false ) {
|
86 |
+
$video_pos = $video_pos + 9;
|
87 |
+
$ampersand_pos = strpos( $id, '&', $video_pos );
|
88 |
+
if ( !$ampersand_pos ) {
|
89 |
+
$id = substr( $id, $video_pos );
|
90 |
+
} else {
|
91 |
+
$id = substr( $id, $video_pos, $ampersand_pos - $video_pos );
|
92 |
+
}
|
93 |
+
}
|
94 |
}
|
95 |
}
|
96 |
|
97 |
// Convert video ID characters
|
98 |
$id = str_replace( '–', '--', $id );
|
99 |
$id = str_replace( '×', 'x', $id );
|
100 |
+
|
101 |
return $id;
|
102 |
}
|
103 |
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://artiss.co.uk/donate
|
|
4 |
Tags: admin, annotations, artiss, automatic, editor, embed, embedding, embedplus, flash, flv, google, hd, height, iframe, manage, media, plugin, page, play, playlist, post, profile, sidebar, simple, url, valid, video, widget,width, xhtml, youtube, youtuber
|
5 |
Requires at least: 2.9
|
6 |
Tested up to: 3.2.1
|
7 |
-
Stable tag: 2.0.
|
8 |
|
9 |
A simple to use method of embedding YouTube videos into your posts and pages but with powerful features for those that need them.
|
10 |
|
@@ -357,6 +357,7 @@ That's correct - all Artiss plugins will now add this feature to keep you up-to-
|
|
357 |
3. The profiles screen.
|
358 |
4. The lists screen - videos have been added and validated. The drop-down help is also shown.
|
359 |
5. The About screen
|
|
|
360 |
|
361 |
== Changelog ==
|
362 |
|
@@ -417,13 +418,24 @@ That's correct - all Artiss plugins will now add this feature to keep you up-to-
|
|
417 |
* Many, many more changes - too many to list!
|
418 |
|
419 |
= 2.0.1 =
|
420 |
-
* Changed cache key encoding so that it was compatible with PHP 4
|
421 |
-
*
|
422 |
-
*
|
423 |
-
*
|
424 |
-
*
|
425 |
-
*
|
426 |
-
* Added random ID to EmbedPlus output to resolve a bug that can affect IE users
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
427 |
|
428 |
== Upgrade Notice ==
|
429 |
|
@@ -458,4 +470,7 @@ That's correct - all Artiss plugins will now add this feature to keep you up-to-
|
|
458 |
* Upgrade to take advantage of many new features. Code completely re-written
|
459 |
|
460 |
= 2.0.1 =
|
461 |
-
* Update to fix a few minor bugs found in 2.0 and add a couple of small enhancements
|
|
|
|
|
|
4 |
Tags: admin, annotations, artiss, automatic, editor, embed, embedding, embedplus, flash, flv, google, hd, height, iframe, manage, media, plugin, page, play, playlist, post, profile, sidebar, simple, url, valid, video, widget,width, xhtml, youtube, youtuber
|
5 |
Requires at least: 2.9
|
6 |
Tested up to: 3.2.1
|
7 |
+
Stable tag: 2.0.2
|
8 |
|
9 |
A simple to use method of embedding YouTube videos into your posts and pages but with powerful features for those that need them.
|
10 |
|
357 |
3. The profiles screen.
|
358 |
4. The lists screen - videos have been added and validated. The drop-down help is also shown.
|
359 |
5. The About screen
|
360 |
+
6. The default widget options
|
361 |
|
362 |
== Changelog ==
|
363 |
|
418 |
* Many, many more changes - too many to list!
|
419 |
|
420 |
= 2.0.1 =
|
421 |
+
* Enhancement: Changed cache key encoding so that it was compatible with PHP 4
|
422 |
+
* Enhancement: Added autoplay option to EmbedPlus
|
423 |
+
* Enhancement: Re-instated `style` option, allowing you to apply a direct set of CSS elements to the output - a requirement if you wish to add a border to the video, for instance
|
424 |
+
* Maintenance: Updated screens and documentation to show the `start` parameter works with EmbedPlus
|
425 |
+
* Bug: Fixed incorrect caching of options - was only changing if override parameters were modified
|
426 |
+
* Bug: Video Information Cache will no longer reset to zero if the Embed cache is greater
|
427 |
+
* Bug: Added random ID to EmbedPlus output to resolve a bug that can affect IE users
|
428 |
+
|
429 |
+
= 2.0.2 =
|
430 |
+
* Enhancement: Strip tags from video ID, in case any have crept in
|
431 |
+
* Enhancement: Tidied some of the widget controls
|
432 |
+
* Enhancement: You can now specify YouTube short URLs as video IDs
|
433 |
+
* Bug: Removed reference to jscolor.js script, which isn't used
|
434 |
+
* Bug: Video IDs beginning with numbers are being confused with list numbers
|
435 |
+
* Bug: Corrected problem with random single videos being picked from a list
|
436 |
+
* Bug: Fixed problem with list where one video was being ignored and another repeated
|
437 |
+
* Bug: Modified widget code to allow for all states to be allowable. Defaults updated
|
438 |
+
* Bug: YouTube documentation states that if you don't specify the fullscreen parameter it will default to off. It doesn't. Corrected in the code
|
439 |
|
440 |
== Upgrade Notice ==
|
441 |
|
470 |
* Upgrade to take advantage of many new features. Code completely re-written
|
471 |
|
472 |
= 2.0.1 =
|
473 |
+
* Update to fix a few minor bugs found in 2.0 and add a couple of small enhancements
|
474 |
+
|
475 |
+
= 2.0.2 =
|
476 |
+
* Further update to fix a few minor bugs found in 2.0. A few small enhancements have also been made.
|
screenshot-6.png
ADDED
Binary file
|
youtube-embed.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Artiss YouTube Embed
|
4 |
Plugin URI: http://www.artiss.co.uk/artiss-youtube-embed
|
5 |
Description: Embed YouTube Videos in WordPress
|
6 |
-
Version: 2.0.
|
7 |
Author: David Artiss
|
8 |
Author URI: http://www.artiss.co.uk
|
9 |
*/
|
@@ -17,7 +17,7 @@ Author URI: http://www.artiss.co.uk
|
|
17 |
* @since 2.0
|
18 |
*/
|
19 |
|
20 |
-
define( 'youtube_embed_version', '2.0' );
|
21 |
|
22 |
$functions_dir = WP_PLUGIN_DIR . '/youtube-embed/includes/';
|
23 |
|
3 |
Plugin Name: Artiss YouTube Embed
|
4 |
Plugin URI: http://www.artiss.co.uk/artiss-youtube-embed
|
5 |
Description: Embed YouTube Videos in WordPress
|
6 |
+
Version: 2.0.2
|
7 |
Author: David Artiss
|
8 |
Author URI: http://www.artiss.co.uk
|
9 |
*/
|
17 |
* @since 2.0
|
18 |
*/
|
19 |
|
20 |
+
define( 'youtube_embed_version', '2.0.2' );
|
21 |
|
22 |
$functions_dir = WP_PLUGIN_DIR . '/youtube-embed/includes/';
|
23 |
|