Version Description
- Changed cache key encoding so that it was compatible with PHP 4
- Fixed incorrect caching of options - was only changing if override parameters were modified
- Video Information Cache will no longer reset to zero if the Embed cache is greater
- Added autoplay option to EmbedPlus
- Updated screens and documentation to show the
start
parameter works with EmbedPlus - 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 - Added random ID to EmbedPlus output to resolve a bug that can affect IE users
=
Download this release
Release Info
Developer | dartiss |
Plugin | YouTube Embed |
Version | 2.0.1 |
Comparing to | |
See all releases |
Code changes from version 2.0 to 2.0.1
- images/Thumbs.db +0 -0
- includes/generate-embed-code.php +8 -13
- includes/options-general.php +0 -7
- includes/options-profiles.php +11 -6
- includes/options-widgets.php +20 -15
- includes/set-option-defaults.php +2 -3
- includes/widgets.php +2 -1
- readme.txt +24 -7
- screenshot-2.png +0 -0
- screenshot-3.png +0 -0
- youtube-embed.php +1 -1
images/Thumbs.db
DELETED
Binary file
|
includes/generate-embed-code.php
CHANGED
@@ -120,7 +120,7 @@ function ye_generate_youtube_code( $id = '', $type = '', $width = '', $height =
|
|
120 |
}
|
121 |
|
122 |
// Generate a cache key for the above passed parameters
|
123 |
-
$cache_key = 'ye_video_' . base64_encode( sha1( $id . $type . $width . $height . $fullscreen . $related . $autoplay . $loop . $start . $info . $annotation . $cc . $style . $link . $react . $stop . $sweetspot . $disablekb . $ratio . $autohide . $controls . $profile . $list_style . $audio . $template . $hd . $general . $options . $list, true ) );
|
124 |
|
125 |
// Try and get the output from cache. If it exists, return the code
|
126 |
if ( ( $general[ 'embed_cache' ] != 0 ) && ( !is_feed() ) ) {
|
@@ -165,18 +165,13 @@ function ye_generate_youtube_code( $id = '', $type = '', $width = '', $height =
|
|
165 |
if ( $controls == '' ) { $controls = $options[ 'controls' ]; }
|
166 |
if ( $audio == '' ) { $audio = $options[ 'audio' ]; }
|
167 |
if ( $hd == '' ) { $hd = $options[ 'hd' ]; }
|
|
|
168 |
|
169 |
$wmode = $options[ 'wmode' ];
|
170 |
$shadow = $options[ 'shadow' ];
|
171 |
|
172 |
-
//
|
173 |
-
if ( $template == '' ) {
|
174 |
-
if ( $style == '' ) {
|
175 |
-
$template = $options[ 'template' ];
|
176 |
-
} else {
|
177 |
-
$template = '<div style="' . $style . '">%video%</div>';
|
178 |
-
}
|
179 |
-
}
|
180 |
if ( strpos( $template, '%video%' ) === false ) { $template = '%video%'; }
|
181 |
|
182 |
// If a multi-play list has been specified and EmbedPlus selected, use fallback embedding method instead
|
@@ -249,7 +244,7 @@ function ye_generate_youtube_code( $id = '', $type = '', $width = '', $height =
|
|
249 |
// Generate parameters to add to URL
|
250 |
if ( $fullscreen == 1 ) { $paras .= '&fs=1'; }
|
251 |
if ( $related != 1 ) { $paras .= '&rel=0'; }
|
252 |
-
if ( $autoplay == 1 ) { $paras .= '&autoplay=1'; }
|
253 |
if ( $loop == 1 ) { $paras .= '&loop=1'; }
|
254 |
if ( $info == 1 ) { $paras .= '&showinfo=1'; }
|
255 |
if ( $annotation != 1 ) { $paras .= '&iv_load_policy=3'; }
|
@@ -275,7 +270,7 @@ function ye_generate_youtube_code( $id = '', $type = '', $width = '', $height =
|
|
275 |
|
276 |
// Add EmbedPlus code
|
277 |
if ( $embedplus ) {
|
278 |
-
$result .= "<object type=\"application/x-shockwave-flash\" width=\"" . $width . "\" height=\"" . $embedheight . "\" data=\"http://getembedplus.com/embedplus.swf\">\n";
|
279 |
$result .= "\t<param value=\"http://getembedplus.com/embedplus.swf\" name=\"movie\" />\n";
|
280 |
$result .= "\t<param value=\"high\" name=\"quality\" />\n";
|
281 |
$result .= "\t<param value=\"" . $wmode . "\" name=\"wmode\" />\n";
|
@@ -286,7 +281,7 @@ function ye_generate_youtube_code( $id = '', $type = '', $width = '', $height =
|
|
286 |
|
287 |
// Add AS3 YouTube embed code
|
288 |
if ( ( $swf ) or ( ( $embedplus ) && ( ( $fallback == 'o' ) or ( $fallback == 'p' ) ) ) ) {
|
289 |
-
$result .= $tab . "<object class=\"" . $class . "\" type=\"application/x-shockwave-flash\" data=\"http://www.youtube.com/" . $embed_type . "/" . $id . $paras . "\" width=\"" . $width . "\" height=\"" . $height . "\"";
|
290 |
if ( $metadata != 0 ) { $result .= " rel=\"media:video\" resource=\"http://www.youtube.com/" . $embed_type . "/" . $id ."\" xmlns:media=\"http://search.yahoo.com/searchmonkey/media/\""; }
|
291 |
$result .= ">\n";
|
292 |
if ( $metadata != 0 ) { $result .= $tab . "\t<a rel=\"media:thumbnail\" href=\"http://img.youtube.com/vi/" . $id . "/default.jpg\" />\n"; }
|
@@ -301,7 +296,7 @@ function ye_generate_youtube_code( $id = '', $type = '', $width = '', $height =
|
|
301 |
// Add IFRAME embed code
|
302 |
if ( ( $iframe ) or ( ( $embedplus ) && ( $fallback == "v" ) ) ) {
|
303 |
if ( $embed_type == "p" ) { $playlist_para = "p/"; } else { $playlist_para = ''; }
|
304 |
-
$result .= $tab . '<iframe style="border: 0" class="' . $class . '" width="' . $width . '" height="' . $height . '" src="http://www.youtube.com/embed/' . $playlist_para . $id . '?' . substr( $paras, 1 ) . '&wmode=' . $wmode . '"';
|
305 |
if ( $fullscreen == 1 ) { $result .= ' allowfullscreen="allowfullscreen"'; }
|
306 |
$result .= "></iframe>\n";
|
307 |
}
|
120 |
}
|
121 |
|
122 |
// Generate a cache key for the above passed parameters
|
123 |
+
$cache_key = 'ye_video_' . base64_encode( sha1( $id . $type . $width . $height . $fullscreen . $related . $autoplay . $loop . $start . $info . $annotation . $cc . $style . $link . $react . $stop . $sweetspot . $disablekb . $ratio . $autohide . $controls . $profile . $list_style . $audio . $template . $hd . print_r( $general, true ) . print_r( $options, true ) . print_r( $list, true ) ) );
|
124 |
|
125 |
// Try and get the output from cache. If it exists, return the code
|
126 |
if ( ( $general[ 'embed_cache' ] != 0 ) && ( !is_feed() ) ) {
|
165 |
if ( $controls == '' ) { $controls = $options[ 'controls' ]; }
|
166 |
if ( $audio == '' ) { $audio = $options[ 'audio' ]; }
|
167 |
if ( $hd == '' ) { $hd = $options[ 'hd' ]; }
|
168 |
+
if ( $style == '' ) { $style = $options[ 'style' ]; }
|
169 |
|
170 |
$wmode = $options[ 'wmode' ];
|
171 |
$shadow = $options[ 'shadow' ];
|
172 |
|
173 |
+
// Build the required template
|
174 |
+
if ( $template == '' ) { $template = $options[ 'template' ]; }
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
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'; }
|
249 |
if ( $info == 1 ) { $paras .= '&showinfo=1'; }
|
250 |
if ( $annotation != 1 ) { $paras .= '&iv_load_policy=3'; }
|
270 |
|
271 |
// Add EmbedPlus code
|
272 |
if ( $embedplus ) {
|
273 |
+
$result .= "<object type=\"application/x-shockwave-flash\" width=\"" . $width . "\" height=\"" . $embedheight . "\" data=\"http://getembedplus.com/embedplus.swf\" style=\"" . $style . "\" id=\"" . uniqid( 'ep_', true ) . "\">\n";
|
274 |
$result .= "\t<param value=\"http://getembedplus.com/embedplus.swf\" name=\"movie\" />\n";
|
275 |
$result .= "\t<param value=\"high\" name=\"quality\" />\n";
|
276 |
$result .= "\t<param value=\"" . $wmode . "\" name=\"wmode\" />\n";
|
281 |
|
282 |
// Add AS3 YouTube embed code
|
283 |
if ( ( $swf ) or ( ( $embedplus ) && ( ( $fallback == 'o' ) or ( $fallback == 'p' ) ) ) ) {
|
284 |
+
$result .= $tab . "<object class=\"" . $class . "\" type=\"application/x-shockwave-flash\" data=\"http://www.youtube.com/" . $embed_type . "/" . $id . $paras . "\" width=\"" . $width . "\" height=\"" . $height . "\" style=\"" . $style . "\"";
|
285 |
if ( $metadata != 0 ) { $result .= " rel=\"media:video\" resource=\"http://www.youtube.com/" . $embed_type . "/" . $id ."\" xmlns:media=\"http://search.yahoo.com/searchmonkey/media/\""; }
|
286 |
$result .= ">\n";
|
287 |
if ( $metadata != 0 ) { $result .= $tab . "\t<a rel=\"media:thumbnail\" href=\"http://img.youtube.com/vi/" . $id . "/default.jpg\" />\n"; }
|
296 |
// Add IFRAME embed code
|
297 |
if ( ( $iframe ) or ( ( $embedplus ) && ( $fallback == "v" ) ) ) {
|
298 |
if ( $embed_type == "p" ) { $playlist_para = "p/"; } else { $playlist_para = ''; }
|
299 |
+
$result .= $tab . '<iframe style="border: 0;' . $style . '" class="' . $class . '" width="' . $width . '" height="' . $height . '" src="http://www.youtube.com/embed/' . $playlist_para . $id . '?' . substr( $paras, 1 ) . '&wmode=' . $wmode . '"';
|
300 |
if ( $fullscreen == 1 ) { $result .= ' allowfullscreen="allowfullscreen"'; }
|
301 |
$result .= "></iframe>\n";
|
302 |
}
|
includes/options-general.php
CHANGED
@@ -32,13 +32,6 @@ if ( ( !empty( $_POST ) ) && ( check_admin_referer( 'youtube-embed-general', 'yo
|
|
32 |
$options[ 'embed_cache' ] = $_POST[ 'youtube_embed_embed_cache' ];
|
33 |
$options[ 'info_cache' ] = $_POST[ 'youtube_embed_info_cache' ];
|
34 |
$options[ 'transcript_cache' ] = $_POST[ 'youtube_embed_transcript_cache' ];
|
35 |
-
|
36 |
-
// If an embed cache has been specified and the information cache is less,
|
37 |
-
// put it to zero to switch off
|
38 |
-
if ( ( $options[ 'embed_cache' ] != 0 ) && ( $options[ 'info_cache' ] <= $options[ 'embed_cache' ] ) ) {
|
39 |
-
$options[ 'info_cache' ] = 0;
|
40 |
-
}
|
41 |
-
|
42 |
$options[ 'fetch_title' ] = $_POST[ 'youtube_embed_fetch_title' ];
|
43 |
$options[ 'alt_profile' ] = $_POST[ 'youtube_embed_alt_profile' ];
|
44 |
$options[ 'alt_profile2' ] = $_POST[ 'youtube_embed_alt_profile2' ];
|
32 |
$options[ 'embed_cache' ] = $_POST[ 'youtube_embed_embed_cache' ];
|
33 |
$options[ 'info_cache' ] = $_POST[ 'youtube_embed_info_cache' ];
|
34 |
$options[ 'transcript_cache' ] = $_POST[ 'youtube_embed_transcript_cache' ];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
$options[ 'fetch_title' ] = $_POST[ 'youtube_embed_fetch_title' ];
|
36 |
$options[ 'alt_profile' ] = $_POST[ 'youtube_embed_alt_profile' ];
|
37 |
$options[ 'alt_profile2' ] = $_POST[ 'youtube_embed_alt_profile2' ];
|
includes/options-profiles.php
CHANGED
@@ -31,6 +31,7 @@ if ( ( !empty( $_POST[ 'Submit' ] ) ) && ( check_admin_referer( 'youtube-embed-p
|
|
31 |
$options[ 'template' ] = htmlspecialchars_decode( $_POST[ 'youtube_embed_template' ] );
|
32 |
if ( strpos( $options[ 'template' ], '%video%' ) === false ) { $options[ 'template' ] = '%video%'; }
|
33 |
|
|
|
34 |
$options[ 'fullscreen' ] = $_POST[ 'youtube_embed_fullscreen' ];
|
35 |
$options[ 'autoplay'] = $_POST[ 'youtube_embed_autoplay' ];
|
36 |
$options[ 'loop'] = $_POST[ 'youtube_embed_loop' ];
|
@@ -114,11 +115,15 @@ _e( '<br/>Use the drop-down on the right hand side to swap between profiles.' );
|
|
114 |
<br/><span class="yt_heading"><?php _e( 'All Embed Type Options' ); ?></span>
|
115 |
|
116 |
<table class="form-table">
|
117 |
-
|
118 |
<tr>
|
119 |
<th scope="row"><?php _e( 'Template' ); ?></th>
|
120 |
<td><input type="text" size="40" name="youtube_embed_template" value="<?php echo htmlspecialchars( $options[ 'template' ] ); ?>"/> <span class="description">Wrapper for video output. Must include <code>%video%</code> tag to show video position</span></td>
|
121 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
122 |
</table>
|
123 |
|
124 |
<table class="form-table ytbox_grey">
|
@@ -147,6 +152,11 @@ _e( '<br/>Use the drop-down on the right hand side to swap between profiles.' );
|
|
147 |
<td><input type="checkbox" name="youtube_embed_audio" value="1"<?php if ( $options[ 'audio' ] == "1" ) { echo ' checked="checked"'; } ?>/> <span class="description"><?php _e( 'Only show the toolbar for audio only playback' ); ?></span></td>
|
148 |
</tr>
|
149 |
|
|
|
|
|
|
|
|
|
|
|
150 |
<tr>
|
151 |
<th scope="row"><?php _e( 'Drop Shadow Height' ); ?></th>
|
152 |
<td><input type="text" size="2" name="youtube_embed_shadow" value="<?php echo $options[ 'shadow' ]; ?>"/>px <span class="description">Number of pixels high for drop-shadow. Put to 0 to switch off.</span></td>
|
@@ -167,11 +177,6 @@ _e( '<br/>Use the drop-down on the right hand side to swap between profiles.' );
|
|
167 |
</select> <span class="description"><?php _e( 'Video controls will automatically hide after a video begins playing' ); ?></span></td>
|
168 |
</tr>
|
169 |
|
170 |
-
<tr>
|
171 |
-
<th scope="row"><?php _e( 'Autoplay' ); ?></th>
|
172 |
-
<td><input type="checkbox" name="youtube_embed_autoplay" value="1"<?php if ( $options[ 'autoplay' ] == "1" ) { echo ' checked="checked"'; } ?>/> <span class="description"><?php _e( 'The video will start playing when the player loads' ); ?></span></td>
|
173 |
-
</tr>
|
174 |
-
|
175 |
<tr>
|
176 |
<th scope="row"><?php _e( 'Controls' ); ?></th>
|
177 |
<td><input type="checkbox" name="youtube_embed_controls" value="1"<?php if ( $options[ 'controls' ] == "1" ) { echo ' checked="checked"'; } ?>/> <span class="description"><?php _e( 'Video player controls will display' ); ?></span></td>
|
31 |
$options[ 'template' ] = htmlspecialchars_decode( $_POST[ 'youtube_embed_template' ] );
|
32 |
if ( strpos( $options[ 'template' ], '%video%' ) === false ) { $options[ 'template' ] = '%video%'; }
|
33 |
|
34 |
+
$options[ 'style' ] = $_POST[ 'youtube_embed_style' ];
|
35 |
$options[ 'fullscreen' ] = $_POST[ 'youtube_embed_fullscreen' ];
|
36 |
$options[ 'autoplay'] = $_POST[ 'youtube_embed_autoplay' ];
|
37 |
$options[ 'loop'] = $_POST[ 'youtube_embed_loop' ];
|
115 |
<br/><span class="yt_heading"><?php _e( 'All Embed Type Options' ); ?></span>
|
116 |
|
117 |
<table class="form-table">
|
|
|
118 |
<tr>
|
119 |
<th scope="row"><?php _e( 'Template' ); ?></th>
|
120 |
<td><input type="text" size="40" name="youtube_embed_template" value="<?php echo htmlspecialchars( $options[ 'template' ] ); ?>"/> <span class="description">Wrapper for video output. Must include <code>%video%</code> tag to show video position</span></td>
|
121 |
</tr>
|
122 |
+
|
123 |
+
<tr>
|
124 |
+
<th scope="row"><?php _e( 'Style' ); ?></th>
|
125 |
+
<td><input type="text" size="40" name="youtube_embed_style" value="<?php echo htmlspecialchars( $options[ 'style' ] ); ?>"/> <span class="description">CSS elements to apply to video</span></td>
|
126 |
+
</tr>
|
127 |
</table>
|
128 |
|
129 |
<table class="form-table ytbox_grey">
|
152 |
<td><input type="checkbox" name="youtube_embed_audio" value="1"<?php if ( $options[ 'audio' ] == "1" ) { echo ' checked="checked"'; } ?>/> <span class="description"><?php _e( 'Only show the toolbar for audio only playback' ); ?></span></td>
|
153 |
</tr>
|
154 |
|
155 |
+
<tr>
|
156 |
+
<th scope="row"><?php _e( 'Autoplay' ); ?></th>
|
157 |
+
<td><input type="checkbox" name="youtube_embed_autoplay" value="1"<?php if ( $options[ 'autoplay' ] == "1" ) { echo ' checked="checked"'; } ?>/> <span class="description"><?php _e( 'The video will start playing when the player loads' ); ?></span></td>
|
158 |
+
</tr>
|
159 |
+
|
160 |
<tr>
|
161 |
<th scope="row"><?php _e( 'Drop Shadow Height' ); ?></th>
|
162 |
<td><input type="text" size="2" name="youtube_embed_shadow" value="<?php echo $options[ 'shadow' ]; ?>"/>px <span class="description">Number of pixels high for drop-shadow. Put to 0 to switch off.</span></td>
|
177 |
</select> <span class="description"><?php _e( 'Video controls will automatically hide after a video begins playing' ); ?></span></td>
|
178 |
</tr>
|
179 |
|
|
|
|
|
|
|
|
|
|
|
180 |
<tr>
|
181 |
<th scope="row"><?php _e( 'Controls' ); ?></th>
|
182 |
<td><input type="checkbox" name="youtube_embed_controls" value="1"<?php if ( $options[ 'controls' ] == "1" ) { echo ' checked="checked"'; } ?>/> <span class="description"><?php _e( 'Video player controls will display' ); ?></span></td>
|
includes/options-widgets.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
// Set default options
|
3 |
-
$default = array( 'titles' => 'YouTube', 'id' => '', 'type' => 'v', 'width' => '320', 'height' => '240', 'fullscreen' => '', 'related' => '', 'autoplay' => '', 'loop' => '', 'start' => '', 'info' => '1', 'annotation' => '1', 'cc' => '', 'link' => '1', 'react' => '1', 'stop' => '', 'sweetspot' => '1', 'disablekb' => '', 'autohide' => '2', 'controls' => '1', 'profile' => '0', 'list' => '', 'template' => '%video%', 'hd' => '1' );
|
4 |
$instance = wp_parse_args( ( array ) $instance, $default );
|
5 |
$general = ye_set_general_defaults();
|
6 |
|
@@ -37,6 +37,11 @@ $field_id = $this -> get_field_id( 'template' );
|
|
37 |
$field_name = $this -> get_field_name( 'template' );
|
38 |
echo "\r\n" . '<p><label for="' . $field_id . '">'.__( 'Template' ).': </label><input type="text" class="widefat" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape( $instance[ 'template' ] ) . '" /></p>';
|
39 |
|
|
|
|
|
|
|
|
|
|
|
40 |
// Size fields
|
41 |
$field_id = $this -> get_field_id( 'width' );
|
42 |
$field_name = $this -> get_field_name( 'width' );
|
@@ -46,15 +51,22 @@ $field_id = $this -> get_field_id( 'height' );
|
|
46 |
$field_name = $this -> get_field_name( 'height' );
|
47 |
echo '<input type="text" size="3" maxlength="3" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape( $instance[ 'height' ] ) . '" /> pixels</p>';
|
48 |
|
49 |
-
|
50 |
-
|
51 |
-
|
|
|
|
|
|
|
52 |
|
53 |
// Start field
|
54 |
$field_id = $this -> get_field_id( 'start' );
|
55 |
$field_name = $this -> get_field_name( 'start' );
|
56 |
echo "\r\n" . '<p><label for="' . $field_id . '">' . __( 'Start' ) . ': </label><input type="text" size="3" maxlength="3" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape( $instance[ 'start' ] ) . '" /> seconds</p>';
|
57 |
|
|
|
|
|
|
|
|
|
58 |
// Autohide field
|
59 |
$field_id = $this -> get_field_id( 'autohide' );
|
60 |
$field_name = $this -> get_field_name( 'autohide' );
|
@@ -69,23 +81,16 @@ echo '>' . __( 'Progress bar fades' ) . '</option></select></p>';
|
|
69 |
// List field
|
70 |
$field_id = $this -> get_field_id( 'list' );
|
71 |
$field_name = $this -> get_field_name( 'list' );
|
72 |
-
echo "\r\n" . '<p><label for="' . $field_id . '">' . __( 'List Playback' ) . ': </label><select name="' . $field_name . '" class="widefat" id="' . $field_id . '"><option value="
|
73 |
-
if ( attribute_escape( $instance[ 'list' ] ) == '' ) { echo " selected='selected'"; }
|
74 |
-
echo '>' . __( 'Play each video in order' ) . '</option><option value="
|
75 |
if ( attribute_escape( $instance[ 'list' ] ) == 'random' ) { echo " selected='selected'"; }
|
76 |
-
echo '>' . __( 'Play videos randomly' ) . '</option><option value="
|
77 |
if ( attribute_escape( $instance[ 'list' ] ) == 'single' ) { echo " selected='selected'"; }
|
78 |
echo '>' . __( 'Play one random video' ) . '</option></select></p>';
|
79 |
|
80 |
echo "<table>\n";
|
81 |
|
82 |
-
// Autoplay field
|
83 |
-
$field_id = $this -> get_field_id( 'autoplay' );
|
84 |
-
$field_name = $this -> get_field_name( 'autoplay' );
|
85 |
-
echo "\r\n" . '<tr><td width="100%">' . __( 'Autoplay' ) . '</td><td><input type="checkbox" name="' . $field_name . '" id="' . $field_id . '" value="1" ';
|
86 |
-
if ( attribute_escape( $instance[ 'autoplay' ] ) == '1') { echo "checked='checked' "; }
|
87 |
-
echo '/></td></tr>';
|
88 |
-
|
89 |
// Controls field
|
90 |
$field_id = $this -> get_field_id( 'controls' );
|
91 |
$field_name = $this -> get_field_name( 'controls' );
|
1 |
<?php
|
2 |
// Set default options
|
3 |
+
$default = array( 'titles' => 'YouTube', 'id' => '', 'type' => 'v', 'width' => '320', 'height' => '240', 'fullscreen' => '', 'related' => '', 'autoplay' => '', 'loop' => '', 'start' => '', 'info' => '1', 'annotation' => '1', 'cc' => '', 'link' => '1', 'react' => '1', 'stop' => '', 'sweetspot' => '1', 'disablekb' => '', 'autohide' => '2', 'controls' => '1', 'profile' => '0', 'list' => '', 'template' => '%video%', 'hd' => '1', 'style' => '' );
|
4 |
$instance = wp_parse_args( ( array ) $instance, $default );
|
5 |
$general = ye_set_general_defaults();
|
6 |
|
37 |
$field_name = $this -> get_field_name( 'template' );
|
38 |
echo "\r\n" . '<p><label for="' . $field_id . '">'.__( 'Template' ).': </label><input type="text" class="widefat" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape( $instance[ 'template' ] ) . '" /></p>';
|
39 |
|
40 |
+
// Style
|
41 |
+
$field_id = $this -> get_field_id( 'style' );
|
42 |
+
$field_name = $this -> get_field_name( 'style' );
|
43 |
+
echo "\r\n" . '<p><label for="' . $field_id . '">'.__( 'Style' ).': </label><input type="text" class="widefat" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape( $instance[ 'style' ] ) . '" /></p>';
|
44 |
+
|
45 |
// Size fields
|
46 |
$field_id = $this -> get_field_id( 'width' );
|
47 |
$field_name = $this -> get_field_name( 'width' );
|
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 |
+
// Autoplay field
|
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" . '<p><label for="' . $field_id . '">' . __( 'Start' ) . ': </label><input type="text" size="3" maxlength="3" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape( $instance[ 'start' ] ) . '" /> seconds</p>';
|
65 |
|
66 |
+
?>
|
67 |
+
<h4><?php _e( 'Non-EmbedPlus Options' ); ?></h4>
|
68 |
+
<?php
|
69 |
+
|
70 |
// Autohide field
|
71 |
$field_id = $this -> get_field_id( 'autohide' );
|
72 |
$field_name = $this -> get_field_name( 'autohide' );
|
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="order"';
|
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'"; }
|
88 |
+
echo '>' . __( 'Play videos randomly' ) . '</option><option value="single"';
|
89 |
if ( attribute_escape( $instance[ 'list' ] ) == 'single' ) { echo " selected='selected'"; }
|
90 |
echo '>' . __( 'Play one random video' ) . '</option></select></p>';
|
91 |
|
92 |
echo "<table>\n";
|
93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
// Controls field
|
95 |
$field_id = $this -> get_field_id( 'controls' );
|
96 |
$field_name = $this -> get_field_name( 'controls' );
|
includes/set-option-defaults.php
CHANGED
@@ -74,7 +74,7 @@ function ye_set_general_defaults() {
|
|
74 |
$changed = true;
|
75 |
} else {
|
76 |
// If array doesn't exist, set defaults
|
77 |
-
$options = array( 'editor_button' => 1, 'admin_bar' => 1, 'profile_no' => 5, 'list_no' => 5, 'info_cache' =>
|
78 |
$changed = true;
|
79 |
}
|
80 |
}
|
@@ -137,11 +137,10 @@ function ye_set_profile_defaults( $profile ) {
|
|
137 |
$old_opts = get_option( 'youtube_embed' );
|
138 |
$options = $old_opts;
|
139 |
delete_option( 'youtube_embed' );
|
140 |
-
if ( $options[ 'style' ] != '') { $options [ 'template' ] = '<div style="' . $options[ 'style' ] . '">%video%</div>';}
|
141 |
$changed = true;
|
142 |
} else {
|
143 |
// If array doesn't exist, set defaults
|
144 |
-
$options = array( 'width' => $width, 'height' => $height, 'fullscreen' => '', 'template' => '%video%', 'autoplay' => '', 'start' => '0', 'loop' => '', 'cc' => '', 'annotation' => '1', 'related' => '', 'info' => '1', 'link' => '1', 'react' => '1', 'stop' => '0', 'sweetspot' => '1', 'type' => 'v', 'disablekb' => '', 'autohide' => '2', 'controls' => '1', 'playlist' => 'v', 'fallback' => 'v', 'wmode' => 'opaque', 'shadow' => '0', 'audio' => '', 'hd' => '1' );
|
145 |
$changed = true;
|
146 |
}
|
147 |
}
|
74 |
$changed = true;
|
75 |
} else {
|
76 |
// If array doesn't exist, set defaults
|
77 |
+
$options = array( 'editor_button' => 1, 'admin_bar' => 1, 'profile_no' => 5, 'list_no' => 5, 'info_cache' => 1, 'embed_cache' => 24, 'transcript_cache' => 24, 'alt_profile' => 0, 'alt_profile2' => 0, 'bracket' => '', 'alt' => 0, 'url_profile' => 0, 'other_profile' => 0, 'comments' => '', 'comments_profile' => 0, 'metadata' => 1, 'feed' => 'b' );
|
78 |
$changed = true;
|
79 |
}
|
80 |
}
|
137 |
$old_opts = get_option( 'youtube_embed' );
|
138 |
$options = $old_opts;
|
139 |
delete_option( 'youtube_embed' );
|
|
|
140 |
$changed = true;
|
141 |
} else {
|
142 |
// If array doesn't exist, set defaults
|
143 |
+
$options = array( 'width' => $width, 'height' => $height, 'fullscreen' => '', 'template' => '%video%', 'autoplay' => '', 'start' => '0', 'loop' => '', 'cc' => '', 'annotation' => '1', 'related' => '', 'info' => '1', 'link' => '1', 'react' => '1', 'stop' => '0', 'sweetspot' => '1', 'type' => 'v', 'disablekb' => '', 'autohide' => '2', 'controls' => '1', 'playlist' => 'v', 'fallback' => 'v', 'wmode' => 'opaque', 'shadow' => '0', 'audio' => '', 'hd' => '1', 'style' => '' );
|
144 |
$changed = true;
|
145 |
}
|
146 |
}
|
includes/widgets.php
CHANGED
@@ -67,7 +67,7 @@ if ( ( float ) $wp_version >= 2.8 ) {
|
|
67 |
$instance[ 'info' ],
|
68 |
$instance[ 'annotation' ],
|
69 |
$instance[ 'cc' ],
|
70 |
-
'',
|
71 |
$instance[ 'link' ],
|
72 |
$instance[ 'react' ],
|
73 |
$instance[ 'stop' ],
|
@@ -114,6 +114,7 @@ if ( ( float ) $wp_version >= 2.8 ) {
|
|
114 |
$instance[ 'info' ] = $new_instance[ 'info' ];
|
115 |
$instance[ 'annotation' ] = $new_instance[ 'annotation' ];
|
116 |
$instance[ 'cc' ] = $new_instance[ 'cc' ];
|
|
|
117 |
$instance[ 'link' ] = $new_instance[ 'link' ];
|
118 |
$instance[ 'react' ] = $new_instance[ 'react' ];
|
119 |
$instance[ 'stop' ] = $new_instance[ 'stop' ];
|
67 |
$instance[ 'info' ],
|
68 |
$instance[ 'annotation' ],
|
69 |
$instance[ 'cc' ],
|
70 |
+
$instance[ 'style' ],
|
71 |
$instance[ 'link' ],
|
72 |
$instance[ 'react' ],
|
73 |
$instance[ 'stop' ],
|
114 |
$instance[ 'info' ] = $new_instance[ 'info' ];
|
115 |
$instance[ 'annotation' ] = $new_instance[ 'annotation' ];
|
116 |
$instance[ 'cc' ] = $new_instance[ 'cc' ];
|
117 |
+
$instance[ 'style' ] = $new_instance[ 'style' ];
|
118 |
$instance[ 'link' ] = $new_instance[ 'link' ];
|
119 |
$instance[ 'react' ] = $new_instance[ 'react' ];
|
120 |
$instance[ 'stop' ] = $new_instance[ 'stop' ];
|
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 |
|
@@ -45,10 +45,13 @@ Which options are available depends upon the embedding type you're using - you c
|
|
45 |
The following parameters work with all embed types:
|
46 |
|
47 |
* **audio** - yes or no, this will hide the video and display just the toolbar (ideal for audio only playback) if switched on
|
|
|
48 |
* **height** - the video height, in pixels
|
49 |
* **list** - if you've specified your own list, use this to select the way the videos should be output. Should be `random` (display videos in a random order), `single` (show just one video, randomly picked from the list) or `order` (show each video in the original order - this is the default)
|
50 |
* **profile** - specify a different default profile (see section on Profiles for further details)
|
51 |
* **ratio** - allows you to define a window ratio - specify just a height or width and the ratio will calculate the missing dimension. Uses the format x:x, e.g. 4:3, 16:9
|
|
|
|
|
52 |
* **template** - specify a template (see section on Templates for further details)
|
53 |
* **type** - which embedding type to use, this can be `embedplus`, `iframe` or `object`
|
54 |
* **width** - the video width, in pixels
|
@@ -56,10 +59,8 @@ The following parameters work with all embed types:
|
|
56 |
The following parameters will not work with EmbedPlus:
|
57 |
|
58 |
* **autohide** - 0, 1 or 2, this parameter indicates whether the video controls will automatically hide after a video begins playing. The default behaviour, a value of 2, is for the video progress bar to fade out while the player controls (play button, volume control, etc.) remain visible. If this parameter is set to 0, the video progress bar and the video player controls will be visible throughout the video. If this parameter is set to 1, then the video progress bar and the player controls will slide out of view a couple of seconds after the video starts playing. They will only reappear if the user moves her mouse over the video player or presses a key on her keyboard.
|
59 |
-
* **autoplay** - yes or no, should the video automatically start playing?
|
60 |
* **controls** - yes or no, should the controls be shown?
|
61 |
* **loop** - yes or no, whether to start the video again once it ends
|
62 |
-
* **start** - a number of seconds from where to start the video playing
|
63 |
|
64 |
The following parameters will not work with EmbedPlus or if IFRAME uses HTML5:
|
65 |
|
@@ -291,7 +292,7 @@ For problems, suggestions or enhancements for this plugin, there is [a dedicated
|
|
291 |
|
292 |
== Installation ==
|
293 |
|
294 |
-
1. Upload the entire `youtube-embed`folder to your wp-content/plugins/ directory.
|
295 |
2. Activate the plugin through the 'Plugins' menu in WordPress.
|
296 |
3. That's it, you're done - you just need to add the shortcode wherever you need.
|
297 |
|
@@ -311,6 +312,10 @@ Equally, some options are not supported depending on whether you use the IFRAME
|
|
311 |
|
312 |
[Read more about which options are supported](http://www.artiss.co.uk/artiss-youtube-embed/further-help#ye-api "API Support").
|
313 |
|
|
|
|
|
|
|
|
|
314 |
= I've upgraded from an earlier version of Artiss YouTube Embed and one of the functions / shortcodes / parameters that I used is no longer documented =
|
315 |
|
316 |
Code created for previous versions of the plugin should still work - however, the functions will not be documented to deter people from using them in the future.
|
@@ -337,9 +342,9 @@ However, I can confirm that it's been tested in IE7 (IE8 in compatibility mode),
|
|
337 |
|
338 |
= Which version of PHP does this plugin work with? =
|
339 |
|
340 |
-
It has been
|
341 |
|
342 |
-
|
343 |
|
344 |
= A new box has appeared on my dashboard all about Artiss plugins =
|
345 |
|
@@ -411,6 +416,15 @@ That's correct - all Artiss plugins will now add this feature to keep you up-to-
|
|
411 |
* Improved editor button and link added to admin bar
|
412 |
* Many, many more changes - too many to list!
|
413 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
414 |
== Upgrade Notice ==
|
415 |
|
416 |
= 1.0 =
|
@@ -441,4 +455,7 @@ That's correct - all Artiss plugins will now add this feature to keep you up-to-
|
|
441 |
* Upgrade to add a number of new options including video size ratios, disabling keyboard controls, an editor button and different demonstration video options on the admin screen
|
442 |
|
443 |
= 2.0 =
|
444 |
-
* Upgrade to take advantage of many new features. Code completely re-written
|
|
|
|
|
|
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.1
|
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 |
|
45 |
The following parameters work with all embed types:
|
46 |
|
47 |
* **audio** - yes or no, this will hide the video and display just the toolbar (ideal for audio only playback) if switched on
|
48 |
+
* **autoplay** - yes or no, should the video automatically start playing?
|
49 |
* **height** - the video height, in pixels
|
50 |
* **list** - if you've specified your own list, use this to select the way the videos should be output. Should be `random` (display videos in a random order), `single` (show just one video, randomly picked from the list) or `order` (show each video in the original order - this is the default)
|
51 |
* **profile** - specify a different default profile (see section on Profiles for further details)
|
52 |
* **ratio** - allows you to define a window ratio - specify just a height or width and the ratio will calculate the missing dimension. Uses the format x:x, e.g. 4:3, 16:9
|
53 |
+
* **start** - a number of seconds from where to start the video playing
|
54 |
+
* **style** - apply CSS elements directly to the video output
|
55 |
* **template** - specify a template (see section on Templates for further details)
|
56 |
* **type** - which embedding type to use, this can be `embedplus`, `iframe` or `object`
|
57 |
* **width** - the video width, in pixels
|
59 |
The following parameters will not work with EmbedPlus:
|
60 |
|
61 |
* **autohide** - 0, 1 or 2, this parameter indicates whether the video controls will automatically hide after a video begins playing. The default behaviour, a value of 2, is for the video progress bar to fade out while the player controls (play button, volume control, etc.) remain visible. If this parameter is set to 0, the video progress bar and the video player controls will be visible throughout the video. If this parameter is set to 1, then the video progress bar and the player controls will slide out of view a couple of seconds after the video starts playing. They will only reappear if the user moves her mouse over the video player or presses a key on her keyboard.
|
|
|
62 |
* **controls** - yes or no, should the controls be shown?
|
63 |
* **loop** - yes or no, whether to start the video again once it ends
|
|
|
64 |
|
65 |
The following parameters will not work with EmbedPlus or if IFRAME uses HTML5:
|
66 |
|
292 |
|
293 |
== Installation ==
|
294 |
|
295 |
+
1. Upload the entire `youtube-embed` folder to your wp-content/plugins/ directory.
|
296 |
2. Activate the plugin through the 'Plugins' menu in WordPress.
|
297 |
3. That's it, you're done - you just need to add the shortcode wherever you need.
|
298 |
|
312 |
|
313 |
[Read more about which options are supported](http://www.artiss.co.uk/artiss-youtube-embed/further-help#ye-api "API Support").
|
314 |
|
315 |
+
= How do I add a border to the video =
|
316 |
+
|
317 |
+
The border option is no longer available with the YouTube player. However, you can use the `style` option to mimic it. Simply add a style of `border: 10px solid #b1b1b1`.
|
318 |
+
|
319 |
= I've upgraded from an earlier version of Artiss YouTube Embed and one of the functions / shortcodes / parameters that I used is no longer documented =
|
320 |
|
321 |
Code created for previous versions of the plugin should still work - however, the functions will not be documented to deter people from using them in the future.
|
342 |
|
343 |
= Which version of PHP does this plugin work with? =
|
344 |
|
345 |
+
It has been syntax checked as PHP 4. However, this does not guarantee PHP 4 compatibility and the minimum for WordPress is now PHP 5.2.4.
|
346 |
|
347 |
+
Although I attempt to keep with PHP 4 compatability there are no guarantees of this.
|
348 |
|
349 |
= A new box has appeared on my dashboard all about Artiss plugins =
|
350 |
|
416 |
* Improved editor button and link added to admin bar
|
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 |
+
* Fixed incorrect caching of options - was only changing if override parameters were modified
|
422 |
+
* Video Information Cache will no longer reset to zero if the Embed cache is greater
|
423 |
+
* Added autoplay option to EmbedPlus
|
424 |
+
* Updated screens and documentation to show the `start` parameter works with EmbedPlus
|
425 |
+
* 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
|
426 |
+
* Added random ID to EmbedPlus output to resolve a bug that can affect IE users
|
427 |
+
|
428 |
== Upgrade Notice ==
|
429 |
|
430 |
= 1.0 =
|
455 |
* Upgrade to add a number of new options including video size ratios, disabling keyboard controls, an editor button and different demonstration video options on the admin screen
|
456 |
|
457 |
= 2.0 =
|
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
|
screenshot-2.png
CHANGED
Binary file
|
screenshot-3.png
CHANGED
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 |
*/
|
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.1
|
7 |
Author: David Artiss
|
8 |
Author URI: http://www.artiss.co.uk
|
9 |
*/
|