YouTube Embed - Version 5.1.1

Version Description

  • Enhancement: Added extra plugin meta
  • Bug: The URL separator was not always correct - it still seemed to work but it was sloppy
  • Bug: Reduced the top padding on videos
  • Bug: Single-video looping was not working due a change in how YouTube nows processes them (they now have to be single-video playlists for them to loop. Yeah, I know)
Download this release

Release Info

Developer dartiss
Plugin Icon 128x128 YouTube Embed
Version 5.1.1
Comparing to
See all releases

Code changes from version 5.1 to 5.1.1

css/admin.css CHANGED
@@ -2,7 +2,7 @@
2
  .ye-container {
3
  position: relative;
4
  padding-bottom: 56.25%;
5
- padding-top: 30px;
6
  height: 0;
7
  overflow: hidden;
8
  }
2
  .ye-container {
3
  position: relative;
4
  padding-bottom: 56.25%;
5
+ padding-top: 0;
6
  height: 0;
7
  overflow: hidden;
8
  }
css/admin.min.css CHANGED
@@ -1 +1 @@
1
- .ye-container{position:relative;padding-bottom:56.25%;padding-top:30px;height:0;overflow:hidden}.ye-container iframe,.ye-container object,.ye-container embed{position:absolute;top:0;left:0;width:100%;height:100%}
1
+ .ye-container{position:relative;padding-bottom:56.25%;padding-top:0;height:0;overflow:hidden}.ye-container iframe,.ye-container object,.ye-container embed{position:absolute;top:0;left:0;width:100%;height:100%}
css/main.css CHANGED
@@ -1,7 +1,7 @@
1
  .ye-container {
2
  position: relative;
3
  padding-bottom: 56.25%;
4
- padding-top: 30px;
5
  height: 0;
6
  overflow: hidden;
7
  }
1
  .ye-container {
2
  position: relative;
3
  padding-bottom: 56.25%;
4
+ padding-top: 0;
5
  height: 0;
6
  overflow: hidden;
7
  }
