YouTube - Version 10.4

Version Description

Download this release

Release Info

Developer embedplus
Plugin Icon 128x128 YouTube
Version 10.4
Comparing to
See all releases

Code changes from version 10.3 to 10.4

Files changed (2) hide show
  1. readme.txt +9 -6
  2. youtube.php +51 -36
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === YouTube ===
2
  Contributors: embedplus
3
  Plugin Name: YouTube Embed
4
- Tags: video gallery, youtube galleries, channel gallery, gallery, playlist gallery, youtube gallery, accessibility, analytics, api, blocked youtube videos, cache, caching, channel, deleted youtube videos, effects, embed youtube, embedding youtube, featured image, get_locale, i18n, internationalization, l10n, language, lazy, lazy load, locale, localization, mute, no-cookie, oembed, page speed, playlist, playlists, plugin, Reddit, responsive, seo, short code, shortcode, special effects, ssl, subtitles, thumbnail, thumbnail image, thumbnails, tinymce, translate, translator, video, video analytics, video plugin, video seo, video shortcode, video thumbnails, view count, volume, widget, wordpress security, wordpress youtube embed, youtube, youtube api, youtube analytics, youtube embed, youtube impressions, youtube player, youtube playlist, youtube plugin, youtube shortcode, youtube snippets, youtube takedowns, youtube thumbnails, youtube plugin migration
5
  Requires at least: 3.3
6
  Tested up to: 4.2
7
- Stable tag: 10.3
8
  License: GPLv3 or later
9
 
10
  YouTube embed plugin. Embed a responsive video, YouTube channel gallery, or playlist gallery. Add video thumbnails, analytics, SEO, caching...
@@ -13,13 +13,13 @@ YouTube embed plugin. Embed a responsive video, YouTube channel gallery, or play
13
 
14
  **Here are a few recently added features (even more features below):**
15
 
