PluginProbe
Embed Plus for YouTube Gallery, Livestream and Lazy Loading with Facades / trunk
Embed Plus for YouTube Gallery, Livestream and Lazy Loading with Facades vtrunk
trunk 1.0 1.1 10.0 10.1 10.2 10.3 10.4 10.5 10.6 10.7 10.8 10.9 11.0 11.0.1 11.1 11.2 11.3 11.3.1 11.4 11.5 11.6 11.7 11.7.1 11.8 All 143 releases
← All changes | youtube.php +4372 -2246 10.9trunk View file →
@@ -1,17 +1,18 @@
1 1 <?php
2 2 /*
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.9
7 - Author: EmbedPlus Team
8 - Author URI: http://www.embedplus.com
3 + Plugin Name: Embed Plus for YouTube Gallery, Livestream and Lazy Loading with Facades
4 + Plugin URI: https://www.embedplus.com/dashboard/pro-easy-video-analytics.aspx?ref=plugin
5 + Description: A multi-featured plugin to embed YouTube in WordPress. Embed a video, YouTube channel gallery, playlist, or YouTube livestream. Defer JavaScript too!
6 + Version: 14.2.6.1
7 + Author: Embed Plus for YouTube Plugin Team
8 + Author URI: https://www.embedplus.com
9 + Requires at least: 4.5
9 10 */
10 11
11 12 /*
12 - YouTube
13 - Copyright (C) 2015 EmbedPlus.com
13 + Embed Plus for YouTube Gallery, Livestream and Lazy Loading with Facades
14 + Copyright (C) 2026 EmbedPlus.com
14 15
15 16 This program is free software: you can redistribute it and/or modify
16 17 it under the terms of the GNU General Public License as published by
17 18 the Free Software Foundation, either version 3 of the License, or
@@ -31,9 +32,11 @@
31 32
32 33 class YouTubePrefs
33 34 {
34 35
35 - public static $version = '10.9';
36 + public static $folder_name = 'youtube-embed-plus';
37 + public static $curltimeout = 30;
38 + public static $version = '14.2.6.1';
36 39 public static $opt_version = 'version';
37 40 public static $optembedwidth = null;
38 41 public static $optembedheight = null;
39 42 public static $defaultheight = null;
@@ -42,95 +45,133 @@
42 45 public static $opt_center = 'centervid';
43 46 public static $opt_glance = 'glance';
44 47 public static $opt_autoplay = 'autoplay';
45 48 public static $opt_debugmode = 'debugmode';
49 + public static $opt_uninstall_data = 'uninstall_data';
46 50 public static $opt_old_script_method = 'old_script_method';
47 51 public static $opt_cc_load_policy = 'cc_load_policy';
52 + public static $opt_cc_lang_pref = 'cc_lang_pref';
48 53 public static $opt_iv_load_policy = 'iv_load_policy';
49 54 public static $opt_loop = 'loop';
50 - public static $opt_modestbranding = 'modestbranding';
51 55 public static $opt_rel = 'rel';
52 - public static $opt_showinfo = 'showinfo';
56 + public static $opt_fs = 'fs';
53 57 public static $opt_playsinline = 'playsinline';
54 58 public static $opt_autohide = 'autohide';
55 59 public static $opt_controls = 'controls';
60 + public static $opt_disablekb = 'disablekb';
56 61 public static $opt_theme = 'theme';
57 62 public static $opt_color = 'color';
58 63 public static $opt_listType = 'listType';
59 - public static $opt_wmode = 'wmode';
60 - public static $opt_vq = 'vq';
61 - public static $opt_html5 = 'html5';
62 64 public static $opt_dohl = 'dohl';
63 65 public static $opt_hl = 'hl';
64 - public static $opt_ssl = 'ssl';
65 - public static $opt_ogvideo = 'ogvideo';
66 66 public static $opt_nocookie = 'nocookie';
67 + public static $opt_gb_compat = 'gb_compat';
68 + public static $opt_facade_mode = 'facade_mode';
69 + public static $opt_facade_autoplay = 'facade_autoplay';
70 + public static $opt_gdpr_consent = 'gdpr_consent';
71 + public static $opt_gdpr_consent_message = 'gdpr_consent_message';
72 + public static $opt_gdpr_consent_button = 'gdpr_consent_button';
73 + public static $gdpr_cookie_name = 'ytprefs_gdpr_consent';
67 74 public static $opt_playlistorder = 'playlistorder';
68 75 public static $opt_acctitle = 'acctitle';
69 76 public static $opt_pro = 'pro';
70 77 public static $opt_oldspacing = 'oldspacing';
78 + public static $opt_frontend_only = 'frontend_only';
71 79 public static $opt_responsive = 'responsive';
72 80 public static $opt_responsive_all = 'responsive_all';
73 81 public static $opt_origin = 'origin';
74 82 public static $opt_widgetfit = 'widgetfit';
75 83 public static $opt_evselector_light = 'evselector_light';
84 + public static $opt_stop_mobile_buffer = 'stop_mobile_buffer';
85 + public static $opt_restrict_wizard = 'restrict_wizard';
86 + public static $opt_restrict_wizard_roles = 'restrict_wizard_roles';
87 + public static $opt_ajax_compat = 'ajax_compat';
88 + public static $opt_maxres_facade = 'maxres_facade';
89 + public static $opt_ytapi_load = 'ytapi_load';
76 90 public static $opt_defaultdims = 'defaultdims';
77 91 public static $opt_defaultwidth = 'width';
78 92 public static $opt_defaultheight = 'height';
93 + public static $opt_pause_others = 'pause_others';
79 94 public static $opt_defaultvol = 'defaultvol';
80 95 public static $opt_vol = 'vol';
81 96 public static $opt_apikey = 'apikey';
82 - public static $opt_schemaorg = 'schemaorg';
83 - public static $opt_ftpostimg = 'ftpostimg';
84 - public static $opt_spdc = 'spdc';
85 - public static $opt_spdcexp = 'spdcexp';
86 97 public static $opt_migrate = 'migrate';
87 98 public static $opt_migrate_youtube = 'migrate_youtube';
88 - public static $spdcprefix = 'ytpref';
89 - public static $spdcall = 'youtubeprefs_spdcall';
90 - public static $opt_dynload = 'dynload';
91 - public static $opt_dyntype = 'dyntype';
99 + public static $opt_migrate_embedplusvideo = 'migrate_embedplusvideo';
92 100 public static $opt_gallery_pagesize = 'gallery_pagesize';
93 - public static $opt_gallery_apikey = 'gallery_apikey';
94 101 public static $opt_gallery_columns = 'gallery_columns';
95 - public static $opt_gallery_style = 'gallery_style';
102 + public static $opt_gallery_collapse_grid = 'gallery_collapse_grid';
103 + public static $opt_gallery_collapse_grid_breaks = 'gallery_collapse_grid_breaks';
96 104 public static $opt_gallery_scrolloffset = 'gallery_scrolloffset';
105 + public static $opt_gallery_hideprivate = 'gallery_hideprivate';
97 106 public static $opt_gallery_showtitle = 'gallery_showtitle';
107 + public static $opt_gallery_showpaging = 'gallery_showpaging';
108 + public static $opt_gallery_thumbplay = 'gallery_thumbplay';
109 + public static $opt_gallery_autonext = 'gallery_autonext';
110 + public static $opt_gallery_channelsub = 'gallery_channelsub';
111 + public static $opt_gallery_channelsublink = 'gallery_channelsublink';
112 + public static $opt_gallery_channelsubtext = 'gallery_channelsubtext';
98 113 public static $opt_gallery_customarrows = 'gallery_customarrows';
99 114 public static $opt_gallery_customprev = 'gallery_customprev';
100 115 public static $opt_gallery_customnext = 'gallery_customnext';
101 - public static $opt_gallery_showdsc = 'gallery_showdsc';
102 - public static $opt_gallery_thumbcrop = 'gallery_thumbcrop';
116 + public static $opt_not_live_content = 'not_live_content';
117 + public static $opt_not_live_on = 'not_live_on';
118 + public static $opt_not_live_on_channel = 'not_live_on_channel';
103 119 public static $opt_admin_off_scripts = 'admin_off_scripts';
120 + public static $opt_defer_js = 'defer_js';
121 + public static $opt_defer_jquery = 'defer_jquery';
122 + public static $opt_ajax_save = 'ajax_save';
123 + public static $opt_onboarded = 'onboarded';
124 + public static $opt_show_pointer = 'show_pointer';
104 125 public static $opt_alloptions = 'youtubeprefs_alloptions';
105 126 public static $alloptions = null;
106 127 public static $yt_options = array();
107 - //public static $epbase = 'http://localhost:2346';
108 - public static $epbase = '//www.embedplus.com';
128 + public static $dft_bpts = array(array('bp' => array('min' => 0, 'max' => 767), 'cols' => 1));
129 + public static $dft_roles = array('administrator', 'editor', 'author', 'contributor', 'subscriber');
130 + public static $epbase = 'https://www.embedplus.com';
109 131 public static $double_plugin = false;
110 132 public static $scriptsprinted = 0;
133 + public static $min = '.min';
111 134 public static $badentities = array('&#215;', '×', '&#8211;', '–', '&amp;', '&#038;', '&#38;');
112 135 public static $goodliterals = array('x', 'x', '--', '--', '&', '&', '&');
136 + public static $wizard_hook = '';
137 + public static $onboarding_hook = '';
138 + public static $admin_page_hooks = array();
139 + public static $the_content_filters = array(
140 + 'wptexturize',
141 + 'wpautop',
142 + 'shortcode_unautop',
143 + 'prepend_attachment',
144 + 'wp_make_content_images_responsive',
145 + 'wp_filter_content_tags',
146 + 'do_shortcode',
147 + 'convert_smilies'
148 + );
149 + public static $get_api_key_msg = 'The ### feature now requires a (free) YouTube API key from Google. Please follow the easy steps <a href="https://www.youtube.com/watch?v=ZCfrNvu6nMc" target="_blank">in this video</a> to create and save your API key.';
150 + public static $boilerplate_api_error_message = ' Please make sure you performed the <a href="https://www.youtube.com/watch?v=ZCfrNvu6nMc" target="_blank">steps in this video</a> to create and save a proper server API key.';
151 + public static $dft_gdpr_consent_message = '<p><strong>Please accept YouTube cookies to play this video.</strong> By accepting you will be accessing content from YouTube, a service provided by an external third party.</p><p><a href="https://policies.google.com/privacy" target="_blank">YouTube privacy policy</a></p><p>If you accept this notice, your choice will be saved and the page will refresh.</p>';
113 152 ///////////////////////////////////////////////////////////////////////////////////////////////////
114 153 ///////////////////////////////////////////////////////////////////////////////////////////////////
115 154 ///////////////////////////////////////////////////////////////////////////////////////////////////
116 155 ///////////////////////////////////////////////////////////////////////////////////////////////////
117 - ///////////////////////////////////////////////////////////////////////////////////////////////////
118 - //public static $ytregex = '@^[\r\n]{0,1}[[:blank:]]*https?://(?:www\.)?(?:(?:youtube.com/watch\?)|(?:youtu.be/))([^\s"]+)[[:blank:]]*[\r\n]{0,1}$@im';
119 - public static $oldytregex = '@^\s*https?://(?:www\.)?(?:(?:youtube.com/(?:(?:watch)|(?:embed))/{0,1}\?)|(?:youtu.be/))([^\s"]+)\s*$@im';
120 - public static $ytregex = '@^[\r\t ]*https?://(?:www\.)?(?:(?:youtube.com/(?:(?:watch)|(?:embed))/{0,1}\?)|(?:youtu.be/))([^\s"]+)[\r\t ]*$@im';
121 - public static $justurlregex = '@https?://(?:www\.)?(?:(?:youtube.com/(?:(?:watch)|(?:embed))/{0,1}\?)|(?:youtu.be/))([^\[\s"]+)@i';
122 156
157 + public static $oldytregex = '@^\s*https?://(?:www\.)?(?:(?:youtube.com/(?:(?:watch)|(?:embed)|(?:playlist))(?:/live_stream){0,1}/{0,1}\?)|(?:youtu.be/))([^\s"]+)\s*$@im';
158 + public static $ytregex = '@^[\r\t ]*https?://(?:www\.)?(?:(?:youtube.com/(?:(?:watch)|(?:embed)|(?:playlist))(?:/live_stream){0,1}/{0,1}\?)|(?:youtu.be/))([^\s"]+)[\r\t ]*$@im';
159 + public static $justurlregex = '@https?://(?:www\.)?(?:(?:youtube.com/(?:(?:watch)|(?:embed)|(?:playlist))(?:/live_stream){0,1}/{0,1}\?)|(?:youtu.be/))([^\[\s"]+)@i';
160 +
123 161 ///////////////////////////////////////////////////////////////////////////////////////////////////
124 162 ///////////////////////////////////////////////////////////////////////////////////////////////////
125 163 ///////////////////////////////////////////////////////////////////////////////////////////////////
126 - ///////////////////////////////////////////////////////////////////////////////////////////////////
127 - ///////////////////////////////////////////////////////////////////////////////////////////////////
128 - ///////////////////////////////////////////////////////////////////////////////////////////////////
129 164
130 165 public function __construct()
131 166 {
132 - add_action('admin_init', array("YouTubePrefs", 'check_double_plugin_warning'));
167 + if (defined('EMBEDPLUS_BASE_URL'))
168 + {
169 + self::$epbase = EMBEDPLUS_BASE_URL;
170 + }
171 + register_deactivation_hook(__FILE__, array(self::class, 'on_deactivation'));
172 + add_action('admin_init', array(self::class, 'check_double_plugin_warning'));
173 + add_action('admin_notices', array(self::class, 'separate_version_message'));
133 174
134 175 self::$alloptions = get_option(self::$opt_alloptions);
135 176 if (self::$alloptions == false || version_compare(self::$alloptions[self::$opt_version], self::$version, '<'))
136 177 {
@@ -136,8 +177,14 @@
136 177 {
137 178 self::initoptions();
138 179 }
139 180
181 + if ((defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) || self::$alloptions[self::$opt_debugmode] == 1)
182 + {
183 + self::$min = '';
184 + }
185 +
186 +
140 187 if (self::$alloptions[self::$opt_oldspacing] == 1)
141 188 {
142 189 self::$ytregex = self::$oldytregex;
143 190 }
@@ -147,56 +194,117 @@
147 194
148 195 self::$yt_options = array(
149 196 self::$opt_autoplay,
150 197 self::$opt_cc_load_policy,
198 + self::$opt_cc_lang_pref,
151 199 self::$opt_iv_load_policy,
152 200 self::$opt_loop,
153 - self::$opt_modestbranding,
154 201 self::$opt_rel,
155 - self::$opt_showinfo,
202 + self::$opt_fs,
156 203 self::$opt_playsinline,
157 204 self::$opt_autohide,
158 205 self::$opt_controls,
159 - self::$opt_html5,
206 + self::$opt_disablekb,
160 207 self::$opt_hl,
161 208 self::$opt_theme,
162 209 self::$opt_color,
163 210 self::$opt_listType,
164 - self::$opt_wmode,
165 - self::$opt_vq,
166 211 'index',
167 212 'list',
168 213 'start',
169 - 'end'
214 + 'end',
215 + 'channel'
170 216 );
171 217
172 - add_action('media_buttons', 'YouTubePrefs::media_button_wizard', 11);
218 + add_action('media_buttons', array(self::class, 'media_button_wizard'), 11);
173 219
174 220
175 221 self::do_ytprefs();
176 - add_action('admin_menu', 'YouTubePrefs::ytprefs_plugin_menu');
222 + add_action('admin_menu', array(self::class, 'ytprefs_plugin_menu'));
223 + add_filter('plugin_action_links_' . plugin_basename(__FILE__), array(self::class, 'my_plugin_action_links'));
224 +
177 225 if (!is_admin())
178 226 {
179 -
180 -
181 227 if (self::$alloptions[self::$opt_old_script_method] == 1)
182 228 {
183 - add_action('wp_print_scripts', array('YouTubePrefs', 'jsvars'));
184 - add_action('wp_enqueue_scripts', array('YouTubePrefs', 'jsvars'));
229 + add_action('wp_print_scripts', array(self::class, 'jsvars'));
230 + add_action('wp_enqueue_scripts', array(self::class, 'jsvars'));
185 231 }
186 232
187 - add_action('wp_enqueue_scripts', array('YouTubePrefs', 'ytprefsscript'), 100);
188 - add_action('wp_enqueue_scripts', array('YouTubePrefs', 'fitvids'), 101);
233 + add_action('wp_enqueue_scripts', array(self::class, 'ytprefsscript'), 100);
234 + add_action('wp_enqueue_scripts', array(self::class, 'fitvids'), 101);
235 + }
189 236
237 + add_filter('ytprefs_filter_the_content_light', array(self::class, 'filter_the_content_light'));
190 238
239 + add_action("wp_ajax_my_embedplus_onboarding_save_ajax", array(self::class, 'onboarding_save_ajax'));
240 + add_action("wp_ajax_my_embedplus_settings_save_ajax", array(self::class, 'settings_save_ajax'));
241 + add_action("wp_ajax_my_embedplus_onboarding_save_apikey_ajax", array(self::class, 'onboarding_save_apikey_ajax'));
242 + add_action("wp_ajax_my_embedplus_glance_vids", array(self::class, 'my_embedplus_glance_vids'));
243 + add_action("wp_ajax_my_embedplus_glance_count", array(self::class, 'my_embedplus_glance_count'));
244 + add_action("wp_ajax_my_embedplus_dismiss_double_plugin_warning", array(self::class, 'my_embedplus_dismiss_double_plugin_warning'));
245 + add_action("wp_ajax_my_embedplus_gallery_page", array(self::class, 'my_embedplus_gallery_page'));
246 + add_action("wp_ajax_nopriv_my_embedplus_gallery_page", array(self::class, 'my_embedplus_gallery_page'));
247 + add_action('admin_enqueue_scripts', array(self::class, 'admin_enqueue_scripts'), 10, 1);
191 248
192 - if (self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0 && self::$alloptions[self::$opt_ogvideo] == 1)
193 - {
194 - add_action('wp_head', array('YouTubePrefs', 'do_ogvideo'));
195 - }
249 + if (!empty(self::$alloptions[self::$opt_not_live_on_channel]))
250 + {
251 + add_action("wp_footer", array(self::class, 'live_fallback_template'));
196 252 }
253 + /////////////////////////////////////
254 + include_once(EPYTGB_INCLUDES_PATH . 'gutenberg_hooks.php');
197 255 }
198 256
257 + public static function separate_version_message()
258 + {
259 + if (current_user_can('manage_options') && self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 10)
260 + {
261 + $class = 'notice notice-error is-dismissible';
262 + $message = 'Important message to Pro users: From version 11.7 onward, you must <a href="https://www.embedplus.com/youtube-pro/download/?prokey=' . esc_attr(self::$alloptions[self::$opt_pro]) . '" target="_blank">download the separate plugin here</a> to regain your Pro features. All your settings will automatically migrate after installing the separate Pro download. Thank you for your support and patience during this transition.';
263 +
264 + printf('<div class="%1$s"><p>%2$s</p></div>', esc_attr($class), wp_kses_post($message));
265 + }
266 + }
267 +
268 + public static function live_fallback_template()
269 + {
270 + echo '<script type="text/x-template" id="epyt-live-fallback">' . base64_encode(apply_filters('ytprefs_filter_the_content_light', wp_kses_post(self::$alloptions[self::$opt_not_live_content]))) . '</script>';
271 + }
272 +
273 + public static function defer_scripts($tag, $handle, $src)
274 + {
275 + $defer = array(
276 + '__dispload__',
277 + '__ytprefs__',
278 + '__dynload__',
279 + '__ytprefs__bar',
280 + '__ytprefsfitvids__',
281 + '__jquery_cookie__'
282 + );
283 +
284 + if (self::$alloptions[self::$opt_defer_jquery] == 1 && !is_admin())
285 + {
286 + array_push($defer, 'jquery', 'jquery-core', 'jquery-migrate');
287 + }
288 +
289 + if (in_array($handle, $defer) && stripos($tag, ' defer') === false)
290 + {
291 + $tag = str_replace(' src', ' defer src', $tag);
292 + }
293 +
294 + return $tag;
295 + }
296 +
297 + public static function my_plugin_action_links($links)
298 + {
299 + if (is_array($links))
300 + {
301 + $links[] = '<a href="' . esc_url(admin_url('admin.php?page=youtube-my-preferences')) . '">Settings</a>';
302 + $links[] = '<a href="https://www.embedplus.com/dashboard/pro-easy-video-analytics.aspx?ref=actionlinks" target="_blank">Pro Version</a>';
303 + }
304 + return $links;
305 + }
306 +
199 307 public static function show_glance_list()
200 308 {
201 309 $glancehref = self::show_glance();
202 310 $cnt = self::get_glance_count();
@@ -201,13 +309,10 @@
201 309 $glancehref = self::show_glance();
202 310 $cnt = self::get_glance_count();
203 311
204 312 //display via list
205 - return
206 - '<li class="page-count">
207 - <a href="' . $glancehref . '" class="thickbox ytprefs_glance_button" id="ytprefs_glance_button" title="YouTube Embeds At a Glance">
208 - ' . number_format_i18n($cnt) . ' With YouTube
209 - </a>
313 + return '<li class="page-count">
314 + <a href="' . $glancehref . '" class="thickbox ytprefs_glance_button" id="ytprefs_glance_button" title="YouTube Embeds At a Glance">' . number_format_i18n($cnt) . ' With YouTube</a>
210 315 </li>';
211 316 }
212 317
213 318 public static function show_glance_table()
@@ -250,8 +355,9 @@
250 355 #wpbody{margin-left: 0px;}
251 356 .wrap {font-family: Arial; padding: 0px 10px 0px 10px; line-height: 180%;}
252 357 .bold {font-weight: bold;}
253 358 .orange {color: #f85d00;}
359 + sup.orange {text-transform: lowercase; font-weight: bold; color: #f85d00;}
254 360 #adminmenuback {display: none;}
255 361 #adminmenu, adminmenuwrap {display: none;}
256 362 #wpcontent, .auto-fold #wpcontent {margin-left: 0px;}
257 363 #wpadminbar {display:none;}
@@ -269,8 +375,9 @@
269 375 .accthumb img {width: 300px; height: auto; display: block;}
270 376 .clearboth {clear: both;}
271 377 .pad20 {padding: 20px;}
272 378 .center {text-align: center;}
379 + #screen-meta-links {display: none;}
273 380 </style>
274 381 <script type="text/javascript">
275 382 function accclose(ele)
276 383 {
@@ -278,47 +385,48 @@
278 385 }
279 386
280 387 (function ($j)
281 388 {
282 - $j(document).ready(function () {
389 + $j(document).ready(function ()
390 + {
283 391
284 392
285 - $j('.acctitle').click(function () {
393 + $j('.acctitle').on('click', function ()
394 + {
286 395 var $acctitle = $j(this);
287 396 var $accbox = $j(this).parent().children('.accbox');
288 397 var pid = $accbox.attr("data-postid");
289 -
290 - $acctitle.prepend('<img class="accloader" src="<?php echo plugins_url('images/ajax-loader.gif', __FILE__) ?>" />');
398 + $acctitle.prepend('<img alt="loading" class="accloader" src="<?php echo plugins_url('images/ajax-loader.gif', __FILE__) ?>" />');
291 399 jQuery.ajax({
292 400 type: "post",
293 401 dataType: "json",
294 402 timeout: 30000,
295 - url: wpajaxurl,
403 + url: window._EPYTA_ ? window._EPYTA_.wpajaxurl : ajaxurl,
296 404 data: {action: 'my_embedplus_glance_vids', postid: pid},
297 - success: function (response) {
298 - if (response.type == "success") {
405 + success: function (response)
406 + {
407 + if (response.type === "success")
408 + {
299 409 $accbox.html(response.data),
300 410 $accbox.show(400);
301 411 }
302 - else {
412 + else
413 + {
303 414 }
304 415 },
305 - error: function (xhr, ajaxOptions, thrownError) {
416 + error: function (xhr, ajaxOptions, thrownError)
417 + {
306 418
307 419 },
308 - complete: function () {
420 + complete: function ()
421 + {
309 422 $acctitle.children('.accloader').remove();
310 423 }
311 424
312 425 });
313 -
314 -
315 426 });
316 427 });
317 - })(jQuery);
318 -
319 -
320 - </script>
428 + })(jQuery);</script>
321 429 <?php
322 430 global $wpdb;
323 431 $query_sql = "
324 432 SELECT SQL_CALC_FOUND_ROWS *
@@ -332,9 +440,9 @@
332 440 if ($query_result !== null)
333 441 {
334 442 $total = $wpdb->get_var("SELECT FOUND_ROWS();");
335 443 global $post;
336 - echo '<h2><img src="' . plugins_url('images/youtubeicon16.png', __FILE__) . '" /> 10 Latest Posts/Pages with YouTube Videos (' . $total . ' Total)</h2>';
444 + echo '<h2>10 Latest Posts/Pages with YouTube Videos (' . intval($total) . ' Total)</h2>';
337 445 ?>
338 446
339 447 We recommend using this page as an easy way to check the results of the global default settings you make (e.g. hide annotations) on your recent embeds. Or, simply use it as an index to jump right to your posts that contain YouTube embeds.
340 448
@@ -364,19 +472,35 @@
364 472 </div>
365 473 <?php
366 474 }
367 475
476 + public static function is_ajax()
477 + {
478 + $requested_with = filter_input(INPUT_SERVER, 'HTTP_X_REQUESTED_WITH');
479 + $is_ajax = (function_exists('wp_doing_ajax') && wp_doing_ajax() || (!empty($requested_with) && strtolower($requested_with) == 'xmlhttprequest') || (defined('DOING_AJAX') && DOING_AJAX));
480 + if ($is_ajax)
481 + {
482 + header('HTTP/1.1 200 OK');
483 + }
484 + return $is_ajax;
485 + }
486 +
368 487 public static function my_embedplus_glance_vids()
369 488 {
370 489 $result = array();
371 - if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
490 + if (self::is_ajax())
372 491 {
492 + if (!current_user_can('edit_posts'))
493 + {
494 + wp_send_json_error('Unauthorized');
495 + die();
496 + }
373 497 $postid = intval($_REQUEST['postid']);
374 498 $currpost = get_post($postid);
375 499
376 - $thehtml = '<img class="accclose" onclick="accclose(this)" src="' . plugins_url('images/accclose.png', __FILE__) . '" />';
500 + $thehtml = '<img alt="close" class="accclose" onclick="accclose(this)" src="' . plugins_url('images/accclose.png', __FILE__) . '" />';
377 501
378 - $matches = Array();
502 + $matches = array();
379 503 $ismatch = preg_match_all(self::$justurlregex, $currpost->post_content, $matches);
380 504
381 505 if ($ismatch)
382 506 {
@@ -404,17 +528,17 @@
404 528 if ($vidid != null)
405 529 {
406 530 try
407 531 {
408 - $odata = self::get_oembed('http://youtube.com/watch?v=' . $vidid, 1920, 1280);
532 + $odata = self::get_oembed('https://youtube.com/watch?v=' . $vidid, 1920, 1280);
409 533 $postlink = get_permalink($postid);
410 534 if ($odata != null && !is_wp_error($odata))
411 535 {
412 536 $_name = esc_attr(sanitize_text_field($odata->title));
413 537 $_description = esc_attr(sanitize_text_field($odata->author_name));
414 - $_thumbnailUrl = esc_url("//i.ytimg.com/vi/" . $vidid . "/0.jpg");
538 + $_thumbnailUrl = esc_url("https://i.ytimg.com/vi/" . $vidid . "/0.jpg");
415 539
416 - $thehtml .= '<a target="_blank" href="' . $postlink . '" class="accthumb"><img src="' . $_thumbnailUrl . '" /></a>';
540 + $thehtml .= '<a target="_blank" href="' . $postlink . '" class="accthumb"><img alt="YouTube Video" src="' . $_thumbnailUrl . '" /></a>';
417 541 $thehtml .= '<div class="accinfo">';
418 542 $thehtml .= '<a target="_blank" href="' . $postlink . '" class="accvidtitle">' . $_name . '</a>';
419 543 $thehtml .= '<div class="accdesc">' . (strlen($_description) > 400 ? substr($_description, 0, 400) . "..." : $_description) . '</div>';
420 544 $thehtml .= '</div>';
@@ -422,13 +546,41 @@
422 546 }
423 547 else
424 548 {
425 549 $thehtml .= '<p class="center bold orange">This <a target="_blank" href="' . $postlink . '">post/page</a> contains a video that has been removed from YouTube.';
550 + $thehtml .= '<br><a target="_blank" href="https://www.embedplus.com/dashboard/pro-easy-video-analytics.aspx?ref=glancevids">Activate delete video tracking to catch these cases &raquo;</a>';
551 + $thehtml .= '</strong>';
552 + }
553 + }
554 + catch (Exception $ex)
555 + {
556 +
557 + }
558 + }
559 + else if (isset($linkparams['list']))
560 + {
561 + // if playlist
562 + try
563 + {
564 + $odata = self::get_oembed('https://youtube.com/playlist?list=' . $linkparams['list'], 1920, 1280);
565 + $postlink = get_permalink($postid);
566 + if ($odata != null && !is_wp_error($odata))
567 + {
568 + $_name = esc_attr(sanitize_text_field($odata->title));
569 + $_description = esc_attr(sanitize_text_field($odata->author_name));
570 + $_thumbnailUrl = esc_url($odata->thumbnail_url);
426 571
427 - if (!(self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0))
428 - {
429 - $thehtml .='<br><a target="_blank" href="https://www.embedplus.com/dashboard/pro-easy-video-analytics.aspx">Activate delete video tracking to catch these cases &raquo;</a>';
430 - }
572 + $thehtml .= '<a target="_blank" href="' . $postlink . '" class="accthumb"><img alt="YouTube Video" src="' . $_thumbnailUrl . '" /></a>';
573 + $thehtml .= '<div class="accinfo">';
574 + $thehtml .= '<a target="_blank" href="' . $postlink . '" class="accvidtitle">' . $_name . '</a>';
575 + $thehtml .= '<div class="accdesc">' . (strlen($_description) > 400 ? substr($_description, 0, 400) . "..." : $_description) . '</div>';
576 + $thehtml .= '</div>';
577 + $thehtml .= '<div class="clearboth pad20"></div>';
578 + }
579 + else
580 + {
581 + $thehtml .= '<p class="center bold orange">This <a target="_blank" href="' . $postlink . '">post/page</a> contains a video that has been removed from YouTube.';
582 + $thehtml .= '<br><a target="_blank" href="https://www.embedplus.com/dashboard/pro-easy-video-analytics.aspx?ref=glancevids">Activate delete video tracking to catch these cases &raquo;</a>';
431 583 $thehtml .= '</strong>';
432 584 }
433 585 }
434 586 catch (Exception $ex)
@@ -435,11 +587,8 @@
435 587 {
436 588
437 589 }
438 590 }
439 - else if (false)
440 - { // if playlist
441 - }
442 591 }
443 592 }
444 593
445 594
@@ -465,10 +614,15 @@
465 614
466 615 public static function my_embedplus_glance_count()
467 616 {
468 617 $result = array();
469 - if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
618 + if (self::is_ajax())
470 619 {
620 + if (!current_user_can('edit_posts'))
621 + {
622 + wp_send_json_error('Unauthorized');
623 + die();
624 + }
471 625 $thehtml = '';
472 626
473 627 try
474 628 {
@@ -499,24 +653,1031 @@
499 653 }
500 654 die();
501 655 }
502 656
657 + public static function try_get_ytid($url)
658 + {
659 + $theytid = null;
660 + if (strpos($url, 'v=') !== false)
661 + {
662 + $url_params = explode('?', $url);
663 + $kvp = self::keyvalue($url_params[1], true);
664 + $theytid = $kvp['v'];
665 + }
666 + else if (strpos($url, "youtu.be") !== false)
667 + {
668 + $shortpath = explode('/', parse_url($url, PHP_URL_PATH));
669 + $theytid = $shortpath[1];
670 + }
671 + return $theytid;
672 + }
673 +
674 + public static function wizard()
675 + {
676 + ?>
677 + <div class="wrap" id="epyt_wiz_wrap">
678 + <div class="smallnote center"> Please periodically check the YouTube plugin tab on your admin panel to review the latest options. </div>
679 +
680 + <?php
681 + $form_valid = true;
682 + $acc_expand = '';
683 + $get_pro_link = self::$epbase . '/dashboard/pro-easy-video-analytics.aspx?ref=wizard';
684 +
685 +
686 +
687 + $step1_api_error_msg = ' Please confirm that the link works in your browser, and that <em>the owner of the video allowed embed sharing permissions (otherwise, contact the owner of the video to allow embedding)</em>. Then copy that full link in your address bar to paste here. If you are sure your link is correct, then (1) your API key may be too restrictive (<a target="_blank" href="https://console.developers.google.com/apis/credentials">check here</a>) or (2) you have reached your Google quota (<a href="https://console.developers.google.com/apis/dashboard" target="_blank">check here</a>). You can apply to Google for a <a href="https://services.google.com/fb/forms/ytapiquotarequest/" target="_blank">quota increase here</a>.';
688 + $step1_video_errors = '';
689 + $step1_video_error_invalid = 'Sorry, that does not seem to be a link to an existing video. Please confirm that the link works in your browser, and that <em>the owner of the video allowed embed sharing permissions (otherwise, contact the owner of the video to allow embedding)</em>. Then copy that full link in your address bar to paste here.';
690 + $step1_playlist_errors = '';
691 + $step1_playlist_error_invalid = 'Sorry, that does not seem to be a link to an existing playlist. Please confirm that the link works in your browser, and that <em>the owner of the playlist allowed embed sharing permissions (otherwise, contact the owner of the video to allow embedding)</em>. Then copy that full link in your address bar to paste here.';
692 + $step1_channel_errors = '';
693 + $step1_channel_error_invalid = 'Sorry, that does not seem to be a link to an existing video. ' . $step1_api_error_msg;
694 + $step1_live_errors = '';
695 + $step1_live_error_invalid = 'Sorry, that does not seem to be a valid link to an existing live video. ' . $step1_api_error_msg;
696 + $step1_livechannel_errors = '';
697 + $step1_livechannel_error_invalid = __('Sorry, that does not seem to be a link to an existing channel. Note: the custom channel name will not work. Please enter either a) the official channel format shown above, or b) any any single video belonging to the channel and the plugin can retrieve the official channel format for you.', 'text_domain');
698 +
699 + $if_live_preview = false;
700 +
701 + $theytid = null;
702 + $theplaylistid = null;
703 + $submit_type = null;
704 +
705 + if (isset($_POST['wizform_submit']))
706 + {
707 + check_admin_referer('_epyt_wiz', '_epyt_nonce');
708 +
709 + $submit_type = sanitize_text_field($_POST['wizform_submit']);
710 + if ($submit_type === 'step1_video')
711 + {
712 + // validate
713 + $search = sanitize_text_field(trim($_POST['txtUrl']));
714 +
715 + try
716 + {
717 + if (empty($search))
718 + {
719 + throw new Exception();
720 + }
721 + else
722 + {
723 + // cleanup
724 + $search = str_replace('/shorts/', '/watch?v=', $search);
725 + }
726 + if (preg_match(self::$justurlregex, $search))
727 + {
728 + //$search = esc_url($search);
729 +
730 + try
731 + {
732 + $theytid = self::try_get_ytid($search);
733 +
734 + if ($theytid == null)
735 + {
736 + $form_valid = false;
737 + $step1_video_errors = $step1_video_error_invalid;
738 + $acc_expand = 'h3_video';
739 + }
740 + else
741 + {
742 +
743 + $odata = self::get_oembed('http://youtube.com/watch?v=' . $theytid, 1920, 1280);
744 + if (is_object($odata))
745 + {
746 + ?>
747 +
748 + <div id="step2_video" class="center">
749 +
750 + <h2>
751 + <?php
752 + if (isset($odata->title))
753 + {
754 + echo sanitize_text_field($odata->title);
755 + }
756 + ?>
757 + </h2>
758 + <p class="center">
759 + <a class="ui-button ui-widget ui-corner-all" href="<?php echo $get_pro_link; ?>" target="_blank"><span class="ui-icon ui-icon-gear"></span> Customize (PRO)</a>
760 + &nbsp; <a class="ui-button ui-widget ui-corner-all inserttopost" rel="[embedyt] https://www.youtube.com/watch?v=<?php echo esc_attr($theytid) ?>[/embedyt]"><span class="ui-icon ui-icon-arrowthickstop-1-s"></span> Insert Into Editor</a>
761 + </p>
762 + &nbsp; Or Copy Code:
763 + <span class="copycode">[embedyt] https://www.youtube.com/watch?v=<?php echo esc_attr($theytid) ?>[/embedyt]</span>
764 + <div class="clearboth" style="height: 10px;">
765 + </div>
766 + <div class="ep-wizard-preview-video-wrapper">
767 + <iframe allow="fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" src="https://www.youtube.com/embed/<?php echo esc_attr($theytid) ?>?rel=0" allowfullscreen="" frameborder="0"></iframe>
768 + </div>
769 +
770 + </div>
771 + <?php
772 + }
773 + else
774 + {
775 + $form_valid = false;
776 + $step1_video_errors = $step1_video_error_invalid;
777 + $acc_expand = 'h3_video';
778 + }
779 + }
780 + }
781 + catch (Exception $ex)
782 + {
783 + $form_valid = false;
784 + $step1_video_errors = $step1_video_error_invalid;
785 + $acc_expand = 'h3_video';
786 + }
787 + }
788 + else
789 + {
790 + $search_options = new stdClass();
791 + $search_options->q = $search;
792 + $search_options->pageToken = null;
793 + ?>
794 + <div id="step2_video_search" class="center">
795 + <h2>You searched for: <em class="orange"><?php echo sanitize_text_field($search); ?></em> </h2>
796 +
797 + <?php
798 + $search_page = self::get_search_page($search_options);
799 + echo $search_page->html;
800 + ?>
801 + </div>
802 + <?php
803 + }
804 +
805 + // // if valid, set and display next step
806 + // if not,form_valid = false and set accordion expander and error messages
807 + }
808 + catch (Exception $ex)
809 + {
810 + $form_valid = false;
811 + $step1_video_errors = $step1_video_error_invalid;
812 + $acc_expand = 'h3_video';
813 + }
814 + }
815 + else if ($submit_type === 'step1_playlist')
816 + {
817 + $search = sanitize_text_field(trim($_POST['txtUrlPlaylist']));
818 + try
819 + {
820 + if (empty($search))
821 + {
822 + throw new Exception();
823 + }
824 + if (preg_match(self::$justurlregex, $search))
825 + {
826 + try
827 + {
828 + $theytid = null;
829 + try
830 + {
831 + $theytid = self::try_get_ytid($search);
832 + }
833 + catch (Exception $ex)
834 + {
835 +
836 + }
837 +
838 + $urlparams = explode('?', $search);
839 + $qvars = array();
840 + parse_str($urlparams[1], $qvars);
841 + $theplaylistid = $qvars["list"];
842 +
843 + $odata = self::get_oembed('https://youtube.com/playlist?list=' . $theplaylistid, 1920, 1280);
844 +
845 + if (is_object($odata))
846 + {
847 + $rel = 'https://www.youtube.com/embed?listType=playlist&list=' . (esc_attr($theplaylistid) . (empty($theytid) ? '' : '&v=' . esc_attr($theytid)));
848 + ?>
849 +
850 + <div id="step2_playlist" class="center">
851 +
852 + <h2>
853 + <?php
854 + if (isset($odata->title))
855 + {
856 + echo 'Playlist: ' . sanitize_text_field($odata->title);
857 + }
858 + ?>
859 + </h2>
860 + <p class="center">
861 + <a class="ui-button ui-widget ui-corner-all inserttopost" rel="[embedyt] <?php echo $rel; ?>[/embedyt]"><span class="ui-icon ui-icon-arrowthickstop-1-s"></span> Insert as Playlist</a>
862 + &nbsp; <a class="ui-button ui-widget ui-corner-all inserttopost" rel="[embedyt] <?php echo $rel . '&layout=gallery'; ?>[/embedyt]"><span class="ui-icon ui-icon-arrowthickstop-1-s"></span> Insert as Gallery</a>
863 + &nbsp; <a class="ui-button ui-widget ui-corner-all" href="<?php echo $get_pro_link; ?>" target="_blank"><span class="ui-icon ui-icon-gear"></span> Customize (PRO)</a>
864 + </p>
865 + <p>
866 + Or Copy Code:
867 + </p>
868 + <p>
869 + Playlist Layout: <span class="copycode">[embedyt] <?php echo $rel; ?>[/embedyt]</span>
870 + </p>
871 + <p>
872 + Gallery Layout: <span class="copycode">[embedyt] <?php echo $rel . '&layout=gallery'; ?>[/embedyt]</span>
873 + </p>
874 + <div class="clearboth" style="height: 10px;">
875 + </div>
876 + <div class="ep-wizard-preview-video-wrapper">
877 + <iframe allow="fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" src="<?php echo $rel; ?>" allowfullscreen="" frameborder="0"></iframe>
878 + </div>
879 + </div>
880 + <?php
881 + }
882 + else
883 + {
884 + $form_valid = false;
885 + $step1_playlist_errors = $step1_playlist_error_invalid;
886 + $acc_expand = 'h3_playlist';
887 + }
888 + }
889 + catch (Exception $ex)
890 + {
891 + $form_valid = false;
892 + $step1_playlist_errors = $step1_playlist_error_invalid;
893 + $acc_expand = 'h3_playlist';
894 + }
895 + }
896 + }
897 + catch (Exception $ex)
898 + {
899 + $form_valid = false;
900 + $step1_playlist_errors = $step1_playlist_error_invalid;
901 + $acc_expand = 'h3_playlist';
902 + }
903 + }
904 + else if ($submit_type === 'step1_channel')
905 + {
906 + $search = sanitize_text_field(trim($_POST['txtUrlChannel']));
907 + try
908 + {
909 + if (empty($search))
910 + {
911 + throw new Exception();
912 + }
913 + if (preg_match(self::$justurlregex, $search) || preg_match('@/channel/(.+)@', $search))
914 + {
915 + try
916 + {
917 + $thechannel = null;
918 + if (preg_match(self::$justurlregex, $search))
919 + {
920 + // single id
921 + $theytid = null;
922 + try
923 + {
924 + $theytid = self::try_get_ytid($search);
925 + }
926 + catch (Exception $ex)
927 + {
928 +
929 + }
930 + $chanvid = null;
931 + if ($theytid)
932 + {
933 + $chanvid = self::get_video_snippet($theytid);
934 + }
935 + if ($chanvid)
936 + {
937 + $thechannel = self::get_channel_snippet($chanvid->snippet->channelId);
938 + }
939 + }
940 + else
941 + {
942 + // channel id
943 + $chanmatch = array();
944 + preg_match('@/channel/(.+)@', $search, $chanmatch);
945 + if (!empty($chanmatch))
946 + {
947 + $thechannel = self::get_channel_snippet($chanmatch[1]);
948 + }
949 + }
950 + if ($thechannel)
951 + {
952 + $theplaylistid = $thechannel->contentDetails->relatedPlaylists->uploads;
953 + $rel = 'https://www.youtube.com/embed?listType=playlist&list=' . (esc_attr($theplaylistid));
954 + ?>
955 +
956 + <div id="step2_channel" class="center">
957 +
958 + <h2>
959 + <?php
960 + echo 'Channel: ' . sanitize_text_field($thechannel->snippet->title);
961 + ?>
962 + </h2>
963 + <p class="center">
964 + <a class="ui-button ui-widget ui-corner-all inserttopost" rel="[embedyt] <?php echo $rel; ?>[/embedyt]"><span class="ui-icon ui-icon-arrowthickstop-1-s"></span> Insert as Playlist</a>
965 + &nbsp; <a class="ui-button ui-widget ui-corner-all inserttopost" rel="[embedyt] <?php echo $rel . '&layout=gallery'; ?>[/embedyt]"><span class="ui-icon ui-icon-arrowthickstop-1-s"></span> Insert as Gallery</a>
966 + &nbsp; <a class="ui-button ui-widget ui-corner-all" href="<?php echo $get_pro_link; ?>" target="_blank"><span class="ui-icon ui-icon-gear"></span> Customize (PRO)</a>
967 + </p>
968 + <p>
969 + Or Copy Code:
970 + </p>
971 + <p>
972 + Playlist Layout: <span class="copycode">[embedyt] <?php echo $rel; ?>[/embedyt]</span>
973 + </p>
974 + <p>
975 + Gallery Layout: <span class="copycode">[embedyt] <?php echo $rel . '&layout=gallery'; ?>[/embedyt]</span>
976 + </p>
977 + <div class="clearboth" style="height: 10px;">
978 + </div>
979 + <div class="ep-wizard-preview-video-wrapper">
980 + <iframe allow="fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" src="<?php echo $rel; ?>" allowfullscreen="" frameborder="0"></iframe>
981 + </div>
982 + </div>
983 + <?php
984 + }
985 + else
986 + {
987 + $form_valid = false;
988 + $step1_channel_errors = $step1_channel_error_invalid;
989 + $acc_expand = 'h3_channel';
990 + }
991 + }
992 + catch (Exception $ex)
993 + {
994 + $form_valid = false;
995 + $step1_channel_errors = $step1_channel_error_invalid;
996 + $acc_expand = 'h3_channel';
997 + }
998 + }
999 + }
1000 + catch (Exception $ex)
1001 + {
1002 + $form_valid = false;
1003 + $step1_channel_errors = $step1_channel_error_invalid;
1004 + $acc_expand = 'h3_channel';
1005 + }
1006 + }
1007 + else if ($submit_type === 'step1_livechannel')
1008 + {
1009 + $search = sanitize_text_field(trim($_POST['txtUrlLiveChannel']));
1010 + try
1011 + {
1012 + if (empty($search))
1013 + {
1014 + throw new Exception();
1015 + }
1016 + if (preg_match(self::$justurlregex, $search) || preg_match('@/channel/(.+)@', $search))
1017 + {
1018 + try
1019 + {
1020 + $thechannelid = null;
1021 + if (preg_match(self::$justurlregex, $search))
1022 + {
1023 + // single id
1024 + $theytid = null;
1025 + try
1026 + {
1027 + $theytid = self::try_get_ytid($search);
1028 + }
1029 + catch (Exception $ex)
1030 + {
1031 +
1032 + }
1033 + $chanvid = null;
1034 + if ($theytid)
1035 + {
1036 + $chanvid = self::get_video_snippet($theytid);
1037 + }
1038 + if ($chanvid)
1039 + {
1040 + $thechannelid = $chanvid->snippet->channelId;
1041 + }
1042 + }
1043 + else
1044 + {
1045 + // channel id
1046 + $chanmatch = array();
1047 + preg_match('@/channel/(.+)@', $search, $chanmatch);
1048 + if (!empty($chanmatch))
1049 + {
1050 + $thechannelid = $chanmatch[1];
1051 + }
1052 + }
1053 + if (!empty($thechannelid))
1054 + {
1055 + $rel = 'https://www.youtube.com/embed/live_stream?channel=' . (esc_attr($thechannelid));
1056 +
1057 + $final_title = esc_url('https://www.youtube.com/channel/' . $thechannelid);
1058 + $final_title_prefix = 'Live stream from channel';
1059 + $doing_live = true;
1060 + ?>
1061 +
1062 + <div id="step2_livechannel" class="center">
1063 + <h2>
1064 + <?php
1065 + echo 'Live stream from channel: ' . esc_url('https://www.youtube.com/channel/' . $thechannelid);
1066 + ?>
1067 + </h2>
1068 + <p class="center">
1069 + <a class="ui-button ui-widget ui-corner-all inserttopost" rel="[embedyt] https://www.youtube.com/embed/live_stream?channel=<?php echo esc_attr($thechannelid) ?>[/embedyt]"><span class="ui-icon ui-icon-arrowthickstop-1-s"></span> Insert Into Editor</a>
1070 + &nbsp;
1071 + <a class="ui-button ui-widget ui-corner-all" href="<?php echo $get_pro_link; ?>" target="_blank"><span class="ui-icon ui-icon-gear"></span> Customize (PRO)</a>
1072 + </p>
1073 + &nbsp; Or Copy Code:
1074 + <span class="copycode">[embedyt] https://www.youtube.com/embed/live_stream?channel=<?php echo esc_attr($thechannelid) ?>[/embedyt]</span>
1075 + <div class="clearboth" style="height: 10px;">
1076 + </div>
1077 + <p>
1078 + <?php _e('If you see a black/empty YouTube player, then it likely means that you do not have any currently running or future live streams that are scheduled in your channel, so the plugin isn\'t getting any data from the YouTube API to show. If you want to continue to use the channel based live stream embedding method, we suggest regularly scheduling one or more live streams, or using the live stream fallback content feature, so the player is not black/empty.', 'text_domain'); ?>
1079 + </p>
1080 + <div class="ep-wizard-preview-video-wrapper">
1081 + <iframe allow="fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" src="https://www.youtube.com/embed/live_stream?channel=<?php echo esc_attr($thechannelid) ?>" allowfullscreen="" frameborder="0"></iframe>
1082 + </div>
1083 + </div>
1084 + <?php
1085 + }
1086 + else
1087 + {
1088 + $form_valid = false;
1089 + $step1_livechannel_errors = $step1_livechannel_error_invalid;
1090 + $acc_expand = 'h3_live';
1091 + }
1092 + }
1093 + catch (Exception $ex)
1094 + {
1095 + $form_valid = false;
1096 + $step1_livechannel_errors = $step1_livechannel_error_invalid;
1097 + $acc_expand = 'h3_live';
1098 + }
1099 + }
1100 + else
1101 + {
1102 + $form_valid = false;
1103 + $step1_livechannel_errors = $step1_livechannel_error_invalid;
1104 + $acc_expand = 'h3_live';
1105 + }
1106 + }
1107 + catch (Exception $ex)
1108 + {
1109 + $form_valid = false;
1110 + $step1_livechannel_errors = $step1_livechannel_error_invalid;
1111 + $acc_expand = 'h3_live';
1112 + }
1113 + }
1114 + else if ($submit_type === 'step1_live')
1115 + {
1116 + $search = sanitize_text_field(trim($_POST['txtUrlLive']));
1117 + try
1118 + {
1119 + if (empty($search))
1120 + {
1121 + throw new Exception();
1122 + }
1123 +
1124 + try
1125 + {
1126 + $theytid = null;
1127 + try
1128 + {
1129 + $theytid = self::try_get_ytid($search);
1130 + }
1131 + catch (Exception $ex)
1132 + {
1133 +
1134 + }
1135 + $live_attempt = self::get_video_snippet($theytid);
1136 + if ($live_attempt)
1137 + {
1138 + $if_live_preview = $live_attempt->id;
1139 + $final_title = sanitize_text_field($live_attempt->snippet->title);
1140 + $final_title_prefix = 'Live Stream';
1141 + }
1142 + $rel = 'https://www.youtube.com/watch?v=' . (esc_attr($theytid)) . '&live=1';
1143 + $doing_live = true;
1144 + ?>
1145 + <div id="step2_live" class="center">
1146 +
1147 + <h2>
1148 + <?php
1149 + echo 'Live Stream (or Premiere): ' . sanitize_text_field($live_attempt->snippet->title);
1150 + ?>
1151 + </h2>
1152 + <p class="center">
1153 + <a class="ui-button ui-widget ui-corner-all inserttopost" rel="[embedyt] <?php echo $rel; ?>[/embedyt]"><span class="ui-icon ui-icon-arrowthickstop-1-s"></span> Insert Into Editor</a>
1154 + &nbsp; <a class="ui-button ui-widget ui-corner-all" href="<?php echo $get_pro_link; ?>" target="_blank"><span class="ui-icon ui-icon-gear"></span> Customize (PRO)</a>
1155 + </p>
1156 + <p>
1157 + Or Copy Code:
1158 + </p>
1159 + <p>
1160 + <span class="copycode">[embedyt] <?php echo $rel; ?>[/embedyt]</span>
1161 + </p>
1162 + <div class="clearboth" style="height: 10px;">
1163 + </div>
1164 + <?php
1165 + if ($if_live_preview)
1166 + {
1167 + ?>
1168 + <div class="ep-wizard-preview-video-wrapper">
1169 + <iframe allow="fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" src="https://www.youtube.com/embed/<?php echo esc_attr($if_live_preview) ?>?rel=0" allowfullscreen="" frameborder="0"></iframe>
1170 + </div>
1171 + <?php
1172 + }
1173 + ?>
1174 + <p>
1175 + <?php _e('<strong>Is your live stream not working?</strong> Read more here: <a href="https://support.google.com/youtube/answer/2474026?hl=en" target="_blank">https://support.google.com/youtube/answer/2474026?hl=en</a>', 'text_domain'); ?>
1176 + </p>
1177 + </div>
1178 + <?php
1179 + }
1180 + catch (Exception $ex)
1181 + {
1182 + $form_valid = false;
1183 + $step1_live_errors = $step1_live_error_invalid;
1184 + $acc_expand = 'h3_live';
1185 + }
1186 + }
1187 + catch (Exception $ex)
1188 + {
1189 + $form_valid = false;
1190 + $step1_live_errors = $step1_live_error_invalid;
1191 + $acc_expand = 'h3_live';
1192 + }
1193 + }
1194 + else
1195 + {
1196 + $form_valid = false;
1197 + $acc_expand = 'h3none';
1198 + }
1199 + }
1200 +
1201 + if (!isset($_POST['wizform_submit']) || ($form_valid === false))
1202 + {
1203 + if ($form_valid === false)
1204 + {
1205 + ?>
1206 + <script type="text/javascript">
1207 + var _EPYTWIZ_ = _EPYTWIZ_ || {};
1208 + _EPYTWIZ_.acc_expand = '<?php echo sanitize_key($acc_expand) ?>';</script>
1209 + <?php
1210 + }
1211 + ?>
1212 +
1213 + <div class="wiz-accordion">
1214 + <h3 class="header-go"> <a href="<?php echo admin_url('admin.php?page=youtube-my-preferences#jumpdefaults'); ?>">Check my general YouTube embedding instructions and settings. </a></h3>
1215 + <div class="header-go-content"></div>
1216 + <h3 id="h3_video"> <a href="#"><?php _e('Embed a single video, or YouTube short.', 'text_domain'); ?></a></h3>
1217 + <div>
1218 + <h4 class="center">Single video directions</h4>
1219 + <p>
1220 + <?php _e('Paste the url of a single video below (examples: <em>https://www.youtube.com/watch?v=YVvn8dpSAt0</em> or <em>https://www.youtube.com/shorts/J38Yq85ZoyY</em>)', 'text_domain'); ?>
1221 + </p>
1222 + <form name="wizform_video" method="post" action="" class="wizform" id="wizform_video">
1223 + <?php wp_nonce_field('_epyt_wiz', '_epyt_nonce', true); ?>
1224 + <div class="center txt-button-align">
1225 + <input name="txtUrl" maxlength="200" id="txtUrl" class="txturlpastecustom ui-widget ui-widget-content ui-corner-all" placeholder="Paste URL here" type="text"> <button name="wizform_submit" class="ui-button ui-widget ui-corner-all" type="submit" value="step1_video">Submit</button>
1226 + </div>
1227 + <p class="badpaste orange bold" style="display: none;">
1228 + Please do not paste full embedcode above, only simple links to the YouTube video.
1229 + <br />
1230 + We have attempted to correct it above, but please doublecheck!
1231 + </p>
1232 + </form>
1233 + <?php echo $step1_video_errors ? '<p class="orange bold">' . $step1_video_errors . '</p>' : ''; ?>
1234 + <p><em>Note: You can also search YouTube videos by title in the text box above (example: <em>TED talks</em>). However, searching will use a significant amount of your YouTube API quota.</em></p>
1235 + </div>
1236 + <h3 id="h3_playlist"> <a href="#">Embed a playlist. </a></h3>
1237 + <div>
1238 + <h4 class="center">Playlist directions</h4>
1239 + <div class="playlist-tabs">
1240 + <ul>
1241 + <li><a href="#ptabs-1">Self-contained layout directions</a></li>
1242 + <li><a href="#ptabs-2">Gallery layout directions</a></li>
1243 + </ul>
1244 + <div id="ptabs-1">
1245 + <img src="<?php echo plugins_url('/images/icon-playlist-self.jpg', __FILE__) ?>" class="icon-playlist" />
1246 + <ol>
1247 + <li>Go to the page for the playlist that lists all of its videos (<a href="https://www.youtube.com/playlist?list=PL70DEC2B0568B5469" target="_blank">Example &raquo;</a>). </li>
1248 + <li>You may then click on the video that you want the playlist to start with (this step only applies to self-contained playlists. You cannot pick a starter for gallery layout directions).</li>
1249 + <li>Copy the URL in your browser and paste it in the textbox below. You'll notice that a playlist URL contains the playlist ID (e.g. "PL...")</li>
1250 + <li>Click "Get Playlist" to continue.</li>
1251 + </ol>
1252 + <div class="clearboth">
1253 + </div>
1254 + </div>
1255 + <div id="ptabs-2">
1256 + <img src="<?php echo plugins_url('/images/icon-playlist-gallery.jpg', __FILE__) ?>" class="icon-playlist" />
1257 + <ol>
1258 + <li>Go to the page for the playlist that lists all of its videos (<a href="https://www.youtube.com/playlist?list=PL70DEC2B0568B5469" target="_blank">Example &raquo;</a>). </li>
1259 + <li>Copy the URL in your browser and paste it in the textbox below. You'll notice that a playlist URL contains the playlist ID (e.g. "PL...")</li>
1260 + <li>Click "Get Playlist" to continue.</li>
1261 + </ol>
1262 + <div class="clearboth">
1263 + </div>
1264 + </div>
1265 + </div>
1266 +
1267 + <form name="wizform_playlist" method="post" action="" class="wizform" id="wizform_playlist">
1268 + <?php wp_nonce_field('_epyt_wiz', '_epyt_nonce', true); ?>
1269 + <div class="center txt-button-align">
1270 + <input name="txtUrlPlaylist" maxlength="200" id="txtUrlPlaylist" class="txturlpastecustom ui-widget ui-widget-content ui-corner-all" placeholder="Paste the playlist link here" type="text">
1271 + <button name="wizform_submit" class="ui-button ui-widget ui-corner-all" type="submit" value="step1_playlist">Get Playlist</button>
1272 + </div>
1273 + </form>
1274 + <?php echo $step1_playlist_errors ? '<p class="orange bold">' . $step1_playlist_errors . '</p>' : ''; ?>
1275 + </div>
1276 + <h3 id="h3_channel"> <a href="#">Embed a channel. </a></h3>
1277 + <div>
1278 + <h4 class="center">Channel directions</h4>
1279 + <?php
1280 + if (!self::has_api_key())
1281 + {
1282 + echo str_replace('###', '"search for channel"', self::$get_api_key_msg);
1283 + }
1284 + else
1285 + {
1286 + ?>
1287 + <p>
1288 + <?php _e('If you already know the direct link to the channel ID, enter it below. <br>Example: https://www.youtube.com<strong>/channel/</strong>UCnM5iMGiKsZg-iOlIO2ZkdQ <p class="error-channel-format smallnote">Note: the following format will not work: https://www.youtube.com<strong>/c/</strong>customchannelname If you cannot locate the proper channel ID format above, then try the other method below.</p> ', 'text_domain'); ?>
1289 + </p>
1290 + <p>
1291 + Or, simply enter a link to any single video that belongs to the user's channel, and the plugin will find the channel for you.<br>Example: https://www.youtube.com/watch?v=YVvn8dpSAt0
1292 + </p>
1293 + <form name="wizform_channel" method="post" action="" class="wizform" id="wizform_channel">
1294 + <?php wp_nonce_field('_epyt_wiz', '_epyt_nonce', true); ?>
1295 + <div class="center txt-button-align">
1296 + <input name="txtUrlChannel" maxlength="200" id="txtUrlChannel" class="txturlpastecustom ui-widget ui-widget-content ui-corner-all" placeholder="Paste YouTube link here" type="text"> <button name="wizform_submit" class="ui-button ui-widget ui-corner-all" type="submit" value="step1_channel">Get Channel</button>
1297 + </div>
1298 + <p class="badpaste orange bold" style="display: none;">
1299 + Please do not paste full embedcode above, only simple links to the YouTube video.
1300 + <br />
1301 + We have attempted to correct it above, but please doublecheck!
1302 + </p>
1303 + </form>
1304 + <?php echo $step1_channel_errors ? '<p class="orange bold">' . $step1_channel_errors . '</p>' : ''; ?>
1305 + <?php
1306 + }
1307 + ?>
1308 + </div>
1309 + <h3 id="h3_live"> <a href="#">Embed a live stream or premiere video. </a></h3>
1310 + <div>
1311 + <h4 class="center">Live stream or premiere directions</h4>
1312 + <?php
1313 + if (!self::has_api_key())
1314 + {
1315 + echo str_replace('###', 'live stream', self::$get_api_key_msg);
1316 + }
1317 + else
1318 + {
1319 + ?>
1320 + <div class="livestream-tabs">
1321 + <ul>
1322 + <li><a href="#livestream-tabs-2">Channel-based livestream (upgrade required)</a></li>
1323 + <li><a href="#livestream-tabs-1">Direct link to livestream or premiere video</a></li>
1324 + </ul>
1325 + <div id="livestream-tabs-1">
1326 + <p>
1327 + This will embed a specific live stream or premiere video.
1328 + </p>
1329 + <ol>
1330 + <li>
1331 + Paste in the direct URL of the live stream or premiere below and click Submit. <br> Example: https://www.youtube.com/watch?v=<strong>5qap5aO4i9A</strong>
1332 + </li>
1333 + <li>
1334 + On the next screen, customize or insert your video.
1335 + </li>
1336 + </ol>
1337 + <form name="wizform_live" method="post" action="" class="wizform" id="wizform_live">
1338 + <?php wp_nonce_field('_epyt_wiz', '_epyt_nonce', true); ?>
1339 + <div class="center txt-button-align">
1340 + <input name="txtUrlLive" maxlength="200" id="txtUrlLive" class="ui-widget ui-widget-content ui-corner-all" placeholder="Paste YouTube link here" type="text"> <button name="wizform_submit" class="ui-button ui-widget ui-corner-all" type="submit" value="step1_live">Submit</button>
1341 + </div>
1342 + </form>
1343 + <?php echo $step1_live_errors ? '<p class="orange bold">' . $step1_live_errors . '</p>' : ''; ?>
1344 + </div>
1345 + <div id="livestream-tabs-2">
1346 + <div class="alert">
1347 + <p>
1348 + Unfortunately, Google has recently removed their YouTube API feature that used to support automatic channel-based live streams. It appears they won't change things back. However, you do have a couple of choices:
1349 + </p>
1350 + <ol>
1351 + <li>Use "Direct link" live streams, as explained in the other tab. The trade-off is that you will have to manually post and take down your future live streams every time they start and when they end, respectively.</li>
1352 + <li>Or <a href="<?php echo self::$epbase ?>/dashboard/pro-easy-video-analytics.aspx" target="_blank">upgrade to Pro</a>, which has a solution that brings back all the "set it and forget it" features of channel-based embeds. We spent a significant amount of time developing a stable, long-term solution around YouTube's limitations, so we are releasing this effort exclusively to our Pro customers.</li>
1353 + </ol>
1354 +
1355 + </div>
1356 + <?php echo $step1_livechannel_errors ? '<p class="orange bold">' . $step1_livechannel_errors . '</p>' : ''; ?>
1357 + </div>
1358 + </div>
1359 + <?php
1360 + }
1361 + ?>
1362 + </div>
1363 + <h3 class="header-go"> <a href="<?php echo self::$epbase . '/dashboard/pro-easy-video-analytics.aspx?ref=wizardacc'; ?>">Check my performance, blocked countries, deleted videos, etc. (PRO) </a></h3>
1364 + <div class="header-go-content"></div>
1365 + </div>
1366 + <?php
1367 + }
1368 + ?>
1369 + </div>
1370 + <?php
1371 + }
1372 +
1373 + public static function has_api_key()
1374 + {
1375 + if (isset(self::$alloptions[self::$opt_apikey]) && strlen(trim(self::$alloptions[self::$opt_apikey])) > 0)
1376 + {
1377 + return true;
1378 + }
1379 +
1380 + return false;
1381 + }
1382 +
1383 + public static function get_live_snippet($channel)
1384 + {
1385 + $apiEndpoint = 'https://www.googleapis.com/youtube/v3/search?order=date&part=snippet&maxResults=1&type=video&eventType=live&safeSearch=none&videoEmbeddable=true&key=' . self::$alloptions[self::$opt_apikey]
1386 + . '&channelId=' . urlencode($channel);
1387 + $apiResult = wp_remote_get($apiEndpoint, array('timeout' => self::$curltimeout, 'headers' => array('referer' => site_url())));
1388 +
1389 + if (is_wp_error($apiResult))
1390 + {
1391 + return false;
1392 + }
1393 +
1394 + $jsonResult = json_decode($apiResult['body']);
1395 +
1396 + if (isset($jsonResult->error))
1397 + {
1398 + return false;
1399 + }
1400 +
1401 + if (isset($jsonResult->items) && $jsonResult->items != null && is_array($jsonResult->items) && count($jsonResult->items))
1402 + {
1403 + return $jsonResult->items[0];
1404 + }
1405 +
1406 + return false;
1407 + }
1408 +
1409 + public static function get_video_snippet($vid)
1410 + {
1411 + $apiEndpoint = 'https://www.googleapis.com/youtube/v3/videos?part=snippet&maxResults=1&key=' . self::$alloptions[self::$opt_apikey]
1412 + . '&id=' . urlencode($vid);
1413 + $apiResult = wp_remote_get($apiEndpoint, array('timeout' => self::$curltimeout, 'headers' => array('referer' => site_url())));
1414 +
1415 + if (is_wp_error($apiResult))
1416 + {
1417 + return false;
1418 + }
1419 +
1420 + $jsonResult = json_decode($apiResult['body']);
1421 +
1422 + if (isset($jsonResult->error))
1423 + {
1424 + return false;
1425 + }
1426 +
1427 + if (isset($jsonResult->items) && $jsonResult->items != null && is_array($jsonResult->items) && count($jsonResult->items))
1428 + {
1429 + return $jsonResult->items[0];
1430 + }
1431 +
1432 + return false;
1433 + }
1434 +
1435 + public static function get_channel_snippet($channid)
1436 + {
1437 + $apiEndpoint = 'https://www.googleapis.com/youtube/v3/channels?part=contentDetails,snippet&key=' . self::$alloptions[self::$opt_apikey]
1438 + . '&id=' . urlencode($channid);
1439 + $apiResult = wp_remote_get($apiEndpoint, array('timeout' => self::$curltimeout, 'headers' => array('referer' => site_url())));
1440 +
1441 + if (is_wp_error($apiResult))
1442 + {
1443 + return false;
1444 + }
1445 +
1446 + $jsonResult = json_decode($apiResult['body']);
1447 +
1448 + if (isset($jsonResult->error))
1449 + {
1450 + return false;
1451 + }
1452 +
1453 + if (isset($jsonResult->items) && $jsonResult->items != null && is_array($jsonResult->items) && count($jsonResult->items))
1454 + {
1455 + return $jsonResult->items[0];
1456 + }
1457 +
1458 + return false;
1459 + }
1460 +
1461 + public static function clean_api_error($raw_message)
1462 + {
1463 + return htmlspecialchars(strip_tags(preg_replace('@&key=[^& ]+@i', '&key=*******', $raw_message)), ENT_QUOTES, 'UTF-8');
1464 + }
1465 +
1466 + public static function clean_api_error_html($raw_message, $add_boilerplate)
1467 + {
1468 + $clean_html = '<div>Sorry, there was a YouTube error.</div>';
1469 + if (current_user_can('manage_options'))
1470 + {
1471 + $clean_html = '<div>Sorry, there was a YouTube API error: <em>' . self::clean_api_error($raw_message) . '</em>' .
1472 + ( $add_boilerplate ? self::$boilerplate_api_error_message : '' ) .
1473 + '</div>';
1474 + }
1475 + return $clean_html;
1476 + }
1477 +
1478 + public static function get_search_page($options)
1479 + {
1480 + $gallobj = new stdClass();
1481 + $pageSize = 30;
1482 +
1483 + if (!self::has_api_key())
1484 + {
1485 + $gallobj->html = '<div>' . str_replace('###', 'search', self::$get_api_key_msg) . '</div>';
1486 + return $gallobj;
1487 + }
1488 +
1489 + $apiEndpoint = 'https://www.googleapis.com/youtube/v3/search?part=snippet&maxResults=' . $pageSize . '&type=video&safeSearch=none&videoEmbeddable=true&key=' . self::$alloptions[self::$opt_apikey]
1490 + . '&q=' . urlencode($options->q);
1491 + if (!empty($options->pageToken))
1492 + {
1493 + $apiEndpoint .= '&pageToken=' . $options->pageToken;
1494 + }
1495 +
1496 + $code = '';
1497 + $apiResult = wp_remote_get($apiEndpoint, array('timeout' => self::$curltimeout, 'headers' => array('referer' => site_url())));
1498 +
1499 + if (is_wp_error($apiResult))
1500 + {
1501 + $gallobj->html = self::clean_api_error_html($apiResult->get_error_message(), true);
1502 + return $gallobj;
1503 + }
1504 +
1505 + $jsonResult = json_decode($apiResult['body']);
1506 +
1507 + if (isset($jsonResult->error))
1508 + {
1509 + if (isset($jsonResult->error->message))
1510 + {
1511 + $gallobj->html = self::clean_api_error_html($jsonResult->error->message, true);
1512 + return $gallobj;
1513 + }
1514 + $gallobj->html = '<div>Sorry, there may be an issue with your YouTube API key. ' . self::$boilerplate_api_error_message . '</div>';
1515 + return $gallobj;
1516 + }
1517 +
1518 + $totalResults = $jsonResult->pageInfo->totalResults;
1519 +
1520 + $nextPageToken = '';
1521 + $prevPageToken = '';
1522 + if (isset($jsonResult->nextPageToken))
1523 + {
1524 + $nextPageToken = $jsonResult->nextPageToken;
1525 + }
1526 +
1527 + if (isset($jsonResult->prevPageToken))
1528 + {
1529 + $prevPageToken = $jsonResult->prevPageToken;
1530 + }
1531 +
1532 + $cnt = 0;
1533 +
1534 + $code .= '<div class="epyt-search-results">';
1535 +
1536 + if (isset($jsonResult->items) && $jsonResult->items != null && is_array($jsonResult->items))
1537 + {
1538 + foreach ($jsonResult->items as $item)
1539 + {
1540 +
1541 + $thumb = new stdClass();
1542 +
1543 + $thumb->id = isset($item->snippet->resourceId->videoId) ? $item->snippet->resourceId->videoId : null;
1544 + $thumb->id = $thumb->id ? $thumb->id : (isset($item->id->videoId) ? $item->id->videoId : null);
1545 +
1546 + if ($thumb->id)
1547 + {
1548 + $thumb->title = $item->snippet->title;
1549 +
1550 + if (isset($item->snippet->thumbnails->high->url))
1551 + {
1552 + $thumb->img = $item->snippet->thumbnails->high->url;
1553 + $thumb->quality = 'high';
1554 + }
1555 + elseif (isset($item->snippet->thumbnails->default->url))
1556 + {
1557 + $thumb->img = $item->snippet->thumbnails->default->url;
1558 + $thumb->quality = 'default';
1559 + }
1560 + elseif (isset($item->snippet->thumbnails->medium->url))
1561 + {
1562 + $thumb->img = $item->snippet->thumbnails->medium->url;
1563 + $thumb->quality = 'medium';
1564 + }
1565 + else
1566 + {
1567 + $thumb->img = plugins_url('/images/deleted-video-thumb.png', __FILE__);
1568 + $thumb->quality = 'medium';
1569 + }
1570 +
1571 + $code .= self::get_search_result_html($thumb, $options);
1572 + $cnt++;
1573 + $code .= '<div class="clear-both"></div>';
1574 + }
1575 + }
1576 + }
1577 +
1578 + $code .= '<div class="clear-both"></div></div>';
1579 +
1580 + $totalPages = ceil($totalResults / $pageSize);
1581 + $pagination = '<div class="epyt-pagination">';
1582 +
1583 + $txtprev = self::$alloptions[self::$opt_gallery_customarrows] ? self::$alloptions[self::$opt_gallery_customprev] : _('Prev');
1584 + $pagination .= '<div tabindex="0" role="button" class="epyt-pagebutton epyt-prev ' . (empty($prevPageToken) ? ' hide ' : '') . '" data-q="' . esc_attr($options->q)
1585 + . '" data-pagetoken="' . esc_attr($prevPageToken)
1586 + . '"><div class="epyt-arrow">&laquo;</div> <div>' . $txtprev . '</div></div>';
1587 +
1588 +
1589 + $pagination .= '<div class="epyt-pagenumbers ' . ($totalPages > 1 ? '' : 'hide') . '">';
1590 + $pagination .= '<div class="epyt-current">1</div><div class="epyt-pageseparator"> / </div><div class="epyt-totalpages">' . $totalPages . '</div>';
1591 + $pagination .= '</div>';
1592 +
1593 + $txtnext = self::$alloptions[self::$opt_gallery_customarrows] ? self::$alloptions[self::$opt_gallery_customnext] : _('Next');
1594 + $pagination .= '<div tabindex="0" role="button" class="epyt-pagebutton epyt-next' . (empty($nextPageToken) ? ' hide ' : '') . '" data-q="' . esc_attr($options->q)
1595 + . '" data-pagetoken="' . esc_attr($nextPageToken)
1596 + . '"><div>' . $txtnext . '</div> <div class="epyt-arrow">&raquo;</div></div>';
1597 +
1598 + $pagination .= '<div class="epyt-loader"><img alt="loading" width="16" height="11" src="' . plugins_url('images/gallery-page-loader.gif', __FILE__) . '"></div>';
1599 + $pagination .= '</div>';
1600 +
1601 + $code = $pagination . $code . $pagination;
1602 + $gallobj->html = $code;
1603 + return $gallobj;
1604 + }
1605 +
1606 + public static function get_search_result_html($thumb, $options)
1607 + {
1608 + $get_pro_link = self::$epbase . '/dashboard/pro-easy-video-analytics.aspx?ref=searchresult';
1609 + $escId = esc_attr($thumb->id);
1610 + $code = '';
1611 +
1612 + $code .= '<div class="resultdiv" data-vid="' . $escId . '">
1613 + <div class="resultinfo">
1614 + <a class="pointer thumb load-movie" style="background-image: url(' . esc_url($thumb->img) . ')"></a>
1615 + <a class="resulttitle pointer load-movie"><span class="ui-icon ui-icon-circle-triangle-e"></span> ' . sanitize_text_field($thumb->title) . '</a>
1616 + <br>
1617 + <span style="display: block;" id="scrollwatch' . $escId . '"></span>
1618 + <div class="resultsubinfo">
1619 + <p>
1620 + <a class="ui-button ui-widget ui-corner-all" href="' . $get_pro_link . '" target="_blank"><span class="ui-icon ui-icon-gear"></span> Customize (PRO)</a>
1621 + &nbsp; <a class="ui-button ui-widget ui-corner-all inserttopost" rel="[embedyt] https://www.youtube.com/watch?v=' . $escId . '[/embedyt]"><span class="ui-icon ui-icon-arrowthickstop-1-s"></span> Insert Into Editor</a>
1622 + </p>
1623 + &nbsp; Or Copy Code:
1624 + <span class="copycode">[embedyt] https://www.youtube.com/watch?v=' . $escId . '[/embedyt]</span>
1625 + </div>
1626 + </div>
1627 + <div class="clearboth"></div>
1628 + </div>
1629 + <div id="moviecontainer' . $escId . '" class="center moviecontainer relative" style="display: none;">
1630 + Preview: <a id="closeme' . $escId . '" class="closeme" data-vid="' . $escId . '">
1631 + &times;
1632 + </a>
1633 + <div id="watch' . $escId . '">
1634 + </div>
1635 + </div>';
1636 +
1637 + return $code;
1638 + }
1639 +
1640 + public static function user_in_roles_any($user, $roles)
1641 + {
1642 + foreach ($user->roles as $idx => $r)
1643 + {
1644 + if (in_array($r, $roles))
1645 + {
1646 + return true;
1647 + }
1648 + }
1649 + return false;
1650 + }
1651 +
1652 + public static function is_restrict_wizard()
1653 + {
1654 + $curr_user = wp_get_current_user();
1655 + if (
1656 + $curr_user->ID // logged in
1657 + && isset(self::$alloptions[self::$opt_restrict_wizard]) && self::$alloptions[self::$opt_restrict_wizard] == 1 // restricting
1658 + && is_array(self::$alloptions[self::$opt_restrict_wizard_roles]) && !self::user_in_roles_any($curr_user, self::$alloptions[self::$opt_restrict_wizard_roles])
1659 + )
1660 + {
1661 + return true;
1662 + }
1663 + return false;
1664 + }
1665 +
503 1666 public static function media_button_wizard()
504 1667 {
1668 + if (self::is_restrict_wizard())
1669 + {
1670 + return;
1671 + }
1672 +
505 1673 add_thickbox();
506 1674
507 - $wizhref = self::$epbase . '/wpembedcode-simple-search.aspx?pluginversion=' . YouTubePrefs::$version .
508 - '&wpversion=' . get_bloginfo('version') .
509 - '&settingsurl=' . urlencode(admin_url('admin.php?page=youtube-my-preferences#jumpdefaults')) .
510 - '&dashurl=' . urlencode(admin_url('admin.php?page=youtube-ep-analytics-dashboard')) .
511 - '&blogwidth=' . YouTubePrefs::get_blogwidth() .
512 - '&domain=' . urlencode(site_url()) .
513 - '&prokey=' . urlencode(YouTubePrefs::$alloptions[YouTubePrefs::$opt_pro]) .
514 - '&myytdefaults=' . urlencode(http_build_query(YouTubePrefs::$alloptions)) .
1675 + $wizhref = admin_url('admin.php?page=youtube-ep-wizard') .
515 1676 '&random=' . rand(1, 1000) .
516 1677 '&TB_iframe=true&width=950&height=800';
517 1678 ?>
518 - <a href="<?php echo $wizhref; ?>" class="thickbox button ytprefs_media_link" id="ytprefs_wiz_button" title="Visual YouTube Search Tool and Wizard - An easier embedding option"><span></span> YouTube</a>
1679 + <a href="<?php echo esc_attr($wizhref); ?>" class="thickbox button ytprefs_media_link" id="ytprefs_wiz_button" title="Visual YouTube Search Tool and Wizard - For easier embedding"><span></span> YouTube</a>
519 1680 <?php
520 1681 }
521 1682
522 1683 public static function check_double_plugin_warning()
@@ -522,10 +1683,9 @@
522 1683 public static function check_double_plugin_warning()
523 1684 {
524 1685 if (is_plugin_active('embedplus-for-wordpress/embedplus.php'))
525 1686 {
526 - add_action('admin_notices', array("YouTubePrefs", "double_plugin_warning"));
527 - //self::$double_plugin = true;
1687 + add_action('admin_notices', array(self::class, "double_plugin_warning"));
528 1688 }
529 1689 }
530 1690
531 1691 public static function double_plugin_warning()
@@ -558,36 +1718,42 @@
558 1718 {
559 1719 echo '<a class="epxout">&times;</a>';
560 1720 }
561 1721 ?>
562 - Seems like you have two different YouTube plugins by the EmbedPlus Team installed: <b><img src="<?php echo plugins_url('images/youtubeicon16.png', __FILE__) ?>" /> YouTube</b> and <b><img src="<?php echo plugins_url('images/btn_embedpluswiz.png', __FILE__) ?>" /> Advanced YouTube Embed.</b> We strongly suggest keeping only the one you prefer, so that they don't conflict with each other while trying to create your embeds.</p>
1722 + Seems like you have two different YouTube plugins by the EmbedPlus Team installed; this one and <b>Advanced YouTube Embed.</b> We strongly suggest keeping only the one you prefer, so that they don't conflict with each other while trying to create your embeds.
1723 + </p>
563 1724 </div>
564 - <iframe allowTransparency="true" src="<?php echo self::$epbase . '/both-plugins-conflict.aspx' ?>" style="width:2px; height: 2px;" ></iframe>
1725 +
565 1726 <script type="text/javascript">
566 - (function ($) {
567 - $(document).ready(function () {
568 - $('.epxout').click(function () {
1727 + (function ($)
1728 + {
1729 + $(document).ready(function ()
1730 + {
1731 + $('.epxout').on('click', function ()
1732 + {
569 1733 $.ajax({
570 1734 type: "post",
571 1735 dataType: "json",
572 1736 timeout: 30000,
573 - url: wpajaxurl,
1737 + url: window._EPYTA_ ? window._EPYTA_.wpajaxurl : ajaxurl,
574 1738 data: {action: 'my_embedplus_dismiss_double_plugin_warning'},
575 - success: function (response) {
576 - if (response.type == "success") {
1739 + success: function (response)
1740 + {
1741 + if (response.type === "success")
1742 + {
577 1743 $(".embedpluswarningbox").hide();
578 1744 }
579 1745 },
580 - error: function (xhr, ajaxOptions, thrownError) {
1746 + error: function (xhr, ajaxOptions, thrownError)
1747 + {
581 1748 },
582 - complete: function () {
1749 + complete: function ()
1750 + {
583 1751 }
584 1752 });
585 1753 });
586 -
587 1754 });
588 - })(jQuery);
589 - </script>
1755 + })(jQuery);</script>
590 1756 <?php
591 1757 }
592 1758 }
593 1759 }
@@ -594,10 +1760,15 @@
594 1760
595 1761 public static function my_embedplus_dismiss_double_plugin_warning()
596 1762 {
597 1763 $result = array();
598 - if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
1764 + if (self::is_ajax())
599 1765 {
1766 + if (!current_user_can('manage_options'))
1767 + {
1768 + wp_send_json_error('Unauthorized');
1769 + die();
1770 + }
600 1771 $user_id = get_current_user_id();
601 1772 update_user_meta($user_id, 'embedplus_double_plugin_warning', 1);
602 1773 $result['type'] = 'success';
603 1774 echo json_encode($result);
@@ -621,14 +1792,21 @@
621 1792 ajaxurl: "<?php echo admin_url('admin-ajax.php'); ?>",
622 1793 security: "<?php echo wp_create_nonce('embedplus-nonce'); ?>",
623 1794 gallery_scrolloffset: <?php echo intval(self::$alloptions[self::$opt_gallery_scrolloffset]) ?>,
624 1795 eppathtoscripts: "<?php echo plugins_url('scripts/', __FILE__); ?>",
1796 + eppath: "<?php echo plugins_url('/', __FILE__); ?>",
625 1797 epresponsiveselector: <?php echo self::get_responsiveselector(); ?>,
626 - version: "<?php echo self::$alloptions[self::$opt_version] ?>",
1798 + version: "<?php echo esc_attr(self::$alloptions[self::$opt_version]) ?>",
627 1799 epdovol: true,
628 - evselector: '<?php echo self::get_evselector(); ?>'
629 - };
630 - </script>
1800 + evselector: '<?php echo self::get_evselector(); ?>',
1801 + ajax_compat: <?php echo self::$alloptions[self::$opt_ajax_compat] == '1' ? 'true' : 'false' ?>,
1802 + maxres_facade: '<?php echo esc_attr(self::$alloptions[self::$opt_maxres_facade]) ?>',
1803 + ytapi_load: '<?php echo esc_attr(self::$alloptions[self::$opt_ytapi_load]) ?>',
1804 + pause_others: <?php echo self::$alloptions[self::$opt_pause_others] == '1' ? 'true' : 'false' ?>,
1805 + facade_mode: <?php echo self::$alloptions[self::$opt_facade_mode] == '1' ? 'true' : 'false' ?>,
1806 + not_live_on_channel: <?php echo self::$alloptions[self::$opt_not_live_on_channel] == '1' ? 'true' : 'false' ?>,
1807 + stopMobileBuffer: <?php echo self::$alloptions[self::$opt_stop_mobile_buffer] == '1' ? 'true' : 'false' ?>
1808 + };</script>
631 1809 <?php
632 1810 }
633 1811 }
634 1812
@@ -634,57 +1812,78 @@
634 1812
635 1813 public static function fitvids()
636 1814 {
637 1815 $loggedin = current_user_can('edit_posts');
638 - if (!($loggedin && self::$alloptions[self::$opt_admin_off_scripts]))
1816 + if (!($loggedin && self::$alloptions[self::$opt_admin_off_scripts]) && (self::$alloptions[self::$opt_responsive] || self::$alloptions[self::$opt_widgetfit]))
639 1817 {
640 - wp_enqueue_script('__ytprefsfitvids__', plugins_url('scripts/fitvids.min.js', __FILE__), array('__ytprefs__'), false, true);
1818 + wp_enqueue_script('__ytprefsfitvids__', plugins_url('scripts/fitvids' . self::$min . '.js', __FILE__), array('__ytprefs__'), self::$version, true);
641 1819 }
642 1820 }
643 1821
644 1822 public static function initoptions()
645 1823 {
1824 + global $wpdb;
1825 + $arroptions = get_option(self::$opt_alloptions);
1826 + if ($arroptions !== false)
1827 + {
1828 + $bak = str_replace('.', '_', $arroptions[self::$opt_version]);
1829 + add_option(self::$opt_alloptions . '_backup_' . $bak, $arroptions, '', 'no');
1830 + $sql = "update " . $wpdb->options . " set autoload = 'no' where option_name like '" . self::$opt_alloptions . "\_backup\_%'";
1831 + $wpdb->query($sql);
1832 + }
1833 +
1834 + // backup settings for migration
1835 + if (isset($arroptions[self::$opt_pro]) && strlen(trim($arroptions[self::$opt_pro])) > 10)
1836 + {
1837 + add_option(self::$opt_alloptions . '_migrate', $arroptions);
1838 + }
1839 +
646 1840 //vanilla defaults
647 1841 $_center = 0;
648 - $_glance = 1;
649 - $_autoplay = get_option('youtubeprefs_autoplay', 0);
650 - $_cc_load_policy = get_option('youtubeprefs_cc_load_policy', 0);
651 - $_iv_load_policy = get_option('youtubeprefs_iv_load_policy', 1);
652 - $_loop = get_option('youtubeprefs_loop', 0);
653 - $_modestbranding = get_option('youtubeprefs_modestbranding', 0);
654 - $_rel = get_option('youtubeprefs_rel', 1);
655 - $_showinfo = get_option('youtubeprefs_showinfo', 1);
656 - $_html5 = get_option('youtubeprefs_html5', 0);
657 - $_theme = get_option('youtubeprefs_theme', 'dark');
658 - $_color = get_option('youtubeprefs_color', 'red');
659 - $_vq = get_option('youtubeprefs_vq', '');
1842 + $_glance = 0;
1843 + $_autoplay = 0;
1844 + $_cc_load_policy = 0;
1845 + $_cc_lang_pref = '';
1846 + $_iv_load_policy = 1;
1847 + $_loop = 0;
1848 + $_rel = 1;
1849 + $_fs = 1;
1850 + $_theme = 'dark';
1851 + $_color = 'red';
660 1852 $_autohide = 2;
661 1853 $_pro = '';
662 - $_ssl = 0;
663 1854 $_nocookie = 0;
1855 + $_gb_compat = 1;
1856 + $_facade_mode = 0;
1857 + $_facade_autoplay = 1;
1858 + $_gdpr_consent = 0;
1859 + $_gdpr_consent_message = self::$dft_gdpr_consent_message;
1860 + $_gdpr_consent_button = 'Accept YouTube Content';
664 1861 $_playlistorder = 0;
665 1862 $_acctitle = 0;
666 - $_ogvideo = 0;
667 1863 $_migrate = 0;
668 1864 $_migrate_youtube = 0;
669 - $_controls = 2;
1865 + $_migrate_embedplusvideo = 0;
1866 + $_controls = 1;
1867 + $_disablekb = 0;
670 1868 $_oldspacing = 1;
1869 + $_frontend_only = 1;
671 1870 $_responsive = 0;
672 1871 $_responsive_all = 1;
673 1872 $_widgetfit = 1;
674 1873 $_evselector_light = 0;
675 - $_schemaorg = 0;
676 - $_ftpostimg = 0;
677 - $_spdc = 0;
678 - $_spdcexp = 24;
679 - $_dynload = 0;
680 - $_dyntype = '';
681 - $_wmode = 'opaque';
682 - $_defaultdims = 0;
683 - $_defaultwidth = '';
684 - $_defaultheight = '';
1874 + $_stop_mobile_buffer = 1;
1875 + $_restrict_wizard = 0;
1876 + $_restrict_wizard_roles = self::$dft_roles;
1877 + $_ajax_compat = 0;
1878 + $_maxres_facade = 'eager';
1879 + $_ytapi_load = 'light';
1880 + $_defaultdims = 1;
1881 + $_defaultwidth = isset($GLOBALS['content_width']) && is_numeric($GLOBALS['content_width']) ? intval($GLOBALS['content_width']) : 800;
1882 + $_defaultheight = intval($_defaultwidth * 9.0 / 16.0);
685 1883 $_playsinline = 0;
686 1884 $_origin = 0;
1885 + $_pause_others = 0;
687 1886 $_defaultvol = 0;
688 1887 $_vol = '';
689 1888 $_apikey = '';
690 1889 $_hl = '';
@@ -689,84 +1888,119 @@
689 1888 $_apikey = '';
690 1889 $_hl = '';
691 1890 $_dohl = 0;
692 1891 $_gallery_columns = 3;
1892 + $_gallery_collapse_grid = 0;
1893 + $_gallery_collapse_grid_breaks = self::$dft_bpts;
693 1894 $_gallery_scrolloffset = 20;
1895 + $_gallery_hideprivate = 1;
694 1896 $_gallery_showtitle = 1;
1897 + $_gallery_showpaging = 1;
1898 + $_gallery_autonext = 0;
1899 + $_gallery_thumbplay = 1;
1900 + $_gallery_channelsub = 0;
1901 + $_gallery_channelsublink = '';
1902 + $_gallery_channelsubtext = 'Subscribe to my channel';
695 1903 $_gallery_customarrows = 0;
696 1904 $_gallery_customprev = 'Prev';
697 1905 $_gallery_customnext = 'Next';
698 1906 $_gallery_pagesize = 15;
699 - $_gallery_style = 'grid';
700 - $_gallery_showdsc = 0;
701 - $_gallery_thumbcrop = 'box';
1907 + $_not_live_content = '';
1908 + $_not_live_on = 0;
1909 + $_not_live_on_channel = 0;
702 1910 $_debugmode = 0;
1911 + $_uninstall_data = 0;
703 1912 $_admin_off_scripts = 0;
1913 + $_defer_js = 0;
1914 + $_defer_jquery = 0;
1915 + $_ajax_save = 1;
1916 + $_show_pointer = 1;
1917 + $_onboarded = 0;
704 1918 $_old_script_method = 0;
705 1919
706 - $arroptions = get_option(self::$opt_alloptions);
707 -
708 1920 //update vanilla to previous settings if exists
709 1921 if ($arroptions !== false)
710 1922 {
711 1923 $_center = self::tryget($arroptions, self::$opt_center, 0);
712 - $_glance = self::tryget($arroptions, self::$opt_glance, 1);
1924 + $_glance = self::tryget($arroptions, self::$opt_glance, $_glance);
713 1925 $_autoplay = self::tryget($arroptions, self::$opt_autoplay, 0);
714 1926 $_debugmode = self::tryget($arroptions, self::$opt_debugmode, 0);
1927 + $_uninstall_data = self::tryget($arroptions, self::$opt_uninstall_data, 0);
715 1928 $_old_script_method = self::tryget($arroptions, self::$opt_old_script_method, 0);
716 1929 $_cc_load_policy = self::tryget($arroptions, self::$opt_cc_load_policy, 0);
1930 + $_cc_lang_pref = self::tryget($arroptions, self::$opt_cc_lang_pref, $_cc_lang_pref);
717 1931 $_iv_load_policy = self::tryget($arroptions, self::$opt_iv_load_policy, 1);
718 1932 $_loop = self::tryget($arroptions, self::$opt_loop, 0);
719 - $_modestbranding = self::tryget($arroptions, self::$opt_modestbranding, 0);
720 1933 $_rel = self::tryget($arroptions, self::$opt_rel, 1);
721 - $_showinfo = self::tryget($arroptions, self::$opt_showinfo, 1);
1934 + $_fs = self::tryget($arroptions, self::$opt_fs, 1);
722 1935 $_playsinline = self::tryget($arroptions, self::$opt_playsinline, 0);
723 - $_origin = self::tryget($arroptions, self::$opt_origin, 0);
724 - $_html5 = self::tryget($arroptions, self::$opt_html5, 0);
1936 + $_origin = self::tryget($arroptions, self::$opt_origin, 1);
725 1937 $_hl = self::tryget($arroptions, self::$opt_hl, '');
726 1938 $_dohl = self::tryget($arroptions, self::$opt_dohl, 0);
727 1939 $_theme = self::tryget($arroptions, self::$opt_theme, 'dark');
728 1940 $_color = self::tryget($arroptions, self::$opt_color, 'red');
729 - $_wmode = self::tryget($arroptions, self::$opt_wmode, 'opaque');
730 - $_vq = self::tryget($arroptions, self::$opt_vq, '');
1941 + $_autohide = self::tryget($arroptions, self::$opt_autohide, 2);
731 1942 $_pro = self::tryget($arroptions, self::$opt_pro, '');
732 - $_ssl = self::tryget($arroptions, self::$opt_ssl, 0);
733 1943 $_nocookie = self::tryget($arroptions, self::$opt_nocookie, 0);
1944 + $_gb_compat = self::tryget($arroptions, self::$opt_gb_compat, $_gb_compat);
1945 + $_facade_mode = self::tryget($arroptions, self::$opt_facade_mode, $_facade_mode);
1946 + $_facade_autoplay = self::tryget($arroptions, self::$opt_facade_autoplay, $_facade_autoplay);
1947 + $_gdpr_consent = self::tryget($arroptions, self::$opt_gdpr_consent, $_gdpr_consent);
1948 + $_gdpr_consent_message = self::tryget($arroptions, self::$opt_gdpr_consent_message, $_gdpr_consent_message);
1949 + $_gdpr_consent_button = self::tryget($arroptions, self::$opt_gdpr_consent_button, $_gdpr_consent_button);
734 1950 $_playlistorder = self::tryget($arroptions, self::$opt_playlistorder, 0);
735 1951 $_acctitle = self::tryget($arroptions, self::$opt_acctitle, 0);
736 - $_ogvideo = self::tryget($arroptions, self::$opt_ogvideo, 0);
737 1952 $_migrate = self::tryget($arroptions, self::$opt_migrate, 0);
738 1953 $_migrate_youtube = self::tryget($arroptions, self::$opt_migrate_youtube, 0);
739 - $_controls = self::tryget($arroptions, self::$opt_controls, 2);
740 - $_autohide = self::tryget($arroptions, self::$opt_autohide, 2);
1954 + $_migrate_embedplusvideo = self::tryget($arroptions, self::$opt_migrate_embedplusvideo, 0);
1955 + $_controls = self::tryget($arroptions, self::$opt_controls, 1);
1956 + $_controls = $_controls == 2 ? 1 : $_controls;
1957 + $_disablekb = self::tryget($arroptions, self::$opt_disablekb, 0);
741 1958 $_oldspacing = self::tryget($arroptions, self::$opt_oldspacing, 1);
742 - $_responsive = self::tryget($arroptions, self::$opt_responsive, 0);
743 - $_responsive_all = self::tryget($arroptions, self::$opt_responsive_all, 1);
1959 + $_frontend_only = self::tryget($arroptions, self::$opt_frontend_only, $_frontend_only);
1960 + $_responsive = self::tryget($arroptions, self::$opt_responsive, $_responsive);
1961 + $_responsive_all = self::tryget($arroptions, self::$opt_responsive_all, $_responsive_all);
744 1962 $_widgetfit = self::tryget($arroptions, self::$opt_widgetfit, 1);
745 1963 $_evselector_light = self::tryget($arroptions, self::$opt_evselector_light, 0);
746 - $_schemaorg = self::tryget($arroptions, self::$opt_schemaorg, 0);
747 - $_ftpostimg = self::tryget($arroptions, self::$opt_ftpostimg, 0);
748 - $_spdc = self::tryget($arroptions, self::$opt_spdc, 0);
749 - $_spdcexp = self::tryget($arroptions, self::$opt_spdcexp, 24);
750 - $_dynload = self::tryget($arroptions, self::$opt_dynload, 0);
751 - $_dyntype = self::tryget($arroptions, self::$opt_dyntype, '');
752 - $_defaultdims = self::tryget($arroptions, self::$opt_defaultdims, 0);
753 - $_defaultwidth = self::tryget($arroptions, self::$opt_defaultwidth, '');
754 - $_defaultheight = self::tryget($arroptions, self::$opt_defaultheight, '');
1964 + $_stop_mobile_buffer = self::tryget($arroptions, self::$opt_stop_mobile_buffer, 1);
1965 + $_restrict_wizard = self::tryget($arroptions, self::$opt_restrict_wizard, 0);
1966 + $_restrict_wizard_roles = self::tryget($arroptions, self::$opt_restrict_wizard_roles, self::$dft_roles);
1967 + $_ajax_compat = self::tryget($arroptions, self::$opt_ajax_compat, 0);
1968 + $_maxres_facade = self::tryget($arroptions, self::$opt_maxres_facade, $_maxres_facade);
1969 + $_ytapi_load = self::tryget($arroptions, self::$opt_ytapi_load, $_ytapi_load);
1970 + $_defaultdims = self::tryget($arroptions, self::$opt_defaultdims, $_defaultdims);
1971 + $_defaultwidth = self::tryget($arroptions, self::$opt_defaultwidth, $_defaultwidth);
1972 + $_defaultheight = self::tryget($arroptions, self::$opt_defaultheight, $_defaultheight);
1973 + $_pause_others = self::tryget($arroptions, self::$opt_pause_others, $_pause_others);
755 1974 $_defaultvol = self::tryget($arroptions, self::$opt_defaultvol, 0);
756 1975 $_vol = self::tryget($arroptions, self::$opt_vol, '');
757 1976 $_apikey = self::tryget($arroptions, self::$opt_apikey, '');
758 1977 $_gallery_pagesize = self::tryget($arroptions, self::$opt_gallery_pagesize, 15);
759 1978 $_gallery_columns = self::tryget($arroptions, self::$opt_gallery_columns, 3);
1979 + $_gallery_collapse_grid = self::tryget($arroptions, self::$opt_gallery_collapse_grid, 0);
1980 + $_gallery_collapse_grid_breaks = self::tryget($arroptions, self::$opt_gallery_collapse_grid_breaks, self::$dft_bpts);
760 1981 $_gallery_scrolloffset = self::tryget($arroptions, self::$opt_gallery_scrolloffset, 20);
1982 + $_gallery_hideprivate = self::tryget($arroptions, self::$opt_gallery_hideprivate, $_gallery_hideprivate);
761 1983 $_gallery_showtitle = self::tryget($arroptions, self::$opt_gallery_showtitle, 1);
762 - $_gallery_style = self::tryget($arroptions, self::$opt_gallery_style, 'grid');
763 - $_gallery_thumbcrop = self::tryget($arroptions, self::$opt_gallery_thumbcrop, 'box');
1984 + $_gallery_showpaging = self::tryget($arroptions, self::$opt_gallery_showpaging, 1);
1985 + $_gallery_autonext = self::tryget($arroptions, self::$opt_gallery_autonext, 0);
1986 + $_gallery_thumbplay = self::tryget($arroptions, self::$opt_gallery_thumbplay, 1);
1987 + $_gallery_channelsub = self::tryget($arroptions, self::$opt_gallery_channelsub, $_gallery_channelsub);
1988 + $_gallery_channelsublink = self::tryget($arroptions, self::$opt_gallery_channelsublink, $_gallery_channelsublink);
1989 + $_gallery_channelsubtext = self::tryget($arroptions, self::$opt_gallery_channelsubtext, $_gallery_channelsubtext);
764 1990 $_gallery_customarrows = self::tryget($arroptions, self::$opt_gallery_customarrows, $_gallery_customarrows);
765 1991 $_gallery_customnext = self::tryget($arroptions, self::$opt_gallery_customnext, $_gallery_customnext);
766 1992 $_gallery_customprev = self::tryget($arroptions, self::$opt_gallery_customprev, $_gallery_customprev);
767 - $_gallery_showdsc = self::tryget($arroptions, self::$opt_gallery_showdsc, $_gallery_showdsc);
1993 + $_not_live_content = self::tryget($arroptions, self::$opt_not_live_content, $_not_live_content);
1994 + $_not_live_content = empty($_not_live_content) ? $_not_live_content : trim($_not_live_content);
1995 + $_not_live_on = self::tryget($arroptions, self::$opt_not_live_on, empty($_not_live_content) ? 0 : $_not_live_on);
1996 + $_not_live_on_channel = self::tryget($arroptions, self::$opt_not_live_on_channel, $_not_live_on_channel);
768 1997 $_admin_off_scripts = self::tryget($arroptions, self::$opt_admin_off_scripts, $_admin_off_scripts);
1998 + $_defer_js = self::tryget($arroptions, self::$opt_defer_js, $_defer_js);
1999 + $_defer_jquery = self::tryget($arroptions, self::$opt_defer_jquery, $_defer_jquery);
2000 + $_ajax_save = self::tryget($arroptions, self::$opt_ajax_save, $_ajax_save);
2001 + $_show_pointer = self::tryget($arroptions, self::$opt_show_pointer, $_show_pointer);
2002 + $_onboarded = 0; // self::tryget($arroptions, self::$opt_onboarded, $_onboarded);
769 2003 }
770 2004 else
771 2005 {
772 2006 $_oldspacing = 0;
@@ -777,61 +2011,81 @@
777 2011 self::$opt_center => $_center,
778 2012 self::$opt_glance => $_glance,
779 2013 self::$opt_autoplay => $_autoplay,
780 2014 self::$opt_cc_load_policy => $_cc_load_policy,
2015 + self::$opt_cc_lang_pref => $_cc_lang_pref,
781 2016 self::$opt_iv_load_policy => $_iv_load_policy,
782 2017 self::$opt_loop => $_loop,
783 - self::$opt_modestbranding => $_modestbranding,
784 2018 self::$opt_rel => $_rel,
785 - self::$opt_showinfo => $_showinfo,
2019 + self::$opt_fs => $_fs,
786 2020 self::$opt_playsinline => $_playsinline,
787 2021 self::$opt_origin => $_origin,
788 2022 self::$opt_autohide => $_autohide,
789 - self::$opt_html5 => $_html5,
790 2023 self::$opt_hl => $_hl,
791 2024 self::$opt_dohl => $_dohl,
792 2025 self::$opt_theme => $_theme,
793 2026 self::$opt_color => $_color,
794 - self::$opt_wmode => $_wmode,
795 - self::$opt_vq => $_vq,
796 2027 self::$opt_pro => $_pro,
797 - self::$opt_ssl => $_ssl,
798 2028 self::$opt_nocookie => $_nocookie,
2029 + self::$opt_gb_compat => $_gb_compat,
2030 + self::$opt_facade_mode => $_facade_mode,
2031 + self::$opt_facade_autoplay => $_facade_autoplay,
2032 + self::$opt_gdpr_consent => $_gdpr_consent,
2033 + self::$opt_gdpr_consent_message => $_gdpr_consent_message,
2034 + self::$opt_gdpr_consent_button => $_gdpr_consent_button,
799 2035 self::$opt_playlistorder => $_playlistorder,
800 2036 self::$opt_acctitle => $_acctitle,
801 - self::$opt_ogvideo => $_ogvideo,
802 2037 self::$opt_migrate => $_migrate,
803 2038 self::$opt_migrate_youtube => $_migrate_youtube,
2039 + self::$opt_migrate_embedplusvideo => $_migrate_embedplusvideo,
804 2040 self::$opt_controls => $_controls,
2041 + self::$opt_disablekb => $_disablekb,
805 2042 self::$opt_oldspacing => $_oldspacing,
2043 + self::$opt_frontend_only => $_frontend_only,
806 2044 self::$opt_responsive => $_responsive,
807 2045 self::$opt_responsive_all => $_responsive_all,
808 2046 self::$opt_widgetfit => $_widgetfit,
809 2047 self::$opt_evselector_light => $_evselector_light,
810 - self::$opt_schemaorg => $_schemaorg,
811 - self::$opt_ftpostimg => $_ftpostimg,
812 - self::$opt_spdc => $_spdc,
813 - self::$opt_spdcexp => $_spdcexp,
814 - self::$opt_dynload => $_dynload,
815 - self::$opt_dyntype => $_dyntype,
2048 + self::$opt_stop_mobile_buffer => $_stop_mobile_buffer,
2049 + self::$opt_restrict_wizard => $_restrict_wizard,
2050 + self::$opt_restrict_wizard_roles => $_restrict_wizard_roles,
2051 + self::$opt_ajax_compat => $_ajax_compat,
2052 + self::$opt_maxres_facade => $_maxres_facade,
2053 + self::$opt_ytapi_load => $_ytapi_load,
816 2054 self::$opt_defaultdims => $_defaultdims,
817 2055 self::$opt_defaultwidth => $_defaultwidth,
818 2056 self::$opt_defaultheight => $_defaultheight,
2057 + self::$opt_pause_others => $_pause_others,
819 2058 self::$opt_defaultvol => $_defaultvol,
820 2059 self::$opt_vol => $_vol,
821 2060 self::$opt_apikey => $_apikey,
822 2061 self::$opt_gallery_columns => $_gallery_columns,
2062 + self::$opt_gallery_collapse_grid => $_gallery_collapse_grid,
2063 + self::$opt_gallery_collapse_grid_breaks => $_gallery_collapse_grid_breaks,
823 2064 self::$opt_gallery_scrolloffset => $_gallery_scrolloffset,
2065 + self::$opt_gallery_hideprivate => $_gallery_hideprivate,
824 2066 self::$opt_gallery_showtitle => $_gallery_showtitle,
2067 + self::$opt_gallery_showpaging => $_gallery_showpaging,
2068 + self::$opt_gallery_autonext => $_gallery_autonext,
2069 + self::$opt_gallery_thumbplay => $_gallery_thumbplay,
2070 + self::$opt_gallery_channelsub => $_gallery_channelsub,
2071 + self::$opt_gallery_channelsublink => $_gallery_channelsublink,
2072 + self::$opt_gallery_channelsubtext => $_gallery_channelsubtext,
825 2073 self::$opt_gallery_customarrows => $_gallery_customarrows,
826 2074 self::$opt_gallery_customnext => $_gallery_customnext,
827 2075 self::$opt_gallery_customprev => $_gallery_customprev,
828 - self::$opt_gallery_showdsc => $_gallery_showdsc,
829 - self::$opt_gallery_style => $_gallery_style,
830 - self::$opt_gallery_thumbcrop => $_gallery_thumbcrop,
831 2076 self::$opt_gallery_pagesize => $_gallery_pagesize,
2077 + self::$opt_not_live_content => $_not_live_content,
2078 + self::$opt_not_live_on => $_not_live_on,
2079 + self::$opt_not_live_on_channel => $_not_live_on_channel,
832 2080 self::$opt_debugmode => $_debugmode,
2081 + self::$opt_uninstall_data => $_uninstall_data,
833 2082 self::$opt_admin_off_scripts => $_admin_off_scripts,
2083 + self::$opt_defer_js => $_defer_js,
2084 + self::$opt_defer_jquery => $_defer_jquery,
2085 + self::$opt_ajax_save => $_ajax_save,
2086 + self::$opt_show_pointer => $_show_pointer,
2087 + self::$opt_onboarded => $_onboarded,
834 2088 self::$opt_old_script_method => $_old_script_method
835 2089 );
836 2090
837 2091 update_option(self::$opt_alloptions, $all);
@@ -855,41 +2109,56 @@
855 2109 }
856 2110
857 2111 public static function do_ytprefs()
858 2112 {
859 - add_filter('autoptimize_filter_js_exclude', 'YouTubePrefs::ao_override_jsexclude', 10, 1);
860 - if (!is_admin())
2113 + //add_filter('autoptimize_filter_js_exclude', array(self::class, 'ao_override_jsexclude'), 10, 1);
2114 + if (
2115 + !is_admin() || (self::$alloptions[self::$opt_frontend_only] != 1)
2116 + //|| (function_exists('wp_doing_ajax') && wp_doing_ajax())
2117 + )
861 2118 {
862 - add_filter('the_content', 'YouTubePrefs::apply_prefs_content', 1);
863 - add_filter('widget_text', 'YouTubePrefs::apply_prefs_widget', 1);
864 - add_shortcode('embedyt', array('YouTubePrefs', 'apply_prefs_shortcode'));
2119 + add_filter('the_content', array(self::class, 'apply_prefs_content'), 1);
2120 + add_filter('widget_text', array(self::class, 'apply_prefs_widget'), 1);
2121 + //add_filter('bjll/skip_classes', array(self::class, 'bjll_skip_classes'), 10, 2);
2122 +
2123 + add_filter('sgo_lazy_load_exclude_classes', array(self::class, 'exclude_lazy_sgo'));
2124 +
2125 + add_shortcode('embedyt', array(self::class, 'apply_prefs_shortcode'));
865 2126 if (self::$alloptions[self::$opt_migrate] == 1)
866 2127 {
867 2128 if (self::$alloptions[self::$opt_migrate_youtube] == 1)
868 2129 {
869 - add_shortcode('youtube', array('YouTubePrefs', 'apply_prefs_shortcode_youtube'));
870 - add_shortcode('youtube_video', array('YouTubePrefs', 'apply_prefs_shortcode_youtube'));
2130 + add_shortcode('youtube', array(self::class, 'apply_prefs_shortcode_youtube'));
2131 + add_shortcode('youtube_video', array(self::class, 'apply_prefs_shortcode_youtube'));
871 2132 }
2133 + if (self::$alloptions[self::$opt_migrate_embedplusvideo] == 1)
2134 + {
2135 + add_shortcode('embedplusvideo', array(self::class, 'apply_prefs_shortcode_embedplusvideo'));
2136 + }
872 2137 }
873 2138 }
874 - else
2139 +
2140 + if (self::$alloptions[self::$opt_defer_js] == 1)
875 2141 {
876 - if (self::$alloptions[self::$opt_ftpostimg] == 1 && self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0)
877 - {
878 - add_action('save_post', array('YouTubePrefs', 'doftpostimg'), 110, 3);
879 - }
2142 + add_filter('script_loader_tag', array(self::class, 'defer_scripts'), 10, 3);
880 2143 }
881 2144 }
882 2145
883 2146 public static function ao_override_jsexclude($exclude)
884 2147 {
885 - if (strpos($exclude, 'ytprefs.min.js') === false)
2148 + if (strpos($exclude, 'ytprefs' . self::$min . '.js') === false)
886 2149 {
887 - return $exclude . ",ytprefs.min.js,__ytprefs__";
2150 + return $exclude . ',ytprefs' . self::$min . '.js,__ytprefs__';
888 2151 }
889 2152 return $exclude;
890 2153 }
891 2154
2155 + public static function exclude_lazy_sgo($classes)
2156 + {
2157 + $classes[] = '__youtube_prefs__';
2158 + return $classes;
2159 + }
2160 +
892 2161 public static function apply_prefs_shortcode($atts, $content = null)
893 2162 {
894 2163 $content = trim($content);
895 2164 $currfilter = current_filter();
@@ -894,9 +2163,9 @@
894 2163 $content = trim($content);
895 2164 $currfilter = current_filter();
896 2165 if (preg_match(self::$justurlregex, $content))
897 2166 {
898 - return self::get_html(array($content), $currfilter == 'widget_text' ? false : true);
2167 + return self::get_html(array($content), strpos($currfilter, 'widget_text') === 0 ? false : true, false);
899 2168 }
900 2169 return '';
901 2170 }
902 2171
@@ -901,51 +2170,88 @@
901 2170 }
902 2171
903 2172 public static function apply_prefs_shortcode_youtube($atts, $content = null)
904 2173 {
905 - $content = 'http://www.youtube.com/watch?v=' . trim($content);
2174 + $content = 'https://www.youtube.com/watch?v=' . trim($content);
906 2175 $currfilter = current_filter();
907 2176 if (preg_match(self::$justurlregex, $content))
908 2177 {
909 - return self::get_html(array($content), $currfilter == 'widget_text' ? false : true);
2178 + return self::get_html(array($content), $currfilter == 'widget_text' ? false : true, false);
910 2179 }
911 2180 return '';
912 2181 }
913 2182
2183 + public static function apply_prefs_shortcode_embedplusvideo($atts, $content = null)
2184 + {
2185 + $atts = shortcode_atts(array(
2186 + "height" => self::$defaultheight,
2187 + "width" => self::$defaultwidth,
2188 + "vars" => "",
2189 + "standard" => "",
2190 + "id" => "ep" . rand(10000, 99999)
2191 + ), $atts);
2192 +
2193 + $epvars = $atts['vars'];
2194 + $epvars = preg_replace('/\s/', '', $epvars);
2195 + $epvars = preg_replace('/¬/', '&not', $epvars);
2196 + $epvars = str_replace('&amp;', '&', $epvars);
2197 +
2198 + $epparams = self::keyvalue($epvars, true);
2199 +
2200 + if (isset($epparams) && isset($epparams['ytid']))
2201 + {
2202 + $start = isset($epparams['start']) && is_numeric($epparams['start']) ? '&start=' . intval($epparams['start']) : '';
2203 + $end = isset($epparams['end']) && is_numeric($epparams['end']) ? '&end=' . intval($epparams['end']) : '';
2204 + $end = isset($epparams['stop']) && is_numeric($epparams['stop']) ? '&end=' . intval($epparams['stop']) : '';
2205 +
2206 + $url = 'https://www.youtube.com/watch?v=' . trim($epparams['ytid']) . $start . $end;
2207 +
2208 + $currfilter = current_filter();
2209 + if (preg_match(self::$justurlregex, $url))
2210 + {
2211 + return self::get_html(array($url), $currfilter == 'widget_text' ? false : true, false);
2212 + }
2213 + }
2214 + return '';
2215 + }
2216 +
914 2217 public static function apply_prefs_content($content)
915 2218 {
916 - $content = preg_replace_callback(self::$ytregex, "YouTubePrefs::get_html_content", $content);
2219 + $content = preg_replace_callback(self::$ytregex, array(self::class, "get_html_content"), $content);
917 2220 return $content;
918 2221 }
919 2222
920 2223 public static function apply_prefs_widget($content)
921 2224 {
922 - $content = preg_replace_callback(self::$ytregex, "YouTubePrefs::get_html_widget", $content);
2225 + $content = preg_replace_callback(self::$ytregex, array(self::class, "get_html_widget"), $content);
923 2226 return $content;
924 2227 }
925 2228
926 2229 public static function get_html_content($m)
927 2230 {
928 - return self::get_html($m, true);
2231 + return self::get_html($m, true, true);
929 2232 }
930 2233
931 2234 public static function get_html_widget($m)
932 2235 {
933 - return self::get_html($m, false);
2236 + return self::get_html($m, false, true);
934 2237 }
935 2238
936 2239 public static function get_gallery_page($options)
937 2240 {
2241 + $gallobj = new stdClass();
2242 +
938 2243 $options->pageSize = min(intval($options->pageSize), 50);
939 - $options->columns = intval($options->columns);
2244 + $options->columns = intval($options->columns) == 0 ? 3 : intval($options->columns);
940 2245 $options->showTitle = intval($options->showTitle);
941 - $options->showDsc = intval($options->showDsc);
942 - $options->thumbcrop = sanitize_html_class($options->thumbcrop);
943 - $options->style = sanitize_html_class($options->style);
2246 + $options->showPaging = intval($options->showPaging);
2247 + $options->autonext = intval($options->autonext);
2248 + $options->thumbplay = intval($options->thumbplay);
944 2249
945 2250 if (empty($options->apiKey))
946 2251 {
947 - return '<div>Please enter your YouTube API key to embed galleries.</div>';
2252 + $gallobj->html = '<div>Please enter your YouTube API key to embed galleries.</div>';
2253 + return $gallobj;
948 2254 }
949 2255
950 2256 $apiEndpoint = 'https://www.googleapis.com/youtube/v3/playlistItems?part=snippet,status&playlistId=' . $options->playlistId
951 2257 . '&maxResults=' . $options->pageSize
@@ -953,45 +2259,40 @@
953 2259 if ($options->pageToken != null)
954 2260 {
955 2261 $apiEndpoint .= '&pageToken=' . $options->pageToken;
956 2262 }
957 - $spdckey = '';
958 - if (self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 8 && self::$alloptions[self::$opt_spdc] == 1)
2263 +
2264 + $code = '';
2265 + $init_id = null;
2266 +
2267 + $apiResult = wp_remote_get($apiEndpoint, array('timeout' => self::$curltimeout, 'headers' => array('referer' => site_url())));
2268 +
2269 + if (is_wp_error($apiResult))
959 2270 {
960 - try
961 - {
962 - $spdckey = self::$spdcprefix . '_' . md5($apiEndpoint . $options->columns . $options->style . $options->showTitle . $options->showDsc . $options->thumbcrop);
963 - $spdcval = get_transient($spdckey);
964 - if (!empty($spdcval))
965 - {
966 - //self::debuglog((microtime(true) - $time_start) . "\t" . $spdckey . "\t" . $spdcval . "\r\n");
967 - return $spdcval;
968 - }
969 - }
970 - catch (Exception $ex)
971 - {
972 -
973 - }
2271 + $gallobj->html = self::clean_api_error_html($apiResult->get_error_message(), true);
2272 + return $gallobj;
974 2273 }
975 2274
976 - $code = '';
977 -
978 - $apiResult = wp_remote_get($apiEndpoint);
979 2275 if (self::$alloptions[self::$opt_debugmode] == 1 && current_user_can('manage_options'))
980 2276 {
981 2277 $redactedEndpoint = preg_replace('@&key=[^&]+@i', '&key=PRIVATE', $apiEndpoint);
982 - return '<pre onclick="_EPADashboard_.selectText(this);" class="epyt-debug">CLICK this debug text to auto-select all. Then, COPY the selection.' . "\n\n" . $redactedEndpoint . "\n\n" . print_r($apiResult, true) . '</pre>';
2278 + $active_plugins = get_option('active_plugins');
2279 + $gallobj->html = '<pre onclick="_EPADashboard_.selectText(this);" class="epyt-debug">CLICK this debug text to auto-select all. Then, COPY the selection.' . "\n\n" .
2280 + 'THIS IS DEBUG MODE OUTPUT. UNCHECK THE OPTION IN THE SETTINGS PAGE ONCE YOU ARE DONE DEBUGGING TO PUT THINGS BACK TO NORMAL.' . "\n\n" . $redactedEndpoint . "\n\n" . print_r($apiResult, true) . "\n\nActive Plugins\n\n" . print_r($active_plugins, true) . '</pre>';
2281 + return $gallobj;
983 2282 }
984 -
2283 +
985 2284 $jsonResult = json_decode($apiResult['body']);
986 -
2285 +
987 2286 if (isset($jsonResult->error))
988 2287 {
989 2288 if (isset($jsonResult->error->message))
990 2289 {
991 - return '<div>Sorry, there was a YouTube API error: <em>' . strip_tags($jsonResult->error->message) . '</em></div>';
2290 + $gallobj->html = self::clean_api_error_html($jsonResult->error->message, true);
2291 + return $gallobj;
992 2292 }
993 - return '<div>Sorry, there may be an issue with your YouTube API key. Please enter a valid key to embed galleries.</div>';
2293 + $gallobj->html = '<div>Sorry, there may be an issue with your YouTube API key. ' . self::$boilerplate_api_error_message . '</div>';
2294 + return $gallobj;
994 2295 }
995 2296
996 2297
997 2298
@@ -1010,23 +2311,18 @@
1010 2311 $prevPageToken = $jsonResult->prevPageToken;
1011 2312 }
1012 2313
1013 2314 $cnt = 0;
1014 - $colclass = '';
1015 - if (in_array($options->style, array('grid', '')))
1016 - {
1017 - $colclass = ' epyt-cols-' . $options->columns . ' ';
1018 - }
2315 + $colclass = ' epyt-cols-' . $options->columns . ' ';
2316 + $code .= '<div class="epyt-gallery-allthumbs ' . $colclass . '">';
1019 2317
1020 - $cropclass = '';
1021 - if (!in_array($options->thumbcrop, array('box', '')))
1022 - {
1023 - $cropclass = ' epyt-thumb-' . $options->thumbcrop . ' ';
1024 - }
1025 -
1026 - $code.= '<div class="epyt-gallery-allthumbs ' . $cropclass . $colclass . '">';
1027 2318 if (isset($jsonResult->items) && $jsonResult->items != null && is_array($jsonResult->items))
1028 2319 {
2320 + if (strpos($options->playlistId, 'UU') === 0)
2321 + {
2322 + // sort only channels
2323 + usort($jsonResult->items, array(self::class, 'compare_vid_date')); // sorts in place
2324 + }
1029 2325
1030 2326 foreach ($jsonResult->items as $item)
1031 2327 {
1032 2328
@@ -1036,13 +2332,18 @@
1036 2332 $thumb->id = $thumb->id ? $thumb->id : $item->id->videoId;
1037 2333 $thumb->title = $options->showTitle ? $item->snippet->title : '';
1038 2334 $thumb->privacyStatus = isset($item->status->privacyStatus) ? $item->status->privacyStatus : null;
1039 2335
1040 - if (self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0 && $options->style == 'listview')
2336 + if ($thumb->privacyStatus == 'private' && self::$alloptions[self::$opt_gallery_hideprivate] == 1)
1041 2337 {
1042 - $thumb->dsc = $options->showDsc ? $item->snippet->description : '';
2338 + continue;
1043 2339 }
1044 2340
2341 + if ($cnt == 0 && $options->pageToken == null)
2342 + {
2343 + $init_id = $thumb->id;
2344 + }
2345 +
1045 2346 if ($thumb->privacyStatus == 'private')
1046 2347 {
1047 2348 $thumb->img = plugins_url('/images/private.png', __FILE__);
1048 2349 $thumb->quality = 'medium';
@@ -1058,11 +2359,16 @@
1058 2359 {
1059 2360 $thumb->img = $item->snippet->thumbnails->default->url;
1060 2361 $thumb->quality = 'default';
1061 2362 }
2363 + elseif (isset($item->snippet->thumbnails->medium->url))
2364 + {
2365 + $thumb->img = $item->snippet->thumbnails->medium->url;
2366 + $thumb->quality = 'medium';
2367 + }
1062 2368 else
1063 2369 {
1064 - $thumb->img = $item->snippet->thumbnails->medium->url;
2370 + $thumb->img = plugins_url('/images/deleted-video-thumb.png', __FILE__);
1065 2371 $thumb->quality = 'medium';
1066 2372 }
1067 2373 }
1068 2374
@@ -1068,9 +2374,9 @@
1068 2374
1069 2375 $code .= self::get_thumbnail_html($thumb, $options);
1070 2376 $cnt++;
1071 2377
1072 - if ($cnt % $options->columns === 0 && $options->style !== 'carousel')
2378 + if ($cnt % $options->columns === 0)
1073 2379 {
1074 2380 $code .= '<div class="epyt-gallery-rowbreak"></div>';
1075 2381 }
1076 2382 }
@@ -1077,66 +2383,58 @@
1077 2383 }
1078 2384
1079 2385 $code .= '<div class="epyt-gallery-clear"></div></div>';
1080 2386
1081 - if ($options->style === 'carousel' && $options->showTitle)
1082 - {
1083 - $code .= '<div class="epyt-gallery-rowtitle"></div>';
1084 - }
2387 + $totalPages = ceil($totalResults / $resultsPerPage);
2388 + $pagination = '<div class="epyt-pagination ' . ($options->showPaging == 0 ? 'epyt-hide-pagination' : '') . '">';
1085 2389
2390 + $txtprev = self::$alloptions[self::$opt_gallery_customarrows] ? self::$alloptions[self::$opt_gallery_customprev] : _('Prev');
2391 + $pagination .= '<div tabindex="0" role="button" class="epyt-pagebutton epyt-prev ' . (empty($prevPageToken) ? ' hide ' : '') . '" data-playlistid="' . esc_attr($options->playlistId)
2392 + . '" data-pagesize="' . intval($options->pageSize)
2393 + . '" data-pagetoken="' . esc_attr($prevPageToken)
2394 + . '" data-epcolumns="' . intval($options->columns)
2395 + . '" data-showtitle="' . intval($options->showTitle)
2396 + . '" data-showpaging="' . intval($options->showPaging)
2397 + . '" data-autonext="' . intval($options->autonext)
2398 + . '" data-thumbplay="' . intval($options->thumbplay)
2399 + . '"><div class="epyt-arrow">&laquo;</div> <div>' . $txtprev . '</div></div>';
1086 2400
1087 - $totalPages = ceil($totalResults / $resultsPerPage);
1088 - $pagination = '<div class="epyt-pagination">';
1089 - //if ($totalPages > 1)
1090 - {
1091 - //if (!empty($prevPageToken))
1092 - {
1093 - $txtprev = self::$alloptions[self::$opt_gallery_customarrows] ? self::$alloptions[self::$opt_gallery_customprev] : _('Prev');
1094 - $pagination .= '<div class="epyt-pagebutton epyt-prev ' . (empty($prevPageToken) ? ' hide ' : '') . '" data-playlistid="' . esc_attr($options->playlistId)
1095 - . '" data-pagesize="' . intval($options->pageSize)
1096 - . '" data-pagetoken="' . esc_attr($prevPageToken)
1097 - . '" data-style="' . esc_attr($options->style)
1098 - . '" data-columns="' . intval($options->columns)
1099 - . '" data-showtitle="' . intval($options->showTitle)
1100 - . ((self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 8 && $options->style == 'listview' && $options->showDsc) ? '" data-showdsc="' . intval($options->showDsc) : '')
1101 - . ((self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 8 && !in_array($options->thumbcrop, array('box', ''))) ? '" data-thumbcrop="' . $options->thumbcrop : '')
1102 - . '"><div class="arrow">&laquo;</div> <div>' . $txtprev . '</div></div>';
1103 - }
1104 2401
1105 - $pagination .= '<div class="epyt-pagenumbers ' . ($totalPages > 1 ? '' : 'hide') . '">';
1106 - $pagination .= '<div class="epyt-current">1</div><div class="epyt-pageseparator"> / </div><div class="epyt-totalpages">' . $totalPages . '</div>';
1107 - $pagination .= '</div>';
2402 + $pagination .= '<div class="epyt-pagenumbers ' . ($totalPages > 1 ? '' : 'hide') . '">';
2403 + $pagination .= '<div class="epyt-current">1</div><div class="epyt-pageseparator"> / </div><div class="epyt-totalpages">' . $totalPages . '</div>';
2404 + $pagination .= '</div>';
1108 2405
1109 - //if (!empty($nextPageToken))
1110 - {
1111 - $txtnext = self::$alloptions[self::$opt_gallery_customarrows] ? self::$alloptions[self::$opt_gallery_customnext] : _('Next');
1112 - $pagination .= '<div class="epyt-pagebutton epyt-next' . (empty($nextPageToken) ? ' hide ' : '') . '" data-playlistid="' . esc_attr($options->playlistId)
1113 - . '" data-pagesize="' . intval($options->pageSize)
1114 - . '" data-pagetoken="' . esc_attr($nextPageToken)
1115 - . '" data-style="' . esc_attr($options->style)
1116 - . '" data-columns="' . intval($options->columns)
1117 - . '" data-showtitle="' . intval($options->showTitle)
1118 - . ((self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0 && $options->style == 'listview' && $options->showDsc) ? '" data-showdsc="' . intval($options->showDsc) : '')
1119 - . ((self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 8 && !in_array($options->thumbcrop, array('box', ''))) ? '" data-thumbcrop="' . $options->thumbcrop : '')
1120 - . '"><div>' . $txtnext . '</div> <div class="arrow">&raquo;</div></div>';
1121 - }
1122 - $pagination .= '<div class="epyt-loader"><img width="16" height="11" src="' . plugins_url('images/gallery-page-loader.gif', __FILE__) . '"></div>';
1123 - }
2406 + $txtnext = self::$alloptions[self::$opt_gallery_customarrows] ? self::$alloptions[self::$opt_gallery_customnext] : _('Next');
2407 + $pagination .= '<div tabindex="0" role="button" class="epyt-pagebutton epyt-next' . (empty($nextPageToken) ? ' hide ' : '') . '" data-playlistid="' . esc_attr($options->playlistId)
2408 + . '" data-pagesize="' . intval($options->pageSize)
2409 + . '" data-pagetoken="' . esc_attr($nextPageToken)
2410 + . '" data-epcolumns="' . intval($options->columns)
2411 + . '" data-showtitle="' . intval($options->showTitle)
2412 + . '" data-showpaging="' . intval($options->showPaging)
2413 + . '" data-autonext="' . intval($options->autonext)
2414 + . '" data-thumbplay="' . intval($options->thumbplay)
2415 + . '"><div>' . $txtnext . '</div> <div class="epyt-arrow">&raquo;</div></div>';
2416 +
2417 + $pagination .= '<div class="epyt-loader"><img alt="loading" width="16" height="11" src="' . plugins_url('images/gallery-page-loader.gif', __FILE__) . '"></div>';
1124 2418 $pagination .= '</div>';
1125 2419
2420 +// if ($options->showPaging == 0)
2421 +// {
2422 +// $pagination = '<div class="epyt-pagination"></div>';
2423 +// }
1126 2424 $code = $pagination . $code . $pagination;
2425 + $gallobj->html = $code;
2426 + $gallobj->init_id = $init_id;
2427 + return $gallobj;
2428 + }
1127 2429
1128 - if (self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0 && self::$alloptions[self::$opt_spdc] == 1)
2430 + public static function compare_vid_date($a, $b)
2431 + {
2432 + if ($a->snippet->publishedAt == $b->snippet->publishedAt)
1129 2433 {
1130 - $daysecs = self::$alloptions[self::$opt_spdcexp] * 60 * 60;
1131 - set_transient($spdckey, $code, $daysecs);
1132 - $allk = get_option(self::$spdcall, array());
1133 - $allk[] = $spdckey;
1134 - update_option(self::$spdcall, $allk);
1135 -
1136 - //self::debuglog((microtime(true) - $time_start) . "\t" . $spdckey . "\t" . $code . "\r\n");
2434 + return 0;
1137 2435 }
1138 - return $code;
2436 + return ($a->snippet->publishedAt > $b->snippet->publishedAt) ? -1 : 1;
1139 2437 }
1140 2438
1141 2439 public static function get_thumbnail_html($thumb, $options)
1142 2440 {
@@ -1141,29 +2439,17 @@
1141 2439 public static function get_thumbnail_html($thumb, $options)
1142 2440 {
1143 2441 $escId = esc_attr($thumb->id);
1144 2442 $code = '';
1145 - $styleclass = '';
1146 - $rawstyle = '';
1147 - $dschtml = '';
1148 - if (self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0)
1149 - {
1150 - if ($options->style == 'listview')
1151 - {
1152 - $styleclass = 'epyt-listview';
1153 - $dschtml = isset($thumb->dsc) && !empty($thumb->dsc) ? '<div class="epyt-gallery-dsc">' . $thumb->dsc . '</div>' : '';
1154 - }
1155 - else if ($options->style == 'carousel')
1156 - {
1157 - $rawstyle = ' style="width: ' . (100.0 / floatval($options->pageSize)) . '%;" ';
1158 - }
1159 - }
2443 + $code .= '<div tabindex="0" role="button" data-videoid="' . $escId . '" class="epyt-gallery-thumb">';
1160 2444
1161 - $code .= '<div data-videoid="' . $escId . '" class="epyt-gallery-thumb ' . $styleclass . '" ' . $rawstyle . '>';
1162 - $code .= '<div class="epyt-gallery-img-box"><div class="epyt-gallery-img" style="background-image: url(' . esc_attr($thumb->img) . ')">' .
1163 - '<div class="epyt-gallery-playhover"><img class="epyt-play-img" width="30" height="23" src="' . plugins_url('images/playhover.png', __FILE__) . '" /><div class="epyt-gallery-playcrutch"></div></div>' .
2445 + $code .= (self::gdpr_mode() ? '<div class="epyt-gallery-img-box"><div class="epyt-gallery-img epyt-gallery-img-gdpr">' :
2446 + '<div class="epyt-gallery-img-box"><div class="epyt-gallery-img" style="background-image: url(' . esc_attr($thumb->img) . ')">') .
2447 + '<div class="epyt-gallery-playhover"><img alt="play" class="epyt-play-img" width="30" height="23" src="' . plugins_url('images/playhover.png', __FILE__) . '" data-no-lazy="1" data-skipgform_ajax_framebjll="" /><div class="epyt-gallery-playcrutch"></div></div>' .
1164 2448 '</div></div>';
1165 - if ($options->style != 'carousel' && !empty($thumb->title))
2449 +
2450 +
2451 + if (!empty($thumb->title))
1166 2452 {
1167 2453 $code .= '<div class="epyt-gallery-title">' . esc_html($thumb->title) . '</div>';
1168 2454 }
1169 2455 else
@@ -1169,27 +2455,25 @@
1169 2455 else
1170 2456 {
1171 2457 $code .= '<div class="epyt-gallery-notitle"><span>' . esc_html($thumb->title) . '</span></div>';
1172 2458 }
1173 - $code .= $dschtml . '</div>';
1174 -
1175 -
2459 + $code .= '</div>';
1176 2460 return $code;
1177 2461 }
1178 2462
1179 2463 public static function my_embedplus_gallery_page()
1180 2464 {
1181 - if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
2465 + if (self::is_ajax())
1182 2466 {
1183 - check_ajax_referer('embedplus-nonce', 'security');
2467 + //check_ajax_referer('embedplus-nonce', 'security');
1184 2468 $options = (object) $_POST['options'];
1185 2469 $options->apiKey = self::$alloptions[self::$opt_apikey];
1186 - echo self::get_gallery_page($options);
2470 + echo self::get_gallery_page($options)->html;
1187 2471 die();
1188 2472 }
1189 2473 }
1190 2474
1191 - public static function get_html($m, $iscontent)
2475 + public static function get_html($m, $iscontent, $isoverride)
1192 2476 {
1193 2477 //$time_start = microtime(true);
1194 2478
1195 2479 $link = trim(str_replace(self::$badentities, self::$goodliterals, $m[0]));
@@ -1207,40 +2491,109 @@
1207 2491 $vtemp = explode('/', $linkparamstemp[0]);
1208 2492 $linkparams['v'] = array_pop($vtemp);
1209 2493 }
1210 2494
1211 - //$linkscheme = 'http';
1212 - $youtubebaseurl = 'youtube';
1213 - $schemaorgoutput = '';
1214 - $voloutput = '';
1215 - $dynsrc = '';
1216 - $dyntype = '';
1217 - $acctitle = '';
1218 -
1219 - $finalparams = $linkparams + self::$alloptions;
1220 -
1221 - $spdckey = '';
1222 - if (self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0 && self::$alloptions[self::$opt_spdc] == 1)
2495 + if (isset($linkparams['live']) && $linkparams['live'] == '1')
1223 2496 {
1224 - try
2497 + $live_error_msg = ' To embed live videos, please make sure you performed the <a href="https://www.youtube.com/watch?v=ZCfrNvu6nMc" target="_blank">steps in this video</a> to create and save a proper server API key.';
2498 + if (isset(self::$alloptions[self::$opt_apikey]))
1225 2499 {
1226 - $kparams = $finalparams;
1227 - ksort($kparams);
1228 - $jparams = json_encode($kparams);
1229 - $spdckey = self::$spdcprefix . '_' . md5($jparams);
1230 - $spdcval = get_transient($spdckey);
1231 - if (!empty($spdcval))
2500 + if (isset($linkparams['channel']))
1232 2501 {
1233 - //self::debuglog((microtime(true) - $time_start) . "\t" . $spdckey . "\t" . $spdcval . "\r\n");
1234 - return $spdcval;
2502 + $linkparams['live_stream'] = 1;
2503 + if (false) // takes up too much quota;
2504 + {
2505 + try
2506 + {
2507 + $ytapilink_live = 'https://www.googleapis.com/youtube/v3/search?order=date&maxResults=1&type=video&eventType=live&safeSearch=none&videoEmbeddable=true&channelId=' . $linkparams['channel'] . '&part=snippet&key=' . self::$alloptions[self::$opt_apikey];
2508 + $apidata_live = wp_remote_get($ytapilink_live, array('timeout' => self::$curltimeout, 'headers' => array('referer' => site_url())));
2509 + if (!is_wp_error($apidata_live))
2510 + {
2511 + $raw = wp_remote_retrieve_body($apidata_live);
2512 + if (!empty($raw))
2513 + {
2514 + $json = json_decode($raw, true);
2515 + if (!isset($json['error']) && is_array($json) && count($json['items']))
2516 + {
2517 + $linkparams['v'] = $json['items'][0]['id']['videoId'];
2518 + }
2519 + else if (isset($json['error']))
2520 + {
2521 + return $live_error_msg; // . ' <em>(Error code ' . $json['error']->code . ': ' . $json['error']->message . ')</em>';
2522 + }
2523 + }
2524 + }
2525 + }
2526 + catch (Exception $ex)
2527 + {
2528 + return $live_error_msg;
2529 + }
2530 + }
1235 2531 }
2532 + else if (isset($linkparams['v']))
2533 + {
2534 + ////////////////////// process single video live stream
2535 + try
2536 + {
2537 + if (self::$alloptions[self::$opt_not_live_on])
2538 + {
2539 + // if not_live_content isn't being used, just process as a normal single video. otherwise: if not currently live (nor upcoming?), unset $linkparams['v']
2540 + $not_live_content = trim(htmlspecialchars_decode(wp_strip_all_tags(self::$alloptions[self::$opt_not_live_content], true), ENT_QUOTES));
2541 + if (!empty($not_live_content))
2542 + {
2543 + $ytapilink_live = 'https://www.googleapis.com/youtube/v3/videos?id=' . $linkparams['v'] . '&part=snippet&key=' . self::$alloptions[self::$opt_apikey];
2544 + $apidata_live = wp_remote_get($ytapilink_live, array('timeout' => self::$curltimeout, 'headers' => array('referer' => site_url())));
2545 + if (!is_wp_error($apidata_live))
2546 + {
2547 + $raw = wp_remote_retrieve_body($apidata_live);
2548 + if (!empty($raw))
2549 + {
2550 + $json = json_decode($raw, true);
2551 + if (!isset($json['error']) && is_array($json) && count($json['items']))
2552 + {
2553 + if (isset($json['items'][0]['snippet']['liveBroadcastContent']) && $json['items'][0]['snippet']['liveBroadcastContent'] != 'live')
2554 + {
2555 + unset($linkparams['v']);
2556 + }
2557 + }
2558 + else if (isset($json['error']))
2559 + {
2560 + return $live_error_msg; // . ' <em>(Error code ' . $json['error']->code . ': ' . $json['error']->message . ')</em>';
2561 + }
2562 + }
2563 + }
2564 + }
2565 + }
2566 + }
2567 + catch (Exception $ex)
2568 + {
2569 + return $live_error_msg;
2570 + }
2571 + }
1236 2572 }
1237 - catch (Exception $ex)
2573 + else
1238 2574 {
1239 -
2575 + return $live_error_msg;
1240 2576 }
2577 +
2578 + if (!isset($linkparams['v']) && !isset($linkparams['live_stream']))
2579 + {
2580 + return apply_filters('ytprefs_filter_the_content_light', wp_kses_post(self::$alloptions[self::$opt_not_live_content]));
2581 + }
1241 2582 }
1242 2583
2584 + if (stripos($linkparamstemp[0], 'live_stream') !== false)
2585 + {
2586 + $linkparams['live_stream'] = 1;
2587 + }
2588 +
2589 + $youtubebaseurl = 'youtube';
2590 + $voloutput = '';
2591 + $acctitle = '';
2592 + $relstop = '';
2593 +
2594 + $finalparams = $linkparams + self::$alloptions;
2595 +
1243 2596 self::init_dimensions($link, $linkparams, $finalparams);
1244 2597
1245 2598 if (self::$alloptions[self::$opt_nocookie] == 1)
1246 2599 {
@@ -1246,68 +2599,31 @@
1246 2599 {
1247 2600 $youtubebaseurl = 'youtube-nocookie';
1248 2601 }
1249 2602
1250 -
1251 -// if (self::$alloptions[self::$opt_ssl] == 1)
1252 -// {
1253 -// $linkscheme = 'https';
1254 -// }
1255 -
1256 2603 if (self::$alloptions[self::$opt_defaultvol] == 1)
1257 2604 {
1258 2605 $voloutput = ' data-vol="' . self::$alloptions[self::$opt_vol] . '" ';
1259 2606 }
1260 2607
1261 -
1262 -// if (!(self::$alloptions[self::$opt_dohl] == 1 && isset($finalparams[self::$opt_hl]) && strlen($finalparams[self::$opt_hl]) == 2))
1263 -// {
1264 -// unset($finalparams[self::$opt_hl]);
1265 -// }
1266 - if (self::$alloptions[self::$opt_dohl] == 1)
2608 + if (is_numeric(self::$alloptions[self::$opt_rel]) && intval(self::$alloptions[self::$opt_rel]) === -1)
1267 2609 {
1268 - $locale = get_locale();
1269 - $finalparams[self::$opt_hl] = $locale;
2610 + $relstop = ' data-relstop="1" ';
1270 2611 }
1271 - else
1272 - {
1273 - unset($finalparams[self::$opt_hl]);
1274 - }
1275 2612
1276 - if (isset($finalparams[self::$opt_html5]) && $finalparams[self::$opt_html5] == 0)
2613 + if (!empty($finalparams[self::$opt_loop]))
1277 2614 {
1278 - unset($finalparams[self::$opt_html5]);
2615 + $relstop = '';
1279 2616 }
1280 2617
1281 - if (self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0)
2618 + if (self::$alloptions[self::$opt_dohl] == 1)
1282 2619 {
1283 -
1284 - if (self::$alloptions[self::$opt_schemaorg] == 1 && isset($finalparams['v']))
1285 - {
1286 - $schemaorgoutput = self::getschemaorgoutput($finalparams['v']);
1287 - }
1288 -
1289 -
1290 -
1291 - if (self::$alloptions[self::$opt_dynload] == 1
1292 - //&& $finalparams[self::$opt_autoplay] != 1
1293 - )
1294 - {
1295 - $dynsrc = 'data-ep-';
1296 - $dyntype = ' data-ep-a="' . self::$alloptions[self::$opt_dyntype] . '" ';
1297 - }
1298 -
1299 - if (isset($linkparams[self::$opt_vol]) && is_numeric(trim($linkparams[self::$opt_vol])))
1300 - {
1301 - $voloutput = ' data-vol="' . $linkparams[self::$opt_vol] . '" ';
1302 - }
2620 + $locale = get_locale();
2621 + $finalparams[self::$opt_hl] = $locale;
1303 2622 }
1304 2623 else
1305 2624 {
1306 - if (isset($finalparams[self::$opt_vol]))
1307 - {
1308 - unset($finalparams[self::$opt_vol]);
1309 - }
2625 + unset($finalparams[self::$opt_hl]);
1310 2626 }
1311 2627
1312 2628 $centercode = '';
1313 2629 if ($finalparams[self::$opt_center] == 1)
@@ -1325,10 +2641,25 @@
1325 2641 $acctitle = self::$oembeddata->title;
1326 2642 }
1327 2643 else
1328 2644 {
1329 - $odata = self::get_oembed('http://youtube.com/watch?v=' . $linkparams['v'], 1920, 1280);
1330 - $acctitle = $odata->title;
2645 +
2646 + if (isset($linkparams['list']))
2647 + {
2648 + $odata = self::get_oembed('https://youtube.com/playlist?list=' . $linkparams['list'], 1920, 1280);
2649 + if (is_object($odata) && isset($odata->title))
2650 + {
2651 + $acctitle = $odata->title;
2652 + }
2653 + }
2654 + else if (isset($linkparams['v']))
2655 + {
2656 + $odata = self::get_oembed('https://youtube.com/watch?v=' . $linkparams['v'], 1920, 1280);
2657 + if (is_object($odata) && isset($odata->title))
2658 + {
2659 + $acctitle = $odata->title;
2660 + }
2661 + }
1331 2662 }
1332 2663
1333 2664 if ($acctitle)
1334 2665 {
@@ -1333,8 +2664,12 @@
1333 2664 if ($acctitle)
1334 2665 {
1335 2666 $acctitle = ' title="' . esc_attr($acctitle) . '" ';
1336 2667 }
2668 + else
2669 + {
2670 + $acctitle = ' title="YouTube player" ';
2671 + }
1337 2672 }
1338 2673 catch (Exception $e)
1339 2674 {
1340 2675
@@ -1339,8 +2674,12 @@
1339 2674 {
1340 2675
1341 2676 }
1342 2677 }
2678 + else
2679 + {
2680 + $acctitle = ' title="YouTube player" ';
2681 + }
1343 2682
1344 2683 // playlist cleanup
1345 2684 $videoidoutput = isset($linkparams['v']) ? $linkparams['v'] : '';
1346 2685
@@ -1348,9 +2687,12 @@
1348 2687 {
1349 2688 try
1350 2689 {
1351 2690 $videoidoutput = '';
1352 - $finalparams['index'] = intval($finalparams['plindex']);
2691 + if (isset($finalparams['plindex']))
2692 + {
2693 + $finalparams['index'] = intval($finalparams['plindex']);
2694 + }
1353 2695 }
1354 2696 catch (Exception $ex)
1355 2697 {
1356 2698
@@ -1359,11 +2701,10 @@
1359 2701
1360 2702 $galleryWrapper1 = '';
1361 2703 $galleryWrapper2 = '';
1362 2704 $galleryCode = '';
1363 - if (
1364 - isset($finalparams['layout']) && strtolower($finalparams['layout']) == 'gallery' && isset($finalparams['list'])
1365 - )
2705 + $galleryid_ifm_data = '';
2706 + if (isset($finalparams['layout']) && strtolower($finalparams['layout']) == 'gallery' && isset($finalparams['list']))
1366 2707 {
1367 2708 $gallery_options = new stdClass();
1368 2709 $gallery_options->playlistId = $finalparams['list'];
1369 2710 $gallery_options->pageToken = null;
@@ -1369,27 +2710,103 @@
1369 2710 $gallery_options->pageToken = null;
1370 2711 $gallery_options->pageSize = $finalparams[self::$opt_gallery_pagesize];
1371 2712 $gallery_options->columns = intval($finalparams[self::$opt_gallery_columns]);
1372 2713 $gallery_options->showTitle = intval($finalparams[self::$opt_gallery_showtitle]);
1373 - $gallery_options->showDsc = intval($finalparams[self::$opt_gallery_showdsc]);
1374 - $gallery_options->style = $finalparams[self::$opt_gallery_style];
1375 - $gallery_options->thumbcrop = $finalparams[self::$opt_gallery_thumbcrop];
2714 + $gallery_options->showPaging = intval($finalparams[self::$opt_gallery_showpaging]);
2715 + $gallery_options->autonext = intval($finalparams[self::$opt_gallery_autonext]);
2716 + $gallery_options->thumbplay = intval($finalparams[self::$opt_gallery_thumbplay]);
1376 2717 $gallery_options->apiKey = self::$alloptions[self::$opt_apikey];
1377 2718
1378 - $dynsrc = 'data-ep-gallery';
1379 - $galleryWrapper1 = '<div class="epyt-gallery" data-currpage="1">';
2719 + $galleryid = 'epyt_gallery_' . rand(10000, 99999);
2720 + $galleryid_ifm_data = ' data-epytgalleryid="' . $galleryid . '" ';
2721 +
2722 + $subbutton = '';
2723 + if (isset($finalparams[self::$opt_gallery_channelsub]) && $finalparams[self::$opt_gallery_channelsub] == 1)
2724 + {
2725 + $subbutton = '<div class="epyt-gallery-subscribe"><a target="_blank" class="epyt-gallery-subbutton" href="' .
2726 + esc_url(self::$alloptions[self::$opt_gallery_channelsublink]) . '?sub_confirmation=1"><img alt="subscribe" src="' . plugins_url('images/play-subscribe.png', __FILE__) . '" />' .
2727 + htmlspecialchars(self::$alloptions[self::$opt_gallery_channelsubtext], ENT_QUOTES, 'UTF-8') . '</a></div>';
2728 + }
2729 +
2730 + $gallery_page_obj = self::get_gallery_page($gallery_options);
2731 +
2732 + $galleryWrapper1 = '<div class="epyt-gallery" data-currpage="1" id="' . $galleryid . '">';
1380 2733 $galleryWrapper2 = '</div>';
1381 - $galleryCode = '<div class="epyt-gallery-list epyt-gallery-style-' . esc_attr($gallery_options->style) . '">' .
1382 - self::get_gallery_page($gallery_options) .
2734 + $galleryCode = $subbutton . '<div class="epyt-gallery-list">' . $gallery_page_obj->html . '</div>';
2735 + $videoidoutput = isset($gallery_page_obj->init_id) ? $gallery_page_obj->init_id : '';
2736 + }
2737 +
2738 + if (!empty($voloutput) && isset($finalparams['autoplay']) && $finalparams['autoplay'] == 1)
2739 + {
2740 + $voloutput .= ' data-epautoplay="1" ';
2741 + $finalparams['autoplay'] = 0;
2742 + }
2743 +
2744 + if (!empty($relstop) && isset($finalparams['rel']) && intval($finalparams['rel']) === -1)
2745 + {
2746 + $finalparams['rel'] = 0;
2747 + }
2748 +
2749 + if (!empty($finalparams['live_stream']))
2750 + {
2751 + $videoidoutput = 'live_stream';
2752 + }
2753 +
2754 + $begin_responsive = '';
2755 + $end_responsive = '';
2756 + $dim_attrs = ' width="' . self::$defaultwidth . '" height="' . self::$defaultheight . '" ';
2757 + if ($finalparams[self::$opt_responsive] == 1)
2758 + {
2759 + $begin_responsive = '<div class="epyt-video-wrapper">';
2760 + $end_responsive = '</div>';
2761 + }
2762 +
2763 + $begin_gb_wrapper = '';
2764 + $end_gb_wrapper = '';
2765 + if ($iscontent && !$isoverride && $finalparams[self::$opt_gb_compat] == 1 && current_theme_supports('responsive-embeds'))// self::using_gutenberg())
2766 + {
2767 + // don't do the following if: overriding default YT, is widget
2768 + $begin_gb_wrapper = '<figure class="wp-block-embed wp-block-embed-youtube is-type-video is-provider-youtube epyt-figure"><div class="wp-block-embed__wrapper">';
2769 + //wp-block-embed-youtube is-type-video is-provider-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio
2770 + $end_gb_wrapper = '</div></figure>';
2771 + }
2772 + $iframe_id = rand(10000, 99999);
2773 +
2774 + $code1 = $begin_gb_wrapper . $begin_responsive;
2775 + $code_iframe1 = $code_iframe2 = '';
2776 + if ($videoidoutput != 'live_stream' && $finalparams[self::$opt_facade_mode] == 1)
2777 + {
2778 + $facade_img_src = '';
2779 + if (!empty($videoidoutput))
2780 + {
2781 + $facade_img_src = ' src="https://i.ytimg.com/vi/' . $videoidoutput . ($finalparams[self::$opt_maxres_facade] == 'eager' ? '/maxresdefault.jpg' : '/hqdefault.jpg') . '" ';
2782 + }
2783 + else if (isset($finalparams['list']))
2784 + {
2785 + $facade_img_src = ' data-facadeoembed="playlist?list=' . $finalparams['list'] . '" ';
2786 + }
2787 + $acctitle = str_replace('title="', 'alt="', $acctitle);
2788 + $facade_autoplay = $finalparams[self::$opt_facade_autoplay] == 1 ? ' data-epautoplay="1" ' : '';
2789 + $code_iframe1 = '<div ' . $centercode . ' id="_ytid_' . $iframe_id . '" ' . $dim_attrs . ' data-origwidth="' . self::$defaultwidth . '" data-origheight="' . self::$defaultheight . '" ' . $relstop .
2790 + 'data-facadesrc="https://www.' . $youtubebaseurl . '.com/embed/' . $videoidoutput . '?';
2791 + $code_iframe2 = '" class="__youtube_prefs__ epyt-facade' . (!empty($finalparams['live_stream']) ? ' epyt-live-channel ' : '') . ($iscontent ? '' : ' __youtube_prefs_widget__ ') . ($isoverride ? ' epyt-is-override ' : '') . ' no-lazyload"' .
2792 + $voloutput . $galleryid_ifm_data . $facade_autoplay . '><img data-spai-excluded="true" class="epyt-facade-poster skip-lazy" loading="lazy" ' . $acctitle . $facade_img_src . ' />' .
2793 + '<button class="epyt-facade-play" aria-label="Play"><svg data-no-lazy="1" height="100%" version="1.1" viewBox="0 0 68 48" width="100%"><path class="ytp-large-play-button-bg" d="M66.52,7.74c-0.78-2.93-2.49-5.41-5.42-6.19C55.79,.13,34,0,34,0S12.21,.13,6.9,1.55 C3.97,2.33,2.27,4.81,1.48,7.74C0.06,13.05,0,24,0,24s0.06,10.95,1.48,16.26c0.78,2.93,2.49,5.41,5.42,6.19 C12.21,47.87,34,48,34,48s21.79-0.13,27.1-1.55c2.93-0.78,4.64-3.26,5.42-6.19C67.94,34.95,68,24,68,24S67.94,13.05,66.52,7.74z" fill="#f00"></path><path d="M 45,24 27,14 27,34" fill="#fff"></path></svg></button>' .
1383 2794 '</div>';
1384 - $videoidoutput = 'GALLERYVIDEOID';
1385 2795 }
2796 + else
2797 + {
2798 + $code_iframe1 = '<iframe ' . $centercode . ' id="_ytid_' . $iframe_id . '" ' . $dim_attrs . ' data-origwidth="' . self::$defaultwidth . '" data-origheight="' . self::$defaultheight . '" ' . $relstop .
2799 + 'src="https://www.' . $youtubebaseurl . '.com/embed/' . $videoidoutput . '?';
2800 + $code_iframe2 = '" class="__youtube_prefs__ ' . (!empty($finalparams['live_stream']) ? ' epyt-live-channel ' : '') . ($iscontent ? '' : ' __youtube_prefs_widget__ ') . ($isoverride ? ' epyt-is-override ' : '') . ' no-lazyload"' .
2801 + $voloutput . $acctitle . $galleryid_ifm_data . ' allow="fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen data-no-lazy="1" data-skipgform_ajax_framebjll=""></iframe>';
2802 + }
1386 2803
1387 - $code1 = '<iframe ' . $dyntype . $centercode . ' id="_ytid_' . rand(10000, 99999) . '" width="' . self::$defaultwidth . '" height="' . self::$defaultheight .
1388 - '" ' . $dynsrc . 'src="//www.' . $youtubebaseurl . '.com/embed/' . $videoidoutput . '?';
1389 - $code2 = '" frameborder="0" class="__youtube_prefs__' . ($iscontent ? '' : ' __youtube_prefs_widget__') .
1390 - '"' . $voloutput . $acctitle . ' allowfullscreen ></iframe>' . $schemaorgoutput;
2804 + $code2 = $end_responsive . $end_gb_wrapper;
1391 2805
2806 + $code1 .= $code_iframe1;
2807 + $code2 = $code_iframe2 . $code2;
2808 +
1392 2809 $origin = '';
1393 2810
1394 2811 try
1395 2812 {
@@ -1402,9 +2819,9 @@
1402 2819 catch (Exception $e)
1403 2820 {
1404 2821 $origin = '';
1405 2822 }
1406 - $finalsrc = 'enablejsapi=1&' . $origin;
2823 + $finalsrc = (self::$alloptions[self::$opt_ytapi_load] == 'never' ? '' : 'enablejsapi=1&') . $origin;
1407 2824
1408 2825 if (count($finalparams) > 1)
1409 2826 {
1410 2827 foreach ($finalparams as $key => $value)
@@ -1416,12 +2833,15 @@
1416 2833
1417 2834 }
1418 2835 else
1419 2836 {
1420 - $finalsrc .= htmlspecialchars($key) . '=' . htmlspecialchars($value) . '&';
1421 - if ($key == 'loop' && $value == 1 && !isset($finalparams['list']))
2837 + if (!((isset($finalparams['live']) || isset($finalparams['live_stream'])) && $key == 'loop')) // don't add loop for channel streaming
1422 2838 {
1423 - $finalsrc .= 'playlist=' . $finalparams['v'] . '&';
2839 + $finalsrc .= htmlspecialchars($key, ENT_QUOTES, 'UTF-8') . '=' . htmlspecialchars($value, ENT_QUOTES, 'UTF-8') . '&';
2840 + if ($key == 'loop' && $value == 1 && !isset($finalparams['list']))
2841 + {
2842 + $finalsrc .= 'playlist=' . $finalparams['v'] . '&';
2843 + }
1424 2844 }
1425 2845 }
1426 2846 }
1427 2847 }
@@ -1426,51 +2846,65 @@
1426 2846 }
1427 2847 }
1428 2848 }
1429 2849
1430 - $code = $galleryWrapper1 . $code1 . $finalsrc . $code2 . $galleryCode . $galleryWrapper2; //. '<!--' . $m[0] . '-->';
1431 - // reset static vals for next embed
2850 + if (self::gdpr_mode())
2851 + {
2852 + $code1 = '<div ' . $centercode . ' id="_ytid_' . rand(10000, 99999) . '"'; //'" width="' . self::$defaultwidth . '" height="' . self::$defaultheight . '" ';
2853 + $code2 = ' class="__youtube_prefs__ __youtube_prefs_gdpr__ ' . ($iscontent ? '' : ' __youtube_prefs_widget__') . ($isoverride ? ' epyt-is-override ' : '') . '" allowfullscreen data-no-lazy="1" data-skipgform_ajax_framebjll="">' .
2854 + apply_filters('ytprefs_filter_the_content_light', wp_kses_post(self::$alloptions[self::$opt_gdpr_consent_message])) .
2855 + '<button type="button" class="__youtube_prefs_gdpr__">' . trim(sanitize_text_field(self::$alloptions[self::$opt_gdpr_consent_button])) .
2856 + '<img src="' . plugins_url('images/icon-check.png', __FILE__) . '" alt="accept" data-no-lazy="1" data-skipgform_ajax_framebjll="" /></button>' .
2857 + '</div>';
2858 + $finalsrc = '';
2859 + }
2860 +
2861 + $code = $galleryWrapper1 . $code1 . $finalsrc . $code2 . $galleryCode . $galleryWrapper2;
2862 + //. '<!--' . $m[0] . '-->';
1432 2863 self::$defaultheight = null;
1433 2864 self::$defaultwidth = null;
1434 2865 self::$oembeddata = null;
1435 2866
2867 + return $code;
2868 + }
1436 2869
1437 -
1438 -
1439 -
1440 - if (self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0 && self::$alloptions[self::$opt_spdc] == 1)
2870 + public static function using_gutenberg()
2871 + {
2872 + global $wp_version;
2873 + if ((version_compare($wp_version, '5.0', '>=') && !is_plugin_active('classic-editor/classic-editor.php')) || is_plugin_active('gutenberg/gutenberg.php'))
1441 2874 {
1442 - $daysecs = self::$alloptions[self::$opt_spdcexp] * 60 * 60;
1443 - set_transient($spdckey, $code, $daysecs);
1444 - $allk = get_option(self::$spdcall, array());
1445 - $allk[] = $spdckey;
1446 - update_option(self::$spdcall, $allk);
1447 -
1448 - //self::debuglog((microtime(true) - $time_start) . "\t" . $spdckey . "\t" . $code . "\r\n");
2875 + return true;
1449 2876 }
1450 - return $code;
2877 + return false;
1451 2878 }
1452 2879
1453 - public static function debuglog($str)
2880 + public static function gdpr_mode()
1454 2881 {
1455 - $handle = fopen(__DIR__ . "\\debug.txt", "a+");
1456 - fwrite($handle, $str);
1457 - fclose($handle);
2882 + return (bool) self::$alloptions[self::$opt_gdpr_consent] && filter_input(INPUT_COOKIE, self::$gdpr_cookie_name, FILTER_SANITIZE_NUMBER_INT) != 1;
1458 2883 }
1459 2884
1460 - public static function spdcpurge()
2885 + public static function filter_the_content_light($content)
1461 2886 {
1462 - $allk = get_option(self::$spdcall, array());
1463 - if (is_array($allk))
2887 + //global $wp_filter;
2888 + //$the_content_filters_current = $wp_filter['the_content']->callbacks;
2889 +
2890 + for ($i = 0; $i < count(self::$the_content_filters); $i++)
1464 2891 {
1465 - foreach ($allk as $t)
2892 + if (function_exists(self::$the_content_filters[$i]) && !(self::wp_above_version('5.5') && self::$the_content_filters[$i] === 'wp_make_content_images_responsive'))
1466 2893 {
1467 - $success = delete_transient($t);
2894 + $content = call_user_func(self::$the_content_filters[$i], $content);
1468 2895 }
1469 2896 }
1470 - update_option(self::$spdcall, array());
2897 + return $content;
1471 2898 }
1472 2899
2900 + public static function debuglog($str)
2901 + {
2902 + $handle = fopen(__DIR__ . "\\debug.txt", "a+");
2903 + fwrite($handle, $str);
2904 + fclose($handle);
2905 + }
2906 +
1473 2907 public static function keyvalue($qry, $includev)
1474 2908 {
1475 2909 $ytvars = explode('&', $qry);
1476 2910 $ytkvp = array();
@@ -1485,50 +2919,8 @@
1485 2919
1486 2920 return $ytkvp;
1487 2921 }
1488 2922
1489 - public static function getschemaorgoutput($vidid)
1490 - {
1491 - $schemaorgcode = '';
1492 - try
1493 - {
1494 - $ytapilink = 'https://www.googleapis.com/youtube/v3/videos?id=' . $vidid . '&part=contentDetails,snippet&key=' . self::$alloptions[self::$opt_apikey];
1495 -
1496 -
1497 - $apidata = wp_remote_get($ytapilink);
1498 - if (!is_wp_error($apidata))
1499 - {
1500 - $raw = wp_remote_retrieve_body($apidata);
1501 - if (!empty($raw))
1502 - {
1503 - $json = json_decode($raw, true);
1504 - if (is_array($json))
1505 - {
1506 - $_name = esc_attr(sanitize_text_field(str_replace("@", "&#64;", $json['items'][0]['snippet']['title'])));
1507 - $_description = esc_attr(sanitize_text_field(str_replace("@", "&#64;", $json['items'][0]['snippet']['description'])));
1508 - $_thumbnailUrl = esc_url("http://i.ytimg.com/vi/" . $vidid . "/0.jpg");
1509 - $_duration = $json['items'][0]['contentDetails']['duration']; // "T0H9M35S" "PT9M35S"
1510 - $_uploadDate = sanitize_text_field($json['items'][0]['snippet']['publishedAt']); // "2014-10-03T15:30:12.000Z"
1511 -
1512 - $schemaorgcode = '<span itemprop="video" itemscope itemtype="http://schema.org/VideoObject">';
1513 - $schemaorgcode .= '<meta itemprop="embedURL" content="http://www.youtube.com/embed/' . $vidid . '">';
1514 - $schemaorgcode .= '<meta itemprop="name" content="' . $_name . '">';
1515 - $schemaorgcode .= '<meta itemprop="description" content="' . $_description . '">';
1516 - $schemaorgcode .= '<meta itemprop="thumbnailUrl" content="' . $_thumbnailUrl . '">';
1517 - $schemaorgcode .= '<meta itemprop="duration" content="' . $_duration . '">';
1518 - $schemaorgcode .= '<meta itemprop="uploadDate" content="' . $_uploadDate . '">';
1519 - $schemaorgcode .= '</span>';
1520 - }
1521 - }
1522 - }
1523 - }
1524 - catch (Exception $ex)
1525 - {
1526 -
1527 - }
1528 - return $schemaorgcode;
1529 - }
1530 -
1531 2923 public static function secondsToDuration($seconds)
1532 2924 {
1533 2925 $remaining = $seconds;
1534 2926 $parts = array();
@@ -1603,9 +2995,9 @@
1603 2995 self::$defaultheight = self::$alloptions[self::$opt_defaultheight];
1604 2996 }
1605 2997 else
1606 2998 {
1607 - self::$defaultheight = self::get_aspect_height($url, $urlkvp, $finalparams);
2999 + self::$defaultheight = self::get_aspect_height($url, self::$defaultwidth);
1608 3000 }
1609 3001 }
1610 3002 }
1611 3003
@@ -1610,9 +3002,20 @@
1610 3002 }
1611 3003
1612 3004 public static function get_oembed($url, $height, $width)
1613 3005 {
1614 - require_once( ABSPATH . WPINC . '/class-oembed.php' );
3006 + if (stripos($url, 'listType=playlist') !== false && stripos($url, '/embed') !== false)
3007 + {
3008 + $url = str_replace('/embed', '/playlist', $url);
3009 + }
3010 + if (file_exists(ABSPATH . WPINC . '/class-wp-oembed.php'))
3011 + {
3012 + require_once(ABSPATH . WPINC . '/class-wp-oembed.php');
3013 + }
3014 + else
3015 + {
3016 + require_once(ABSPATH . WPINC . '/class-oembed.php');
3017 + }
1615 3018 $oembed = _wp_oembed_get_object();
1616 3019 $args = array();
1617 3020 $args['width'] = $width;
1618 3021 $args['height'] = $height;
@@ -1620,18 +3023,16 @@
1620 3023 self::$oembeddata = $oembed->fetch('https://www.youtube.com/oembed', $url, $args);
1621 3024 return self::$oembeddata;
1622 3025 }
1623 3026
1624 - public static function get_aspect_height($url, $urlkvp, $finalparams)
3027 + public static function get_aspect_height($url, $widthbox)
1625 3028 {
1626 -
1627 3029 // attempt to get aspect ratio correct height from oEmbed
1628 - $aspectheight = round((self::$defaultwidth * 9) / 16, 0);
3030 + $aspectheight = round(($widthbox * 9) / 16, 0);
1629 3031
1630 -
1631 3032 if ($url)
1632 3033 {
1633 - $odata = self::get_oembed($url, self::$defaultwidth, self::$defaultwidth);
3034 + $odata = self::get_oembed($url, $widthbox, $widthbox);
1634 3035
1635 3036 if ($odata)
1636 3037 {
1637 3038 $aspectheight = $odata->height;
@@ -1637,329 +3038,34 @@
1637 3038 $aspectheight = $odata->height;
1638 3039 }
1639 3040 }
1640 3041
1641 - if ($finalparams[self::$opt_controls] != 0 && $finalparams[self::$opt_autohide] != 1)
1642 - {
1643 - //add 28 for YouTube's own bar
1644 - $aspectheight += 28;
1645 - }
1646 3042 return $aspectheight;
1647 3043 }
1648 3044
1649 - public static function doftpostimg($postid, $post, $update)
1650 - {
1651 - if (current_user_can('edit_posts'))
1652 - {
1653 - if ((defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) || !in_array($post->post_status, array('publish', 'pending', 'draft', 'future', 'private')))
1654 - {
1655 - return;
1656 - }
1657 - try
1658 - {
1659 - self::doftpostimgfor($post);
1660 - }
1661 - catch (Exception $ex)
1662 - {
1663 - // display error message
1664 - }
1665 - }
1666 - }
1667 -
1668 - public static function doftpostimgfor($post)
1669 - {
1670 - $search_content = isset($post->post_content) ? $post->post_content : '';
1671 - $search_content = substr(wp_strip_all_tags($search_content), 0, 4000);
1672 -
1673 - $search_content = apply_filters('youtube_embedplus_video_content', $search_content);
1674 -
1675 - $vid_match = null;
1676 - if ($search_content && $post->ID && !has_post_thumbnail($post->ID) && preg_match(self::$justurlregex, $search_content, $vid_match)
1677 - )
1678 - {
1679 -
1680 - $first_vid_link = trim(str_replace(self::$badentities, self::$goodliterals, $vid_match[0]));
1681 -
1682 - $first_vid_link = preg_replace('/\s/', '', $first_vid_link);
1683 - $linkparamstemp = explode('?', $first_vid_link);
1684 -
1685 - $linkparams = array();
1686 - if (count($linkparamstemp) > 1)
1687 - {
1688 - $linkparams = self::keyvalue($linkparamstemp[1], true);
1689 - }
1690 - if (strpos($linkparamstemp[0], 'youtu.be') !== false && !isset($linkparams['v']))
1691 - {
1692 - $vtemp = explode('/', $linkparamstemp[0]);
1693 - $linkparams['v'] = array_pop($vtemp);
1694 - }
1695 -
1696 -
1697 -
1698 - $just_id = $linkparams['v'];
1699 - $ftimgurl = "https://img.youtube.com/vi/" . $just_id . "/maxresdefault.jpg";
1700 - $ftimgid = self::media_sideload($ftimgurl, $post->ID, sanitize_title(preg_replace("/[^a-zA-Z0-9\s]/", "-", $post->title)));
1701 -
1702 - if (!ftimgid || is_wp_error($ftimgid))
1703 - {
1704 - $ftimgurl = null;
1705 - $ftimgid = 0;
1706 - if ($just_id)
1707 - {
1708 - require_once( ABSPATH . WPINC . '/class-oembed.php' );
1709 - $oembed = _wp_oembed_get_object();
1710 - $args = array();
1711 - $args['width'] = 1920;
1712 - $args['height'] = 1080;
1713 - $args['discover'] = false;
1714 - $odata = $oembed->fetch('https://www.youtube.com/oembed', 'http://youtube.com/watch?v=' . $just_id, $args);
1715 -
1716 - if ($odata)
1717 - {
1718 - $ftimgurl = $odata->thumbnail_url;
1719 - }
1720 - }
1721 -
1722 - $ftimgid = $ftimgurl && !is_wp_error($ftimgurl) ? self::media_sideload($ftimgurl, $post->ID, sanitize_title(preg_replace("/[^a-zA-Z0-9\s]/", "-", $post->title))) : 0;
1723 -
1724 - if (!$ftimgid || is_wp_error($ftimgid))
1725 - {
1726 - return;
1727 - }
1728 - }
1729 - set_post_thumbnail($post->ID, $ftimgid);
1730 - }
1731 - }
1732 -
1733 - public static function media_sideload($url, $post_id, $filename = null)
1734 - {
1735 - if (!$url || !$post_id)
1736 - {
1737 - return new WP_Error('missing', __('Please provide a valid URL and post ID', ''));
1738 - }
1739 -
1740 - $post_title = get_the_title($post_id);
1741 -
1742 - require_once(ABSPATH . 'wp-admin/includes/file.php');
1743 - $tmp = download_url($url);
1744 -
1745 - if (is_wp_error($tmp))
1746 - {
1747 - @unlink($file_array['tmp_name']);
1748 - $file_array['tmp_name'] = '';
1749 - return $tmp;
1750 - }
1751 -
1752 - preg_match('/[^\?]+\.(jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG)/', $url, $matches);
1753 - $url_filename = basename($matches[0]);
1754 - $url_type = wp_check_filetype($url_filename);
1755 -
1756 - if (!empty($filename))
1757 - {
1758 - $filename = sanitize_file_name($filename);
1759 - $tmppath = pathinfo($tmp);
1760 - $new = $tmppath['dirname'] . '/' . $filename . '.' . $tmppath['extension'];
1761 - rename($tmp, $new);
1762 - $tmp = $new;
1763 - }
1764 -
1765 - $file_array['tmp_name'] = $tmp;
1766 - if (!empty($filename))
1767 - {
1768 - $file_array['name'] = $filename . '.' . $url_type['ext'];
1769 - }
1770 - else
1771 - {
1772 - $file_array['name'] = $url_filename;
1773 - }
1774 -
1775 - $post_data = array(
1776 - 'post_title' => $post_title,
1777 - 'post_parent' => $post_id,
1778 - );
1779 -
1780 - require_once( ABSPATH . 'wp-admin/includes/file.php' );
1781 - require_once( ABSPATH . 'wp-admin/includes/media.php' );
1782 - require_once( ABSPATH . 'wp-admin/includes/image.php' );
1783 -
1784 - $att_id = media_handle_sideload($file_array, $post_id, null, $post_data);
1785 -
1786 - if (is_wp_error($att_id))
1787 - {
1788 - @unlink($file_array['tmp_name']);
1789 - return $att_id;
1790 - }
1791 -
1792 - return $att_id;
1793 - }
1794 -
1795 - public static function do_ogvideo()
1796 - {
1797 - global $wp_query;
1798 - $the_content = $wp_query->post->post_content;
1799 - $matches = Array();
1800 - $ismatch = preg_match_all(self::$justurlregex, $the_content, $matches);
1801 -
1802 - if ($ismatch)
1803 - {
1804 - $match = $matches[0][0];
1805 -
1806 - $link = trim(preg_replace('/&amp;/i', '&', $match));
1807 - $link = preg_replace('/\s/', '', $link);
1808 - $link = trim(str_replace(self::$badentities, self::$goodliterals, $link));
1809 -
1810 - $linkparamstemp = explode('?', $link);
1811 -
1812 - $linkparams = array();
1813 - if (count($linkparamstemp) > 1)
1814 - {
1815 - $linkparams = self::keyvalue($linkparamstemp[1], true);
1816 - }
1817 - if (strpos($linkparamstemp[0], 'youtu.be') !== false && !isset($linkparams['v']))
1818 - {
1819 - $vtemp = explode('/', $linkparamstemp[0]);
1820 - $linkparams['v'] = array_pop($vtemp);
1821 - }
1822 - ?>
1823 - <meta property="og:type" content="video">
1824 - <meta property="og:video" content="https://www.youtube.com/v/<?php echo $linkparams['v']; ?>?autohide=1&amp;version=3">
1825 - <meta property="og:video:type" content="application/x-shockwave-flash">
1826 - <meta property="og:video:width" content="480">
1827 - <meta property="og:video:height" content="360">
1828 - <meta property="og:image" content="https://img.youtube.com/vi/<?php echo $linkparams['v']; ?>/0.jpg">
1829 - <?php
1830 - }
1831 - }
1832 -
1833 3045 public static function ytprefs_plugin_menu()
1834 3046 {
1835 - if (self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0)
1836 - {
1837 - add_menu_page('YouTube Settings', 'YouTube PRO', 'manage_options', 'youtube-my-preferences', 'YouTubePrefs::ytprefs_show_options', plugins_url('images/youtubeicon16.png', __FILE__), '10.000392854349');
1838 - add_submenu_page('youtube-my-preferences', '', '', 'manage_options', 'youtube-my-preferences', 'YouTubePrefs::ytprefs_show_options');
1839 - add_submenu_page('youtube-my-preferences', 'YouTube Analytics Dashboard', '<img style="width: 16px; height: 16px; vertical-align: text-top;" src="' . plugins_url('images/epstats16.png', __FILE__) . '" />&nbsp;&nbsp;PRO Analytics', 'manage_options', 'youtube-ep-analytics-dashboard', 'YouTubePrefs::epstats_show_options');
1840 - }
1841 - else
1842 - {
1843 - add_menu_page('YouTube Settings', 'YouTube Free', 'manage_options', 'youtube-my-preferences', 'YouTubePrefs::ytprefs_show_options', plugins_url('images/youtubeicon16.png', __FILE__), '10.000392854349');
1844 - add_submenu_page('youtube-my-preferences', '', '', 'manage_options', 'youtube-my-preferences', 'YouTubePrefs::ytprefs_show_options');
1845 - add_submenu_page('youtube-my-preferences', 'YouTube PRO', '<img style="width: 16px; height: 16px; vertical-align: text-top;" src="' . plugins_url('images/iconwizard.png', __FILE__) . '" />&nbsp;&nbsp;YouTube PRO', 'manage_options', 'youtube-ep-analytics-dashboard', 'YouTubePrefs::epstats_show_options');
1846 - }
1847 - add_submenu_page(null, 'YouTube Posts', 'YouTube Posts', 'manage_options', 'youtube-ep-glance', 'YouTubePrefs::glance_page');
1848 - }
3047 + self::$admin_page_hooks[] = add_menu_page('EmbedPlus for YouTube Settings', 'EmbedPlus for YouTube', 'manage_options', 'youtube-my-preferences', array(self::class, 'ytprefs_show_options'), 'dashicons-video-alt3', '10.000392854349');
3048 + self::$admin_page_hooks[] = add_submenu_page('youtube-my-preferences', '', '', 'manage_options', 'youtube-my-preferences', array(self::class, 'ytprefs_show_options'));
1849 3049
1850 - public static function epstats_show_options()
1851 - {
1852 -
1853 - if (!current_user_can('manage_options'))
1854 - {
1855 - wp_die(__('You do not have sufficient permissions to access this page.'));
1856 - }
1857 -
1858 - if (self::$double_plugin)
1859 - {
1860 - //add_action('admin_notices', array("YouTubePrefs", "double_plugin_warning"));
1861 - self::double_plugin_warning();
1862 - }
1863 -
1864 -
1865 - // Now display the settings editing screen
1866 - ?>
1867 - <div class="wrap">
1868 - <style type="text/css">
1869 - .wrap {font-family: Arial;}
1870 - .epicon { width: 20px; height: 20px; vertical-align: middle; padding-right: 5px;}
1871 - .epindent {padding-left: 25px;}
1872 - iframe.shadow {-webkit-box-shadow: 0px 0px 20px 0px #000000; box-shadow: 0px 0px 20px 0px #000000;}
1873 - .bold {font-weight: bold;}
1874 - .orange {color: #f85d00;}
1875 - </style>
1876 - <br>
1877 - <?php
1878 - $thishost = (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : "");
1879 - $thiskey = self::$alloptions[self::$opt_pro];
1880 -
1881 - $dashurl = self::$epbase . "/dashboard/pro-easy-video-analytics.aspx?ref=protab&domain=" . $thishost . "&prokey=" . $thiskey;
1882 -
1883 - if (self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0)
1884 - {
1885 - //// header
1886 - echo "<h2>" . '<img src="' . plugins_url('images/epstats16.png', __FILE__) . '" /> ' . __('YouTube Analytics Dashboard') . "</h2>";
1887 - echo '<p><i>Logging you in below... (You can also <a class="button-primary" target="_blank" href="' . $dashurl . '">click here</a> to launch your dashboard in a new tab)</i></p>';
1888 - }
1889 - else
1890 - {
1891 - //// header
1892 - echo "<h2>" . '<img style="vertical-align: text-bottom;" src="' . plugins_url('images/iconwizard.png', __FILE__) . '" /> ' . __('YouTube Plugin PRO') . "</h2><p class='bold orange'>This tab is here to provide direct access to analytics. Graphs and other data about your site will show below after you activate PRO.</p><br>";
1893 - }
1894 - ?>
1895 - <iframe class="shadow" src="<?php echo $dashurl ?>" width="1060" height="3600" scrolling="auto"/>
1896 - </div>
1897 - <?php
3050 + self::$admin_page_hooks[] = add_submenu_page('youtube-my-preferences_nomenu', 'YouTube Posts', 'YouTube Posts', 'manage_options', 'youtube-ep-glance', array(self::class, 'glance_page'));
3051 + self::$admin_page_hooks[] = self::$wizard_hook = add_submenu_page('youtube-my-preferences_nomenu', 'EmbedPlus for YouTube Wizard', 'Wizard', 'edit_posts', 'youtube-ep-wizard', array(self::class, 'wizard'));
3052 + self::$admin_page_hooks[] = self::$onboarding_hook = add_submenu_page('youtube-my-preferences_nomenu', 'EmbedPlus for YouTube Setup', 'Setup', 'manage_options', 'youtube-ep-onboarding', array(self::class, 'ytprefs_show_onboarding'));
1898 3053 }
1899 3054
1900 - public static function my_embedplus_pro_record()
3055 + public static function custom_admin_pointers_check()
1901 3056 {
1902 - $result = array();
1903 - if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
3057 + if (!self::$alloptions[self::$opt_show_pointer])
1904 3058 {
1905 - $tmppro = preg_replace('/[^A-Za-z0-9-]/i', '', $_REQUEST[self::$opt_pro]);
1906 - $new_options = array();
1907 - $new_options[self::$opt_pro] = $tmppro;
1908 - $all = get_option(self::$opt_alloptions);
1909 - $all = $new_options + $all;
1910 - update_option(self::$opt_alloptions, $all);
1911 -
1912 - if (strlen($tmppro) > 0)
1913 - {
1914 - $result['type'] = 'success';
1915 - }
1916 - else
1917 - {
1918 - $result['type'] = 'error';
1919 - }
1920 - echo json_encode($result);
3059 + return false;
1921 3060 }
1922 - else
1923 - {
1924 - $result['type'] = 'error';
1925 - header("Location: " . $_SERVER["HTTP_REFERER"]);
1926 - }
1927 - die();
1928 - }
1929 -
1930 - public static function my_embedplus_clearspdc()
1931 - {
1932 - $result = array();
1933 - if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
1934 - {
1935 - try
1936 - {
1937 - self::spdcpurge();
1938 - $result['type'] = 'success';
1939 - }
1940 - catch (Exception $ex)
1941 - {
1942 - $result['type'] = 'error';
1943 - }
1944 - echo json_encode($result);
1945 - }
1946 - else
1947 - {
1948 - $result['type'] = 'error';
1949 - header("Location: " . $_SERVER["HTTP_REFERER"]);
1950 - }
1951 - die();
1952 - }
1953 -
1954 - public static function custom_admin_pointers_check()
1955 - {
1956 - //return false; // ooopointer shut all off;
1957 3061 $admin_pointers = self::custom_admin_pointers();
1958 3062 foreach ($admin_pointers as $pointer => $array)
1959 3063 {
1960 3064 if ($array['active'])
3065 + {
1961 3066 return true;
3067 + }
1962 3068 }
1963 3069 }
1964 3070
1965 3071 public static function glance_script()
@@ -1966,10 +3072,12 @@
1966 3072 {
1967 3073 add_thickbox();
1968 3074 ?>
1969 3075 <script type="text/javascript">
1970 - function widen_ytprefs_glance() {
1971 - setTimeout(function () {
3076 + function widen_ytprefs_glance()
3077 + {
3078 + setTimeout(function ()
3079 + {
1972 3080 jQuery("#TB_window").animate({marginLeft: '-' + parseInt((780 / 2), 10) + 'px', width: '780px'}, 300);
1973 3081 jQuery("#TB_window iframe").animate({width: '780px'}, 300);
1974 3082 }, 15);
1975 3083 }
@@ -1975,40 +3083,43 @@
1975 3083 }
1976 3084
1977 3085 (function ($j)
1978 3086 {
1979 - $j(document).ready(function () {
3087 + $j(document).ready(function ()
3088 + {
1980 3089
1981 3090 $j.ajax({
1982 3091 type: "post",
1983 3092 dataType: "json",
1984 3093 timeout: 30000,
1985 - url: wpajaxurl,
3094 + url: window._EPYTA_ ? window._EPYTA_.wpajaxurl : ajaxurl,
1986 3095 data: {action: 'my_embedplus_glance_count'},
1987 - success: function (response) {
1988 - if (response.type == "success") {
3096 + success: function (response)
3097 + {
3098 + if (response.type === "success")
3099 + {
1989 3100 $j(response.container).append(response.data);
1990 - $j(".ytprefs_glance_button").click(widen_ytprefs_glance);
1991 - $j(window).resize(widen_ytprefs_glance);
1992 - if (typeof ep_do_pointers == 'function')
3101 + $j(".ytprefs_glance_button").on('click', widen_ytprefs_glance);
3102 + $j(window).on('resize', widen_ytprefs_glance);
3103 + if (typeof ep_do_pointers === 'function')
1993 3104 {
1994 3105 //ep_do_pointers($j);
1995 3106 }
1996 3107 }
1997 - else {
3108 + else
3109 + {
1998 3110 }
1999 3111 },
2000 - error: function (xhr, ajaxOptions, thrownError) {
3112 + error: function (xhr, ajaxOptions, thrownError)
3113 + {
2001 3114
2002 3115 },
2003 - complete: function () {
3116 + complete: function ()
3117 + {
2004 3118 }
2005 3119 });
2006 -
2007 3120 });
2008 -
2009 - })(jQuery);
2010 - </script>
3121 + })(jQuery);</script>
2011 3122 <?php
2012 3123 }
2013 3124
2014 3125 public static function custom_admin_pointers_footer()
@@ -2025,15 +3136,17 @@
2025 3136 if ($array['active'])
2026 3137 {
2027 3138 ?>
2028 3139 $('<?php echo $array['anchor_id']; ?>').pointer({
3140 + pointerClass: 'wp-pointer ytprefs-pointer',
2029 3141 content: '<?php echo $array['content']; ?>',
2030 3142 position: {
2031 3143 edge: '<?php echo $array['edge']; ?>',
2032 3144 align: '<?php echo $array['align']; ?>'
2033 3145 },
2034 - close: function () {
2035 - $.post(wpajaxurl, {
3146 + close: function ()
3147 + {
3148 + $.post(window._EPYTA_ ? window._EPYTA_.wpajaxurl : ajaxurl, {
2036 3149 pointer: '<?php echo $pointer; ?>',
2037 3150 action: 'dismiss-wp-pointer'
2038 3151 });
2039 3152 }
@@ -2058,16 +3171,14 @@
2058 3171
2059 3172 $new_pointer_content = '<h3>' . __('New Update') . '</h3>'; // ooopointer
2060 3173
2061 3174 $new_pointer_content .= '<p>'; // ooopointer
2062 - if (!(self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0))
3175 + $new_pointer_content .= 'This version improves compatibility with WordPress 7.1 for both free and <a target=_blank href="' . self::$epbase . '/dashboard/pro-easy-video-analytics.aspx?ref=frompointer">Pro</a> plugins, and optimizes the caching feature for the Pro plugin.';
3176 + if (!empty(self::$alloptions[self::$opt_pro]) && strlen(trim(self::$alloptions[self::$opt_pro])) > 0)
2063 3177 {
2064 - $new_pointer_content .= __("This update improves compatibility and adds features to Free and <a target=_blank href=" . self::$epbase . '/dashboard/pro-easy-video-analytics.aspx?ref=frompointer' . ">Pro galleries &raquo;</a>");
3178 + $new_pointer_content .= ' <strong>Important message to Pro users</strong>: From version 11.7 onward, you must <a href="https://www.embedplus.com/youtube-pro/download/?prokey=' . esc_attr(self::$alloptions[self::$opt_pro]) . '" target="_blank">download the separate plugin here</a> to regain your Pro features. All your settings will automatically migrate after installing the separate Pro download. Thank you for your support and patience during this transition.';
2065 3179 }
2066 - else
2067 - {
2068 - $new_pointer_content .= __("This update improves compatibility and adds features to Free and Pro galleries.");
2069 - }
3180 +
2070 3181 $new_pointer_content .= '</p>';
2071 3182
2072 3183 return array(
2073 3184 $prefix . 'new_items' => array(
@@ -2074,9 +3185,9 @@
2074 3185 'content' => $new_pointer_content,
2075 3186 'anchor_id' => 'a.toplevel_page_youtube-my-preferences', //'#ytprefs_glance_button',
2076 3187 'edge' => 'top',
2077 3188 'align' => 'left',
2078 - 'active' => (!in_array($prefix . 'new_items', $dismissed) )
3189 + 'active' => (!in_array($prefix . 'new_items', $dismissed))
2079 3190 ),
2080 3191 );
2081 3192 }
2082 3193
@@ -2084,11 +3195,29 @@
2084 3195 {
2085 3196 return isset($_POST[$idx]) && $_POST[$idx] == (true || 'on');
2086 3197 }
2087 3198
3199 + public static function settings_nav()
3200 + {
3201 + ?>
3202 +
3203 + <h3 class="nav-tab-wrapper">
3204 + <a class="nav-tab nav-tab-active" href="#jumpdefaults">Defaults</a>
3205 + <a class="nav-tab" href="#jumpapikey">API Key</a>
3206 + <a class="nav-tab" href="#jumpwiz">Wizard</a>
3207 + <a class="nav-tab" href="#jumpgallery">Galleries</a>
3208 + <a class="nav-tab href-link" style="background-color: #daebf1;" target="_blank" href="<?php echo self::$epbase . "/dashboard/pro-easy-video-analytics.aspx?ref=protab" ?>">Upgrade?</a>
3209 + <a class="nav-tab" href="#jumpperformance">Performance</a>
3210 + <a class="nav-tab" href="#jumpcompat">Compatibility</a>
3211 + <a class="nav-tab" href="#jumpprivacy">Security & Privacy</a>
3212 + <a class="nav-tab" href="#jumphowto">Embed Manually</a>
3213 + <a class="nav-tab" href="#jumpsupport">Support</a>
3214 + </h3>
3215 + <?php
3216 + }
3217 +
2088 3218 public static function ytprefs_show_options()
2089 3219 {
2090 -
2091 3220 if (!current_user_can('manage_options'))
2092 3221 {
2093 3222 wp_die(__('You do not have sufficient permissions to access this page.'));
2094 3223 }
@@ -2094,14 +3223,11 @@
2094 3223 }
2095 3224
2096 3225 if (self::$double_plugin)
2097 3226 {
2098 - //add_action('admin_notices', array("YouTubePrefs", "double_plugin_warning"));
2099 3227 self::double_plugin_warning();
2100 3228 }
2101 3229
2102 -
2103 - // variables for the field and option names
2104 3230 $ytprefs_submitted = 'ytprefs_submitted';
2105 3231
2106 3232 // Read in existing option values from database
2107 3233
@@ -2108,280 +3234,25 @@
2108 3234 $all = get_option(self::$opt_alloptions);
2109 3235
2110 3236 // See if the user has posted us some information
2111 3237 // If they did, this hidden field will be set to 'Y'
2112 - if (isset($_POST[$ytprefs_submitted]) && $_POST[$ytprefs_submitted] == 'Y')
3238 + if (isset($_POST[$ytprefs_submitted]) && $_POST[$ytprefs_submitted] == 'Y' && check_admin_referer('_epyt_save', '_epyt_nonce'))
2113 3239 {
2114 - // Read their posted values
2115 -
2116 - $new_options = array();
2117 - $new_options[self::$opt_center] = self::postchecked(self::$opt_center) ? 1 : 0;
2118 - $new_options[self::$opt_glance] = self::postchecked(self::$opt_glance) ? 1 : 0;
2119 - $new_options[self::$opt_autoplay] = self::postchecked(self::$opt_autoplay) ? 1 : 0;
2120 - $new_options[self::$opt_debugmode] = self::postchecked(self::$opt_debugmode) ? 1 : 0;
2121 - $new_options[self::$opt_admin_off_scripts] = self::postchecked(self::$opt_admin_off_scripts) ? 1 : 0;
2122 - $new_options[self::$opt_old_script_method] = self::postchecked(self::$opt_old_script_method) ? 1 : 0;
2123 - $new_options[self::$opt_cc_load_policy] = self::postchecked(self::$opt_cc_load_policy) ? 1 : 0;
2124 - $new_options[self::$opt_iv_load_policy] = self::postchecked(self::$opt_iv_load_policy) ? 1 : 3;
2125 - $new_options[self::$opt_loop] = self::postchecked(self::$opt_loop) ? 1 : 0;
2126 - $new_options[self::$opt_modestbranding] = self::postchecked(self::$opt_modestbranding) ? 1 : 0;
2127 - $new_options[self::$opt_rel] = self::postchecked(self::$opt_rel) ? 1 : 0;
2128 - $new_options[self::$opt_showinfo] = self::postchecked(self::$opt_showinfo) ? 1 : 0;
2129 - $new_options[self::$opt_playsinline] = self::postchecked(self::$opt_playsinline) ? 1 : 0;
2130 - $new_options[self::$opt_origin] = self::postchecked(self::$opt_origin) ? 1 : 0;
2131 - $new_options[self::$opt_controls] = self::postchecked(self::$opt_controls) ? 2 : 0;
2132 - $new_options[self::$opt_autohide] = self::postchecked(self::$opt_autohide) ? 1 : 2;
2133 - $new_options[self::$opt_html5] = self::postchecked(self::$opt_html5) ? 1 : 0;
2134 - $new_options[self::$opt_theme] = self::postchecked(self::$opt_theme) ? 'dark' : 'light';
2135 - $new_options[self::$opt_color] = self::postchecked(self::$opt_color) ? 'red' : 'white';
2136 - $new_options[self::$opt_wmode] = self::postchecked(self::$opt_wmode) ? 'opaque' : 'transparent';
2137 - $new_options[self::$opt_vq] = self::postchecked(self::$opt_vq) ? 'hd720' : '';
2138 - $new_options[self::$opt_nocookie] = self::postchecked(self::$opt_nocookie) ? 1 : 0;
2139 - $new_options[self::$opt_playlistorder] = self::postchecked(self::$opt_playlistorder) ? 1 : 0;
2140 - $new_options[self::$opt_acctitle] = self::postchecked(self::$opt_acctitle) ? 1 : 0;
2141 - $new_options[self::$opt_ogvideo] = self::postchecked(self::$opt_ogvideo) ? 1 : 0;
2142 - $new_options[self::$opt_migrate] = self::postchecked(self::$opt_migrate) ? 1 : 0;
2143 - $new_options[self::$opt_migrate_youtube] = self::postchecked(self::$opt_migrate_youtube) ? 1 : 0;
2144 - //$new_options[self::$opt_ssl] = self::postchecked(self::$opt_ssl) ? 1 : 0;
2145 - $new_options[self::$opt_oldspacing] = self::postchecked(self::$opt_oldspacing) ? 1 : 0;
2146 - $new_options[self::$opt_responsive] = self::postchecked(self::$opt_responsive) ? 1 : 0;
2147 - $new_options[self::$opt_widgetfit] = self::postchecked(self::$opt_widgetfit) ? 1 : 0;
2148 - $new_options[self::$opt_evselector_light] = self::postchecked(self::$opt_evselector_light) ? 1 : 0;
2149 - $new_options[self::$opt_schemaorg] = self::postchecked(self::$opt_schemaorg) ? 1 : 0;
2150 - $new_options[self::$opt_ftpostimg] = self::postchecked(self::$opt_ftpostimg) ? 1 : 0;
2151 - $new_options[self::$opt_spdc] = self::postchecked(self::$opt_spdc) ? 1 : 0;
2152 - $new_options[self::$opt_dynload] = self::postchecked(self::$opt_dynload) ? 1 : 0;
2153 - $new_options[self::$opt_defaultdims] = self::postchecked(self::$opt_defaultdims) ? 1 : 0;
2154 - $new_options[self::$opt_defaultvol] = self::postchecked(self::$opt_defaultvol) ? 1 : 0;
2155 - $new_options[self::$opt_dohl] = self::postchecked(self::$opt_dohl) ? 1 : 0;
2156 - $new_options[self::$opt_gallery_showtitle] = self::postchecked(self::$opt_gallery_showtitle) ? 1 : 0;
2157 - $new_options[self::$opt_gallery_customarrows] = self::postchecked(self::$opt_gallery_customarrows) ? 1 : 0;
2158 - $new_options[self::$opt_gallery_showdsc] = self::postchecked(self::$opt_gallery_showdsc) ? 1 : 0;
2159 -
2160 - $_defaultwidth = '';
2161 - try
2162 - {
2163 - $_defaultwidth = is_numeric(trim($_POST[self::$opt_defaultwidth])) ? intval(trim($_POST[self::$opt_defaultwidth])) : $_defaultwidth;
2164 - }
2165 - catch (Exception $ex)
2166 - {
2167 -
2168 - }
2169 - $new_options[self::$opt_defaultwidth] = $_defaultwidth;
2170 -
2171 - $_defaultheight = '';
2172 - try
2173 - {
2174 - $_defaultheight = is_numeric(trim($_POST[self::$opt_defaultheight])) ? intval(trim($_POST[self::$opt_defaultheight])) : $_defaultheight;
2175 - }
2176 - catch (Exception $ex)
2177 - {
2178 -
2179 - }
2180 - $new_options[self::$opt_defaultheight] = $_defaultheight;
2181 -
2182 - $_responsive_all = 1;
2183 - try
2184 - {
2185 - $_responsive_all = is_numeric(trim($_POST[self::$opt_responsive_all])) ? intval(trim($_POST[self::$opt_responsive_all])) : $_responsive_all;
2186 - }
2187 - catch (Exception $ex)
2188 - {
2189 -
2190 - }
2191 - $new_options[self::$opt_responsive_all] = $_responsive_all;
2192 -
2193 - $_vol = '';
2194 - try
2195 - {
2196 - $_vol = is_numeric(trim($_POST[self::$opt_vol])) ? intval(trim($_POST[self::$opt_vol])) : $_vol;
2197 - }
2198 - catch (Exception $ex)
2199 - {
2200 -
2201 - }
2202 - $new_options[self::$opt_vol] = $_vol;
2203 -
2204 - $_gallery_pagesize = 12;
2205 - try
2206 - {
2207 - $_gallery_pagesize = is_numeric(trim($_POST[self::$opt_gallery_pagesize])) ? intval(trim($_POST[self::$opt_gallery_pagesize])) : $_gallery_pagesize;
2208 - }
2209 - catch (Exception $ex)
2210 - {
2211 -
2212 - }
2213 - $new_options[self::$opt_gallery_pagesize] = $_gallery_pagesize;
2214 -
2215 -
2216 - $_gallery_columns = 3;
2217 - try
2218 - {
2219 - $_gallery_columns = is_numeric(trim($_POST[self::$opt_gallery_columns])) ? intval(trim($_POST[self::$opt_gallery_columns])) : $_gallery_columns;
2220 - }
2221 - catch (Exception $ex)
2222 - {
2223 -
2224 - }
2225 - $new_options[self::$opt_gallery_columns] = $_gallery_columns;
2226 -
2227 - $_gallery_scrolloffset = 20;
2228 - try
2229 - {
2230 - $_gallery_scrolloffset = is_numeric(trim($_POST[self::$opt_gallery_scrolloffset])) ? intval(trim($_POST[self::$opt_gallery_scrolloffset])) : $_gallery_scrolloffset;
2231 - }
2232 - catch (Exception $ex)
2233 - {
2234 -
2235 - }
2236 - $new_options[self::$opt_gallery_scrolloffset] = $_gallery_scrolloffset;
2237 -
2238 - $_gallery_style = 'grid';
2239 - try
2240 - {
2241 - $_gallery_style = trim(str_replace(array(' ', "'", '"'), array('', '', ''), strip_tags($_POST[self::$opt_gallery_style])));
2242 - }
2243 - catch (Exception $ex)
2244 - {
2245 - $_gallery_style = 'grid';
2246 - }
2247 - $new_options[self::$opt_gallery_style] = $_gallery_style;
2248 -
2249 -
2250 - $_gallery_thumbcrop = 'box';
2251 - try
2252 - {
2253 - $_gallery_thumbcrop = trim(str_replace(array(' ', "'", '"'), array('', '', ''), strip_tags($_POST[self::$opt_gallery_thumbcrop])));
2254 - }
2255 - catch (Exception $ex)
2256 - {
2257 - $_gallery_thumbcrop = 'box';
2258 - }
2259 - $new_options[self::$opt_gallery_thumbcrop] = $_gallery_thumbcrop;
2260 -
2261 -
2262 - $_gallery_custom_prev = 'Prev';
2263 - try
2264 - {
2265 - $_gallery_custom_prev = trim(strip_tags($_POST[self::$opt_gallery_customprev]));
2266 - }
2267 - catch (Exception $ex)
2268 - {
2269 - $_gallery_custom_prev = 'Prev';
2270 - }
2271 - $new_options[self::$opt_gallery_customprev] = $_gallery_custom_prev;
2272 -
2273 -
2274 - $_gallery_custom_next = 'Next';
2275 - try
2276 - {
2277 - $_gallery_custom_next = trim(strip_tags($_POST[self::$opt_gallery_customnext]));
2278 - }
2279 - catch (Exception $ex)
2280 - {
2281 - $_gallery_custom_next = 'Next';
2282 - }
2283 - $new_options[self::$opt_gallery_customnext] = $_gallery_custom_next;
2284 -
2285 -
2286 - $_apikey = $all[self::$opt_apikey];
2287 - try
2288 - {
2289 - $_curr_apikey = $all[self::$opt_apikey];
2290 - $_schema_apikey = trim(str_replace(array(' ', "'", '"'), array('', '', ''), strip_tags($_POST[self::$opt_apikey])));
2291 - $_gallery_apikey = trim(str_replace(array(' ', "'", '"'), array('', '', ''), strip_tags($_POST[self::$opt_gallery_apikey])));
2292 -
2293 - if (!empty($_schema_apikey) && $_schema_apikey != $_curr_apikey)
2294 - {
2295 - $_apikey = $_schema_apikey;
2296 - }
2297 - if (!empty($_gallery_apikey) && $_gallery_apikey != $_curr_apikey)
2298 - {
2299 - $_apikey = $_gallery_apikey;
2300 - }
2301 - }
2302 - catch (Exception $ex)
2303 - {
2304 -
2305 - }
2306 - $new_options[self::$opt_apikey] = $_apikey;
2307 -
2308 - $_hl = '';
2309 - try
2310 - {
2311 - $temphl = strtolower(trim($_POST[self::$opt_hl]));
2312 - $_hl = preg_match('/^[a-z][a-z]$/i', $temphl) ? $temphl : '';
2313 - }
2314 - catch (Exception $ex)
2315 - {
2316 -
2317 - }
2318 - $new_options[self::$opt_hl] = $_hl;
2319 -
2320 - $_dyntype = '';
2321 - try
2322 - {
2323 - $tempdyntype = trim($_POST[self::$opt_dyntype]);
2324 - $_dyntype = preg_match('/^[a-zA-Z-]+$/i', $tempdyntype) ? $tempdyntype : '';
2325 - }
2326 - catch (Exception $ex)
2327 - {
2328 -
2329 - }
2330 - $new_options[self::$opt_dyntype] = $_dyntype;
2331 -
2332 - $_spdcexp = 24;
2333 - try
2334 - {
2335 - $_spdcexp = is_numeric(trim($_POST[self::$opt_spdcexp])) ? intval(trim($_POST[self::$opt_spdcexp])) : $_spdcexp;
2336 - }
2337 - catch (Exception $ex)
2338 - {
2339 -
2340 - }
2341 - $new_options[self::$opt_spdcexp] = $_spdcexp;
2342 -
2343 -
2344 -
2345 - $all = $new_options + $all;
2346 -
2347 - update_option(self::$opt_alloptions, $all);
2348 -
2349 - try
2350 - {
2351 - self::spdcpurge();
2352 - if ($all[self::$opt_spdc] == 1)
2353 - {
2354 - wp_remote_get(site_url());
2355 - }
2356 - }
2357 - catch (Exception $ex)
2358 - {
2359 -
2360 - }
3240 + $result = self::settings_save($all);
3241 + $all = get_option(self::$opt_alloptions);
2361 3242 ?>
2362 - <div class="updated"><p><strong><?php _e('Changes saved.'); ?></strong></p></div>
3243 + <div class="updated"><p><strong><?php echo wp_kses_post($result['message']) ?></strong></p></div>
2363 3244 <?php
2364 3245 }
2365 -
2366 -
2367 - // Now display the settings editing screen
2368 -
2369 - echo '<div class="wrap" style="max-width: 1000px;">';
2370 -
2371 - // header
2372 -
2373 - echo "<h2>" . '<img src="' . plugins_url('images/youtubeicon16.png', __FILE__) . '" /> ' . __('YouTube Settings') . "</h2>";
2374 -
2375 - // settings form
2376 3246 ?>
2377 3247
2378 3248 <style type="text/css">
2379 - .wrap {font-family: Arial; color: #000000;}
2380 - #ytform p { line-height: 20px; margin-bottom: 11px; }
2381 - #ytform ul li {margin-left: 30px; list-style: disc outside none;}
2382 - .ytindent {padding: 0px 0px 0px 20px; font-size: 12px;}
2383 - .ytindent ul, .ytindent p {font-size: 12px;}
3249 + .wrap {font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",Arial,sans-serif; color: #000000;}
3250 + .wrap-ytprefs {max-width: 1064px;}
3251 + h1 span {vertical-align: middle;}
3252 + #ytform p, #ytform .p { line-height: 20px; margin: 18px 0; }
3253 + .ytindent {padding: 0px 0px 0px 20px; font-size: 13px; margin-bottom: 100px;}
3254 + .ytindent ul, .ytindent p {font-size: 13px;}
2384 3255 .shadow {-webkit-box-shadow: 0px 0px 20px 0px #000000; box-shadow: 0px 0px 20px 0px #000000;}
2385 3256 .gopro {margin: 0px;}
2386 3257 .gopro img {vertical-align: middle;
2387 3258 width: 19px;
@@ -2390,602 +3261,1236 @@
2390 3261 .gopro li {margin-bottom: 0px;}
2391 3262 .orange {color: #f85d00;}
2392 3263 .bold {font-weight: bold;}
2393 3264 .grey{color: #888888;}
2394 - #goprobox {border-radius: 15px; padding: 10px 15px 15px 15px; margin-top: 15px; border: 3px solid #CCE5EC; position: relative;}
2395 - #salenote {position: absolute; right: 10px; top: 10px; width: 75px; height: 30px;}
2396 - #nonprosupport {border-radius: 15px; padding: 10px 15px 20px 15px; border: 3px solid #ff6655;}
3265 + #goprobox {border-radius: 15px; padding: 10px 15px 15px 15px; border: 3px solid #CCE5EC; position: relative;}
2397 3266 .pronon {font-weight: bold; color: #f85d00;}
2398 - ul.reglist li {margin: 0px 0px 0px 30px; list-style: disc outside none;}
3267 + ul.reglist li {margin-left: 30px; list-style: disc outside none;}
2399 3268 .procol {width: 475px; float: left;}
2400 - .ytindent .procol ul {font-size: 11px;}
2401 - .smallnote, .ytindent .smallnote {font-style: italic; font-size: 10px;}
3269 + .ytindent .procol ul {font-size: 12px;}
3270 + .smallnote, .ytindent .smallnote {font-style: italic; font-size: 11px;}
2402 3271 .italic {font-style: italic;}
2403 - .ytindent h3 {font-size: 15px; line-height: 22px; margin: 5px 0px 10px 0px;}
3272 + .ytindent h3 {font-size: 16px; line-height: 22px; margin: 5px 0px 10px 0px;}
2404 3273 #wizleftlink {float: left; display: block; width: 240px; font-style: italic; text-align: center; text-decoration: none;}
2405 - .button-primary {font-weight: bold; white-space: nowrap;}
3274 + .button-primary {white-space: nowrap;}
2406 3275 p.submit {margin: 10px 0 0 0; padding: 10px 0 5px 0;}
2407 - .wp-core-ui p.submit .button-primary {font-size: 20px; height: 50px; padding: 0 20px 1px;
2408 - background: #2ea2cc; /* Old browsers */
2409 - background: -moz-linear-gradient(top, #2ea2cc 0%, #007396 98%); /* FF3.6+ */
2410 - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#2ea2cc), color-stop(98%,#007396)); /* Chrome,Safari4+ */
2411 - background: -webkit-linear-gradient(top, #2ea2cc 0%,#007396 98%); /* Chrome10+,Safari5.1+ */
2412 - background: -o-linear-gradient(top, #2ea2cc 0%,#007396 98%); /* Opera 11.10+ */
2413 - background: -ms-linear-gradient(top, #2ea2cc 0%,#007396 98%); /* IE10+ */
2414 - background: linear-gradient(to bottom, #2ea2cc 0%,#007396 98%); /* W3C */
2415 - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#2ea2cc', endColorstr='#007396',GradientType=0 ); /* IE6-9 */
3276 + .wp-core-ui p.submit .button-primary {
3277 + font-weight: bold;
3278 + font-size: 21px; min-height: 50px; padding: 0 20px 1px;
2416 3279 }
3280 + .wp-core-ui p.submit .button-primary[disabled] {
3281 + opacity: .4;
3282 + transition: opacity ease-in-out .3s;
3283 + }
3284 + .wp-core-ui p.submit .button-primary[disabled]:after {
3285 + content: url(<?php echo admin_url('images/wpspin_light.gif') ?>);
3286 + padding-left: 3px;
3287 + }
2417 3288 p.submit em {display: inline-block; padding-left: 20px; vertical-align: middle; width: 240px; margin-top: -6px;}
2418 3289 #opt_pro {box-shadow: 0px 0px 5px 0px #1870D5; width: 320px;vertical-align: top;}
2419 - #goprobox h3 {font-size: 13px;}
2420 - .chx {border-left: 5px solid rgba(100, 100, 100,.1);}
3290 + #goprobox h3 {font-size: 14px;}
3291 + .chx {border-left: 5px solid rgba(100, 100, 100,.1); margin-bottom: 20px;}
2421 3292 .chx p {margin: 0px 0px 5px 0px;}
2422 3293 .cuz {background-image: linear-gradient(to bottom,#4983FF,#0C5597) !important; color: #ffffff;}
2423 3294 .brightpro {background-image: linear-gradient(to bottom,#ff5500,#cc2200) !important; color: #ffffff;}
2424 3295 #boxdefaultdims {font-weight: bold; padding: 0px 10px; <?php echo $all[self::$opt_defaultdims] ? '' : 'display: none;' ?>}
2425 - #boxcustomarrows {font-weight: bold; padding: 0px 10px; <?php echo $all[self::$opt_gallery_customarrows] ? '' : 'display: none;' ?>}
3296 + #boxcustomarrows {font-weight: bold; padding: 0px 10px; <?php echo $all[self::$opt_gallery_customarrows] ? 'display: block;' : 'display: none;' ?>}
3297 + #boxchannelsub {font-weight: bold; padding: 0px 10px; <?php echo $all[self::$opt_gallery_channelsub] ? 'display: block;' : 'display: none;' ?>}
3298 + #box_collapse_grid {font-weight: bold; padding: 0px 10px; <?php echo isset($all[self::$opt_gallery_collapse_grid]) && $all[self::$opt_gallery_collapse_grid] ? 'display: block;' : 'display: none;' ?>}
3299 + #box_restrict_wizard {padding: 0px 10px; <?php echo isset($all[self::$opt_restrict_wizard]) && $all[self::$opt_restrict_wizard] ? 'display: block;' : 'display: none;' ?>}
3300 + #box_restrict_wizard label {display: block; margin: 5px 10px;}
2426 3301 .textinput {border-width: 2px !important;}
3302 + input[type=text]::placeholder {font-weight: normal;}
2427 3303 h3.sect {border-radius: 10px; background-color: #D9E9F7; padding: 5px 5px 5px 10px; position: relative; font-weight: bold;}
2428 3304 h3.sect a {text-decoration: none; color: #E20000;}
2429 3305 h3.sect a.button-primary {color: #ffffff;}
2430 3306 h4.sect {border-radius: 10px; background-color: #D9E9F7; padding: 5px 5px 5px 10px; position: relative; font-weight: bold;}
2431 3307
3308 + .nav-tab-wrapper sup {line-height: 0;}
2432 3309 .ytnav {margin-bottom: 15px;}
2433 - .ytnav a {font-weight: bold; display: inline-block; padding: 5px 10px; margin: 0px 20px 0px 0px; border: 1px solid #cccccc; border-radius: 6px;
3310 + .ytnav a {font-weight: bold; display: inline-block; padding: 5px 10px; margin: 0px 15px 0px 0px; border: 1px solid #cccccc; border-radius: 6px;
2434 3311 text-decoration: none; background-color: #ffffff;}
3312 + .ytnav a:last-child {margin-right: 0;}
2435 3313 .jumper {height: 25px;}
2436 3314 .ssschema {float: right; width: 350px; height: auto; margin-right: 10px;}
2437 3315 .ssfb {float: right; height: auto; margin-right: 10px; margin-left: 15px; margin-bottom: 10px;}
2438 - .totop {position: absolute; right: 20px; top: 5px; color: #444444; font-size: 10px;}
3316 + .totop {position: absolute; right: 20px; top: 5px; color: #444444; font-size: 11px;}
2439 3317 input[type=checkbox] {border: 1px solid #000000;}
2440 3318 .chktitle {display: inline-block; padding: 1px 5px 1px 5px; border-radius: 3px; background-color: #ffffff; border: 1px solid #dddddd;}
2441 3319 b, strong {font-weight: bold;}
2442 - input.checkbox[disabled] {border: 1px dashed #444444;}
3320 + input.checkbox[disabled], input[type=radio][disabled] {border: 1px dashed #444444;}
2443 3321 .pad10 {padding: 10px;}
2444 3322 #boxdohl {font-weight: bold; padding: 0px 10px; <?php echo $all[self::$opt_dohl] ? '' : 'display: none;' ?>}
2445 - #boxdyn {font-weight: bold; padding: 0px 10px; <?php echo $all[self::$opt_dynload] ? '' : 'display: none;' ?>}
2446 - #boxspdc {padding: 0px 10px; <?php echo $all[self::$opt_spdc] ? '' : 'display: none;' ?>}
2447 3323 #boxdefaultvol {font-weight: bold; padding: 0px 10px; <?php echo $all[self::$opt_defaultvol] ? '' : 'display: none;' ?>}
2448 3324 .vol-output {display: none; width: 30px; color: #008800;}
2449 3325 .vol-range {background-color: #dddddd; border-radius: 3px; cursor: pointer;}
2450 3326 input#vol {vertical-align: middle;}
2451 3327 .vol-seeslider {display: none;}
2452 - input#spdcexp {width: 70px;}
2453 3328 .indent-option {margin-left: 25px;}
2454 - #boxschemaorg {font-weight: bold; padding: 7px 0; <?php echo $all[self::$opt_schemaorg] ? 'display: block;' : 'display: none;' ?>}
2455 3329 #boxmigratelist { <?php echo $all[self::$opt_migrate] ? '' : 'display: none;' ?>}
2456 3330 #boxresponsive_all { <?php echo $all[self::$opt_responsive] ? '' : 'display: none;' ?> padding-left: 25px; border-left: 5px solid rgba(100, 100, 100,.1); margin-left: 5px;}
2457 - .apikey-msg {display: inline-block; width: 45%; vertical-align: top;}
2458 3331 .apikey-video{margin-left: 3%; display: inline-block; width: 50%; position: relative; padding-top: 29%}
2459 3332 .apikey-video iframe{display: block; width: 100%; height: 100%; position: absolute; top: 0; left: 0;}
2460 - #boxnocookie {display: inline-block; border-radius: 3px; padding: 2px 4px 2px 4px; color: red; background-color: yellow; font-weight: bold; <?php echo $all[self::$opt_nocookie] ? '' : 'display: none;' ?>}
3333 + #boxnocookie {display: inline-block; border-radius: 3px; padding: 2px 4px 2px 4px; color: red; <?php echo $all[self::$opt_nocookie] ? '' : 'display: none;' ?>}
3334 + #boxapinever {display: none; color: red;}
3335 + input[type="radio"]:checked ~ #boxapinever {display: block;}
3336 + #box_facade_mode { color: red; <?php echo (bool) $all[self::$opt_facade_mode] ? 'display: block;' : 'display: none;' ?>}
3337 + #box_gdpr_consent { color: red; <?php echo (bool) $all[self::$opt_gdpr_consent] ? 'display: block;' : 'display: none;' ?>}
2461 3338 .strike {text-decoration: line-through;}
2462 - .upgchecks { padding: 20px; border-radius: 15px; border: 1px dotted #777777; background-color: #fcfcfc; }
3339 + .upgchecks { padding: 20px; border: 1px dotted #777777; background-color: #fcfcfc; }
2463 3340 .clearboth {clear: both;}
2464 3341 div.hr {clear: both; border-bottom: 1px dotted #A8BDD8; margin: 20px 0 20px 0;}
2465 3342 .wp-pointer-buttons a.close {margin-top: 0 !important;}
2466 3343 .pad20{padding: 20px 0 20px 0;}
2467 3344 .ssgallery {float: right; width: 130px; height: auto; margin-left: 15px; border: 3px solid #ffffff;}
3345 + .sssubscribe{display: block; width: 400px; height: auto;}
2468 3346 .ssaltgallery {float: right; height: auto; margin-right: 10px; margin-left: 15px; margin-bottom: 10px; width: 350px;}
3347 + .sspopupplayer {float: right; height: auto; margin-right: 10px; margin-left: 15px; margin-bottom: 10px; width: 350px;}
3348 + .sshidethumbimg {float: right; height: auto; margin-right: 10px; margin-left: 40px; margin-bottom: 10px; width: 315px;}
3349 + .sswizardbutton { max-width: 70%; height: auto;}
2469 3350 .save-changes-follow {position: fixed; z-index: 10000; bottom: 0; right: 0; background-color: #ffffff; padding: 0 20px; border-top-left-radius: 20px; border: 2px solid #aaaaaa; border-right-width: 0; border-bottom-width: 0;
2470 3351 -webkit-box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.75);
2471 3352 -moz-box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.75);
2472 3353 box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.75); }
2473 - </style>
2474 - <div class="ytindent">
2475 - <br>
2476 - <div id="jumphowto"></div>
2477 - <div class="ytnav">
2478 - <a href="#jumphowto">How To Embed</a>
2479 - <a href="#jumpwiz">Visual Wizard</a>
2480 - <a href="#jumpdefaults">Defaults</a>
2481 - <a href="#jumpcompat">Compatibility</a>
2482 - <a href="#jumpgallery">Gallery Settings</a>
2483 - <a href="#jumpoverride">Override Defaults</a>
2484 - <a target="_blank" href="<?php echo self::$epbase . "/dashboard/pro-easy-video-analytics.aspx?ref=protab" ?>" style="border-color: #888888;">Upgrade?</a>
2485 - <a href="#jumpsupport">Support</a>
2486 - </div>
3354 + .alertify .ajs-body .ajs-content {line-height: 2.5em;}
3355 + #jumpmonetize h2:first-child {margin-bottom: 0;}
2487 3356
2488 - <form name="form1" method="post" action="" id="ytform">
2489 - <input type="hidden" name="<?php echo $ytprefs_submitted; ?>" value="Y">
3357 + .wrap-ytprefs h2.nav-tab-wrapper {
3358 + margin:22px 0 0 0;
3359 + }
2490 3360
2491 - <h3 class="sect">
2492 - How to Insert a YouTube Video or Playlist &nbsp; <a class="smallnote" href="#jumpgallery">(For gallery directions, go here &raquo;)</a>
2493 - </h3>
2494 - <p>
2495 - <b>For videos:</b> <i>Method 1 - </i> Do you already have a URL to the video you want to embed in a post, page, or even a widget? All you have to do is paste it on its own line, as shown below (including the http:// part). Easy, eh?<br>
2496 - <i>Method 2 - </i> If you want to do some formatting (e.g. add HTML to center a video) or have two or more videos next to each other on the same line, wrap each link with the <code>[embedyt]...[/embedyt]</code> shortcode. <b>Tip for embedding videos on the same line:</b> As shown in the example image below, decrease the size of each video so that they fit together on the same line (See the "How To Override Defaults" section for height and width instructions).
2497 - </p>
2498 - <p>
2499 - <b>For playlists:</b> Go to the page for the playlist that lists all of its videos (<a target="_blank" href="http://www.youtube.com/playlist?list=PL70DEC2B0568B5469">Example &raquo;</a>). Click on the video that you want the playlist to start with. Copy and paste that browser URL into your blog on its own line. If you want the first video to always be the latest video in your playlist, check the option "Playlist Ordering" in the settings down below (you will also see this option available if you use the Pro Wizard). If you want to have two or more playlists next to each other on the same line, wrap each link with the <code>[embedyt]...[/embedyt]</code> shortcode.
2500 - </p>
2501 - <p>
2502 - <b>For channel playlists:</b> At your editor, click on the <img style="vertical-align: text-bottom;" src="<?php echo plugins_url('images/wizbuttonbig.png', __FILE__) ?>"> wizard button and choose the option <i>Search for a video or channel to insert in my editor.</i> Then, click on the <i>channel playlist</i> option there (instead of <i>single video</i>). Search for the channel username and follow the rest of the directions there.
2503 - </p>
2504 - <p>
2505 - <b>Examples:</b><br><br>
2506 - <img style="width: 900px; height: auto;" class="shadow" src="<?php echo plugins_url('images/sshowto.png', __FILE__) ?>" />
2507 - </p>
2508 - <p>
2509 - Always follow these rules for any URL:
2510 - </p>
2511 - <ul class="reglist">
2512 - <li>Make sure the URL is really on its own line by itself. Or, if you need multiple videos on the same line, make sure each URL is wrapped properly with the shortcode (Example: <code>[embedyt]http://www.youtube.com/watch?v=ABCDEFGHIJK&width=400&height=250[/embedyt]</code>)</li>
2513 - <li>Make sure the URL is <strong>not</strong> an active hyperlink (i.e., it should just be plain text). Otherwise, highlight the URL and click the "unlink" button in your editor: <img src="<?php echo plugins_url('images/unlink.png', __FILE__) ?>"/></li>
2514 - <li>Make sure you did <strong>not</strong> format or align the URL in any way. If your URL still appears in your actual post instead of a video, highlight it and click the "remove formatting" button (formatting can be invisible sometimes): <img src="<?php echo plugins_url('images/erase.png', __FILE__) ?>"/></li>
2515 - <li>If you really want to align the video, try wrapping the link with the shortcode first. For example: <code>[embedyt]http://www.youtube.com/watch?v=ABCDEFGHIJK[/embedyt]</code> Using the shortcode also allows you to have two or more videos next to each other on the same line. Just put the shortcoded links together on the same line. For example:<br>
2516 - <code>[embedyt]http://www.youtube.com/watch?v=ABCDEF[/embedyt] [embedyt]http://www.youtube.com/watch?v=GHIJK[/embedyt]</code>
2517 - </ul>
3361 + .wrap-ytprefs h3 .nav-tab {
3362 + padding: 5px 10px;
3363 + }
2518 3364
2519 - <div class="jumper" id="jumpwiz"></div>
2520 - <h3 class="sect">Visual YouTube Wizard <a href="#top" class="totop">&#9650; top</a></h3>
3365 + .wrap-ytprefs section {
3366 + display:none;
3367 + padding-top:15px;
3368 + }
3369 + .wrap-ytprefs section#jumpdefaults {
3370 + display:block;
3371 + }
3372 + .wrap-ytprefs .no-js section {
3373 + display: block;
3374 + }
2521 3375
2522 - <p>
2523 - Let's say you don't know the exact URL of the video you wish to embed. Well, we've made the ability to directly search YouTube and insert videos right from your editor tab as a free feature to all users.
2524 - Simply click the <img style="vertical-align: text-bottom;" src="<?php echo plugins_url('images/wizbuttonbig.png', __FILE__) ?>"> wizard button found above
2525 - your editor to start the wizard (see image above to locate this button). There, you'll be given the option to enter your search terms.
2526 - Click the "Search" button to view the results. Each result will have an <span class="button-primary cuz">&#9660; Insert Into Editor</span> button that
2527 - you can click to directly embed the desired video link to your post without having to copy and paste.
2528 - </p>
2529 - <p>
2530 - The ability to read the latest Internet discussions about the videos you want to embed is now free to all users.
2531 - </p>
2532 - <p>
2533 - <b class="orange">Even more options are available to PRO users!</b> Simply click the <a href="<?php echo self::$epbase . '/dashboard/pro-easy-video-analytics.aspx?ref=protab' ?>" target="_blank" class="button-primary cuz">&#9658; Customize</a> button on the wizard to further personalize your embeds without having to enter special codes yourself.
2534 - <br>
2535 - <br>
3376 + .gdpr-options-left {
3377 + width: 65%;
3378 + float: left;
3379 + clear: left;
3380 + }
2536 3381
2537 - <a href="<?php echo self::$epbase ?>/dashboard/pro-easy-video-analytics.aspx" target="_blank" style="text-decoration: none;"><img style="width: 500px; margin: 0 auto; display: block;" src="<?php echo plugins_url('images/ssprowizard.png', __FILE__) ?>" ></a>
3382 + .gdpr-options-right {
3383 + width: 33%;
3384 + float: right;
3385 + margin-top: 20px;
3386 + }
2538 3387
2539 - </p>
2540 - <div class="jumper" id="jumpdefaults"></div>
2541 - <h3 class="sect">
2542 - <?php _e("Default YouTube Options") ?> <a href="#top" class="totop">&#9650; top</a>
2543 - </h3>
2544 - <p>
2545 - <?php _e("One of the benefits of using this plugin is that you can set site-wide default options for all your videos (click \"Save Changes\" when finished). However, you can also override them (and more) on a per-video basis. Directions on how to do that are in the next section.") ?>
2546 - </p>
2547 - <?php // self::save_changes_button(); ?>
3388 + .gdpr-options-right .img-gdpr-message {
3389 + width: 100%;
3390 + height: auto;
3391 + }
2548 3392
2549 - <div class="ytindent chx">
2550 - <p>
2551 - <input name="<?php echo self::$opt_glance; ?>" id="<?php echo self::$opt_glance; ?>" <?php checked($all[self::$opt_glance], 1); ?> type="checkbox" class="checkbox">
2552 - <label for="<?php echo self::$opt_glance; ?>"><?php _e('<b class="chktitle">At a glance:</b> Show "At a Glance" Embed Links on the dashboard homepage.') ?></label>
2553 - </p>
2554 - <p>
2555 - <input name="<?php echo self::$opt_center; ?>" id="<?php echo self::$opt_center; ?>" <?php checked($all[self::$opt_center], 1); ?> type="checkbox" class="checkbox">
2556 - <label for="<?php echo self::$opt_center; ?>"><?php _e('<b class="chktitle">Centering:</b> Automatically center all your videos (not necessary if all your videos span the whole width of your blog).') ?></label>
2557 - </p>
2558 - <p>
2559 - <input name="<?php echo self::$opt_autoplay; ?>" id="<?php echo self::$opt_autoplay; ?>" <?php checked($all[self::$opt_autoplay], 1); ?> type="checkbox" class="checkbox">
2560 - <label for="<?php echo self::$opt_autoplay; ?>"><?php _e('<b class="chktitle">Autoplay:</b> Automatically start playing your videos.') ?></label>
2561 - </p>
2562 - <p>
2563 - <input name="<?php echo self::$opt_iv_load_policy; ?>" id="<?php echo self::$opt_iv_load_policy; ?>" <?php checked($all[self::$opt_iv_load_policy], 1); ?> type="checkbox" class="checkbox">
2564 - <label for="<?php echo self::$opt_iv_load_policy; ?>"><?php _e('<b class="chktitle">Annotations:</b> Show annotations by default.') ?></label>
2565 - </p>
2566 - <p>
2567 - <input name="<?php echo self::$opt_loop; ?>" id="<?php echo self::$opt_loop; ?>" <?php checked($all[self::$opt_loop], 1); ?> type="checkbox" class="checkbox">
2568 - <label for="<?php echo self::$opt_loop; ?>"><?php _e('<b class="chktitle">Looping:</b> Loop all your videos.') ?></label>
2569 - </p>
2570 - <p>
2571 - <input name="<?php echo self::$opt_modestbranding; ?>" id="<?php echo self::$opt_modestbranding; ?>" <?php checked($all[self::$opt_modestbranding], 1); ?> type="checkbox" class="checkbox">
2572 - <label for="<?php echo self::$opt_modestbranding; ?>"><?php _e('<b class="chktitle">Modest Branding:</b> No YouTube logo will be shown on the control bar. Instead, the logo will only show as a watermark when the video is paused/stopped.') ?></label>
2573 - </p>
2574 - <p>
2575 - <input name="<?php echo self::$opt_rel; ?>" id="<?php echo self::$opt_rel; ?>" <?php checked($all[self::$opt_rel], 1); ?> type="checkbox" class="checkbox">
2576 - <label for="<?php echo self::$opt_rel; ?>"><?php _e('<b class="chktitle">Related Videos:</b> Show related videos at the end.') ?></label>
2577 - </p>
2578 - <p>
2579 - <input name="<?php echo self::$opt_showinfo; ?>" id="<?php echo self::$opt_showinfo; ?>" <?php checked($all[self::$opt_showinfo], 1); ?> type="checkbox" class="checkbox">
2580 - <label for="<?php echo self::$opt_showinfo; ?>"><?php _e('<b class="chktitle">Show Title:</b> Show the video title and other info.') ?></label>
2581 - </p>
2582 - <p>
2583 - <input name="<?php echo self::$opt_acctitle; ?>" id="<?php echo self::$opt_acctitle; ?>" <?php checked($all[self::$opt_acctitle], 1); ?> type="checkbox" class="checkbox">
2584 - <label for="<?php echo self::$opt_acctitle; ?>"><b class="chktitle">Accessible Title Attributes: </b> Improve accessibility by using title attributes for screen reader support. It should help your site pass functional accessibility evaluations (FAE). </label>
2585 - </p>
2586 - <p>
2587 - <input name="<?php echo self::$opt_theme; ?>" id="<?php echo self::$opt_theme; ?>" <?php checked($all[self::$opt_theme], 'dark'); ?> type="checkbox" class="checkbox">
2588 - <label for="<?php echo self::$opt_theme; ?>"><?php _e('<b class="chktitle">Dark Theme:</b> Use the dark theme (uncheck to use light theme).') ?></label>
2589 - </p>
2590 - <p>
2591 - <input name="<?php echo self::$opt_color; ?>" id="<?php echo self::$opt_color; ?>" <?php checked($all[self::$opt_color], 'red'); ?> type="checkbox" class="checkbox">
2592 - <label for="<?php echo self::$opt_color; ?>"><?php _e('<b class="chktitle">Red Progress Bar:</b> Use the red progress bar (uncheck to use a white progress bar). Note: Using white will disable the modestbranding option.') ?></label>
2593 - </p>
2594 - <p>
2595 - <input name="<?php echo self::$opt_vq; ?>" id="<?php echo self::$opt_vq; ?>" <?php checked($all[self::$opt_vq], 'hd720'); ?> type="checkbox" class="checkbox">
2596 - <label for="<?php echo self::$opt_vq; ?>"><?php _e('<b class="chktitle strike">HD Quality:</b> Force HD quality when available. <b>NOTE: YouTube has deprecated this unofficially supported option.</b>') ?> </label>
2597 - </p>
2598 - <p>
2599 - <input name="<?php echo self::$opt_wmode; ?>" id="<?php echo self::$opt_wmode; ?>" <?php checked($all[self::$opt_wmode], 'opaque'); ?> type="checkbox" class="checkbox">
2600 - <label for="<?php echo self::$opt_wmode; ?>"><?php _e('<b class="chktitle">Wmode:</b> Use "opaque" wmode (uncheck to use "transparent"). Opaque may have higher performance.') ?></label>
2601 - </p>
2602 - <p>
2603 - <input name="<?php echo self::$opt_defaultdims; ?>" id="<?php echo self::$opt_defaultdims; ?>" <?php checked($all[self::$opt_defaultdims], 1); ?> type="checkbox" class="checkbox">
2604 - <span id="boxdefaultdims">
2605 - Width: <input type="text" name="<?php echo self::$opt_defaultwidth; ?>" id="<?php echo self::$opt_defaultwidth; ?>" value="<?php echo trim($all[self::$opt_defaultwidth]); ?>" class="textinput" style="width: 50px;"> &nbsp;
2606 - Height: <input type="text" name="<?php echo self::$opt_defaultheight; ?>" id="<?php echo self::$opt_defaultheight; ?>" value="<?php echo trim($all[self::$opt_defaultheight]); ?>" class="textinput" style="width: 50px;">
2607 - </span>
3393 + iframe#gdpr_consent_message_ifr {
3394 + min-height: 250px !important;
3395 + }
2608 3396
2609 - <label for="<?php echo self::$opt_defaultdims; ?>"><?php _e('<b class="chktitle">Default Dimensions:</b> Make your videos have a default size. (NOTE: Checking the responsive option will override this size setting) ') ?></label>
2610 - </p>
2611 - <p>
2612 - <input name="<?php echo self::$opt_responsive; ?>" id="<?php echo self::$opt_responsive; ?>" <?php checked($all[self::$opt_responsive], 1); ?> type="checkbox" class="checkbox">
2613 - <label for="<?php echo self::$opt_responsive; ?>"><?php _e('<b class="chktitle">Responsive Video Sizing:</b> Make your videos responsive so that they dynamically fit in all screen sizes (smart phone, PC and tablet). NOTE: While this is checked, any custom hardcoded widths and heights you may have set will dynamically change too. <b>Do not check this if your theme already handles responsive video sizing.</b>') ?></label>
2614 - <div id="boxresponsive_all">
2615 - <input type="radio" name="<?php echo self::$opt_responsive_all; ?>" id="<?php echo self::$opt_responsive_all; ?>1" value="1" <?php checked($all[self::$opt_responsive_all], 1); ?> >
2616 - <label for="<?php echo self::$opt_responsive_all; ?>1">Responsive for all YouTube videos</label> &nbsp;&nbsp;
2617 - <input type="radio" name="<?php echo self::$opt_responsive_all; ?>" id="<?php echo self::$opt_responsive_all; ?>0" value="0" <?php checked($all[self::$opt_responsive_all], 0); ?> >
2618 - <label for="<?php echo self::$opt_responsive_all; ?>0">Responsive for only videos embedded via this plugin</label>
2619 - </div>
2620 - </p>
2621 - <p>
2622 - <input name="<?php echo self::$opt_widgetfit; ?>" id="<?php echo self::$opt_widgetfit; ?>" <?php checked($all[self::$opt_widgetfit], 1); ?> type="checkbox" class="checkbox">
2623 - <label for="<?php echo self::$opt_widgetfit; ?>"><?php _e('<b class="chktitle">Autofit Widget Videos:</b> Make each video that you embed in a widget area automatically fit the width of its container.</b>') ?></label>
2624 - </p>
2625 - <p>
2626 - <input name="<?php echo self::$opt_playsinline; ?>" id="<?php echo self::$opt_playsinline; ?>" <?php checked($all[self::$opt_playsinline], 1); ?> type="checkbox" class="checkbox">
2627 - <label for="<?php echo self::$opt_playsinline; ?>">
2628 - <b class="chktitle">iOS Playback:</b> Check this to allow your embeds to play inline within your page when viewed on iOS (iPhone and iPad) browsers. Uncheck it to have iOS launch your embeds in fullscreen instead.
2629 - <em>Disclaimer: YouTube/Google has issues with this iOS related parameter, but we are providing it here in the event that they support it consistently.</em>
2630 - </label>
2631 - </p>
2632 - <p>
2633 - <input name="<?php echo self::$opt_origin; ?>" id="<?php echo self::$opt_origin; ?>" <?php checked($all[self::$opt_origin], 1); ?> type="checkbox" class="checkbox">
2634 - <label for="<?php echo self::$opt_origin; ?>"><b class="chktitle">Extra Player Security: </b>
2635 - Add 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).
2636 - </label>
2637 - </p>
2638 - <p>
2639 - <input name="<?php echo self::$opt_nocookie; ?>" id="<?php echo self::$opt_nocookie; ?>" <?php checked($all[self::$opt_nocookie], 1); ?> type="checkbox" class="checkbox">
2640 - <span id="boxnocookie">
2641 - Uncheck this option if you are planning to embed galleries and playlists on your site. Furthermore, videos on mobile devices may have problems if you leave this checked.
2642 - </span>
2643 - <label for="<?php echo self::$opt_nocookie; ?>">
2644 - <b class="chktitle">No Cookies:</b> Prevent YouTube from leaving tracking cookies on your visitors browsers unless they actual play the videos. This is coded to apply this behavior on links in your past post as well. <b>NOTE: Research shows that YouTube's support of Do Not Track can be error-prone. </b>
2645 - </label>
2646 - </p>
2647 - <p>
2648 - <input name="<?php echo self::$opt_controls; ?>" id="<?php echo self::$opt_controls; ?>" <?php checked($all[self::$opt_controls], 2); ?> type="checkbox" class="checkbox">
2649 - <label for="<?php echo self::$opt_controls; ?>"><b class="chktitle">Show Controls:</b> Show the player's control bar. Unchecking this option creates a cleaner look but limits what your viewers can control (play position, volume, etc.).</label>
2650 - </p>
2651 - <p>
2652 - <input name="<?php echo self::$opt_autohide; ?>" id="<?php echo self::$opt_autohide; ?>" <?php checked($all[self::$opt_autohide], 1); ?> type="checkbox" class="checkbox">
2653 - <label for="<?php echo self::$opt_autohide; ?>"><b class="chktitle">Autohide Controls:</b> Slide away the control bar after the video starts playing. It will automatically slide back in again if you mouse over the video. If you unchecked "Show Controls" above, then what you select for Autohide does not matter since there are no controls to even hide.</label>
2654 - </p>
2655 - <!-- <p>
2656 - <input name="<?php echo self::$opt_ssl; ?>" id="<?php echo self::$opt_ssl; ?>" <?php checked($all[self::$opt_ssl], 1); ?> type="checkbox" class="checkbox">
2657 - <label for="<?php echo self::$opt_ssl; ?>">
2658 - <b class="chktitle">HTTPS/SSL Player:</b> Do you have a website that uses HTTPS? Check this to use the secure YouTube player for all of your embeds.
2659 - This will go back and also secure your past embeds as they are loaded on their pages. Most web browsers will warn users when they access web pages via HTTPS that contain embedded content loaded via HTTP. If your main site is currently accessed via HTTPS, using HTTPS URLs for your YouTube embeds will prevent your users from running into that warning. If you're not currently supporting HTTPS/SSL, <a href="http://embedplus.com/convert-old-youtube-embeds-to-https-ssl.aspx" target="_blank">here's some motivation from Google &raquo;</a>
2660 - </label>
2661 - </p>-->
2662 - <p>
2663 - <input name="<?php echo self::$opt_defaultvol; ?>" id="<?php echo self::$opt_defaultvol; ?>" <?php checked($all[self::$opt_defaultvol], 1); ?> type="checkbox" class="checkbox">
2664 - <span id="boxdefaultvol">
2665 - Volume: <span class="vol-output"></span> <input min="0" max="100" step="1" type="text" name="<?php echo self::$opt_vol; ?>" id="<?php echo self::$opt_vol; ?>" value="<?php echo trim($all[self::$opt_vol]); ?>" >
2666 - </span>
2667 - <label for="<?php echo self::$opt_defaultvol; ?>">
2668 - <b class="chktitle">Volume Initialization: </b>
2669 - Set an initial volume level for all of your embedded videos. Check this and you'll see a <span class="vol-seeslider">slider</span> <span class="vol-seetextbox">textbox</span> for setting the start volume to a value between 0 (mute) and 100 (max) percent. Leaving it unchecked means you want the visitor's default behavior. This feature is experimental and is less predictable on a page with more than one embed. Read more about why you might want to <a href="<?php echo self::$epbase ?>/mute-volume-youtube-wordpress.aspx" target="_blank">initialize YouTube embed volume here &raquo;</a>
2670 - </label>
2671 - </p>
3397 + section#jumpwiz hr {
3398 + margin: 20px 0 20px 0;
3399 + }
3400 + .wiztab-screenshots {
3401 + float: right;
3402 + max-width: 50%;
3403 + height: auto;
3404 + clear: right;
3405 + margin-left: 30px;
3406 + margin-bottom: 15px;
3407 + display: block;
3408 + border: 5px solid #dddddd;
3409 + }
2672 3410
2673 - <p>
2674 - <input name="<?php echo self::$opt_cc_load_policy; ?>" id="<?php echo self::$opt_cc_load_policy; ?>" <?php checked($all[self::$opt_cc_load_policy], 1); ?> type="checkbox" class="checkbox">
2675 - <label for="<?php echo self::$opt_cc_load_policy; ?>"><?php _e('<b class="chktitle">Closed Captions:</b> Turn on closed captions by default.') ?></label>
2676 - </p>
2677 - <p>
2678 - <input name="<?php echo self::$opt_dohl; ?>" id="<?php echo self::$opt_dohl; ?>" <?php checked($all[self::$opt_dohl], 1); ?> type="checkbox" class="checkbox">
2679 - <!-- <span id="boxdohl">
2680 - Language: <input type="text" name="<?php echo self::$opt_hl; ?>" id="<?php echo self::$opt_hl; ?>" value="<?php echo trim($all[self::$opt_hl]); ?>" class="textinput" style="width: 50px;" maxlength="2">
2681 - </span>-->
2682 - <label for="<?php echo self::$opt_dohl; ?>"><b class="chktitle">Player Localization / Internationalization: </b>
2683 - Automatically detect your site's default language (using get_locale) and set your YouTube embeds interface language so that it matches. Specifically, this will set the player's tooltips and caption track if your language is natively supported by YouTube. We suggest checking this if English is not your site's default language. <a href="<?php echo self::$epbase ?>/youtube-iso-639-1-language-codes.aspx" target="_blank">See here for more details &raquo;</a></label>
2684 - </p>
2685 - <p>
2686 - <input name="<?php echo self::$opt_html5; ?>" id="<?php echo self::$opt_html5; ?>" <?php checked($all[self::$opt_html5], 1); ?> type="checkbox" class="checkbox">
2687 - <label for="<?php echo self::$opt_html5; ?>">
2688 - <b class="chktitle strike">HTML5 First:</b>
2689 - As of January 2015, YouTube began serving the HTML5 player by default; therefore, this plugin no longer needs a special HTML5 setting. This option is simply kept here as a notice.
2690 - </label>
2691 - </p>
3411 + .epyt-deprecated {
3412 + color: #aaaaaa;
3413 + }
2692 3414
2693 - <p>
2694 - <input name="<?php echo self::$opt_playlistorder; ?>" id="<?php echo self::$opt_playlistorder; ?>" <?php checked($all[self::$opt_playlistorder], 1); ?> type="checkbox" class="checkbox">
2695 - <label for="<?php echo self::$opt_playlistorder; ?>">
2696 - <b class="chktitle">Playlist Ordering: <sup class="orange bold">NEW</sup></b>
2697 - Check this option if you want your playlists to begin with the latest added video by default. (Unchecking this will force playlists to always start with your selected specific video, even if you add videos to the playlist later).
2698 - Note that this is not for setting the thumbnail list order of galleries, just the standard playlist player that YouTube provides.
2699 - </label>
2700 - </p>
3415 + input[type="checkbox"] + label .check-note {
3416 + display: none;
3417 + }
2701 3418
3419 + input[type="checkbox"]:checked + label .check-note {
3420 + display: inline;
3421 + }
2702 3422
3423 + .not-live-content {
3424 + opacity: .3;
3425 + }
2703 3426
2704 - </div>
3427 + #not_live_on:checked ~ .not-live-content, #not_live_on_channel:checked ~ .not-live-content {
3428 + opacity: 1;
3429 + }
2705 3430
2706 - <div class="jumper" id="jumpcompat"></div>
2707 - <h3 class="sect">Compatibility Settings<sup class="orange bold">NEW</sup> <a href="#top" class="totop">&#9650; top</a></h3>
2708 - <p>
2709 - With thousands of active users, our plugin may not work with every plugin out there. Below are some settings you may wish to try out.
2710 - </p>
2711 - <div class="ytindent chx">
2712 - <p>
2713 - <input name="<?php echo self::$opt_old_script_method; ?>" id="<?php echo self::$opt_old_script_method; ?>" <?php checked($all[self::$opt_old_script_method], 1); ?> type="checkbox" class="checkbox">
2714 - <label for="<?php echo self::$opt_old_script_method; ?>">
2715 - <b class="chktitle">Use Legacy Scripts: </b>
2716 - This is a legacy option for users with theme issues that require backwards compatibility (v.10.5 or earlier). It may also help with caching plugin or CDN plugin issues.
2717 - </label>
2718 - </p>
2719 - <p>
2720 - <input name="<?php echo self::$opt_admin_off_scripts; ?>" id="<?php echo self::$opt_admin_off_scripts; ?>" <?php checked($all[self::$opt_admin_off_scripts], 1); ?> type="checkbox" class="checkbox">
2721 - <label for="<?php echo self::$opt_admin_off_scripts; ?>">
2722 - <b class="chktitle">Turn Off Scripts While Editing: <sup class="orange bold">NEW</sup></b>
2723 - Front-end editors and visual pagebuilders often run Javascript while you're in edit mode. Check this to turn off this plugin's Javascript during edit mode, if you see conflicts.
2724 - Don't worry, all other visitors to your site will still view your site normally.
2725 - </label>
2726 - </p>
2727 - <p>
2728 - <input name="<?php echo self::$opt_migrate; ?>" id="<?php echo self::$opt_migrate; ?>" <?php checked($all[self::$opt_migrate], 1); ?> type="checkbox" class="checkbox">
2729 - <label for="<?php echo self::$opt_migrate; ?>">
2730 - <b class="chktitle">Migrate Shortcodes: </b> Inherit other shortcodes.
2731 - </label>
2732 - <div id="boxmigratelist">
2733 - <ul>
2734 - <li><input name="<?php echo self::$opt_migrate_youtube; ?>" id="<?php echo self::$opt_migrate_youtube; ?>" <?php checked($all[self::$opt_migrate_youtube], 1); ?> type="checkbox" class="checkbox"><label for="<?php echo self::$opt_migrate_youtube; ?>">"Youtube Embed" : <code>youtube</code> and <code>youtube_video</code> shortcodes</label></li>
2735 - <li class="smallnote orange" style="list-style: none;">This feature is beta. More shortcodes coming.</li>
2736 - </ul>
3431 + #facade_mode ~ .box_facade_mode {
3432 + opacity: .3;
3433 + }
2737 3434
2738 - </div>
2739 - </p>
2740 - <p>
2741 - <input name="<?php echo self::$opt_oldspacing; ?>" id="<?php echo self::$opt_oldspacing; ?>" <?php checked($all[self::$opt_oldspacing], 1); ?> type="checkbox" class="checkbox">
2742 - <label for="<?php echo self::$opt_oldspacing; ?>">
2743 - <b class="chktitle">Legacy Spacing:</b> Continue the spacing style from version 4.0 and older. Those versions required you to manually add spacing above and below your video. Unchecking this will automatically add the spacing.
2744 - </label>
2745 - </p>
2746 - <p>
2747 - <input name="<?php echo self::$opt_evselector_light; ?>" id="<?php echo self::$opt_evselector_light; ?>" <?php checked($all[self::$opt_evselector_light], 1); ?> type="checkbox" class="checkbox">
2748 - <label for="<?php echo self::$opt_evselector_light; ?>">
2749 - <b class="chktitle">Theme Video Problems: <sup class="orange bold">NEW</sup></b>
2750 - Check this option if you're having issues with autoplayed videos or background videos etc. that have been generated by your theme.
2751 - </label>
2752 - </p>
2753 - <p>
2754 - <input name="<?php echo self::$opt_debugmode; ?>" id="<?php echo self::$opt_debugmode; ?>" <?php checked($all[self::$opt_debugmode], 1); ?> type="checkbox" class="checkbox">
2755 - <label for="<?php echo self::$opt_debugmode; ?>">
2756 - <b class="chktitle">Debug Mode: </b> If you ask for support, we may ask you to turn on debug mode here.
2757 - It may print out some diagnostic info so that we can help you solve your issue.
2758 - </label>
2759 - </p>
3435 + #facade_mode:checked ~ .box_facade_mode {
3436 + opacity: 1;
3437 + }
2760 3438
2761 - </div>
2762 - <div class="jumper" id="jumpgallery"></div>
2763 - <h3 class="sect">Gallery Settings and Directions<sup class="orange bold">NEW</sup> <a href="#top" class="totop">&#9650; top</a></h3>
2764 - <img class="ssgallery" src="<?php echo plugins_url('images/ssgallery.png', __FILE__) ?>">
2765 - <p>
2766 - <a target="_blank" href="<?php echo self::$epbase ?>/responsive-youtube-playlist-channel-gallery-for-wordpress.aspx">You can now make playlist embeds (and channel-playlist embeds) have a gallery layout &raquo;</a>. <strong>First, you must obtain your YouTube API key</strong>.
2767 - Don't worry, it's an easy process. Just <a href="https://www.youtube.com/watch?v=px8LvNIVblg" target="_blank">click this link &raquo;</a> and follow the video on that page to get your API key. Then paste it in the box below, and click the "Save Changes" button.
2768 - </p>
2769 - <!-- <p>
2770 - Simply add the following parameter to the end of your playlist url:
2771 - </p>
2772 - <p><code>&layout=gallery</code></p>
2773 - <p>For example, below is a playlist that has been converted into a gallery. Notice the new layout parameter, with no spaces:</p>
2774 - <p>
2775 - <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>
2776 - </p>
2777 - <p class="smallnote">
2778 - Note: The PRO wizard has steps to fully create playlist, channel, and gallery codes like the above.
2779 - </p>-->
2780 - <p>
2781 - Below are the settings for galleries:
2782 - </p>
2783 - <div class="ytindent chx">
2784 - <p>
2785 - <b class="chktitle">YouTube API Key:</b>
2786 - <input type="text" name="<?php echo self::$opt_gallery_apikey; ?>" id="<?php echo self::$opt_gallery_apikey; ?>" value="<?php echo trim($all[self::$opt_apikey]); ?>" class="textinput" style="width: 250px;">
2787 - Required so your site can get the thumbnails, title text, and other content from YouTube’s servers that used to render galleries. <a href="https://www.youtube.com/watch?v=px8LvNIVblg" target="_blank">Click this link &raquo;</a> and follow the video to the right to get your API key.
2788 - </p>
2789 - <p>
2790 - <label for="<?php echo self::$opt_gallery_pagesize; ?>"><b class="chktitle">Gallery Page Size:</b></label>
2791 - <select name="<?php echo self::$opt_gallery_pagesize; ?>" id="<?php echo self::$opt_gallery_pagesize; ?>" style="width: 60px;">
2792 - <?php
2793 - $gps_val = intval(trim($all[self::$opt_gallery_pagesize]));
2794 - $gps_val = min($gps_val, 50);
2795 - for ($gps = 1; $gps <= 50; $gps++)
2796 - {
2797 - ?><option <?php echo $gps_val == $gps ? 'selected' : '' ?> value="<?php echo $gps ?>"><?php echo $gps ?></option>
2798 - <?php
2799 - }
2800 - ?>
2801 - </select>
2802 - Enter how many thumbnails per page should be shown at once (YouTube allows a maximum of 50 per page).
2803 - </p>
2804 - <p>
2805 - <label for="<?php echo self::$opt_gallery_columns; ?>"><b class="chktitle">Number of Columns:</b></label>
2806 - <input name="<?php echo self::$opt_gallery_columns; ?>" id="<?php echo self::$opt_gallery_columns; ?>" type="number" class="textinput" style="width: 60px;" value="<?php echo trim($all[self::$opt_gallery_columns]); ?>">
2807 - Enter how many thumbnails can fit per row.
2808 - </p>
2809 - <p>
2810 - <input name="<?php echo self::$opt_gallery_customarrows; ?>" id="<?php echo self::$opt_gallery_customarrows; ?>" <?php checked($all[self::$opt_gallery_customarrows], 1); ?> type="checkbox" class="checkbox">
2811 - <span id="boxcustomarrows">
2812 - Previous Page: <input type="text" name="<?php echo self::$opt_gallery_customprev; ?>" id="<?php echo self::$opt_gallery_customprev; ?>" value="<?php echo esc_attr(trim($all[self::$opt_gallery_customprev])); ?>" class="textinput" style="width: 100px;"> &nbsp;
2813 - Next Page: <input type="text" name="<?php echo self::$opt_gallery_customnext; ?>" id="<?php echo self::$opt_gallery_customnext; ?>" value="<?php echo esc_attr(trim($all[self::$opt_gallery_customnext])); ?>" class="textinput" style="width: 100px;">
2814 - </span>
3439 + #defer_js ~ .box_defer_jquery {
3440 + opacity: .3;
3441 + }
2815 3442
2816 - <label for="<?php echo self::$opt_gallery_customarrows; ?>">
2817 - <b class="chktitle">Custom Next/Previous Text:</b> If you want your gallery viewers to see something besides "Next" and "Prev" when browsing through thumbnails, enter your replacement text here. This feature can be quite useful for non-English sites. For example, a French site might replace Prev with Pr&eacute;c&eacute;dent and Next with Suivant.
2818 - </label>
2819 - </p>
2820 - <p>
2821 - <label for="<?php echo self::$opt_gallery_scrolloffset; ?>"><b class="chktitle">Scroll Offset:</b></label>
2822 - <input name="<?php echo self::$opt_gallery_scrolloffset; ?>" id="<?php echo self::$opt_gallery_scrolloffset; ?>" type="number" class="textinput" style="width: 60px;" value="<?php echo trim($all[self::$opt_gallery_scrolloffset]); ?>">
2823 - After you click on a thumbnail, the gallery will automatically smooth scroll up to the actual player. If you need it to scroll a few pixels further, increase this number.
2824 - </p>
2825 - <p>
2826 - <input name="<?php echo self::$opt_gallery_showtitle; ?>" id="<?php echo self::$opt_gallery_showtitle; ?>" <?php checked($all[self::$opt_gallery_showtitle], 1); ?> type="checkbox" class="checkbox">
2827 - <label for="<?php echo self::$opt_gallery_showtitle; ?>"><b class="chktitle">Show Thumbnail Title:</b> Show titles with each thumbnail.</label>
2828 - </p>
2829 - <div class="smallnote pad20">
2830 - <strong class="orange">Note:</strong> We have an instructional video that shows how to generate the codes needed to embed two different types of galleries using the FREE and PRO version of the plugin:
2831 - <ol>
2832 - <li>a gallery from an entire YouTube channel, and</li>
2833 - <li>a gallery from a specific playlist</li>
2834 - </ol>
2835 - We advise that you <a href="https://www.youtube.com/watch?v=XvFL-Rr-2Qo" target="_blank">watch the video here &raquo;</a> with YouTube.com annotations turned on so you don't miss important steps.
2836 - The PRO wizard is an alternate way to fully create playlist, channel, and gallery codes.
2837 - </div>
3443 + #defer_js:checked ~ .box_defer_jquery {
3444 + opacity: 1;
3445 + }
2838 3446
2839 - </div>
3447 + .epyt-fitvid {
3448 + width: 100%;
3449 + padding-top: 56.25%;
3450 + position: relative;
3451 + }
2840 3452
2841 - <?php // self::save_changes_button(); ?>
3453 + .epyt-fitvid iframe {
3454 + position: absolute;
3455 + top: 0;
3456 + left:0;
3457 + right: 0;
3458 + bottom: 0;
3459 + width: 100%;
3460 + height: 100%;
3461 + }
2842 3462
2843 - <div class="upgchecks">
2844 - <h3 class="sect">PRO Features</h3>
2845 - <?php
2846 - if ($all[self::$opt_pro] && strlen(trim($all[self::$opt_pro])) > 8)
2847 - {
2848 - ?>
2849 - <p class="smallnote orange">Below are PRO features for enhanced SEO and performance (works for even past embed links). Gallery options for PRO users will also be listed here.</p>
3463 + .wiztab-pagebuilder {
3464 + width: 50%;
3465 + float: left;
3466 + padding: 20px;
3467 + box-sizing: border-box;
3468 + }
3469 +
3470 + </style>
3471 + <div class="wrap wrap-ytprefs">
3472 + <h1><span class="dashicons-before dashicons-video-alt3"></span> <?php echo __('EmbedPlus for YouTube Settings') ?></h1>
3473 + <?php
3474 + self::settings_nav();
3475 + ?>
3476 +
3477 + <div class="ytindent">
3478 + <form name="form1" method="post" action="" id="ytform">
3479 + <input type="hidden" name="<?php echo $ytprefs_submitted; ?>" value="Y">
3480 + <?php wp_nonce_field('_epyt_save', '_epyt_nonce', true); ?>
3481 + <section class="pattern" id="jumpapikey">
3482 + <h2>
3483 + YouTube API Key
3484 + </h2>
2850 3485 <p>
2851 - <img class="ssaltgallery" src="<?php echo plugins_url('images/ssaltgalleryall.jpg', __FILE__) ?>" />
2852 - <?php $cleanstyle = trim($all[self::$opt_gallery_style]); ?>
2853 - <select name="<?php echo self::$opt_gallery_style; ?>" id="<?php echo self::$opt_gallery_style; ?>" >
2854 - <option value="">Gallery Style</option>
2855 - <option value="grid" <?php echo 'grid' === $cleanstyle ? 'selected' : '' ?> >Grid (default)</option>
2856 - <option value="listview" <?php echo 'listview' === $cleanstyle ? 'selected' : '' ?> >Vertical List</option>
2857 - <option value="carousel" <?php echo 'carousel' === $cleanstyle ? 'selected' : '' ?> >Horizontal Slider</option>
2858 - </select>
2859 - <label for="<?php echo self::$opt_gallery_style; ?>">
2860 - <b>(PRO)</b> <b class="chktitle">Alternate Gallery Styling: <sup class="orange">NEW</sup></b></b>
2861 - Switch from the grid style of the FREE version to another gallery style. Right now, we provide a vertical (single column) and horizontal (single row) list style as alternatives to the grid, with more designs coming. These current alternatives were inspired by the standard YouTube playlist player's "table of contents," except our gallery's video lists are always visible and shown under the playing video.
2862 - <a target="_blank" href="<?php echo self::$epbase ?>/responsive-youtube-playlist-channel-gallery-for-wordpress.aspx">Read more here &raquo;</a>
2863 - </label>
3486 + Some features (such as galleries, and some wizard features) now require you to create a free YouTube API key from Google.
3487 + The instructions for this are very specific, so we created a video for you that's hopefully easy to follow: <a href="https://www.embedplus.com/how-to-create-a-youtube-api-key.aspx" target="_blank">Click this link</a> and follow the steps on the page. Then save your API key below.
2864 3488 </p>
3489 + <p>
3490 + <b class="chktitle">YouTube API Key:</b>
3491 + <input type="text" name="<?php echo self::$opt_apikey; ?>" id="<?php echo self::$opt_apikey; ?>" value="<?php echo esc_attr(trim($all[self::$opt_apikey])); ?>" class="textinput" style="width: 250px;">
3492 + </p>
3493 + </section>
2865 3494
2866 - <div class="hr"></div>
3495 + <section class="pattern" id="jumpdefaults">
3496 + <h2>
3497 + <?php _e("Default YouTube Options") ?>
3498 + </h2>
2867 3499 <p>
2868 - <img class="ssaltgallery" src="<?php echo plugins_url('images/ssverticallayout.png', __FILE__) ?>" />
2869 - <input name="<?php echo self::$opt_gallery_showdsc; ?>" id="<?php echo self::$opt_gallery_showdsc; ?>" <?php checked($all[self::$opt_gallery_showdsc], 1); ?> type="checkbox" class="checkbox">
2870 - <label for="<?php echo self::$opt_gallery_showdsc; ?>">
2871 - <b>(PRO)</b> <b class="chktitle">Show Gallery Descriptions (for vertical list styling): </b>
2872 - For the vertical list layout, this option will show full video descriptions (taken directly from YouTube.com) with each thumbnail. Note: these descriptions only apply the vertical list layout; other layouts don't have enough room.
2873 - </label>
3500 + <?php _e("One of the benefits of using this plugin is that you can set site-wide default options for all your videos (click \"Save Changes\" when finished). However, you can also override them (and more) on a per-video basis. Directions on how to do that are in the next tab.") ?>
2874 3501 </p>
2875 - <div class="hr"></div>
3502 +
3503 + <div class="ytindent chx">
3504 + <p>
3505 + <input name="<?php echo self::$opt_glance; ?>" id="<?php echo self::$opt_glance; ?>" <?php checked($all[self::$opt_glance], 1); ?> type="checkbox" class="checkbox">
3506 + <label for="<?php echo self::$opt_glance; ?>"><?php _e('<b class="chktitle">At a glance:</b> Show "At a Glance" Embed Links on the dashboard homepage.') ?></label>
3507 + </p>
3508 + <p>
3509 + <input name="<?php echo self::$opt_center; ?>" id="<?php echo self::$opt_center; ?>" <?php checked($all[self::$opt_center], 1); ?> type="checkbox" class="checkbox">
3510 + <label for="<?php echo self::$opt_center; ?>"><?php _e('<b class="chktitle">Centering:</b> Automatically center all your videos (not necessary if all your videos span the whole width of your blog).') ?></label>
3511 + </p>
3512 + <p>
3513 + <input name="<?php echo self::$opt_autoplay; ?>" id="<?php echo self::$opt_autoplay; ?>" <?php checked($all[self::$opt_autoplay], 1); ?> type="checkbox" class="checkbox">
3514 + <label for="<?php echo self::$opt_autoplay; ?>">
3515 + <?php _e('<b class="chktitle">Autoplay:</b> Automatically start playing your videos.') ?>
3516 + <strong>Note:</strong> If you're embedding videos from your own monetized YouTube channel, we advise you to read YouTube's resource page on ads on embedded videos:
3517 + <a href="https://support.google.com/youtube/answer/132596?hl=en" target="_blank">https://support.google.com/youtube/answer/132596?hl=en</a>
3518 + You'll see that videos that you want to monetize "should be embedded using the standard click-to-play embed and NOT a scripted play."
3519 + Unchecking this option guarantees standard click-to-play gallery embedding.
3520 + (Another Note: Desktop browsers like <a href="https://developers.google.com/youtube/iframe_api_reference#Mobile_considerations" target="_blank">Chrome and Safari are moving towards preventing autoplay for any video</a>. But, your chances are improved if you set your videos to initially start muted.)
3521 + </label>
3522 + </p>
3523 + <p>
3524 + <input name="<?php echo self::$opt_iv_load_policy; ?>" id="<?php echo self::$opt_iv_load_policy; ?>" <?php checked($all[self::$opt_iv_load_policy], 1); ?> type="checkbox" class="checkbox">
3525 + <label for="<?php echo self::$opt_iv_load_policy; ?>"><?php _e('<b class="chktitle">Annotations:</b> Show annotations by default.') ?></label>
3526 + </p>
3527 + <p>
3528 + <input name="<?php echo self::$opt_loop; ?>" id="<?php echo self::$opt_loop; ?>" <?php checked($all[self::$opt_loop], 1); ?> type="checkbox" class="checkbox">
3529 + <label for="<?php echo self::$opt_loop; ?>"><?php _e('<b class="chktitle">Looping:</b> Loop all your videos. Note: this feature is incompatible with the "hide related videos" feature.') ?></label>
3530 + </p>
3531 + <p>
3532 + <label>
3533 + <b class="chktitle">Related Videos:</b>
3534 + Show or hide related and recommended videos at the end of playback.
3535 + <br>
3536 + </label>
3537 + <input type="radio" name="<?php echo self::$opt_rel; ?>" id="<?php echo self::$opt_rel; ?>-1" value="-1" <?php checked($all[self::$opt_rel], -1); ?>>
3538 + <label for="<?php echo self::$opt_rel; ?>-1">Hide related videos at the end of playback</label> &nbsp;&nbsp;
3539 + <input type="radio" name="<?php echo self::$opt_rel; ?>" id="<?php echo self::$opt_rel; ?>0" value="0" <?php checked($all[self::$opt_rel], 0); ?>>
3540 + <label for="<?php echo self::$opt_rel; ?>0">Show related videos only from the video's channel</label> &nbsp;&nbsp;
3541 + <input type="radio" name="<?php echo self::$opt_rel; ?>" id="<?php echo self::$opt_rel; ?>1" value="1" <?php checked($all[self::$opt_rel], 1); ?>>
3542 + <label for="<?php echo self::$opt_rel; ?>1">Show related videos</label> &nbsp;&nbsp;
3543 + </p>
3544 + <p>
3545 + <input name="<?php echo self::$opt_fs; ?>" id="<?php echo self::$opt_fs; ?>" <?php checked($all[self::$opt_fs], 1); ?> type="checkbox" class="checkbox">
3546 + <label for="<?php echo self::$opt_fs; ?>"><?php _e('<b class="chktitle">Show Fullscreen Button:</b> Show the fullscreen button.') ?></label>
3547 + </p>
3548 + <p>
3549 + <input name="<?php echo self::$opt_acctitle; ?>" id="<?php echo self::$opt_acctitle; ?>" <?php checked($all[self::$opt_acctitle], 1); ?> type="checkbox" class="checkbox">
3550 + <label for="<?php echo self::$opt_acctitle; ?>"><b class="chktitle">Accessible Title Attributes: </b> Improve accessibility by using title attributes for screen reader support. It should help your site pass functional accessibility evaluations (FAE). </label>
3551 + </p>
3552 + <p>
3553 + <input name="<?php echo self::$opt_color; ?>" id="<?php echo self::$opt_color; ?>" <?php checked($all[self::$opt_color], 'red'); ?> type="checkbox" class="checkbox">
3554 + <label for="<?php echo self::$opt_color; ?>"><?php _e('<b class="chktitle">Red Progress Bar:</b> Use the red progress bar (uncheck to use a white progress bar).') ?></label>
3555 + </p>
3556 + <p>
3557 + <input name="<?php echo self::$opt_defaultdims; ?>" id="<?php echo self::$opt_defaultdims; ?>" <?php checked($all[self::$opt_defaultdims], 1); ?> type="checkbox" class="checkbox">
3558 + <span id="boxdefaultdims">
3559 + Width: <input type="number" min="200" name="<?php echo self::$opt_defaultwidth; ?>" id="<?php echo self::$opt_defaultwidth; ?>" value="<?php echo esc_attr(trim($all[self::$opt_defaultwidth])); ?>" class="textinput" style="width: 75px;"> &nbsp;
3560 + Height: <input type="number" min="200" name="<?php echo self::$opt_defaultheight; ?>" id="<?php echo self::$opt_defaultheight; ?>" value="<?php echo esc_attr(trim($all[self::$opt_defaultheight])); ?>" class="textinput" style="width: 75px;">
3561 + </span>
3562 +
3563 + <label for="<?php echo self::$opt_defaultdims; ?>"><?php _e('<b class="chktitle">Default Dimensions:</b> Make your videos have a default size, for better loading performance and consistency. Recommended: 800 x 450 (NOTE: If responsive sizing is also turned on, your videos will be responsive but also keep this aspect ratio.). Also, according to YouTube guidelines, the player must be a minimum of 200 x 200 (or recommended 480 x 270 for 16:9 ratio players) in order to display correctly.') ?></label>
3564 + </p>
3565 + <p>
3566 + <input name="<?php echo self::$opt_responsive; ?>" id="<?php echo self::$opt_responsive; ?>" <?php checked($all[self::$opt_responsive], 1); ?> type="checkbox" class="checkbox">
3567 + <label for="<?php echo self::$opt_responsive; ?>"><?php _e('<b class="chktitle">Responsive Video Sizing:</b> Make your videos responsive so that they dynamically fit in all screen sizes (smart phone, PC and tablet). NOTE: While this is checked, any custom hardcoded widths and heights you may have set will dynamically change too. <b>Uncheck this if your theme already properly handles responsive video sizing.</b>') ?></label>
3568 + <div id="boxresponsive_all">
3569 + <input type="radio" name="<?php echo self::$opt_responsive_all; ?>" id="<?php echo self::$opt_responsive_all; ?>1" value="1" <?php checked($all[self::$opt_responsive_all], 1); ?> >
3570 + <label for="<?php echo self::$opt_responsive_all; ?>1">Responsive for all YouTube videos</label> &nbsp;&nbsp;
3571 + <input type="radio" name="<?php echo self::$opt_responsive_all; ?>" id="<?php echo self::$opt_responsive_all; ?>0" value="0" <?php checked($all[self::$opt_responsive_all], 0); ?> >
3572 + <label for="<?php echo self::$opt_responsive_all; ?>0">Responsive for only videos embedded via this plugin</label>
3573 + </div>
3574 + </p>
3575 + <p>
3576 + <input name="<?php echo self::$opt_widgetfit; ?>" id="<?php echo self::$opt_widgetfit; ?>" <?php checked($all[self::$opt_widgetfit], 1); ?> type="checkbox" class="checkbox">
3577 + <label for="<?php echo self::$opt_widgetfit; ?>"><?php _e('<b class="chktitle">Autofit Widget Videos:</b> Make each video that you embed in a widget area automatically fit the width of its container.') ?></label>
3578 + </p>
3579 + <p>
3580 + <input name="<?php echo self::$opt_playsinline; ?>" id="<?php echo self::$opt_playsinline; ?>" <?php checked($all[self::$opt_playsinline], 1); ?> type="checkbox" class="checkbox">
3581 + <label for="<?php echo self::$opt_playsinline; ?>">
3582 + <b class="chktitle">iOS Playback:</b> Check this to allow your embeds to play inline within your page when viewed on iOS (iPhone and iPad) browsers. Uncheck it to have iOS launch your embeds in fullscreen instead.
3583 + <em>Disclaimer: YouTube/Google has issues with this iOS related parameter, but we are providing it here in the event that they support it consistently.</em>
3584 + </label>
3585 + </p>
3586 + <p>
3587 + <input name="<?php echo self::$opt_controls; ?>" id="<?php echo self::$opt_controls; ?>" <?php checked($all[self::$opt_controls], 1); ?> type="checkbox" class="checkbox">
3588 + <label for="<?php echo self::$opt_controls; ?>"><b class="chktitle">Show Controls:</b> Show the player's control bar. Unchecking this option creates a cleaner look but limits what your viewers can control (play position, volume, etc.).</label>
3589 + </p>
3590 + <p>
3591 + <input name="<?php echo self::$opt_disablekb; ?>" id="<?php echo self::$opt_disablekb; ?>" <?php checked($all[self::$opt_disablekb], 1); ?> type="checkbox" class="checkbox">
3592 + <label for="<?php echo self::$opt_disablekb; ?>"><b class="chktitle">Disable Keyboard Controls:</b> Prevent users from using keyboard controls (spacebar to play/pause, arrow keys to seek, etc.).</label>
3593 + </p>
3594 + <p>
3595 + <input name="<?php echo self::$opt_defaultvol; ?>" id="<?php echo self::$opt_defaultvol; ?>" <?php checked($all[self::$opt_defaultvol], 1); ?> type="checkbox" class="checkbox">
3596 + <label for="<?php echo self::$opt_defaultvol; ?>">
3597 + <b class="chktitle">Volume Initialization: </b>
3598 + Set an initial volume level for all of your embedded videos. Check this and you'll see a <span class="vol-seeslider">slider</span> <span class="vol-seetextbox">textbox</span> for setting the start volume to a value between 0 (mute) and 100 (max) percent. Leaving it unchecked means you want the visitor's default behavior. This feature is experimental and is less predictable on a page with more than one embed. Read more about why you might want to <a href="<?php echo self::$epbase ?>/mute-volume-youtube-wordpress.aspx" target="_blank">initialize YouTube embed volume here &raquo;</a>
3599 + </label>
3600 + <span id="boxdefaultvol">
3601 + Volume: <span class="vol-output"></span> <input min="0" max="100" step="1" type="text" name="<?php echo self::$opt_vol; ?>" id="<?php echo self::$opt_vol; ?>" value="<?php echo esc_attr(trim($all[self::$opt_vol])); ?>" >
3602 + </span>
3603 + </p>
3604 +
3605 + <p>
3606 + <input name="<?php echo self::$opt_pause_others; ?>" id="<?php echo self::$opt_pause_others; ?>" <?php checked($all[self::$opt_pause_others], 1); ?> type="checkbox" class="checkbox">
3607 + <label for="<?php echo self::$opt_pause_others; ?>">
3608 + <b class="chktitle"><?php _e('Simultaneous Playback Control:', 'youtube-embed-plus'); ?></b>
3609 + <?php _e('You can enable/disable the ability for visitors to have separate videos running at the same time on the same page. Check this to automatically pause other players while the current player is playing. (Note: this feature is not guaranteed to work with videos embedded from other plugins).', 'youtube-embed-plus'); ?>
3610 + </label>
3611 + </p>
3612 +
3613 + <p>
3614 + <input name="<?php echo self::$opt_cc_load_policy; ?>" id="<?php echo self::$opt_cc_load_policy; ?>" <?php checked($all[self::$opt_cc_load_policy], 1); ?> type="checkbox" class="checkbox">
3615 + <label for="<?php echo self::$opt_cc_load_policy; ?>"><?php _e('<b class="chktitle">Closed Captions:</b> Turn on closed captions by default.') ?></label>
3616 + </p>
3617 + <?php
3618 + $lang_codes = [
3619 + ["Abkhazian", "аҧсуа бызшәа, аҧсшәа", "ab", "abk", "abk"],
3620 + ["Afar", "Afaraf", "aa", "aar", "aar"],
3621 + ["Afrikaans", "Afrikaans", "af", "afr", "afr"],
3622 + ["Akan", "Akan", "ak", "aka", "aka"],
3623 + ["Albanian", "Shqip", "sq", "sqi", "alb"],
3624 + ["Amharic", "አማርኛ", "am", "amh", "amh"],
3625 + ["Arabic", "العربية", "ar", "ara", "ara"],
3626 + ["Aragonese", "aragonés", "an", "arg", "arg"],
3627 + ["Armenian", "Հայերեն", "hy", "hye", "arm"],
3628 + ["Assamese", "অসমীয়া", "as", "asm", "asm"],
3629 + ["Avaric", "авар мацӀ, магӀарул мацӀ", "av", "ava", "ava"],
3630 + ["Avestan", "avesta", "ae", "ave", "ave"],
3631 + ["Aymara", "aymar aru", "ay", "aym", "aym"],
3632 + ["Azerbaijani", "azərbaycan dili", "az", "aze", "aze"],
3633 + ["Bambara", "bamanankan", "bm", "bam", "bam"],
3634 + ["Bashkir", "башҡорт теле", "ba", "bak", "bak"],
3635 + ["Basque", "euskara, euskera", "eu", "eus", "baq"],
3636 + ["Belarusian", "беларуская мова", "be", "bel", "bel"],
3637 + ["Bengali", "বাংলা", "bn", "ben", "ben"],
3638 + ["Bihari languages", "भोजपुरी", "bh", "bih", "bih"],
3639 + ["Bislama", "Bislama", "bi", "bis", "bis"],
3640 + ["Bosnian", "bosanski jezik", "bs", "bos", "bos"],
3641 + ["Breton", "brezhoneg", "br", "bre", "bre"],
3642 + ["Bulgarian", "български език", "bg", "bul", "bul"],
3643 + ["Burmese", "ဗမာစာ", "my", "mya", "bur"],
3644 + ["Catalan, Valencian", "català, valencià", "ca", "cat", "cat"],
3645 + ["Chamorro", "Chamoru", "ch", "cha", "cha"],
3646 + ["Chechen", "нохчийн мотт", "ce", "che", "che"],
3647 + ["Chichewa, Chewa, Nyanja", "chiCheŵa, chinyanja", "ny", "nya", "nya"],
3648 + ["Chinese", "中文 (Zhōngwén), 汉语, 漢語", "zh", "zho", "chi"],
3649 + ["Chuvash", "чӑваш чӗлхи", "cv", "chv", "chv"],
3650 + ["Cornish", "Kernewek", "kw", "cor", "cor"],
3651 + ["Corsican", "corsu, lingua corsa", "co", "cos", "cos"],
3652 + ["Cree", "ᓀᐦᐃᔭᐍᐏᐣ", "cr", "cre", "cre"],
3653 + ["Croatian", "hrvatski jezik", "hr", "hrv", "hrv"],
3654 + ["Czech", "čeština, český jazyk", "cs", "ces", "cze"],
3655 + ["Danish", "dansk", "da", "dan", "dan"],
3656 + ["Divehi, Dhivehi, Maldivian", "ދިވެހި", "dv", "div", "div"],
3657 + ["Dutch, Flemish", "Nederlands, Vlaams", "nl", "nld", "dut"],
3658 + ["Dzongkha", "རྫོང་ཁ", "dz", "dzo", "dzo"],
3659 + ["English", "English", "en", "eng", "eng"],
3660 + ["Esperanto", "Esperanto", "eo", "epo", "epo"],
3661 + ["Estonian", "eesti, eesti keel", "et", "est", "est"],
3662 + ["Ewe", "Eʋegbe", "ee", "ewe", "ewe"],
3663 + ["Faroese", "føroyskt", "fo", "fao", "fao"],
3664 + ["Fijian", "vosa Vakaviti", "fj", "fij", "fij"],
3665 + ["Finnish", "suomi, suomen kieli", "fi", "fin", "fin"],
3666 + ["French", "français, langue française", "fr", "fra", "fre"],
3667 + ["Fulah", "Fulfulde, Pulaar, Pular", "ff", "ful", "ful"],
3668 + ["Galician", "Galego", "gl", "glg", "glg"],
3669 + ["Georgian", "ქართული", "ka", "kat", "geo"],
3670 + ["German", "Deutsch", "de", "deu", "ger"],
3671 + ["Greek, Modern (1453–)", "ελληνικά", "el", "ell", "gre"],
3672 + ["Guarani", "Avañe'ẽ", "gn", "grn", "grn"],
3673 + ["Gujarati", "ગુજરાતી", "gu", "guj", "guj"],
3674 + ["Haitian, Haitian Creole", "Kreyòl ayisyen", "ht", "hat", "hat"],
3675 + ["Hausa", "(Hausa) هَوُسَ", "ha", "hau", "hau"],
3676 + ["Hebrew", "עברית", "he", "heb", "heb"],
3677 + ["Herero", "Otjiherero", "hz", "her", "her"],
3678 + ["Hindi", "हिन्दी, हिंदी", "hi", "hin", "hin"],
3679 + ["Hiri Motu", "Hiri Motu", "ho", "hmo", "hmo"],
3680 + ["Hungarian", "magyar", "hu", "hun", "hun"],
3681 + ["Interlingua (International Auxiliary Language Association)", "Interlingua", "ia", "ina", "ina"],
3682 + ["Indonesian", "Bahasa Indonesia", "id", "ind", "ind"],
3683 + ["Interlingue, Occidental", "(originally:) Occidental, (after WWII:) Interlingue", "ie", "ile", "ile"],
3684 + ["Irish", "Gaeilge", "ga", "gle", "gle"],
3685 + ["Igbo", "Asụsụ Igbo", "ig", "ibo", "ibo"],
3686 + ["Inupiaq", "Iñupiaq, Iñupiatun", "ik", "ipk", "ipk"],
3687 + ["Ido", "Ido", "io", "ido", "ido"],
3688 + ["Icelandic", "Íslenska", "is", "isl", "ice"],
3689 + ["Italian", "Italiano", "it", "ita", "ita"],
3690 + ["Inuktitut", "ᐃᓄᒃᑎᑐᑦ", "iu", "iku", "iku"],
3691 + ["Japanese", "日本語 (にほんご)", "ja", "jpn", "jpn"],
3692 + ["Javanese", "ꦧꦱꦗꦮ, Basa Jawa", "jv", "jav", "jav"],
3693 + ["Kalaallisut, Greenlandic", "kalaallisut, kalaallit oqaasii", "kl", "kal", "kal"],
3694 + ["Kannada", "ಕನ್ನಡ", "kn", "kan", "kan"],
3695 + ["Kanuri", "Kanuri", "kr", "kau", "kau"],
3696 + ["Kashmiri", "कश्मीरी, كشميري‎", "ks", "kas", "kas"],
3697 + ["Kazakh", "қазақ тілі", "kk", "kaz", "kaz"],
3698 + ["Central Khmer", "ខ្មែរ, ខេមរភាសា, ភាសាខ្មែរ", "km", "khm", "khm"],
3699 + ["Kikuyu, Gikuyu", "Gĩkũyũ", "ki", "kik", "kik"],
3700 + ["Kinyarwanda", "Ikinyarwanda", "rw", "kin", "kin"],
3701 + ["Kirghiz, Kyrgyz", "Кыргызча, Кыргыз тили", "ky", "kir", "kir"],
3702 + ["Komi", "коми кыв", "kv", "kom", "kom"],
3703 + ["Kongo", "Kikongo", "kg", "kon", "kon"],
3704 + ["Korean", "한국어", "ko", "kor", "kor"],
3705 + ["Kurdish", "Kurdî, کوردی‎", "ku", "kur", "kur"],
3706 + ["Kuanyama, Kwanyama", "Kuanyama", "kj", "kua", "kua"],
3707 + ["Latin", "latine, lingua latina", "la", "lat", "lat"],
3708 + ["Luxembourgish, Letzeburgesch", "Lëtzebuergesch", "lb", "ltz", "ltz"],
3709 + ["Ganda", "Luganda", "lg", "lug", "lug"],
3710 + ["Limburgan, Limburger, Limburgish", "Limburgs", "li", "lim", "lim"],
3711 + ["Lingala", "Lingála", "ln", "lin", "lin"],
3712 + ["Lao", "ພາສາລາວ", "lo", "lao", "lao"],
3713 + ["Lithuanian", "lietuvių kalba", "lt", "lit", "lit"],
3714 + ["Luba-Katanga", "Kiluba", "lu", "lub", "lub"],
3715 + ["Latvian", "latviešu valoda", "lv", "lav", "lav"],
3716 + ["Manx", "Gaelg, Gailck", "gv", "glv", "glv"],
3717 + ["Macedonian", "македонски јазик", "mk", "mkd", "mac"],
3718 + ["Malagasy", "fiteny malagasy", "mg", "mlg", "mlg"],
3719 + ["Malay", "Bahasa Melayu, بهاس ملايو‎", "ms", "msa", "may"],
3720 + ["Malayalam", "മലയാളം", "ml", "mal", "mal"],
3721 + ["Maltese", "Malti", "mt", "mlt", "mlt"],
3722 + ["Maori", "te reo Māori", "mi", "mri", "mao"],
3723 + ["Marathi", "मराठी", "mr", "mar", "mar"],
3724 + ["Marshallese", "Kajin M̧ajeļ", "mh", "mah", "mah"],
3725 + ["Mongolian", "Монгол хэл", "mn", "mon", "mon"],
3726 + ["Nauru", "Dorerin Naoero", "na", "nau", "nau"],
3727 + ["Navajo, Navaho", "Diné bizaad", "nv", "nav", "nav"],
3728 + ["North Ndebele", "isiNdebele", "nd", "nde", "nde"],
3729 + ["Nepali", "नेपाली", "ne", "nep", "nep"],
3730 + ["Ndonga", "Owambo", "ng", "ndo", "ndo"],
3731 + ["Norwegian Bokmål", "Norsk Bokmål", "nb", "nob", "nob"],
3732 + ["Norwegian Nynorsk", "Norsk Nynorsk", "nn", "nno", "nno"],
3733 + ["Norwegian", "Norsk", "no", "nor", "nor"],
3734 + ["Sichuan Yi, Nuosu", "ꆈꌠ꒿ Nuosuhxop", "ii", "iii", "iii"],
3735 + ["South Ndebele", "isiNdebele", "nr", "nbl", "nbl"],
3736 + ["Occitan", "occitan, lenga d'òc", "oc", "oci", "oci"],
3737 + ["Ojibwa", "ᐊᓂᔑᓈᐯᒧᐎᓐ", "oj", "oji", "oji"],
3738 + ["Church Slavic, Old Slavonic, Church Slavonic, Old Bulgarian, Old Church Slavonic", "ѩзыкъ словѣньскъ", "cu", "chu", "chu"],
3739 + ["Oromo", "Afaan Oromoo", "om", "orm", "orm"],
3740 + ["Oriya", "ଓଡ଼ିଆ", "or", "ori", "ori"],
3741 + ["Ossetian, Ossetic", "ирон æвзаг", "os", "oss", "oss"],
3742 + ["Punjabi, Panjabi", "ਪੰਜਾਬੀ, پنجابی‎", "pa", "pan", "pan"],
3743 + ["Pali", "पालि, पाळि", "pi", "pli", "pli"],
3744 + ["Persian", "فارسی", "fa", "fas", "per"],
3745 + ["Polish", "język polski, polszczyzna", "pl", "pol", "pol"],
3746 + ["Pashto, Pushto", "پښتو", "ps", "pus", "pus"],
3747 + ["Portuguese", "Português", "pt", "por", "por"],
3748 + ["Quechua", "Runa Simi, Kichwa", "qu", "que", "que"],
3749 + ["Romansh", "Rumantsch Grischun", "rm", "roh", "roh"],
3750 + ["Rundi", "Ikirundi", "rn", "run", "run"],
3751 + ["Romanian, Moldavian, Moldovan", "Română", "ro", "ron", "rum"],
3752 + ["Russian", "русский", "ru", "rus", "rus"],
3753 + ["Sanskrit", "संस्कृतम्", "sa", "san", "san"],
3754 + ["Sardinian", "sardu", "sc", "srd", "srd"],
3755 + ["Sindhi", "सिन्धी, سنڌي، سندھی‎", "sd", "snd", "snd"],
3756 + ["Northern Sami", "Davvisámegiella", "se", "sme", "sme"],
3757 + ["Samoan", "gagana fa'a Samoa", "sm", "smo", "smo"],
3758 + ["Sango", "yângâ tî sängö", "sg", "sag", "sag"],
3759 + ["Serbian", "српски језик", "sr", "srp", "srp"],
3760 + ["Gaelic, Scottish Gaelic", "Gàidhlig", "gd", "gla", "gla"],
3761 + ["Shona", "chiShona", "sn", "sna", "sna"],
3762 + ["Sinhala, Sinhalese", "සිංහල", "si", "sin", "sin"],
3763 + ["Slovak", "Slovenčina, Slovenský Jazyk", "sk", "slk", "slo"],
3764 + ["Slovenian", "Slovenski Jezik, Slovenščina", "sl", "slv", "slv"],
3765 + ["Somali", "Soomaaliga, af Soomaali", "so", "som", "som"],
3766 + ["Southern Sotho", "Sesotho", "st", "sot", "sot"],
3767 + ["Spanish, Castilian", "Español", "es", "spa", "spa"],
3768 + ["Sundanese", "Basa Sunda", "su", "sun", "sun"],
3769 + ["Swahili", "Kiswahili", "sw", "swa", "swa"],
3770 + ["Swati", "SiSwati", "ss", "ssw", "ssw"],
3771 + ["Swedish", "Svenska", "sv", "swe", "swe"],
3772 + ["Tamil", "தமிழ்", "ta", "tam", "tam"],
3773 + ["Telugu", "తెలుగు", "te", "tel", "tel"],
3774 + ["Tajik", "тоҷикӣ, toçikī, تاجیکی‎", "tg", "tgk", "tgk"],
3775 + ["Thai", "ไทย", "th", "tha", "tha"],
3776 + ["Tigrinya", "ትግርኛ", "ti", "tir", "tir"],
3777 + ["Tibetan", "བོད་ཡིག", "bo", "bod", "tib"],
3778 + ["Turkmen", "Türkmen, Түркмен", "tk", "tuk", "tuk"],
3779 + ["Tagalog", "Wikang Tagalog", "tl", "tgl", "tgl"],
3780 + ["Tswana", "Setswana", "tn", "tsn", "tsn"],
3781 + ["Tonga (Tonga Islands)", "Faka Tonga", "to", "ton", "ton"],
3782 + ["Turkish", "Türkçe", "tr", "tur", "tur"],
3783 + ["Tsonga", "Xitsonga", "ts", "tso", "tso"],
3784 + ["Tatar", "татар теле, tatar tele", "tt", "tat", "tat"],
3785 + ["Twi", "Twi", "tw", "twi", "twi"],
3786 + ["Tahitian", "Reo Tahiti", "ty", "tah", "tah"],
3787 + ["Uighur, Uyghur", "ئۇيغۇرچە‎, Uyghurche", "ug", "uig", "uig"],
3788 + ["Ukrainian", "Українська", "uk", "ukr", "ukr"],
3789 + ["Urdu", "اردو", "ur", "urd", "urd"],
3790 + ["Uzbek", "Oʻzbek, Ўзбек, أۇزبېك‎", "uz", "uzb", "uzb"],
3791 + ["Venda", "Tshivenḓa", "ve", "ven", "ven"],
3792 + ["Vietnamese", "Tiếng Việt", "vi", "vie", "vie"],
3793 + ["Volapük", "Volapük", "vo", "vol", "vol"],
3794 + ["Walloon", "Walon", "wa", "wln", "wln"],
3795 + ["Welsh", "Cymraeg", "cy", "cym", "wel"],
3796 + ["Wolof", "Wollof", "wo", "wol", "wol"],
3797 + ["Western Frisian", "Frysk", "fy", "fry", "fry"],
3798 + ["Xhosa", "isiXhosa", "xh", "xho", "xho"],
3799 + ["Yiddish", "ייִדיש", "yi", "yid", "yid"],
3800 + ["Yoruba", "Yorùbá", "yo", "yor", "yor"],
3801 + ["Zhuang, Chuang", "Saɯ cueŋƅ, Saw cuengh", "za", "zha", "zha"],
3802 + ["Zulu", "isiZulu", "zu", "zul", "zul"]
3803 + ];
3804 +
3805 + $selected_val = trim($all[self::$opt_cc_lang_pref]);
3806 + ?>
3807 + <p>
3808 + <label for="<?php echo self::$opt_cc_lang_pref; ?>"><b class="chktitle">Closed Captions Language:</b></label>
3809 + <select name="<?php echo self::$opt_cc_lang_pref; ?>" id="<?php echo self::$opt_cc_lang_pref; ?>" style="width: 260px;">
3810 + <option <?php echo '' == $selected_val ? 'selected' : '' ?> value="">Default/Unspecified</option>
3811 + <?php
3812 + foreach ($lang_codes as $idx => $lang_row)
3813 + {
3814 + $iso_code = $lang_row[2];
3815 + $iso_label = $lang_row[0] . ' - ' . $lang_row[1];
3816 + ?>
3817 + <option <?php echo $iso_code == $selected_val ? 'selected' : '' ?> value="<?php echo $iso_code ?>"><?php echo $iso_label ?></option>
3818 + <?php
3819 + }
3820 + ?>
3821 + </select>
3822 + Select the preferred default language for closed captions (when available).
3823 + </p>
3824 + <p>
3825 + <input name="<?php echo self::$opt_dohl; ?>" id="<?php echo self::$opt_dohl; ?>" <?php checked($all[self::$opt_dohl], 1); ?> type="checkbox" class="checkbox">
3826 + <label for="<?php echo self::$opt_dohl; ?>"><b class="chktitle">Player Localization / Internationalization: </b>
3827 + Automatically detect your site's default language (using get_locale) and set your YouTube embeds interface language so that it matches. Specifically, this will set the player's tooltips and caption track if your language is natively supported by YouTube. We suggest checking this if English is not your site's default language. <a href="<?php echo self::$epbase ?>/youtube-iso-639-1-language-codes.aspx" target="_blank">See here for more details &raquo;</a></label>
3828 + </p>
3829 + <p>
3830 + <input name="<?php echo self::$opt_playlistorder; ?>" id="<?php echo self::$opt_playlistorder; ?>" <?php checked($all[self::$opt_playlistorder], 1); ?> type="checkbox" class="checkbox">
3831 + <label for="<?php echo self::$opt_playlistorder; ?>">
3832 + <b class="chktitle">Self-contained Playlist Ordering:</b>
3833 + Note: This option does <strong class="orange">NOT</strong> apply to galleries. It applies only to these kinds of <em>self-contained playlists</em> (Example: <a target="_blank" href="https://www.youtube.com/watch?v=J50PlRZHH9I&t=3m20s">https://www.youtube.com/watch?v=J50PlRZHH9I&t=3m20s</a>).
3834 + If you're trying to control the order of a <em>gallery</em> instead, then you must be the owner of the playlist, go to YouTube.com, and reorder it there. This plugin can only order a <em>gallery</em> the way the owner ordered the source playlist.
3835 + Check this option if you just want your <em>self-contained playlists</em> to begin with the latest added video by default. (Unchecking this will force playlists to always start with your selected specific video, even if you add videos to the playlist later).
3836 + </label>
3837 + </p>
3838 + <p>
3839 + <input name="<?php echo self::$opt_onboarded; ?>" id="<?php echo self::$opt_onboarded; ?>" <?php checked($all[self::$opt_onboarded], 1); ?> type="checkbox" class="checkbox">
3840 + <label for="<?php echo self::$opt_onboarded; ?>">
3841 + <b class="chktitle">Hide Quick Setup Guide:</b>
3842 + Check this to hide the installation setup wizard when this page loads.
3843 + </label>
3844 + </p>
3845 + <p>
3846 + <input name="<?php echo self::$opt_show_pointer; ?>" id="<?php echo self::$opt_show_pointer; ?>" <?php checked($all[self::$opt_show_pointer], 1); ?> type="checkbox" class="checkbox">
3847 + <label for="<?php echo self::$opt_show_pointer; ?>">
3848 + <b class="chktitle">Show New Feature Notice:</b>
3849 + Show admin notice of new plugin features after updates.
3850 + </label>
3851 + </p>
3852 + <div id="not_live_content_scroll" class="p">
3853 + <p>
3854 + <b class="chktitle">Use "Not Live" Fallback Content For Live Streams:</b> (<a href="<?php echo self::$epbase ?>/how-to-embed-a-youtube-livestream-in-wordpress.aspx" target="_blank">More info here</a>)
3855 + This feature lets you display alternate content if your live stream is not currently active. This feature works for <strong>direct link</strong> live streams
3856 + (more info about channel-based live streams below).
3857 + </p>
3858 + <div class="ytindent chx">
3859 + <input name="<?php echo self::$opt_not_live_on; ?>" id="<?php echo self::$opt_not_live_on; ?>" <?php checked($all[self::$opt_not_live_on], 1); ?> type="checkbox" class="checkbox">
3860 + <label for="<?php echo self::$opt_not_live_on; ?>"><span class="chktitle">Turn on for <b>direct link</b> live streams:</span>
3861 + When your direct-link embed is not streaming live, the YouTube live player usually displays a countdown after the user clicks the play button.
3862 + Instead of showing that player, you can display some "coming soon" content in that space for your visitors to see until your video begins to live stream.
3863 + The plugin will automatically switch to your video's live stream once it's active. In the <em>"Not Live" Fallback Content</em> box below, enter what you would like to appear until then.
3864 + You can even insert shortcodes from our plugin into the box below (shortcodes from other plugins may or may not work correctly).
3865 + If you just want to show the standard countdown player that YouTube provides, don't use this feature.
3866 + <strong>NOTE: Turning this on for direct-link live streams uses a significant amount of your YouTube API quota. We suggest unchecking it if your site has high traffic. If you chose to use this feature, do <u>not</u> put another live stream embed below.</strong>
3867 + </label>
3868 + <br>
3869 + <br>
3870 + <input disabled id="<?php echo self::$opt_not_live_on_channel; ?>" type="checkbox" class="checkbox">
3871 + <label><span class="chktitle">Turn on for <b>channel</b> live streams: <sup class="orange">upgrade required</sup></span>
3872 + Unfortunately, Google has recently removed their YouTube API feature that used to support channel-based live streams. It appears they won't change things back. However, you do have a couple of choices:
3873 + <ol>
3874 + <li>Use "Direct link" live streams, as explained above. The trade-off is that you will have to manually post and take down your future live streams every time they start and when they end, respectively.</li>
3875 + <li>Or <a href="<?php echo self::$epbase ?>/dashboard/pro-easy-video-analytics.aspx" target="_blank">upgrade to Pro</a>, which has a solution that brings back all the "set it and forget it" features of channel-based embeds. We spent a significant amount of time developing a stable, long-term solution around YouTube's limitations, so we are releasing this effort exclusively to our Pro customers.</li>
3876 + </ol>
3877 + </label>
3878 + <div class="p not-live-content">
3879 + <p>
3880 + <b>"Not Live" Fallback Content:</b>
3881 + </p>
3882 + <?php
3883 + wp_editor(wp_kses_post($all[self::$opt_not_live_content]), self::$opt_not_live_content, array('textarea_rows' => 7));
3884 + ?>
3885 + </div>
3886 + </div>
3887 + </div>
3888 + </div>
3889 + </section>
3890 + <section class="pattern" id="jumpprivacy">
3891 + <h2>Security Options</h2>
2876 3892 <p>
2877 - <img class="ssaltgallery" src="<?php echo plugins_url('images/ssaltgallerycircles.jpg', __FILE__) ?>" />
2878 - <?php $cleancrop = trim($all[self::$opt_gallery_thumbcrop]); ?>
2879 - <select name="<?php echo self::$opt_gallery_thumbcrop; ?>" id="<?php echo self::$opt_gallery_thumbcrop; ?>" >
2880 - <option value="">Thumbnail Shape</option>
2881 - <option value="box" <?php echo 'box' === $cleancrop ? 'selected' : '' ?> >Rectangle (default)</option>
2882 - <option value="portal" <?php echo 'portal' === $cleancrop ? 'selected' : '' ?> >Circular</option>
2883 - </select>
2884 - <label for="<?php echo self::$opt_gallery_thumbcrop; ?>">
2885 - <b>(PRO)</b> <b class="chktitle">Gallery Thumbnail Shape: <sup class="orange">NEW</sup></b></b>
2886 - Differentiate your gallery by showing different thumbnail shapes. We currently offer rectangle and circle shapes.
3893 + <input name="<?php echo self::$opt_restrict_wizard; ?>" id="<?php echo self::$opt_restrict_wizard; ?>" <?php checked($all[self::$opt_restrict_wizard], 1); ?> type="checkbox" class="checkbox">
3894 + <label for="<?php echo self::$opt_restrict_wizard; ?>">
3895 + <b class="chktitle">Restrict Wizard Button:</b> Select which roles can use the EmbedPlus for YouTube wizard button. For example, you may wish to hide the button from contributors submitting content on the front end.
2887 3896 </label>
3897 + <br>
3898 + <span id="box_restrict_wizard" class="chx">
3899 + <?php
3900 + foreach (self::$dft_roles as $idx => $role)
3901 + {
3902 + ?>
3903 + <label>
3904 + <input type="checkbox" name="<?php echo self::$opt_restrict_wizard_roles . '[]' ?>" value="<?php echo esc_attr($role) ?>" <?php echo in_array($role, $all[self::$opt_restrict_wizard_roles]) ? 'checked' : '' ?>>
3905 + <?php echo esc_html(ucfirst($role)); ?>s
3906 + </label>
3907 + <?php
3908 + }
3909 + ?>
3910 + </span>
2888 3911 </p>
2889 - <div class="hr"></div>
2890 -
2891 3912 <p>
2892 - <input name="<?php echo self::$opt_spdc; ?>" id="<?php echo self::$opt_spdc; ?>" <?php checked($all[self::$opt_spdc], 1); ?> type="checkbox" class="checkbox">
2893 - <label for="<?php echo self::$opt_spdc; ?>">
2894 - <b>(PRO)</b> <b class="chktitle">Faster Page Loads (Caching): </b>
2895 - Use embed caching to speed up your page loads. By default, WordPress needs to request information from YouTube.com's servers for every video you embed, every time a page is loaded. These data requests can add time to your total page load time. Turn on this feature to cache that data (instead of having to request for the same information every time you load a page). This should then make your pages that have videos load faster. It's been noted that even small speed ups in page load can help increase visitor engagement, retention, and conversions. Caching also makes galleries run faster.
3913 + <input name="<?php echo self::$opt_origin; ?>" id="<?php echo self::$opt_origin; ?>" <?php checked($all[self::$opt_origin], 1); ?> type="checkbox" class="checkbox">
3914 + <label for="<?php echo self::$opt_origin; ?>"><b class="chktitle">Extra Player Security: </b>
3915 + Add 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).
2896 3916 </label>
2897 - <div class="indent-option">
2898 - <div id="boxspdc">
2899 - <label>
2900 - <b class="chktitle">Cache Liftime (hours): </b>
2901 - <input name="<?php echo self::$opt_spdcexp; ?>" id="<?php echo self::$opt_spdcexp; ?>" value="<?php echo trim($all[self::$opt_spdcexp]); ?>" type="number" min="1"/>
3917 + </p>
3918 +
3919 + <h2>Privacy Options</h2>
3920 + <p>These options may help with privacy restrictions such as GDPR and the EU Cookie Law.</p>
3921 + <div class="ytindent chx">
3922 + <p>
3923 + <b class="chktitle">YouTube API Loading:</b> Choose when to load the YouTube API. The "Restricted" or "Never" options will help with GDPR compliance:
3924 + <ul class="indent-option">
3925 + <li><label><input type="radio" name="<?php echo self::$opt_ytapi_load ?>" value="light" <?php checked($all[self::$opt_ytapi_load], 'light'); ?> /> <em>Restricted</em> - (Recommended) Only load the API on pages that have a YouTube video.</label></li>
3926 + <li><label>
3927 + <input type="radio" name="<?php echo self::$opt_ytapi_load ?>" value="never" <?php checked($all[self::$opt_ytapi_load], 'never'); ?> /> <em>Never</em> - Do not load the YouTube API. Note: The "Never" choice may break a few features such as Volume Initialization and Gallery Continuous/Auto Play.
3928 + <div id="boxapinever">
3929 + Note: Checking this option may break some features such as the ones listed below:
3930 + <ul class="list-ul">
3931 + <li>Galleries</li>
3932 + <li>Hide related videos at the end of playback</li>
3933 + <li>Volume initialization</li>
3934 + <li>Simultaneous playback control</li>
3935 + <li>Playing video on mobile devices</li>
3936 + </ul>
3937 + </div>
3938 + </label></li>
3939 + <li><label><input type="radio" name="<?php echo self::$opt_ytapi_load ?>" value="always" <?php checked($all[self::$opt_ytapi_load], 'always'); ?> /> <em>Always</em> - Load the API on all pages. In most cases, the "Always" choice is not necessary.</label></li>
3940 + </ul>
3941 + </p>
3942 +
3943 +
3944 + <p>
3945 + <input name="<?php echo self::$opt_gdpr_consent; ?>" id="<?php echo self::$opt_gdpr_consent; ?>" <?php checked($all[self::$opt_gdpr_consent], 1); ?> type="checkbox" class="checkbox">
3946 + <label for="<?php echo self::$opt_gdpr_consent; ?>">
3947 + <b class="chktitle">Privacy/GDPR - Show Consent Message:</b> Ask for consent before loading YouTube content. A message will be displayed in place of the YouTube video, as shown in the screenshot below. Once the visitor approves consent, the YouTube content will load. You can customize the message text and the button text in the next 2 options.
3948 + See this feature demonstrated in <a href="https://www.youtube.com/watch?v=lm_HIic6obw" target="_blank">this video</a>.
2902 3949 </label>
2903 - Tip: If your pages rarely change, you may wish to set this to a much higher value than 24 hours.
3950 + <span id="box_gdpr_consent">
3951 + Note: If your visitors click a red accept button but your site doesn't reveal the video, you probably have a caching plugin. There should be a setting in your caching plugin to prevent caching the consent cookie. The name of the consent cookie is: <code>ytprefs_gdpr_consent</code>
3952 + </span>
3953 + </p>
2904 3954
2905 - <div class="pad20">
2906 - <input type="button" class="button button-primary" value="Click to clear YouTube cache"/>
2907 - <span style="display: none;" id="clearspdcloading" class="orange bold">Clearing...</span>
2908 - <span class="orange bold" style="display: none;" id="clearspdcsuccess">Finished clearing YouTube cache.</span>
2909 - <span class="orange bold" style="display: none;" id="clearspdcfailed">Sorry, there seemed to be a problem clearing the cache.</span>
2910 - </div>
3955 + <p>
3956 + <label for="<?php echo self::$opt_gdpr_consent_message; ?>">
3957 + <b class="chktitle">Privacy/GDPR - Consent Message Text:</b>
3958 + Below you can customize the message that will appear to visitors before they accept YouTube content:
3959 + </label>
3960 + <div class="clearboth"></div>
3961 + <div class="gdpr-options-left">
3962 + <?php
3963 + wp_editor(wp_kses_post($all[self::$opt_gdpr_consent_message]), self::$opt_gdpr_consent_message, array(
3964 + 'textarea_rows' => 22,
3965 + 'media_buttons' => false,
3966 + 'teeny' => true
3967 + ));
3968 + ?>
2911 3969 </div>
3970 + <div class="gdpr-options-right">
3971 + <p><em>Example of message and button:</em></p>
3972 +
3973 + <img src="<?php echo plugins_url('images/ss-gdpr-message.png', __FILE__) ?>" alt="GDPR Consent Message Example" class="img-gdpr-message" />
3974 + </div>
3975 +
3976 + </p>
3977 + <div class="clearboth"></div>
3978 + <p>
3979 + <label for="<?php echo self::$opt_gdpr_consent_button; ?>">
3980 + <b class="chktitle">Privacy/GDPR - Consent Button Text:</b>
3981 + This is the text for the red "Accept" button that appears with the above privacy/GDPR message:
3982 + </label>
3983 + <br>
3984 + <input type="text" placeholder="Example: Accept YouTube Content" name="<?php echo self::$opt_gdpr_consent_button; ?>" id="<?php echo self::$opt_gdpr_consent_button; ?>" value="<?php echo esc_attr(trim($all[self::$opt_gdpr_consent_button])); ?>" class="textinput regular-text"/>
3985 + </p>
3986 +
3987 + <p>
3988 + <input name="<?php echo self::$opt_nocookie; ?>" id="<?php echo self::$opt_nocookie; ?>" <?php checked($all[self::$opt_nocookie], 1); ?> type="checkbox" class="checkbox">
3989 + <label for="<?php echo self::$opt_nocookie; ?>">
3990 + <b class="chktitle">No Cookies:</b> Prevent YouTube from leaving tracking cookies on your visitors browsers unless they actual play the videos. This is coded to apply this behavior on links in your past post as well.
3991 + <div id="boxnocookie">
3992 + Note: Checking this option may introduce issues to features that depend YouTube's API, such as the ones listed below. We suggest testing them out to make sure you are still pleased with the results:
3993 + <ul class="list-ul">
3994 + <li>Galleries</li>
3995 + <li>Hide related videos at the end of playback</li>
3996 + <li>Volume initialization</li>
3997 + <li>Simultaneous playback control</li>
3998 + <li>Playing video on mobile devices</li>
3999 + </ul>
4000 + </div>
4001 + </label>
4002 + </p>
2912 4003 </div>
4004 + </section>
4005 +
4006 + <section class="pattern" id="jumpwiz">
4007 + <h2>Visual YouTube Wizard Directions</h2>
4008 + <p>
4009 + While you're writing your post or page, you have the ability to search YouTube and insert videos, playlists, and even galleries right from your editor. Below are directions for each type of WordPress editor.
4010 + For <strong>pagebuilder instructions</strong>, scroll down to the "Pagebuilder Tips" section.
2913 4011 </p>
2914 - <div class="hr"></div>
4012 + <h3>Classic Editor</h3>
4013 + <img class="wiztab-screenshots" src="<?php echo plugins_url('images/ss-wiz-classic.png', __FILE__) ?>">
4014 + <p>
4015 + Simply click the EmbedPlus for YouTube wizard button found above
4016 + your post editor to start the wizard (see image to the right to locate this button). There, you'll have several options for different types of embeds.
4017 + Each embed code will have an "Insert Into Editor" button that you can click to directly embed the desired video link to your post without having to copy and paste.
4018 + </p>
4019 + <hr class="clearboth">
4020 + <h3>Widgets</h3>
4021 + <img class="wiztab-screenshots" src="<?php echo plugins_url('images/ss-wiz-widget.png', __FILE__) ?>">
4022 + <p>
4023 + To insert a video in a widget area, use the Text widget that comes with WordPress. Simply click the EmbedPlus for YouTube wizard button found above
4024 + the widget textbox to start the wizard (see image to the right to locate this button). There, you'll have several options for different types of embeds.
4025 + Each embed code will have an "Insert Into Editor" button that you can click to directly embed the desired video link to your post without having to copy and paste.
4026 + </p>
4027 + <hr class="clearboth"/>
4028 + <h3>Gutenberg Block Editor</h3>
4029 + <img class="wiztab-screenshots" src="<?php echo plugins_url('images/ss-wiz-gbblock.png', __FILE__) ?>">
4030 + <p>
4031 + Click on the (+) sign for the block editor list. The EmbedPlus for YouTube Wizard block is located under the "Embeds" category (make sure you choose "YouTube <strong>Wizard</strong>" not "YouTube").
4032 + Then your page will show a placeholder where you can launch the wizard. In the wizard, you'll have several options for different types of embeds.
4033 + Each embed code will have an "Insert Into Editor" button that you can click to directly embed the desired video link to your post without having to copy and paste.
4034 + You'll also be able to preview and interact with your embed without having to view the page on the front end.
4035 + </p>
4036 + <hr class="clearboth"/>
4037 + <h3>Gutenberg Classic Block</h3>
4038 + <img class="wiztab-screenshots" src="<?php echo plugins_url('images/ss-wiz-gbclassicblock.png', __FILE__) ?>">
4039 + <p>
4040 + Are you using Gutenberg but not quite ready to start using all the blocks? Well, you can still access our wizard if you wish to continue using Gutenberg's Classic block.
4041 + The Classic block brings back the former editor you used before WordPress, and so we've added a button to it you can use to launch the wizard (see example on the right).
4042 + Simply click the wizard button to start the wizard. There, you'll have several options for different types of embeds.
4043 + Each embed code will have an "Insert Into Editor" button that you can click to directly embed the desired video link to your post without having to copy and paste.
4044 + </p>
4045 + <hr class="clearboth"/>
4046 + <h3>Pro Customization</h3>
4047 + <img class="wiztab-screenshots" src="<?php echo plugins_url('images/ssprowizard.png', __FILE__) ?>">
4048 + <p>
4049 + <a href="<?php echo self::$epbase ?>/dashboard/pro-easy-video-analytics.aspx?ref=wizdirections" target="_blank"><b>Even more options are available to PRO users, no matter which editor you choose!</b></a>
4050 + Simply click the "Customize" button in the wizard to further personalize each of your embeds without having to manually add special codes yourself.
4051 + The customize button will allow you to easily override most of the above default options for that embed.
4052 + </p>
4053 + <hr class="clearboth"/>
4054 + <h2 id="jumppagebuilder">Pagebuilder Tips</h2>
4055 + <p>
4056 + Most page builders have a text widget in which our plugin's wizard can be launched. Watch the videos below for some popular ones, namely Elementor, Beaver Builder, and SiteOrigin.
4057 + </p>
4058 + <p>
4059 + <em>Note: Please do not check the "Also Defer jQuery" option if you use a pagebuilder. Some pagebuilders cannot work if jQuery is deferred.</em>
4060 + </p>
4061 + <div class="wiztab-pagebuilder">
4062 + <h3>Beaver Builder</h3>
4063 + <div class="epyt-fitvid">
4064 + <iframe allow="fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" src="https://www.youtube.com/embed/bPgz0jyt7TE?rel=0" allowfullscreen="" frameborder="0"></iframe>
4065 + </div>
4066 + </div>
4067 + <div class="wiztab-pagebuilder">
4068 + <h3>Elementor</h3>
4069 + <div class="epyt-fitvid">
4070 + <iframe allow="fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" src="https://www.youtube.com/embed/ldNfIGRTxDU?rel=0" allowfullscreen="" frameborder="0"></iframe>
4071 + </div>
4072 + </div>
4073 + <div class="wiztab-pagebuilder">
4074 + <h3>Site Origin</h3>
4075 + <div class="epyt-fitvid">
4076 + <iframe allow="fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" src="https://www.youtube.com/embed/7QNYw_g-7WM?rel=0" allowfullscreen="" frameborder="0"></iframe>
4077 + </div>
4078 + </div>
4079 + <div class="wiztab-pagebuilder">
4080 + <h3>Visual Composer</h3>
4081 + <div class="epyt-fitvid">
4082 + <iframe allow="fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" src="https://www.youtube.com/embed/FWBQc9XhAqM?rel=0" allowfullscreen="" frameborder="0"></iframe>
4083 + </div>
4084 + </div>
4085 + <div class="wiztab-pagebuilder">
4086 + <h3>WPBakery</h3>
4087 + <div class="epyt-fitvid">
4088 + <iframe allow="fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" src="https://www.youtube.com/embed/7T5wPoEujN8?rel=0" allowfullscreen="" frameborder="0"></iframe>
4089 + </div>
4090 + </div>
4091 + <div class="wiztab-pagebuilder">
4092 + <p>
4093 + If you don't see your page builder listed above, don't worry. For pretty much any page builder with a short code widget, you can also embed your video, gallery, live stream, or premiere by creating the short code using the plugin's wizard and then embedding the code in the short code widget or text widget of your page builder of choice.
4094 + </p>
4095 + </div>
4096 + </section>
2915 4097
4098 + <section class="pattern" id="jumpgallery">
4099 + <h2>Gallery Settings and Directions</h2>
4100 + <img class="ssgallery" src="<?php echo plugins_url('images/ssgallery.png', __FILE__) ?>">
2916 4101 <p>
2917 - <input name="<?php echo self::$opt_schemaorg; ?>" id="<?php echo self::$opt_schemaorg; ?>" <?php checked($all[self::$opt_schemaorg], 1); ?> type="checkbox" class="checkbox">
2918 - <label for="<?php echo self::$opt_schemaorg; ?>">
2919 - <b>(PRO)</b> <b class="chktitle">Video SEO Tags:</b> Update your YouTube embeds with Google, Bing, and Yahoo friendly schema markup for videos.
2920 - </label>
2921 - <span id="boxschemaorg">
2922 - <span class="apikey-msg">
2923 - The video SEO tags include data like the title, description, and thumbnail information of each video you embed. This plugin automatically extracts this data directly from YouTube using the version 3 API,
2924 - which will soon replace the version 2 API. This particular API version requires that you obtain an API key so that YouTube can authenticate the requests. Don't worry, it's an easy process.
2925 - Just <a href="https://developers.google.com/youtube/registering_an_application" target="_blank">click this link &raquo;</a> and follow the video to the right to get your API key. Then paste it in the box below, and click the "Save Changes" button:
2926 - <br>
2927 - <span style="vertical-align: middle; display: inline-block;">
2928 - YouTube API Key: <input type="text" name="<?php echo self::$opt_apikey; ?>" id="<?php echo self::$opt_apikey; ?>" value="<?php echo trim($all[self::$opt_apikey]); ?>" class="textinput" style="width: 200px;">
2929 - </span>
4102 + <a target="_blank" href="<?php echo self::$epbase ?>/responsive-youtube-playlist-channel-gallery-for-wordpress.aspx">You can now make playlist embeds (and channel-playlist embeds) have a gallery layout &raquo;</a>. <strong>First, you must obtain your YouTube API key</strong>.
4103 + Don't worry, it's an easy process. Just <a href="https://www.youtube.com/watch?v=ZCfrNvu6nMc" target="_blank">click this link &raquo;</a> and follow the video on that page to get your server API key. Since Google updates their API Key generation directions frequently, follow the general steps shown in the video.
4104 + Then paste your API key in the "API Key" tab, and click the "Save Changes" button.
4105 + </p>
4106 +
4107 + <p>
4108 + Below are the global settings for galleries. If you want each of your galleries to have custom settings, <a href="<?php echo self::$epbase ?>/dashboard/pro-easy-video-analytics.aspx?ref=galleryglobal" target="_blank">go PRO</a> for more options:
4109 + </p>
4110 + <div class="ytindent chx">
4111 +
4112 + <p>
4113 + <label for="<?php echo self::$opt_gallery_pagesize; ?>"><b class="chktitle">Gallery Page Size:</b></label>
4114 + <select name="<?php echo self::$opt_gallery_pagesize; ?>" id="<?php echo self::$opt_gallery_pagesize; ?>" style="width: 60px;">
4115 + <?php
4116 + $gps_val = intval(trim($all[self::$opt_gallery_pagesize]));
4117 + $gps_val = min($gps_val, 50);
4118 + for ($gps = 1; $gps <= 50; $gps++)
4119 + {
4120 + ?><option <?php echo $gps_val == $gps ? 'selected' : '' ?> value="<?php echo $gps ?>"><?php echo $gps ?></option>
4121 + <?php
4122 + }
4123 + ?>
4124 + </select>
4125 + Enter how many thumbnails per page should be shown at once (YouTube allows a maximum of 50 per page).
4126 + </p>
4127 + <p>
4128 + <label for="<?php echo self::$opt_gallery_columns; ?>"><b class="chktitle">Number of Columns:</b></label>
4129 + <input name="<?php echo self::$opt_gallery_columns; ?>" min="1" id="<?php echo self::$opt_gallery_columns; ?>" type="number" class="textinput" style="width: 60px;" value="<?php echo esc_attr(trim($all[self::$opt_gallery_columns])); ?>">
4130 + Enter how many thumbnails can fit per row.
4131 + </p>
4132 + <p>
4133 + <input name="<?php echo self::$opt_gallery_collapse_grid; ?>" id="<?php echo self::$opt_gallery_collapse_grid; ?>" <?php checked($all[self::$opt_gallery_collapse_grid], 1); ?> type="checkbox" class="checkbox">
4134 + <label for="<?php echo self::$opt_gallery_collapse_grid; ?>">
4135 + <b class="chktitle">Stack Thumbnails for Mobile:</b> Check this option to responsively stack thumbnails on smaller screens, for the grid layout.
4136 + </label>
4137 + <span id="box_collapse_grid">
4138 + <?php
4139 + foreach ($all[self::$opt_gallery_collapse_grid_breaks] as $idx => $bpts)
4140 + {
4141 + ?>
4142 + On screens up to
4143 + <input type="number" name="<?php echo self::$opt_gallery_collapse_grid_breaks . '[' . $idx . '][bp][max]'; ?>"
4144 + id="<?php echo self::$opt_gallery_collapse_grid_breaks . '[' . $idx . '][bp][max]'; ?>"
4145 + value="<?php echo intval(trim($bpts['bp']['max'])); ?>" class="textinput" style="width: 70px;">px wide, stack thumbnails to 1 column.
4146 + <input type="hidden" name="<?php echo self::$opt_gallery_collapse_grid_breaks . '[' . $idx . '][cols]'; ?>"
4147 + id="<?php echo self::$opt_gallery_collapse_grid_breaks . '[' . $idx . '][cols]'; ?>"
4148 + value="<?php echo intval(trim($bpts['cols'])); ?>">
4149 + <input type="hidden" name="<?php echo self::$opt_gallery_collapse_grid_breaks . '[' . $idx . '][bp][min]'; ?>"
4150 + id="<?php echo self::$opt_gallery_collapse_grid_breaks . '[' . $idx . '][bp][min]'; ?>"
4151 + value="<?php echo intval(trim($bpts['bp']['min'])); ?>">
4152 + <?php
4153 + }
4154 + ?>
4155 + <span class="smallnote grey pad20"><br>Note: a common mobile screen width is 767 pixels.</span>
2930 4156 </span>
2931 - <span class="apikey-video">
2932 - <iframe width="384" height="216" src="https://www.youtube.com/embed/px8LvNIVblg?rel=0" frameborder="0" allowfullscreen></iframe>
4157 + </p>
4158 + <p>
4159 + <input name="<?php echo self::$opt_gallery_showpaging; ?>" id="<?php echo self::$opt_gallery_showpaging; ?>" <?php checked($all[self::$opt_gallery_showpaging], 1); ?> type="checkbox" class="checkbox">
4160 + <label for="<?php echo self::$opt_gallery_showpaging; ?>"><b class="chktitle">Show Pagination:</b> Show the Next/Previous buttons and page numbering.
4161 + It might be useful to hide pagination if you want your gallery to display just a subset of videos from a playlist or channel. That is, only the first page of videos (defined by your page size) will be visible to your visitors if these buttons are hidden.
4162 + </label>
4163 + </p>
4164 + <p>
4165 + <input name="<?php echo self::$opt_gallery_customarrows; ?>" id="<?php echo self::$opt_gallery_customarrows; ?>" <?php checked($all[self::$opt_gallery_customarrows], 1); ?> type="checkbox" class="checkbox">
4166 + <label for="<?php echo self::$opt_gallery_customarrows; ?>">
4167 + <b class="chktitle">Custom Next/Previous Text:</b> If you want your gallery viewers to see something besides "Next" and "Prev" when browsing through thumbnails, enter your replacement text here. This feature can be quite useful for non-English sites. For example, a French site might replace Prev with Pr&eacute;c&eacute;dent and Next with Suivant.
4168 + </label>
4169 + <span id="boxcustomarrows">
4170 + Previous Page: <input type="text" name="<?php echo self::$opt_gallery_customprev; ?>" id="<?php echo self::$opt_gallery_customprev; ?>" value="<?php echo esc_attr(trim($all[self::$opt_gallery_customprev])); ?>" class="textinput" style="width: 100px;"> &nbsp;
4171 + Next Page: <input type="text" name="<?php echo self::$opt_gallery_customnext; ?>" id="<?php echo self::$opt_gallery_customnext; ?>" value="<?php echo esc_attr(trim($all[self::$opt_gallery_customnext])); ?>" class="textinput" style="width: 100px;">
2933 4172 </span>
2934 - </span>
4173 + </p>
4174 + <p>
4175 + <input name="<?php echo self::$opt_gallery_channelsub; ?>" id="<?php echo self::$opt_gallery_channelsub; ?>" <?php checked($all[self::$opt_gallery_channelsub], 1); ?> type="checkbox" class="checkbox">
4176 + <label for="<?php echo self::$opt_gallery_channelsub; ?>">
4177 + <b class="chktitle">Show Subscribe Button: </b> Are you the channel owner for all your galleries? Check this box to add a "Subscribe" button to all your galleries as shown below. This might help you convert your site's visitors to YouTube subscribers of your channel.
4178 + </label>
4179 + <span id="boxchannelsub">
4180 + Paste Channel URL: <input type="text" placeholder="Example: https://www.youtube.com/user/YourChannel" name="<?php echo self::$opt_gallery_channelsublink; ?>" id="<?php echo self::$opt_gallery_channelsublink; ?>" value="<?php echo esc_url(trim($all[self::$opt_gallery_channelsublink])); ?>" class="textinput regular-text"> &nbsp;
4181 + Button text: <input type="text" name="<?php echo self::$opt_gallery_channelsubtext; ?>" id="<?php echo self::$opt_gallery_channelsubtext; ?>" value="<?php echo esc_attr(trim($all[self::$opt_gallery_channelsubtext])); ?>" class="textinput" style="width: 200px;">
4182 + </span>
4183 + </p>
4184 + <p><img class="sssubscribe" src="<?php echo plugins_url('images/sssubscribe.png', __FILE__) ?>"></p>
4185 +
4186 + <p>
4187 + <label for="<?php echo self::$opt_gallery_scrolloffset; ?>"><b class="chktitle">Scroll Offset:</b></label>
4188 + <input name="<?php echo self::$opt_gallery_scrolloffset; ?>" id="<?php echo self::$opt_gallery_scrolloffset; ?>" type="number" class="textinput" style="width: 60px;" value="<?php echo esc_attr(trim($all[self::$opt_gallery_scrolloffset])); ?>">
4189 + After you click on a thumbnail, the gallery will automatically smooth scroll up to the actual player. If you need it to scroll a few pixels further, increase this number.
4190 + </p>
4191 + <p>
4192 + <input name="<?php echo self::$opt_gallery_showtitle; ?>" id="<?php echo self::$opt_gallery_showtitle; ?>" <?php checked($all[self::$opt_gallery_showtitle], 1); ?> type="checkbox" class="checkbox">
4193 + <label for="<?php echo self::$opt_gallery_showtitle; ?>"><b class="chktitle">Show Thumbnail Title:</b> Show titles with each thumbnail.</label>
4194 + </p>
4195 + <p>
4196 + <input name="<?php echo self::$opt_gallery_hideprivate; ?>" id="<?php echo self::$opt_gallery_hideprivate; ?>" <?php checked($all[self::$opt_gallery_hideprivate], 1); ?> type="checkbox" class="checkbox">
4197 + <label for="<?php echo self::$opt_gallery_hideprivate; ?>"><b class="chktitle">Hide Private Thumbnails:</b> Hide thumbnails for videos in a playlist that cannot be embedded yet. Note: This may make some page sizes look uneven.</label>
4198 + </p>
4199 + <p>
4200 + <input name="<?php echo self::$opt_gallery_autonext; ?>" id="<?php echo self::$opt_gallery_autonext; ?>" <?php checked($all[self::$opt_gallery_autonext], 1); ?> type="checkbox" class="checkbox">
4201 + <label for="<?php echo self::$opt_gallery_autonext; ?>"><b class="chktitle">Automatic Continuous Play:</b> Automatically play the next video in the gallery as soon as the current video finished.
4202 + <strong>Note:</strong> If you're embedding videos from your own monetized YouTube channel, we advise you to read YouTube's resource page on ads on embedded videos:
4203 + <a href="https://support.google.com/youtube/answer/132596?hl=en" target="_blank">https://support.google.com/youtube/answer/132596?hl=en</a>
4204 + You'll see that videos that you want to monetize "should be embedded using the standard click-to-play embed and NOT a scripted play."
4205 + Unchecking this option guarantees standard click-to-play gallery embedding.
4206 + </label>
4207 + </p>
4208 + <p>
4209 + <input name="<?php echo self::$opt_gallery_thumbplay; ?>" id="<?php echo self::$opt_gallery_thumbplay; ?>" <?php checked($all[self::$opt_gallery_thumbplay], 1); ?> type="checkbox" class="checkbox">
4210 + <label for="<?php echo self::$opt_gallery_thumbplay; ?>"><b class="chktitle">Thumbnail Click Plays Video:</b>
4211 + Clicking on a gallery thumbnail autoplays the video. Uncheck this and visitors must also click the video's play button after clicking the thumbnail
4212 + (uncheck this option for standard click-to-play gallery embedding).
4213 + </label>
4214 + </p>
4215 + <div class="pad20">
4216 + <p>
4217 + Ready to get started with an actual gallery? Just click the plugin wizard button and pick your desired gallery embedding choice.
4218 + </p>
4219 + <p><img class="sswizardbutton" src="<?php echo plugins_url('images/sswizardbutton.jpg', __FILE__) ?>"></p>
4220 + </div>
4221 + </div>
4222 + </section>
4223 +
4224 + <section class="pattern" id="jumpcompat">
4225 + <h2>Compatibility Settings</h2>
4226 + <p>
4227 + With tens of thousands of active users, our plugin may not work with every plugin out there. Below are some settings you may wish to try out.
2935 4228 </p>
2936 - <div class="hr"></div>
4229 + <div class="ytindent chx">
4230 + <p>
4231 + <input name="<?php echo self::$opt_ajax_save; ?>" id="<?php echo self::$opt_ajax_save; ?>" <?php checked($all[self::$opt_ajax_save], 1); ?> type="checkbox" class="checkbox">
4232 + <label for="<?php echo self::$opt_ajax_save; ?>">
4233 + <b class="chktitle">Save Settings with AJAX: </b>
4234 + Turn this option off if you are having trouble saving your settings.
4235 + </label>
4236 + </p>
4237 + <p>
4238 + <input name="<?php echo self::$opt_gb_compat; ?>" id="<?php echo self::$opt_gb_compat; ?>" <?php checked($all[self::$opt_gb_compat], 1); ?> type="checkbox" class="checkbox">
4239 + <label for="<?php echo self::$opt_gb_compat; ?>">
4240 + <b class="chktitle">Gutenberg Block Editor Theme Spacing: </b>
4241 + Check this option to fix possible issues with spacing below your videos. You may also want to try combining this option with Responsive Sizing.
4242 + </label>
4243 + </p>
4244 + <p>
4245 + <input name="<?php echo self::$opt_old_script_method; ?>" id="<?php echo self::$opt_old_script_method; ?>" <?php checked($all[self::$opt_old_script_method], 1); ?> type="checkbox" class="checkbox">
4246 + <label for="<?php echo self::$opt_old_script_method; ?>">
4247 + <b class="chktitle">Use Legacy Scripts: </b>
4248 + This is a legacy option for users with theme issues that require backwards compatibility (v.10.5 or earlier). It may also help with caching plugin or CDN plugin issues.
4249 + </label>
4250 + </p>
4251 + <p>
4252 + <input name="<?php echo self::$opt_admin_off_scripts; ?>" id="<?php echo self::$opt_admin_off_scripts; ?>" <?php checked($all[self::$opt_admin_off_scripts], 1); ?> type="checkbox" class="checkbox">
4253 + <label for="<?php echo self::$opt_admin_off_scripts; ?>">
4254 + <b class="chktitle">Turn Off Scripts While Editing: </b>
4255 + Front-end editors and visual pagebuilders often run Javascript while you're in edit mode. Check this to turn off this plugin's Javascript during edit mode, if you see conflicts.
4256 + Don't worry, all other visitors to your site will still view your site normally.
4257 + </label>
4258 + </p>
4259 + <p>
4260 + <input name="<?php echo self::$opt_migrate; ?>" id="<?php echo self::$opt_migrate; ?>" <?php checked($all[self::$opt_migrate], 1); ?> type="checkbox" class="checkbox">
4261 + <label for="<?php echo self::$opt_migrate; ?>">
4262 + <b class="chktitle">Migrate Shortcodes: </b> Inherit shortcodes from other plugins. This is useful for when a plugin becomes deprecated, or you simply prefer this plugin's features.
4263 + </label>
4264 + <div id="boxmigratelist">
4265 + <ul>
4266 + <li><input name="<?php echo self::$opt_migrate_embedplusvideo; ?>" id="<?php echo self::$opt_migrate_embedplusvideo; ?>" <?php checked($all[self::$opt_migrate_embedplusvideo], 1); ?> type="checkbox" class="checkbox"><label for="<?php echo self::$opt_migrate_embedplusvideo; ?>"><b>"YouTube Advanced Embed":</b> <code>[embedplusvideo]</code> shortcode</label></li>
4267 + <li><input name="<?php echo self::$opt_migrate_youtube; ?>" id="<?php echo self::$opt_migrate_youtube; ?>" <?php checked($all[self::$opt_migrate_youtube], 1); ?> type="checkbox" class="checkbox"><label for="<?php echo self::$opt_migrate_youtube; ?>"><b>"YouTube Embed":</b> <code>[youtube]</code> and <code>[youtube_video]</code> shortcodes</label></li>
4268 + <li class="smallnote orange" style="list-style: none;">This feature is beta. More shortcodes coming.</li>
4269 + </ul>
4270 +
4271 + </div>
4272 + </p>
4273 + <p>
4274 + <input name="<?php echo self::$opt_oldspacing; ?>" id="<?php echo self::$opt_oldspacing; ?>" <?php checked($all[self::$opt_oldspacing], 1); ?> type="checkbox" class="checkbox">
4275 + <label for="<?php echo self::$opt_oldspacing; ?>">
4276 + <b class="chktitle">Legacy Spacing:</b> Continue the spacing style from version 4.0 and older. Those versions required you to manually add spacing above and below your video. Unchecking this will automatically add the spacing.
4277 + </label>
4278 + </p>
4279 + <p>
4280 + <input name="<?php echo self::$opt_frontend_only; ?>" id="<?php echo self::$opt_frontend_only; ?>" <?php checked($all[self::$opt_frontend_only], 1); ?> type="checkbox" class="checkbox">
4281 + <label for="<?php echo self::$opt_frontend_only; ?>">
4282 + <b class="chktitle">Don't Run Shortcode In Admin:</b>
4283 + Checking this will only allow the shortcode to run on the front-end of your website, and not in the admin area.
4284 + </label>
4285 + </p>
4286 + <p>
4287 + <input name="<?php echo self::$opt_evselector_light; ?>" id="<?php echo self::$opt_evselector_light; ?>" <?php checked($all[self::$opt_evselector_light], 1); ?> type="checkbox" class="checkbox">
4288 + <label for="<?php echo self::$opt_evselector_light; ?>">
4289 + <b class="chktitle">Theme Video Problems: </b>
4290 + Check this option if you're having issues with autoplayed videos or background videos etc. that have been generated by your theme.
4291 + </label>
4292 + </p>
4293 + <p>
4294 + <input name="<?php echo self::$opt_stop_mobile_buffer; ?>" id="<?php echo self::$opt_stop_mobile_buffer; ?>" <?php checked($all[self::$opt_stop_mobile_buffer], 1); ?> type="checkbox" class="checkbox">
4295 + <label for="<?php echo self::$opt_stop_mobile_buffer; ?>">
4296 + <b class="chktitle">Mobile Autoplay Problems: </b>
4297 + Autoplay works for desktop, but mobile devices don't allow autoplay due to network carrier data charges. For mobile devices, this option may help the player to properly display the video for the visitor to click on.
4298 + (<strong>Note:</strong> Desktop browsers like <a href="https://developers.google.com/youtube/iframe_api_reference#Mobile_considerations" target="_blank">Chrome and Safari are moving towards preventing autoplay for any video</a>. But, your chances are improved if you set your videos to initially start muted.)
4299 + </label>
4300 + </p>
4301 + <p>
4302 + <input name="<?php echo self::$opt_ajax_compat; ?>" id="<?php echo self::$opt_ajax_compat; ?>" <?php checked($all[self::$opt_ajax_compat], 1); ?> type="checkbox" class="checkbox">
4303 + <label for="<?php echo self::$opt_ajax_compat; ?>">
4304 + <b class="chktitle">Ajax Theme:</b>
4305 + If you have a theme that loads pages with AJAX transitions, try checking this option.
4306 + </label>
4307 + </p>
4308 + <p>
4309 + <input name="<?php echo self::$opt_debugmode; ?>" id="<?php echo self::$opt_debugmode; ?>" <?php checked($all[self::$opt_debugmode], 1); ?> type="checkbox" class="checkbox">
4310 + <label for="<?php echo self::$opt_debugmode; ?>">
4311 + <b class="chktitle">Debug Mode: </b> If you ask for support, we may ask you to turn on debug mode here.
4312 + It may print out some diagnostic info so that we can help you solve your issue.
4313 + </label>
4314 + </p>
4315 + <p>
4316 + <input name="<?php echo self::$opt_uninstall_data; ?>" id="<?php echo self::$opt_uninstall_data; ?>" <?php checked($all[self::$opt_uninstall_data], 1); ?> type="checkbox" class="checkbox">
4317 + <label for="<?php echo self::$opt_uninstall_data; ?>">
4318 + <b class="chktitle">Delete Options When Uninstalling:</b> Checking this box will permanently delete your options the next time you uninstall the plugin. Leave it unchecked
4319 + to preserve your options between installations.
4320 + </label>
4321 + </p>
4322 + </div>
4323 +
4324 +
4325 + </section>
4326 + <section class="pattern" id="jumphowto">
4327 + <h2>Manual Embedding</h2>
2937 4328 <p>
2938 - <input name="<?php echo self::$opt_dynload; ?>" id="<?php echo self::$opt_dynload; ?>" <?php checked($all[self::$opt_dynload], 1); ?> type="checkbox" class="checkbox">
2939 - <span id="boxdyn">
2940 - Animation:
2941 - <?php $cleandyn = trim($all[self::$opt_dyntype]); ?>
2942 - <select name="<?php echo self::$opt_dyntype; ?>" id="<?php echo self::$opt_dyntype; ?>" >
2943 - <option value="">Select type</option>
2944 - <option value="rotateIn" <?php echo 'rotateIn' === $cleandyn ? 'selected' : '' ?> >rotate in</option>
2945 - <option value="slideInRight" <?php echo 'slideInRight' === $cleandyn ? 'selected' : '' ?> >slide from right</option>
2946 - <option value="slideInLeft" <?php echo 'slideInLeft' === $cleandyn ? 'selected' : '' ?> >slide from left</option>
2947 - <option value="bounceIn" <?php echo 'bounceIn' === $cleandyn ? 'selected' : '' ?> >bounce in</option>
2948 - <option value="flipInX" <?php echo 'flipInX' === $cleandyn ? 'selected' : '' ?> >flip up/down</option>
2949 - <option value="flipInY" <?php echo 'flipInY' === $cleandyn ? 'selected' : '' ?> >flip left/right</option>
2950 - <option value="pulse" <?php echo 'pulse' === $cleandyn ? 'selected' : '' ?> >pulse</option>
2951 - <option value="tada" <?php echo 'tada' === $cleandyn ? 'selected' : '' ?> >jiggle</option>
2952 - <option value="fadeInDown" <?php echo 'fadeInDown' === $cleandyn ? 'selected' : '' ?> >fade in downward</option>
2953 - <option value="fadeInUp" <?php echo 'fadeInUp' === $cleandyn ? 'selected' : '' ?> >fade in upward</option>
2954 - <option value="zoomInDown" <?php echo 'zoomInDown' === $cleandyn ? 'selected' : '' ?> >zoom in downward</option>
2955 - <option value="zoomInUp" <?php echo 'zoomInUp' === $cleandyn ? 'selected' : '' ?> >zoom in upward</option>
2956 - </select>
2957 - </span>
2958 - <label for="<?php echo self::$opt_dynload; ?>">
2959 - <b>(PRO)</b> <b class="chktitle">Special Lazy-Loading Effects:</b>
2960 - Add eye-catching special effects that will make your YouTube embeds bounce, flip, pulse, or slide as they lazy load on the screen. Check this box to select your desired effect. <a target="_blank" href="<?php echo self::$epbase ?>/add-special-effects-to-youtube-embeds-in-wordpress.aspx">Read more here &raquo;</a>
2961 - </label>
4329 + <strong>We strongly recommend using the wizard in your editor to embed.</strong> However, if you choose to manually embed code, follow some legacy instructions below.
2962 4330 </p>
2963 - <div class="hr"></div>
4331 + <h3>
4332 + Manually Embed a YouTube Video or Playlist &nbsp; <a class="smallnote" href="#jumpgallery">(For gallery directions, go here &raquo;)</a>
4333 + </h3>
2964 4334 <p>
2965 - <img class="ssfb" src="<?php echo plugins_url('images/ssfb.jpg', __FILE__) ?>" />
2966 - <input name="<?php echo self::$opt_ogvideo; ?>" id="<?php echo self::$opt_ogvideo; ?>" <?php checked($all[self::$opt_ogvideo], 1); ?> type="checkbox" class="checkbox">
2967 - <label for="<?php echo self::$opt_ogvideo; ?>">
2968 - <b>(PRO)</b> <b class="chktitle">Facebook Open Graph Markup:</b> Update YouTube embeds on your pages with Open Graph markup to enhance Facebook sharing and discovery of the pages. Your shared pages, for example, will also display embedded video thumbnails on Facebook Timelines.
4335 + <b>For videos:</b> <i>Method 1 - </i> Do you already have a URL to the video you want to embed in a post, page, or even a widget? All you have to do is paste it on its own line, as shown below (including the https:// part). Easy, eh?<br>
4336 + <i>Method 2 - </i> If you want to do some formatting (e.g. add HTML to center a video) or have two or more videos next to each other on the same line, wrap each link with the <code>[embedyt]...[/embedyt]</code> shortcode. <b>Tip for embedding videos on the same line:</b> As shown in the example image below, decrease the size of each video so that they fit together on the same line (See the "How To Override Defaults" section for height and width instructions).
4337 + </p>
4338 + <p>
4339 + <b>For galleries:</b> <a href="#jumpgallery">Click here</a> to scroll down to gallery settings and directions.
4340 + </p>
4341 + <p>
4342 + <b>For self-contained playlists:</b> Go to the page for the playlist that lists all of its videos (<a target="_blank" href="https://www.youtube.com/playlist?list=PLsRNoUx8w3rPxNGCQYBPobGxNj1BfDT7P">Example &raquo;</a>). Click on the video that you want the playlist to start with. Copy and paste that browser URL into your blog on its own line. If you want the first video to always be the latest video in your playlist, check the option "Playlist Ordering" in the settings down below (you will also see this option available if you use the Pro Wizard). If you want to have two or more playlists next to each other on the same line, wrap each link with the <code>[embedyt]...[/embedyt]</code> shortcode.
4343 + </p>
4344 + <p>
4345 + <b>For self-contained channel playlists:</b> At your editor, click on the <img style="vertical-align: text-bottom;" src="<?php echo plugins_url('images/wizbuttonbig.png', __FILE__) ?>"> wizard button and choose the option <i>Search for a video or channel to insert in my editor.</i> Then, click on the <i>channel playlist</i> option there (instead of <i>single video</i>). Search for the channel username and follow the rest of the directions there.
4346 + </p>
4347 + <p>
4348 + <strong>For directly embedding in your theme with PHP:</strong>
4349 + If you need to use PHP directly, we still recommend using the wizard to create the shortcode--but instead of pressing the "Insert" button, just copy the shortcode the wizard gives you. Then use the <code>do_shortcode()</code> function in your theme, like this:
4350 + <br>
4351 + <code>&lt;?php echo do_shortcode('[embedyt]....[/embedyt]'); ?&gt;</code>
4352 + </p>
4353 + <p>
4354 + <b>Examples:</b><br><br>
4355 + <img style="width: 900px; height: auto;" class="shadow" src="<?php echo plugins_url('images/sshowto.png', __FILE__) ?>" />
4356 + </p>
4357 + <p>
4358 + Always follow these rules for any URL:
4359 + </p>
4360 + <ul class="reglist">
4361 + <li>Make sure the URL is really on its own line by itself. Or, if you need multiple videos on the same line, make sure each URL is wrapped properly with the shortcode (Example: <code>[embedyt]http://www.youtube.com/watch?v=ABCDEFGHIJK&width=400&height=250[/embedyt]</code>)</li>
4362 + <li>Make sure the URL is <strong>not</strong> an active hyperlink (i.e., it should just be plain text). Otherwise, highlight the URL and click the "unlink" button in your editor: <img src="<?php echo plugins_url('images/unlink.png', __FILE__) ?>"/></li>
4363 + <li>Make sure you did <strong>not</strong> format or align the URL in any way. If your URL still appears in your actual post instead of a video, highlight it and click the "remove formatting" button (formatting can be invisible sometimes): <img src="<?php echo plugins_url('images/erase.png', __FILE__) ?>"/></li>
4364 + <li>If you really want to align the video, try wrapping the link with the shortcode first. For example: <code>[embedyt]http://www.youtube.com/watch?v=ABCDEFGHIJK[/embedyt]</code> Using the shortcode also allows you to have two or more videos next to each other on the same line. Just put the shortcoded links together on the same line. For example:<br>
4365 + <code>[embedyt]http://www.youtube.com/watch?v=ABCDEF[/embedyt] [embedyt]http://www.youtube.com/watch?v=GHIJK[/embedyt]</code>
4366 + </li>
4367 + </ul>
4368 +
4369 +
4370 + <h3>
4371 + <?php _e("How To Manually Override Defaults / Other Options") ?>
4372 + </h3>
4373 + <p>
4374 + Suppose you have a few videos that need to be different from the above defaults. You can add options to the end of a link as displayed below to override the above defaults. Each option should begin with '&'.
4375 + <br><span class="orange">PRO users: You can use the <a href="<?php echo self::$epbase . '/dashboard/pro-easy-video-analytics.aspx?ref=manual' ?>" target="_blank">customize</a> buttons that you will see inside the wizard, instead of memorizing the following codes.</span>
4376 + </p>
4377 + <?php
4378 + _e('<ul class="reglist">');
4379 + _e("<li><strong>width</strong> - Sets the width of your player. If omitted, the default width will be the width of your theme's content.<em> Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&width=500</strong>&height=350</em></li>");
4380 + _e("<li><strong>height</strong> - Sets the height of your player. <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA&width=500<strong>&height=350</strong></em> </li>");
4381 + _e("<li><strong>autoplay</strong> - Set this to 1 to autoplay the video (or 0 to play the video once). <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&autoplay=1</strong></em> (Note: Desktop browsers like Chrome and Safari are moving towards preventing autoplay for any video. But, your chances are improved if you set your videos to initially start muted.) </li>");
4382 + _e("<li><strong>cc_load_policy</strong> - Set this to 1 to turn on closed captioning (or 0 to leave them off). <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&cc_load_policy=1</strong></em> </li>");
4383 + _e("<li><strong>iv_load_policy</strong> - Set this to 3 to turn off annotations (or 1 to show them). <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&iv_load_policy=3</strong></em> </li>");
4384 + _e("<li><strong>loop</strong> - Set this to 1 to loop the video (or 0 to not loop). <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&loop=1</strong></em> </li>");
4385 + _e("<li><strong>rel</strong> - Set this to 0 to not show related videos at the end of playing (or 1 to show them). <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&rel=0</strong></em> </li>");
4386 + _e("<li><strong>fs</strong> - Set this to 0 to hide the fullscreen button (or 1 to show it). <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&fs=0</strong></em> </li>");
4387 + _e("<li><strong>color</strong> - Set this to 'white' to make the player have a white progress bar (or 'red' for a red progress bar). <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&color=white</strong></em> </li>");
4388 + _e("<li><strong>controls</strong> - Set this to 0 to completely hide the video controls (or 1 to show it). <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&controls=0</strong></em> </li>");
4389 + _e("<li><strong>disablekb</strong> - Set this to 1 to disable keyboard controls (or 0 to enable them). <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&disablekb=1</strong></em> </li>");
4390 + _e("<li><strong>playsinline</strong> - Set this to 1 to allow videos play inline with the page on iOS browsers. (Set to 0 to have iOS launch videos in fullscreen instead). <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&playsinline=1</strong></em> </li>");
4391 + _e("<li><strong>origin</strong> - Set this to 1 to add the 'origin' parameter for extra JavaScript security. <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&origin=1</strong></em> </li>");
4392 + _e('</ul>');
4393 +
4394 + _e("<p>You can also start and end each individual video at particular times. Like the above, each option should begin with '&'</p>");
4395 + _e('<ul class="reglist">');
4396 + _e("<li><strong>start</strong> - Sets the time (in seconds) to start the video. <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA&width=500&height=350<strong>&start=20</strong></em> </li>");
4397 + _e("<li><strong>end</strong> - Sets the time (in seconds) to stop the video. <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA&width=500&height=350<strong>&end=100</strong></em> </li>");
4398 + _e('</ul>');
4399 + ?>
4400 + </section>
4401 +
4402 + <section class="pattern" id="jumpperformance">
4403 + <h2><?php _e('Performance Settings & Tips', 'youtube-embed-plus'); ?></h2>
4404 + <p>
4405 + <?php _e('On this page, we describe performance options to help optimize page speed times of your pages containing YouTube embeds.', 'youtube-embed-plus'); ?>
4406 + </p>
4407 + <div class="p">
4408 + <input name="<?php echo self::$opt_facade_mode; ?>" id="<?php echo self::$opt_facade_mode; ?>" <?php checked($all[self::$opt_facade_mode], 1); ?> type="checkbox" class="checkbox">
4409 + <label for="<?php echo self::$opt_facade_mode ?>">
4410 + <b class="chktitle"><?php _e('Facade Mode:', 'youtube-embed-plus'); ?> <sup class="orange">new</sup></b>
4411 + <?php _e('This improves performance by loading a lighter version of the player, until it is clicked. Then the real player loads (note: for live streams, the real player is always loaded). We have tested this feature in multiple cases and found it to successfully improve your Lighthouse performance score by addressing the following recommendation: "Some third-party resources can be lazy loaded with a facade."', 'youtube-embed-plus'); ?>
4412 + <a href="https://www.youtube.com/watch?v=W7PKUjVBDNE" target="_blank"><?php _e('See an example of this feature at work.', 'youtube-embed-plus'); ?></a>
4413 + </label>
4414 + <div class="p box_facade_mode">
4415 + <input name="<?php echo self::$opt_facade_autoplay; ?>" id="<?php echo self::$opt_facade_autoplay; ?>" type="checkbox" class="checkbox" <?php checked($all[self::$opt_facade_autoplay], 1); ?>>
4416 + <label for="<?php echo self::$opt_facade_autoplay ?>">
4417 + <b class="chktitle"><?php _e('Autoplay On Facade Click:', 'youtube-embed-plus'); ?></b>
4418 + <span>
4419 + <?php _e('After clicking once on the facade (aka light thumbnail), it is replaced with the real player. Check this option to have the real player play immediately, otherwise it will require an additional click. Note that checking this option will use YouTube\'s autoplay feature, which will not contribute toward play counts. If you\'re embedding videos from someone else\'s channel, we recommend checking this. If you\'re embedding videos that are from your channel, then you should self-evaluate the tradeoff involving play counts and additional clicking.', 'youtube-embed-plus'); ?>
4420 + </span>
4421 + </label>
4422 + <br>
4423 + <br>
4424 + <label>
4425 + <b class="chktitle"><?php _e('Force Maximum Quality for Facade Images: <sup class="orange">new</sup>', 'text_domain') ?></b>
4426 + <?php _e('Attempt to load the maximum resolution image for the facade image. This max quality image does not exist for all videos, so you have a few choices below.', 'text_domain'); ?>
4427 + </label>
4428 + <ul class="indent-option">
4429 + <li>
4430 + <input type="radio" name="<?php echo self::$opt_maxres_facade; ?>" id="<?php echo self::$opt_maxres_facade; ?>_eager" value="eager" <?php checked($all[self::$opt_maxres_facade], 'eager'); ?>>
4431 + <label for="<?php echo self::$opt_maxres_facade; ?>_eager"> <?php _e("<em>Eager:</em> Try loading the max resolution image by default. If the max-res image does not exist for the video, the next highest available resolution will immediately load instead. This option is best for websites that embed videos having very high resolutions (i.e. the max-res images will likely exist).", 'text_domain') ?> </label> <br>
4432 + </li>
4433 + <li>
4434 + <input type="radio" name="<?php echo self::$opt_maxres_facade; ?>" id="<?php echo self::$opt_maxres_facade; ?>_soft" value="soft" <?php checked($all[self::$opt_maxres_facade], 'soft'); ?>>
4435 + <label for="<?php echo self::$opt_maxres_facade; ?>_soft"> <?php _e("<em>Soft:</em> Load a relatively high resolution image that is guaranteed to exist, but immediately try updating the image to maximum resolution if it exists. This option is best for sites with some videos that may have a missing max resolution image.", 'text_domain') ?> </label> <br>
4436 + </li>
4437 + <li>
4438 + <input type="radio" name="<?php echo self::$opt_maxres_facade; ?>" id="<?php echo self::$opt_maxres_facade; ?>_off" value="off" <?php checked($all[self::$opt_maxres_facade], 'off'); ?>>
4439 + <label for="<?php echo self::$opt_maxres_facade; ?>_off"><?php _e("<em>Off:</em> Don't try to maximize facade image quality. Just load the relatively high resolution image that all videos have.", 'text_domain') ?></label> <br>
4440 + </li>
4441 + </ul>
4442 + </div>
4443 + </div>
4444 + <div class="p">
4445 + <input name="<?php echo self::$opt_defer_js; ?>" id="<?php echo self::$opt_defer_js; ?>" <?php checked($all[self::$opt_defer_js], 1); ?> type="checkbox" class="checkbox">
4446 + <label for="<?php echo self::$opt_defer_js ?>">
4447 + <b class="chktitle"><?php _e('Defer Javascript:', 'youtube-embed-plus'); ?></b>
4448 + <?php _e('JavaScript (JS) deferral is a common website performance option that can offer significant improvements of page speed. You can reduce the initial load time of your page by allowing this plugin\'s scripts to begin execution only after a page is loaded. You may receive a better GTMetrix score with this option turned on. Note: This feature is compatible with most sites, but turn it off if you are having issues.', 'youtube-embed-plus'); ?>
4449 + </label>
4450 + <div class="p box_defer_jquery">
4451 + <input name="<?php echo self::$opt_defer_jquery; ?>" id="<?php echo self::$opt_defer_jquery; ?>" type="checkbox" class="checkbox" <?php checked($all[self::$opt_defer_jquery], 1); ?>>
4452 + <label for="<?php echo self::$opt_defer_jquery ?>">
4453 + <b class="chktitle"><?php _e('Also Defer jQuery:', 'youtube-embed-plus'); ?></b>
4454 + <span style="color: red;">
4455 + <?php _e('Note: Do NOT check this option if you are using a pagebuilder. Furthermore, defering jQuery may improve your GTMetrix score even more, but might not be compatible with your theme or other plugins (especially if they are not defering their own scripts). Use this option with caution.', 'youtube-embed-plus'); ?>
4456 + </span>
4457 + </label>
4458 + </div>
4459 + </div>
4460 + <p><?php _e('Note: Since the YouTube player is loaded in its own iframe from YouTube\'s servers, browser restrictions prevent this plugin from directly deferring the JS inside the iframe. However, if you upgrade to Pro, you can use the lazy loading feature <a href="#jumpupgrade">described here &raquo;</a> to further improve your page speeds or try out facade mode.', 'youtube-embed-plus'); ?></p>
4461 + </section>
4462 +
4463 + <div class="save-changes-follow"> <?php self::save_changes_button(isset($_POST[$ytprefs_submitted]) && $_POST[$ytprefs_submitted] == 'Y'); ?> </div>
4464 + </form>
4465 +
4466 + <section class="pattern" id="jumpupgrade">
4467 + <div class="upgchecks">
4468 + <h3 class="sect">Want the PRO Features?</h3>
4469 + <p>
4470 + Below are descriptions for some of our PRO features for more gallery customization options, faster page loading, enhanced SEO, and more. Simply purchase and install our separate PRO plugin (the PRO plugin automatically works for all your past embed links).
4471 + </p>
4472 + <p>
4473 + <input disabled type="checkbox" class="checkbox">
4474 + <label>
4475 + <b class="chktitle">Lazy-Loading for Performance:</b> <span class="pronon">(PRO Users)</span>
4476 + Lazy-loading can speed up your page loads by loading the player only until it is visible on the screen.
4477 + <a href="https://www.youtube.com/watch?v=omNdJvXDCLo" target="_blank">See an example here</a>.
4478 + An added bonus to this option is that you have the choice of several types of eye-catching lazy-loading effects that will make your YouTube embeds bounce, flip, pulse, or slide as they lazy load on the screen. Check this box to select your desired effect. <a target="_blank" href="<?php echo self::$epbase ?>/add-special-effects-to-youtube-embeds-in-wordpress.aspx">Read more here &raquo;</a>
2969 4479 </label>
2970 4480 </p>
2971 4481 <div class="hr"></div>
2972 4482 <p>
2973 - <img class="ssfb" src="<?php echo plugins_url('images/youtube_thumbnail_sample.jpg', __FILE__) ?>" />
2974 - <input name="<?php echo self::$opt_ftpostimg; ?>" id="<?php echo self::$opt_ftpostimg; ?>" <?php checked($all[self::$opt_ftpostimg], 1); ?> type="checkbox" class="checkbox">
2975 - <label for="<?php echo self::$opt_ftpostimg; ?>">
2976 - <b>(PRO)</b> <b class="chktitle">Automatic Video Thumbnails: </b>
2977 - Automatically grab the thumbnail image of the first video embedded in each post or page, and use it as the featured image. If your theme can display featured images of posts on your blog home, you’ll see the thumbnails there as shown in the picture on the right. All you have to do is click Update on a post or page and the plugin does the rest!
2978 - (Example shown on the right) <a target="_blank" href="<?php echo self::$epbase ?>/add-youtube-video-thumbnails-featured-image-wordpress.aspx">Watch example here &raquo;</a>
4483 + <img class="ssaltgallery" src="<?php echo plugins_url('images/ss-live-chat.jpg', __FILE__) ?>" />
4484 + <input disabled type="checkbox" class="checkbox">
4485 + <label>
4486 + <b class="chktitle"><?php _e('Enable Live Chat:', 'youtube-embed-plus') ?></b> <span class="pronon"><?php _e('(PRO Users)', 'youtube-embed-plus') ?></span> <?php _e('<sup class="orange">new</sup>') ?> <?php _e('Add more interaction to your site by including the YouTube live chat box as part of each live stream embed. Note that live chat can also be an option for earning money from your audience by using the Super Chat feature. <a href="https://creatoracademy.youtube.com/page/lesson/superchat" target="_blank">Learn more here</a>.') ?>
4487 + <strong class="check-note"><?php _e('<span class="orange">NOTE:</span> In wide containers, the chat box will appear to the right of the player. It will appear below the player when the container is less than 964px. Also, Google/YouTube disables live chat on mobile devices. So for mobile phones and tablets, the chat box will be hidden.') ?></strong>
2979 4488 </label>
4489 + <br>
4490 + <br>
2980 4491 </p>
2981 -
2982 - <?php
2983 - }
2984 - else
2985 - {
2986 - ?>
2987 - <p class="smallnote orange">Below are PRO features for enhanced SEO and performance (works for even past embed links). </p>
4492 + <div class="hr"></div>
2988 4493 <p>
2989 4494 <img class="ssaltgallery" src="<?php echo plugins_url('images/ssaltgalleryall.jpg', __FILE__) ?>" />
2990 4495 <select disabled>
2991 4496 <option value="">Gallery Style</option>
@@ -2990,10 +4495,10 @@
2990 4495 <select disabled>
2991 4496 <option value="">Gallery Style</option>
2992 4497 </select>
2993 4498 <label>
2994 - <b class="chktitle">Alternate Gallery Styling: <sup class="orange">NEW</sup></b> <span class="pronon">(PRO Users)</span>
2995 - Switch from the grid style of the FREE version to another gallery style. Right now, we provide a vertical (single column) and horizontal (single row) list style as alternatives to the grid, with more designs coming. These current alternatives were inspired by the standard YouTube playlist player's "table of contents," except our gallery's video lists are always visible and shown under the playing video.
4499 + <b class="chktitle">Advanced Gallery Customization Options: </b> <span class="pronon">(PRO Users)</span>
4500 + Switch from the grid style of the free version to another gallery style. Right now, we provide a vertical (single column) and horizontal (single row) list style as alternatives to the grid, with more designs coming. These current alternatives were inspired by the standard YouTube playlist player's "table of contents," except our gallery's video lists are always visible and shown under the playing video.
2996 4501 <a target="_blank" href="<?php echo self::$epbase ?>/responsive-youtube-playlist-channel-gallery-for-wordpress.aspx">Read more here &raquo;</a>
2997 4502 </label>
2998 4503 </p>
2999 4504
@@ -3012,9 +4517,9 @@
3012 4517 <select disabled>
3013 4518 <option value="">Select Thumbnail Shape</option>
3014 4519 </select>
3015 4520 <label>
3016 - <b class="chktitle">Gallery Thumbnail Shape: <sup class="orange">NEW</sup></b> <span class="pronon">(PRO Users)</span>
4521 + <b class="chktitle">Gallery Thumbnail Shape: </b> <span class="pronon">(PRO Users)</span>
3017 4522 Differentiate your gallery by showing different thumbnail shapes. We currently offer rectangle and circle shapes.
3018 4523 <a target="_blank" href="<?php echo self::$epbase ?>/responsive-youtube-playlist-channel-gallery-for-wordpress.aspx">Read more here &raquo;</a>
3019 4524 </label>
3020 4525 </p>
@@ -3020,10 +4525,33 @@
3020 4525 </p>
3021 4526
3022 4527 <div class="hr"></div>
3023 4528 <p>
4529 + <img class="sspopupplayer" src="<?php echo plugins_url('images/sspopupplayer.jpg', __FILE__) ?>" />
4530 + <label>
4531 + <b class="chktitle">Gallery Video Display Mode: </b> <span class="pronon">(PRO Users)</span>
4532 + Display your gallery videos simply above the thumbnails (default), or as a popup lightbox. Choosing "popup lightbox" will make your videos lazy-loaded, which will provide some performance benefits since the YouTube player is not initially loaded with your page. It's loaded with a popup only when a user clicks a thumbnail.
4533 + </label>
4534 + <br>
4535 + <input type="radio" disabled> Default &nbsp; <input type="radio" disabled> Popup lightbox
4536 + </p>
4537 +
4538 + <div class="hr"></div>
4539 +
4540 + <p>
4541 + <img class="sshidethumbimg" src="<?php echo plugins_url('images/sshidethumbimg.jpg', __FILE__) ?>" />
3024 4542 <input disabled type="checkbox" class="checkbox">
3025 4543 <label>
4544 + <b class="chktitle">Hide Thumbnail Images:</b> <span class="pronon">(PRO Users)</span>
4545 + (For "Grid" and "Vertical List" gallery layouts only) Hide the image for each thumbnail, leaving just the text. This can improve performance when imagery is not important.
4546 + <a href="<?php echo self::$epbase ?>/responsive-youtube-playlist-channel-gallery-for-wordpress.aspx" target="_blank">See an example here &raquo;</a>
4547 + </label>
4548 + </p>
4549 +
4550 + <div class="hr"></div>
4551 + <p>
4552 + <input disabled type="checkbox" class="checkbox">
4553 + <label>
3026 4554 <b class="chktitle">Faster Page Loads (Caching): </b> <span class="pronon">(PRO Users)</span>
3027 4555 Use embed caching to speed up your page loads. By default, WordPress needs to request information from YouTube.com's servers for every video you embed, every time a page is loaded. These data requests can add time to your total page load time. Turn on this feature to cache that data (instead of having to request for the same information every time you load a page). This should then make your pages that have videos load faster. It's been noted that even small speed ups in page load can help increase visitor engagement, retention, and conversions. Caching also makes galleries run faster.
3028 4556 </label>
3029 4557 <div class="indent-option">
@@ -3035,9 +4563,8 @@
3035 4563 </div>
3036 4564 </p>
3037 4565 <div class="hr"></div>
3038 4566
3039 -
3040 4567 <p>
3041 4568 <input disabled type="checkbox" class="checkbox">
3042 4569 <label>
3043 4570 <b class="chktitle">Video SEO Tags:</b> <span class="pronon">(PRO Users)</span> Update your YouTube embeds with Google, Bing, and Yahoo friendly schema markup for videos.
@@ -3046,26 +4573,17 @@
3046 4573 <div class="hr"></div>
3047 4574 <p>
3048 4575 <input disabled type="checkbox" class="checkbox">
3049 4576 <label>
3050 - <b class="chktitle">Special Loading Effects:</b> <span class="pronon">(PRO Users)</span>
3051 - Add eye-catching special effects that will make your YouTube embeds bounce, flip, pulse, or slide as they load on the screen. Check this box to select your desired effect. <a target="_blank" href="<?php echo self::$epbase ?>/add-special-effects-to-youtube-embeds-in-wordpress.aspx">Read more here &raquo;</a>
4577 + <b class="chktitle">Facebook Open Graph Markup:</b> <span class="pronon">(PRO Users)</span> Include Facebook Open Graph markup with the videos you embed with this plugin. We follow the guidelines for videos as described here: <a href="https://developers.facebook.com/docs/sharing/webmasters#media" target="_blank">https://developers.facebook.com/docs/sharing/webmasters#media</a>
3052 4578 </label>
3053 4579 </p>
3054 4580 <div class="hr"></div>
3055 4581 <p>
3056 - <img class="ssfb" src="<?php echo plugins_url('images/ssfb.jpg', __FILE__) ?>" />
3057 - <input disabled type="checkbox" class="checkbox">
3058 - <label>
3059 - <b class="chktitle">Facebook Open Graph Markup:</b> <span class="pronon">(PRO Users)</span> Update YouTube embeds on your pages with Open Graph markup to enhance Facebook sharing and discovery of the pages. Your shared pages, for example, will also display embedded video thumbnails on Facebook Timelines.
3060 - </label>
3061 - </p>
3062 - <div class="hr"></div>
3063 - <p>
3064 4582 <img class="ssfb" src="<?php echo plugins_url('images/youtube_thumbnail_sample.jpg', __FILE__) ?>" />
3065 4583 <input disabled type="checkbox" class="checkbox">
3066 4584 <label>
3067 - <b class="chktitle">Automatic Video Thumbnails:</b> <span class="pronon">(PRO Users)</span>
4585 + <b class="chktitle">Featured Thumbnail Images:</b> <span class="pronon">(PRO Users)</span>
3068 4586 Automatically grab the thumbnail image of the first video embedded in each post or page, and use it as the featured image.
3069 4587 All you have to do is click Update on a post or page and the plugin does the rest!
3070 4588 (Example shown on the right) <a target="_blank" href="<?php echo self::$epbase ?>/add-youtube-video-thumbnails-featured-image-wordpress.aspx">Read more here &raquo;</a>
3071 4589 </label>
@@ -3071,243 +4589,60 @@
3071 4589 </label>
3072 4590 </p>
3073 4591 <div class="hr"></div>
3074 4592 <p>
3075 - <a href="<?php echo self::$epbase ?>/dashboard/pro-easy-video-analytics.aspx" target="_blank">Activate the above and several other features &raquo;</a>
3076 - </p>
3077 - <?php
3078 - }
3079 - ?>
3080 - <div class="clearboth"></div>
3081 - </div>
3082 - <?php // self::save_changes_button(); ?>
4593 + <a href="<?php echo self::$epbase ?>/dashboard/pro-easy-video-analytics.aspx?ref=protabfooter" target="_blank">Purchase and download the PRO plugin to get the above and several other features &raquo;</a>
4594 + </p>
4595 + <div class="clearboth"></div>
4596 + </div>
3083 4597
3084 - <hr>
4598 + </section>
3085 4599
4600 + <section class="pattern" id="jumpsupport">
4601 + <h2>Plugin Support</h2>
3086 4602
3087 - <div class="jumper" id="jumpoverride"></div>
3088 -
3089 - <h3 class="sect">
3090 - <?php _e("How To Override Defaults / Other Options") ?> <a href="#top" class="totop">&#9650; top</a>
3091 - </h3>
3092 - <p>Suppose you have a few videos that need to be different from the above defaults. You can add options to the end of a link as displayed below to override the above defaults. Each option should begin with '&'.
3093 - <br><span class="smallnote orange">PRO users: You can use the <a href="<?php echo self::$epbase . '/dashboard/pro-easy-video-analytics.aspx?ref=protab' ?>" target="_blank" class="button-primary cuz">&#9658; Customize</a> button that you will see inside the wizard, instead of memorizing the following.</span>
3094 - <?php
3095 - _e('<ul>');
3096 - _e("<li><strong>width</strong> - Sets the width of your player. If omitted, the default width will be the width of your theme's content.<em> Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&width=500</strong>&height=350</em></li>");
3097 - _e("<li><strong>height</strong> - Sets the height of your player. <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA&width=500<strong>&height=350</strong></em> </li>");
3098 - _e("<li><strong>autoplay</strong> - Set this to 1 to autoplay the video (or 0 to play the video once). <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&autoplay=1</strong></em> </li>");
3099 - _e("<li><strong>cc_load_policy</strong> - Set this to 1 to turn on closed captioning (or 0 to leave them off). <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&cc_load_policy=1</strong></em> </li>");
3100 - _e("<li><strong>iv_load_policy</strong> - Set this to 3 to turn off annotations (or 1 to show them). <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&iv_load_policy=3</strong></em> </li>");
3101 - _e("<li><strong>loop</strong> - Set this to 1 to loop the video (or 0 to not loop). <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&loop=1</strong></em> </li>");
3102 - _e("<li><strong>modestbranding</strong> - Set this to 1 to remove the YouTube logo while playing (or 0 to show the logo). <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&modestbranding=1</strong></em> </li>");
3103 - _e("<li><strong>rel</strong> - Set this to 0 to not show related videos at the end of playing (or 1 to show them). <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&rel=0</strong></em> </li>");
3104 - _e("<li><strong>showinfo</strong> - Set this to 0 to hide the video title and other info (or 1 to show it). <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&showinfo=0</strong></em> </li>");
3105 - _e("<li><strong>theme</strong> - Set this to 'light' to make the player have the light-colored theme (or 'dark' for the dark theme). <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&theme=light</strong></em> </li>");
3106 - _e("<li><strong>color</strong> - Set this to 'white' to make the player have a white progress bar (or 'red' for a red progress bar). Note: Using white will disable the modestbranding option. <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&color=white</strong></em> </li>");
3107 - _e("<li><strong>vq</strong> - Set this to 'hd720' or 'hd1080' to force the video to have HD quality. Leave blank to let YouTube decide. <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&vq=hd720</strong></em> </li>");
3108 - _e("<li><strong>controls</strong> - Set this to 0 to completely hide the video controls (or 2 to show it). <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&controls=0</strong></em> </li>");
3109 - _e("<li><strong>autohide</strong> - Set this to 1 to slide away the control bar after the video starts playing. It will automatically slide back in again if you mouse over the video. (Set to 2 to always show it). <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&autohide=1</strong></em> </li>");
3110 - _e("<li><strong>playsinline</strong> - Set this to 1 to allow videos play inline with the page on iOS browsers. (Set to 0 to have iOS launch videos in fullscreen instead). <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&playsinline=1</strong></em> </li>");
3111 - _e("<li><strong>origin</strong> - Set this to 1 to add the 'origin' parameter for extra JavaScript security. <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&origin=1</strong></em> </li>");
3112 - _e('</ul>');
3113 -
3114 - _e("<p>You can also start and end each individual video at particular times. Like the above, each option should begin with '&'</p>");
3115 - _e('<ul>');
3116 - _e("<li><strong>start</strong> - Sets the time (in seconds) to start the video. <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA&width=500&height=350<strong>&start=20</strong></em> </li>");
3117 - _e("<li><strong>end</strong> - Sets the time (in seconds) to stop the video. <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA&width=500&height=350<strong>&end=100</strong></em> </li>");
3118 - _e('</ul>');
3119 - ?>
3120 - <div class="save-changes-follow"> <?php self::save_changes_button(isset($_POST[$ytprefs_submitted]) && $_POST[$ytprefs_submitted] == 'Y'); ?> </div>
3121 - </form>
3122 - <div class="jumper" id="jumppro"></div>
3123 - <div id="goprobox">
3124 - <?php
3125 - if ($all[self::$opt_pro] && strlen(trim($all[self::$opt_pro])) > 0)
3126 - {
3127 - echo "<h3>" . __('Thank you for going PRO.');
3128 - echo ' &nbsp;<input type="submit" name="showkey" class="button-primary" style="vertical-align: 15%;" id="showprokey" value="View my PRO key" />';
3129 - echo "</h3>";
3130 - ?>
3131 - <?php
3132 - }
3133 - else
3134 - {
3135 - ?>
3136 -
3137 - <h3 class="sect">
3138 - <a href="<?php echo self::$epbase ?>/dashboard/pro-easy-video-analytics.aspx" class="button-primary" target="_blank">Want to go PRO? (Low Prices) &raquo;</a> &nbsp;
3139 - PRO users help keep new features coming and our coffee cups filled. Go PRO and get these perks in return:
3140 - </h3>
3141 - <div class="procol">
3142 - <ul class="gopro">
3143 - <li>
3144 - <img src="<?php echo plugins_url('images/iconcache.png', __FILE__) ?>">
3145 - Faster Page Loads (Caching)
4603 + <div id="nonprosupport">
4604 + <p>
4605 + Here is a short video explaining a few of the plugin's features:
4606 + </p>
4607 + <div class="epyt-fitvid">
4608 + <iframe allow="fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" src="https://www.youtube.com/embed/QDdvXBqfrzM?rel=0" allowfullscreen="" frameborder="0"></iframe>
4609 + </div>
4610 + <p>
4611 + We've also found that a common support request has been from users that are pasting video links on single lines, as required, but are not seeing the video embed show up. One of these suggestions is usually the fix:
4612 + </p>
4613 + <ul class="reglist">
4614 + <li>Make sure the URL is really on its own line by itself. Or, if you need multiple videos on the same line, make sure each URL is wrapped properly with the shortcode (Example: <code>[embedyt]http://www.youtube.com/watch?v=ABCDEFGHIJK&width=400&height=250[/embedyt]</code>)</li>
4615 + <li>Make sure the URL is not an active hyperlink (i.e., it should just be plain text). Otherwise, highlight the URL and click the "unlink" button in your editor: <img src="<?php echo plugins_url('images/unlink.png', __FILE__) ?>"/>.</li>
4616 + <li>Make sure you did <strong>not</strong> format or align the URL in any way. If your URL still appears in your actual post instead of a video, highlight it and click the "remove formatting" button (formatting can be invisible sometimes): <img src="<?php echo plugins_url('images/erase.png', __FILE__) ?>"/></li>
4617 + <li>Try wrapping the URL with the <code>[embedyt]...[/embedyt]</code> shortcode. For example: <code>[embedyt]http://www.youtube.com/watch?v=ABCDEFGHIJK[/embedyt]</code> Using the shortcode also allows you to have two or more videos next to each other on the same line. Just put the shortcoded links together on the same line. For example:<br>
4618 + <code>[embedyt]http://www.youtube.com/watch?v=ABCDEF&width=400&height=250[/embedyt] [embedyt]http://www.youtube.com/watch?v=GHIJK&width=400&height=250[/embedyt]</code>
4619 + <br> TIP: As shown above, decrease the size of each video so that they fit together on the same line (See the "How To Override Defaults" section for height and width instructions)
3146 4620 </li>
3147 - <li>
3148 - <img src="<?php echo plugins_url('images/iconwizard.png', __FILE__) ?>">
3149 - Full Visual Embedding Wizard (Easily customize embeds without memorizing codes)
3150 - </li>
3151 - <li>
3152 - <img src="<?php echo plugins_url('images/icongallery.png', __FILE__) ?>">
3153 - Alternate Gallery Styling
3154 - </li>
3155 - <li>
3156 - <img src="<?php echo plugins_url('images/iconfx.png', __FILE__) ?>">
3157 - Add eye-catching special effects as your videos load
3158 - </li>
3159 - <li>
3160 - <img src="<?php echo plugins_url('images/deletechecker.png', __FILE__) ?>">
3161 - Deleted Video Checker (alerts you if YouTube deletes videos you embedded)
3162 - </li>
3163 - <li>
3164 - <img src="<?php echo plugins_url('images/globe.png', __FILE__) ?>">
3165 - Alerts when visitors from different countries are blocked from viewing your embeds
3166 - </li>
3167 - <li>
3168 - <img src="<?php echo plugins_url('images/mobilecompat.png', __FILE__) ?>">
3169 - Check if your embeds have restrictions that can block mobile viewing
3170 - </li>
3171 -
4621 + <li>If you upload a new video to a playlist or channel and that video is not yet showing up on a gallery you embedded, you should clear/reset any caching plugins you have. This will force your site to retrieve the freshest version of your playlist and/or channel video listing. If you don't reset you cache, then you'll have to wait until cache lifetime expires.</li>
4622 + <li>Finally, there's a slight chance your custom theme is the issue, if you have one. To know for sure, we suggest temporarily switching to one of the default WordPress themes (e.g., "Twenty Fourteen") just to see if your video does appear. If it suddenly works, then your custom theme is the issue. You can switch back when done testing.</li>
4623 + <li>If your videos always appear full size, try turning off "Responsive video sizing."</li>
4624 + <li>If none of the above work, you can contact us here if you still have issues: ext@embedplus.com. We'll try to respond within a week.</li>
3172 4625 </ul>
4626 + <p>
4627 + Deactivating the No Cookies option has also been proven to solve player errors.
4628 + </p>
4629 + <p>
4630 + We also have a YouTube channel. We use it to provide users with some helper videos and a way to keep updated on new features as they are introduced. <a href="https://www.youtube.com/subscription_center?add_user=EmbedPlus" target="_blank">Subscribe for tips and updates here &raquo;</a>
4631 + </p>
3173 4632 </div>
3174 - <div class="procol" style="max-width: 465px;">
3175 - <ul class="gopro">
3176 - <li>
3177 - <img src="<?php echo plugins_url('images/videothumbs.png', __FILE__) ?>">
3178 - Automatic video thumbnail images (just click 'Update')
3179 - </li>
3180 - <li>
3181 - <img src="<?php echo plugins_url('images/prioritysupport.png', __FILE__) ?>">
3182 - Priority support (Puts your request in front)
3183 - </li>
3184 - <li>
3185 - <img src="<?php echo plugins_url('images/bulletgraph45.png', __FILE__) ?>">
3186 - User-friendly video analytics dashboard
3187 - </li>
3188 -
3189 - <li id="fbstuff">
3190 - <img src="<?php echo plugins_url('images/iconfb.png', __FILE__) ?>">
3191 - Automatic Open Graph tagging for Facebook
3192 - </li>
3193 - <!-- <li>
3194 - <img src="<?php echo plugins_url('images/iconythealth.png', __FILE__) ?>">
3195 - Instant YouTube embed diagnostic reports
3196 - </li> -->
3197 - <li>
3198 - <img src="<?php echo plugins_url('images/vseo.png', __FILE__) ?>">
3199 - Automatic tagging for video SEO (will even work for your old embeds)
3200 - </li>
3201 - <li>
3202 - <img src="<?php echo plugins_url('images/iconvolume.png', __FILE__) ?>">
3203 - Fine-Grained Volume Initialization – Individual video volume settings in the wizard
3204 - </li>
3205 -
3206 - <li>
3207 - <img src="<?php echo plugins_url('images/infinity.png', __FILE__) ?>">
3208 - Unlimited PRO upgrades and downloads
3209 - </li>
3210 - <!-- <li>
3211 - <img src="<?php echo plugins_url('images/questionsale.png', __FILE__) ?>">
3212 - What else? You tell us!
3213 - </li> -->
3214 - </ul>
3215 - </div>
3216 - <div style="clear: both;"></div>
3217 4633 <br>
3218 - <h3 class="bold">Enter and save your PRO key (emailed to you):</h3>
3219 - <?php } ?>
3220 - <form name="form2" method="post" action="" id="epform2" class="submitpro" <?php
3221 - if ($all[self::$opt_pro] && strlen(trim($all[self::$opt_pro])) > 0)
3222 - {
3223 - echo 'style="display: none;"';
3224 - }
3225 - ?>>
3226 -
3227 - <input name="<?php echo self::$opt_pro; ?>" id="opt_pro" value="<?php echo $all[self::$opt_pro]; ?>" type="text">
3228 - <input type="submit" name="Submit" class="button-primary" id="prokeysubmit" value="<?php _e('Save Key') ?>" />
3229 - <?php
3230 - if (!($all[self::$opt_pro] && strlen(trim($all[self::$opt_pro])) > 0))
3231 - {
3232 - ?>
3233 - &nbsp; &nbsp; &nbsp; <span style="font-size: 25px; color: #cccccc;">|</span> &nbsp; &nbsp; &nbsp; <a href="<?php echo self::$epbase ?>/dashboard/pro-easy-video-analytics.aspx" class="button-primary brightpro" target="_blank">Click here to go PRO &raquo;</a>
3234 - <?php
3235 - }
3236 - ?>
3237 - <br>
3238 - <span style="display: none;" id="prokeyloading" class="orange bold">Verifying...</span>
3239 - <span class="orange bold" style="display: none;" id="prokeysuccess">Success! Please refresh this page.</span>
3240 - <span class="orange bold" style="display: none;" id="prokeyfailed">Sorry, that seems to be an invalid key, or it has been used already.</span>
3241 -
3242 - </form>
3243 -
4634 + </section>
3244 4635 </div>
3245 - <div class="smallnote">
3246 - <!--&nbsp; *Upcoming: We've started developing a feature that will recommend YouTube embeds that you might want to include in a post while you're actually<br>
3247 - writing/editing. It will apply some experimental artificial intelligence techniques on your post content for these recommendations, all at the click of a button.
3248 - -->
3249 - </div>
3250 - <div class="jumper" id="jumpsupport"></div>
3251 - <div id="nonprosupport">
3252 - <h3 class="bold">Support tips for all users (Free and PRO)</h3>
3253 - We've found that a common support request has been from users that are pasting video links on single lines, as required, but are not seeing the video embed show up. One of these suggestions is usually the fix:
3254 - <ul class="reglist">
3255 - <li>Make sure the URL is really on its own line by itself. Or, if you need multiple videos on the same line, make sure each URL is wrapped properly with the shortcode (Example: <code>[embedyt]http://www.youtube.com/watch?v=ABCDEFGHIJK&width=400&height=250[/embedyt]</code>)</li>
3256 - <li>Make sure the URL is not an active hyperlink (i.e., it should just be plain text). Otherwise, highlight the URL and click the "unlink" button in your editor: <img src="<?php echo plugins_url('images/unlink.png', __FILE__) ?>"/>.</li>
3257 - <li>Make sure you did <strong>not</strong> format or align the URL in any way. If your URL still appears in your actual post instead of a video, highlight it and click the "remove formatting" button (formatting can be invisible sometimes): <img src="<?php echo plugins_url('images/erase.png', __FILE__) ?>"/></li>
3258 - <li>Try wrapping the URL with the <code>[embedyt]...[/embedyt]</code> shortcode. For example: <code>[embedyt]http://www.youtube.com/watch?v=ABCDEFGHIJK[/embedyt]</code> Using the shortcode also allows you to have two or more videos next to each other on the same line. Just put the shortcoded links together on the same line. For example:<br>
3259 - <code>[embedyt]http://www.youtube.com/watch?v=ABCDEF&width=400&height=250[/embedyt] [embedyt]http://www.youtube.com/watch?v=GHIJK&width=400&height=250[/embedyt]</code>
3260 - <br> TIP: As shown above, decrease the size of each video so that they fit together on the same line (See the "How To Override Defaults" section for height and width instructions)
3261 - </li>
3262 - <li>Finally, there's a slight chance your custom theme is the issue, if you have one. To know for sure, we suggest temporarily switching to one of the default WordPress themes (e.g., "Twenty Fourteen") just to see if your video does appear. If it suddenly works, then your custom theme is the issue. You can switch back when done testing.</li>
3263 - <li>If your videos always appear full size, try turning off "Responsive video sizing."</li>
3264 - <li>If none of the above work, you can contact us here if you still have issues: ext@embedplus.com. We'll try to respond within a week. PRO users should use the priority form below for faster replies.</li>
3265 - </ul>
3266 - <p>
3267 - Deactivating the No Cookies option has also been proven to solve player errors.
3268 - </p>
3269 - <p>
3270 - We also have a YouTube channel. We use it to provide users with some helper videos and a way to keep updated on new features as they are introduced. <a href="https://www.youtube.com/subscription_center?add_user=EmbedPlus" target="_blank">Subscribe for tips and updates here &raquo;</a>
3271 - </p>
3272 - </div>
3273 - <br>
3274 - <h3 class="sect">
3275 - Priority Support <span class="pronon">(<a href="<?php echo self::$epbase ?>/dashboard/pro-easy-video-analytics.aspx" target="_blank">PRO Users &raquo;</a>)</span><a href="#top" class="totop">&#9650; top</a>
3276 - </h3>
3277 - <p>
3278 - <strong>PRO users:</strong> Below, We've enabled the ability to have priority support with our team. Use this to get one-on-one help with any issues you might have or to send us suggestions for future features. We typically respond within minutes during normal work hours. We're always happy to accept any testimonials you might have as well.
3279 - </p>
3280 -
3281 -
3282 - <iframe src="<?php echo self::$epbase ?>/dashboard/prosupport.aspx?simple=1&prokey=<?php echo $all[self::$opt_pro]; ?>&domain=<?php echo site_url(); ?>" width="500" height="<?php echo ($all[self::$opt_pro] && strlen(trim($all[self::$opt_pro])) > 0) ? "500" : "140"; ?>"></iframe>
3283 -
3284 - <?php
3285 - if (!($all[self::$opt_pro] && strlen(trim($all[self::$opt_pro])) > 0))
4636 + </div>
4637 + <script type="text/javascript">
4638 + (function ($)
3286 4639 {
3287 - ?>
3288 - <br>
3289 - <br>
3290 - <iframe src="<?php echo self::$epbase ?>/dashboard/likecoupon.aspx" width="600" height="500"></iframe>
3291 - <?php }
3292 - ?>
3293 - <div class="ytnav">
3294 - <a href="#jumphowto">How To Embed</a>
3295 - <a href="#jumpwiz">Visual Wizard</a>
3296 - <a href="#jumpdefaults">Defaults</a>
3297 - <a href="#jumpcompat">Compatibility</a>
3298 - <a href="#jumpgallery">Gallery Settings</a>
3299 - <a href="#jumpoverride">Override Defaults</a>
3300 - <a target="_blank" href="<?php echo self::$epbase . "/dashboard/pro-easy-video-analytics.aspx?ref=protab" ?>" style="border-color: #888888;">Upgrade?</a>
3301 - <a href="#jumpsupport">Support</a>
3302 - </div>
3303 -
3304 -
3305 - <script type="text/javascript">
3306 -
3307 - function savevalidate()
4640 + window.savevalidate = function (e)
3308 4641 {
4642 + var $formDefaults = $(e.target);
3309 4643 var valid = true;
4644 + var $tabFocus = '';
3310 4645 var alertmessage = '';
3311 4646 if (jQuery("#<?php echo self::$opt_defaultdims; ?>").is(":checked"))
3312 4647 {
3313 4648 if (!(jQuery.isNumeric(jQuery.trim(jQuery("#<?php echo self::$opt_defaultwidth; ?>").val())) &&
@@ -3315,8 +4650,9 @@
3315 4650 {
3316 4651 alertmessage += "Please enter valid numbers for default height and width, or uncheck the option.";
3317 4652 jQuery("#boxdefaultdims input").css("background-color", "#ffcccc").css("border", "2px solid #000000");
3318 4653 valid = false;
4654 + $tabFocus = $("#<?php echo self::$opt_defaultdims; ?>").closest('section');
3319 4655 }
3320 4656 }
3321 4657
3322 4658 if (jQuery("#<?php echo self::$opt_gallery_customarrows; ?>").is(":checked"))
@@ -3326,80 +4662,138 @@
3326 4662 {
3327 4663 alertmessage += "Please enter valid text for both the custom gallery Prev and Next buttons, or uncheck the option.";
3328 4664 jQuery("#boxcustomarrows input").css("background-color", "#ffcccc").css("border", "2px solid #000000");
3329 4665 valid = false;
4666 + $tabFocus = $("#<?php echo self::$opt_gallery_customarrows; ?>").closest('section');
3330 4667 }
3331 4668 }
3332 4669
3333 - if (jQuery("#<?php echo self::$opt_defaultvol; ?>").is(":checked"))
4670 +
4671 + if (jQuery("#<?php echo self::$opt_gallery_channelsub; ?>").is(":checked"))
3334 4672 {
3335 - if (!(jQuery.isNumeric(jQuery.trim(jQuery("#<?php echo self::$opt_vol; ?>").val()))))
4673 + if (!jQuery.trim(jQuery("#<?php echo self::$opt_gallery_channelsublink; ?>").val()) ||
4674 + !jQuery.trim(jQuery("#<?php echo self::$opt_gallery_channelsubtext; ?>").val()))
3336 4675 {
3337 - alertmessage += "Please enter a number between 0 and 100 for the default volume, or uncheck the option.";
3338 - jQuery("#boxdefaultvol input").css("background-color", "#ffcccc").css("border", "2px solid #000000");
4676 + alertmessage += "Please enter valid text for both the subscribe text and subscribe URL, or uncheck the option.";
4677 + jQuery("#boxchannelsub input").css("background-color", "#ffcccc").css("border", "2px solid #000000");
3339 4678 valid = false;
4679 + $tabFocus = $("#<?php echo self::$opt_gallery_channelsub; ?>").closest('section');
3340 4680 }
3341 4681 }
3342 4682
3343 - if (jQuery("#<?php echo self::$opt_spdc; ?>").is(":checked"))
4683 +
4684 + if (jQuery("#<?php echo self::$opt_gallery_collapse_grid; ?>").is(":checked"))
3344 4685 {
3345 - if (!(jQuery.isNumeric(jQuery.trim(jQuery("#<?php echo self::$opt_spdcexp; ?>").val()))))
4686 + var emptyStacks = [];
4687 + jQuery("#box_collapse_grid input").each(function ()
3346 4688 {
3347 - alertmessage += "Please enter a valid number of hours (greater than 0) for the cache lifetime, or uncheck the option.";
3348 - jQuery("#boxspdc input[type=number], #boxspdc input[type=text]").css("background-color", "#ffcccc").css("border", "2px solid #000000");
4689 + var val = jQuery(this).val();
4690 + if (jQuery.trim(val) === '' || !jQuery.isNumeric(val))
4691 + {
4692 + emptyStacks.push(this);
4693 + jQuery(this).css("background-color", "#ffcccc").css("outline", "2px solid #000000");
4694 + }
4695 + });
4696 + if (emptyStacks.length)
4697 + {
4698 + alertmessage += "Please enter a valid number for the gallery stacking screen width.";
3349 4699 valid = false;
4700 + $tabFocus = $("#<?php echo self::$opt_gallery_collapse_grid; ?>").closest('section');
3350 4701 }
3351 4702 }
3352 4703
3353 4704
3354 4705
3355 - if (jQuery("#<?php echo self::$opt_schemaorg; ?>").is(":checked"))
4706 + if (jQuery("#<?php echo self::$opt_defaultvol; ?>").is(":checked"))
3356 4707 {
3357 - if (!(jQuery.trim(jQuery("#<?php echo self::$opt_apikey; ?>").val()).length > 0))
4708 + if (!(jQuery.isNumeric(jQuery.trim(jQuery("#<?php echo self::$opt_vol; ?>").val()))))
3358 4709 {
3359 - alertmessage += "Please enter a valid YouTube API key, or uncheck the 'Video SEO Tags' option.";
3360 - jQuery("#boxschemaorg input").css("background-color", "#ffcccc").css("border", "2px solid #000000");
4710 + alertmessage += "Please enter a number between 0 and 100 for the default volume, or uncheck the option.";
4711 + jQuery("#boxdefaultvol input").css("background-color", "#ffcccc").css("border", "2px solid #000000");
3361 4712 valid = false;
4713 + $tabFocus = $("#<?php echo self::$opt_defaultvol; ?>").closest('section');
3362 4714 }
3363 4715 }
3364 4716
4717 + if (!valid)
4718 + {
4719 + alertify.alert(alertmessage);
4720 + var tabSelector = '.wrap-ytprefs .nav-tab-wrapper .nav-tab[href=#' + $tabFocus.attr('id') + ']';
4721 + $(tabSelector).trigger('click');
4722 + }
4723 + if (!$formDefaults.find('#ajax_save').is(':checked'))
4724 + {
4725 + return valid;
4726 + }
4727 + //////////////////////////////////////////////////////////////////////////////////////////////////////////////// MAIN PREFS AJAX SAVE
4728 + if (valid)
4729 + {
4730 + e.preventDefault();
4731 + (window.tinyMCE || window.tinymce).triggerSave();
4732 + $formDefaults.find('.ytprefs-submit').prop('disabled', true);
3365 4733
4734 + var formData = $formDefaults.ytprefsFormJSON();
4735 + formData.action = 'my_embedplus_settings_save_ajax';
3366 4736
3367 - if (jQuery("#<?php echo self::$opt_dynload; ?>").is(":checked"))
4737 + $.ajax({
4738 + type: "post",
4739 + dataType: "json",
4740 + timeout: 30000,
4741 + url: window._EPYTA_ ? window._EPYTA_.wpajaxurl : ajaxurl,
4742 + data: formData,
4743 + success: function (response)
4744 + {
4745 + alertify.alert(response ? response.message : 'Sorry, there was an error submitting your settings.', function ()
4746 + {
4747 + if (response.type == 'success')
4748 + {
4749 + window.top.location.href = window._EPYTA_.admin_url_ytprefs;
4750 + }
4751 + });
4752 + },
4753 + error: function (xhr, ajaxOptions, thrownError)
4754 + {
4755 + alertify.alert('Sorry, there was an error saving your settings. ' + (thrownError ? thrownError : ''));
4756 + },
4757 + complete: function ()
4758 + {
4759 + $formDefaults.find('.ytprefs-submit').prop('disabled', false);
4760 + }
4761 + });
4762 + }
4763 + };
4764 +
4765 + var mydomain = escape("http://" + window.location.host.toString());
4766 + jQuery(document).ready(function ($)
4767 + {
4768 + $(document).on('click', '.wrap-ytprefs .nav-tab-wrapper a, .epyt-jumptab', function ()
3368 4769 {
3369 - if (!(/^[A-Za-z-]+$/.test(jQuery.trim(jQuery("#<?php echo self::$opt_dyntype; ?>").val()))))
4770 + $a = $(this);
4771 + if (!$a.hasClass('href-link'))
3370 4772 {
3371 - alertmessage += "Please select an animation, or uncheck the option.";
3372 - jQuery("#boxdyn select").css("background-color", "#ffcccc").css("border", "2px solid #000000");
3373 - valid = false;
4773 + $('.wrap-ytprefs .nav-tab-wrapper a').removeClass('nav-tab-active');
4774 + $a.addClass('nav-tab-active');
4775 + $('.wrap-ytprefs section').hide();
4776 + $('.wrap-ytprefs section').filter($a.attr('rel') ? $a.attr('rel') : $a.attr('href')).fadeIn(200);
4777 + return false;
3374 4778 }
3375 - }
4779 + });
3376 4780
3377 -
3378 -
3379 -
3380 - // if (jQuery("#<?php echo self::$opt_dohl; ?>").is(":checked"))
3381 - // {
3382 - // if (!(/^[A-Za-z][A-Za-z]$/.test(jQuery.trim(jQuery("#<?php echo self::$opt_hl; ?>").val()))))
3383 - // {
3384 - // alertmessage += "Please enter a valid 2-letter language code.";
3385 - // jQuery("#boxdohl input").css("background-color", "#ffcccc").css("border", "2px solid #000000");
3386 - // valid = false;
3387 - // }
3388 - // }
3389 -
3390 - if (!valid)
4781 + if (window.location.hash && window.location.hash == '#jumpmonetize')
3391 4782 {
3392 - alert(alertmessage);
4783 + setTimeout(function ()
4784 + {
4785 + window.scrollTo(0, 0);
4786 + }, 1);
4787 + $('.wrap-ytprefs .nav-tab-wrapper a[href="' + window.location.hash + '"]').trigger('click');
3393 4788 }
3394 - return valid;
3395 - }
3396 4789
3397 - var prokeyval;
3398 - var mydomain = escape("http://" + window.location.host.toString());
4790 + $('#ytform').on('submit', function (e)
4791 + {
4792 + return window.savevalidate(e);
4793 + });
3399 4794
3400 - jQuery(document).ready(function ($) {
3401 - jQuery('#<?php echo self::$opt_defaultdims; ?>').change(function ()
4795 + jQuery('#<?php echo self::$opt_defaultdims; ?>').on('change', function ()
3402 4796 {
3403 4797 if (jQuery(this).is(":checked"))
3404 4798 {
3405 4799 jQuery("#boxdefaultdims").show(500);
@@ -3409,10 +4803,9 @@
3409 4803 jQuery("#boxdefaultdims").hide(500);
3410 4804 }
3411 4805
3412 4806 });
3413 -
3414 - jQuery('#<?php echo self::$opt_gallery_customarrows; ?>').change(function ()
4807 + jQuery('#<?php echo self::$opt_gallery_customarrows; ?>').on('change', function ()
3415 4808 {
3416 4809 if (jQuery(this).is(":checked"))
3417 4810 {
3418 4811 jQuery("#boxcustomarrows").show(500);
@@ -3422,36 +4815,44 @@
3422 4815 jQuery("#boxcustomarrows").hide(500);
3423 4816 }
3424 4817
3425 4818 });
3426 -
3427 - jQuery('#<?php echo self::$opt_dynload; ?>').change(function ()
4819 + jQuery('#<?php echo self::$opt_gallery_collapse_grid; ?>').on('change', function ()
3428 4820 {
3429 4821 if (jQuery(this).is(":checked"))
3430 4822 {
3431 - jQuery("#boxdyn").show(500);
4823 + jQuery("#box_collapse_grid").show(500);
3432 4824 }
3433 4825 else
3434 4826 {
3435 - jQuery("#boxdyn").hide(500);
4827 + jQuery("#box_collapse_grid").hide(500);
3436 4828 }
3437 -
3438 4829 });
3439 -
3440 - jQuery('#<?php echo self::$opt_spdc; ?>').change(function ()
4830 + jQuery('#<?php echo self::$opt_restrict_wizard; ?>').on('change', function ()
3441 4831 {
3442 4832 if (jQuery(this).is(":checked"))
3443 4833 {
3444 - jQuery("#boxspdc").show(500);
4834 + jQuery("#box_restrict_wizard").show(500);
3445 4835 }
3446 4836 else
3447 4837 {
3448 - jQuery("#boxspdc").hide(500);
4838 + jQuery("#box_restrict_wizard").hide(500);
3449 4839 }
3450 4840 });
3451 4841
4842 + jQuery('#<?php echo self::$opt_gallery_channelsub; ?>').on('change', function ()
4843 + {
4844 + if (jQuery(this).is(":checked"))
4845 + {
4846 + jQuery("#boxchannelsub").show(500);
4847 + }
4848 + else
4849 + {
4850 + jQuery("#boxchannelsub").hide(500);
4851 + }
3452 4852
3453 - jQuery('#<?php echo self::$opt_responsive; ?>').change(function ()
4853 + });
4854 + jQuery('#<?php echo self::$opt_responsive; ?>').on('change', function ()
3454 4855 {
3455 4856 if (jQuery(this).is(":checked"))
3456 4857 {
3457 4858 jQuery("#boxresponsive_all").show(500);
@@ -3460,12 +4861,9 @@
3460 4861 {
3461 4862 jQuery("#boxresponsive_all").hide(500);
3462 4863 }
3463 4864 });
3464 -
3465 -
3466 -
3467 - jQuery('#<?php echo self::$opt_migrate; ?>').change(function ()
4865 + jQuery('#<?php echo self::$opt_migrate; ?>').on('change', function ()
3468 4866 {
3469 4867 if (jQuery(this).is(":checked"))
3470 4868 {
3471 4869 jQuery("#boxmigratelist").show(500);
@@ -3474,12 +4872,9 @@
3474 4872 {
3475 4873 jQuery("#boxmigratelist").hide(500);
3476 4874 }
3477 4875 });
3478 -
3479 -
3480 -
3481 - jQuery('#<?php echo self::$opt_nocookie; ?>').change(function ()
4876 + jQuery('#<?php echo self::$opt_nocookie; ?>').on('change', function ()
3482 4877 {
3483 4878 if (jQuery(this).is(":checked"))
3484 4879 {
3485 4880 jQuery("#boxnocookie").show(500);
@@ -3489,38 +4884,22 @@
3489 4884 jQuery("#boxnocookie").hide(500);
3490 4885 }
3491 4886
3492 4887 });
3493 -
3494 - jQuery('#<?php echo self::$opt_schemaorg; ?>').change(function ()
4888 + jQuery('#<?php echo self::$opt_gdpr_consent; ?>').on('change', function ()
3495 4889 {
3496 4890 if (jQuery(this).is(":checked"))
3497 4891 {
3498 - jQuery("#boxschemaorg").show(500);
4892 + jQuery("#box_gdpr_consent").show(500);
3499 4893 }
3500 4894 else
3501 4895 {
3502 - jQuery("#boxschemaorg").hide(500);
4896 + jQuery("#box_gdpr_consent").hide(500);
3503 4897 }
4898 +
3504 4899 });
3505 4900
3506 -
3507 - // jQuery('#<?php echo self::$opt_dohl; ?>').change(function()
3508 - // {
3509 - // if (jQuery(this).is(":checked"))
3510 - // {
3511 - // jQuery("#boxdohl").show(500);
3512 - // }
3513 - // else
3514 - // {
3515 - // jQuery("#boxdohl").hide(500);
3516 - // }
3517 - //
3518 - // });
3519 -
3520 -
3521 -
3522 - jQuery('#<?php echo self::$opt_defaultvol; ?>').change(function ()
4901 + jQuery('#<?php echo self::$opt_defaultvol; ?>').on('change', function ()
3523 4902 {
3524 4903 if (jQuery(this).is(":checked"))
3525 4904 {
3526 4905 jQuery("#boxdefaultvol").show(500);
@@ -3530,9 +4909,8 @@
3530 4909 jQuery("#boxdefaultvol").hide(500);
3531 4910 }
3532 4911
3533 4912 });
3534 -
3535 4913 var rangedetect = document.createElement("input");
3536 4914 rangedetect.setAttribute("type", "range");
3537 4915 var canrange = rangedetect.type !== "text";
3538 4916 //canrange = false;
@@ -3537,9 +4915,10 @@
3537 4915 var canrange = rangedetect.type !== "text";
3538 4916 //canrange = false;
3539 4917 if (canrange)
3540 4918 {
3541 - $("input#vol").prop("type", "range").addClass("vol-range").on("input change", function () {
4919 + $("input#vol").prop("type", "range").addClass("vol-range").on("input change", function ()
4920 + {
3542 4921 $('.vol-output').text($(this).val() > 0 ? $(this).val() + '%' : 'Mute');
3543 4922 });
3544 4923 $('.vol-output').css("display", "inline-block").text($("input#vol").val() > 0 ? $("input#vol").val() + '%' : 'Mute');
3545 4924 $('.vol-seeslider').show();
@@ -3549,448 +4928,1195 @@
3549 4928 {
3550 4929 $("input#vol").width(40);
3551 4930 }
3552 4931
4932 + $('#defer_js').on('change', function ()
4933 + {
4934 + if (!$(this).is(':checked'))
4935 + {
4936 + $('#defer_jquery').prop('checked', false).prop('disabled', true);
4937 + }
4938 + else
4939 + {
4940 + $('#defer_jquery').prop('disabled', false);
4941 + }
4942 + });
3553 4943
3554 - jQuery('#boxspdc input.button').click(function () {
3555 - jQuery('#clearspdcloading').show();
3556 - jQuery('#clearspdcfailed').hide();
3557 - jQuery('#clearspdcsuccess').hide();
4944 + });
4945 + })(jQuery);
4946 + </script>
3558 4947
3559 - $clearbutton = jQuery(this);
3560 - $clearbutton.attr('disabled', 'disabled');
4948 + <a href="<?php echo esc_attr(admin_url('admin.php?page=youtube-ep-onboarding') . '&random=' . rand(1, 1000) . '&TB_iframe=true&width=950&height=800'); ?>" class="thickbox ytprefs-onboarding-launch" id="ytprefs-onboarding-launch" title="EmbedPlus for YouTube Setup Guide"></a>
3561 4949
3562 - jQuery.ajax({
3563 - type: "post",
3564 - dataType: "json",
3565 - timeout: 30000,
3566 - url: wpajaxurl,
3567 - data: {action: 'my_embedplus_clearspdc'},
3568 - success: function (response) {
3569 - if (response.type == "success") {
3570 - jQuery("#clearspdcsuccess").show();
3571 - }
3572 - else {
3573 - jQuery("#clearspdcfailed").show();
3574 - }
3575 - },
3576 - error: function (xhr, ajaxOptions, thrownError) {
3577 - jQuery("#clearspdcfailed").show();
3578 - },
3579 - complete: function () {
3580 - jQuery('#clearspdcloading').hide();
3581 - $clearbutton.removeAttr('disabled');
3582 - }
4950 + <?php
4951 + if (function_exists('add_thickbox'))
4952 + {
4953 + add_thickbox();
4954 + }
4955 + }
3583 4956
3584 - });
4957 + public static function settings_save($all)
4958 + {
4959 + $new_options = array();
4960 + $new_options[self::$opt_center] = self::postchecked(self::$opt_center) ? 1 : 0;
4961 + $new_options[self::$opt_glance] = self::postchecked(self::$opt_glance) ? 1 : 0;
4962 + $new_options[self::$opt_autoplay] = self::postchecked(self::$opt_autoplay) ? 1 : 0;
4963 + $new_options[self::$opt_debugmode] = self::postchecked(self::$opt_debugmode) ? 1 : 0;
4964 + $new_options[self::$opt_uninstall_data] = self::postchecked(self::$opt_uninstall_data) ? 1 : 0;
4965 + $new_options[self::$opt_admin_off_scripts] = self::postchecked(self::$opt_admin_off_scripts) ? 1 : 0;
4966 + $new_options[self::$opt_defer_js] = self::postchecked(self::$opt_defer_js) ? 1 : 0;
4967 + $new_options[self::$opt_defer_jquery] = self::postchecked(self::$opt_defer_jquery) ? 1 : 0;
4968 + $new_options[self::$opt_ajax_save] = self::postchecked(self::$opt_ajax_save) ? 1 : 0;
4969 + $new_options[self::$opt_show_pointer] = self::postchecked(self::$opt_show_pointer) ? 1 : 0;
4970 + $new_options[self::$opt_old_script_method] = self::postchecked(self::$opt_old_script_method) ? 1 : 0;
4971 + $new_options[self::$opt_cc_load_policy] = self::postchecked(self::$opt_cc_load_policy) ? 1 : 0;
4972 + $new_options[self::$opt_iv_load_policy] = self::postchecked(self::$opt_iv_load_policy) ? 1 : 3;
4973 + $new_options[self::$opt_loop] = self::postchecked(self::$opt_loop) ? 1 : 0;
4974 + $new_options[self::$opt_fs] = self::postchecked(self::$opt_fs) ? 1 : 0;
4975 + $new_options[self::$opt_playsinline] = self::postchecked(self::$opt_playsinline) ? 1 : 0;
4976 + $new_options[self::$opt_origin] = self::postchecked(self::$opt_origin) ? 1 : 0;
4977 + $new_options[self::$opt_controls] = self::postchecked(self::$opt_controls) ? 1 : 0;
4978 + $new_options[self::$opt_disablekb] = self::postchecked(self::$opt_disablekb) ? 1 : 0;
4979 + $new_options[self::$opt_color] = self::postchecked(self::$opt_color) ? 'red' : 'white';
4980 + $new_options[self::$opt_nocookie] = self::postchecked(self::$opt_nocookie) ? 1 : 0;
4981 + $new_options[self::$opt_gb_compat] = self::postchecked(self::$opt_gb_compat) ? 1 : 0;
4982 + $new_options[self::$opt_facade_mode] = self::postchecked(self::$opt_facade_mode) ? 1 : 0;
4983 + $new_options[self::$opt_facade_autoplay] = self::postchecked(self::$opt_facade_autoplay) ? 1 : 0;
4984 + $new_options[self::$opt_gdpr_consent] = self::postchecked(self::$opt_gdpr_consent) ? 1 : 0;
4985 + $new_options[self::$opt_playlistorder] = self::postchecked(self::$opt_playlistorder) ? 1 : 0;
4986 + $new_options[self::$opt_acctitle] = self::postchecked(self::$opt_acctitle) ? 1 : 0;
4987 + $new_options[self::$opt_migrate] = self::postchecked(self::$opt_migrate) ? 1 : 0;
4988 + $new_options[self::$opt_migrate_youtube] = self::postchecked(self::$opt_migrate_youtube) ? 1 : 0;
4989 + $new_options[self::$opt_migrate_embedplusvideo] = self::postchecked(self::$opt_migrate_embedplusvideo) ? 1 : 0;
4990 + $new_options[self::$opt_oldspacing] = self::postchecked(self::$opt_oldspacing) ? 1 : 0;
4991 + $new_options[self::$opt_frontend_only] = self::postchecked(self::$opt_frontend_only) ? 1 : 0;
4992 + $new_options[self::$opt_responsive] = self::postchecked(self::$opt_responsive) ? 1 : 0;
4993 + $new_options[self::$opt_widgetfit] = self::postchecked(self::$opt_widgetfit) ? 1 : 0;
4994 + $new_options[self::$opt_evselector_light] = self::postchecked(self::$opt_evselector_light) ? 1 : 0;
4995 + $new_options[self::$opt_stop_mobile_buffer] = self::postchecked(self::$opt_stop_mobile_buffer) ? 1 : 0;
4996 + $new_options[self::$opt_restrict_wizard] = self::postchecked(self::$opt_restrict_wizard) ? 1 : 0;
4997 + $new_options[self::$opt_ajax_compat] = self::postchecked(self::$opt_ajax_compat) ? 1 : 0;
4998 + $new_options[self::$opt_defaultdims] = self::postchecked(self::$opt_defaultdims) ? 1 : 0;
4999 + $new_options[self::$opt_pause_others] = self::postchecked(self::$opt_pause_others) ? 1 : 0;
5000 + $new_options[self::$opt_defaultvol] = self::postchecked(self::$opt_defaultvol) ? 1 : 0;
5001 + $new_options[self::$opt_dohl] = self::postchecked(self::$opt_dohl) ? 1 : 0;
5002 + $new_options[self::$opt_onboarded] = self::postchecked(self::$opt_onboarded) ? 1 : 0;
5003 + $new_options[self::$opt_not_live_on] = self::postchecked(self::$opt_not_live_on) ? 1 : 0;
5004 + $new_options[self::$opt_not_live_on_channel] = self::postchecked(self::$opt_not_live_on_channel) ? 1 : 0;
5005 + $new_options[self::$opt_gallery_hideprivate] = self::postchecked(self::$opt_gallery_hideprivate) ? 1 : 0;
5006 + $new_options[self::$opt_gallery_showtitle] = self::postchecked(self::$opt_gallery_showtitle) ? 1 : 0;
5007 + $new_options[self::$opt_gallery_showpaging] = self::postchecked(self::$opt_gallery_showpaging) ? 1 : 0;
5008 + $new_options[self::$opt_gallery_autonext] = self::postchecked(self::$opt_gallery_autonext) ? 1 : 0;
5009 + $new_options[self::$opt_gallery_thumbplay] = self::postchecked(self::$opt_gallery_thumbplay) ? 1 : 0;
5010 + $new_options[self::$opt_gallery_channelsub] = self::postchecked(self::$opt_gallery_channelsub) ? 1 : 0;
5011 + $new_options[self::$opt_gallery_customarrows] = self::postchecked(self::$opt_gallery_customarrows) ? 1 : 0;
5012 + $new_options[self::$opt_gallery_collapse_grid] = self::postchecked(self::$opt_gallery_collapse_grid) ? 1 : 0;
3585 5013
3586 - });
5014 + $new_options[self::$opt_cc_lang_pref] = sanitize_title($_POST[self::$opt_cc_lang_pref]);
3587 5015
5016 + $_rel = 0;
5017 + try
5018 + {
5019 + $_rel = is_numeric(trim($_POST[self::$opt_rel])) ? intval(trim($_POST[self::$opt_rel])) : $_rel;
5020 + }
5021 + catch (Exception $ex)
5022 + {
5023 +
5024 + }
5025 + $new_options[self::$opt_rel] = $_rel;
3588 5026
3589 5027
5028 + $_gdpr_consent_message = '';
5029 + try
5030 + {
5031 + $_gdpr_consent_message = wp_kses_post(stripslashes($_POST[self::$opt_gdpr_consent_message]));
5032 + }
5033 + catch (Exception $ex)
5034 + {
5035 + $_gdpr_consent_message = '';
5036 + }
5037 + $new_options[self::$opt_gdpr_consent_message] = $_gdpr_consent_message;
3590 5038
3591 - jQuery("#showcase-validate").click(function () {
3592 - window.open("<?php echo self::$epbase . "/showcase-validate.aspx?prokey=" . self::$alloptions[self::$opt_pro] ?>" + "&domain=" + mydomain);
3593 - });
5039 + $_gdpr_consent_button = '';
5040 + try
5041 + {
5042 + $_gdpr_consent_button = wp_kses_post(stripslashes($_POST[self::$opt_gdpr_consent_button]));
5043 + }
5044 + catch (Exception $ex)
5045 + {
5046 + $_gdpr_consent_button = '';
5047 + }
5048 + $new_options[self::$opt_gdpr_consent_button] = $_gdpr_consent_button;
3594 5049
3595 - jQuery('#showprokey').click(function () {
3596 - jQuery('.submitpro').show(500);
3597 - return false;
3598 - });
5050 + $_ytapi_load = 'light';
5051 + try
5052 + {
5053 + $_ytapi_load_temp = $_POST[self::$opt_ytapi_load];
5054 + if (in_array($_ytapi_load_temp, array('always', 'light', 'never')))
5055 + {
5056 + $_ytapi_load = $_ytapi_load_temp;
5057 + }
5058 + }
5059 + catch (Exception $ex)
5060 + {
5061 +
5062 + }
5063 + $new_options[self::$opt_ytapi_load] = $_ytapi_load;
3599 5064
3600 - jQuery('#prokeysubmit').click(function () {
3601 - jQuery(this).attr('disabled', 'disabled');
3602 - jQuery('#prokeyfailed').hide();
3603 - jQuery('#prokeysuccess').hide();
3604 - jQuery('#prokeyloading').show();
3605 - prokeyval = jQuery('#opt_pro').val();
5065 + $_maxres_facade = 'eager';
5066 + try
5067 + {
5068 + $_maxres_facade_temp = filter_input(INPUT_POST, self::$opt_maxres_facade);
5069 + if (in_array($_maxres_facade_temp, array('eager', 'soft', 'off')))
5070 + {
5071 + $_maxres_facade = $_maxres_facade_temp;
5072 + }
5073 + }
5074 + catch (Exception $ex)
5075 + {
5076 +
5077 + }
5078 + $new_options[self::$opt_maxres_facade] = $_maxres_facade;
3606 5079
3607 - var tempscript = document.createElement("script");
3608 - tempscript.src = "//www.embedplus.com/dashboard/wordpress-pro-validatejp.aspx?simple=1&prokey=" + prokeyval + "&domain=" + mydomain;
3609 - var n = document.getElementsByTagName("head")[0].appendChild(tempscript);
3610 - setTimeout(function () {
3611 - n.parentNode.removeChild(n);
3612 - }, 500);
3613 - return false;
3614 - });
5080 + $_restrict_wizard_roles = self::$dft_roles;
5081 + try
5082 + {
5083 + $_restrict_wizard_roles = is_array($_POST[self::$opt_restrict_wizard_roles]) ? $_POST[self::$opt_restrict_wizard_roles] : $_restrict_wizard_roles;
5084 + }
5085 + catch (Exception $ex)
5086 + {
5087 +
5088 + }
5089 + $new_options[self::$opt_restrict_wizard_roles] = $_restrict_wizard_roles;
3615 5090
3616 - window.embedplus_record_prokey = function (good) {
3617 5091
3618 - jQuery.ajax({
3619 - type: "post",
3620 - dataType: "json",
3621 - timeout: 30000,
3622 - url: wpajaxurl,
3623 - data: {action: 'my_embedplus_pro_record', <?php echo self::$opt_pro; ?>: (good ? prokeyval : "")},
3624 - success: function (response) {
3625 - if (response.type == "success") {
3626 - jQuery("#prokeysuccess").show();
3627 - }
3628 - else {
3629 - jQuery("#prokeyfailed").show();
3630 - }
3631 - },
3632 - error: function (xhr, ajaxOptions, thrownError) {
3633 - jQuery('#prokeyfailed').show();
3634 - },
3635 - complete: function () {
3636 - jQuery('#prokeyloading').hide();
3637 - jQuery('#prokeysubmit').removeAttr('disabled');
3638 - }
5092 + $_defaultwidth = '';
5093 + try
5094 + {
5095 + $_defaultwidth = is_numeric(trim($_POST[self::$opt_defaultwidth])) ? intval(trim($_POST[self::$opt_defaultwidth])) : $_defaultwidth;
5096 + }
5097 + catch (Exception $ex)
5098 + {
5099 +
5100 + }
5101 + $new_options[self::$opt_defaultwidth] = $_defaultwidth;
3639 5102
3640 - });
5103 + $_defaultheight = '';
5104 + try
5105 + {
5106 + $_defaultheight = is_numeric(trim($_POST[self::$opt_defaultheight])) ? intval(trim($_POST[self::$opt_defaultheight])) : $_defaultheight;
5107 + }
5108 + catch (Exception $ex)
5109 + {
5110 +
5111 + }
5112 + $new_options[self::$opt_defaultheight] = $_defaultheight;
3641 5113
3642 - };
5114 + $_responsive_all = 1;
5115 + try
5116 + {
5117 + $_responsive_all = is_numeric(trim($_POST[self::$opt_responsive_all])) ? intval(trim($_POST[self::$opt_responsive_all])) : $_responsive_all;
5118 + }
5119 + catch (Exception $ex)
5120 + {
5121 +
5122 + }
5123 + $new_options[self::$opt_responsive_all] = $_responsive_all;
3643 5124
3644 - });
3645 - </script>
3646 - <?php
3647 - if (function_exists('add_thickbox'))
3648 - {
3649 - add_thickbox();
3650 - }
3651 - ?>
5125 + $_vol = '';
5126 + try
5127 + {
5128 + $_vol = is_numeric(trim($_POST[self::$opt_vol])) ? intval(trim($_POST[self::$opt_vol])) : $_vol;
5129 + }
5130 + catch (Exception $ex)
5131 + {
5132 +
5133 + }
5134 + $new_options[self::$opt_vol] = $_vol;
3652 5135
3653 - <?php
5136 + $_gallery_pagesize = 15;
5137 + try
5138 + {
5139 + $_gallery_pagesize = is_numeric(trim($_POST[self::$opt_gallery_pagesize])) ? intval(trim($_POST[self::$opt_gallery_pagesize])) : $_gallery_pagesize;
3654 5140 }
5141 + catch (Exception $ex)
5142 + {
5143 +
5144 + }
5145 + $new_options[self::$opt_gallery_pagesize] = $_gallery_pagesize;
3655 5146
3656 - public static function save_changes_button($submitted)
5147 +
5148 + $_gallery_columns = 3;
5149 + try
3657 5150 {
3658 - $button_label = 'Save Changes';
3659 - if ($submitted)
3660 - {
3661 - $button_label = 'Changes Saved';
3662 - ?>
3663 - <script type="text/javascript">
3664 - jQuery(document).ready(function () {
3665 - setTimeout(function () {
3666 - jQuery('input.ytprefs-submit').val('Save Changes');
3667 - }, 3000);
3668 - });
5151 + $_gallery_columns = is_numeric(trim($_POST[self::$opt_gallery_columns])) ? intval(trim($_POST[self::$opt_gallery_columns])) : $_gallery_columns;
5152 + }
5153 + catch (Exception $ex)
5154 + {
5155 +
5156 + }
5157 + $new_options[self::$opt_gallery_columns] = $_gallery_columns;
3669 5158
3670 - </script>
3671 - <?php
3672 - }
3673 - ?>
3674 - <p class="submit">
3675 - <input type="submit" onclick="return savevalidate();" name="Submit" class="button-primary ytprefs-submit" value="<?php _e($button_label) ?>" />
3676 - <em>If you're using a separate caching plugin and you do not see your changes after saving, you might want to reset your cache.</em>
3677 - </p>
3678 - <?php
5159 +
5160 + $_gallery_collapse_grid_breaks = self::$dft_bpts;
5161 + try
5162 + {
5163 + $_gallery_collapse_grid_breaks = is_array($_POST[self::$opt_gallery_collapse_grid_breaks]) ? $_POST[self::$opt_gallery_collapse_grid_breaks] : $_gallery_collapse_grid_breaks;
3679 5164 }
5165 + catch (Exception $ex)
5166 + {
5167 +
5168 + }
5169 + $new_options[self::$opt_gallery_collapse_grid_breaks] = $_gallery_collapse_grid_breaks;
3680 5170
3681 - public static function ytprefsscript()
5171 +
5172 +
5173 + $_gallery_scrolloffset = 20;
5174 + try
3682 5175 {
3683 - $loggedin = current_user_can('edit_posts');
3684 - if (!($loggedin && self::$alloptions[self::$opt_admin_off_scripts]))
3685 - {
3686 - wp_enqueue_style(
3687 - '__EPYT__style', plugins_url('styles/ytprefs.min.css', __FILE__)
3688 - );
3689 - $cols = floatval(self::$alloptions[self::$opt_gallery_columns]);
3690 - $cols = $cols == 0 ? 3.0 : $cols;
3691 - $colwidth = 100.0 / $cols;
3692 - $custom_css = "
3693 - .epyt-gallery-thumb {
3694 - width: " . round($colwidth, 3) . "%;
3695 - }";
3696 - wp_add_inline_style('__EPYT__style', $custom_css);
5176 + $_gallery_scrolloffset = is_numeric(trim($_POST[self::$opt_gallery_scrolloffset])) ? intval(trim($_POST[self::$opt_gallery_scrolloffset])) : $_gallery_scrolloffset;
5177 + }
5178 + catch (Exception $ex)
5179 + {
5180 +
5181 + }
5182 + $new_options[self::$opt_gallery_scrolloffset] = $_gallery_scrolloffset;
3697 5183
3698 - wp_enqueue_script('__ytprefs__', plugins_url('scripts/ytprefs.min.js', __FILE__), array('jquery'));
5184 + $_gallery_channelsublink = '';
5185 + try
5186 + {
5187 + $_gallery_channelsublink = trim(strip_tags($_POST[self::$opt_gallery_channelsublink]));
5188 + $pieces = explode('?', $_gallery_channelsublink);
5189 + $_gallery_channelsublink = trim($pieces[0]);
5190 + }
5191 + catch (Exception $ex)
5192 + {
5193 + $_gallery_channelsublink = '';
5194 + }
5195 + $new_options[self::$opt_gallery_channelsublink] = $_gallery_channelsublink;
3699 5196
3700 - if (self::$alloptions[self::$opt_old_script_method] != 1)
3701 - {
3702 - wp_localize_script('__ytprefs__', '_EPYT_', array(
3703 - 'ajaxurl' => admin_url('admin-ajax.php'),
3704 - 'security' => wp_create_nonce('embedplus-nonce'),
3705 - 'gallery_scrolloffset' => intval(self::$alloptions[self::$opt_gallery_scrolloffset]),
3706 - 'eppathtoscripts' => plugins_url('scripts/', __FILE__),
3707 - 'epresponsiveselector' => self::get_responsiveselector(),
3708 - 'epdovol' => true,
3709 - 'version' => self::$alloptions[self::$opt_version],
3710 - 'evselector' => self::get_evselector()
3711 - ));
3712 - }
3713 5197
3714 - ////////////////////// cloudflare accomodation
3715 - //add_filter('script_loader_tag', 'YouTubePrefs::set_cfasync', 10, 3);
5198 + $_gallery_channelsubtext = '';
5199 + try
5200 + {
5201 + $_gallery_channelsubtext = stripslashes(trim($_POST[self::$opt_gallery_channelsubtext]));
5202 + }
5203 + catch (Exception $ex)
5204 + {
5205 + $_gallery_channelsubtext = '';
5206 + }
5207 + $new_options[self::$opt_gallery_channelsubtext] = $_gallery_channelsubtext;
3716 5208
3717 - if (!is_admin() && (self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0) && self::$alloptions[self::$opt_dynload] == 1)
3718 - {
3719 - wp_enqueue_style('__dyntype__', plugins_url('scripts/embdyn.min.css', __FILE__));
3720 - wp_enqueue_script('__dynload__', plugins_url('scripts/embdyn.min.js', __FILE__), array('jquery'));
3721 - }
3722 - }
5209 +
5210 + $_gallery_custom_prev = 'Prev';
5211 + try
5212 + {
5213 + $_gallery_custom_prev = trim(strip_tags($_POST[self::$opt_gallery_customprev]));
3723 5214 }
5215 + catch (Exception $ex)
5216 + {
5217 + $_gallery_custom_prev = 'Prev';
5218 + }
5219 + $new_options[self::$opt_gallery_customprev] = $_gallery_custom_prev;
3724 5220
3725 - public static function set_cfasync($tag, $handle, $src)
5221 +
5222 + $_gallery_custom_next = 'Next';
5223 + try
3726 5224 {
3727 - if ('__ytprefs__' !== $handle)
5225 + $_gallery_custom_next = trim(strip_tags($_POST[self::$opt_gallery_customnext]));
5226 + }
5227 + catch (Exception $ex)
5228 + {
5229 + $_gallery_custom_next = 'Next';
5230 + }
5231 + $new_options[self::$opt_gallery_customnext] = $_gallery_custom_next;
5232 +
5233 +
5234 + $_not_live_content = '';
5235 + try
5236 + {
5237 + $_not_live_content = wp_kses_post(stripslashes($_POST[self::$opt_not_live_content]));
5238 + }
5239 + catch (Exception $ex)
5240 + {
5241 + $_not_live_content = '';
5242 + }
5243 + $new_options[self::$opt_not_live_content] = $_not_live_content;
5244 +
5245 +
5246 + $_apikey = '';
5247 + try
5248 + {
5249 + $_apikey = trim(str_replace(array(' ', "'", '"'), array('', '', ''), strip_tags($_POST[self::$opt_apikey])));
5250 + }
5251 + catch (Exception $ex)
5252 + {
5253 + $_apikey = '';
5254 + }
5255 + $new_options[self::$opt_apikey] = $_apikey;
5256 +
5257 +
5258 + $all = $new_options + $all;
5259 +
5260 + update_option(self::$opt_alloptions, $all);
5261 + return array(
5262 + 'type' => 'success',
5263 + 'message' => 'Changes were saved. <em>If you are using a separate caching plugin and you do not see your changes after saving, <strong class="orange">you need to reset your cache.</strong></em>'
5264 + );
5265 + }
5266 +
5267 + public static function settings_save_ajax()
5268 + {
5269 + $result = array();
5270 + if (check_ajax_referer('_epyt_save', '_epyt_nonce', false) && current_user_can('manage_options'))
5271 + {
5272 + $all = get_option(self::$opt_alloptions);
5273 + $result = self::settings_save($all);
5274 + }
5275 + else
5276 + {
5277 + $result['type'] = 'error';
5278 + $result['message'] = 'Sorry, there was a problem saving your settings.';
5279 + }
5280 + echo json_encode($result);
5281 + die();
5282 + }
5283 +
5284 + public static function onboarding_save_valid(&$input)
5285 + {
5286 + $messages = array();
5287 + try
5288 + {
5289 + $input[self::$opt_responsive] = intval($input[self::$opt_responsive]);
5290 + $input[self::$opt_responsive_all] = intval($input[self::$opt_responsive_all]);
5291 + $input[self::$opt_defer_js] = intval($input[self::$opt_defer_js]);
5292 + $input[self::$opt_disablekb] = intval($input[self::$opt_disablekb]);
5293 +
5294 + $input[self::$opt_gallery_pagesize] = intval($input[self::$opt_gallery_pagesize]);
5295 + $input[self::$opt_gallery_columns] = intval($input[self::$opt_gallery_columns]);
5296 + $input[self::$opt_not_live_content] = wp_kses_post(stripslashes($input[self::$opt_not_live_content]));
5297 + $input[self::$opt_not_live_on] = intval($input[self::$opt_not_live_on]);
5298 + $input[self::$opt_not_live_on_channel] = intval($input[self::$opt_not_live_on_channel]);
5299 +
5300 + if (!in_array($input[self::$opt_ytapi_load], array('always', 'light', 'never')))
3728 5301 {
3729 - return $tag;
5302 + $input[self::$opt_ytapi_load] = 'light';
3730 5303 }
3731 - return str_replace('<script', '<script data-cfasync="false" ', $tag);
5304 + $input[self::$opt_facade_mode] = intval($input[self::$opt_facade_mode]);
5305 + $input[self::$opt_facade_autoplay] = intval($input[self::$opt_facade_autoplay]);
5306 + $input[self::$opt_gdpr_consent] = intval($input[self::$opt_gdpr_consent]);
5307 + $input[self::$opt_gdpr_consent_message] = wp_kses_post(stripslashes($input[self::$opt_gdpr_consent_message]));
5308 + $input[self::$opt_gdpr_consent_button] = wp_kses_post(stripslashes($input[self::$opt_gdpr_consent_button]));
5309 + $input[self::$opt_nocookie] = intval($input[self::$opt_nocookie]);
3732 5310 }
5311 + catch (Exception $ex)
5312 + {
5313 + $messages[] = 'Please enter valid data.';
5314 + }
3733 5315
3734 - public static function get_evselector()
5316 + if (empty($messages))
3735 5317 {
3736 - $evselector = 'iframe.__youtube_prefs__[src], iframe[src*="youtube.com/embed/"], iframe[src*="youtube-nocookie.com/embed/"]';
5318 + return true;
5319 + }
5320 + return $messages;
5321 + }
3737 5322
3738 - if (self::$alloptions[self::$opt_evselector_light] == 1)
3739 - {
3740 - $evselector = 'iframe.__youtube_prefs__[src]';
3741 - }
5323 + public static function onboarding_save()
5324 + {
5325 + $result = array();
5326 + $default = array(
5327 + self::$opt_rel => 1,
5328 + self::$opt_disablekb => 0,
5329 + self::$opt_responsive => 0,
5330 + self::$opt_responsive_all => 0,
5331 + self::$opt_defer_js => 0,
5332 + self::$opt_gallery_pagesize => 15,
5333 + self::$opt_gallery_columns => 3,
5334 + self::$opt_not_live_content => '',
5335 + self::$opt_not_live_on => 0,
5336 + self::$opt_not_live_on_channel => 0,
5337 + self::$opt_ytapi_load => 'light',
5338 + self::$opt_facade_mode => 0,
5339 + self::$opt_facade_autoplay => 1,
5340 + self::$opt_gdpr_consent => 0,
5341 + self::$opt_gdpr_consent_message => self::$dft_gdpr_consent_message,
5342 + self::$opt_gdpr_consent_button => 'Accept YouTube Content',
5343 + self::$opt_nocookie => 0
5344 + );
3742 5345
3743 - return $evselector;
5346 +
5347 + $input = shortcode_atts($default, stripslashes_deep($_POST));
5348 + $valid = self::onboarding_save_valid($input);
5349 + if ($valid === true)
5350 + {
5351 + self::update_option_set($input);
5352 + $result['type'] = 'success';
3744 5353 }
5354 + else
5355 + {
5356 + $result['type'] = 'error';
5357 + $result['message'] = implode('<br/>', $valid);
5358 + }
3745 5359
3746 - public static function get_responsiveselector()
5360 + return $result;
5361 + }
5362 +
5363 + public static function onboarding_save_ajax()
5364 + {
5365 + $result = array();
5366 + if (self::is_ajax() && self::ajax_referer() && current_user_can('manage_options'))
3747 5367 {
3748 - $responsiveselector = '[]';
3749 - if (self::$alloptions[self::$opt_widgetfit] == 1)
3750 - {
3751 - $responsiveselector = '["iframe.__youtube_prefs_widget__"]';
3752 - }
3753 - if (self::$alloptions[self::$opt_responsive] == 1)
3754 - {
3755 - if (self::$alloptions[self::$opt_responsive_all] == 1)
5368 + $result = self::onboarding_save();
5369 + }
5370 + else
5371 + {
5372 + $result['type'] = 'error';
5373 + $result['message'] = 'Sorry, there was a problem saving the data.';
5374 + }
5375 + echo json_encode($result);
5376 + die();
5377 + }
5378 +
5379 + public static function onboarding_save_apikey_valid(&$input)
5380 + {
5381 + $messages = array();
5382 + try
5383 + {
5384 + $input[self::$opt_apikey] = trim(str_replace(array(' ', "'", '"'), array('', '', ''), strip_tags($input[self::$opt_apikey])));
5385 + }
5386 + catch (Exception $ex)
5387 + {
5388 + $messages[] = 'Please enter a valid API key.';
5389 + }
5390 +
5391 + if (empty($messages))
5392 + {
5393 + return true;
5394 + }
5395 + return $messages;
5396 + }
5397 +
5398 + public static function onboarding_save_apikey()
5399 + {
5400 + $result = array();
5401 + $default = array(
5402 + self::$opt_apikey => '',
5403 + );
5404 +
5405 + $input = shortcode_atts($default, stripslashes_deep($_POST));
5406 + $valid = self::onboarding_save_apikey_valid($input);
5407 + if ($valid === true)
5408 + {
5409 + self::update_option_set($input);
5410 + $result['type'] = 'success';
5411 + }
5412 + else
5413 + {
5414 + $result['type'] = 'error';
5415 + $result['message'] = implode('<br/>', $valid);
5416 + }
5417 +
5418 + return $result;
5419 + }
5420 +
5421 + public static function onboarding_save_apikey_ajax()
5422 + {
5423 + $result = array();
5424 + if (self::is_ajax() && self::ajax_referer() && current_user_can('manage_options'))
5425 + {
5426 + $result = self::onboarding_save_apikey();
5427 + }
5428 + else
5429 + {
5430 + $result['type'] = 'error';
5431 + $result['message'] = 'Sorry, there was a problem saving the data.';
5432 + }
5433 + echo json_encode($result);
5434 + die();
5435 + }
5436 +
5437 + public static function ytprefs_show_onboarding()
5438 + {
5439 +
5440 + if (!current_user_can('manage_options'))
5441 + {
5442 + wp_die(__('You do not have sufficient permissions to access this page.'));
5443 + }
5444 + if (self::$double_plugin)
5445 + {
5446 + self::double_plugin_warning();
5447 + }
5448 + $all = get_option(self::$opt_alloptions);
5449 +
5450 + $do_once = array(
5451 + self::$opt_onboarded => 1
5452 + );
5453 + self::update_option_set($do_once);
5454 + ?>
5455 + <div class="wrap wrap-ytprefs-onboarding">
5456 + <div class="ytprefs-ob-title">
5457 + EmbedPlus for YouTube Setup Guide
5458 + </div>
5459 + <div class="relative">
5460 + <div class="ytprefs-ob-step ytprefs-ob-step1 active-step">
5461 + <div class="ytprefs-ob-content">
5462 + <div class="ytprefs-ob-block">
5463 + <p>
5464 + With so many options available in this plugin, we created this easy setup guide to help you quickly learn about its <strong>most common settings and newest features</strong>. We hope it will get you embedding videos, galleries, and/or live streams sooner.
5465 + </p>
5466 + <p>
5467 + You'll have an opportunity to see and set many other options after completing this setup guide.
5468 + </p>
5469 + </div>
5470 + </div>
5471 +
5472 + <div class="ytprefs-ob-content ytprefs-ob-content1">
5473 + <h2>
5474 + Below, check all that apply:<br><em>I'm interested in embedding...</em>
5475 + </h2>
5476 + <div class="ytprefs-hover-icons">
5477 + <img class="yob-single-icon" src="<?php echo plugins_url('images/icon-player-single.png', __FILE__) ?>"/>
5478 + <img class="yob-gallery-icon" src="<?php echo plugins_url('images/icon-playlist-gallery.png', __FILE__) ?>"/>
5479 + <img class="yob-standalone-icon" src="<?php echo plugins_url('images/icon-playlist-self.png', __FILE__) ?>"/>
5480 + <img class="yob-live-icon" src="<?php echo plugins_url('images/icon-player-live.png', __FILE__) ?>"/>
5481 + <img class="yob-privacy-icon" src="<?php echo plugins_url('images/icon-player-privacy.png', __FILE__) ?>"/>
5482 + <!-- <img class="yob-monetize-icon" src="<?php echo plugins_url('images/icon-player-money.png', __FILE__) ?>"/>-->
5483 + </div>
5484 + <ul class="ytprefs-ob-filter">
5485 + <li><label><input type="checkbox" data-obfilter="yob-single" /> Single videos.</label></li>
5486 + <li><label><input type="checkbox" data-obfilter="yob-gallery" /> Galleries of playlists or channels (displays thumbnails and a player).</label></li>
5487 + <li><label><input type="checkbox" data-obfilter="yob-standalone" /> Self-contained playlists or channels (no thumbnails, just YouTube's standard playlist player).</label></li>
5488 + <li><label><input type="checkbox" data-obfilter="yob-live" /> Live streams or premieres.</label></li>
5489 + <li style="display:none;"><label><input type="checkbox" data-obfilter="yob-privacy" /> With GDPR / privacy features.</label></li>
5490 + <!-- <li><label><input type="checkbox" data-obfilter="yob-monetize" /> Relevant video ads that earn me up to 10x higher CPMs (revenue) than display advertising.</label></li>-->
5491 + </ul>
5492 + <div class="ytprefs-ob-nav">
5493 + <button type="button" class="button-secondary ytprefs-ob-nav-close">Cancel</button>
5494 + <button type="button" disabled class="button-primary ytprefs-ob-nav-next">Next &raquo;</button>
5495 + </div>
5496 + <h2>
5497 + Intro Video
5498 + </h2>
5499 + <p>
5500 + Want a quick visual overview? Here's a preview of some of the free features of the plugin.
5501 + </p>
5502 + <div class="epyt-fitvid">
5503 + <iframe allow="fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" src="https://www.youtube.com/embed/QDdvXBqfrzM?rel=0" allowfullscreen="" frameborder="0"></iframe>
5504 + </div>
5505 + <p>
5506 + </p>
5507 + </div>
5508 + </div>
5509 + <div class="ytprefs-ob-step ytprefs-ob-step2">
5510 + <div class="ytprefs-ob-content">
5511 + <h2>
5512 + You're interested in:
5513 + </h2>
5514 +
5515 + <form id="form-onboarding">
5516 + <input type="hidden" name="action" value="my_embedplus_onboarding_save_ajax"/>
5517 +
5518 + <div class="ytprefs-ob-setting yob-single yob-gallery yob-standalone yob-live">
5519 + <label>
5520 + <b class="chktitle">Related Videos:</b>
5521 + Show or hide related and recommended videos at the end of playback.
5522 + <br>
5523 + </label>
5524 + <input type="radio" name="<?php echo self::$opt_rel; ?>" id="<?php echo self::$opt_rel; ?>-1" value="-1" <?php checked($all[self::$opt_rel], -1); ?>>
5525 + <label for="<?php echo self::$opt_rel; ?>-1">Hide related videos at the end of playback</label> &nbsp;&nbsp;
5526 + <input type="radio" name="<?php echo self::$opt_rel; ?>" id="<?php echo self::$opt_rel; ?>0" value="0" <?php checked($all[self::$opt_rel], 0); ?>>
5527 + <label for="<?php echo self::$opt_rel; ?>0">Show related videos only from the video's channel</label> &nbsp;&nbsp;
5528 + <input type="radio" name="<?php echo self::$opt_rel; ?>" id="<?php echo self::$opt_rel; ?>1" value="1" <?php checked($all[self::$opt_rel], 1); ?>>
5529 + <label for="<?php echo self::$opt_rel; ?>1">Show related videos</label> &nbsp;&nbsp;
5530 + </div>
5531 + <div class="ytprefs-ob-setting yob-single yob-gallery yob-standalone">
5532 + <input value="1" name="<?php echo self::$opt_facade_mode; ?>" id="<?php echo self::$opt_facade_mode; ?>" <?php checked($all[self::$opt_facade_mode], 1); ?> type="checkbox" class="checkbox">
5533 + <label for="<?php echo self::$opt_facade_mode ?>">
5534 + <b class="chktitle"><?php _e('Facade Mode:', 'youtube-embed-plus'); ?> <sup class="orange">new</sup></b>
5535 + <?php _e('This improves performance by loading a lighter version of the player, until it is clicked. Then the real player loads (note: for live streams, the real player is always loaded). We have tested this feature in multiple cases and found it to successfully improve your Lighthouse performance score by addressing the following recommendation: "Some third-party resources can be lazy loaded with a facade."', 'youtube-embed-plus'); ?>
5536 + <a href="https://www.youtube.com/watch?v=W7PKUjVBDNE" target="_blank"><?php _e('See an example of this feature at work.', 'youtube-embed-plus'); ?></a>
5537 + </label>
5538 + <div class="p box_facade_mode">
5539 + <input value="1" name="<?php echo self::$opt_facade_autoplay; ?>" id="<?php echo self::$opt_facade_autoplay; ?>" type="checkbox" class="checkbox" <?php checked($all[self::$opt_facade_autoplay], 1); ?>>
5540 + <label for="<?php echo self::$opt_facade_autoplay ?>">
5541 + <b class="chktitle"><?php _e('Autoplay On Facade Click:', 'youtube-embed-plus'); ?></b>
5542 + <span>
5543 + <?php _e('After clicking once on the facade (aka light thumbnail), it is replaced with the real player. Check this option to have the real player play immediately, otherwise it will require an additional click. Note that checking this option will use YouTube\'s autoplay feature, which will not contribute toward play counts. If you\'re embedding videos from someone else\'s channel, we recommend checking this. If you\'re embedding videos that are from your channel, then you should self-evaluate the tradeoff involving play counts and additional clicking.', 'youtube-embed-plus'); ?>
5544 + </span>
5545 + </label>
5546 + </div>
5547 + </div>
5548 + <div class="ytprefs-ob-setting yob-single yob-gallery yob-standalone yob-live">
5549 + <input value="1" name="<?php echo self::$opt_responsive; ?>" id="<?php echo self::$opt_responsive; ?>" <?php checked($all[self::$opt_responsive], 1); ?> type="checkbox" class="checkbox">
5550 + <label for="<?php echo self::$opt_responsive; ?>"><?php _e('<b class="chktitle">Responsive Video Sizing:</b> Make your videos responsive so that they dynamically fit in all screen sizes (smart phone, PC and tablet). NOTE: While this is checked, any custom hardcoded widths and heights you may have set will dynamically change too. <b>Do not check this if your theme already handles responsive video sizing.</b>') ?></label>
5551 + <p id="boxresponsive_all" class="ytindent">
5552 + <input type="radio" name="<?php echo self::$opt_responsive_all; ?>" id="<?php echo self::$opt_responsive_all; ?>1" value="1" <?php checked($all[self::$opt_responsive_all], 1); ?> >
5553 + <label for="<?php echo self::$opt_responsive_all; ?>1">Responsive for all YouTube videos</label> &nbsp;&nbsp;
5554 + <input type="radio" name="<?php echo self::$opt_responsive_all; ?>" id="<?php echo self::$opt_responsive_all; ?>0" value="0" <?php checked($all[self::$opt_responsive_all], 0); ?> >
5555 + <label for="<?php echo self::$opt_responsive_all; ?>0">Responsive for only videos embedded via this plugin</label>
5556 + </p>
5557 + </div>
5558 + <div class="ytprefs-ob-setting yob-gallery">
5559 + <label for="<?php echo self::$opt_gallery_pagesize; ?>"><b class="chktitle">Default Gallery Page Size:</b></label>
5560 + <select name="<?php echo self::$opt_gallery_pagesize; ?>" id="<?php echo self::$opt_gallery_pagesize; ?>" style="width: 60px;">
5561 + <?php
5562 + $gps_val = intval(trim($all[self::$opt_gallery_pagesize]));
5563 + $gps_val = min($gps_val, 50);
5564 + for ($gps = 1; $gps <= 50; $gps++)
5565 + {
5566 + ?><option <?php echo $gps_val == $gps ? 'selected' : '' ?> value="<?php echo $gps ?>"><?php echo $gps ?></option>
5567 + <?php
5568 + }
5569 + ?>
5570 + </select>
5571 + Enter how many thumbnails per page should be shown at once (YouTube allows a maximum of 50 per page). You can later use the embedding wizard to customize this for specific galleries.
5572 + </div>
5573 +
5574 + <div class="ytprefs-ob-setting yob-gallery">
5575 + <label for="<?php echo self::$opt_gallery_columns; ?>"><b class="chktitle">Default Gallery Number of Columns:</b></label>
5576 + <input name="<?php echo self::$opt_gallery_columns; ?>" id="<?php echo self::$opt_gallery_columns; ?>" type="number" class="textinput" style="width: 60px;" value="<?php echo esc_attr(trim($all[self::$opt_gallery_columns])); ?>">
5577 + Enter how many thumbnails can fit per row. You can later use the embedding wizard to customize this for specific galleries.
5578 + </div>
5579 + <div class="ytprefs-ob-setting yob-live">
5580 + <p>
5581 + <b class="chktitle">Use "Not Live" Fallback Content For Live Streams:</b> (<a href="<?php echo self::$epbase ?>/how-to-embed-a-youtube-livestream-in-wordpress.aspx" target="_blank">More info here</a>)
5582 + This feature lets you display alternate content if your live stream is not currently active. This feature works for <strong>direct link</strong> live streams (more info about channel-based live streams below).
5583 + </p>
5584 + <div class="ytindent chx">
5585 + <input value="1" name="<?php echo self::$opt_not_live_on; ?>" id="<?php echo self::$opt_not_live_on; ?>" <?php checked($all[self::$opt_not_live_on], 1); ?> type="checkbox" class="checkbox">
5586 + <label for="<?php echo self::$opt_not_live_on; ?>"><span class="chktitle">Turn on for <b>direct link</b> live streams:</span>
5587 + When your direct-link embed is not streaming live, the YouTube live player usually displays a countdown after the user clicks the play button.
5588 + Instead of showing that player, you can display some "coming soon" content in that space for your visitors to see until your video begins to live stream.
5589 + The plugin will automatically switch to your video's live stream once it's active. In the <em>"Not Live" Fallback Content</em> box below, enter what you would like to appear until then.
5590 + You can even insert shortcodes from our plugin into the box below (shortcodes from other plugins may or may not work correctly).
5591 + If you just want to show the standard countdown player that YouTube provides, don't use this feature.
5592 + <strong>NOTE: Turning this on for direct-link live streams uses a significant amount of your YouTube API quota. We suggest unchecking it if your site has high traffic. If you chose to use this feature, do not put another live stream embed below.</strong>
5593 + </label>
5594 + <br>
5595 + <br>
5596 + <input disabled id="<?php echo self::$opt_not_live_on_channel; ?>" type="checkbox" class="checkbox">
5597 + <label><span class="chktitle">Turn on for <b>channel</b> live streams (<span class="orange">upgrade required</span>) </span>
5598 + Unfortunately, Google has recently removed their YouTube API feature that used to support channel-based live streams. It appears they won't change things back. However, you do have a couple of choices:
5599 + <ol>
5600 + <li>Use "Direct link" live streams, as explained above. The trade-off is that you will have to manually post and take down your future live streams every time they start and when they end, respectively.</li>
5601 + <li>Or <a href="<?php echo self::$epbase ?>/dashboard/pro-easy-video-analytics.aspx" target="_blank">upgrade to Pro</a>, which has a solution that brings back all the "set it and forget it" features of channel-based embeds. We spent a significant amount of time developing a stable, long-term solution around YouTube's limitations, so we are releasing this effort exclusively to our Pro customers.</li>
5602 + </ol>
5603 + </label>
5604 + <div class="p not-live-content">
5605 + <p>
5606 + <b>"Not Live" Fallback Content:</b>
5607 + </p>
5608 + <?php
5609 + wp_editor(wp_kses_post($all[self::$opt_not_live_content]), self::$opt_not_live_content, array('textarea_rows' => 7));
5610 + ?>
5611 + </div>
5612 + </div>
5613 + </div>
5614 +
5615 + <div class="ytprefs-ob-setting yob-privacy">
5616 + <b class="chktitle">YouTube API Loading:</b> Choose when to load the YouTube API. The "Restricted" or "Never" options will help with GDPR compliance:
5617 + <ul class="indent-option">
5618 + <li><label><input type="radio" name="<?php echo self::$opt_ytapi_load ?>" value="light" <?php checked($all[self::$opt_ytapi_load], 'light'); ?> /> <em>Restricted</em> - (Recommended) Only load the API on pages that have a YouTube video.</label></li>
5619 + <li><label><input type="radio" name="<?php echo self::$opt_ytapi_load ?>" value="never" <?php checked($all[self::$opt_ytapi_load], 'never'); ?> /> <em>Never</em> - Do not load the YouTube API. Note: The "Never" choice may break a few features such as Volume Initialization and Gallery Continuous/Auto Play.</label></li>
5620 + <li><label><input type="radio" name="<?php echo self::$opt_ytapi_load ?>" value="always" <?php checked($all[self::$opt_ytapi_load], 'always'); ?> /> <em>Always</em> - Load the API on all pages. In most cases, the "Always" choice is not necessary.</label></li>
5621 + </ul>
5622 + </div>
5623 +
5624 +
5625 + <div class="ytprefs-ob-setting yob-privacy">
5626 + <input value="1" name="<?php echo self::$opt_gdpr_consent; ?>" id="<?php echo self::$opt_gdpr_consent; ?>" <?php checked($all[self::$opt_gdpr_consent], 1); ?> type="checkbox" class="checkbox">
5627 + <label for="<?php echo self::$opt_gdpr_consent; ?>">
5628 + <b class="chktitle">Privacy/GDPR - Show Consent Message:</b> Ask for consent before loading YouTube content. A message will be displayed in place of the YouTube video, as shown in the screenshot below. Once the visitor approves consent, the YouTube content will load. You can customize the message text and the button text in the next 2 options.
5629 + </label>
5630 + </div>
5631 +
5632 +
5633 + <div class="ytprefs-ob-setting yob-privacy">
5634 + <label for="<?php echo self::$opt_gdpr_consent_message; ?>">
5635 + <b class="chktitle">Privacy/GDPR - Consent Message Text:</b>
5636 + Below you can customize the message that will appear to visitors before they accept YouTube content:
5637 + </label>
5638 + <div class="clearboth"></div>
5639 + <div class="gdpr-options-left">
5640 + <?php
5641 + wp_editor(wp_kses_post($all[self::$opt_gdpr_consent_message]), self::$opt_gdpr_consent_message, array(
5642 + 'textarea_rows' => 22,
5643 + 'media_buttons' => false,
5644 + 'teeny' => true
5645 + ));
5646 + ?>
5647 + </div>
5648 + <div class="gdpr-options-right">
5649 + <p><em>Example of message and button:</em></p>
5650 +
5651 + <img src="<?php echo plugins_url('images/ss-gdpr-message.png', __FILE__) ?>" alt="GDPR Consent Message Example" class="img-gdpr-message" />
5652 + </div>
5653 +
5654 + </div>
5655 +
5656 + <div class="clearboth"></div>
5657 + <div class="ytprefs-ob-setting yob-privacy">
5658 + <label for="<?php echo self::$opt_gdpr_consent_button; ?>">
5659 + <b class="chktitle">Privacy/GDPR - Consent Button Text:</b>
5660 + This is the text for the red "Accept" button that appears with the above privacy/GDPR message:
5661 + </label>
5662 + <br>
5663 + <input type="text" placeholder="Example: Accept YouTube Content" name="<?php echo self::$opt_gdpr_consent_button; ?>" id="<?php echo self::$opt_gdpr_consent_button; ?>" value="<?php echo esc_attr(trim($all[self::$opt_gdpr_consent_button])); ?>" class="textinput regular-text"/>
5664 + </div>
5665 +
5666 + <div class="ytprefs-ob-setting yob-privacy">
5667 + <input value="1" name="<?php echo self::$opt_nocookie; ?>" id="<?php echo self::$opt_nocookie; ?>" <?php checked($all[self::$opt_nocookie], 1); ?> type="checkbox" class="checkbox">
5668 + <label for="<?php echo self::$opt_nocookie; ?>">
5669 + <b class="chktitle">No Cookies:</b> Prevent YouTube from leaving tracking cookies on your visitors browsers unless they actual play the videos. This is coded to apply this behavior on links in your past post as well.
5670 + <span id="boxnocookie">
5671 + Checking this option may introduce issues to features that depend YouTube's API, such as galleries and playlists. Furthermore, videos on mobile devices may have problems if you leave this checked. We suggest testing this out to make sure you are pleased with the results.
5672 + </span>
5673 + </label>
5674 + </div>
5675 +
5676 + <div class="ytprefs-ob-nav">
5677 + <button type="button" class="button-secondary ytprefs-ob-nav-prev">&laquo; Previous</button>
5678 + <button type="submit" class="button-primary ytprefs-ob-nav-next">Save & Next &raquo;</button>
5679 + </div>
5680 + </form>
5681 + </div>
5682 + </div>
5683 + <div class="ytprefs-ob-step ytprefs-ob-step3">
5684 + <div class="ytprefs-ob-content">
5685 + <h2>
5686 + YouTube API Key
5687 + </h2>
5688 + <form id="form-onboarding-apikey">
5689 + <input type="hidden" name="action" value="my_embedplus_onboarding_save_apikey_ajax"/>
5690 + <p>
5691 + Some features (such as galleries, and some wizard features) now require you to create a free YouTube API key from Google.
5692 + </p>
5693 + <?php
5694 + if (!empty($all[self::$opt_apikey]) && strlen($all[self::$opt_apikey]) > 0)
5695 + {
5696 + ?>
5697 + <p class="ytprefs-ob-success">
5698 + Great! You already have an API key.
5699 + </p>
5700 + <?php
5701 + }
5702 + else
5703 + {
5704 + ?>
5705 + <p>
5706 + The instructions for this are very specific, so we created a video for you that's hopefully easy to follow: <a href="https://www.embedplus.com/how-to-create-a-youtube-api-key.aspx" target="_blank">Click this link</a> and follow the steps on the page. Then save your API key here.
5707 + </p>
5708 + <?php
5709 + }
5710 + ?>
5711 + <p>
5712 + <input type="text" placeholder="Paste your YouTube API key here" name="<?php echo self::$opt_apikey; ?>" id="<?php echo self::$opt_apikey; ?>" value="<?php echo esc_attr(trim($all[self::$opt_apikey])); ?>" class="regular-text" style='max-width: 40%;'>
5713 + </p>
5714 +
5715 + <div class="ytprefs-ob-nav">
5716 + <div class="ytprefs-ob-nav-ultimate">
5717 + <button type="button" class="button-secondary ytprefs-ob-nav-prev">&laquo; Previous</button>
5718 + <button type="button" class="button-secondary ytprefs-ob-nav-close">I'll do this later.</button>
5719 + <button type="submit" class="button-primary ytprefs-ob-nav-next">Save & Finish</button>
5720 + </div>
5721 + <div class="ytprefs-ob-nav-penultimate ytprefs-ob-nav-hide">
5722 + <button type="button" class="button-secondary ytprefs-ob-nav-prev">&laquo; Previous</button>
5723 + <button type="button" class="button-secondary ytprefs-ob-nav-skip">I'll do this later &raquo;</button>
5724 + <button type="submit" class="button-primary ytprefs-ob-nav-next">Save & Next &raquo;</button>
5725 + </div>
5726 + </div>
5727 + </form>
5728 + </div>
5729 + </div>
5730 + <div class="ytprefs-ob-step ytprefs-ob-step4">
5731 + <div class="ytprefs-ob-content">
5732 + <div class="ytprefs-ob-nav">
5733 + <button type="button" class="button-secondary ytprefs-ob-nav-prev">&laquo; Previous</button>
5734 + <button type="button" class="button-primary ytprefs-ob-nav-close">Finish</button>
5735 + </div>
5736 + </div>
5737 + </div>
5738 +
5739 + </div>
5740 + </div>
5741 + <?php
5742 + }
5743 +
5744 + public static function save_changes_button($submitted)
5745 + {
5746 + $button_label = 'Save Changes';
5747 + if ($submitted)
5748 + {
5749 + $button_label = 'Changes Saved';
5750 + ?>
5751 + <script type="text/javascript">
5752 + jQuery(document).ready(function ()
3756 5753 {
3757 - $responsiveselector = '["iframe[src*=\'youtube.com\']","iframe[src*=\'youtube-nocookie.com\']","iframe[data-ep-src*=\'youtube.com\']","iframe[data-ep-src*=\'youtube-nocookie.com\']","iframe[data-ep-gallerysrc*=\'youtube.com\']"]';
5754 + setTimeout(function ()
5755 + {
5756 + jQuery('.ytprefs-submit').text('Save Changes');
5757 + }, 3000);
5758 + });</script>
5759 + <?php
5760 + }
5761 + ?>
5762 + <p class="submit">
5763 + <button type="submit" name="Submit" class="button-primary ytprefs-submit"><?php _e($button_label) ?></button>
5764 + <em>If you're using a separate caching plugin and you do not see your changes after saving, <strong class="orange">you need to reset your cache.</strong></em>
5765 + </p>
5766 + <?php
5767 + }
5768 +
5769 + public static function ytprefsscript()
5770 + {
5771 + $loggedin = current_user_can('edit_posts');
5772 + if (!($loggedin && self::$alloptions[self::$opt_admin_off_scripts]))
5773 + {
5774 + wp_enqueue_style(
5775 + '__EPYT__style', plugins_url('styles/ytprefs' . self::$min . '.css', __FILE__), array(), self::$version
5776 + );
5777 + $cols = floatval(self::$alloptions[self::$opt_gallery_columns]);
5778 + $cols = $cols == 0 ? 3.0 : $cols;
5779 + $colwidth = 100.0 / $cols;
5780 + $custom_css = "
5781 + .epyt-gallery-thumb {
5782 + width: " . round($colwidth, 3) . "%;
3758 5783 }
3759 - else
5784 + ";
5785 +
5786 + if (self::$alloptions[self::$opt_gallery_collapse_grid] == 1)
5787 + {
5788 + foreach (self::$alloptions[self::$opt_gallery_collapse_grid_breaks] as $idx => $bpts)
3760 5789 {
3761 - $responsiveselector = '["iframe.__youtube_prefs__"]';
5790 + $custom_css .= "
5791 + @media (min-width:" . $bpts['bp']['min'] . "px) and (max-width: " . $bpts['bp']['max'] . "px) {
5792 + .epyt-gallery-rowbreak {
5793 + display: none;
5794 + }
5795 + .epyt-gallery-allthumbs[class*=\"epyt-cols\"] .epyt-gallery-thumb {
5796 + width: " . round(100.0 / intval($bpts['cols']), 3) . "% !important;
5797 + }
5798 + }";
3762 5799 }
3763 5800 }
3764 - return $responsiveselector;
3765 - }
3766 5801
3767 - public static function get_blogwidth()
3768 - {
3769 - $blogwidth = null;
3770 - try
5802 + wp_add_inline_style('__EPYT__style', $custom_css);
5803 +
5804 + wp_enqueue_script('__ytprefs__', plugins_url('scripts/ytprefs' . self::$min . '.js', __FILE__), array('jquery'), self::$version);
5805 +
5806 + if (self::$alloptions[self::$opt_old_script_method] != 1)
3771 5807 {
3772 - $embed_size_w = intval(get_option('embed_size_w'));
5808 + $my_script_vars = array(
5809 + 'ajaxurl' => admin_url('admin-ajax.php'),
5810 + 'security' => wp_create_nonce('embedplus-nonce'),
5811 + 'gallery_scrolloffset' => intval(self::$alloptions[self::$opt_gallery_scrolloffset]),
5812 + 'eppathtoscripts' => plugins_url('scripts/', __FILE__),
5813 + 'eppath' => plugins_url('/', __FILE__),
5814 + 'epresponsiveselector' => self::get_responsiveselector(),
5815 + 'epdovol' => true,
5816 + 'version' => self::$alloptions[self::$opt_version],
5817 + 'evselector' => self::get_evselector(),
5818 + 'ajax_compat' => self::$alloptions[self::$opt_ajax_compat] == '1' ? true : false,
5819 + 'maxres_facade' => esc_attr(self::$alloptions[self::$opt_maxres_facade]),
5820 + 'ytapi_load' => self::$alloptions[self::$opt_ytapi_load],
5821 + 'pause_others' => self::$alloptions[self::$opt_pause_others] == '1' ? true : false,
5822 + 'stopMobileBuffer' => self::$alloptions[self::$opt_stop_mobile_buffer] == '1' ? true : false,
5823 + 'facade_mode' => self::$alloptions[self::$opt_facade_mode] == '1' ? true : false,
5824 + 'not_live_on_channel' => self::$alloptions[self::$opt_not_live_on_channel] == '1' ? true : false
5825 + );
3773 5826
3774 - global $content_width;
3775 - if (empty($content_width))
3776 - {
3777 - $content_width = $GLOBALS['content_width'];
3778 - }
5827 + wp_localize_script('__ytprefs__', '_EPYT_', $my_script_vars);
5828 + }
3779 5829
3780 - $blogwidth = $embed_size_w ? $embed_size_w : ($content_width ? $content_width : 450);
3781 - }
3782 - catch (Exception $ex)
5830 + if ((bool) self::$alloptions[self::$opt_gdpr_consent])
3783 5831 {
3784 -
5832 + wp_enqueue_script('__jquery_cookie__', plugins_url('scripts/jquery.cookie' . self::$min . '.js', __FILE__), array('jquery'), self::$version);
3785 5833 }
3786 5834
3787 - $blogwidth = preg_replace('/\D/', '', $blogwidth); //may have px
3788 5835
3789 - return $blogwidth;
5836 + ////////////////////// cloudflare accomodation
5837 + //add_filter('script_loader_tag', array(self::class, 'set_cfasync'), 10, 3);
3790 5838 }
5839 + }
3791 5840
5841 + public static function set_cfasync($tag, $handle, $src)
5842 + {
5843 + if ('__ytprefs__' !== $handle)
5844 + {
5845 + return $tag;
5846 + }
5847 + return str_replace('<script', '<script data-cfasync="false" ', $tag);
3792 5848 }
3793 5849
3794 -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
3795 -//class start
3796 - class Add_new_tinymce_btn_Youtubeprefs
5850 + public static function get_evselector()
3797 5851 {
5852 + $evselector = 'iframe.__youtube_prefs__[src], iframe[src*="youtube.com/embed/"], iframe[src*="youtube-nocookie.com/embed/"]';
3798 5853
3799 - public $btn_arr;
3800 - public $js_file;
5854 + if (self::$alloptions[self::$opt_evselector_light] == 1)
5855 + {
5856 + $evselector = 'iframe.__youtube_prefs__[src]';
5857 + }
3801 5858
3802 - /*
3803 - * call the constructor and set class variables
3804 - * From the constructor call the functions via wordpress action/filter
3805 - */
5859 + return $evselector;
5860 + }
3806 5861
3807 - function __construct($seperator, $btn_name, $javascrip_location)
5862 + public static function get_responsiveselector()
5863 + {
5864 + $responsiveselector = '[]';
5865 + if (self::$alloptions[self::$opt_widgetfit] == 1)
3808 5866 {
3809 - $this->btn_arr = array("Seperator" => $seperator, "Name" => $btn_name);
3810 - $this->js_file = $javascrip_location;
3811 - add_action('init', array($this, 'add_tinymce_button'));
3812 - add_filter('tiny_mce_version', array($this, 'refresh_mce_version'));
5867 + $responsiveselector = '["iframe.__youtube_prefs_widget__"]';
3813 5868 }
3814 -
3815 - /*
3816 - * create the buttons only if the user has editing privs.
3817 - * If so we create the button and add it to the tinymce button array
3818 - */
3819 -
3820 - function add_tinymce_button()
5869 + if (self::$alloptions[self::$opt_responsive] == 1)
3821 5870 {
3822 - if (!current_user_can('edit_posts') && !current_user_can('edit_pages'))
3823 - return;
3824 - if (get_user_option('rich_editing') == 'true')
5871 + if (self::$alloptions[self::$opt_responsive_all] == 1)
3825 5872 {
3826 - //the function that adds the javascript
3827 - add_filter('mce_external_plugins', array($this, 'add_new_tinymce_plugin'));
3828 - //adds the button to the tinymce button array
3829 - add_filter('mce_buttons', array($this, 'register_new_button'));
5873 + $responsiveselector = '["iframe.__youtube_prefs__","iframe[src*=\'youtube.com\']","iframe[src*=\'youtube-nocookie.com\']","iframe[data-ep-src*=\'youtube.com\']","iframe[data-ep-src*=\'youtube-nocookie.com\']","iframe[data-ep-gallerysrc*=\'youtube.com\']"]';
3830 5874 }
5875 + else
5876 + {
5877 + $responsiveselector = '["iframe.__youtube_prefs__"]';
5878 + }
3831 5879 }
5880 + return $responsiveselector;
5881 + }
3832 5882
3833 - /*
3834 - * add the new button to the tinymce array
3835 - */
5883 + public static function admin_enqueue_scripts($hook)
5884 + {
5885 + if (in_array($hook, self::$admin_page_hooks))
5886 + {
5887 + wp_enqueue_style('__ytprefs_admin__alertify_css', plugins_url('styles/alertify/alertify' . self::$min . '.css', __FILE__), array(), self::$version);
5888 + wp_enqueue_style('__ytprefs_admin__alertify_theme_css', plugins_url('styles/alertify/themes/default' . self::$min . '.css', __FILE__), array(), self::$version);
5889 + wp_enqueue_script('__ytprefs_admin__alertify_js', plugins_url('scripts/alertify/alertify' . self::$min . '.js', __FILE__), array(), self::$version);
5890 + wp_enqueue_script('__ytprefs_admin__alertify_defaults_js', plugins_url('scripts/alertify/alertify-defaults' . self::$min . '.js', __FILE__), array(), self::$version);
5891 + }
3836 5892
3837 - function register_new_button($buttons)
5893 + wp_enqueue_style('embedplusyoutube', plugins_url('scripts/embedplus_mce' . self::$min . '.css', __FILE__), array(), self::$version);
5894 + wp_enqueue_script('__ytprefs_admin__', plugins_url('scripts/ytprefs-admin' . self::$min . '.js', __FILE__), array('jquery', 'jquery-effects-fade'), self::$version, false);
5895 + $admin_script_vars = array(
5896 + 'wpajaxurl' => admin_url('admin-ajax.php'),
5897 + 'wizhref' => admin_url('admin.php?page=youtube-ep-wizard') . '&random=' . rand(1, 1000) . '&TB_iframe=true&width=950&height=800',
5898 + 'manage_options' => current_user_can('manage_options'),
5899 + 'security' => wp_create_nonce('embedplus-nonce'),
5900 + 'onboarded' => self::$alloptions[self::$opt_onboarded],
5901 + 'epbase' => self::$epbase,
5902 + 'admin_url' => admin_url(),
5903 + 'admin_url_ytprefs' => admin_url('admin.php?page=youtube-my-preferences'),
5904 + //'epblogwidth' => self::get_blogwidth(),
5905 + //'epprokey' => self::$alloptions[self::$opt_pro],
5906 + //'epbasesite' => self::$epbase,
5907 + //'epversion' => self::$version,
5908 + //'myytdefaults' => http_build_query(self::$alloptions),
5909 + //'eppluginadminurl' => admin_url('admin.php?page=youtube-my-preferences')
5910 + );
5911 + wp_localize_script('__ytprefs_admin__', '_EPYTA_', $admin_script_vars);
5912 +
5913 + if (function_exists('add_thickbox'))
3838 5914 {
3839 - array_push($buttons, $this->btn_arr["Seperator"], $this->btn_arr["Name"]);
3840 - return $buttons;
5915 + add_thickbox();
3841 5916 }
3842 5917
3843 - /*
3844 - * Call the javascript file that loads the
3845 - * instructions for the new button
3846 - */
3847 5918
3848 - function add_new_tinymce_plugin($plugin_array)
5919 + if ((get_bloginfo('version') >= '3.3') && self::custom_admin_pointers_check())
3849 5920 {
3850 - $plugin_array[$this->btn_arr['Name']] = $this->js_file;
3851 - return $plugin_array;
5921 + add_action('admin_print_footer_scripts', array(self::class, 'custom_admin_pointers_footer'));
5922 + wp_enqueue_script('wp-pointer');
5923 + wp_enqueue_style('wp-pointer');
3852 5924 }
3853 5925
3854 - /*
3855 - * This function tricks tinymce in thinking
3856 - * it needs to refresh the buttons
3857 - */
5926 + if (self::$alloptions['glance'] == 1)
5927 + {
5928 + add_action('admin_print_footer_scripts', array(self::class, 'glance_script'));
5929 + }
3858 5930
3859 - function refresh_mce_version($ver)
5931 + if ($hook == self::$wizard_hook)
3860 5932 {
3861 - $ver += 3;
3862 - return $ver;
5933 + wp_enqueue_style('__ytprefs_admin__wizard_ui', plugins_url('styles/jquery-ui' . self::$min . '.css', __FILE__), array(), self::$version);
5934 + wp_enqueue_style('__ytprefs_admin__wizard', plugins_url('styles/ytprefs-wizard' . self::$min . '.css', __FILE__), array(), self::$version);
5935 + wp_enqueue_script('__ytprefs_admin__wizard_script', plugins_url('scripts/ytprefs-wizard' . self::$min . '.js', __FILE__), array('jquery', 'jquery-ui-accordion', 'jquery-ui-tabs'), self::$version);
3863 5936 }
3864 5937
5938 + if ($hook == self::$onboarding_hook)
5939 + {
5940 + wp_enqueue_style('__ytprefs_admin__onboarding_animate', plugins_url('scripts/embdyn' . self::$min . '.css', __FILE__), array(), self::$version);
5941 + wp_enqueue_style('__ytprefs_admin__onboarding_ui', plugins_url('styles/jquery-ui' . self::$min . '.css', __FILE__), array(), self::$version);
5942 + wp_enqueue_style('__ytprefs_admin__onboarding', plugins_url('styles/ytprefs-onboarding' . self::$min . '.css', __FILE__), array(), self::$version);
5943 + }
3865 5944 }
3866 5945
3867 -//class end
5946 + public static function get_blogwidth()
5947 + {
5948 + $blogwidth = null;
5949 + try
5950 + {
5951 + $embed_size_w = intval(get_option('embed_size_w'));
3868 5952
5953 + global $content_width;
5954 + if (empty($content_width))
5955 + {
5956 + $content_width = $GLOBALS['content_width'];
5957 + }
3869 5958
3870 - register_activation_hook(__FILE__, array('YouTubePrefs', 'initoptions'));
3871 - $youtubeplgplus = new YouTubePrefs();
5959 + $blogwidth = $embed_size_w ? $embed_size_w : ($content_width ? $content_width : 450);
5960 + }
5961 + catch (Exception $ex)
5962 + {
5963 +
5964 + }
3872 5965
5966 + $blogwidth = preg_replace('/\D/', '', $blogwidth); //may have px
3873 5967
3874 - add_action("wp_ajax_my_embedplus_pro_record", array('YouTubePrefs', 'my_embedplus_pro_record'));
3875 - add_action("wp_ajax_my_embedplus_clearspdc", array('YouTubePrefs', 'my_embedplus_clearspdc'));
3876 - add_action("wp_ajax_my_embedplus_glance_vids", array('YouTubePrefs', 'my_embedplus_glance_vids'));
3877 - add_action("wp_ajax_my_embedplus_glance_count", array('YouTubePrefs', 'my_embedplus_glance_count'));
3878 - add_action("wp_ajax_my_embedplus_dismiss_double_plugin_warning", array('YouTubePrefs', 'my_embedplus_dismiss_double_plugin_warning'));
3879 - add_action("wp_ajax_my_embedplus_gallery_page", array('YouTubePrefs', 'my_embedplus_gallery_page'));
3880 - add_action("wp_ajax_nopriv_my_embedplus_gallery_page", array('YouTubePrefs', 'my_embedplus_gallery_page'));
5968 + return $blogwidth;
5969 + }
3881 5970
3882 - add_action('admin_enqueue_scripts', 'youtubeprefs_admin_enqueue_scripts');
5971 + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
5972 + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
5973 + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
3883 5974
3884 - function youtubeprefs_admin_enqueue_scripts()
5975 + private static function ajax_referer()
3885 5976 {
3886 - wp_enqueue_style('embedplusyoutube', plugins_url() . '/youtube-embed-plus/scripts/embedplus_mce.css');
3887 - add_action('wp_print_scripts', 'youtubeprefs_output_scriptvars');
3888 - wp_enqueue_script('__ytprefs_admin__', plugins_url('scripts/ytprefs-admin.min.js', __FILE__), array('jquery'));
5977 + return check_ajax_referer('embedplus-nonce', 'security', false);
5978 + }
3889 5979
3890 - if (
3891 - //(!(isset(YouTubePrefs::$alloptions[YouTubePrefs::$opt_pro]) && strlen(trim(YouTubePrefs::$alloptions[YouTubePrefs::$opt_pro])) > 0)) && // display only if not pro ooopointer
3892 - (get_bloginfo('version') >= '3.3') && YouTubePrefs::custom_admin_pointers_check()
3893 - )
5980 + public static function base_url()
5981 + {
5982 + $parsed = parse_url(site_url());
5983 + return $parsed['scheme'] . '://' . $parsed['host'];
5984 + }
5985 +
5986 + public static function on_deactivation()
5987 + {
5988 + }
5989 +
5990 + private static function update_option_set($new_options)
5991 + {
5992 + $all = get_option(self::$opt_alloptions);
5993 + $all = $new_options + $all;
5994 + update_option(self::$opt_alloptions, $all);
5995 + self::$alloptions = get_option(self::$opt_alloptions);
5996 + }
5997 +
5998 + public static function gb_block_assets()
5999 + {
6000 + // frontend+backend styles.
6001 + wp_enqueue_style('epytgb-style-css', plugins_url('dist/blocks.style.build.css', __FILE__), array('wp-blocks'), self::$version);
6002 + }
6003 +
6004 + public static function gb_editor_assets()
6005 + {
6006 + // backend styels
6007 + self::ytprefsscript();
6008 + self::fitvids();
6009 + if (!empty(self::$alloptions[self::$opt_not_live_on_channel]))
3894 6010 {
3895 - add_action('admin_print_footer_scripts', 'YouTubePrefs::custom_admin_pointers_footer');
6011 + add_action("admin_print_footer_scripts", array(self::class, 'live_fallback_template'));
6012 + }
6013 +
6014 + if (!self::is_restrict_wizard() && current_user_can('edit_posts'))
6015 + {
6016 + // Scripts.
6017 + wp_enqueue_script(
6018 + 'epytgb-block-js', // Handle.
6019 + plugins_url('/dist/blocks.build.js', __FILE__), // Block.build.js: We register the block here. Built with Webpack.
6020 + array('wp-blocks', 'wp-i18n', 'wp-element'), // Dependencies, defined above.
6021 + self::$version, true // Enqueue the script in the footer.
6022 + );
3896 6023
3897 - wp_enqueue_script('wp-pointer');
3898 - wp_enqueue_style('wp-pointer');
6024 + // Styles.
6025 + wp_enqueue_style(
6026 + 'epytgb-block-editor-css', // Handle.
6027 + plugins_url('dist/blocks.editor.build.css', __FILE__), // Block editor CSS.
6028 + array('wp-edit-blocks'), // Dependency to include the CSS after it.
6029 + self::$version
6030 + );
6031 +
6032 + // Tiny MCE
6033 + wp_enqueue_style('__ytprefs_admin__tinymce_css', plugins_url('styles/epyt_mce_wizard_button' . self::$min . '.css', __FILE__), array(), self::$version);
3899 6034 }
6035 + }
3900 6036
3901 - if (YouTubePrefs::$alloptions['glance'] == 1)
6037 + public static function gb_classic_block_setup()
6038 + {
6039 + if (!self::is_restrict_wizard() && current_user_can('edit_posts'))
3902 6040 {
3903 - add_action('admin_print_footer_scripts', 'YouTubePrefs::glance_script');
6041 + add_thickbox();
6042 + add_filter("mce_external_plugins", array(self::class, "gb_add_tinymce_plugin"));
6043 + add_filter('mce_buttons_2', array(self::class, 'gb_register_tinymce_button'));
3904 6044 }
3905 6045 }
3906 6046
3907 - function youtubeprefs_output_scriptvars()
6047 + public static function gb_add_tinymce_plugin($plugin_array)
3908 6048 {
3909 - YouTubePrefs::$scriptsprinted++;
3910 - if (YouTubePrefs::$scriptsprinted == 1)
6049 + $plugin_array['epyt_mce_wizard_button'] = plugins_url('scripts/epyt_mce_wizard_button' . self::$min . '.js', __FILE__) . '?ver=' . self::$version;
6050 + return $plugin_array;
6051 + }
6052 +
6053 + public static function gb_register_tinymce_button($buttons)
6054 + {
6055 + array_push($buttons, "epyt_mce_wizard_button");
6056 + return $buttons;
6057 + }
6058 +
6059 + public static function gb_svg_defs()
6060 + {
6061 + ?>
6062 + <svg style="height: 0 !important; width: 0 !important; display: absolute !important; top: 0 !important; left: 0 !important;"><defs><style>.epytcls-1{fill:red;}.epytcls-2{fill-rule:evenodd;fill:url(#radial-gradient);}.epytcls-3{fill:#31aaff;}.epytcls-4{fill:#fff;}</style><radialGradient id="radial-gradient" cx="193" cy="85.85" r="77.53" gradientUnits="userSpaceOnUse"><stop offset="0.17" stop-color="#fff"/><stop offset="0.68" stop-color="#31aaff"/></radialGradient></defs></svg>
6063 + <?php
6064 + }
6065 +
6066 + public static function gb_canvas_svg_styles()
6067 + {
6068 + // The block editor canvas is an iframe, so the gradient and class rules that
6069 + // gb_svg_defs() prints into the admin document are out of scope for the icon
6070 + // rendered inside it. Restate them for the canvas only.
6071 + if (!is_admin())
3911 6072 {
3912 - $blogwidth = YouTubePrefs::get_blogwidth();
3913 - $epprokey = YouTubePrefs::$alloptions[YouTubePrefs::$opt_pro];
3914 - $myytdefaults = http_build_query(YouTubePrefs::$alloptions);
3915 - ?>
3916 - <script type="text/javascript">
3917 - var wpajaxurl = "<?php echo admin_url('admin-ajax.php') ?>";
3918 - if (window.location.toString().indexOf('https://') == 0)
3919 - {
3920 - wpajaxurl = wpajaxurl.replace("http://", "https://");
3921 - }
6073 + return;
6074 + }
3922 6075
3923 - var epblogwidth = <?php echo $blogwidth; ?>;
3924 - var epprokey = '<?php echo $epprokey; ?>';
3925 - var epbasesite = '<?php echo YouTubePrefs::$epbase; ?>';
3926 - var epversion = '<?php echo YouTubePrefs::$version; ?>';
3927 - var myytdefaults = '<?php echo $myytdefaults; ?>';
3928 - var eppluginadminurl = '<?php echo admin_url('admin.php?page=youtube-my-preferences'); ?>';
6076 + wp_register_style('epytgb-canvas-svg-css', false, array(), self::$version);
6077 + wp_enqueue_style('epytgb-canvas-svg-css');
6078 + wp_add_inline_style('epytgb-canvas-svg-css', '.editor-styles-wrapper .epytcls-1{fill:red;}.editor-styles-wrapper .epytcls-2{fill-rule:evenodd;fill:#31aaff;}.editor-styles-wrapper .epytcls-3{fill:#31aaff;}.editor-styles-wrapper .epytcls-4{fill:#fff;}');
6079 + }
3929 6080
3930 - // Create IE + others compatible event handler
3931 - var epeventMethod = window.addEventListener ? "addEventListener" : "attachEvent";
3932 - var epeventer = window[epeventMethod];
3933 - var epmessageEvent = epeventMethod == "attachEvent" ? "onmessage" : "message";
6081 + public static function gb_register_block_types()
6082 + {
6083 + if (function_exists('register_block_type'))
6084 + {
6085 + register_block_type(
6086 + 'epyt/youtube', array(
6087 + 'attributes' => array(
6088 + 'shortcode' => array(
6089 + 'type' => 'string'
6090 + )
6091 + ),
6092 + 'render_callback' => array(self::class, 'gb_render_callback_youtube'),
6093 + )
6094 + );
6095 + }
6096 + }
3934 6097
3935 - // Listen to message from child window
3936 - epeventer(epmessageEvent, function (e)
3937 - {
3938 - var embedcode = "";
3939 - try
3940 - {
3941 - if (e.data.indexOf("youtubeembedplus") == 0)
3942 - {
6098 + public static function gb_render_callback_youtube($attributes, $content)
6099 + {
6100 + if ($attributes && $attributes['shortcode'] && strpos($attributes['shortcode'], '[') === 0)
6101 + {
6102 + $render = do_shortcode($attributes['shortcode']);
6103 + if (empty($render) && stripos($attributes['shortcode'], 'live=1') !== false)
6104 + {
6105 + $render = '<em>This is a live embed that is not currently streaming. You can optionally fill out the <a href="' . admin_url('admin.php?page=youtube-my-preferences') . '#not_live_content_scroll" target="_blank">Not Live Content</a> field in the YouTube plugin\'s Default Settings.</em>';
6106 + }
6107 + return $render;
6108 + }
6109 + return isset($attributes['shortcode']) ? $attributes['shortcode'] : '';
6110 + }
3943 6111
3944 - embedcode = e.data.split("|")[1];
3945 - if (embedcode.indexOf("[") !== 0)
3946 - {
3947 - embedcode = "<p>" + embedcode + "</p>";
3948 - }
6112 +}
3949 6113
3950 - if (window.tinyMCE !== null && window.tinyMCE.activeEditor !== null && !window.tinyMCE.activeEditor.isHidden())
3951 - {
3952 - if (typeof window.tinyMCE.execInstanceCommand !== 'undefined')
3953 - {
3954 - window.tinyMCE.execInstanceCommand(
3955 - window.tinyMCE.activeEditor.id,
3956 - 'mceInsertContent',
3957 - false,
3958 - embedcode);
3959 - }
3960 - else
3961 - {
3962 - send_to_editor(embedcode);
3963 - }
3964 - }
3965 - else
3966 - {
3967 - embedcode = embedcode.replace('<p>', '\n').replace('</p>', '\n');
3968 - if (typeof QTags.insertContent === 'function')
3969 - {
3970 - QTags.insertContent(embedcode);
3971 - }
3972 - else
3973 - {
3974 - send_to_editor(embedcode);
3975 - }
3976 - }
3977 - tb_remove();
6114 +// constants
6115 +define('EPYT_BASE_URL', rtrim(plugins_url('', __FILE__), "\\/") . '/');
6116 +define('EPYTGB_INCLUDES_PATH', rtrim(dirname(__FILE__), "\\/") . '/includes/gutenberg/');
3978 6117
3979 - }
3980 - }
3981 - catch (err)
3982 - {
3983 - if (typeof console !== 'undefined')
3984 - console.log(err.message);
3985 - }
6118 +$youtubeplgplus = new YouTubePrefs();
3986 6119
3987 6120
3988 - }, false);
3989 6121
3990 6122
3991 -
3992 - </script>
3993 - <?php
3994 - }
3995 - }
3996 -