css/main.min.css CHANGED
@@ -1 +1 @@
1
- .ye-container{position:relative;padding-bottom:56.25%;padding-top:30px;height:0;overflow:hidden;}.ye-container iframe,.ye-container object,.ye-container embed{position:absolute;top:0;left:0;width:100%;height:100%;}
1
+ .ye-container{position:relative;padding-bottom:56.25%;padding-top:0;height:0;overflow:hidden;}.ye-container iframe,.ye-container object,.ye-container embed{position:absolute;top:0;left:0;width:100%;height:100%;}
includes/admin-config.php CHANGED
@@ -36,25 +36,25 @@ function ye_add_settings_link( $links, $file ) {
36
  add_filter( 'plugin_action_links', 'ye_add_settings_link', 10, 2 );
37
 
38
  /**
39
- * Add meta to plugin details
40
- *
41
- * Add options to plugin meta line
42
- *
43
- * @since 2.0
44
- *
45
- * @param string $links Current links
46
- * @param string $file File in use
47
- * @return string Links, now with settings added
48
- */
49
-
50
  function ye_set_plugin_meta( $links, $file ) {
51
 
52
  if ( strpos( $file, 'youtube-embed.php' ) !== false ) {
53
 
54
- $links = array_merge( $links, array( '<a href="https://github.com/dartiss/youtube-embed">' . __( 'Github', 'youtube-embed' ) . '</a>' ) );
55
 
56
  $links = array_merge( $links, array( '<a href="https://wordpress.org/support/plugin/youtube-embed">' . __( 'Support', 'youtube-embed' ) . '</a>' ) );
57
 
 
 
 
58
  }
59
 
60
  return $links;
36
  add_filter( 'plugin_action_links', 'ye_add_settings_link', 10, 2 );
37
 
38
  /**
39
+ * Add meta to plugin details
40
+ *
41
+ * Add options to plugin meta line
42
+ *
43
+ * @param string $links Current links.
44
+ * @param string $file File in use.
45
+ * @return string Links, now with settings added.
46
+ */
 
 
 
47
  function ye_set_plugin_meta( $links, $file ) {
48
 
49
  if ( strpos( $file, 'youtube-embed.php' ) !== false ) {
50
 
51
+ $links = array_merge( $links, array( '<a href="https://github.com/dartiss/youtube-embed">' . __( 'Github', 'youtube-embed' ) . '</a>' ) );
52
 
53
  $links = array_merge( $links, array( '<a href="https://wordpress.org/support/plugin/youtube-embed">' . __( 'Support', 'youtube-embed' ) . '</a>' ) );
54
 
55
+ $links = array_merge( $links, array( '<a href="https://artiss.blog/donate">' . __( 'Donate', 'youtube-embed' ) . '</a>' ) );
56
+
57
+ $links = array_merge( $links, array( '<a href="https://wordpress.org/support/plugin/youtube-embed/reviews/#new-post">' . __( 'Write a Review', 'youtube-embed' ) . '&nbsp;⭐️⭐️⭐️⭐️⭐️</a>' ) );
58
  }
59
 
60
  return $links;
includes/generate-embed-code.php CHANGED
@@ -1,35 +1,32 @@
1
  <?php
2
  /**
3
- * Generate embed code
4
- *
5
- * Functions calls to generate the required YouTube code
6
- *
7
- * @package youtube-embed
8
- */
9
 
10
  /**
11
- * Generate embed code
12
- *
13
- * Generate XHTML compatible YouTube embed code
14
- *
15
- * @since 2.0
16
- *
17
- * @uses ye_add_links Add links under video
18
- * @uses ye_error Display an error
19
- * @uses ye_extract_id Get the video ID
20
- * @uses ye_validate_list Get the requested lists
21
- * @uses ye_get_api_data Get the API data
22
- * @uses ye_validate_profile Get the requested profile
23
- * @uses ye_get_general_defaults Get general options
24
- * @uses ye_get_profile Set default profile options
25
- *
26
- * @param string $array Array of parameters
27
- * @return string Code output
28
- */
29
-
30
- function ye_generate_youtube_code( $array ) {
31
-
32
- // Set defaults then merge with passed array. Finally, split array into individual variables
33
 
34
  $default = array( 'id' => '', 'width' => '', 'height' => '', 'fullscreen' => '', 'related' => '', 'autoplay' => '', 'loop' => '', 'start' => '', 'annotation' => '', 'cc' => '', 'style' => '', 'stop' => '', 'disablekb' => '', 'ratio' => '', 'controls' => '', 'profile' => '', 'list_style' => '', 'template' => '', 'color' => '', 'responsive' => '', 'search' => '', 'user' => '', 'modest' => '', 'playsinline' => '', 'cc_lang' => '', 'language' => '' );
35
 
@@ -252,39 +249,45 @@ function ye_generate_youtube_code( $array ) {
252
  }
253
  if ( strpos( $template, '%video%' ) === false ) { $template = '%video%'; }
254
 
255
- // Set validation options
256
 
257
  if ( isset( $general[ 'frameborder' ] ) && $general[ 'frameborder' ] != 1 ) {
258
  $frameborder = 'frameborder="0" ';
259
- $amp = '&';
260
  } else {
261
  $frameborder = '';
262
- $amp = '&amp;';
263
  }
264
 
265
- // Generate parameters to add to URL but only if they differ from the default
266
 
267
  $paras = '';
268
 
269
- if ( $modest == 1 ) { $paras .= $amp . 'modestbranding=1'; }
270
- if ( $fullscreen != 1 ) { $paras .= $amp . 'fs=0'; }
271
- if ( $related != 1 ) { $paras .= $amp . 'rel=0'; }
272
- if ( $autoplay == 1 ) { $paras .= $amp . 'autoplay=1'; }
273
- if ( $loop == 1 ) { $paras .= $amp . 'loop=1'; }
274
- if ( $annotation != 1 ) { $paras .= $amp . 'iv_load_policy=3'; }
275
- if ( $cc != '' ) { $paras .= $amp . 'cc_load_policy=' . $cc; }
276
- if ( $cc_lang != '' ) { $paras .= $amp . 'cc_lang_pref=' . $cc_lang; }
277
- if ( $disablekb == 1 ) { $paras .= $amp . 'disablekb=1'; }
278
- if ( $controls != 1 ) { $paras .= $amp . 'controls=' . $controls; }
279
- if ( strtolower( $color ) != 'red' ) { $paras .= $amp . 'color=' . strtolower( $color ); }
280
- if ( $playsinline == 1 ) { $paras .= $amp . 'playsinline=1'; }
281
- if ( $language != '' ) { $paras .= $amp . 'hl=' . $language; }
282
- if ( $start != 0 ) { $paras .= $amp . 'start=' . $start; }
283
- if ( $stop != 0 ) { $paras .= $amp . 'end=' . $stop; }
284
-
285
- // If not a playlist, add the playlist parameter
286
-
287
- if ( ( $playlist_ids != '' ) && ( $playlist_ids != $id ) ) { $paras .= $amp . 'playlist=' . $playlist_ids; }
 
 
 
 
 
 
 
 
288
 
289
  // Generate DIVs to wrap around video
290
 
1
  <?php
2
  /**
3
+ * Generate embed code
4
+ *
5
+ * Functions calls to generate the required YouTube code
6
+ *
7
+ * @package youtube-embed
8
+ */
9
 
10
  /**
11
+ * Generate embed code
12
+ *
13
+ * Generate XHTML compatible YouTube embed code
14
+ *
15
+ * @uses ye_add_links Add links under video.
16
+ * @uses ye_error Display an error.
17
+ * @uses ye_extract_id Get the video ID.
18
+ * @uses ye_validate_list Get the requested lists.
19
+ * @uses ye_get_api_data Get the API data.
20
+ * @uses ye_validate_profile Get the requested profile.
21
+ * @uses ye_get_general_defaults Get general options.
22
+ * @uses ye_get_profile Set default profile options.
23
+ *
24
+ * @param string $array Array of parameters.
25
+ * @return string Code output.
26
+ */
27
+ function ye_generate_youtube_code( $array ) {
28
+
29
+ // Set defaults then merge with passed array. Finally, split array into individual variables.
 
 
 
30
 
31
  $default = array( 'id' => '', 'width' => '', 'height' => '', 'fullscreen' => '', 'related' => '', 'autoplay' => '', 'loop' => '', 'start' => '', 'annotation' => '', 'cc' => '', 'style' => '', 'stop' => '', 'disablekb' => '', 'ratio' => '', 'controls' => '', 'profile' => '', 'list_style' => '', 'template' => '', 'color' => '', 'responsive' => '', 'search' => '', 'user' => '', 'modest' => '', 'playsinline' => '', 'cc_lang' => '', 'language' => '' );
32
 
249
  }
250
  if ( strpos( $template, '%video%' ) === false ) { $template = '%video%'; }
251
 
252
+ // Set frameborder options.
253
 
254
  if ( isset( $general[ 'frameborder' ] ) && $general[ 'frameborder' ] != 1 ) {
255
  $frameborder = 'frameborder="0" ';
 
256
  } else {
257
  $frameborder = '';
 
258
  }
259
 
260
+ // Generate parameters to add to URL but only if they differ from the default.
261
 
262
  $paras = '';
263
 
264
+ if ( $modest == 1 ) { $paras .= '&modestbranding=1'; }
265
+ if ( $fullscreen != 1 ) { $paras .= '&fs=0'; }
266
+ if ( $related != 1 ) { $paras .= '&rel=0'; }
267
+ if ( $autoplay == 1 ) { $paras .= '&autoplay=1'; }
268
+ if ( $loop == 1 ) { $paras .= '&loop=1'; }
269
+ if ( $annotation != 1 ) { $paras .= '&iv_load_policy=3'; }
270
+ if ( $cc != '' ) { $paras .= '&cc_load_policy=' . $cc; }
271
+ if ( $cc_lang != '' ) { $paras .= '&cc_lang_pref=' . $cc_lang; }
272
+ if ( $disablekb == 1 ) { $paras .= '&disablekb=1'; }
273
+ if ( $controls != 1 ) { $paras .= '&controls=' . $controls; }
274
+ if ( strtolower( $color ) != 'red' ) { $paras .= '&color=' . strtolower( $color ); }
275
+ if ( $playsinline == 1 ) { $paras .= '&playsinline=1'; }
276
+ if ( $language != '' ) { $paras .= '&hl=' . $language; }
277
+ if ( $start != 0 ) { $paras .= '&start=' . $start; }
278
+ if ( $stop != 0 ) { $paras .= '&end=' . $stop; }
279
+
280
+ // If the loop parameter is being used, make this a single video playlist.
281
+
282
+ if ( 1 == $loop && '' == $playlist_ids ) {
283
+ $playlist_ids = $id;
284
+ }
285
+
286
+ // If not a playlist, add the playlist parameter.
287
+
288
+ if ( '' != $playlist_ids ) {
289
+ $paras .= '&playlist=' . $playlist_ids;
290
+ }
291
 
292
  // Generate DIVs to wrap around video
293
 
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: embed, insert, video, youtube
5
  Requires at least: 4.6
6
  Tested up to: 5.4
7
  Requires PHP: 5.3
8
- Stable tag: 5.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -313,7 +313,13 @@ Before reporting it please bear in mind that this plugin uses the standard YouTu
313
 
314
  == Changelog ==
315
 
316
- 🔢 [Learn more about my version numbering methodology](https://artiss.blog/2016/09/wordpress-plugin-versioning/ "WordPress Plugin Versioning")
 
 
 
 
 
 
317
 
318
  = 5.1 =
319
  * Enhancement: Now supports specifying the language for the closed captions
@@ -537,5 +543,5 @@ Before reporting it please bear in mind that this plugin uses the standard YouTu
537
 
538
  == Upgrade Notice ==
539
 
540
- = 5.1 =
541
- * Enhancements and bug fixes
5
  Requires at least: 4.6
6
  Tested up to: 5.4
7
  Requires PHP: 5.3
8
+ Stable tag: 5.1.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
313
 
314
  == Changelog ==
315
 
316
+ 🔢 [Learn more about my version numbering methodology](https://artiss.blog/2016/09/wordpress-plugin-versioning/ "WordPress Plugin Versioning")
317
+
318
+ = 5.1.1 =
319
+ * Enhancement: Added extra plugin meta
320
+ * Bug: The URL separator was not always correct - it still seemed to work but it was sloppy
321
+ * Bug: Reduced the top padding on videos
322
+ * Bug: Single-video looping was not working due a change in how YouTube nows processes them (they now have to be single-video playlists for them to loop. Yeah, I know)
323
 
324
  = 5.1 =
325
  * Enhancement: Now supports specifying the language for the closed captions
543
 
544
  == Upgrade Notice ==
545
 
546
+ = 5.1.1 =
547
+ * Whilst we'd holed up at home, it's bug fix time!
youtube-embed.php CHANGED
@@ -1,43 +1,36 @@
1
  <?php
2
- /*
3
  Plugin Name: YouTube Embed
4
  Plugin URI: https://github.com/dartiss/youtube-embed
5
  Description: An incredibly fast, simple, yet powerful, method of embedding YouTube videos into your WordPress site.
6
- Version: 5.1
7
  Author: dartiss
8
  Author URI: https://artiss.blog
9
  Text Domain: youtube-embed
10
- */
11
 
12
- /**
13
- * YouTube Embed
14
- *
15
- * Main code - include various functions
16
- *
17
- * @package youtube-embed
18
- * @since 2.0
19
- */
20
 
21
- define( 'youtube_embed_version', '5.1' );
22
 
23
  $functions_dir = plugin_dir_path( __FILE__ ) . 'includes/';
24
 
25
- // Include all the various functions
26
 
27
- include_once( $functions_dir . 'shared-functions.php' ); // Shared routines
28
 
29
- include_once( $functions_dir . 'add-scripts.php' ); // Add various scripts
30
 
31
- include_once( $functions_dir . 'generate-embed-code.php' ); // Generate YouTube embed code
32
 
33
- include_once( $functions_dir . 'generate-other-code.php' ); // Generate download & short URLs & thumbnails
34
 
35
- include_once( $functions_dir . 'generate-widgets.php' ); // Generate widgets
36
 
37
- include_once( $functions_dir . 'api-access.php' ); // Fetch video data from YouTube API
38
 
39
- include_once( $functions_dir . 'caching.php' ); // Data caching functions
40
 
41
- include_once( $functions_dir . 'shortcodes.php' ); // Shortcodes
42
 
43
- include_once( $functions_dir . 'admin-config.php' ); // Administration configuration
1
  <?php
2
+ /**
3
  Plugin Name: YouTube Embed
4
  Plugin URI: https://github.com/dartiss/youtube-embed
5
  Description: An incredibly fast, simple, yet powerful, method of embedding YouTube videos into your WordPress site.
6
+ Version: 5.1.1
7
  Author: dartiss
8
  Author URI: https://artiss.blog
9
  Text Domain: youtube-embed
 
10
 
11
+ @package youtube-embed
12
+ */
 
 
 
 
 
 
13
 
14
+ define( 'youtube_embed_version', '5.1.1' );
15
 
16
  $functions_dir = plugin_dir_path( __FILE__ ) . 'includes/';
17
 
18
+ // Include all the various functions.
19
 
20
+ require_once $functions_dir . 'shared-functions.php'; // Shared routines.
21
 
22
+ require_once $functions_dir . 'add-scripts.php'; // Add various scripts.
23
 
24
+ require_once $functions_dir . 'generate-embed-code.php'; // Generate YouTube embed code.
25
 
26
+ require_once $functions_dir . 'generate-other-code.php'; // Generate download & short URLs & thumbnails.
27
 
28
+ require_once $functions_dir . 'generate-widgets.php'; // Generate widgets.
29
 
30
+ require_once $functions_dir . 'api-access.php'; // Fetch video data from YouTube API.
31
 
32
+ require_once $functions_dir . 'caching.php'; // Data caching functions.
33
 
34
+ require_once $functions_dir . 'shortcodes.php'; // Shortcodes.
35
 
36
+ require_once $functions_dir . 'admin-config.php'; // Administration configuration.