16
- * The ability to make playlist (and channel) embeds have a gallery layout. By the default, the plugin can generate a grid-based [responsive playlist and channel gallery >>](http://www.embedplus.com/responsive-youtube-playlist-channel-gallery-for-wordpress.aspx). Your visitors can browse through pages of video thumbnails and choose from videos that are pulled from an entire playlist or channel.
17
  * Improved accessibility by using title attributes for screen reader support. It should help your site [pass functional accessibility evaluations (FAE)](https://www.youtube.com/watch?v=gpAiFnYYkbk).
18
  * Site origin information with each embed code as an extra security measure. In YouTube's/Google's own words, checking this option "protects against malicious third-party JavaScript being injected into your page and hijacking control of your YouTube player." We especially recommend checking it as it adds higher security than the built-in YouTube embedding method that comes with the current version of WordPress (i.e. oembed).
19
  * Easy "Insert" button for both the Visual and Text mode of the editor
20
  * [Embed an entire channel as a playlist >>](https://www.youtube.com/watch?v=_9D4yMyd40g)
21
  * Start video settings for playlist embeds. You can now choose to start a playlist with a specific video or have the plugin automatically start with the most recently added video.
22
- * Volume level initialization ( [helpful for autoplay >>](http://www.embedplus.com/mute-volume-youtube-wordpress.aspx) )
23
  * iOS playback preferences
24
  * [Automatic localization/internationalization](http://www.embedplus.com/youtube-iso-639-1-language-codes.aspx) so you can set the player's interface language from English to another
25
  * Instant HTTPS support. It can even convert past non-HTTPS videos to HTTPS. Did you know that Google uses [HTTPS/SSL support as a ranking signal for SERP?](http://embedplus.com/convert-old-youtube-embeds-to-https-ssl.aspx)
@@ -32,8 +32,8 @@ YouTube embed plugin. Embed a responsive video, YouTube channel gallery, or play
32
  You can even extend the plugin with PRO features like:
33
 
34
  * Alternate playlist and channel gallery styling
35
- * Caching to avoid making frequent requests to YouTube.com and speed up your page loads.
36
- * [Automatic video thumbnail images](http://embedplus.com/add-youtube-video-thumbnails-featured-image-wordpress.aspx): each post or page that contains at least one video will have the thumbnail of its first video serve as its featured image.
37
  * [Eye-catching special effects for YouTube embeds >>](http://www.embedplus.com/add-special-effects-to-youtube-embeds-in-wordpress.aspx) (uses lazy loading)
38
  * Automatic tagging for video SEO
39
  * Automatic Open Graph tagging for Facebook
@@ -147,6 +147,9 @@ You can also start and end each individual video at particular times. Like the a
147
 
148
  == Changelog ==
149
 
 
 
 
150
  = YouTube Embed 10.3 =
151
  Adds the ability to make playlist and channel embeds have a gallery layout. By the default, the plugin can generate a grid-based [responsive playlist and channel gallery >>](http://www.embedplus.com/responsive-youtube-playlist-channel-gallery-for-wordpress.aspx)
152
 
1
  === YouTube ===
2
  Contributors: embedplus
3
  Plugin Name: YouTube Embed
4
+ Tags: youtube channel, video gallery, youtube galleries, channel gallery, gallery, playlist gallery, youtube gallery, accessibility, analytics, api, blocked youtube videos, cache, caching, channel, deleted youtube videos, effects, embed youtube, embedding youtube, featured image, get_locale, i18n, internationalization, l10n, language, lazy, lazy load, locale, localization, mute, no-cookie, oembed, page speed, playlist, playlists, plugin, Reddit, responsive, seo, short code, shortcode, ssl, subtitles, thumbnail, thumbnail image, thumbnails, tinymce, translate, translator, video, video analytics, video plugin, video seo, video shortcode, video thumbnails, view count, volume, widget, wordpress security, wordpress youtube embed, youtube, youtube api, youtube analytics, youtube embed, youtube impressions, youtube player, youtube playlist, youtube plugin, youtube shortcode, youtube snippets, youtube takedowns, youtube thumbnails, youtube plugin migration
5
  Requires at least: 3.3
6
  Tested up to: 4.2
7
+ Stable tag: 10.4
8
  License: GPLv3 or later
9
 
10
  YouTube embed plugin. Embed a responsive video, YouTube channel gallery, or playlist gallery. Add video thumbnails, analytics, SEO, caching...
13
 
14
  **Here are a few recently added features (even more features below):**
15
 
16
+ * YouTube Channel and Playlist Gallery - The ability to make playlist (and channel) embeds have a gallery layout. By default, the plugin can generate a grid-based [responsive playlist or channel gallery >>](http://www.embedplus.com/responsive-youtube-playlist-channel-gallery-for-wordpress.aspx). Your visitors can browse through pages of video thumbnails and choose from videos that are pulled from an entire YouTube channel or playlist.
17
  * Improved accessibility by using title attributes for screen reader support. It should help your site [pass functional accessibility evaluations (FAE)](https://www.youtube.com/watch?v=gpAiFnYYkbk).
18
  * Site origin information with each embed code as an extra security measure. In YouTube's/Google's own words, checking this option "protects against malicious third-party JavaScript being injected into your page and hijacking control of your YouTube player." We especially recommend checking it as it adds higher security than the built-in YouTube embedding method that comes with the current version of WordPress (i.e. oembed).
19
  * Easy "Insert" button for both the Visual and Text mode of the editor
20
  * [Embed an entire channel as a playlist >>](https://www.youtube.com/watch?v=_9D4yMyd40g)
21
  * Start video settings for playlist embeds. You can now choose to start a playlist with a specific video or have the plugin automatically start with the most recently added video.
22
+ * [Volume level initialization](http://www.embedplus.com/mute-volume-youtube-wordpress.aspx) - helpful when autoplay is checked
23
  * iOS playback preferences
24
  * [Automatic localization/internationalization](http://www.embedplus.com/youtube-iso-639-1-language-codes.aspx) so you can set the player's interface language from English to another
25
  * Instant HTTPS support. It can even convert past non-HTTPS videos to HTTPS. Did you know that Google uses [HTTPS/SSL support as a ranking signal for SERP?](http://embedplus.com/convert-old-youtube-embeds-to-https-ssl.aspx)
32
  You can even extend the plugin with PRO features like:
33
 
34
  * Alternate playlist and channel gallery styling
35
+ * Caching to avoid making frequent requests to YouTube.com and speed up your page loads
36
+ * [Automatic video thumbnail images](http://embedplus.com/add-youtube-video-thumbnails-featured-image-wordpress.aspx): each post or page that contains at least one video will have the thumbnail of its first video serve as its featured image
37
  * [Eye-catching special effects for YouTube embeds >>](http://www.embedplus.com/add-special-effects-to-youtube-embeds-in-wordpress.aspx) (uses lazy loading)
38
  * Automatic tagging for video SEO
39
  * Automatic Open Graph tagging for Facebook
147
 
148
  == Changelog ==
149
 
150
+ = YouTube Embed 10.4 =
151
+ Addresses limitations some users were getting when pasting a YouTube channel and/or playlist gallery.
152
+
153
  = YouTube Embed 10.3 =
154
  Adds the ability to make playlist and channel embeds have a gallery layout. By the default, the plugin can generate a grid-based [responsive playlist and channel gallery >>](http://www.embedplus.com/responsive-youtube-playlist-channel-gallery-for-wordpress.aspx)
155
 
youtube.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: YouTube
4
  Plugin URI: http://www.embedplus.com/dashboard/pro-easy-video-analytics.aspx
5
  Description: YouTube embed plugin. Embed a responsive YouTube video, playlist gallery, or channel gallery. Add video thumbnails, analytics, SEO, caching...
6
- Version: 10.3
7
  Author: EmbedPlus Team
8
  Author URI: http://www.embedplus.com
9
  */
@@ -32,7 +32,7 @@
32
  class YouTubePrefs
33
  {
34
 
35
- public static $version = '10.3';
36
  public static $opt_version = 'version';
37
  public static $optembedwidth = null;
38
  public static $optembedheight = null;
@@ -96,8 +96,8 @@ class YouTubePrefs
96
  public static $epbase = '//www.embedplus.com';
97
  public static $double_plugin = false;
98
  public static $scriptsprinted = 0;
99
- public static $badentities = array('×', '×', '–', '–', '&');
100
- public static $goodliterals = array('x', 'x', '--', '--', '&');
101
  ///////////////////////////////////////////////////////////////////////////////////////////////////
102
  ///////////////////////////////////////////////////////////////////////////////////////////////////
103
  ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -833,6 +833,7 @@ class YouTubePrefs
833
 
834
  public static function do_ytprefs()
835
  {
 
836
  if (!is_admin())
837
  {
838
  add_filter('the_content', 'YouTubePrefs::apply_prefs_content', 1);
@@ -856,6 +857,15 @@ class YouTubePrefs
856
  }
857
  }
858
 
 
 
 
 
 
 
 
 
 
859
  public static function apply_prefs_shortcode($atts, $content = null)
860
  {
861
  $content = trim($content);
@@ -1001,33 +1011,36 @@ class YouTubePrefs
1001
  }
1002
  }
1003
 
 
1004
  $pagination = '<div class="epyt-pagination">';
1005
- if (!empty($prevPageToken))
1006
  {
1007
- $pagination .= '<div class="epyt-pagebutton epyt-prev" data-playlistid="' . esc_attr($playlistId)
1008
- . '" data-pagesize="' . intval($pageSize)
1009
- . '" data-pagetoken="' . esc_attr($prevPageToken)
1010
- . '" data-style="' . esc_attr($style)
1011
- . '" data-columns="' . intval($columns)
1012
- . '"><div>&laquo;</div> ' . _('Prev') . '</div>';
1013
- }
 
 
1014
 
1015
- $totalPages = ceil($totalResults / $resultsPerPage);
1016
- $pagination .= '<div class="epyt-pagenumbers">';
1017
- $pagination .= '<div class="epyt-current">1</div><div class="epyt-pageseparator">' . _("of") . '</div><div class="epyt-totalpages">' . $totalPages . '</div>';
1018
- $pagination .= '</div>';
1019
 
1020
- if (!empty($nextPageToken))
1021
- {
1022
- $pagination .= '<div class="epyt-pagebutton epyt-next" data-playlistid="' . esc_attr($playlistId)
1023
- . '" data-pagesize="' . intval($pageSize)
1024
- . '" data-pagetoken="' . esc_attr($nextPageToken)
1025
- . '" data-style="' . esc_attr($style)
1026
- . '" data-columns="' . intval($columns)
1027
- . '">' . _('Next') . ' <div>&raquo;</div></div>';
 
 
1028
  }
1029
- $pagination .= '<div class="epyt-loader"><img src="' . plugins_url('images/gallery-page-loader.gif', __FILE__) . '"></div></div>';
1030
-
1031
 
1032
  $code = $pagination . $code . $pagination;
1033
 
@@ -1334,12 +1347,13 @@ class YouTubePrefs
1334
 
1335
  public static function spdcpurge()
1336
  {
1337
- $allk = get_option(self::$spdcall);
1338
- foreach ($allk as $t)
1339
- {
1340
- $success = delete_transient($t);
 
 
1341
  }
1342
- update_option(self::$spdcall, array());
1343
  }
1344
 
1345
  public static function keyvalue($qry, $includev)
@@ -1930,11 +1944,11 @@ class YouTubePrefs
1930
  $new_pointer_content .= '<p>'; // ooopointer
1931
  if (!(self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0))
1932
  {
1933
- $new_pointer_content .= __("This update adds playlist and channel gallery support for FREE and PRO users with some <a target=_blank href=" . self::$epbase . '/dashboard/pro-easy-video-analytics.aspx?ref=frompointer' . ">additional PRO settings &raquo;</a>");
1934
  }
1935
  else
1936
  {
1937
- $new_pointer_content .= __("This update adds playlist and channel gallery support for FREE and PRO users with some additional PRO settings.");
1938
  }
1939
  $new_pointer_content .= '</p>';
1940
 
@@ -2512,7 +2526,7 @@ class YouTubePrefs
2512
  <p><code>&layout=gallery</code></p>
2513
  <p>For example, below is a playlist that has been converted into a gallery. Notice the new layout parameter, with no spaces:</p>
2514
  <p>
2515
- <code style="font-size: .9em;">http://www.youtube.com/embed?listType=playlist&width=474&height=266&list=UUAuUUnT6oDeKwE6v1NGQxug&plindex=0<b>&layout=gallery</b></code>
2516
  </p>
2517
  <p class="smallnote">
2518
  PRO users can just use the playlist or channel wizard steps to fully to build codes like the above.
@@ -3277,8 +3291,9 @@ class YouTubePrefs
3277
  wp_enqueue_style(
3278
  '__EPYT__style', plugins_url('styles/ytprefs.min.css', __FILE__)
3279
  );
3280
-
3281
- $colwidth = 100.0 / floatval(self::$alloptions[self::$opt_gallery_columns]);
 
3282
  $custom_css = "
3283
  .epyt-gallery-thumb {
3284
  width: {$colwidth}%;
3
  Plugin Name: YouTube
4
  Plugin URI: http://www.embedplus.com/dashboard/pro-easy-video-analytics.aspx
5
  Description: YouTube embed plugin. Embed a responsive YouTube video, playlist gallery, or channel gallery. Add video thumbnails, analytics, SEO, caching...
6
+ Version: 10.4
7
  Author: EmbedPlus Team
8
  Author URI: http://www.embedplus.com
9
  */
32
  class YouTubePrefs
33
  {
34
 
35
+ public static $version = '10.4';
36
  public static $opt_version = 'version';
37
  public static $optembedwidth = null;
38
  public static $optembedheight = null;
96
  public static $epbase = '//www.embedplus.com';
97
  public static $double_plugin = false;
98
  public static $scriptsprinted = 0;
99
+ public static $badentities = array('&#215;', '×', '&#8211;', '–', '&amp;', '&#038;', '&#38;');
100
+ public static $goodliterals = array('x', 'x', '--', '--', '&', '&', '&');
101
  ///////////////////////////////////////////////////////////////////////////////////////////////////
102
  ///////////////////////////////////////////////////////////////////////////////////////////////////
103
  ///////////////////////////////////////////////////////////////////////////////////////////////////
833
 
834
  public static function do_ytprefs()
835
  {
836
+ add_filter('autoptimize_filter_js_exclude', 'YouTubePrefs::ao_override_jsexclude', 10, 1);
837
  if (!is_admin())
838
  {
839
  add_filter('the_content', 'YouTubePrefs::apply_prefs_content', 1);
857
  }
858
  }
859
 
860
+ public static function ao_override_jsexclude($exclude)
861
+ {
862
+ if (strpos($exclude, 'ytprefs.min.js') === false)
863
+ {
864
+ return $exclude . ",ytprefs.min.js";
865
+ }
866
+ return $exclude;
867
+ }
868
+
869
  public static function apply_prefs_shortcode($atts, $content = null)
870
  {
871
  $content = trim($content);
1011
  }
1012
  }
1013
 
1014
+ $totalPages = ceil($totalResults / $resultsPerPage);
1015
  $pagination = '<div class="epyt-pagination">';
1016
+ if ($totalPages > 1)
1017
  {
1018
+ if (!empty($prevPageToken))
1019
+ {
1020
+ $pagination .= '<div class="epyt-pagebutton epyt-prev" data-playlistid="' . esc_attr($playlistId)
1021
+ . '" data-pagesize="' . intval($pageSize)
1022
+ . '" data-pagetoken="' . esc_attr($prevPageToken)
1023
+ . '" data-style="' . esc_attr($style)
1024
+ . '" data-columns="' . intval($columns)
1025
+ . '"><div>&laquo;</div> ' . _('Prev') . '</div>';
1026
+ }
1027
 
1028
+ $pagination .= '<div class="epyt-pagenumbers">';
1029
+ $pagination .= '<div class="epyt-current">1</div><div class="epyt-pageseparator">' . _("of") . '</div><div class="epyt-totalpages">' . $totalPages . '</div>';
1030
+ $pagination .= '</div>';
 
1031
 
1032
+ if (!empty($nextPageToken))
1033
+ {
1034
+ $pagination .= '<div class="epyt-pagebutton epyt-next" data-playlistid="' . esc_attr($playlistId)
1035
+ . '" data-pagesize="' . intval($pageSize)
1036
+ . '" data-pagetoken="' . esc_attr($nextPageToken)
1037
+ . '" data-style="' . esc_attr($style)
1038
+ . '" data-columns="' . intval($columns)
1039
+ . '">' . _('Next') . ' <div>&raquo;</div></div>';
1040
+ }
1041
+ $pagination .= '<div class="epyt-loader"><img src="' . plugins_url('images/gallery-page-loader.gif', __FILE__) . '"></div>';
1042
  }
1043
+ $pagination .= '</div>';
 
1044
 
1045
  $code = $pagination . $code . $pagination;
1046
 
1347
 
1348
  public static function spdcpurge()
1349
  {
1350
+ $allk = get_option(self::$spdcall, array()); {
1351
+ foreach ($allk as $t)
1352
+ {
1353
+ $success = delete_transient($t);
1354
+ }
1355
+ update_option(self::$spdcall, array());
1356
  }
 
1357
  }
1358
 
1359
  public static function keyvalue($qry, $includev)
1944
  $new_pointer_content .= '<p>'; // ooopointer
1945
  if (!(self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0))
1946
  {
1947
+ $new_pointer_content .= __("This update improves playlist and channel features in FREE and <a target=_blank href=" . self::$epbase . '/dashboard/pro-easy-video-analytics.aspx?ref=frompointer' . ">PRO galleries &raquo;</a>");
1948
  }
1949
  else
1950
  {
1951
+ $new_pointer_content .= __("This update improves playlist and channel features in FREE and PRO galleries.");
1952
  }
1953
  $new_pointer_content .= '</p>';
1954
 
2526
  <p><code>&layout=gallery</code></p>
2527
  <p>For example, below is a playlist that has been converted into a gallery. Notice the new layout parameter, with no spaces:</p>
2528
  <p>
2529
+ <code style="font-size: .9em;">http://www.youtube.com/watch?listType=playlist&width=474&height=266&list=UUAuUUnT6oDeKwE6v1NGQxug&plindex=0<b>&layout=gallery</b></code>
2530
  </p>
2531
  <p class="smallnote">
2532
  PRO users can just use the playlist or channel wizard steps to fully to build codes like the above.
3291
  wp_enqueue_style(
3292
  '__EPYT__style', plugins_url('styles/ytprefs.min.css', __FILE__)
3293
  );
3294
+ $cols = floatval(self::$alloptions[self::$opt_gallery_columns]);
3295
+ $cols = $cols == 0 ? 3.0 : $cols;
3296
+ $colwidth = 100.0 / $cols;
3297
  $custom_css = "
3298
  .epyt-gallery-thumb {
3299
  width: {$colwidth}%;