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 +4416 -2166 10.8trunk 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.8
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.8';
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,92 +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';
80 + public static $opt_responsive_all = 'responsive_all';
72 81 public static $opt_origin = 'origin';
73 82 public static $opt_widgetfit = 'widgetfit';
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';
74 90 public static $opt_defaultdims = 'defaultdims';
75 91 public static $opt_defaultwidth = 'width';
76 92 public static $opt_defaultheight = 'height';
93 + public static $opt_pause_others = 'pause_others';
77 94 public static $opt_defaultvol = 'defaultvol';
78 95 public static $opt_vol = 'vol';
79 96 public static $opt_apikey = 'apikey';
80 - public static $opt_schemaorg = 'schemaorg';
81 - public static $opt_ftpostimg = 'ftpostimg';
82 - public static $opt_spdc = 'spdc';
83 - public static $opt_spdcexp = 'spdcexp';
84 97 public static $opt_migrate = 'migrate';
85 98 public static $opt_migrate_youtube = 'migrate_youtube';
86 - public static $spdcprefix = 'ytpref';
87 - public static $spdcall = 'youtubeprefs_spdcall';
88 - public static $opt_dynload = 'dynload';
89 - public static $opt_dyntype = 'dyntype';
99 + public static $opt_migrate_embedplusvideo = 'migrate_embedplusvideo';
90 100 public static $opt_gallery_pagesize = 'gallery_pagesize';
91 - public static $opt_gallery_apikey = 'gallery_apikey';
92 101 public static $opt_gallery_columns = 'gallery_columns';
93 - 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';
94 104 public static $opt_gallery_scrolloffset = 'gallery_scrolloffset';
105 + public static $opt_gallery_hideprivate = 'gallery_hideprivate';
95 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';
96 113 public static $opt_gallery_customarrows = 'gallery_customarrows';
97 114 public static $opt_gallery_customprev = 'gallery_customprev';
98 115 public static $opt_gallery_customnext = 'gallery_customnext';
99 - public static $opt_gallery_showdsc = 'gallery_showdsc';
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';
100 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';
101 125 public static $opt_alloptions = 'youtubeprefs_alloptions';
102 126 public static $alloptions = null;
103 127 public static $yt_options = array();
104 - //public static $epbase = 'http://localhost:2346';
105 - 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';
106 131 public static $double_plugin = false;
107 132 public static $scriptsprinted = 0;
133 + public static $min = '.min';
108 134 public static $badentities = array('&#215;', '×', '&#8211;', '–', '&amp;', '&#038;', '&#38;');
109 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>';
110 152 ///////////////////////////////////////////////////////////////////////////////////////////////////
111 153 ///////////////////////////////////////////////////////////////////////////////////////////////////
112 154 ///////////////////////////////////////////////////////////////////////////////////////////////////
113 155 ///////////////////////////////////////////////////////////////////////////////////////////////////
114 - ///////////////////////////////////////////////////////////////////////////////////////////////////
115 - //public static $ytregex = '@^[\r\n]{0,1}[[:blank:]]*https?://(?:www\.)?(?:(?:youtube.com/watch\?)|(?:youtu.be/))([^\s"]+)[[:blank:]]*[\r\n]{0,1}$@im';
116 - public static $oldytregex = '@^\s*https?://(?:www\.)?(?:(?:youtube.com/(?:(?:watch)|(?:embed))/{0,1}\?)|(?:youtu.be/))([^\s"]+)\s*$@im';
117 - public static $ytregex = '@^[\r\t ]*https?://(?:www\.)?(?:(?:youtube.com/(?:(?:watch)|(?:embed))/{0,1}\?)|(?:youtu.be/))([^\s"]+)[\r\t ]*$@im';
118 - public static $justurlregex = '@https?://(?:www\.)?(?:(?:youtube.com/(?:(?:watch)|(?:embed))/{0,1}\?)|(?:youtu.be/))([^\[\s"]+)@i';
119 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 +
120 161 ///////////////////////////////////////////////////////////////////////////////////////////////////
121 162 ///////////////////////////////////////////////////////////////////////////////////////////////////
122 163 ///////////////////////////////////////////////////////////////////////////////////////////////////
123 - ///////////////////////////////////////////////////////////////////////////////////////////////////
124 - ///////////////////////////////////////////////////////////////////////////////////////////////////
125 - ///////////////////////////////////////////////////////////////////////////////////////////////////
126 164
127 165 public function __construct()
128 166 {
129 - 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'));
130 174
131 175 self::$alloptions = get_option(self::$opt_alloptions);
132 176 if (self::$alloptions == false || version_compare(self::$alloptions[self::$opt_version], self::$version, '<'))
133 177 {
@@ -133,8 +177,14 @@
133 177 {
134 178 self::initoptions();
135 179 }
136 180
181 + if ((defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) || self::$alloptions[self::$opt_debugmode] == 1)
182 + {
183 + self::$min = '';
184 + }
185 +
186 +
137 187 if (self::$alloptions[self::$opt_oldspacing] == 1)
138 188 {
139 189 self::$ytregex = self::$oldytregex;
140 190 }
@@ -144,56 +194,117 @@
144 194
145 195 self::$yt_options = array(
146 196 self::$opt_autoplay,
147 197 self::$opt_cc_load_policy,
198 + self::$opt_cc_lang_pref,
148 199 self::$opt_iv_load_policy,
149 200 self::$opt_loop,
150 - self::$opt_modestbranding,
151 201 self::$opt_rel,
152 - self::$opt_showinfo,
202 + self::$opt_fs,
153 203 self::$opt_playsinline,
154 204 self::$opt_autohide,
155 205 self::$opt_controls,
156 - self::$opt_html5,
206 + self::$opt_disablekb,
157 207 self::$opt_hl,
158 208 self::$opt_theme,
159 209 self::$opt_color,
160 210 self::$opt_listType,
161 - self::$opt_wmode,
162 - self::$opt_vq,
163 211 'index',
164 212 'list',
165 213 'start',
166 - 'end'
214 + 'end',
215 + 'channel'
167 216 );
168 217
169 - add_action('media_buttons', 'YouTubePrefs::media_button_wizard', 11);
218 + add_action('media_buttons', array(self::class, 'media_button_wizard'), 11);
170 219
171 220
172 221 self::do_ytprefs();
173 - 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 +
174 225 if (!is_admin())
175 226 {
176 -
177 -
178 227 if (self::$alloptions[self::$opt_old_script_method] == 1)
179 228 {
180 - add_action('wp_print_scripts', array('YouTubePrefs', 'jsvars'));
181 - 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'));
182 231 }
183 232
184 - add_action('wp_enqueue_scripts', array('YouTubePrefs', 'ytprefsscript'), 100);
185 - add_action('wp_enqueue_scripts', array('YouTubePrefs', 'fitvids'));
233 + add_action('wp_enqueue_scripts', array(self::class, 'ytprefsscript'), 100);
234 + add_action('wp_enqueue_scripts', array(self::class, 'fitvids'), 101);
235 + }
186 236
237 + add_filter('ytprefs_filter_the_content_light', array(self::class, 'filter_the_content_light'));
187 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);
188 248
189 - if (self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0 && self::$alloptions[self::$opt_ogvideo] == 1)
190 - {
191 - add_action('wp_head', array('YouTubePrefs', 'do_ogvideo'));
192 - }
249 + if (!empty(self::$alloptions[self::$opt_not_live_on_channel]))
250 + {
251 + add_action("wp_footer", array(self::class, 'live_fallback_template'));
193 252 }
253 + /////////////////////////////////////
254 + include_once(EPYTGB_INCLUDES_PATH . 'gutenberg_hooks.php');
194 255 }
195 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 +
196 307 public static function show_glance_list()
197 308 {
198 309 $glancehref = self::show_glance();
199 310 $cnt = self::get_glance_count();
@@ -198,13 +309,10 @@
198 309 $glancehref = self::show_glance();
199 310 $cnt = self::get_glance_count();
200 311
201 312 //display via list
202 - return
203 - '<li class="page-count">
204 - <a href="' . $glancehref . '" class="thickbox ytprefs_glance_button" id="ytprefs_glance_button" title="YouTube Embeds At a Glance">
205 - ' . number_format_i18n($cnt) . ' With YouTube
206 - </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>
207 315 </li>';
208 316 }
209 317
210 318 public static function show_glance_table()
@@ -247,8 +355,9 @@
247 355 #wpbody{margin-left: 0px;}
248 356 .wrap {font-family: Arial; padding: 0px 10px 0px 10px; line-height: 180%;}
249 357 .bold {font-weight: bold;}
250 358 .orange {color: #f85d00;}
359 + sup.orange {text-transform: lowercase; font-weight: bold; color: #f85d00;}
251 360 #adminmenuback {display: none;}
252 361 #adminmenu, adminmenuwrap {display: none;}
253 362 #wpcontent, .auto-fold #wpcontent {margin-left: 0px;}
254 363 #wpadminbar {display:none;}
@@ -253,8 +362,9 @@
253 362 #wpcontent, .auto-fold #wpcontent {margin-left: 0px;}
254 363 #wpadminbar {display:none;}
255 364 html.wp-toolbar {padding: 0px;}
256 365 #footer, #wpfooter, .auto-fold #wpfooter {display: none;}
366 + #wpfooter {clear: both}
257 367 .acctitle {background-color: #dddddd; border-radius: 5px; padding: 7px 15px 7px 15px; cursor: pointer; margin: 10px; font-weight: bold; font-size: 12px;}
258 368 .acctitle:hover {background-color: #cccccc;}
259 369 .accbox {display: none; position: relative; margin: 5px 8px 30px 15px; clear: both; line-height: 180%;}
260 370 .accclose {position: absolute; top: -38px; right: 5px; cursor: pointer; width: 24px; height: 24px;}
@@ -265,8 +375,9 @@
265 375 .accthumb img {width: 300px; height: auto; display: block;}
266 376 .clearboth {clear: both;}
267 377 .pad20 {padding: 20px;}
268 378 .center {text-align: center;}
379 + #screen-meta-links {display: none;}
269 380 </style>
270 381 <script type="text/javascript">
271 382 function accclose(ele)
272 383 {
@@ -274,47 +385,48 @@
274 385 }
275 386
276 387 (function ($j)
277 388 {
278 - $j(document).ready(function () {
389 + $j(document).ready(function ()
390 + {
279 391
280 392
281 - $j('.acctitle').click(function () {
393 + $j('.acctitle').on('click', function ()
394 + {
282 395 var $acctitle = $j(this);
283 396 var $accbox = $j(this).parent().children('.accbox');
284 397 var pid = $accbox.attr("data-postid");
285 -
286 - $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__) ?>" />');
287 399 jQuery.ajax({
288 400 type: "post",
289 401 dataType: "json",
290 402 timeout: 30000,
291 - url: wpajaxurl,
403 + url: window._EPYTA_ ? window._EPYTA_.wpajaxurl : ajaxurl,
292 404 data: {action: 'my_embedplus_glance_vids', postid: pid},
293 - success: function (response) {
294 - if (response.type == "success") {
405 + success: function (response)
406 + {
407 + if (response.type === "success")
408 + {
295 409 $accbox.html(response.data),
296 410 $accbox.show(400);
297 411 }
298 - else {
412 + else
413 + {
299 414 }
300 415 },
301 - error: function (xhr, ajaxOptions, thrownError) {
416 + error: function (xhr, ajaxOptions, thrownError)
417 + {
302 418
303 419 },
304 - complete: function () {
420 + complete: function ()
421 + {
305 422 $acctitle.children('.accloader').remove();
306 423 }
307 424
308 425 });
309 -
310 -
311 426 });
312 427 });
313 - })(jQuery);
314 -
315 -
316 - </script>
428 + })(jQuery);</script>
317 429 <?php
318 430 global $wpdb;
319 431 $query_sql = "
320 432 SELECT SQL_CALC_FOUND_ROWS *
@@ -328,9 +440,9 @@
328 440 if ($query_result !== null)
329 441 {
330 442 $total = $wpdb->get_var("SELECT FOUND_ROWS();");
331 443 global $post;
332 - 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>';
333 445 ?>
334 446
335 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.
336 448
@@ -360,19 +472,35 @@
360 472 </div>
361 473 <?php
362 474 }
363 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 +
364 487 public static function my_embedplus_glance_vids()
365 488 {
366 489 $result = array();
367 - if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
490 + if (self::is_ajax())
368 491 {
492 + if (!current_user_can('edit_posts'))
493 + {
494 + wp_send_json_error('Unauthorized');
495 + die();
496 + }
369 497 $postid = intval($_REQUEST['postid']);
370 498 $currpost = get_post($postid);
371 499
372 - $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__) . '" />';
373 501
374 - $matches = Array();
502 + $matches = array();
375 503 $ismatch = preg_match_all(self::$justurlregex, $currpost->post_content, $matches);
376 504
377 505 if ($ismatch)
378 506 {
@@ -400,17 +528,17 @@
400 528 if ($vidid != null)
401 529 {
402 530 try
403 531 {
404 - $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);
405 533 $postlink = get_permalink($postid);
406 534 if ($odata != null && !is_wp_error($odata))
407 535 {
408 536 $_name = esc_attr(sanitize_text_field($odata->title));
409 537 $_description = esc_attr(sanitize_text_field($odata->author_name));
410 - $_thumbnailUrl = esc_url("//i.ytimg.com/vi/" . $vidid . "/0.jpg");
538 + $_thumbnailUrl = esc_url("https://i.ytimg.com/vi/" . $vidid . "/0.jpg");
411 539
412 - $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>';
413 541 $thehtml .= '<div class="accinfo">';
414 542 $thehtml .= '<a target="_blank" href="' . $postlink . '" class="accvidtitle">' . $_name . '</a>';
415 543 $thehtml .= '<div class="accdesc">' . (strlen($_description) > 400 ? substr($_description, 0, 400) . "..." : $_description) . '</div>';
416 544 $thehtml .= '</div>';
@@ -418,13 +546,41 @@
418 546 }
419 547 else
420 548 {
421 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);
422 571
423 - if (!(self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0))
424 - {
425 - $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>';
426 - }
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>';
427 583 $thehtml .= '</strong>';
428 584 }
429 585 }
430 586 catch (Exception $ex)
@@ -431,11 +587,8 @@
431 587 {
432 588
433 589 }
434 590 }
435 - else if (false)
436 - { // if playlist
437 - }
438 591 }
439 592 }
440 593
441 594
@@ -461,10 +614,15 @@
461 614
462 615 public static function my_embedplus_glance_count()
463 616 {
464 617 $result = array();
465 - if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
618 + if (self::is_ajax())
466 619 {
620 + if (!current_user_can('edit_posts'))
621 + {
622 + wp_send_json_error('Unauthorized');
623 + die();
624 + }
467 625 $thehtml = '';
468 626
469 627 try
470 628 {
@@ -495,24 +653,1031 @@
495 653 }
496 654 die();
497 655 }
498 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 +
499 1666 public static function media_button_wizard()
500 1667 {
1668 + if (self::is_restrict_wizard())
1669 + {
1670 + return;
1671 + }
1672 +
501 1673 add_thickbox();
502 1674
503 - $wizhref = self::$epbase . '/wpembedcode-simple-search.aspx?pluginversion=' . YouTubePrefs::$version .
504 - '&wpversion=' . get_bloginfo('version') .
505 - '&settingsurl=' . urlencode(admin_url('admin.php?page=youtube-my-preferences#jumpdefaults')) .
506 - '&dashurl=' . urlencode(admin_url('admin.php?page=youtube-ep-analytics-dashboard')) .
507 - '&blogwidth=' . YouTubePrefs::get_blogwidth() .
508 - '&domain=' . urlencode(site_url()) .
509 - '&prokey=' . urlencode(YouTubePrefs::$alloptions[YouTubePrefs::$opt_pro]) .
510 - '&myytdefaults=' . urlencode(http_build_query(YouTubePrefs::$alloptions)) .
1675 + $wizhref = admin_url('admin.php?page=youtube-ep-wizard') .
511 1676 '&random=' . rand(1, 1000) .
512 1677 '&TB_iframe=true&width=950&height=800';
513 1678 ?>
514 - <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>
515 1680 <?php
516 1681 }
517 1682
518 1683 public static function check_double_plugin_warning()
@@ -518,10 +1683,9 @@
518 1683 public static function check_double_plugin_warning()
519 1684 {
520 1685 if (is_plugin_active('embedplus-for-wordpress/embedplus.php'))
521 1686 {
522 - add_action('admin_notices', array("YouTubePrefs", "double_plugin_warning"));
523 - //self::$double_plugin = true;
1687 + add_action('admin_notices', array(self::class, "double_plugin_warning"));
524 1688 }
525 1689 }
526 1690
527 1691 public static function double_plugin_warning()
@@ -554,36 +1718,42 @@
554 1718 {
555 1719 echo '<a class="epxout">&times;</a>';
556 1720 }
557 1721 ?>
558 - 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>
559 1724 </div>
560 - <iframe allowTransparency="true" src="<?php echo self::$epbase . '/both-plugins-conflict.aspx' ?>" style="width:2px; height: 2px;" ></iframe>
1725 +
561 1726 <script type="text/javascript">
562 - (function ($) {
563 - $(document).ready(function () {
564 - $('.epxout').click(function () {
1727 + (function ($)
1728 + {
1729 + $(document).ready(function ()
1730 + {
1731 + $('.epxout').on('click', function ()
1732 + {
565 1733 $.ajax({
566 1734 type: "post",
567 1735 dataType: "json",
568 1736 timeout: 30000,
569 - url: wpajaxurl,
1737 + url: window._EPYTA_ ? window._EPYTA_.wpajaxurl : ajaxurl,
570 1738 data: {action: 'my_embedplus_dismiss_double_plugin_warning'},
571 - success: function (response) {
572 - if (response.type == "success") {
1739 + success: function (response)
1740 + {
1741 + if (response.type === "success")
1742 + {
573 1743 $(".embedpluswarningbox").hide();
574 1744 }
575 1745 },
576 - error: function (xhr, ajaxOptions, thrownError) {
1746 + error: function (xhr, ajaxOptions, thrownError)
1747 + {
577 1748 },
578 - complete: function () {
1749 + complete: function ()
1750 + {
579 1751 }
580 1752 });
581 1753 });
582 -
583 1754 });
584 - })(jQuery);
585 - </script>
1755 + })(jQuery);</script>
586 1756 <?php
587 1757 }
588 1758 }
589 1759 }
@@ -590,10 +1760,15 @@
590 1760
591 1761 public static function my_embedplus_dismiss_double_plugin_warning()
592 1762 {
593 1763 $result = array();
594 - if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
1764 + if (self::is_ajax())
595 1765 {
1766 + if (!current_user_can('manage_options'))
1767 + {
1768 + wp_send_json_error('Unauthorized');
1769 + die();
1770 + }
596 1771 $user_id = get_current_user_id();
597 1772 update_user_meta($user_id, 'embedplus_double_plugin_warning', 1);
598 1773 $result['type'] = 'success';
599 1774 echo json_encode($result);
@@ -617,88 +1792,98 @@
617 1792 ajaxurl: "<?php echo admin_url('admin-ajax.php'); ?>",
618 1793 security: "<?php echo wp_create_nonce('embedplus-nonce'); ?>",
619 1794 gallery_scrolloffset: <?php echo intval(self::$alloptions[self::$opt_gallery_scrolloffset]) ?>,
620 1795 eppathtoscripts: "<?php echo plugins_url('scripts/', __FILE__); ?>",
1796 + eppath: "<?php echo plugins_url('/', __FILE__); ?>",
621 1797 epresponsiveselector: <?php echo self::get_responsiveselector(); ?>,
622 - version: "<?php echo self::$alloptions[self::$opt_version] ?>",
623 - epdovol: true
624 - };
625 - </script>
1798 + version: "<?php echo esc_attr(self::$alloptions[self::$opt_version]) ?>",
1799 + epdovol: true,
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>
626 1809 <?php
627 1810 }
628 1811 }
629 1812
630 - public static function jsinitvars()
631 - { // NOT USED
632 - //https://support.cloudflare.com/hc/en-us/articles/200169436-How-can-I-have-Rocket-Loader-ignore-my-script-s-in-Automatic-Mode-
633 - $responsiveselector = '[]';
634 - if (self::$alloptions[self::$opt_widgetfit] == 1)
635 - {
636 - $responsiveselector = '["iframe.__youtube_prefs_widget__"]';
637 - }
638 - if (self::$alloptions[self::$opt_responsive] == 1)
639 - {
640 - $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\']"]';
641 - }
642 - ?>
643 - <script data-cfasync="false">
644 - var eppathtoscripts = "<?php echo plugins_url('scripts/', __FILE__); ?>";
645 - var epresponsiveselector = <?php echo $responsiveselector; ?>;
646 - var epdovol = true; //<?php echo (self::$alloptions[self::$opt_defaultvol] == 1 ? 'true' : 'false') ?>;
647 - </script>
648 - <?php
649 - }
650 -
651 1813 public static function fitvids()
652 1814 {
653 1815 $loggedin = current_user_can('edit_posts');
654 - 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]))
655 1817 {
656 - wp_enqueue_script('__ytprefsfitvids__', plugins_url('scripts/fitvids.min.js', __FILE__), false, false, true);
1818 + wp_enqueue_script('__ytprefsfitvids__', plugins_url('scripts/fitvids' . self::$min . '.js', __FILE__), array('__ytprefs__'), self::$version, true);
657 1819 }
658 1820 }
659 1821
660 1822 public static function initoptions()
661 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 +
662 1840 //vanilla defaults
663 1841 $_center = 0;
664 - $_glance = 1;
665 - $_autoplay = get_option('youtubeprefs_autoplay', 0);
666 - $_cc_load_policy = get_option('youtubeprefs_cc_load_policy', 0);
667 - $_iv_load_policy = get_option('youtubeprefs_iv_load_policy', 1);
668 - $_loop = get_option('youtubeprefs_loop', 0);
669 - $_modestbranding = get_option('youtubeprefs_modestbranding', 0);
670 - $_rel = get_option('youtubeprefs_rel', 1);
671 - $_showinfo = get_option('youtubeprefs_showinfo', 1);
672 - $_html5 = get_option('youtubeprefs_html5', 0);
673 - $_theme = get_option('youtubeprefs_theme', 'dark');
674 - $_color = get_option('youtubeprefs_color', 'red');
675 - $_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';
676 1852 $_autohide = 2;
677 1853 $_pro = '';
678 - $_ssl = 0;
679 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';
680 1861 $_playlistorder = 0;
681 1862 $_acctitle = 0;
682 - $_ogvideo = 0;
683 1863 $_migrate = 0;
684 1864 $_migrate_youtube = 0;
685 - $_controls = 2;
1865 + $_migrate_embedplusvideo = 0;
1866 + $_controls = 1;
1867 + $_disablekb = 0;
686 1868 $_oldspacing = 1;
1869 + $_frontend_only = 1;
687 1870 $_responsive = 0;
1871 + $_responsive_all = 1;
688 1872 $_widgetfit = 1;
689 - $_schemaorg = 0;
690 - $_ftpostimg = 0;
691 - $_spdc = 0;
692 - $_spdcexp = 24;
693 - $_dynload = 0;
694 - $_dyntype = '';
695 - $_wmode = 'opaque';
696 - $_defaultdims = 0;
697 - $_defaultwidth = '';
698 - $_defaultheight = '';
1873 + $_evselector_light = 0;
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);
699 1883 $_playsinline = 0;
700 1884 $_origin = 0;
1885 + $_pause_others = 0;
701 1886 $_defaultvol = 0;
702 1887 $_vol = '';
703 1888 $_apikey = '';
704 1889 $_hl = '';
@@ -703,80 +1888,119 @@
703 1888 $_apikey = '';
704 1889 $_hl = '';
705 1890 $_dohl = 0;
706 1891 $_gallery_columns = 3;
1892 + $_gallery_collapse_grid = 0;
1893 + $_gallery_collapse_grid_breaks = self::$dft_bpts;
707 1894 $_gallery_scrolloffset = 20;
1895 + $_gallery_hideprivate = 1;
708 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';
709 1903 $_gallery_customarrows = 0;
710 1904 $_gallery_customprev = 'Prev';
711 1905 $_gallery_customnext = 'Next';
712 1906 $_gallery_pagesize = 15;
713 - $_gallery_style = 'grid';
714 - $_gallery_showdsc = 0;
1907 + $_not_live_content = '';
1908 + $_not_live_on = 0;
1909 + $_not_live_on_channel = 0;
715 1910 $_debugmode = 0;
1911 + $_uninstall_data = 0;
716 1912 $_admin_off_scripts = 0;
1913 + $_defer_js = 0;
1914 + $_defer_jquery = 0;
1915 + $_ajax_save = 1;
1916 + $_show_pointer = 1;
1917 + $_onboarded = 0;
717 1918 $_old_script_method = 0;
718 1919
719 - $arroptions = get_option(self::$opt_alloptions);
720 -
721 1920 //update vanilla to previous settings if exists
722 1921 if ($arroptions !== false)
723 1922 {
724 1923 $_center = self::tryget($arroptions, self::$opt_center, 0);
725 - $_glance = self::tryget($arroptions, self::$opt_glance, 1);
1924 + $_glance = self::tryget($arroptions, self::$opt_glance, $_glance);
726 1925 $_autoplay = self::tryget($arroptions, self::$opt_autoplay, 0);
727 1926 $_debugmode = self::tryget($arroptions, self::$opt_debugmode, 0);
1927 + $_uninstall_data = self::tryget($arroptions, self::$opt_uninstall_data, 0);
728 1928 $_old_script_method = self::tryget($arroptions, self::$opt_old_script_method, 0);
729 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);
730 1931 $_iv_load_policy = self::tryget($arroptions, self::$opt_iv_load_policy, 1);
731 1932 $_loop = self::tryget($arroptions, self::$opt_loop, 0);
732 - $_modestbranding = self::tryget($arroptions, self::$opt_modestbranding, 0);
733 1933 $_rel = self::tryget($arroptions, self::$opt_rel, 1);
734 - $_showinfo = self::tryget($arroptions, self::$opt_showinfo, 1);
1934 + $_fs = self::tryget($arroptions, self::$opt_fs, 1);
735 1935 $_playsinline = self::tryget($arroptions, self::$opt_playsinline, 0);
736 - $_origin = self::tryget($arroptions, self::$opt_origin, 0);
737 - $_html5 = self::tryget($arroptions, self::$opt_html5, 0);
1936 + $_origin = self::tryget($arroptions, self::$opt_origin, 1);
738 1937 $_hl = self::tryget($arroptions, self::$opt_hl, '');
739 1938 $_dohl = self::tryget($arroptions, self::$opt_dohl, 0);
740 1939 $_theme = self::tryget($arroptions, self::$opt_theme, 'dark');
741 1940 $_color = self::tryget($arroptions, self::$opt_color, 'red');
742 - $_wmode = self::tryget($arroptions, self::$opt_wmode, 'opaque');
743 - $_vq = self::tryget($arroptions, self::$opt_vq, '');
1941 + $_autohide = self::tryget($arroptions, self::$opt_autohide, 2);
744 1942 $_pro = self::tryget($arroptions, self::$opt_pro, '');
745 - $_ssl = self::tryget($arroptions, self::$opt_ssl, 0);
746 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);
747 1950 $_playlistorder = self::tryget($arroptions, self::$opt_playlistorder, 0);
748 1951 $_acctitle = self::tryget($arroptions, self::$opt_acctitle, 0);
749 - $_ogvideo = self::tryget($arroptions, self::$opt_ogvideo, 0);
750 1952 $_migrate = self::tryget($arroptions, self::$opt_migrate, 0);
751 1953 $_migrate_youtube = self::tryget($arroptions, self::$opt_migrate_youtube, 0);
752 - $_controls = self::tryget($arroptions, self::$opt_controls, 2);
753 - $_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);
754 1958 $_oldspacing = self::tryget($arroptions, self::$opt_oldspacing, 1);
755 - $_responsive = self::tryget($arroptions, self::$opt_responsive, 0);
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);
756 1962 $_widgetfit = self::tryget($arroptions, self::$opt_widgetfit, 1);
757 - $_schemaorg = self::tryget($arroptions, self::$opt_schemaorg, 0);
758 - $_ftpostimg = self::tryget($arroptions, self::$opt_ftpostimg, 0);
759 - $_spdc = self::tryget($arroptions, self::$opt_spdc, 0);
760 - $_spdcexp = self::tryget($arroptions, self::$opt_spdcexp, 24);
761 - $_dynload = self::tryget($arroptions, self::$opt_dynload, 0);
762 - $_dyntype = self::tryget($arroptions, self::$opt_dyntype, '');
763 - $_defaultdims = self::tryget($arroptions, self::$opt_defaultdims, 0);
764 - $_defaultwidth = self::tryget($arroptions, self::$opt_defaultwidth, '');
765 - $_defaultheight = self::tryget($arroptions, self::$opt_defaultheight, '');
1963 + $_evselector_light = self::tryget($arroptions, self::$opt_evselector_light, 0);
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);
766 1974 $_defaultvol = self::tryget($arroptions, self::$opt_defaultvol, 0);
767 1975 $_vol = self::tryget($arroptions, self::$opt_vol, '');
768 1976 $_apikey = self::tryget($arroptions, self::$opt_apikey, '');
769 1977 $_gallery_pagesize = self::tryget($arroptions, self::$opt_gallery_pagesize, 15);
770 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);
771 1981 $_gallery_scrolloffset = self::tryget($arroptions, self::$opt_gallery_scrolloffset, 20);
1982 + $_gallery_hideprivate = self::tryget($arroptions, self::$opt_gallery_hideprivate, $_gallery_hideprivate);
772 1983 $_gallery_showtitle = self::tryget($arroptions, self::$opt_gallery_showtitle, 1);
773 - $_gallery_style = self::tryget($arroptions, self::$opt_gallery_style, 'grid');
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);
774 1990 $_gallery_customarrows = self::tryget($arroptions, self::$opt_gallery_customarrows, $_gallery_customarrows);
775 1991 $_gallery_customnext = self::tryget($arroptions, self::$opt_gallery_customnext, $_gallery_customnext);
776 1992 $_gallery_customprev = self::tryget($arroptions, self::$opt_gallery_customprev, $_gallery_customprev);
777 - $_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);
778 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);
779 2003 }
780 2004 else
781 2005 {
782 2006 $_oldspacing = 0;
@@ -787,58 +2011,81 @@
787 2011 self::$opt_center => $_center,
788 2012 self::$opt_glance => $_glance,
789 2013 self::$opt_autoplay => $_autoplay,
790 2014 self::$opt_cc_load_policy => $_cc_load_policy,
2015 + self::$opt_cc_lang_pref => $_cc_lang_pref,
791 2016 self::$opt_iv_load_policy => $_iv_load_policy,
792 2017 self::$opt_loop => $_loop,
793 - self::$opt_modestbranding => $_modestbranding,
794 2018 self::$opt_rel => $_rel,
795 - self::$opt_showinfo => $_showinfo,
2019 + self::$opt_fs => $_fs,
796 2020 self::$opt_playsinline => $_playsinline,
797 2021 self::$opt_origin => $_origin,
798 2022 self::$opt_autohide => $_autohide,
799 - self::$opt_html5 => $_html5,
800 2023 self::$opt_hl => $_hl,
801 2024 self::$opt_dohl => $_dohl,
802 2025 self::$opt_theme => $_theme,
803 2026 self::$opt_color => $_color,
804 - self::$opt_wmode => $_wmode,
805 - self::$opt_vq => $_vq,
806 2027 self::$opt_pro => $_pro,
807 - self::$opt_ssl => $_ssl,
808 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,
809 2035 self::$opt_playlistorder => $_playlistorder,
810 2036 self::$opt_acctitle => $_acctitle,
811 - self::$opt_ogvideo => $_ogvideo,
812 2037 self::$opt_migrate => $_migrate,
813 2038 self::$opt_migrate_youtube => $_migrate_youtube,
2039 + self::$opt_migrate_embedplusvideo => $_migrate_embedplusvideo,
814 2040 self::$opt_controls => $_controls,
2041 + self::$opt_disablekb => $_disablekb,
815 2042 self::$opt_oldspacing => $_oldspacing,
2043 + self::$opt_frontend_only => $_frontend_only,
816 2044 self::$opt_responsive => $_responsive,
2045 + self::$opt_responsive_all => $_responsive_all,
817 2046 self::$opt_widgetfit => $_widgetfit,
818 - self::$opt_schemaorg => $_schemaorg,
819 - self::$opt_ftpostimg => $_ftpostimg,
820 - self::$opt_spdc => $_spdc,
821 - self::$opt_spdcexp => $_spdcexp,
822 - self::$opt_dynload => $_dynload,
823 - self::$opt_dyntype => $_dyntype,
2047 + self::$opt_evselector_light => $_evselector_light,
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,
824 2054 self::$opt_defaultdims => $_defaultdims,
825 2055 self::$opt_defaultwidth => $_defaultwidth,
826 2056 self::$opt_defaultheight => $_defaultheight,
2057 + self::$opt_pause_others => $_pause_others,
827 2058 self::$opt_defaultvol => $_defaultvol,
828 2059 self::$opt_vol => $_vol,
829 2060 self::$opt_apikey => $_apikey,
830 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,
831 2064 self::$opt_gallery_scrolloffset => $_gallery_scrolloffset,
2065 + self::$opt_gallery_hideprivate => $_gallery_hideprivate,
832 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,
833 2073 self::$opt_gallery_customarrows => $_gallery_customarrows,
834 2074 self::$opt_gallery_customnext => $_gallery_customnext,
835 2075 self::$opt_gallery_customprev => $_gallery_customprev,
836 - self::$opt_gallery_showdsc => $_gallery_showdsc,
837 - self::$opt_gallery_style => $_gallery_style,
838 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,
839 2080 self::$opt_debugmode => $_debugmode,
2081 + self::$opt_uninstall_data => $_uninstall_data,
840 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,
841 2088 self::$opt_old_script_method => $_old_script_method
842 2089 );
843 2090
844 2091 update_option(self::$opt_alloptions, $all);
@@ -862,41 +2109,56 @@
862 2109 }
863 2110
864 2111 public static function do_ytprefs()
865 2112 {
866 - add_filter('autoptimize_filter_js_exclude', 'YouTubePrefs::ao_override_jsexclude', 10, 1);
867 - 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 + )
868 2118 {
869 - add_filter('the_content', 'YouTubePrefs::apply_prefs_content', 1);
870 - add_filter('widget_text', 'YouTubePrefs::apply_prefs_widget', 1);
871 - 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'));
872 2126 if (self::$alloptions[self::$opt_migrate] == 1)
873 2127 {
874 2128 if (self::$alloptions[self::$opt_migrate_youtube] == 1)
875 2129 {
876 - add_shortcode('youtube', array('YouTubePrefs', 'apply_prefs_shortcode_youtube'));
877 - 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'));
878 2132 }
2133 + if (self::$alloptions[self::$opt_migrate_embedplusvideo] == 1)
2134 + {
2135 + add_shortcode('embedplusvideo', array(self::class, 'apply_prefs_shortcode_embedplusvideo'));
2136 + }
879 2137 }
880 2138 }
881 - else
2139 +
2140 + if (self::$alloptions[self::$opt_defer_js] == 1)
882 2141 {
883 - if (self::$alloptions[self::$opt_ftpostimg] == 1 && self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0)
884 - {
885 - add_action('save_post', array('YouTubePrefs', 'doftpostimg'), 110, 3);
886 - }
2142 + add_filter('script_loader_tag', array(self::class, 'defer_scripts'), 10, 3);
887 2143 }
888 2144 }
889 2145
890 2146 public static function ao_override_jsexclude($exclude)
891 2147 {
892 - if (strpos($exclude, 'ytprefs.min.js') === false)
2148 + if (strpos($exclude, 'ytprefs' . self::$min . '.js') === false)
893 2149 {
894 - return $exclude . ",ytprefs.min.js,__ytprefs__";
2150 + return $exclude . ',ytprefs' . self::$min . '.js,__ytprefs__';
895 2151 }
896 2152 return $exclude;
897 2153 }
898 2154
2155 + public static function exclude_lazy_sgo($classes)
2156 + {
2157 + $classes[] = '__youtube_prefs__';
2158 + return $classes;
2159 + }
2160 +
899 2161 public static function apply_prefs_shortcode($atts, $content = null)
900 2162 {
901 2163 $content = trim($content);
902 2164 $currfilter = current_filter();
@@ -901,9 +2163,9 @@
901 2163 $content = trim($content);
902 2164 $currfilter = current_filter();
903 2165 if (preg_match(self::$justurlregex, $content))
904 2166 {
905 - 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);
906 2168 }
907 2169 return '';
908 2170 }
909 2171
@@ -908,50 +2170,88 @@
908 2170 }
909 2171
910 2172 public static function apply_prefs_shortcode_youtube($atts, $content = null)
911 2173 {
912 - $content = 'http://www.youtube.com/watch?v=' . trim($content);
2174 + $content = 'https://www.youtube.com/watch?v=' . trim($content);
913 2175 $currfilter = current_filter();
914 2176 if (preg_match(self::$justurlregex, $content))
915 2177 {
916 - return self::get_html(array($content), $currfilter == 'widget_text' ? false : true);
2178 + return self::get_html(array($content), $currfilter == 'widget_text' ? false : true, false);
917 2179 }
918 2180 return '';
919 2181 }
920 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 +
921 2217 public static function apply_prefs_content($content)
922 2218 {
923 - $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);
924 2220 return $content;
925 2221 }
926 2222
927 2223 public static function apply_prefs_widget($content)
928 2224 {
929 - $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);
930 2226 return $content;
931 2227 }
932 2228
933 2229 public static function get_html_content($m)
934 2230 {
935 - return self::get_html($m, true);
2231 + return self::get_html($m, true, true);
936 2232 }
937 2233
938 2234 public static function get_html_widget($m)
939 2235 {
940 - return self::get_html($m, false);
2236 + return self::get_html($m, false, true);
941 2237 }
942 2238
943 - //public static function get_gallery_page($playlistId, $pageToken, $pageSize, $columns, $style, $apiKey)
944 2239 public static function get_gallery_page($options)
945 2240 {
2241 + $gallobj = new stdClass();
2242 +
946 2243 $options->pageSize = min(intval($options->pageSize), 50);
947 - $options->columns = intval($options->columns);
2244 + $options->columns = intval($options->columns) == 0 ? 3 : intval($options->columns);
948 2245 $options->showTitle = intval($options->showTitle);
949 - $options->showDsc = intval($options->showDsc);
2246 + $options->showPaging = intval($options->showPaging);
2247 + $options->autonext = intval($options->autonext);
2248 + $options->thumbplay = intval($options->thumbplay);
950 2249
951 2250 if (empty($options->apiKey))
952 2251 {
953 - 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;
954 2254 }
955 2255
956 2256 $apiEndpoint = 'https://www.googleapis.com/youtube/v3/playlistItems?part=snippet,status&playlistId=' . $options->playlistId
957 2257 . '&maxResults=' . $options->pageSize
@@ -959,45 +2259,40 @@
959 2259 if ($options->pageToken != null)
960 2260 {
961 2261 $apiEndpoint .= '&pageToken=' . $options->pageToken;
962 2262 }
963 - $spdckey = '';
964 - if (self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0 && 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))
965 2270 {
966 - try
967 - {
968 - $spdckey = self::$spdcprefix . '_' . md5($apiEndpoint . $options->columns . $options->style . $options->showTitle . $options->showDsc);
969 - $spdcval = get_transient($spdckey);
970 - if (!empty($spdcval))
971 - {
972 - //self::debuglog((microtime(true) - $time_start) . "\t" . $spdckey . "\t" . $spdcval . "\r\n");
973 - return $spdcval;
974 - }
975 - }
976 - catch (Exception $ex)
977 - {
978 -
979 - }
2271 + $gallobj->html = self::clean_api_error_html($apiResult->get_error_message(), true);
2272 + return $gallobj;
980 2273 }
981 2274
982 - $code = '';
983 -
984 - $apiResult = wp_remote_get($apiEndpoint);
985 2275 if (self::$alloptions[self::$opt_debugmode] == 1 && current_user_can('manage_options'))
986 2276 {
987 2277 $redactedEndpoint = preg_replace('@&key=[^&]+@i', '&key=PRIVATE', $apiEndpoint);
988 - 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;
989 2282 }
990 -
2283 +
991 2284 $jsonResult = json_decode($apiResult['body']);
992 -
2285 +
993 2286 if (isset($jsonResult->error))
994 2287 {
995 2288 if (isset($jsonResult->error->message))
996 2289 {
997 - 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;
998 2292 }
999 - 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;
1000 2295 }
1001 2296
1002 2297
1003 2298
@@ -1016,11 +2311,18 @@
1016 2311 $prevPageToken = $jsonResult->prevPageToken;
1017 2312 }
1018 2313
1019 2314 $cnt = 0;
1020 - $code.= '<div class="epyt-gallery-allthumbs">';
2315 + $colclass = ' epyt-cols-' . $options->columns . ' ';
2316 + $code .= '<div class="epyt-gallery-allthumbs ' . $colclass . '">';
2317 +
1021 2318 if (isset($jsonResult->items) && $jsonResult->items != null && is_array($jsonResult->items))
1022 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 + }
1023 2325
1024 2326 foreach ($jsonResult->items as $item)
1025 2327 {
1026 2328
@@ -1030,13 +2332,18 @@
1030 2332 $thumb->id = $thumb->id ? $thumb->id : $item->id->videoId;
1031 2333 $thumb->title = $options->showTitle ? $item->snippet->title : '';
1032 2334 $thumb->privacyStatus = isset($item->status->privacyStatus) ? $item->status->privacyStatus : null;
1033 2335
1034 - 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)
1035 2337 {
1036 - $thumb->dsc = $options->showDsc ? $item->snippet->description : '';
2338 + continue;
1037 2339 }
1038 2340
2341 + if ($cnt == 0 && $options->pageToken == null)
2342 + {
2343 + $init_id = $thumb->id;
2344 + }
2345 +
1039 2346 if ($thumb->privacyStatus == 'private')
1040 2347 {
1041 2348 $thumb->img = plugins_url('/images/private.png', __FILE__);
1042 2349 $thumb->quality = 'medium';
@@ -1052,11 +2359,16 @@
1052 2359 {
1053 2360 $thumb->img = $item->snippet->thumbnails->default->url;
1054 2361 $thumb->quality = 'default';
1055 2362 }
2363 + elseif (isset($item->snippet->thumbnails->medium->url))
2364 + {
2365 + $thumb->img = $item->snippet->thumbnails->medium->url;
2366 + $thumb->quality = 'medium';
2367 + }
1056 2368 else
1057 2369 {
1058 - $thumb->img = $item->snippet->thumbnails->medium->url;
2370 + $thumb->img = plugins_url('/images/deleted-video-thumb.png', __FILE__);
1059 2371 $thumb->quality = 'medium';
1060 2372 }
1061 2373 }
1062 2374
@@ -1062,9 +2374,9 @@
1062 2374
1063 2375 $code .= self::get_thumbnail_html($thumb, $options);
1064 2376 $cnt++;
1065 2377
1066 - if ($cnt % $options->columns === 0 && $options->style !== 'carousel')
2378 + if ($cnt % $options->columns === 0)
1067 2379 {
1068 2380 $code .= '<div class="epyt-gallery-rowbreak"></div>';
1069 2381 }
1070 2382 }
@@ -1071,64 +2383,58 @@
1071 2383 }
1072 2384
1073 2385 $code .= '<div class="epyt-gallery-clear"></div></div>';
1074 2386
1075 - if ($options->style === 'carousel' && $options->showTitle)
1076 - {
1077 - $code .= '<div class="epyt-gallery-rowtitle"></div>';
1078 - }
2387 + $totalPages = ceil($totalResults / $resultsPerPage);
2388 + $pagination = '<div class="epyt-pagination ' . ($options->showPaging == 0 ? 'epyt-hide-pagination' : '') . '">';
1079 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>';
1080 2400
1081 - $totalPages = ceil($totalResults / $resultsPerPage);
1082 - $pagination = '<div class="epyt-pagination">';
1083 - //if ($totalPages > 1)
1084 - {
1085 - //if (!empty($prevPageToken))
1086 - {
1087 - $txtprev = self::$alloptions[self::$opt_gallery_customarrows] ? self::$alloptions[self::$opt_gallery_customprev] : _('Prev');
1088 - $pagination .= '<div class="epyt-pagebutton epyt-prev ' . (empty($prevPageToken) ? ' hide ' : '') . '" data-playlistid="' . esc_attr($options->playlistId)
1089 - . '" data-pagesize="' . intval($options->pageSize)
1090 - . '" data-pagetoken="' . esc_attr($prevPageToken)
1091 - . '" data-style="' . esc_attr($options->style)
1092 - . '" data-columns="' . intval($options->columns)
1093 - . '" data-showtitle="' . intval($options->showTitle)
1094 - . ((self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0 && $options->style == 'listview' && $options->showDsc) ? '" data-showdsc="' . intval($options->showDsc) : '')
1095 - . '"><div class="arrow">&laquo;</div> <div>' . $txtprev . '</div></div>';
1096 - }
1097 2401
1098 - $pagination .= '<div class="epyt-pagenumbers ' . ($totalPages > 1 ? '' : 'hide') . '">';
1099 - $pagination .= '<div class="epyt-current">1</div><div class="epyt-pageseparator"> / </div><div class="epyt-totalpages">' . $totalPages . '</div>';
1100 - $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>';
1101 2405
1102 - //if (!empty($nextPageToken))
1103 - {
1104 - $txtnext = self::$alloptions[self::$opt_gallery_customarrows] ? self::$alloptions[self::$opt_gallery_customnext] : _('Next');
1105 - $pagination .= '<div class="epyt-pagebutton epyt-next' . (empty($nextPageToken) ? ' hide ' : '') . '" data-playlistid="' . esc_attr($options->playlistId)
1106 - . '" data-pagesize="' . intval($options->pageSize)
1107 - . '" data-pagetoken="' . esc_attr($nextPageToken)
1108 - . '" data-style="' . esc_attr($options->style)
1109 - . '" data-columns="' . intval($options->columns)
1110 - . '" data-showtitle="' . intval($options->showTitle)
1111 - . ((self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0 && $options->style == 'listview' && $options->showDsc) ? '" data-showdsc="' . intval($options->showDsc) : '')
1112 - . '"><div>' . $txtnext . '</div> <div class="arrow">&raquo;</div></div>';
1113 - }
1114 - $pagination .= '<div class="epyt-loader"><img src="' . plugins_url('images/gallery-page-loader.gif', __FILE__) . '"></div>';
1115 - }
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>';
1116 2418 $pagination .= '</div>';
1117 2419
2420 +// if ($options->showPaging == 0)
2421 +// {
2422 +// $pagination = '<div class="epyt-pagination"></div>';
2423 +// }
1118 2424 $code = $pagination . $code . $pagination;
2425 + $gallobj->html = $code;
2426 + $gallobj->init_id = $init_id;
2427 + return $gallobj;
2428 + }
1119 2429
1120 - 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)
1121 2433 {
1122 - $daysecs = self::$alloptions[self::$opt_spdcexp] * 60 * 60;
1123 - set_transient($spdckey, $code, $daysecs);
1124 - $allk = get_option(self::$spdcall, array());
1125 - $allk[] = $spdckey;
1126 - update_option(self::$spdcall, $allk);
1127 -
1128 - //self::debuglog((microtime(true) - $time_start) . "\t" . $spdckey . "\t" . $code . "\r\n");
2434 + return 0;
1129 2435 }
1130 - return $code;
2436 + return ($a->snippet->publishedAt > $b->snippet->publishedAt) ? -1 : 1;
1131 2437 }
1132 2438
1133 2439 public static function get_thumbnail_html($thumb, $options)
1134 2440 {
@@ -1133,29 +2439,17 @@
1133 2439 public static function get_thumbnail_html($thumb, $options)
1134 2440 {
1135 2441 $escId = esc_attr($thumb->id);
1136 2442 $code = '';
1137 - $styleclass = '';
1138 - $rawstyle = '';
1139 - $dschtml = '';
1140 - if (self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0)
1141 - {
1142 - if ($options->style == 'listview')
1143 - {
1144 - $styleclass = 'epyt-listview';
1145 - $dschtml = isset($thumb->dsc) && !empty($thumb->dsc) ? '<div class="epyt-gallery-dsc">' . $thumb->dsc . '</div>' : '';
1146 - }
1147 - else if ($options->style == 'carousel')
1148 - {
1149 - $rawstyle = ' style="width: ' . (100.0 / floatval($options->pageSize)) . '%;" ';
1150 - }
1151 - }
2443 + $code .= '<div tabindex="0" role="button" data-videoid="' . $escId . '" class="epyt-gallery-thumb">';
1152 2444
1153 - $code .= '<div data-videoid="' . $escId . '" class="epyt-gallery-thumb ' . $styleclass . '" ' . $rawstyle . '>';
1154 - $code .= '<div class="epyt-gallery-img-box"><div class="epyt-gallery-img" style="background-image: url(' . esc_attr($thumb->img) . ')">' .
1155 - '<div class="epyt-gallery-playhover"><img class="epyt-play-img" 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>' .
1156 2448 '</div></div>';
1157 - if ($options->style != 'carousel' && !empty($thumb->title))
2449 +
2450 +
2451 + if (!empty($thumb->title))
1158 2452 {
1159 2453 $code .= '<div class="epyt-gallery-title">' . esc_html($thumb->title) . '</div>';
1160 2454 }
1161 2455 else
@@ -1161,27 +2455,25 @@
1161 2455 else
1162 2456 {
1163 2457 $code .= '<div class="epyt-gallery-notitle"><span>' . esc_html($thumb->title) . '</span></div>';
1164 2458 }
1165 - $code .= $dschtml . '</div>';
1166 -
1167 -
2459 + $code .= '</div>';
1168 2460 return $code;
1169 2461 }
1170 2462
1171 2463 public static function my_embedplus_gallery_page()
1172 2464 {
1173 - if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
2465 + if (self::is_ajax())
1174 2466 {
1175 - check_ajax_referer('embedplus-nonce', 'security');
2467 + //check_ajax_referer('embedplus-nonce', 'security');
1176 2468 $options = (object) $_POST['options'];
1177 2469 $options->apiKey = self::$alloptions[self::$opt_apikey];
1178 - echo self::get_gallery_page($options);
2470 + echo self::get_gallery_page($options)->html;
1179 2471 die();
1180 2472 }
1181 2473 }
1182 2474
1183 - public static function get_html($m, $iscontent)
2475 + public static function get_html($m, $iscontent, $isoverride)
1184 2476 {
1185 2477 //$time_start = microtime(true);
1186 2478
1187 2479 $link = trim(str_replace(self::$badentities, self::$goodliterals, $m[0]));
@@ -1199,40 +2491,109 @@
1199 2491 $vtemp = explode('/', $linkparamstemp[0]);
1200 2492 $linkparams['v'] = array_pop($vtemp);
1201 2493 }
1202 2494
1203 - //$linkscheme = 'http';
1204 - $youtubebaseurl = 'youtube';
1205 - $schemaorgoutput = '';
1206 - $voloutput = '';
1207 - $dynsrc = '';
1208 - $dyntype = '';
1209 - $acctitle = '';
1210 -
1211 - $finalparams = $linkparams + self::$alloptions;
1212 -
1213 - $spdckey = '';
1214 - 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')
1215 2496 {
1216 - 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]))
1217 2499 {
1218 - $kparams = $finalparams;
1219 - ksort($kparams);
1220 - $jparams = json_encode($kparams);
1221 - $spdckey = self::$spdcprefix . '_' . md5($jparams);
1222 - $spdcval = get_transient($spdckey);
1223 - if (!empty($spdcval))
2500 + if (isset($linkparams['channel']))
1224 2501 {
1225 - //self::debuglog((microtime(true) - $time_start) . "\t" . $spdckey . "\t" . $spdcval . "\r\n");
1226 - 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 + }
1227 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 + }
1228 2572 }
1229 - catch (Exception $ex)
2573 + else
1230 2574 {
1231 -
2575 + return $live_error_msg;
1232 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 + }
1233 2582 }
1234 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 +
1235 2596 self::init_dimensions($link, $linkparams, $finalparams);
1236 2597
1237 2598 if (self::$alloptions[self::$opt_nocookie] == 1)
1238 2599 {
@@ -1238,68 +2599,31 @@
1238 2599 {
1239 2600 $youtubebaseurl = 'youtube-nocookie';
1240 2601 }
1241 2602
1242 -
1243 -// if (self::$alloptions[self::$opt_ssl] == 1)
1244 -// {
1245 -// $linkscheme = 'https';
1246 -// }
1247 -
1248 2603 if (self::$alloptions[self::$opt_defaultvol] == 1)
1249 2604 {
1250 2605 $voloutput = ' data-vol="' . self::$alloptions[self::$opt_vol] . '" ';
1251 2606 }
1252 2607
1253 -
1254 -// if (!(self::$alloptions[self::$opt_dohl] == 1 && isset($finalparams[self::$opt_hl]) && strlen($finalparams[self::$opt_hl]) == 2))
1255 -// {
1256 -// unset($finalparams[self::$opt_hl]);
1257 -// }
1258 - if (self::$alloptions[self::$opt_dohl] == 1)
2608 + if (is_numeric(self::$alloptions[self::$opt_rel]) && intval(self::$alloptions[self::$opt_rel]) === -1)
1259 2609 {
1260 - $locale = get_locale();
1261 - $finalparams[self::$opt_hl] = $locale;
2610 + $relstop = ' data-relstop="1" ';
1262 2611 }
1263 - else
1264 - {
1265 - unset($finalparams[self::$opt_hl]);
1266 - }
1267 2612
1268 - if (isset($finalparams[self::$opt_html5]) && $finalparams[self::$opt_html5] == 0)
2613 + if (!empty($finalparams[self::$opt_loop]))
1269 2614 {
1270 - unset($finalparams[self::$opt_html5]);
2615 + $relstop = '';
1271 2616 }
1272 2617
1273 - if (self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0)
2618 + if (self::$alloptions[self::$opt_dohl] == 1)
1274 2619 {
1275 -
1276 - if (self::$alloptions[self::$opt_schemaorg] == 1 && isset($finalparams['v']))
1277 - {
1278 - $schemaorgoutput = self::getschemaorgoutput($finalparams['v']);
1279 - }
1280 -
1281 -
1282 -
1283 - if (self::$alloptions[self::$opt_dynload] == 1
1284 - //&& $finalparams[self::$opt_autoplay] != 1
1285 - )
1286 - {
1287 - $dynsrc = 'data-ep-';
1288 - $dyntype = ' data-ep-a="' . self::$alloptions[self::$opt_dyntype] . '" ';
1289 - }
1290 -
1291 - if (isset($linkparams[self::$opt_vol]) && is_numeric(trim($linkparams[self::$opt_vol])))
1292 - {
1293 - $voloutput = ' data-vol="' . $linkparams[self::$opt_vol] . '" ';
1294 - }
2620 + $locale = get_locale();
2621 + $finalparams[self::$opt_hl] = $locale;
1295 2622 }
1296 2623 else
1297 2624 {
1298 - if (isset($finalparams[self::$opt_vol]))
1299 - {
1300 - unset($finalparams[self::$opt_vol]);
1301 - }
2625 + unset($finalparams[self::$opt_hl]);
1302 2626 }
1303 2627
1304 2628 $centercode = '';
1305 2629 if ($finalparams[self::$opt_center] == 1)
@@ -1317,10 +2641,25 @@
1317 2641 $acctitle = self::$oembeddata->title;
1318 2642 }
1319 2643 else
1320 2644 {
1321 - $odata = self::get_oembed('http://youtube.com/watch?v=' . $linkparams['v'], 1920, 1280);
1322 - $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 + }
1323 2662 }
1324 2663
1325 2664 if ($acctitle)
1326 2665 {
@@ -1325,8 +2664,12 @@
1325 2664 if ($acctitle)
1326 2665 {
1327 2666 $acctitle = ' title="' . esc_attr($acctitle) . '" ';
1328 2667 }
2668 + else
2669 + {
2670 + $acctitle = ' title="YouTube player" ';
2671 + }
1329 2672 }
1330 2673 catch (Exception $e)
1331 2674 {
1332 2675
@@ -1331,8 +2674,12 @@
1331 2674 {
1332 2675
1333 2676 }
1334 2677 }
2678 + else
2679 + {
2680 + $acctitle = ' title="YouTube player" ';
2681 + }
1335 2682
1336 2683 // playlist cleanup
1337 2684 $videoidoutput = isset($linkparams['v']) ? $linkparams['v'] : '';
1338 2685
@@ -1340,9 +2687,12 @@
1340 2687 {
1341 2688 try
1342 2689 {
1343 2690 $videoidoutput = '';
1344 - $finalparams['index'] = intval($finalparams['plindex']);
2691 + if (isset($finalparams['plindex']))
2692 + {
2693 + $finalparams['index'] = intval($finalparams['plindex']);
2694 + }
1345 2695 }
1346 2696 catch (Exception $ex)
1347 2697 {
1348 2698
@@ -1351,11 +2701,10 @@
1351 2701
1352 2702 $galleryWrapper1 = '';
1353 2703 $galleryWrapper2 = '';
1354 2704 $galleryCode = '';
1355 - if (
1356 - isset($finalparams['layout']) && strtolower($finalparams['layout']) == 'gallery' && isset($finalparams['list'])
1357 - )
2705 + $galleryid_ifm_data = '';
2706 + if (isset($finalparams['layout']) && strtolower($finalparams['layout']) == 'gallery' && isset($finalparams['list']))
1358 2707 {
1359 2708 $gallery_options = new stdClass();
1360 2709 $gallery_options->playlistId = $finalparams['list'];
1361 2710 $gallery_options->pageToken = null;
@@ -1361,26 +2710,103 @@
1361 2710 $gallery_options->pageToken = null;
1362 2711 $gallery_options->pageSize = $finalparams[self::$opt_gallery_pagesize];
1363 2712 $gallery_options->columns = intval($finalparams[self::$opt_gallery_columns]);
1364 2713 $gallery_options->showTitle = intval($finalparams[self::$opt_gallery_showtitle]);
1365 - $gallery_options->showDsc = intval($finalparams[self::$opt_gallery_showdsc]);
1366 - $gallery_options->style = $finalparams[self::$opt_gallery_style];
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]);
1367 2717 $gallery_options->apiKey = self::$alloptions[self::$opt_apikey];
1368 2718
1369 - $dynsrc = 'data-ep-gallery';
1370 - $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 . '">';
1371 2733 $galleryWrapper2 = '</div>';
1372 - $galleryCode = '<div class="epyt-gallery-list epyt-gallery-style-' . esc_attr($gallery_options->style) . '">' .
1373 - 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>' .
1374 2794 '</div>';
1375 - $videoidoutput = 'GALLERYVIDEOID';
1376 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 + }
1377 2803
1378 - $code1 = '<iframe ' . $dyntype . $centercode . ' id="_ytid_' . rand(10000, 99999) . '" width="' . self::$defaultwidth . '" height="' . self::$defaultheight .
1379 - '" ' . $dynsrc . 'src="//www.' . $youtubebaseurl . '.com/embed/' . $videoidoutput . '?';
1380 - $code2 = '" frameborder="0" type="text/html" class="__youtube_prefs__' . ($iscontent ? '' : ' __youtube_prefs_widget__') .
1381 - '"' . $voloutput . $acctitle . ' allowfullscreen webkitallowfullscreen mozallowfullscreen ></iframe>' . $schemaorgoutput;
2804 + $code2 = $end_responsive . $end_gb_wrapper;
1382 2805
2806 + $code1 .= $code_iframe1;
2807 + $code2 = $code_iframe2 . $code2;
2808 +
1383 2809 $origin = '';
1384 2810
1385 2811 try
1386 2812 {
@@ -1393,9 +2819,9 @@
1393 2819 catch (Exception $e)
1394 2820 {
1395 2821 $origin = '';
1396 2822 }
1397 - $finalsrc = 'enablejsapi=1&' . $origin;
2823 + $finalsrc = (self::$alloptions[self::$opt_ytapi_load] == 'never' ? '' : 'enablejsapi=1&') . $origin;
1398 2824
1399 2825 if (count($finalparams) > 1)
1400 2826 {
1401 2827 foreach ($finalparams as $key => $value)
@@ -1407,12 +2833,15 @@
1407 2833
1408 2834 }
1409 2835 else
1410 2836 {
1411 - $finalsrc .= htmlspecialchars($key) . '=' . htmlspecialchars($value) . '&';
1412 - 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
1413 2838 {
1414 - $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 + }
1415 2844 }
1416 2845 }
1417 2846 }
1418 2847 }
@@ -1417,51 +2846,65 @@
1417 2846 }
1418 2847 }
1419 2848 }
1420 2849
1421 - $code = $galleryWrapper1 . $code1 . $finalsrc . $code2 . $galleryCode . $galleryWrapper2; //. '<!--' . $m[0] . '-->';
1422 - // 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] . '-->';
1423 2863 self::$defaultheight = null;
1424 2864 self::$defaultwidth = null;
1425 2865 self::$oembeddata = null;
1426 2866
2867 + return $code;
2868 + }
1427 2869
1428 -
1429 -
1430 -
1431 - 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'))
1432 2874 {
1433 - $daysecs = self::$alloptions[self::$opt_spdcexp] * 60 * 60;
1434 - set_transient($spdckey, $code, $daysecs);
1435 - $allk = get_option(self::$spdcall, array());
1436 - $allk[] = $spdckey;
1437 - update_option(self::$spdcall, $allk);
1438 -
1439 - //self::debuglog((microtime(true) - $time_start) . "\t" . $spdckey . "\t" . $code . "\r\n");
2875 + return true;
1440 2876 }
1441 - return $code;
2877 + return false;
1442 2878 }
1443 2879
1444 - public static function debuglog($str)
2880 + public static function gdpr_mode()
1445 2881 {
1446 - $handle = fopen(__DIR__ . "\\debug.txt", "a+");
1447 - fwrite($handle, $str);
1448 - fclose($handle);
2882 + return (bool) self::$alloptions[self::$opt_gdpr_consent] && filter_input(INPUT_COOKIE, self::$gdpr_cookie_name, FILTER_SANITIZE_NUMBER_INT) != 1;
1449 2883 }
1450 2884
1451 - public static function spdcpurge()
2885 + public static function filter_the_content_light($content)
1452 2886 {
1453 - $allk = get_option(self::$spdcall, array());
1454 - 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++)
1455 2891 {
1456 - 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'))
1457 2893 {
1458 - $success = delete_transient($t);
2894 + $content = call_user_func(self::$the_content_filters[$i], $content);
1459 2895 }
1460 2896 }
1461 - update_option(self::$spdcall, array());
2897 + return $content;
1462 2898 }
1463 2899
2900 + public static function debuglog($str)
2901 + {
2902 + $handle = fopen(__DIR__ . "\\debug.txt", "a+");
2903 + fwrite($handle, $str);
2904 + fclose($handle);
2905 + }
2906 +
1464 2907 public static function keyvalue($qry, $includev)
1465 2908 {
1466 2909 $ytvars = explode('&', $qry);
1467 2910 $ytkvp = array();
@@ -1476,50 +2919,8 @@
1476 2919
1477 2920 return $ytkvp;
1478 2921 }
1479 2922
1480 - public static function getschemaorgoutput($vidid)
1481 - {
1482 - $schemaorgcode = '';
1483 - try
1484 - {
1485 - $ytapilink = 'https://www.googleapis.com/youtube/v3/videos?id=' . $vidid . '&part=contentDetails,snippet&key=' . self::$alloptions[self::$opt_apikey];
1486 -
1487 -
1488 - $apidata = wp_remote_get($ytapilink);
1489 - if (!is_wp_error($apidata))
1490 - {
1491 - $raw = wp_remote_retrieve_body($apidata);
1492 - if (!empty($raw))
1493 - {
1494 - $json = json_decode($raw, true);
1495 - if (is_array($json))
1496 - {
1497 - $_name = esc_attr(sanitize_text_field(str_replace("@", "&#64;", $json['items'][0]['snippet']['title'])));
1498 - $_description = esc_attr(sanitize_text_field(str_replace("@", "&#64;", $json['items'][0]['snippet']['description'])));
1499 - $_thumbnailUrl = esc_url("http://i.ytimg.com/vi/" . $vidid . "/0.jpg");
1500 - $_duration = $json['items'][0]['contentDetails']['duration']; // "T0H9M35S" "PT9M35S"
1501 - $_uploadDate = sanitize_text_field($json['items'][0]['snippet']['publishedAt']); // "2014-10-03T15:30:12.000Z"
1502 -
1503 - $schemaorgcode = '<span itemprop="video" itemscope itemtype="http://schema.org/VideoObject">';
1504 - $schemaorgcode .= '<meta itemprop="embedURL" content="http://www.youtube.com/embed/' . $vidid . '">';
1505 - $schemaorgcode .= '<meta itemprop="name" content="' . $_name . '">';
1506 - $schemaorgcode .= '<meta itemprop="description" content="' . $_description . '">';
1507 - $schemaorgcode .= '<meta itemprop="thumbnailUrl" content="' . $_thumbnailUrl . '">';
1508 - $schemaorgcode .= '<meta itemprop="duration" content="' . $_duration . '">';
1509 - $schemaorgcode .= '<meta itemprop="uploadDate" content="' . $_uploadDate . '">';
1510 - $schemaorgcode .= '</span>';
1511 - }
1512 - }
1513 - }
1514 - }
1515 - catch (Exception $ex)
1516 - {
1517 -
1518 - }
1519 - return $schemaorgcode;
1520 - }
1521 -
1522 2923 public static function secondsToDuration($seconds)
1523 2924 {
1524 2925 $remaining = $seconds;
1525 2926 $parts = array();
@@ -1594,9 +2995,9 @@
1594 2995 self::$defaultheight = self::$alloptions[self::$opt_defaultheight];
1595 2996 }
1596 2997 else
1597 2998 {
1598 - self::$defaultheight = self::get_aspect_height($url, $urlkvp, $finalparams);
2999 + self::$defaultheight = self::get_aspect_height($url, self::$defaultwidth);
1599 3000 }
1600 3001 }
1601 3002 }
1602 3003
@@ -1601,9 +3002,20 @@
1601 3002 }
1602 3003
1603 3004 public static function get_oembed($url, $height, $width)
1604 3005 {
1605 - 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 + }
1606 3018 $oembed = _wp_oembed_get_object();
1607 3019 $args = array();
1608 3020 $args['width'] = $width;
1609 3021 $args['height'] = $height;
@@ -1611,18 +3023,16 @@
1611 3023 self::$oembeddata = $oembed->fetch('https://www.youtube.com/oembed', $url, $args);
1612 3024 return self::$oembeddata;
1613 3025 }
1614 3026
1615 - public static function get_aspect_height($url, $urlkvp, $finalparams)
3027 + public static function get_aspect_height($url, $widthbox)
1616 3028 {
1617 -
1618 3029 // attempt to get aspect ratio correct height from oEmbed
1619 - $aspectheight = round((self::$defaultwidth * 9) / 16, 0);
3030 + $aspectheight = round(($widthbox * 9) / 16, 0);
1620 3031
1621 -
1622 3032 if ($url)
1623 3033 {
1624 - $odata = self::get_oembed($url, self::$defaultwidth, self::$defaultwidth);
3034 + $odata = self::get_oembed($url, $widthbox, $widthbox);
1625 3035
1626 3036 if ($odata)
1627 3037 {
1628 3038 $aspectheight = $odata->height;
@@ -1628,323 +3038,34 @@
1628 3038 $aspectheight = $odata->height;
1629 3039 }
1630 3040 }
1631 3041
1632 - if ($finalparams[self::$opt_controls] != 0 && $finalparams[self::$opt_autohide] != 1)
1633 - {
1634 - //add 28 for YouTube's own bar
1635 - $aspectheight += 28;
1636 - }
1637 3042 return $aspectheight;
1638 3043 }
1639 3044
1640 - public static function doftpostimg($postid, $post, $update)
1641 - {
1642 - if (current_user_can('edit_posts'))
1643 - {
1644 - if ((defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) || !in_array($post->post_status, array('publish', 'pending', 'draft', 'future', 'private')))
1645 - {
1646 - return;
1647 - }
1648 - try
1649 - {
1650 - self::doftpostimgfor($post);
1651 - }
1652 - catch (Exception $ex)
1653 - {
1654 - // display error message
1655 - }
1656 - }
1657 - }
1658 -
1659 - public static function doftpostimgfor($post)
1660 - {
1661 - $search_content = isset($post->post_content) ? $post->post_content : '';
1662 - $search_content = substr(wp_strip_all_tags($search_content), 0, 4000);
1663 -
1664 - $search_content = apply_filters('youtube_embedplus_video_content', $search_content);
1665 -
1666 - $vid_match = null;
1667 - if ($search_content && $post->ID && !has_post_thumbnail($post->ID) && preg_match(self::$justurlregex, $search_content, $vid_match)
1668 - )
1669 - {
1670 -
1671 - $first_vid_link = trim(str_replace(self::$badentities, self::$goodliterals, $vid_match[0]));
1672 -
1673 - $first_vid_link = preg_replace('/\s/', '', $first_vid_link);
1674 - $linkparamstemp = explode('?', $first_vid_link);
1675 -
1676 - $linkparams = array();
1677 - if (count($linkparamstemp) > 1)
1678 - {
1679 - $linkparams = self::keyvalue($linkparamstemp[1], true);
1680 - }
1681 - if (strpos($linkparamstemp[0], 'youtu.be') !== false && !isset($linkparams['v']))
1682 - {
1683 - $vtemp = explode('/', $linkparamstemp[0]);
1684 - $linkparams['v'] = array_pop($vtemp);
1685 - }
1686 -
1687 -
1688 -
1689 - $just_id = $linkparams['v'];
1690 - $ftimgurl = null;
1691 - if ($just_id)
1692 - {
1693 - require_once( ABSPATH . WPINC . '/class-oembed.php' );
1694 - $oembed = _wp_oembed_get_object();
1695 - $args = array();
1696 - $args['width'] = 1920;
1697 - $args['height'] = 1080;
1698 - $args['discover'] = false;
1699 - $odata = $oembed->fetch('https://www.youtube.com/oembed', 'http://youtube.com/watch?v=' . $just_id, $args);
1700 -
1701 - if ($odata)
1702 - {
1703 - $ftimgurl = $odata->thumbnail_url;
1704 - }
1705 - }
1706 -
1707 - $ftimgid = $ftimgurl && !is_wp_error($ftimgurl) ? self::media_sideload($ftimgurl, $post->ID, sanitize_title(preg_replace("/[^a-zA-Z0-9\s]/", "-", $post->title))) : 0;
1708 -
1709 - if (!$ftimgid)
1710 - {
1711 - return;
1712 - }
1713 -
1714 - set_post_thumbnail($post->ID, $ftimgid);
1715 - }
1716 - }
1717 -
1718 - public static function media_sideload($url, $post_id, $filename = null)
1719 - {
1720 - if (!$url || !$post_id)
1721 - {
1722 - return new WP_Error('missing', __('Please provide a valid URL and post ID', ''));
1723 - }
1724 -
1725 - $post_title = get_the_title($post_id);
1726 -
1727 - require_once(ABSPATH . 'wp-admin/includes/file.php');
1728 - $tmp = download_url($url);
1729 -
1730 - if (is_wp_error($tmp))
1731 - {
1732 - @unlink($file_array['tmp_name']);
1733 - $file_array['tmp_name'] = '';
1734 - return $tmp;
1735 - }
1736 -
1737 - preg_match('/[^\?]+\.(jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG)/', $url, $matches);
1738 - $url_filename = basename($matches[0]);
1739 - $url_type = wp_check_filetype($url_filename);
1740 -
1741 - if (!empty($filename))
1742 - {
1743 - $filename = sanitize_file_name($filename);
1744 - $tmppath = pathinfo($tmp);
1745 - $new = $tmppath['dirname'] . '/' . $filename . '.' . $tmppath['extension'];
1746 - rename($tmp, $new);
1747 - $tmp = $new;
1748 - }
1749 -
1750 - $file_array['tmp_name'] = $tmp;
1751 - if (!empty($filename))
1752 - {
1753 - $file_array['name'] = $filename . '.' . $url_type['ext'];
1754 - }
1755 - else
1756 - {
1757 - $file_array['name'] = $url_filename;
1758 - }
1759 -
1760 - $post_data = array(
1761 - 'post_title' => $post_title,
1762 - 'post_parent' => $post_id,
1763 - );
1764 -
1765 - require_once( ABSPATH . 'wp-admin/includes/file.php' );
1766 - require_once( ABSPATH . 'wp-admin/includes/media.php' );
1767 - require_once( ABSPATH . 'wp-admin/includes/image.php' );
1768 -
1769 - $att_id = media_handle_sideload($file_array, $post_id, null, $post_data);
1770 -
1771 - if (is_wp_error($att_id))
1772 - {
1773 - @unlink($file_array['tmp_name']);
1774 - return $att_id;
1775 - }
1776 -
1777 - return $att_id;
1778 - }
1779 -
1780 - public static function do_ogvideo()
1781 - {
1782 - global $wp_query;
1783 - $the_content = $wp_query->post->post_content;
1784 - $matches = Array();
1785 - $ismatch = preg_match_all(self::$justurlregex, $the_content, $matches);
1786 -
1787 - if ($ismatch)
1788 - {
1789 - $match = $matches[0][0];
1790 -
1791 - $link = trim(preg_replace('/&amp;/i', '&', $match));
1792 - $link = preg_replace('/\s/', '', $link);
1793 - $link = trim(str_replace(self::$badentities, self::$goodliterals, $link));
1794 -
1795 - $linkparamstemp = explode('?', $link);
1796 -
1797 - $linkparams = array();
1798 - if (count($linkparamstemp) > 1)
1799 - {
1800 - $linkparams = self::keyvalue($linkparamstemp[1], true);
1801 - }
1802 - if (strpos($linkparamstemp[0], 'youtu.be') !== false && !isset($linkparams['v']))
1803 - {
1804 - $vtemp = explode('/', $linkparamstemp[0]);
1805 - $linkparams['v'] = array_pop($vtemp);
1806 - }
1807 - ?>
1808 - <meta property="og:type" content="video">
1809 - <meta property="og:video" content="https://www.youtube.com/v/<?php echo $linkparams['v']; ?>?autohide=1&amp;version=3">
1810 - <meta property="og:video:type" content="application/x-shockwave-flash">
1811 - <meta property="og:video:width" content="480">
1812 - <meta property="og:video:height" content="360">
1813 - <meta property="og:image" content="https://img.youtube.com/vi/<?php echo $linkparams['v']; ?>/0.jpg">
1814 - <?php
1815 - }
1816 - }
1817 -
1818 3045 public static function ytprefs_plugin_menu()
1819 3046 {
1820 - if (self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0)
1821 - {
1822 - add_menu_page('YouTube Settings', 'YouTube PRO', 'manage_options', 'youtube-my-preferences', 'YouTubePrefs::ytprefs_show_options', plugins_url('images/youtubeicon16.png', __FILE__), '10.000392854349');
1823 - add_submenu_page('youtube-my-preferences', '', '', 'manage_options', 'youtube-my-preferences', 'YouTubePrefs::ytprefs_show_options');
1824 - 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');
1825 - }
1826 - else
1827 - {
1828 - add_menu_page('YouTube Settings', 'YouTube Free', 'manage_options', 'youtube-my-preferences', 'YouTubePrefs::ytprefs_show_options', plugins_url('images/youtubeicon16.png', __FILE__), '10.000392854349');
1829 - add_submenu_page('youtube-my-preferences', '', '', 'manage_options', 'youtube-my-preferences', 'YouTubePrefs::ytprefs_show_options');
1830 - 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');
1831 - }
1832 - add_submenu_page(null, 'YouTube Posts', 'YouTube Posts', 'manage_options', 'youtube-ep-glance', 'YouTubePrefs::glance_page');
1833 - }
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'));
1834 3049
1835 - public static function epstats_show_options()
1836 - {
1837 -
1838 - if (!current_user_can('manage_options'))
1839 - {
1840 - wp_die(__('You do not have sufficient permissions to access this page.'));
1841 - }
1842 -
1843 - if (self::$double_plugin)
1844 - {
1845 - //add_action('admin_notices', array("YouTubePrefs", "double_plugin_warning"));
1846 - self::double_plugin_warning();
1847 - }
1848 -
1849 -
1850 - // Now display the settings editing screen
1851 - ?>
1852 - <div class="wrap">
1853 - <style type="text/css">
1854 - .wrap {font-family: Arial;}
1855 - .epicon { width: 20px; height: 20px; vertical-align: middle; padding-right: 5px;}
1856 - .epindent {padding-left: 25px;}
1857 - iframe.shadow {-webkit-box-shadow: 0px 0px 20px 0px #000000; box-shadow: 0px 0px 20px 0px #000000;}
1858 - .bold {font-weight: bold;}
1859 - .orange {color: #f85d00;}
1860 - </style>
1861 - <br>
1862 - <?php
1863 - $thishost = (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : "");
1864 - $thiskey = self::$alloptions[self::$opt_pro];
1865 -
1866 - $dashurl = self::$epbase . "/dashboard/pro-easy-video-analytics.aspx?ref=protab&domain=" . $thishost . "&prokey=" . $thiskey;
1867 -
1868 - if (self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0)
1869 - {
1870 - //// header
1871 - echo "<h2>" . '<img src="' . plugins_url('images/epstats16.png', __FILE__) . '" /> ' . __('YouTube Analytics Dashboard') . "</h2>";
1872 - 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>';
1873 - }
1874 - else
1875 - {
1876 - //// header
1877 - 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>";
1878 - }
1879 - ?>
1880 - <iframe class="shadow" src="<?php echo $dashurl ?>" width="1060" height="3600" scrolling="auto"/>
1881 - </div>
1882 - <?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'));
1883 3053 }
1884 3054
1885 - public static function my_embedplus_pro_record()
3055 + public static function custom_admin_pointers_check()
1886 3056 {
1887 - $result = array();
1888 - if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
3057 + if (!self::$alloptions[self::$opt_show_pointer])
1889 3058 {
1890 - $tmppro = preg_replace('/[^A-Za-z0-9-]/i', '', $_REQUEST[self::$opt_pro]);
1891 - $new_options = array();
1892 - $new_options[self::$opt_pro] = $tmppro;
1893 - $all = get_option(self::$opt_alloptions);
1894 - $all = $new_options + $all;
1895 - update_option(self::$opt_alloptions, $all);
1896 -
1897 - if (strlen($tmppro) > 0)
1898 - {
1899 - $result['type'] = 'success';
1900 - }
1901 - else
1902 - {
1903 - $result['type'] = 'error';
1904 - }
1905 - echo json_encode($result);
3059 + return false;
1906 3060 }
1907 - else
1908 - {
1909 - $result['type'] = 'error';
1910 - header("Location: " . $_SERVER["HTTP_REFERER"]);
1911 - }
1912 - die();
1913 - }
1914 -
1915 - public static function my_embedplus_clearspdc()
1916 - {
1917 - $result = array();
1918 - if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
1919 - {
1920 - try
1921 - {
1922 - self::spdcpurge();
1923 - $result['type'] = 'success';
1924 - }
1925 - catch (Exception $ex)
1926 - {
1927 - $result['type'] = 'error';
1928 - }
1929 - echo json_encode($result);
1930 - }
1931 - else
1932 - {
1933 - $result['type'] = 'error';
1934 - header("Location: " . $_SERVER["HTTP_REFERER"]);
1935 - }
1936 - die();
1937 - }
1938 -
1939 - public static function custom_admin_pointers_check()
1940 - {
1941 - //return false; // ooopointer shut all off;
1942 3061 $admin_pointers = self::custom_admin_pointers();
1943 3062 foreach ($admin_pointers as $pointer => $array)
1944 3063 {
1945 3064 if ($array['active'])
3065 + {
1946 3066 return true;
3067 + }
1947 3068 }
1948 3069 }
1949 3070
1950 3071 public static function glance_script()
@@ -1951,10 +3072,12 @@
1951 3072 {
1952 3073 add_thickbox();
1953 3074 ?>
1954 3075 <script type="text/javascript">
1955 - function widen_ytprefs_glance() {
1956 - setTimeout(function () {
3076 + function widen_ytprefs_glance()
3077 + {
3078 + setTimeout(function ()
3079 + {
1957 3080 jQuery("#TB_window").animate({marginLeft: '-' + parseInt((780 / 2), 10) + 'px', width: '780px'}, 300);
1958 3081 jQuery("#TB_window iframe").animate({width: '780px'}, 300);
1959 3082 }, 15);
1960 3083 }
@@ -1960,40 +3083,43 @@
1960 3083 }
1961 3084
1962 3085 (function ($j)
1963 3086 {
1964 - $j(document).ready(function () {
3087 + $j(document).ready(function ()
3088 + {
1965 3089
1966 3090 $j.ajax({
1967 3091 type: "post",
1968 3092 dataType: "json",
1969 3093 timeout: 30000,
1970 - url: wpajaxurl,
3094 + url: window._EPYTA_ ? window._EPYTA_.wpajaxurl : ajaxurl,
1971 3095 data: {action: 'my_embedplus_glance_count'},
1972 - success: function (response) {
1973 - if (response.type == "success") {
3096 + success: function (response)
3097 + {
3098 + if (response.type === "success")
3099 + {
1974 3100 $j(response.container).append(response.data);
1975 - $j(".ytprefs_glance_button").click(widen_ytprefs_glance);
1976 - $j(window).resize(widen_ytprefs_glance);
1977 - 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')
1978 3104 {
1979 3105 //ep_do_pointers($j);
1980 3106 }
1981 3107 }
1982 - else {
3108 + else
3109 + {
1983 3110 }
1984 3111 },
1985 - error: function (xhr, ajaxOptions, thrownError) {
3112 + error: function (xhr, ajaxOptions, thrownError)
3113 + {
1986 3114
1987 3115 },
1988 - complete: function () {
3116 + complete: function ()
3117 + {
1989 3118 }
1990 3119 });
1991 -
1992 3120 });
1993 -
1994 - })(jQuery);
1995 - </script>
3121 + })(jQuery);</script>
1996 3122 <?php
1997 3123 }
1998 3124
1999 3125 public static function custom_admin_pointers_footer()
@@ -2010,15 +3136,17 @@
2010 3136 if ($array['active'])
2011 3137 {
2012 3138 ?>
2013 3139 $('<?php echo $array['anchor_id']; ?>').pointer({
3140 + pointerClass: 'wp-pointer ytprefs-pointer',
2014 3141 content: '<?php echo $array['content']; ?>',
2015 3142 position: {
2016 3143 edge: '<?php echo $array['edge']; ?>',
2017 3144 align: '<?php echo $array['align']; ?>'
2018 3145 },
2019 - close: function () {
2020 - $.post(wpajaxurl, {
3146 + close: function ()
3147 + {
3148 + $.post(window._EPYTA_ ? window._EPYTA_.wpajaxurl : ajaxurl, {
2021 3149 pointer: '<?php echo $pointer; ?>',
2022 3150 action: 'dismiss-wp-pointer'
2023 3151 });
2024 3152 }
@@ -2043,16 +3171,14 @@
2043 3171
2044 3172 $new_pointer_content = '<h3>' . __('New Update') . '</h3>'; // ooopointer
2045 3173
2046 3174 $new_pointer_content .= '<p>'; // ooopointer
2047 - 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)
2048 3177 {
2049 - $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.';
2050 3179 }
2051 - else
2052 - {
2053 - $new_pointer_content .= __("This update improves compatibility and adds features to Free and Pro galleries.");
2054 - }
3180 +
2055 3181 $new_pointer_content .= '</p>';
2056 3182
2057 3183 return array(
2058 3184 $prefix . 'new_items' => array(
@@ -2059,9 +3185,9 @@
2059 3185 'content' => $new_pointer_content,
2060 3186 'anchor_id' => 'a.toplevel_page_youtube-my-preferences', //'#ytprefs_glance_button',
2061 3187 'edge' => 'top',
2062 3188 'align' => 'left',
2063 - 'active' => (!in_array($prefix . 'new_items', $dismissed) )
3189 + 'active' => (!in_array($prefix . 'new_items', $dismissed))
2064 3190 ),
2065 3191 );
2066 3192 }
2067 3193
@@ -2069,11 +3195,29 @@
2069 3195 {
2070 3196 return isset($_POST[$idx]) && $_POST[$idx] == (true || 'on');
2071 3197 }
2072 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 +
2073 3218 public static function ytprefs_show_options()
2074 3219 {
2075 -
2076 3220 if (!current_user_can('manage_options'))
2077 3221 {
2078 3222 wp_die(__('You do not have sufficient permissions to access this page.'));
2079 3223 }
@@ -2079,14 +3223,11 @@
2079 3223 }
2080 3224
2081 3225 if (self::$double_plugin)
2082 3226 {
2083 - //add_action('admin_notices', array("YouTubePrefs", "double_plugin_warning"));
2084 3227 self::double_plugin_warning();
2085 3228 }
2086 3229
2087 -
2088 - // variables for the field and option names
2089 3230 $ytprefs_submitted = 'ytprefs_submitted';
2090 3231
2091 3232 // Read in existing option values from database
2092 3233
@@ -2093,256 +3234,25 @@
2093 3234 $all = get_option(self::$opt_alloptions);
2094 3235
2095 3236 // See if the user has posted us some information
2096 3237 // If they did, this hidden field will be set to 'Y'
2097 - 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'))
2098 3239 {
2099 - // Read their posted values
2100 -
2101 - $new_options = array();
2102 - $new_options[self::$opt_center] = self::postchecked(self::$opt_center) ? 1 : 0;
2103 - $new_options[self::$opt_glance] = self::postchecked(self::$opt_glance) ? 1 : 0;
2104 - $new_options[self::$opt_autoplay] = self::postchecked(self::$opt_autoplay) ? 1 : 0;
2105 - $new_options[self::$opt_debugmode] = self::postchecked(self::$opt_debugmode) ? 1 : 0;
2106 - $new_options[self::$opt_admin_off_scripts] = self::postchecked(self::$opt_admin_off_scripts) ? 1 : 0;
2107 - $new_options[self::$opt_old_script_method] = self::postchecked(self::$opt_old_script_method) ? 1 : 0;
2108 - $new_options[self::$opt_cc_load_policy] = self::postchecked(self::$opt_cc_load_policy) ? 1 : 0;
2109 - $new_options[self::$opt_iv_load_policy] = self::postchecked(self::$opt_iv_load_policy) ? 1 : 3;
2110 - $new_options[self::$opt_loop] = self::postchecked(self::$opt_loop) ? 1 : 0;
2111 - $new_options[self::$opt_modestbranding] = self::postchecked(self::$opt_modestbranding) ? 1 : 0;
2112 - $new_options[self::$opt_rel] = self::postchecked(self::$opt_rel) ? 1 : 0;
2113 - $new_options[self::$opt_showinfo] = self::postchecked(self::$opt_showinfo) ? 1 : 0;
2114 - $new_options[self::$opt_playsinline] = self::postchecked(self::$opt_playsinline) ? 1 : 0;
2115 - $new_options[self::$opt_origin] = self::postchecked(self::$opt_origin) ? 1 : 0;
2116 - $new_options[self::$opt_controls] = self::postchecked(self::$opt_controls) ? 2 : 0;
2117 - $new_options[self::$opt_autohide] = self::postchecked(self::$opt_autohide) ? 1 : 2;
2118 - $new_options[self::$opt_html5] = self::postchecked(self::$opt_html5) ? 1 : 0;
2119 - $new_options[self::$opt_theme] = self::postchecked(self::$opt_theme) ? 'dark' : 'light';
2120 - $new_options[self::$opt_color] = self::postchecked(self::$opt_color) ? 'red' : 'white';
2121 - $new_options[self::$opt_wmode] = self::postchecked(self::$opt_wmode) ? 'opaque' : 'transparent';
2122 - $new_options[self::$opt_vq] = self::postchecked(self::$opt_vq) ? 'hd720' : '';
2123 - $new_options[self::$opt_nocookie] = self::postchecked(self::$opt_nocookie) ? 1 : 0;
2124 - $new_options[self::$opt_playlistorder] = self::postchecked(self::$opt_playlistorder) ? 1 : 0;
2125 - $new_options[self::$opt_acctitle] = self::postchecked(self::$opt_acctitle) ? 1 : 0;
2126 - $new_options[self::$opt_ogvideo] = self::postchecked(self::$opt_ogvideo) ? 1 : 0;
2127 - $new_options[self::$opt_migrate] = self::postchecked(self::$opt_migrate) ? 1 : 0;
2128 - $new_options[self::$opt_migrate_youtube] = self::postchecked(self::$opt_migrate_youtube) ? 1 : 0;
2129 - //$new_options[self::$opt_ssl] = self::postchecked(self::$opt_ssl) ? 1 : 0;
2130 - $new_options[self::$opt_oldspacing] = self::postchecked(self::$opt_oldspacing) ? 1 : 0;
2131 - $new_options[self::$opt_responsive] = self::postchecked(self::$opt_responsive) ? 1 : 0;
2132 - $new_options[self::$opt_widgetfit] = self::postchecked(self::$opt_widgetfit) ? 1 : 0;
2133 - $new_options[self::$opt_schemaorg] = self::postchecked(self::$opt_schemaorg) ? 1 : 0;
2134 - $new_options[self::$opt_ftpostimg] = self::postchecked(self::$opt_ftpostimg) ? 1 : 0;
2135 - $new_options[self::$opt_spdc] = self::postchecked(self::$opt_spdc) ? 1 : 0;
2136 - $new_options[self::$opt_dynload] = self::postchecked(self::$opt_dynload) ? 1 : 0;
2137 - $new_options[self::$opt_defaultdims] = self::postchecked(self::$opt_defaultdims) ? 1 : 0;
2138 - $new_options[self::$opt_defaultvol] = self::postchecked(self::$opt_defaultvol) ? 1 : 0;
2139 - $new_options[self::$opt_dohl] = self::postchecked(self::$opt_dohl) ? 1 : 0;
2140 - $new_options[self::$opt_gallery_showtitle] = self::postchecked(self::$opt_gallery_showtitle) ? 1 : 0;
2141 - $new_options[self::$opt_gallery_customarrows] = self::postchecked(self::$opt_gallery_customarrows) ? 1 : 0;
2142 - $new_options[self::$opt_gallery_showdsc] = self::postchecked(self::$opt_gallery_showdsc) ? 1 : 0;
2143 -
2144 - $_defaultwidth = '';
2145 - try
2146 - {
2147 - $_defaultwidth = is_numeric(trim($_POST[self::$opt_defaultwidth])) ? intval(trim($_POST[self::$opt_defaultwidth])) : $_defaultwidth;
2148 - }
2149 - catch (Exception $ex)
2150 - {
2151 -
2152 - }
2153 - $new_options[self::$opt_defaultwidth] = $_defaultwidth;
2154 -
2155 - $_defaultheight = '';
2156 - try
2157 - {
2158 - $_defaultheight = is_numeric(trim($_POST[self::$opt_defaultheight])) ? intval(trim($_POST[self::$opt_defaultheight])) : $_defaultheight;
2159 - }
2160 - catch (Exception $ex)
2161 - {
2162 -
2163 - }
2164 - $new_options[self::$opt_defaultheight] = $_defaultheight;
2165 -
2166 - $_vol = '';
2167 - try
2168 - {
2169 - $_vol = is_numeric(trim($_POST[self::$opt_vol])) ? intval(trim($_POST[self::$opt_vol])) : $_vol;
2170 - }
2171 - catch (Exception $ex)
2172 - {
2173 -
2174 - }
2175 - $new_options[self::$opt_vol] = $_vol;
2176 -
2177 - $_gallery_pagesize = 12;
2178 - try
2179 - {
2180 - $_gallery_pagesize = is_numeric(trim($_POST[self::$opt_gallery_pagesize])) ? intval(trim($_POST[self::$opt_gallery_pagesize])) : $_gallery_pagesize;
2181 - }
2182 - catch (Exception $ex)
2183 - {
2184 -
2185 - }
2186 - $new_options[self::$opt_gallery_pagesize] = $_gallery_pagesize;
2187 -
2188 -
2189 - $_gallery_columns = 3;
2190 - try
2191 - {
2192 - $_gallery_columns = is_numeric(trim($_POST[self::$opt_gallery_columns])) ? intval(trim($_POST[self::$opt_gallery_columns])) : $_gallery_columns;
2193 - }
2194 - catch (Exception $ex)
2195 - {
2196 -
2197 - }
2198 - $new_options[self::$opt_gallery_columns] = $_gallery_columns;
2199 -
2200 - $_gallery_scrolloffset = 20;
2201 - try
2202 - {
2203 - $_gallery_scrolloffset = is_numeric(trim($_POST[self::$opt_gallery_scrolloffset])) ? intval(trim($_POST[self::$opt_gallery_scrolloffset])) : $_gallery_scrolloffset;
2204 - }
2205 - catch (Exception $ex)
2206 - {
2207 -
2208 - }
2209 - $new_options[self::$opt_gallery_scrolloffset] = $_gallery_scrolloffset;
2210 -
2211 - $_gallery_style = 'grid';
2212 - try
2213 - {
2214 - $_gallery_style = trim(str_replace(array(' ', "'", '"'), array('', '', ''), strip_tags($_POST[self::$opt_gallery_style])));
2215 - }
2216 - catch (Exception $ex)
2217 - {
2218 - $_gallery_style = 'grid';
2219 - }
2220 - $new_options[self::$opt_gallery_style] = $_gallery_style;
2221 -
2222 -
2223 - $_gallery_custom_prev = 'Prev';
2224 - try
2225 - {
2226 - $_gallery_custom_prev = trim(strip_tags($_POST[self::$opt_gallery_customprev]));
2227 - }
2228 - catch (Exception $ex)
2229 - {
2230 - $_gallery_custom_prev = 'Prev';
2231 - }
2232 - $new_options[self::$opt_gallery_customprev] = $_gallery_custom_prev;
2233 -
2234 -
2235 - $_gallery_custom_next = 'Next';
2236 - try
2237 - {
2238 - $_gallery_custom_next = trim(strip_tags($_POST[self::$opt_gallery_customnext]));
2239 - }
2240 - catch (Exception $ex)
2241 - {
2242 - $_gallery_custom_next = 'Next';
2243 - }
2244 - $new_options[self::$opt_gallery_customnext] = $_gallery_custom_next;
2245 -
2246 -
2247 - $_apikey = $all[self::$opt_apikey];
2248 - try
2249 - {
2250 - $_curr_apikey = $all[self::$opt_apikey];
2251 - $_schema_apikey = trim(str_replace(array(' ', "'", '"'), array('', '', ''), strip_tags($_POST[self::$opt_apikey])));
2252 - $_gallery_apikey = trim(str_replace(array(' ', "'", '"'), array('', '', ''), strip_tags($_POST[self::$opt_gallery_apikey])));
2253 -
2254 - if (!empty($_schema_apikey) && $_schema_apikey != $_curr_apikey)
2255 - {
2256 - $_apikey = $_schema_apikey;
2257 - }
2258 - if (!empty($_gallery_apikey) && $_gallery_apikey != $_curr_apikey)
2259 - {
2260 - $_apikey = $_gallery_apikey;
2261 - }
2262 - }
2263 - catch (Exception $ex)
2264 - {
2265 -
2266 - }
2267 - $new_options[self::$opt_apikey] = $_apikey;
2268 -
2269 - $_hl = '';
2270 - try
2271 - {
2272 - $temphl = strtolower(trim($_POST[self::$opt_hl]));
2273 - $_hl = preg_match('/^[a-z][a-z]$/i', $temphl) ? $temphl : '';
2274 - }
2275 - catch (Exception $ex)
2276 - {
2277 -
2278 - }
2279 - $new_options[self::$opt_hl] = $_hl;
2280 -
2281 - $_dyntype = '';
2282 - try
2283 - {
2284 - $tempdyntype = trim($_POST[self::$opt_dyntype]);
2285 - $_dyntype = preg_match('/^[a-zA-Z-]+$/i', $tempdyntype) ? $tempdyntype : '';
2286 - }
2287 - catch (Exception $ex)
2288 - {
2289 -
2290 - }
2291 - $new_options[self::$opt_dyntype] = $_dyntype;
2292 -
2293 - $_spdcexp = 24;
2294 - try
2295 - {
2296 - $_spdcexp = is_numeric(trim($_POST[self::$opt_spdcexp])) ? intval(trim($_POST[self::$opt_spdcexp])) : $_spdcexp;
2297 - }
2298 - catch (Exception $ex)
2299 - {
2300 -
2301 - }
2302 - $new_options[self::$opt_spdcexp] = $_spdcexp;
2303 -
2304 -
2305 -
2306 - $all = $new_options + $all;
2307 -
2308 - update_option(self::$opt_alloptions, $all);
2309 -
2310 - try
2311 - {
2312 - self::spdcpurge();
2313 - if ($all[self::$opt_spdc] == 1)
2314 - {
2315 - wp_remote_get(site_url());
2316 - }
2317 - }
2318 - catch (Exception $ex)
2319 - {
2320 -
2321 - }
3240 + $result = self::settings_save($all);
3241 + $all = get_option(self::$opt_alloptions);
2322 3242 ?>
2323 - <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>
2324 3244 <?php
2325 3245 }
2326 -
2327 -
2328 - // Now display the settings editing screen
2329 -
2330 - echo '<div class="wrap" style="max-width: 1000px;">';
2331 -
2332 - // header
2333 -
2334 - echo "<h2>" . '<img src="' . plugins_url('images/youtubeicon16.png', __FILE__) . '" /> ' . __('YouTube Settings') . "</h2>";
2335 -
2336 - // settings form
2337 3246 ?>
2338 3247
2339 3248 <style type="text/css">
2340 - .wrap {font-family: Arial; color: #000000;}
2341 - #ytform p { line-height: 20px; margin-bottom: 11px; }
2342 - #ytform ul li {margin-left: 30px; list-style: disc outside none;}
2343 - .ytindent {padding: 0px 0px 0px 20px; font-size: 12px;}
2344 - .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;}
2345 3255 .shadow {-webkit-box-shadow: 0px 0px 20px 0px #000000; box-shadow: 0px 0px 20px 0px #000000;}
2346 3256 .gopro {margin: 0px;}
2347 3257 .gopro img {vertical-align: middle;
2348 3258 width: 19px;
@@ -2351,563 +3261,1236 @@
2351 3261 .gopro li {margin-bottom: 0px;}
2352 3262 .orange {color: #f85d00;}
2353 3263 .bold {font-weight: bold;}
2354 3264 .grey{color: #888888;}
2355 - #goprobox {border-radius: 15px; padding: 10px 15px 15px 15px; margin-top: 15px; border: 3px solid #CCE5EC; position: relative;}
2356 - #salenote {position: absolute; right: 10px; top: 10px; width: 75px; height: 30px;}
2357 - #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;}
2358 3266 .pronon {font-weight: bold; color: #f85d00;}
2359 - 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;}
2360 3268 .procol {width: 475px; float: left;}
2361 - .ytindent .procol ul {font-size: 11px;}
2362 - .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;}
2363 3271 .italic {font-style: italic;}
2364 - .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;}
2365 3273 #wizleftlink {float: left; display: block; width: 240px; font-style: italic; text-align: center; text-decoration: none;}
2366 - .button-primary {font-weight: bold; white-space: nowrap;}
3274 + .button-primary {white-space: nowrap;}
2367 3275 p.submit {margin: 10px 0 0 0; padding: 10px 0 5px 0;}
2368 - .wp-core-ui p.submit .button-primary {font-size: 20px; height: 50px; padding: 0 20px 1px;
2369 - background: #2ea2cc; /* Old browsers */
2370 - background: -moz-linear-gradient(top, #2ea2cc 0%, #007396 98%); /* FF3.6+ */
2371 - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#2ea2cc), color-stop(98%,#007396)); /* Chrome,Safari4+ */
2372 - background: -webkit-linear-gradient(top, #2ea2cc 0%,#007396 98%); /* Chrome10+,Safari5.1+ */
2373 - background: -o-linear-gradient(top, #2ea2cc 0%,#007396 98%); /* Opera 11.10+ */
2374 - background: -ms-linear-gradient(top, #2ea2cc 0%,#007396 98%); /* IE10+ */
2375 - background: linear-gradient(to bottom, #2ea2cc 0%,#007396 98%); /* W3C */
2376 - 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;
2377 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 + }
2378 3288 p.submit em {display: inline-block; padding-left: 20px; vertical-align: middle; width: 240px; margin-top: -6px;}
2379 3289 #opt_pro {box-shadow: 0px 0px 5px 0px #1870D5; width: 320px;vertical-align: top;}
2380 - #goprobox h3 {font-size: 13px;}
2381 - .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;}
2382 3292 .chx p {margin: 0px 0px 5px 0px;}
2383 3293 .cuz {background-image: linear-gradient(to bottom,#4983FF,#0C5597) !important; color: #ffffff;}
2384 3294 .brightpro {background-image: linear-gradient(to bottom,#ff5500,#cc2200) !important; color: #ffffff;}
2385 3295 #boxdefaultdims {font-weight: bold; padding: 0px 10px; <?php echo $all[self::$opt_defaultdims] ? '' : 'display: none;' ?>}
2386 - #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;}
2387 3301 .textinput {border-width: 2px !important;}
3302 + input[type=text]::placeholder {font-weight: normal;}
2388 3303 h3.sect {border-radius: 10px; background-color: #D9E9F7; padding: 5px 5px 5px 10px; position: relative; font-weight: bold;}
2389 3304 h3.sect a {text-decoration: none; color: #E20000;}
2390 3305 h3.sect a.button-primary {color: #ffffff;}
2391 3306 h4.sect {border-radius: 10px; background-color: #D9E9F7; padding: 5px 5px 5px 10px; position: relative; font-weight: bold;}
2392 3307
3308 + .nav-tab-wrapper sup {line-height: 0;}
2393 3309 .ytnav {margin-bottom: 15px;}
2394 - .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;
2395 3311 text-decoration: none; background-color: #ffffff;}
3312 + .ytnav a:last-child {margin-right: 0;}
2396 3313 .jumper {height: 25px;}
2397 3314 .ssschema {float: right; width: 350px; height: auto; margin-right: 10px;}
2398 3315 .ssfb {float: right; height: auto; margin-right: 10px; margin-left: 15px; margin-bottom: 10px;}
2399 - .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;}
2400 3317 input[type=checkbox] {border: 1px solid #000000;}
2401 3318 .chktitle {display: inline-block; padding: 1px 5px 1px 5px; border-radius: 3px; background-color: #ffffff; border: 1px solid #dddddd;}
2402 3319 b, strong {font-weight: bold;}
2403 - input.checkbox[disabled] {border: 1px dashed #444444;}
3320 + input.checkbox[disabled], input[type=radio][disabled] {border: 1px dashed #444444;}
2404 3321 .pad10 {padding: 10px;}
2405 3322 #boxdohl {font-weight: bold; padding: 0px 10px; <?php echo $all[self::$opt_dohl] ? '' : 'display: none;' ?>}
2406 - #boxdyn {font-weight: bold; padding: 0px 10px; <?php echo $all[self::$opt_dynload] ? '' : 'display: none;' ?>}
2407 - #boxspdc {padding: 0px 10px; <?php echo $all[self::$opt_spdc] ? '' : 'display: none;' ?>}
2408 3323 #boxdefaultvol {font-weight: bold; padding: 0px 10px; <?php echo $all[self::$opt_defaultvol] ? '' : 'display: none;' ?>}
2409 3324 .vol-output {display: none; width: 30px; color: #008800;}
2410 3325 .vol-range {background-color: #dddddd; border-radius: 3px; cursor: pointer;}
2411 3326 input#vol {vertical-align: middle;}
2412 3327 .vol-seeslider {display: none;}
2413 - input#spdcexp {width: 70px;}
2414 3328 .indent-option {margin-left: 25px;}
2415 - #boxschemaorg {font-weight: bold; padding: 7px 0; <?php echo $all[self::$opt_schemaorg] ? 'display: block;' : 'display: none;' ?>}
2416 3329 #boxmigratelist { <?php echo $all[self::$opt_migrate] ? '' : 'display: none;' ?>}
2417 - .apikey-msg {display: inline-block; width: 45%; vertical-align: top;}
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;}
2418 3331 .apikey-video{margin-left: 3%; display: inline-block; width: 50%; position: relative; padding-top: 29%}
2419 3332 .apikey-video iframe{display: block; width: 100%; height: 100%; position: absolute; top: 0; left: 0;}
2420 - #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;' ?>}
2421 3338 .strike {text-decoration: line-through;}
2422 - .upgchecks { padding: 20px; border-radius: 15px; border: 1px dotted #777777; background-color: #fcfcfc; }
3339 + .upgchecks { padding: 20px; border: 1px dotted #777777; background-color: #fcfcfc; }
2423 3340 .clearboth {clear: both;}
2424 3341 div.hr {clear: both; border-bottom: 1px dotted #A8BDD8; margin: 20px 0 20px 0;}
2425 3342 .wp-pointer-buttons a.close {margin-top: 0 !important;}
2426 3343 .pad20{padding: 20px 0 20px 0;}
2427 3344 .ssgallery {float: right; width: 130px; height: auto; margin-left: 15px; border: 3px solid #ffffff;}
3345 + .sssubscribe{display: block; width: 400px; height: auto;}
2428 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;}
2429 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;
2430 3351 -webkit-box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.75);
2431 3352 -moz-box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.75);
2432 3353 box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.75); }
2433 - </style>
2434 - <div class="ytindent">
2435 - <br>
2436 - <div id="jumphowto"></div>
2437 - <div class="ytnav">
2438 - <a href="#jumphowto">How To Embed</a>
2439 - <a href="#jumpwiz">Visual Wizard</a>
2440 - <a href="#jumpdefaults">Defaults</a>
2441 - <a href="#jumpcompat">Compatibility</a>
2442 - <a href="#jumpgallery">Gallery Settings</a>
2443 - <a href="#jumpoverride">How To Override Defaults</a>
2444 - <a target="_blank" href="<?php echo self::$epbase . "/dashboard/pro-easy-video-analytics.aspx?ref=protab" ?>" style="border-color: #888888;">Upgrade?</a>
2445 - <a href="#jumpsupport">Support</a>
2446 - </div>
3354 + .alertify .ajs-body .ajs-content {line-height: 2.5em;}
3355 + #jumpmonetize h2:first-child {margin-bottom: 0;}
2447 3356
2448 - <form name="form1" method="post" action="" id="ytform">
2449 - <input type="hidden" name="<?php echo $ytprefs_submitted; ?>" value="Y">
3357 + .wrap-ytprefs h2.nav-tab-wrapper {
3358 + margin:22px 0 0 0;
3359 + }
2450 3360
2451 - <h3 class="sect">
2452 - How to Insert a YouTube Video or Playlist &nbsp; <a class="smallnote" href="#jumpgallery">(For gallery directions, go here &raquo;)</a>
2453 - </h3>
2454 - <p>
2455 - <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>
2456 - <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).
2457 - </p>
2458 - <p>
2459 - <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.
2460 - </p>
2461 - <p>
2462 - <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.
2463 - </p>
2464 - <p>
2465 - <b>Examples:</b><br><br>
2466 - <img style="width: 900px; height: auto;" class="shadow" src="<?php echo plugins_url('images/sshowto.png', __FILE__) ?>" />
2467 - </p>
2468 - <p>
2469 - Always follow these rules for any URL:
2470 - </p>
2471 - <ul class="reglist">
2472 - <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>
2473 - <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>
2474 - <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>
2475 - <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>
2476 - <code>[embedyt]http://www.youtube.com/watch?v=ABCDEF[/embedyt] [embedyt]http://www.youtube.com/watch?v=GHIJK[/embedyt]</code>
2477 - </ul>
3361 + .wrap-ytprefs h3 .nav-tab {
3362 + padding: 5px 10px;
3363 + }
2478 3364
2479 - <div class="jumper" id="jumpwiz"></div>
2480 - <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 + }
2481 3375
2482 - <p>
2483 - 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.
2484 - Simply click the <img style="vertical-align: text-bottom;" src="<?php echo plugins_url('images/wizbuttonbig.png', __FILE__) ?>"> wizard button found above
2485 - 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.
2486 - 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
2487 - you can click to directly embed the desired video link to your post without having to copy and paste.
2488 - </p>
2489 - <p>
2490 - The ability to read the latest Internet discussions about the videos you want to embed is now free to all users.
2491 - </p>
2492 - <p>
2493 - <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.
2494 - <br>
2495 - <br>
3376 + .gdpr-options-left {
3377 + width: 65%;
3378 + float: left;
3379 + clear: left;
3380 + }
2496 3381
2497 - <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 + }
2498 3387
2499 - </p>
2500 - <div class="jumper" id="jumpdefaults"></div>
2501 - <h3 class="sect">
2502 - <?php _e("Default YouTube Options") ?> <a href="#top" class="totop">&#9650; top</a>
2503 - </h3>
2504 - <p>
2505 - <?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.") ?>
2506 - </p>
2507 - <?php // self::save_changes_button(); ?>
3388 + .gdpr-options-right .img-gdpr-message {
3389 + width: 100%;
3390 + height: auto;
3391 + }
2508 3392
2509 - <div class="ytindent chx">
2510 - <p>
2511 - <input name="<?php echo self::$opt_glance; ?>" id="<?php echo self::$opt_glance; ?>" <?php checked($all[self::$opt_glance], 1); ?> type="checkbox" class="checkbox">
2512 - <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>
2513 - </p>
2514 - <p>
2515 - <input name="<?php echo self::$opt_center; ?>" id="<?php echo self::$opt_center; ?>" <?php checked($all[self::$opt_center], 1); ?> type="checkbox" class="checkbox">
2516 - <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>
2517 - </p>
2518 - <p>
2519 - <input name="<?php echo self::$opt_autoplay; ?>" id="<?php echo self::$opt_autoplay; ?>" <?php checked($all[self::$opt_autoplay], 1); ?> type="checkbox" class="checkbox">
2520 - <label for="<?php echo self::$opt_autoplay; ?>"><?php _e('<b class="chktitle">Autoplay:</b> Automatically start playing your videos.') ?></label>
2521 - </p>
2522 - <p>
2523 - <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">
2524 - <label for="<?php echo self::$opt_iv_load_policy; ?>"><?php _e('<b class="chktitle">Annotations:</b> Show annotations by default.') ?></label>
2525 - </p>
2526 - <p>
2527 - <input name="<?php echo self::$opt_loop; ?>" id="<?php echo self::$opt_loop; ?>" <?php checked($all[self::$opt_loop], 1); ?> type="checkbox" class="checkbox">
2528 - <label for="<?php echo self::$opt_loop; ?>"><?php _e('<b class="chktitle">Looping:</b> Loop all your videos.') ?></label>
2529 - </p>
2530 - <p>
2531 - <input name="<?php echo self::$opt_modestbranding; ?>" id="<?php echo self::$opt_modestbranding; ?>" <?php checked($all[self::$opt_modestbranding], 1); ?> type="checkbox" class="checkbox">
2532 - <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>
2533 - </p>
2534 - <p>
2535 - <input name="<?php echo self::$opt_rel; ?>" id="<?php echo self::$opt_rel; ?>" <?php checked($all[self::$opt_rel], 1); ?> type="checkbox" class="checkbox">
2536 - <label for="<?php echo self::$opt_rel; ?>"><?php _e('<b class="chktitle">Related Videos:</b> Show related videos at the end.') ?></label>
2537 - </p>
2538 - <p>
2539 - <input name="<?php echo self::$opt_showinfo; ?>" id="<?php echo self::$opt_showinfo; ?>" <?php checked($all[self::$opt_showinfo], 1); ?> type="checkbox" class="checkbox">
2540 - <label for="<?php echo self::$opt_showinfo; ?>"><?php _e('<b class="chktitle">Show Title:</b> Show the video title and other info.') ?></label>
2541 - </p>
2542 - <p>
2543 - <input name="<?php echo self::$opt_acctitle; ?>" id="<?php echo self::$opt_acctitle; ?>" <?php checked($all[self::$opt_acctitle], 1); ?> type="checkbox" class="checkbox">
2544 - <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>
2545 - </p>
2546 - <p>
2547 - <input name="<?php echo self::$opt_theme; ?>" id="<?php echo self::$opt_theme; ?>" <?php checked($all[self::$opt_theme], 'dark'); ?> type="checkbox" class="checkbox">
2548 - <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>
2549 - </p>
2550 - <p>
2551 - <input name="<?php echo self::$opt_color; ?>" id="<?php echo self::$opt_color; ?>" <?php checked($all[self::$opt_color], 'red'); ?> type="checkbox" class="checkbox">
2552 - <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>
2553 - </p>
2554 - <p>
2555 - <input name="<?php echo self::$opt_vq; ?>" id="<?php echo self::$opt_vq; ?>" <?php checked($all[self::$opt_vq], 'hd720'); ?> type="checkbox" class="checkbox">
2556 - <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>
2557 - </p>
2558 - <p>
2559 - <input name="<?php echo self::$opt_wmode; ?>" id="<?php echo self::$opt_wmode; ?>" <?php checked($all[self::$opt_wmode], 'opaque'); ?> type="checkbox" class="checkbox">
2560 - <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>
2561 - </p>
2562 - <p>
2563 - <input name="<?php echo self::$opt_defaultdims; ?>" id="<?php echo self::$opt_defaultdims; ?>" <?php checked($all[self::$opt_defaultdims], 1); ?> type="checkbox" class="checkbox">
2564 - <span id="boxdefaultdims">
2565 - 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;
2566 - 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;">
2567 - </span>
3393 + iframe#gdpr_consent_message_ifr {
3394 + min-height: 250px !important;
3395 + }
2568 3396
2569 - <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>
2570 - </p>
2571 - <p>
2572 - <input name="<?php echo self::$opt_responsive; ?>" id="<?php echo self::$opt_responsive; ?>" <?php checked($all[self::$opt_responsive], 1); ?> type="checkbox" class="checkbox">
2573 - <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>
2574 - </p>
2575 - <p>
2576 - <input name="<?php echo self::$opt_widgetfit; ?>" id="<?php echo self::$opt_widgetfit; ?>" <?php checked($all[self::$opt_widgetfit], 1); ?> type="checkbox" class="checkbox">
2577 - <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>
2578 - </p>
2579 - <p>
2580 - <input name="<?php echo self::$opt_playsinline; ?>" id="<?php echo self::$opt_playsinline; ?>" <?php checked($all[self::$opt_playsinline], 1); ?> type="checkbox" class="checkbox">
2581 - <label for="<?php echo self::$opt_playsinline; ?>">
2582 - <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.
2583 - <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>
2584 - </label>
2585 - </p>
2586 - <p>
2587 - <input name="<?php echo self::$opt_origin; ?>" id="<?php echo self::$opt_origin; ?>" <?php checked($all[self::$opt_origin], 1); ?> type="checkbox" class="checkbox">
2588 - <label for="<?php echo self::$opt_origin; ?>"><b class="chktitle">Extra Player Security: </b>
2589 - 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).
2590 - </label>
2591 - </p>
2592 - <p>
2593 - <input name="<?php echo self::$opt_nocookie; ?>" id="<?php echo self::$opt_nocookie; ?>" <?php checked($all[self::$opt_nocookie], 1); ?> type="checkbox" class="checkbox">
2594 - <span id="boxnocookie">
2595 - Reminder: If you see errors while testing your playlist embeds or watching your videos on mobile, please uncheck this option.
2596 - </span>
2597 - <label for="<?php echo self::$opt_nocookie; ?>">
2598 - <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>
2599 - </label>
2600 - </p>
2601 - <p>
2602 - <input name="<?php echo self::$opt_controls; ?>" id="<?php echo self::$opt_controls; ?>" <?php checked($all[self::$opt_controls], 2); ?> type="checkbox" class="checkbox">
2603 - <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>
2604 - </p>
2605 - <p>
2606 - <input name="<?php echo self::$opt_autohide; ?>" id="<?php echo self::$opt_autohide; ?>" <?php checked($all[self::$opt_autohide], 1); ?> type="checkbox" class="checkbox">
2607 - <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>
2608 - </p>
2609 - <!-- <p>
2610 - <input name="<?php echo self::$opt_ssl; ?>" id="<?php echo self::$opt_ssl; ?>" <?php checked($all[self::$opt_ssl], 1); ?> type="checkbox" class="checkbox">
2611 - <label for="<?php echo self::$opt_ssl; ?>">
2612 - <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.
2613 - 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>
2614 - </label>
2615 - </p>-->
2616 - <p>
2617 - <input name="<?php echo self::$opt_defaultvol; ?>" id="<?php echo self::$opt_defaultvol; ?>" <?php checked($all[self::$opt_defaultvol], 1); ?> type="checkbox" class="checkbox">
2618 - <span id="boxdefaultvol">
2619 - 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]); ?>" >
2620 - </span>
2621 - <label for="<?php echo self::$opt_defaultvol; ?>">
2622 - <b class="chktitle">Volume Initialization: </b>
2623 - 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>
2624 - </label>
2625 - </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 + }
2626 3410
2627 - <p>
2628 - <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">
2629 - <label for="<?php echo self::$opt_cc_load_policy; ?>"><?php _e('<b class="chktitle">Closed Captions:</b> Turn on closed captions by default.') ?></label>
2630 - </p>
2631 - <p>
2632 - <input name="<?php echo self::$opt_dohl; ?>" id="<?php echo self::$opt_dohl; ?>" <?php checked($all[self::$opt_dohl], 1); ?> type="checkbox" class="checkbox">
2633 - <!-- <span id="boxdohl">
2634 - 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">
2635 - </span>-->
2636 - <label for="<?php echo self::$opt_dohl; ?>"><b class="chktitle">Player Localization / Internationalization: </b>
2637 - 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>
2638 - </p>
2639 - <p>
2640 - <input name="<?php echo self::$opt_html5; ?>" id="<?php echo self::$opt_html5; ?>" <?php checked($all[self::$opt_html5], 1); ?> type="checkbox" class="checkbox">
2641 - <label for="<?php echo self::$opt_html5; ?>">
2642 - <b class="chktitle strike">HTML5 First:</b>
2643 - 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.
2644 - </label>
2645 - </p>
3411 + .epyt-deprecated {
3412 + color: #aaaaaa;
3413 + }
2646 3414
2647 - <p>
2648 - <input name="<?php echo self::$opt_playlistorder; ?>" id="<?php echo self::$opt_playlistorder; ?>" <?php checked($all[self::$opt_playlistorder], 1); ?> type="checkbox" class="checkbox">
2649 - <label for="<?php echo self::$opt_playlistorder; ?>">
2650 - <b class="chktitle">Playlist Ordering: <sup class="orange bold">NEW</sup></b>
2651 - 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).
2652 - Note that this is not for setting the thumbnail list order of galleries, just the standard playlist player that YouTube provides.
2653 - </label>
2654 - </p>
3415 + input[type="checkbox"] + label .check-note {
3416 + display: none;
3417 + }
2655 3418
3419 + input[type="checkbox"]:checked + label .check-note {
3420 + display: inline;
3421 + }
2656 3422
3423 + .not-live-content {
3424 + opacity: .3;
3425 + }
2657 3426
2658 - </div>
3427 + #not_live_on:checked ~ .not-live-content, #not_live_on_channel:checked ~ .not-live-content {
3428 + opacity: 1;
3429 + }
2659 3430
2660 - <div class="jumper" id="jumpcompat"></div>
2661 - <h3 class="sect">Compatibility Settings<sup class="orange bold">NEW</sup> <a href="#top" class="totop">&#9650; top</a></h3>
2662 - <p>
2663 - 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.
2664 - </p>
2665 - <div class="ytindent chx">
2666 - <p>
2667 - <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">
2668 - <label for="<?php echo self::$opt_old_script_method; ?>">
2669 - <b class="chktitle">Use Legacy Scripts: <sup class="orange bold">NEW</sup></b>
2670 - 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.
2671 - </label>
2672 - </p>
2673 - <p>
2674 - <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">
2675 - <label for="<?php echo self::$opt_admin_off_scripts; ?>">
2676 - <b class="chktitle">Turn Off Scripts While Editing: <sup class="orange bold">NEW</sup></b>
2677 - 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.
2678 - Don't worry, all other visitors to your site will still view your site normally.
2679 - </label>
2680 - </p>
2681 - <p>
2682 - <input name="<?php echo self::$opt_migrate; ?>" id="<?php echo self::$opt_migrate; ?>" <?php checked($all[self::$opt_migrate], 1); ?> type="checkbox" class="checkbox">
2683 - <label for="<?php echo self::$opt_migrate; ?>">
2684 - <b class="chktitle">Migrate Shortcodes: <sup class="orange bold">NEW</sup></b> Inherit other shortcodes.
2685 - </label>
2686 - <div id="boxmigratelist">
2687 - <ul>
2688 - <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>
2689 - <li class="smallnote orange" style="list-style: none;">This feature is beta. More shortcodes coming.</li>
2690 - </ul>
3431 + #facade_mode ~ .box_facade_mode {
3432 + opacity: .3;
3433 + }
2691 3434
2692 - </div>
2693 - </p>
2694 - <p>
2695 - <input name="<?php echo self::$opt_oldspacing; ?>" id="<?php echo self::$opt_oldspacing; ?>" <?php checked($all[self::$opt_oldspacing], 1); ?> type="checkbox" class="checkbox">
2696 - <label for="<?php echo self::$opt_oldspacing; ?>">
2697 - <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.
2698 - </label>
2699 - </p>
2700 - <p>
2701 - <input name="<?php echo self::$opt_debugmode; ?>" id="<?php echo self::$opt_debugmode; ?>" <?php checked($all[self::$opt_debugmode], 1); ?> type="checkbox" class="checkbox">
2702 - <label for="<?php echo self::$opt_debugmode; ?>">
2703 - <b class="chktitle">Debug Mode: <sup class="orange bold">NEW</sup></b> If you ask for support, we may ask you to turn on debug mode here.
2704 - It may print out some diagnostic info so that we can help you solve your issue.
2705 - </label>
2706 - </p>
2707 - </div>
2708 - <div class="jumper" id="jumpgallery"></div>
2709 - <h3 class="sect">Gallery Settings and Directions<sup class="orange bold">NEW</sup> <a href="#top" class="totop">&#9650; top</a></h3>
2710 - <img class="ssgallery" src="<?php echo plugins_url('images/ssgallery.png', __FILE__) ?>">
2711 - <p>
2712 - <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>.
2713 - Don't worry, it's an easy process. Just <a href="https://www.youtube.com/watch?v=2vmBACVETf4" 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:
2714 - </p>
2715 - <p>
2716 - Simply add the following parameter to the end of your playlist url:
2717 - </p>
2718 - <p><code>&layout=gallery</code></p>
2719 - <p>For example, below is a playlist that has been converted into a gallery. Notice the new layout parameter, with no spaces:</p>
2720 - <p>
2721 - <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>
2722 - </p>
2723 - <p class="smallnote">
2724 - Note: The PRO wizard has steps to fully create playlist, channel, and gallery codes like the above.
2725 - </p>
2726 - <p>
2727 - Below are the settings for galleries:
2728 - </p>
2729 - <div class="ytindent chx">
2730 - <p>
2731 - <b class="chktitle">YouTube API Key:</b>
2732 - <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;">
2733 - 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=2vmBACVETf4" target="_blank">Click this link &raquo;</a> and follow the video to the right to get your API key.
2734 - </p>
2735 - <p>
2736 - <label for="<?php echo self::$opt_gallery_pagesize; ?>"><b class="chktitle">Gallery Page Size:</b></label>
2737 - <select name="<?php echo self::$opt_gallery_pagesize; ?>" id="<?php echo self::$opt_gallery_pagesize; ?>" style="width: 60px;">
2738 - <?php
2739 - $gps_val = intval(trim($all[self::$opt_gallery_pagesize]));
2740 - $gps_val = min($gps_val, 50);
2741 - for ($gps = 1; $gps <= 50; $gps++)
2742 - {
2743 - ?><option <?php echo $gps_val == $gps ? 'selected' : '' ?> value="<?php echo $gps ?>"><?php echo $gps ?></option>
2744 - <?php
2745 - }
2746 - ?>
2747 - </select>
2748 - Enter how many thumbnails per page should be shown at once (YouTube allows a maximum of 50 per page).
2749 - </p>
2750 - <p>
2751 - <label for="<?php echo self::$opt_gallery_columns; ?>"><b class="chktitle">Number of Columns:</b></label>
2752 - <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]); ?>">
2753 - Enter how many thumbnails can fit per row.
2754 - </p>
2755 - <p>
2756 - <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">
2757 - <span id="boxcustomarrows">
2758 - 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;
2759 - 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;">
2760 - </span>
3435 + #facade_mode:checked ~ .box_facade_mode {
3436 + opacity: 1;
3437 + }
2761 3438
2762 - <label for="<?php echo self::$opt_gallery_customarrows; ?>">
2763 - <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.
2764 - </label>
2765 - </p>
2766 - <p>
2767 - <label for="<?php echo self::$opt_gallery_scrolloffset; ?>"><b class="chktitle">Scroll Offset:</b></label>
2768 - <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]); ?>">
2769 - 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.
2770 - </p>
2771 - <p>
2772 - <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">
2773 - <label for="<?php echo self::$opt_gallery_showtitle; ?>"><b class="chktitle">Show Thumbnail Title:</b> Show titles with each thumbnail.</label>
2774 - </p>
3439 + #defer_js ~ .box_defer_jquery {
3440 + opacity: .3;
3441 + }
2775 3442
2776 - </div>
3443 + #defer_js:checked ~ .box_defer_jquery {
3444 + opacity: 1;
3445 + }
2777 3446
2778 - <?php // self::save_changes_button(); ?>
3447 + .epyt-fitvid {
3448 + width: 100%;
3449 + padding-top: 56.25%;
3450 + position: relative;
3451 + }
2779 3452
2780 - <div class="upgchecks">
2781 - <h3 class="sect">PRO Features</h3>
2782 - <?php
2783 - if ($all[self::$opt_pro] && strlen(trim($all[self::$opt_pro])) > 5)
2784 - {
2785 - ?>
2786 - <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>
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 + }
3462 +
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>
2787 3485 <p>
2788 - <img class="ssaltgallery" src="<?php echo plugins_url('images/ssaltgalleryall.jpg', __FILE__) ?>" />
2789 - <?php $cleanstyle = trim($all[self::$opt_gallery_style]); ?>
2790 - <select name="<?php echo self::$opt_gallery_style; ?>" id="<?php echo self::$opt_gallery_style; ?>" >
2791 - <option value="">Gallery Style</option>
2792 - <option value="grid" <?php echo 'grid' === $cleanstyle ? 'selected' : '' ?> >Grid (default)</option>
2793 - <option value="listview" <?php echo 'listview' === $cleanstyle ? 'selected' : '' ?> >Vertical List</option>
2794 - <option value="carousel" <?php echo 'carousel' === $cleanstyle ? 'selected' : '' ?> >Horizontal Slider</option>
2795 - </select>
2796 - <label for="<?php echo self::$opt_gallery_style; ?>">
2797 - <b>(PRO)</b> <b class="chktitle">Alternate Gallery Styling: <sup class="orange">NEW</sup></b></b>
2798 - 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.
2799 - <a target="_blank" href="<?php echo self::$epbase ?>/responsive-youtube-playlist-channel-gallery-for-wordpress.aspx">Read more here &raquo;</a>
2800 - </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.
2801 3488 </p>
2802 - <div class="hr"></div>
2803 3489 <p>
2804 - <img class="ssaltgallery" src="<?php echo plugins_url('images/ssverticallayout.png', __FILE__) ?>" />
2805 - <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">
2806 - <label for="<?php echo self::$opt_gallery_showdsc; ?>">
2807 - <b>(PRO)</b> <b class="chktitle">Show Gallery Descriptions (for vertical list styling): </b>
2808 - For the vertical list layout, this option will show full descriptions with each thumbnail (other layouts don't have enough room).
2809 - </label>
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;">
2810 3492 </p>
2811 - <div class="hr"></div>
3493 + </section>
2812 3494
3495 + <section class="pattern" id="jumpdefaults">
3496 + <h2>
3497 + <?php _e("Default YouTube Options") ?>
3498 + </h2>
2813 3499 <p>
2814 - <input name="<?php echo self::$opt_spdc; ?>" id="<?php echo self::$opt_spdc; ?>" <?php checked($all[self::$opt_spdc], 1); ?> type="checkbox" class="checkbox">
2815 - <label for="<?php echo self::$opt_spdc; ?>">
2816 - <b>(PRO)</b> <b class="chktitle">Faster Page Loads (Caching): </b>
2817 - 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.
2818 - </label>
2819 - <div class="indent-option">
2820 - <div id="boxspdc">
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.") ?>
3501 + </p>
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>
2821 3532 <label>
2822 - <b class="chktitle">Cache Liftime (hours): </b>
2823 - <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"/>
3533 + <b class="chktitle">Related Videos:</b>
3534 + Show or hide related and recommended videos at the end of playback.
3535 + <br>
2824 3536 </label>
2825 - Tip: If your pages rarely change, you may wish to set this to a much higher value than 24 hours.
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>
2826 3562
2827 - <div class="pad20">
2828 - <input type="button" class="button button-primary" value="Click to clear YouTube cache"/>
2829 - <span style="display: none;" id="clearspdcloading" class="orange bold">Clearing...</span>
2830 - <span class="orange bold" style="display: none;" id="clearspdcsuccess">Finished clearing YouTube cache.</span>
2831 - <span class="orange bold" style="display: none;" id="clearspdcfailed">Sorry, there seemed to be a problem clearing the cache.</span>
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>
2832 3886 </div>
2833 3887 </div>
2834 3888 </div>
3889 + </section>
3890 + <section class="pattern" id="jumpprivacy">
3891 + <h2>Security Options</h2>
3892 + <p>
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.
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>
2835 3911 </p>
2836 - <div class="hr"></div>
3912 + <p>
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).
3916 + </label>
3917 + </p>
2837 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>.
3949 + </label>
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>
3954 +
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 + ?>
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>
4003 + </div>
4004 + </section>
4005 +
4006 + <section class="pattern" id="jumpwiz">
4007 + <h2>Visual YouTube Wizard Directions</h2>
2838 4008 <p>
2839 - <input name="<?php echo self::$opt_schemaorg; ?>" id="<?php echo self::$opt_schemaorg; ?>" <?php checked($all[self::$opt_schemaorg], 1); ?> type="checkbox" class="checkbox">
2840 - <label for="<?php echo self::$opt_schemaorg; ?>">
2841 - <b>(PRO)</b> <b class="chktitle">Video SEO Tags:</b> Update your YouTube embeds with Google, Bing, and Yahoo friendly video SEO markup.
2842 - </label>
2843 - <span id="boxschemaorg">
2844 - <span class="apikey-msg">
2845 - 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,
2846 - 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.
2847 - 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:
2848 - <br>
2849 - <span style="vertical-align: middle; display: inline-block;">
2850 - 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;">
2851 - </span>
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.
4011 + </p>
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>
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__) ?>">
4101 + <p>
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>
2852 4156 </span>
2853 - <span class="apikey-video">
2854 - <iframe width="384" height="216" src="https://www.youtube.com/embed/2vmBACVETf4?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;">
2855 4172 </span>
2856 - </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.
2857 4228 </p>
2858 - <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>
2859 4328 <p>
2860 - <input name="<?php echo self::$opt_dynload; ?>" id="<?php echo self::$opt_dynload; ?>" <?php checked($all[self::$opt_dynload], 1); ?> type="checkbox" class="checkbox">
2861 - <span id="boxdyn">
2862 - Animation:
2863 - <?php $cleandyn = trim($all[self::$opt_dyntype]); ?>
2864 - <select name="<?php echo self::$opt_dyntype; ?>" id="<?php echo self::$opt_dyntype; ?>" >
2865 - <option value="">Select type</option>
2866 - <option value="rotateIn" <?php echo 'rotateIn' === $cleandyn ? 'selected' : '' ?> >rotate in</option>
2867 - <option value="slideInRight" <?php echo 'slideInRight' === $cleandyn ? 'selected' : '' ?> >slide from right</option>
2868 - <option value="slideInLeft" <?php echo 'slideInLeft' === $cleandyn ? 'selected' : '' ?> >slide from left</option>
2869 - <option value="bounceIn" <?php echo 'bounceIn' === $cleandyn ? 'selected' : '' ?> >bounce in</option>
2870 - <option value="flipInX" <?php echo 'flipInX' === $cleandyn ? 'selected' : '' ?> >flip up/down</option>
2871 - <option value="flipInY" <?php echo 'flipInY' === $cleandyn ? 'selected' : '' ?> >flip left/right</option>
2872 - <option value="pulse" <?php echo 'pulse' === $cleandyn ? 'selected' : '' ?> >pulse</option>
2873 - <option value="tada" <?php echo 'tada' === $cleandyn ? 'selected' : '' ?> >jiggle</option>
2874 - <option value="fadeInDown" <?php echo 'fadeInDown' === $cleandyn ? 'selected' : '' ?> >fade in downward</option>
2875 - <option value="fadeInUp" <?php echo 'fadeInUp' === $cleandyn ? 'selected' : '' ?> >fade in upward</option>
2876 - <option value="zoomInDown" <?php echo 'zoomInDown' === $cleandyn ? 'selected' : '' ?> >zoom in downward</option>
2877 - <option value="zoomInUp" <?php echo 'zoomInUp' === $cleandyn ? 'selected' : '' ?> >zoom in upward</option>
2878 - </select>
2879 - </span>
2880 - <label for="<?php echo self::$opt_dynload; ?>">
2881 - <b>(PRO)</b> <b class="chktitle">Special Lazy-Loading Effects:</b>
2882 - 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>
2883 - </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.
2884 4330 </p>
2885 - <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>
2886 4334 <p>
2887 - <img class="ssfb" src="<?php echo plugins_url('images/ssfb.jpg', __FILE__) ?>" />
2888 - <input name="<?php echo self::$opt_ogvideo; ?>" id="<?php echo self::$opt_ogvideo; ?>" <?php checked($all[self::$opt_ogvideo], 1); ?> type="checkbox" class="checkbox">
2889 - <label for="<?php echo self::$opt_ogvideo; ?>">
2890 - <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>
2891 4479 </label>
2892 4480 </p>
2893 4481 <div class="hr"></div>
2894 4482 <p>
2895 - <img class="ssfb" src="<?php echo plugins_url('images/youtube_thumbnail_sample.jpg', __FILE__) ?>" />
2896 - <input name="<?php echo self::$opt_ftpostimg; ?>" id="<?php echo self::$opt_ftpostimg; ?>" <?php checked($all[self::$opt_ftpostimg], 1); ?> type="checkbox" class="checkbox">
2897 - <label for="<?php echo self::$opt_ftpostimg; ?>">
2898 - <b>(PRO)</b> <b class="chktitle">Automatic Video Thumbnails: </b>
2899 - 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!
2900 - (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>
2901 4488 </label>
4489 + <br>
4490 + <br>
2902 4491 </p>
2903 -
2904 - <?php
2905 - }
2906 - else
2907 - {
2908 - ?>
2909 - <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>
2910 4493 <p>
2911 4494 <img class="ssaltgallery" src="<?php echo plugins_url('images/ssaltgalleryall.jpg', __FILE__) ?>" />
2912 4495 <select disabled>
2913 4496 <option value="">Gallery Style</option>
@@ -2912,10 +4495,10 @@
2912 4495 <select disabled>
2913 4496 <option value="">Gallery Style</option>
2914 4497 </select>
2915 4498 <label>
2916 - <b>(PRO)</b> <b class="chktitle">Alternate Gallery Styling: <sup class="orange">NEW</sup></b> <span class="pronon">(PRO Users)</span>
2917 - 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.
2918 4501 <a target="_blank" href="<?php echo self::$epbase ?>/responsive-youtube-playlist-channel-gallery-for-wordpress.aspx">Read more here &raquo;</a>
2919 4502 </label>
2920 4503 </p>
2921 4504
@@ -2920,26 +4503,61 @@
2920 4503 </p>
2921 4504
2922 4505 <div class="hr"></div>
2923 4506 <p>
4507 + <img class="ssaltgallery" src="<?php echo plugins_url('images/ssverticallayout.png', __FILE__) ?>" />
2924 4508 <input disabled type="checkbox" class="checkbox">
2925 4509 <label>
2926 4510 <b class="chktitle">Show Gallery Descriptions (for vertical list styling): </b> <span class="pronon">(PRO Users)</span>
2927 - For the vertical list layout, this option will show full descriptions with each thumbnail (other layouts don't have enough room).
4511 + 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.
2928 4512 </label>
2929 4513 </p>
4514 + <div class="hr"></div>
4515 + <p>
4516 + <img class="ssaltgallery" src="<?php echo plugins_url('images/ssaltgallerycircles.jpg', __FILE__) ?>" />
4517 + <select disabled>
4518 + <option value="">Select Thumbnail Shape</option>
4519 + </select>
4520 + <label>
4521 + <b class="chktitle">Gallery Thumbnail Shape: </b> <span class="pronon">(PRO Users)</span>
4522 + Differentiate your gallery by showing different thumbnail shapes. We currently offer rectangle and circle shapes.
4523 + <a target="_blank" href="<?php echo self::$epbase ?>/responsive-youtube-playlist-channel-gallery-for-wordpress.aspx">Read more here &raquo;</a>
4524 + </label>
4525 + </p>
2930 4526
4527 + <div class="hr"></div>
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>
2931 4537
2932 4538 <div class="hr"></div>
4539 +
2933 4540 <p>
4541 + <img class="sshidethumbimg" src="<?php echo plugins_url('images/sshidethumbimg.jpg', __FILE__) ?>" />
2934 4542 <input disabled type="checkbox" class="checkbox">
2935 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>
2936 4554 <b class="chktitle">Faster Page Loads (Caching): </b> <span class="pronon">(PRO Users)</span>
2937 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.
2938 4556 </label>
2939 4557 <div class="indent-option">
2940 4558 <label>
2941 - <b class="chktitle">Cache Liftime (hours): </b>
4559 + <b class="chktitle">Cache Lifetime (hours): </b>
2942 4560 <input disabled value="24" type="number">
2943 4561 Tip: If your pages rarely change, you may wish to set this to a much higher value than 24 hours.
2944 4562 </label>
2945 4563 </div>
@@ -2945,13 +4563,12 @@
2945 4563 </div>
2946 4564 </p>
2947 4565 <div class="hr"></div>
2948 4566
2949 -
2950 4567 <p>
2951 4568 <input disabled type="checkbox" class="checkbox">
2952 4569 <label>
2953 - <b class="chktitle">Video SEO Tags:</b> <span class="pronon">(PRO Users)</span> Update your YouTube embeds with Google, Bing, and Yahoo friendly video SEO markup.
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.
2954 4571 </label>
2955 4572 </p>
2956 4573 <div class="hr"></div>
2957 4574 <p>
@@ -2956,26 +4573,17 @@
2956 4573 <div class="hr"></div>
2957 4574 <p>
2958 4575 <input disabled type="checkbox" class="checkbox">
2959 4576 <label>
2960 - <b class="chktitle">Special Loading Effects:</b> <span class="pronon">(PRO Users)</span>
2961 - 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>
2962 4578 </label>
2963 4579 </p>
2964 4580 <div class="hr"></div>
2965 4581 <p>
2966 - <img class="ssfb" src="<?php echo plugins_url('images/ssfb.jpg', __FILE__) ?>" />
2967 - <input disabled type="checkbox" class="checkbox">
2968 - <label>
2969 - <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.
2970 - </label>
2971 - </p>
2972 - <div class="hr"></div>
2973 - <p>
2974 4582 <img class="ssfb" src="<?php echo plugins_url('images/youtube_thumbnail_sample.jpg', __FILE__) ?>" />
2975 4583 <input disabled type="checkbox" class="checkbox">
2976 4584 <label>
2977 - <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>
2978 4586 Automatically grab the thumbnail image of the first video embedded in each post or page, and use it as the featured image.
2979 4587 All you have to do is click Update on a post or page and the plugin does the rest!
2980 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>
2981 4589 </label>
@@ -2981,243 +4589,60 @@
2981 4589 </label>
2982 4590 </p>
2983 4591 <div class="hr"></div>
2984 4592 <p>
2985 - <a href="<?php echo self::$epbase ?>/dashboard/pro-easy-video-analytics.aspx" target="_blank">Activate the above and several other features &raquo;</a>
2986 - </p>
2987 - <?php
2988 - }
2989 - ?>
2990 - <div class="clearboth"></div>
2991 - </div>
2992 - <?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>
2993 4597
2994 - <hr>
4598 + </section>
2995 4599
4600 + <section class="pattern" id="jumpsupport">
4601 + <h2>Plugin Support</h2>
2996 4602
2997 - <div class="jumper" id="jumpoverride"></div>
2998 -
2999 - <h3 class="sect">
3000 - <?php _e("How To Override Defaults / Other Options") ?> <a href="#top" class="totop">&#9650; top</a>
3001 - </h3>
3002 - <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 '&'.
3003 - <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>
3004 - <?php
3005 - _e('<ul>');
3006 - _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>");
3007 - _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>");
3008 - _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>");
3009 - _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>");
3010 - _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>");
3011 - _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>");
3012 - _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>");
3013 - _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>");
3014 - _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>");
3015 - _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>");
3016 - _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>");
3017 - _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>");
3018 - _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>");
3019 - _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>");
3020 - _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>");
3021 - _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>");
3022 - _e('</ul>');
3023 -
3024 - _e("<p>You can also start and end each individual video at particular times. Like the above, each option should begin with '&'</p>");
3025 - _e('<ul>');
3026 - _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>");
3027 - _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>");
3028 - _e('</ul>');
3029 - ?>
3030 - <div class="save-changes-follow"> <?php self::save_changes_button(isset($_POST[$ytprefs_submitted]) && $_POST[$ytprefs_submitted] == 'Y'); ?> </div>
3031 - </form>
3032 - <div class="jumper" id="jumppro"></div>
3033 - <div id="goprobox">
3034 - <?php
3035 - if ($all[self::$opt_pro] && strlen(trim($all[self::$opt_pro])) > 0)
3036 - {
3037 - echo "<h3>" . __('Thank you for going PRO.');
3038 - echo ' &nbsp;<input type="submit" name="showkey" class="button-primary" style="vertical-align: 15%;" id="showprokey" value="View my PRO key" />';
3039 - echo "</h3>";
3040 - ?>
3041 - <?php
3042 - }
3043 - else
3044 - {
3045 - ?>
3046 -
3047 - <h3 class="sect">
3048 - <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;
3049 - PRO users help keep new features coming and our coffee cups filled. Go PRO and get these perks in return:
3050 - </h3>
3051 - <div class="procol">
3052 - <ul class="gopro">
3053 - <li>
3054 - <img src="<?php echo plugins_url('images/iconcache.png', __FILE__) ?>">
3055 - 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)
3056 4620 </li>
3057 - <li>
3058 - <img src="<?php echo plugins_url('images/iconwizard.png', __FILE__) ?>">
3059 - Full Visual Embedding Wizard (Easily customize embeds without memorizing codes)
3060 - </li>
3061 - <li>
3062 - <img src="<?php echo plugins_url('images/icongallery.png', __FILE__) ?>">
3063 - Alternate Gallery Styling
3064 - </li>
3065 - <li>
3066 - <img src="<?php echo plugins_url('images/iconfx.png', __FILE__) ?>">
3067 - Add eye-catching special effects as your videos load
3068 - </li>
3069 - <li>
3070 - <img src="<?php echo plugins_url('images/deletechecker.png', __FILE__) ?>">
3071 - Deleted Video Checker (alerts you if YouTube deletes videos you embedded)
3072 - </li>
3073 - <li>
3074 - <img src="<?php echo plugins_url('images/globe.png', __FILE__) ?>">
3075 - Alerts when visitors from different countries are blocked from viewing your embeds
3076 - </li>
3077 - <li>
3078 - <img src="<?php echo plugins_url('images/mobilecompat.png', __FILE__) ?>">
3079 - Check if your embeds have restrictions that can block mobile viewing
3080 - </li>
3081 -
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>
3082 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>
3083 4632 </div>
3084 - <div class="procol" style="max-width: 465px;">
3085 - <ul class="gopro">
3086 - <li>
3087 - <img src="<?php echo plugins_url('images/videothumbs.png', __FILE__) ?>">
3088 - Automatic video thumbnail images (just click 'Update')
3089 - </li>
3090 - <li>
3091 - <img src="<?php echo plugins_url('images/prioritysupport.png', __FILE__) ?>">
3092 - Priority support (Puts your request in front)
3093 - </li>
3094 - <li>
3095 - <img src="<?php echo plugins_url('images/bulletgraph45.png', __FILE__) ?>">
3096 - User-friendly video analytics dashboard
3097 - </li>
3098 -
3099 - <li id="fbstuff">
3100 - <img src="<?php echo plugins_url('images/iconfb.png', __FILE__) ?>">
3101 - Automatic Open Graph tagging for Facebook
3102 - </li>
3103 - <!-- <li>
3104 - <img src="<?php echo plugins_url('images/iconythealth.png', __FILE__) ?>">
3105 - Instant YouTube embed diagnostic reports
3106 - </li> -->
3107 - <li>
3108 - <img src="<?php echo plugins_url('images/vseo.png', __FILE__) ?>">
3109 - Automatic tagging for video SEO (will even work for your old embeds)
3110 - </li>
3111 - <li>
3112 - <img src="<?php echo plugins_url('images/iconvolume.png', __FILE__) ?>">
3113 - Fine-Grained Volume Initialization – Individual video volume settings in the wizard
3114 - </li>
3115 -
3116 - <li>
3117 - <img src="<?php echo plugins_url('images/infinity.png', __FILE__) ?>">
3118 - Unlimited PRO upgrades and downloads
3119 - </li>
3120 - <!-- <li>
3121 - <img src="<?php echo plugins_url('images/questionsale.png', __FILE__) ?>">
3122 - What else? You tell us!
3123 - </li> -->
3124 - </ul>
3125 - </div>
3126 - <div style="clear: both;"></div>
3127 4633 <br>
3128 - <h3 class="bold">Enter and save your PRO key (emailed to you):</h3>
3129 - <?php } ?>
3130 - <form name="form2" method="post" action="" id="epform2" class="submitpro" <?php
3131 - if ($all[self::$opt_pro] && strlen(trim($all[self::$opt_pro])) > 0)
3132 - {
3133 - echo 'style="display: none;"';
3134 - }
3135 - ?>>
3136 -
3137 - <input name="<?php echo self::$opt_pro; ?>" id="opt_pro" value="<?php echo $all[self::$opt_pro]; ?>" type="text">
3138 - <input type="submit" name="Submit" class="button-primary" id="prokeysubmit" value="<?php _e('Save Key') ?>" />
3139 - <?php
3140 - if (!($all[self::$opt_pro] && strlen(trim($all[self::$opt_pro])) > 0))
3141 - {
3142 - ?>
3143 - &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>
3144 - <?php
3145 - }
3146 - ?>
3147 - <br>
3148 - <span style="display: none;" id="prokeyloading" class="orange bold">Verifying...</span>
3149 - <span class="orange bold" style="display: none;" id="prokeysuccess">Success! Please refresh this page.</span>
3150 - <span class="orange bold" style="display: none;" id="prokeyfailed">Sorry, that seems to be an invalid key, or it has been used already.</span>
3151 -
3152 - </form>
3153 -
4634 + </section>
3154 4635 </div>
3155 - <div class="smallnote">
3156 - <!--&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>
3157 - writing/editing. It will apply some experimental artificial intelligence techniques on your post content for these recommendations, all at the click of a button.
3158 - -->
3159 - </div>
3160 - <div class="jumper" id="jumpsupport"></div>
3161 - <div id="nonprosupport">
3162 - <h3 class="bold">Support tips for all users (Free and PRO)</h3>
3163 - 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:
3164 - <ul class="reglist">
3165 - <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>
3166 - <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>
3167 - <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>
3168 - <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>
3169 - <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>
3170 - <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)
3171 - </li>
3172 - <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>
3173 - <li>If your videos always appear full size, try turning off "Responsive video sizing."</li>
3174 - <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>
3175 - </ul>
3176 - <p>
3177 - Deactivating the No Cookies option has also been proven to solve player errors.
3178 - </p>
3179 - <p>
3180 - 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>
3181 - </p>
3182 - </div>
3183 - <br>
3184 - <h3 class="sect">
3185 - 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>
3186 - </h3>
3187 - <p>
3188 - <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.
3189 - </p>
3190 -
3191 -
3192 - <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>
3193 -
3194 - <?php
3195 - if (!($all[self::$opt_pro] && strlen(trim($all[self::$opt_pro])) > 0))
4636 + </div>
4637 + <script type="text/javascript">
4638 + (function ($)
3196 4639 {
3197 - ?>
3198 - <br>
3199 - <br>
3200 - <iframe src="<?php echo self::$epbase ?>/dashboard/likecoupon.aspx" width="600" height="500"></iframe>
3201 - <?php }
3202 - ?>
3203 - <div class="ytnav">
3204 - <a href="#jumphowto">How To Embed</a>
3205 - <a href="#jumpwiz">Visual Wizard</a>
3206 - <a href="#jumpdefaults">Defaults</a>
3207 - <a href="#jumpcompat">Compatibility</a>
3208 - <a href="#jumpgallery">Gallery Settings</a>
3209 - <a href="#jumpoverride">How To Override Defaults</a>
3210 - <a target="_blank" href="<?php echo self::$epbase . "/dashboard/pro-easy-video-analytics.aspx?ref=protab" ?>" style="border-color: #888888;">Upgrade?</a>
3211 - <a href="#jumpsupport">Support</a>
3212 - </div>
3213 -
3214 -
3215 - <script type="text/javascript">
3216 -
3217 - function savevalidate()
4640 + window.savevalidate = function (e)
3218 4641 {
4642 + var $formDefaults = $(e.target);
3219 4643 var valid = true;
4644 + var $tabFocus = '';
3220 4645 var alertmessage = '';
3221 4646 if (jQuery("#<?php echo self::$opt_defaultdims; ?>").is(":checked"))
3222 4647 {
3223 4648 if (!(jQuery.isNumeric(jQuery.trim(jQuery("#<?php echo self::$opt_defaultwidth; ?>").val())) &&
@@ -3225,8 +4650,9 @@
3225 4650 {
3226 4651 alertmessage += "Please enter valid numbers for default height and width, or uncheck the option.";
3227 4652 jQuery("#boxdefaultdims input").css("background-color", "#ffcccc").css("border", "2px solid #000000");
3228 4653 valid = false;
4654 + $tabFocus = $("#<?php echo self::$opt_defaultdims; ?>").closest('section');
3229 4655 }
3230 4656 }
3231 4657
3232 4658 if (jQuery("#<?php echo self::$opt_gallery_customarrows; ?>").is(":checked"))
@@ -3236,80 +4662,138 @@
3236 4662 {
3237 4663 alertmessage += "Please enter valid text for both the custom gallery Prev and Next buttons, or uncheck the option.";
3238 4664 jQuery("#boxcustomarrows input").css("background-color", "#ffcccc").css("border", "2px solid #000000");
3239 4665 valid = false;
4666 + $tabFocus = $("#<?php echo self::$opt_gallery_customarrows; ?>").closest('section');
3240 4667 }
3241 4668 }
3242 4669
3243 - if (jQuery("#<?php echo self::$opt_defaultvol; ?>").is(":checked"))
4670 +
4671 + if (jQuery("#<?php echo self::$opt_gallery_channelsub; ?>").is(":checked"))
3244 4672 {
3245 - 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()))
3246 4675 {
3247 - alertmessage += "Please enter a number between 0 and 100 for the default volume, or uncheck the option.";
3248 - 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");
3249 4678 valid = false;
4679 + $tabFocus = $("#<?php echo self::$opt_gallery_channelsub; ?>").closest('section');
3250 4680 }
3251 4681 }
3252 4682
3253 - if (jQuery("#<?php echo self::$opt_spdc; ?>").is(":checked"))
4683 +
4684 + if (jQuery("#<?php echo self::$opt_gallery_collapse_grid; ?>").is(":checked"))
3254 4685 {
3255 - if (!(jQuery.isNumeric(jQuery.trim(jQuery("#<?php echo self::$opt_spdcexp; ?>").val()))))
4686 + var emptyStacks = [];
4687 + jQuery("#box_collapse_grid input").each(function ()
3256 4688 {
3257 - alertmessage += "Please enter a valid number of hours (greater than 0) for the cache lifetime, or uncheck the option.";
3258 - 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.";
3259 4699 valid = false;
4700 + $tabFocus = $("#<?php echo self::$opt_gallery_collapse_grid; ?>").closest('section');
3260 4701 }
3261 4702 }
3262 4703
3263 4704
3264 4705
3265 - if (jQuery("#<?php echo self::$opt_schemaorg; ?>").is(":checked"))
4706 + if (jQuery("#<?php echo self::$opt_defaultvol; ?>").is(":checked"))
3266 4707 {
3267 - 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()))))
3268 4709 {
3269 - alertmessage += "Please enter a valid YouTube API key, or uncheck the 'Video SEO Tags' option.";
3270 - 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");
3271 4712 valid = false;
4713 + $tabFocus = $("#<?php echo self::$opt_defaultvol; ?>").closest('section');
3272 4714 }
3273 4715 }
3274 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);
3275 4733
4734 + var formData = $formDefaults.ytprefsFormJSON();
4735 + formData.action = 'my_embedplus_settings_save_ajax';
3276 4736
3277 - 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 ()
3278 4769 {
3279 - if (!(/^[A-Za-z-]+$/.test(jQuery.trim(jQuery("#<?php echo self::$opt_dyntype; ?>").val()))))
4770 + $a = $(this);
4771 + if (!$a.hasClass('href-link'))
3280 4772 {
3281 - alertmessage += "Please select an animation, or uncheck the option.";
3282 - jQuery("#boxdyn select").css("background-color", "#ffcccc").css("border", "2px solid #000000");
3283 - 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;
3284 4778 }
3285 - }
4779 + });
3286 4780
3287 -
3288 -
3289 -
3290 - // if (jQuery("#<?php echo self::$opt_dohl; ?>").is(":checked"))
3291 - // {
3292 - // if (!(/^[A-Za-z][A-Za-z]$/.test(jQuery.trim(jQuery("#<?php echo self::$opt_hl; ?>").val()))))
3293 - // {
3294 - // alertmessage += "Please enter a valid 2-letter language code.";
3295 - // jQuery("#boxdohl input").css("background-color", "#ffcccc").css("border", "2px solid #000000");
3296 - // valid = false;
3297 - // }
3298 - // }
3299 -
3300 - if (!valid)
4781 + if (window.location.hash && window.location.hash == '#jumpmonetize')
3301 4782 {
3302 - 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');
3303 4788 }
3304 - return valid;
3305 - }
3306 4789
3307 - var prokeyval;
3308 - var mydomain = escape("http://" + window.location.host.toString());
4790 + $('#ytform').on('submit', function (e)
4791 + {
4792 + return window.savevalidate(e);
4793 + });
3309 4794
3310 - jQuery(document).ready(function ($) {
3311 - jQuery('#<?php echo self::$opt_defaultdims; ?>').change(function ()
4795 + jQuery('#<?php echo self::$opt_defaultdims; ?>').on('change', function ()
3312 4796 {
3313 4797 if (jQuery(this).is(":checked"))
3314 4798 {
3315 4799 jQuery("#boxdefaultdims").show(500);
@@ -3319,10 +4803,9 @@
3319 4803 jQuery("#boxdefaultdims").hide(500);
3320 4804 }
3321 4805
3322 4806 });
3323 -
3324 - jQuery('#<?php echo self::$opt_gallery_customarrows; ?>').change(function ()
4807 + jQuery('#<?php echo self::$opt_gallery_customarrows; ?>').on('change', function ()
3325 4808 {
3326 4809 if (jQuery(this).is(":checked"))
3327 4810 {
3328 4811 jQuery("#boxcustomarrows").show(500);
@@ -3332,36 +4815,55 @@
3332 4815 jQuery("#boxcustomarrows").hide(500);
3333 4816 }
3334 4817
3335 4818 });
4819 + jQuery('#<?php echo self::$opt_gallery_collapse_grid; ?>').on('change', function ()
4820 + {
4821 + if (jQuery(this).is(":checked"))
4822 + {
4823 + jQuery("#box_collapse_grid").show(500);
4824 + }
4825 + else
4826 + {
4827 + jQuery("#box_collapse_grid").hide(500);
4828 + }
4829 + });
4830 + jQuery('#<?php echo self::$opt_restrict_wizard; ?>').on('change', function ()
4831 + {
4832 + if (jQuery(this).is(":checked"))
4833 + {
4834 + jQuery("#box_restrict_wizard").show(500);
4835 + }
4836 + else
4837 + {
4838 + jQuery("#box_restrict_wizard").hide(500);
4839 + }
4840 + });
3336 4841
3337 - jQuery('#<?php echo self::$opt_dynload; ?>').change(function ()
4842 + jQuery('#<?php echo self::$opt_gallery_channelsub; ?>').on('change', function ()
3338 4843 {
3339 4844 if (jQuery(this).is(":checked"))
3340 4845 {
3341 - jQuery("#boxdyn").show(500);
4846 + jQuery("#boxchannelsub").show(500);
3342 4847 }
3343 4848 else
3344 4849 {
3345 - jQuery("#boxdyn").hide(500);
4850 + jQuery("#boxchannelsub").hide(500);
3346 4851 }
3347 4852
3348 4853 });
3349 -
3350 - jQuery('#<?php echo self::$opt_spdc; ?>').change(function ()
4854 + jQuery('#<?php echo self::$opt_responsive; ?>').on('change', function ()
3351 4855 {
3352 4856 if (jQuery(this).is(":checked"))
3353 4857 {
3354 - jQuery("#boxspdc").show(500);
4858 + jQuery("#boxresponsive_all").show(500);
3355 4859 }
3356 4860 else
3357 4861 {
3358 - jQuery("#boxspdc").hide(500);
4862 + jQuery("#boxresponsive_all").hide(500);
3359 4863 }
3360 4864 });
3361 -
3362 -
3363 - jQuery('#<?php echo self::$opt_migrate; ?>').change(function ()
4865 + jQuery('#<?php echo self::$opt_migrate; ?>').on('change', function ()
3364 4866 {
3365 4867 if (jQuery(this).is(":checked"))
3366 4868 {
3367 4869 jQuery("#boxmigratelist").show(500);
@@ -3370,12 +4872,9 @@
3370 4872 {
3371 4873 jQuery("#boxmigratelist").hide(500);
3372 4874 }
3373 4875 });
3374 -
3375 -
3376 -
3377 - jQuery('#<?php echo self::$opt_nocookie; ?>').change(function ()
4876 + jQuery('#<?php echo self::$opt_nocookie; ?>').on('change', function ()
3378 4877 {
3379 4878 if (jQuery(this).is(":checked"))
3380 4879 {
3381 4880 jQuery("#boxnocookie").show(500);
@@ -3385,38 +4884,22 @@
3385 4884 jQuery("#boxnocookie").hide(500);
3386 4885 }
3387 4886
3388 4887 });
3389 -
3390 - jQuery('#<?php echo self::$opt_schemaorg; ?>').change(function ()
4888 + jQuery('#<?php echo self::$opt_gdpr_consent; ?>').on('change', function ()
3391 4889 {
3392 4890 if (jQuery(this).is(":checked"))
3393 4891 {
3394 - jQuery("#boxschemaorg").show(500);
4892 + jQuery("#box_gdpr_consent").show(500);
3395 4893 }
3396 4894 else
3397 4895 {
3398 - jQuery("#boxschemaorg").hide(500);
4896 + jQuery("#box_gdpr_consent").hide(500);
3399 4897 }
4898 +
3400 4899 });
3401 4900
3402 -
3403 - // jQuery('#<?php echo self::$opt_dohl; ?>').change(function()
3404 - // {
3405 - // if (jQuery(this).is(":checked"))
3406 - // {
3407 - // jQuery("#boxdohl").show(500);
3408 - // }
3409 - // else
3410 - // {
3411 - // jQuery("#boxdohl").hide(500);
3412 - // }
3413 - //
3414 - // });
3415 -
3416 -
3417 -
3418 - jQuery('#<?php echo self::$opt_defaultvol; ?>').change(function ()
4901 + jQuery('#<?php echo self::$opt_defaultvol; ?>').on('change', function ()
3419 4902 {
3420 4903 if (jQuery(this).is(":checked"))
3421 4904 {
3422 4905 jQuery("#boxdefaultvol").show(500);
@@ -3426,9 +4909,8 @@
3426 4909 jQuery("#boxdefaultvol").hide(500);
3427 4910 }
3428 4911
3429 4912 });
3430 -
3431 4913 var rangedetect = document.createElement("input");
3432 4914 rangedetect.setAttribute("type", "range");
3433 4915 var canrange = rangedetect.type !== "text";
3434 4916 //canrange = false;
@@ -3433,9 +4915,10 @@
3433 4915 var canrange = rangedetect.type !== "text";
3434 4916 //canrange = false;
3435 4917 if (canrange)
3436 4918 {
3437 - $("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 + {
3438 4921 $('.vol-output').text($(this).val() > 0 ? $(this).val() + '%' : 'Mute');
3439 4922 });
3440 4923 $('.vol-output').css("display", "inline-block").text($("input#vol").val() > 0 ? $("input#vol").val() + '%' : 'Mute');
3441 4924 $('.vol-seeslider').show();
@@ -3445,428 +4928,1195 @@
3445 4928 {
3446 4929 $("input#vol").width(40);
3447 4930 }
3448 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 + });
3449 4943
3450 - jQuery('#boxspdc input.button').click(function () {
3451 - jQuery('#clearspdcloading').show();
3452 - jQuery('#clearspdcfailed').hide();
3453 - jQuery('#clearspdcsuccess').hide();
4944 + });
4945 + })(jQuery);
4946 + </script>
3454 4947
3455 - $clearbutton = jQuery(this);
3456 - $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>
3457 4949
3458 - jQuery.ajax({
3459 - type: "post",
3460 - dataType: "json",
3461 - timeout: 30000,
3462 - url: wpajaxurl,
3463 - data: {action: 'my_embedplus_clearspdc'},
3464 - success: function (response) {
3465 - if (response.type == "success") {
3466 - jQuery("#clearspdcsuccess").show();
3467 - }
3468 - else {
3469 - jQuery("#clearspdcfailed").show();
3470 - }
3471 - },
3472 - error: function (xhr, ajaxOptions, thrownError) {
3473 - jQuery("#clearspdcfailed").show();
3474 - },
3475 - complete: function () {
3476 - jQuery('#clearspdcloading').hide();
3477 - $clearbutton.removeAttr('disabled');
3478 - }
4950 + <?php
4951 + if (function_exists('add_thickbox'))
4952 + {
4953 + add_thickbox();
4954 + }
4955 + }
3479 4956
3480 - });
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;
3481 5013
3482 - });
5014 + $new_options[self::$opt_cc_lang_pref] = sanitize_title($_POST[self::$opt_cc_lang_pref]);
3483 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;
3484 5026
3485 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;
3486 5038
3487 - jQuery("#showcase-validate").click(function () {
3488 - window.open("<?php echo self::$epbase . "/showcase-validate.aspx?prokey=" . self::$alloptions[self::$opt_pro] ?>" + "&domain=" + mydomain);
3489 - });
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;
3490 5049
3491 - jQuery('#showprokey').click(function () {
3492 - jQuery('.submitpro').show(500);
3493 - return false;
3494 - });
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;
3495 5064
3496 - jQuery('#prokeysubmit').click(function () {
3497 - jQuery(this).attr('disabled', 'disabled');
3498 - jQuery('#prokeyfailed').hide();
3499 - jQuery('#prokeysuccess').hide();
3500 - jQuery('#prokeyloading').show();
3501 - 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;
3502 5079
3503 - var tempscript = document.createElement("script");
3504 - tempscript.src = "//www.embedplus.com/dashboard/wordpress-pro-validatejp.aspx?simple=1&prokey=" + prokeyval + "&domain=" + mydomain;
3505 - var n = document.getElementsByTagName("head")[0].appendChild(tempscript);
3506 - setTimeout(function () {
3507 - n.parentNode.removeChild(n);
3508 - }, 500);
3509 - return false;
3510 - });
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;
3511 5090
3512 - window.embedplus_record_prokey = function (good) {
3513 5091
3514 - jQuery.ajax({
3515 - type: "post",
3516 - dataType: "json",
3517 - timeout: 30000,
3518 - url: wpajaxurl,
3519 - data: {action: 'my_embedplus_pro_record', <?php echo self::$opt_pro; ?>: (good ? prokeyval : "")},
3520 - success: function (response) {
3521 - if (response.type == "success") {
3522 - jQuery("#prokeysuccess").show();
3523 - }
3524 - else {
3525 - jQuery("#prokeyfailed").show();
3526 - }
3527 - },
3528 - error: function (xhr, ajaxOptions, thrownError) {
3529 - jQuery('#prokeyfailed').show();
3530 - },
3531 - complete: function () {
3532 - jQuery('#prokeyloading').hide();
3533 - jQuery('#prokeysubmit').removeAttr('disabled');
3534 - }
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;
3535 5102
3536 - });
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;
3537 5113
3538 - };
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;
3539 5124
3540 - });
3541 - </script>
3542 - <?php
3543 - if (function_exists('add_thickbox'))
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;
5135 +
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;
5140 + }
5141 + catch (Exception $ex)
5142 + {
5143 +
5144 + }
5145 + $new_options[self::$opt_gallery_pagesize] = $_gallery_pagesize;
5146 +
5147 +
5148 + $_gallery_columns = 3;
5149 + try
5150 + {
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;
5158 +
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;
5164 + }
5165 + catch (Exception $ex)
5166 + {
5167 +
5168 + }
5169 + $new_options[self::$opt_gallery_collapse_grid_breaks] = $_gallery_collapse_grid_breaks;
5170 +
5171 +
5172 +
5173 + $_gallery_scrolloffset = 20;
5174 + try
5175 + {
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;
5183 +
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;
5196 +
5197 +
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;
5208 +
5209 +
5210 + $_gallery_custom_prev = 'Prev';
5211 + try
5212 + {
5213 + $_gallery_custom_prev = trim(strip_tags($_POST[self::$opt_gallery_customprev]));
5214 + }
5215 + catch (Exception $ex)
5216 + {
5217 + $_gallery_custom_prev = 'Prev';
5218 + }
5219 + $new_options[self::$opt_gallery_customprev] = $_gallery_custom_prev;
5220 +
5221 +
5222 + $_gallery_custom_next = 'Next';
5223 + try
5224 + {
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')))
3544 5301 {
3545 - add_thickbox();
5302 + $input[self::$opt_ytapi_load] = 'light';
3546 5303 }
3547 - ?>
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]);
5310 + }
5311 + catch (Exception $ex)
5312 + {
5313 + $messages[] = 'Please enter valid data.';
5314 + }
3548 5315
3549 - <?php
5316 + if (empty($messages))
5317 + {
5318 + return true;
3550 5319 }
5320 + return $messages;
5321 + }
3551 5322
3552 - public static function save_changes_button($submitted)
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 + );
5345 +
5346 +
5347 + $input = shortcode_atts($default, stripslashes_deep($_POST));
5348 + $valid = self::onboarding_save_valid($input);
5349 + if ($valid === true)
3553 5350 {
3554 - $button_label = 'Save Changes';
3555 - if ($submitted)
3556 - {
3557 - $button_label = 'Changes Saved';
3558 - ?>
3559 - <script type="text/javascript">
3560 - jQuery(document).ready(function () {
3561 - setTimeout(function () {
3562 - jQuery('input.ytprefs-submit').val('Save Changes');
3563 - }, 3000);
3564 - });
5351 + self::update_option_set($input);
5352 + $result['type'] = 'success';
5353 + }
5354 + else
5355 + {
5356 + $result['type'] = 'error';
5357 + $result['message'] = implode('<br/>', $valid);
5358 + }
3565 5359
3566 - </script>
3567 - <?php
3568 - }
3569 - ?>
3570 - <p class="submit">
3571 - <input type="submit" onclick="return savevalidate();" name="Submit" class="button-primary ytprefs-submit" value="<?php _e($button_label) ?>" />
3572 - <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>
3573 - </p>
3574 - <?php
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'))
5367 + {
5368 + $result = self::onboarding_save();
3575 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 + }
3576 5378
3577 - public static function ytprefsscript()
5379 + public static function onboarding_save_apikey_valid(&$input)
5380 + {
5381 + $messages = array();
5382 + try
3578 5383 {
3579 - $loggedin = current_user_can('edit_posts');
3580 - if (!($loggedin && self::$alloptions[self::$opt_admin_off_scripts]))
3581 - {
3582 - wp_enqueue_style(
3583 - '__EPYT__style', plugins_url('styles/ytprefs.min.css', __FILE__)
3584 - );
3585 - $cols = floatval(self::$alloptions[self::$opt_gallery_columns]);
3586 - $cols = $cols == 0 ? 3.0 : $cols;
3587 - $colwidth = 100.0 / $cols;
3588 - $custom_css = "
3589 - .epyt-gallery-thumb {
3590 - width: " . round($colwidth, 3) . "%;
3591 - }";
3592 - wp_add_inline_style('__EPYT__style', $custom_css);
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 + }
3593 5390
3594 - wp_enqueue_script('__ytprefs__', plugins_url('scripts/ytprefs.min.js', __FILE__), array('jquery'));
5391 + if (empty($messages))
5392 + {
5393 + return true;
5394 + }
5395 + return $messages;
5396 + }
3595 5397
3596 - if (self::$alloptions[self::$opt_old_script_method] != 1)
3597 - {
3598 - wp_localize_script('__ytprefs__', '_EPYT_', array(
3599 - 'ajaxurl' => admin_url('admin-ajax.php'),
3600 - 'security' => wp_create_nonce('embedplus-nonce'),
3601 - 'gallery_scrolloffset' => intval(self::$alloptions[self::$opt_gallery_scrolloffset]),
3602 - 'eppathtoscripts' => plugins_url('scripts/', __FILE__),
3603 - 'epresponsiveselector' => self::get_responsiveselector(),
3604 - 'epdovol' => true,
3605 - 'version' => self::$alloptions[self::$opt_version]
3606 - ));
3607 - }
5398 + public static function onboarding_save_apikey()
5399 + {
5400 + $result = array();
5401 + $default = array(
5402 + self::$opt_apikey => '',
5403 + );
3608 5404
3609 - ////////////////////// cloudflare accomodation
3610 - //add_filter('script_loader_tag', 'YouTubePrefs::set_cfasync', 10, 3);
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 + }
3611 5417
3612 - if (!is_admin() && (self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0) && self::$alloptions[self::$opt_dynload] == 1)
3613 - {
3614 - wp_enqueue_style('__dyntype__', plugins_url('scripts/embdyn.min.css', __FILE__));
3615 - wp_enqueue_script('__dynload__', plugins_url('scripts/embdyn.min.js', __FILE__), array('jquery'));
3616 - }
3617 - }
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();
3618 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 + }
3619 5436
3620 - public static function set_cfasync($tag, $handle, $src)
5437 + public static function ytprefs_show_onboarding()
5438 + {
5439 +
5440 + if (!current_user_can('manage_options'))
3621 5441 {
3622 - if ('__ytprefs__' !== $handle)
3623 - {
3624 - return $tag;
3625 - }
3626 - return str_replace('<script', '<script data-cfasync="false" ', $tag);
5442 + wp_die(__('You do not have sufficient permissions to access this page.'));
3627 5443 }
5444 + if (self::$double_plugin)
5445 + {
5446 + self::double_plugin_warning();
5447 + }
5448 + $all = get_option(self::$opt_alloptions);
3628 5449
3629 - public static function get_responsiveselector()
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)
3630 5748 {
3631 - $responsiveselector = '[]';
3632 - if (self::$alloptions[self::$opt_widgetfit] == 1)
3633 - {
3634 - $responsiveselector = '["iframe.__youtube_prefs_widget__"]';
3635 - }
3636 - if (self::$alloptions[self::$opt_responsive] == 1)
3637 - {
3638 - $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\']"]';
3639 - }
3640 - return $responsiveselector;
5749 + $button_label = 'Changes Saved';
5750 + ?>
5751 + <script type="text/javascript">
5752 + jQuery(document).ready(function ()
5753 + {
5754 + setTimeout(function ()
5755 + {
5756 + jQuery('.ytprefs-submit').text('Save Changes');
5757 + }, 3000);
5758 + });</script>
5759 + <?php
3641 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 + }
3642 5768
3643 - public static function get_blogwidth()
5769 + public static function ytprefsscript()
5770 + {
5771 + $loggedin = current_user_can('edit_posts');
5772 + if (!($loggedin && self::$alloptions[self::$opt_admin_off_scripts]))
3644 5773 {
3645 - $blogwidth = null;
3646 - try
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) . "%;
5783 + }
5784 + ";
5785 +
5786 + if (self::$alloptions[self::$opt_gallery_collapse_grid] == 1)
3647 5787 {
3648 - $embed_size_w = intval(get_option('embed_size_w'));
3649 -
3650 - global $content_width;
3651 - if (empty($content_width))
5788 + foreach (self::$alloptions[self::$opt_gallery_collapse_grid_breaks] as $idx => $bpts)
3652 5789 {
3653 - $content_width = $GLOBALS['content_width'];
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 + }";
3654 5799 }
5800 + }
3655 5801
3656 - $blogwidth = $embed_size_w ? $embed_size_w : ($content_width ? $content_width : 450);
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)
5807 + {
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 + );
5826 +
5827 + wp_localize_script('__ytprefs__', '_EPYT_', $my_script_vars);
3657 5828 }
3658 - catch (Exception $ex)
5829 +
5830 + if ((bool) self::$alloptions[self::$opt_gdpr_consent])
3659 5831 {
3660 -
5832 + wp_enqueue_script('__jquery_cookie__', plugins_url('scripts/jquery.cookie' . self::$min . '.js', __FILE__), array('jquery'), self::$version);
3661 5833 }
3662 5834
3663 - $blogwidth = preg_replace('/\D/', '', $blogwidth); //may have px
3664 5835
3665 - return $blogwidth;
5836 + ////////////////////// cloudflare accomodation
5837 + //add_filter('script_loader_tag', array(self::class, 'set_cfasync'), 10, 3);
3666 5838 }
5839 + }
3667 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);
3668 5848 }
3669 5849
3670 -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
3671 -//class start
3672 - class Add_new_tinymce_btn_Youtubeprefs
5850 + public static function get_evselector()
3673 5851 {
5852 + $evselector = 'iframe.__youtube_prefs__[src], iframe[src*="youtube.com/embed/"], iframe[src*="youtube-nocookie.com/embed/"]';
3674 5853
3675 - public $btn_arr;
3676 - public $js_file;
5854 + if (self::$alloptions[self::$opt_evselector_light] == 1)
5855 + {
5856 + $evselector = 'iframe.__youtube_prefs__[src]';
5857 + }
3677 5858
3678 - /*
3679 - * call the constructor and set class variables
3680 - * From the constructor call the functions via wordpress action/filter
3681 - */
5859 + return $evselector;
5860 + }
3682 5861
3683 - function __construct($seperator, $btn_name, $javascrip_location)
5862 + public static function get_responsiveselector()
5863 + {
5864 + $responsiveselector = '[]';
5865 + if (self::$alloptions[self::$opt_widgetfit] == 1)
3684 5866 {
3685 - $this->btn_arr = array("Seperator" => $seperator, "Name" => $btn_name);
3686 - $this->js_file = $javascrip_location;
3687 - add_action('init', array($this, 'add_tinymce_button'));
3688 - add_filter('tiny_mce_version', array($this, 'refresh_mce_version'));
5867 + $responsiveselector = '["iframe.__youtube_prefs_widget__"]';
3689 5868 }
3690 -
3691 - /*
3692 - * create the buttons only if the user has editing privs.
3693 - * If so we create the button and add it to the tinymce button array
3694 - */
3695 -
3696 - function add_tinymce_button()
5869 + if (self::$alloptions[self::$opt_responsive] == 1)
3697 5870 {
3698 - if (!current_user_can('edit_posts') && !current_user_can('edit_pages'))
3699 - return;
3700 - if (get_user_option('rich_editing') == 'true')
5871 + if (self::$alloptions[self::$opt_responsive_all] == 1)
3701 5872 {
3702 - //the function that adds the javascript
3703 - add_filter('mce_external_plugins', array($this, 'add_new_tinymce_plugin'));
3704 - //adds the button to the tinymce button array
3705 - 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\']"]';
3706 5874 }
5875 + else
5876 + {
5877 + $responsiveselector = '["iframe.__youtube_prefs__"]';
5878 + }
3707 5879 }
5880 + return $responsiveselector;
5881 + }
3708 5882
3709 - /*
3710 - * add the new button to the tinymce array
3711 - */
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 + }
3712 5892
3713 - 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'))
3714 5914 {
3715 - array_push($buttons, $this->btn_arr["Seperator"], $this->btn_arr["Name"]);
3716 - return $buttons;
5915 + add_thickbox();
3717 5916 }
3718 5917
3719 - /*
3720 - * Call the javascript file that loads the
3721 - * instructions for the new button
3722 - */
3723 5918
3724 - function add_new_tinymce_plugin($plugin_array)
5919 + if ((get_bloginfo('version') >= '3.3') && self::custom_admin_pointers_check())
3725 5920 {
3726 - $plugin_array[$this->btn_arr['Name']] = $this->js_file;
3727 - 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');
3728 5924 }
3729 5925
3730 - /*
3731 - * This function tricks tinymce in thinking
3732 - * it needs to refresh the buttons
3733 - */
5926 + if (self::$alloptions['glance'] == 1)
5927 + {
5928 + add_action('admin_print_footer_scripts', array(self::class, 'glance_script'));
5929 + }
3734 5930
3735 - function refresh_mce_version($ver)
5931 + if ($hook == self::$wizard_hook)
3736 5932 {
3737 - $ver += 3;
3738 - 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);
3739 5936 }
3740 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 + }
3741 5944 }
3742 5945
3743 -//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'));
3744 5952
5953 + global $content_width;
5954 + if (empty($content_width))
5955 + {
5956 + $content_width = $GLOBALS['content_width'];
5957 + }
3745 5958
3746 - register_activation_hook(__FILE__, array('YouTubePrefs', 'initoptions'));
3747 - $youtubeplgplus = new YouTubePrefs();
5959 + $blogwidth = $embed_size_w ? $embed_size_w : ($content_width ? $content_width : 450);
5960 + }
5961 + catch (Exception $ex)
5962 + {
5963 +
5964 + }
3748 5965
5966 + $blogwidth = preg_replace('/\D/', '', $blogwidth); //may have px
3749 5967
3750 - add_action("wp_ajax_my_embedplus_pro_record", array('YouTubePrefs', 'my_embedplus_pro_record'));
3751 - add_action("wp_ajax_my_embedplus_clearspdc", array('YouTubePrefs', 'my_embedplus_clearspdc'));
3752 - add_action("wp_ajax_my_embedplus_glance_vids", array('YouTubePrefs', 'my_embedplus_glance_vids'));
3753 - add_action("wp_ajax_my_embedplus_glance_count", array('YouTubePrefs', 'my_embedplus_glance_count'));
3754 - add_action("wp_ajax_my_embedplus_dismiss_double_plugin_warning", array('YouTubePrefs', 'my_embedplus_dismiss_double_plugin_warning'));
3755 - add_action("wp_ajax_my_embedplus_gallery_page", array('YouTubePrefs', 'my_embedplus_gallery_page'));
3756 - add_action("wp_ajax_nopriv_my_embedplus_gallery_page", array('YouTubePrefs', 'my_embedplus_gallery_page'));
5968 + return $blogwidth;
5969 + }
3757 5970
3758 - add_action('admin_enqueue_scripts', 'youtubeprefs_admin_enqueue_scripts');
5971 + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
5972 + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
5973 + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
3759 5974
3760 - function youtubeprefs_admin_enqueue_scripts()
5975 + private static function ajax_referer()
3761 5976 {
3762 - wp_enqueue_style('embedplusyoutube', plugins_url() . '/youtube-embed-plus/scripts/embedplus_mce.css');
3763 - add_action('wp_print_scripts', 'youtubeprefs_output_scriptvars');
3764 - 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 + }
3765 5979
3766 - if (
3767 - //(!(isset(YouTubePrefs::$alloptions[YouTubePrefs::$opt_pro]) && strlen(trim(YouTubePrefs::$alloptions[YouTubePrefs::$opt_pro])) > 0)) && // display only if not pro ooopointer
3768 - (get_bloginfo('version') >= '3.3') && YouTubePrefs::custom_admin_pointers_check()
3769 - )
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]))
3770 6010 {
3771 - 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 + );
3772 6023
3773 - wp_enqueue_script('wp-pointer');
3774 - 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);
3775 6034 }
6035 + }
3776 6036
3777 - 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'))
3778 6040 {
3779 - 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'));
3780 6044 }
3781 6045 }
3782 6046
3783 - function youtubeprefs_output_scriptvars()
6047 + public static function gb_add_tinymce_plugin($plugin_array)
3784 6048 {
3785 - YouTubePrefs::$scriptsprinted++;
3786 - 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())
3787 6072 {
3788 - $blogwidth = YouTubePrefs::get_blogwidth();
3789 - $epprokey = YouTubePrefs::$alloptions[YouTubePrefs::$opt_pro];
3790 - $myytdefaults = http_build_query(YouTubePrefs::$alloptions);
3791 - ?>
3792 - <script type="text/javascript">
3793 - var wpajaxurl = "<?php echo admin_url('admin-ajax.php') ?>";
3794 - if (window.location.toString().indexOf('https://') == 0)
3795 - {
3796 - wpajaxurl = wpajaxurl.replace("http://", "https://");
3797 - }
6073 + return;
6074 + }
3798 6075
3799 - var epblogwidth = <?php echo $blogwidth; ?>;
3800 - var epprokey = '<?php echo $epprokey; ?>';
3801 - var epbasesite = '<?php echo YouTubePrefs::$epbase; ?>';
3802 - var epversion = '<?php echo YouTubePrefs::$version; ?>';
3803 - var myytdefaults = '<?php echo $myytdefaults; ?>';
3804 - 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 + }
3805 6080
3806 - // Create IE + others compatible event handler
3807 - var epeventMethod = window.addEventListener ? "addEventListener" : "attachEvent";
3808 - var epeventer = window[epeventMethod];
3809 - 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 + }
3810 6097
3811 - // Listen to message from child window
3812 - epeventer(epmessageEvent, function (e)
3813 - {
3814 - var embedcode = "";
3815 - try
3816 - {
3817 - if (e.data.indexOf("youtubeembedplus") == 0)
3818 - {
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 + }
3819 6111
3820 - embedcode = e.data.split("|")[1];
3821 - if (embedcode.indexOf("[") !== 0)
3822 - {
3823 - embedcode = "<p>" + embedcode + "</p>";
3824 - }
6112 +}
3825 6113
3826 - if (window.tinyMCE !== null && window.tinyMCE.activeEditor !== null && !window.tinyMCE.activeEditor.isHidden())
3827 - {
3828 - if (typeof window.tinyMCE.execInstanceCommand !== 'undefined')
3829 - {
3830 - window.tinyMCE.execInstanceCommand(
3831 - window.tinyMCE.activeEditor.id,
3832 - 'mceInsertContent',
3833 - false,
3834 - embedcode);
3835 - }
3836 - else
3837 - {
3838 - send_to_editor(embedcode);
3839 - }
3840 - }
3841 - else
3842 - {
3843 - embedcode = embedcode.replace('<p>', '\n').replace('</p>', '\n');
3844 - if (typeof QTags.insertContent === 'function')
3845 - {
3846 - QTags.insertContent(embedcode);
3847 - }
3848 - else
3849 - {
3850 - send_to_editor(embedcode);
3851 - }
3852 - }
3853 - tb_remove();
6114 +// constants
6115 +define('EPYT_BASE_URL', rtrim(plugins_url('', __FILE__), "\\/") . '/');
6116 +define('EPYTGB_INCLUDES_PATH', rtrim(dirname(__FILE__), "\\/") . '/includes/gutenberg/');
3854 6117
3855 - }
3856 - }
3857 - catch (err)
3858 - {
3859 - if (typeof console !== 'undefined')
3860 - console.log(err.message);
3861 - }
6118 +$youtubeplgplus = new YouTubePrefs();
3862 6119
3863 6120
3864 - }, false);
3865 6121
3866 6122
3867 -
3868 - </script>
3869 - <?php
3870 - }
3871 - }
3872 -