PluginProbe
Embed Plus for YouTube Gallery, Livestream and Lazy Loading with Facades / 11.3
Embed Plus for YouTube Gallery, Livestream and Lazy Loading with Facades v11.3
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
youtube-embed-plus / youtube.php

youtube.php in Embed Plus for YouTube Gallery, Livestream and Lazy Loading with Facades 11.3, at youtube.php

4,392 lines 236.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
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: 11.3
7 Author: EmbedPlus Team
8 Author URI: http://www.embedplus.com
9 */
10
11 /*
12 YouTube
13 Copyright (C) 2016 EmbedPlus.com
14
15 This program is free software: you can redistribute it and/or modify
16 it under the terms of the GNU General Public License as published by
17 the Free Software Foundation, either version 3 of the License, or
18 (at your option) any later version.
19
20 This program is distributed in the hope that it will be useful,
21 but WITHOUT ANY WARRANTY; without even the implied warranty of
22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 GNU General Public License for more details.
24
25 You should have received a copy of the GNU General Public License
26 along with this program. If not, see <http://www.gnu.org/licenses/>.
27
28 */
29
30 //define('WP_DEBUG', true);
31
32 class YouTubePrefs
33 {
34
35 public static $version = '11.3';
36 public static $opt_version = 'version';
37 public static $optembedwidth = null;
38 public static $optembedheight = null;
39 public static $defaultheight = null;
40 public static $defaultwidth = null;
41 public static $oembeddata = null;
42 public static $opt_center = 'centervid';
43 public static $opt_glance = 'glance';
44 public static $opt_autoplay = 'autoplay';
45 public static $opt_debugmode = 'debugmode';
46 public static $opt_old_script_method = 'old_script_method';
47 public static $opt_cc_load_policy = 'cc_load_policy';
48 public static $opt_iv_load_policy = 'iv_load_policy';
49 public static $opt_loop = 'loop';
50 public static $opt_modestbranding = 'modestbranding';
51 public static $opt_rel = 'rel';
52 public static $opt_showinfo = 'showinfo';
53 public static $opt_playsinline = 'playsinline';
54 public static $opt_autohide = 'autohide';
55 public static $opt_controls = 'controls';
56 public static $opt_theme = 'theme';
57 public static $opt_color = 'color';
58 public static $opt_listType = 'listType';
59 public static $opt_wmode = 'wmode';
60 public static $opt_vq = 'vq';
61 public static $opt_html5 = 'html5';
62 public static $opt_dohl = 'dohl';
63 public static $opt_hl = 'hl';
64 public static $opt_ssl = 'ssl';
65 public static $opt_ogvideo = 'ogvideo';
66 public static $opt_nocookie = 'nocookie';
67 public static $opt_playlistorder = 'playlistorder';
68 public static $opt_acctitle = 'acctitle';
69 public static $opt_pro = 'pro';
70 public static $opt_oldspacing = 'oldspacing';
71 public static $opt_responsive = 'responsive';
72 public static $opt_responsive_all = 'responsive_all';
73 public static $opt_origin = 'origin';
74 public static $opt_widgetfit = 'widgetfit';
75 public static $opt_evselector_light = 'evselector_light';
76 public static $opt_defaultdims = 'defaultdims';
77 public static $opt_defaultwidth = 'width';
78 public static $opt_defaultheight = 'height';
79 public static $opt_defaultvol = 'defaultvol';
80 public static $opt_vol = 'vol';
81 public static $opt_apikey = 'apikey';
82 public static $opt_schemaorg = 'schemaorg';
83 public static $opt_ftpostimg = 'ftpostimg';
84 public static $opt_spdc = 'spdc';
85 public static $opt_spdcexp = 'spdcexp';
86 public static $opt_migrate = 'migrate';
87 public static $opt_migrate_youtube = 'migrate_youtube';
88 public static $spdcprefix = 'ytpref';
89 public static $spdcall = 'youtubeprefs_spdcall';
90 public static $opt_dynload = 'dynload';
91 public static $opt_dyntype = 'dyntype';
92 public static $opt_gallery_pagesize = 'gallery_pagesize';
93 public static $opt_gallery_apikey = 'gallery_apikey';
94 public static $opt_gallery_columns = 'gallery_columns';
95 public static $opt_gallery_style = 'gallery_style';
96 public static $opt_gallery_scrolloffset = 'gallery_scrolloffset';
97 public static $opt_gallery_showtitle = 'gallery_showtitle';
98 public static $opt_gallery_showpaging = 'gallery_showpaging';
99 public static $opt_gallery_thumbplay = 'gallery_thumbplay';
100 public static $opt_gallery_autonext = 'gallery_autonext';
101 public static $opt_gallery_channelsub = 'gallery_channelsub';
102 public static $opt_gallery_channelsublink = 'gallery_channelsublink';
103 public static $opt_gallery_channelsubtext = 'gallery_channelsubtext';
104 public static $opt_gallery_customarrows = 'gallery_customarrows';
105 public static $opt_gallery_customprev = 'gallery_customprev';
106 public static $opt_gallery_customnext = 'gallery_customnext';
107 public static $opt_gallery_showdsc = 'gallery_showdsc';
108 public static $opt_gallery_thumbcrop = 'gallery_thumbcrop';
109 public static $opt_gallery_disptype = 'gallery_disptype';
110 public static $opt_admin_off_scripts = 'admin_off_scripts';
111 public static $opt_alloptions = 'youtubeprefs_alloptions';
112 public static $alloptions = null;
113 public static $yt_options = array();
114 //public static $epbase = 'http://localhost:2346';
115 public static $epbase = '//www.embedplus.com';
116 public static $double_plugin = false;
117 public static $scriptsprinted = 0;
118 public static $min = '.min';
119 public static $badentities = array('&#215;', '×', '&#8211;', '–', '&amp;', '&#038;', '&#38;');
120 public static $goodliterals = array('x', 'x', '--', '--', '&', '&', '&');
121 ///////////////////////////////////////////////////////////////////////////////////////////////////
122 ///////////////////////////////////////////////////////////////////////////////////////////////////
123 ///////////////////////////////////////////////////////////////////////////////////////////////////
124 ///////////////////////////////////////////////////////////////////////////////////////////////////
125 ///////////////////////////////////////////////////////////////////////////////////////////////////
126 //public static $ytregex = '@^[\r\n]{0,1}[[:blank:]]*https?://(?:www\.)?(?:(?:youtube.com/watch\?)|(?:youtu.be/))([^\s"]+)[[:blank:]]*[\r\n]{0,1}$@im';
127 public static $oldytregex = '@^\s*https?://(?:www\.)?(?:(?:youtube.com/(?:(?:watch)|(?:embed)|(?:playlist))/{0,1}\?)|(?:youtu.be/))([^\s"]+)\s*$@im';
128 public static $ytregex = '@^[\r\t ]*https?://(?:www\.)?(?:(?:youtube.com/(?:(?:watch)|(?:embed)|(?:playlist))/{0,1}\?)|(?:youtu.be/))([^\s"]+)[\r\t ]*$@im';
129 public static $justurlregex = '@https?://(?:www\.)?(?:(?:youtube.com/(?:(?:watch)|(?:embed)|(?:playlist))/{0,1}\?)|(?:youtu.be/))([^\[\s"]+)@i';
130
131 ///////////////////////////////////////////////////////////////////////////////////////////////////
132 ///////////////////////////////////////////////////////////////////////////////////////////////////
133 ///////////////////////////////////////////////////////////////////////////////////////////////////
134 ///////////////////////////////////////////////////////////////////////////////////////////////////
135 ///////////////////////////////////////////////////////////////////////////////////////////////////
136 ///////////////////////////////////////////////////////////////////////////////////////////////////
137
138 public function __construct()
139 {
140
141 add_action('admin_init', array("YouTubePrefs", 'check_double_plugin_warning'));
142
143 self::$alloptions = get_option(self::$opt_alloptions);
144 if (self::$alloptions == false || version_compare(self::$alloptions[self::$opt_version], self::$version, '<'))
145 {
146 self::initoptions();
147 }
148
149 if (self::$alloptions[self::$opt_oldspacing] == 1)
150 {
151 self::$ytregex = self::$oldytregex;
152 }
153
154 self::$optembedwidth = intval(get_option('embed_size_w'));
155 self::$optembedheight = intval(get_option('embed_size_h'));
156
157 self::$yt_options = array(
158 self::$opt_autoplay,
159 self::$opt_cc_load_policy,
160 self::$opt_iv_load_policy,
161 self::$opt_loop,
162 self::$opt_modestbranding,
163 self::$opt_rel,
164 self::$opt_showinfo,
165 self::$opt_playsinline,
166 self::$opt_autohide,
167 self::$opt_controls,
168 self::$opt_html5,
169 self::$opt_hl,
170 self::$opt_theme,
171 self::$opt_color,
172 self::$opt_listType,
173 self::$opt_wmode,
174 self::$opt_vq,
175 'index',
176 'list',
177 'start',
178 'end'
179 );
180
181 add_action('media_buttons', 'YouTubePrefs::media_button_wizard', 11);
182
183
184 self::do_ytprefs();
185 add_action('admin_menu', 'YouTubePrefs::ytprefs_plugin_menu');
186
187 if (self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 8)
188 {
189 add_action('admin_bar_menu', 'YouTubePrefs::ytprefs_admin_bar', 100);
190 add_action('wp_enqueue_scripts', array('YouTubePrefs', 'ytprefs_admin_bar_scripts'));
191 add_action('admin_enqueue_scripts', array('YouTubePrefs', 'ytprefs_admin_bar_scripts'));
192 }
193
194
195 if (!is_admin())
196 {
197
198
199 if (self::$alloptions[self::$opt_old_script_method] == 1)
200 {
201 add_action('wp_print_scripts', array('YouTubePrefs', 'jsvars'));
202 add_action('wp_enqueue_scripts', array('YouTubePrefs', 'jsvars'));
203 }
204
205 add_action('wp_enqueue_scripts', array('YouTubePrefs', 'ytprefsscript'), 100);
206 add_action('wp_enqueue_scripts', array('YouTubePrefs', 'fitvids'), 101);
207
208
209
210 if (self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0 && self::$alloptions[self::$opt_ogvideo] == 1)
211 {
212 add_action('wp_head', array('YouTubePrefs', 'do_ogvideo'));
213 }
214 }
215
216 if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG)
217 {
218 self::$min = '';
219 }
220 }
221
222 public static function ytprefs_admin_bar_scripts()
223 {
224 if (current_user_can('edit_posts'))
225 {
226 wp_enqueue_script('__ytprefs__bar', plugins_url('scripts/ytprefs-bar' . self::$min . '.js', __FILE__), array('jquery'));
227 wp_localize_script('__ytprefs__bar', '_EPYTA_', array(
228 'ajaxurl' => admin_url('admin-ajax.php'),
229 'security' => wp_create_nonce('embedplus-nonce'),
230 'pluginurl' => plugins_url('/', __FILE__)
231 ));
232 }
233 }
234
235 public static function ytprefs_admin_bar($wp_admin_bar)
236 {
237 $args = array(
238 'id' => 'ytprefs-bar-cache',
239 'title' => 'Clear YouTube Cache',
240 'href' => '#',
241 'meta' => array(
242 'class' => ''
243 )
244 );
245 $wp_admin_bar->add_node($args);
246 }
247
248 public static function show_glance_list()
249 {
250 $glancehref = self::show_glance();
251 $cnt = self::get_glance_count();
252
253 //display via list
254 return
255 '<li class="page-count">
256 <a href="' . $glancehref . '" class="thickbox ytprefs_glance_button" id="ytprefs_glance_button" title="YouTube Embeds At a Glance">
257 ' . number_format_i18n($cnt) . ' With YouTube
258 </a>
259 </li>';
260 }
261
262 public static function show_glance_table()
263 {
264 $glancehref = self::show_glance();
265 $cnt = self::get_glance_count();
266 return
267 '<tr>
268 <td class="first b"><a title="YouTube Embeds At a Glance" href="' . $glancehref . '" class="thickbox ytprefs_glance_button">' . number_format_i18n($cnt) . '</a></td>
269 <td class="t"><a title="YouTube Embeds At a Glance" href="' . $glancehref . '" id="ytprefs_glance_button" class="thickbox ytprefs_glance_button">With YouTube</a></td>
270 </tr>';
271 }
272
273 public static function get_glance_count()
274 {
275 global $wpdb;
276 $query_sql = "
277 SELECT count(*) as mytotal
278 FROM $wpdb->posts
279 WHERE (post_content LIKE '%youtube.com/%' OR post_content LIKE '%youtu.be/%')
280 AND post_status = 'publish'";
281
282 $query_result = $wpdb->get_results($query_sql, OBJECT);
283
284 return intval($query_result[0]->mytotal);
285 }
286
287 public static function show_glance()
288 {
289 $glancehref = admin_url('admin.php?page=youtube-ep-glance') . '&random=' . rand(1, 1000) . '&TB_iframe=true&width=780&height=800';
290 return $glancehref;
291 }
292
293 public static function glance_page()
294 {
295 ?>
296 <div class="wrap">
297 <style type="text/css">
298 #wphead {display:none;}
299 #wpbody{margin-left: 0px;}
300 .wrap {font-family: Arial; padding: 0px 10px 0px 10px; line-height: 180%;}
301 .bold {font-weight: bold;}
302 .orange {color: #f85d00;}
303 #adminmenuback {display: none;}
304 #adminmenu, adminmenuwrap {display: none;}
305 #wpcontent, .auto-fold #wpcontent {margin-left: 0px;}
306 #wpadminbar {display:none;}
307 html.wp-toolbar {padding: 0px;}
308 #footer, #wpfooter, .auto-fold #wpfooter {display: none;}
309 #wpfooter {clear: both}
310 .acctitle {background-color: #dddddd; border-radius: 5px; padding: 7px 15px 7px 15px; cursor: pointer; margin: 10px; font-weight: bold; font-size: 12px;}
311 .acctitle:hover {background-color: #cccccc;}
312 .accbox {display: none; position: relative; margin: 5px 8px 30px 15px; clear: both; line-height: 180%;}
313 .accclose {position: absolute; top: -38px; right: 5px; cursor: pointer; width: 24px; height: 24px;}
314 .accloader {padding-right: 20px;}
315 .accthumb {display: block; width: 300px; float: left; margin-right: 25px;}
316 .accinfo {width: 300px; float: left;}
317 .accvidtitle {font-weight: bold; font-size: 16px;}
318 .accthumb img {width: 300px; height: auto; display: block;}
319 .clearboth {clear: both;}
320 .pad20 {padding: 20px;}
321 .center {text-align: center;}
322 </style>
323 <script type="text/javascript">
324 function accclose(ele)
325 {
326 jQuery(ele).parent('.accbox').hide(400);
327 }
328
329 (function ($j)
330 {
331 $j(document).ready(function () {
332
333
334 $j('.acctitle').click(function () {
335 var $acctitle = $j(this);
336 var $accbox = $j(this).parent().children('.accbox');
337 var pid = $accbox.attr("data-postid");
338
339 $acctitle.prepend('<img class="accloader" src="<?php echo plugins_url('images/ajax-loader.gif', __FILE__) ?>" />');
340 jQuery.ajax({
341 type: "post",
342 dataType: "json",
343 timeout: 30000,
344 url: wpajaxurl,
345 data: {action: 'my_embedplus_glance_vids', postid: pid},
346 success: function (response) {
347 if (response.type == "success") {
348 $accbox.html(response.data),
349 $accbox.show(400);
350 }
351 else {
352 }
353 },
354 error: function (xhr, ajaxOptions, thrownError) {
355
356 },
357 complete: function () {
358 $acctitle.children('.accloader').remove();
359 }
360
361 });
362
363
364 });
365 });
366 })(jQuery);
367
368
369 </script>
370 <?php
371 global $wpdb;
372 $query_sql = "
373 SELECT SQL_CALC_FOUND_ROWS *
374 FROM $wpdb->posts
375 WHERE (post_content LIKE '%youtube.com/%' OR post_content LIKE '%youtu.be/%')
376 AND post_status = 'publish'
377 order by post_date DESC LIMIT 0, 10";
378
379 $query_result = $wpdb->get_results($query_sql, OBJECT);
380
381 if ($query_result !== null)
382 {
383 $total = $wpdb->get_var("SELECT FOUND_ROWS();");
384 global $post;
385 echo '<h2><img src="' . plugins_url('images/youtubeicon16.png', __FILE__) . '" /> 10 Latest Posts/Pages with YouTube Videos (' . $total . ' Total)</h2>';
386 ?>
387
388 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.
389
390 <?php
391 if ($total > 0)
392 {
393 echo '<ul class="accord">';
394 foreach ($query_result as $post)
395 {
396 echo '<li>';
397 setup_postdata($post);
398 the_title('<div class="acctitle">', ' &raquo;</div>');
399 echo '<div class="accbox" data-postid="' . $post->ID . '"></div><div class="clearboth"></div></li>';
400 }
401 echo '</ul>';
402 }
403 else
404 {
405 echo '<p class="center bold orange">You currently do not have any YouTube embeds yet.</p>';
406 }
407 }
408
409 wp_reset_postdata();
410 ?>
411 To remove this feature from your dashboard, simply uncheck <i>Show "At a Glance" Embed Links</i> in the <a target="_blank" href="<?php echo admin_url('admin.php?page=youtube-my-preferences#jumpdefaults') ?>">plugin settings page &raquo;</a>.
412
413 </div>
414 <?php
415 }
416
417 public static function my_embedplus_glance_vids()
418 {
419 $result = array();
420 if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
421 {
422 $postid = intval($_REQUEST['postid']);
423 $currpost = get_post($postid);
424
425 $thehtml = '<img class="accclose" onclick="accclose(this)" src="' . plugins_url('images/accclose.png', __FILE__) . '" />';
426
427 $matches = Array();
428 $ismatch = preg_match_all(self::$justurlregex, $currpost->post_content, $matches);
429
430 if ($ismatch)
431 {
432 foreach ($matches[0] as $match)
433 {
434 $link = trim(preg_replace('/&amp;/i', '&', $match));
435 $link = preg_replace('/\s/', '', $link);
436 $link = trim(str_replace(self::$badentities, self::$goodliterals, $link));
437
438 $linkparamstemp = explode('?', $link);
439
440 $linkparams = array();
441 if (count($linkparamstemp) > 1)
442 {
443 $linkparams = self::keyvalue($linkparamstemp[1], true);
444 }
445 if (strpos($linkparamstemp[0], 'youtu.be') !== false && !isset($linkparams['v']))
446 {
447 $vtemp = explode('/', $linkparamstemp[0]);
448 $linkparams['v'] = array_pop($vtemp);
449 }
450
451 $vidid = $linkparams['v'];
452
453 if ($vidid != null)
454 {
455 try
456 {
457 $odata = self::get_oembed('https://youtube.com/watch?v=' . $vidid, 1920, 1280);
458 $postlink = get_permalink($postid);
459 if ($odata != null && !is_wp_error($odata))
460 {
461 $_name = esc_attr(sanitize_text_field($odata->title));
462 $_description = esc_attr(sanitize_text_field($odata->author_name));
463 $_thumbnailUrl = esc_url("https://i.ytimg.com/vi/" . $vidid . "/0.jpg");
464
465 $thehtml .= '<a target="_blank" href="' . $postlink . '" class="accthumb"><img src="' . $_thumbnailUrl . '" /></a>';
466 $thehtml .= '<div class="accinfo">';
467 $thehtml .= '<a target="_blank" href="' . $postlink . '" class="accvidtitle">' . $_name . '</a>';
468 $thehtml .= '<div class="accdesc">' . (strlen($_description) > 400 ? substr($_description, 0, 400) . "..." : $_description) . '</div>';
469 $thehtml .= '</div>';
470 $thehtml .= '<div class="clearboth pad20"></div>';
471 }
472 else
473 {
474 $thehtml .= '<p class="center bold orange">This <a target="_blank" href="' . $postlink . '">post/page</a> contains a video that has been removed from YouTube.';
475
476 if (!(self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0))
477 {
478 $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>';
479 }
480 $thehtml .= '</strong>';
481 }
482 }
483 catch (Exception $ex)
484 {
485
486 }
487 }
488 else if (isset($linkparams['list']))
489 {
490 // if playlist
491 try
492 {
493 $odata = self::get_oembed('https://youtube.com/playlist?list=' . $linkparams['list'], 1920, 1280);
494 $postlink = get_permalink($postid);
495 if ($odata != null && !is_wp_error($odata))
496 {
497 $_name = esc_attr(sanitize_text_field($odata->title));
498 $_description = esc_attr(sanitize_text_field($odata->author_name));
499 $_thumbnailUrl = esc_url($odata->thumbnail_url);
500
501 $thehtml .= '<a target="_blank" href="' . $postlink . '" class="accthumb"><img src="' . $_thumbnailUrl . '" /></a>';
502 $thehtml .= '<div class="accinfo">';
503 $thehtml .= '<a target="_blank" href="' . $postlink . '" class="accvidtitle">' . $_name . '</a>';
504 $thehtml .= '<div class="accdesc">' . (strlen($_description) > 400 ? substr($_description, 0, 400) . "..." : $_description) . '</div>';
505 $thehtml .= '</div>';
506 $thehtml .= '<div class="clearboth pad20"></div>';
507 }
508 else
509 {
510 $thehtml .= '<p class="center bold orange">This <a target="_blank" href="' . $postlink . '">post/page</a> contains a video that has been removed from YouTube.';
511
512 if (!(self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0))
513 {
514 $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>';
515 }
516 $thehtml .= '</strong>';
517 }
518 }
519 catch (Exception $ex)
520 {
521
522 }
523 }
524 }
525 }
526
527
528
529 if ($currpost != null)
530 {
531 $result['type'] = 'success';
532 $result['data'] = $thehtml;
533 }
534 else
535 {
536 $result['type'] = 'error';
537 }
538 echo json_encode($result);
539 }
540 else
541 {
542 $result['type'] = 'error';
543 header("Location: " . $_SERVER["HTTP_REFERER"]);
544 }
545 die();
546 }
547
548 public static function my_embedplus_glance_count()
549 {
550 $result = array();
551 if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
552 {
553 $thehtml = '';
554
555 try
556 {
557 if (version_compare(get_bloginfo('version'), '3.8', '>='))
558 {
559 $result['container'] = '#dashboard_right_now ul';
560 $thehtml .= self::show_glance_list();
561 }
562 else
563 {
564 $result['container'] = '#dashboard_right_now .table_content table tbody';
565 $thehtml .= self::show_glance_table();
566 }
567 $result['type'] = 'success';
568 $result['data'] = $thehtml;
569 }
570 catch (Exception $e)
571 {
572 $result['type'] = 'error';
573 }
574
575 echo json_encode($result);
576 }
577 else
578 {
579 $result['type'] = 'error';
580 header("Location: " . $_SERVER["HTTP_REFERER"]);
581 }
582 die();
583 }
584
585 public static function media_button_wizard()
586 {
587 add_thickbox();
588
589 $wizhref = self::$epbase . '/wpembedcode-simple-search-' . YouTubePrefs::$version . '.aspx?pluginversion=' . YouTubePrefs::$version .
590 '&wpversion=' . get_bloginfo('version') .
591 '&settingsurl=' . urlencode(admin_url('admin.php?page=youtube-my-preferences#jumpdefaults')) .
592 '&dashurl=' . urlencode(admin_url('admin.php?page=youtube-ep-analytics-dashboard')) .
593 '&blogwidth=' . YouTubePrefs::get_blogwidth() .
594 '&domain=' . urlencode(site_url()) .
595 '&prokey=' . urlencode(YouTubePrefs::$alloptions[YouTubePrefs::$opt_pro]) .
596 '&myytdefaults=' . urlencode(http_build_query(YouTubePrefs::$alloptions)) .
597 '&random=' . rand(1, 1000) .
598 '&TB_iframe=true&width=950&height=800';
599 ?>
600 <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>
601 <?php
602 }
603
604 public static function check_double_plugin_warning()
605 {
606 if (is_plugin_active('embedplus-for-wordpress/embedplus.php'))
607 {
608 add_action('admin_notices', array("YouTubePrefs", "double_plugin_warning"));
609 //self::$double_plugin = true;
610 }
611 }
612
613 public static function double_plugin_warning()
614 {
615 global $pagenow;
616 $user_id = get_current_user_id();
617 if ($pagenow != 'plugins.php' || get_user_meta($user_id, 'embedplus_double_plugin_warning', true) != 1)
618 {
619 //echo '<div class="error">' . $_SERVER['QUERY_STRING'] .'</div>';
620 if ($pagenow == 'plugins.php' || strpos($_SERVER['QUERY_STRING'], 'youtube-my-preferences') !== false ||
621 strpos($_SERVER['QUERY_STRING'], 'embedplus-video-analytics-dashboard') !== false ||
622 strpos($_SERVER['QUERY_STRING'], 'youtube-ep-analytics-dashboard') !== false ||
623 strpos($_SERVER['QUERY_STRING'], 'embedplus-official-options') !== false)
624 {
625 ?>
626 <style type="text/css">
627 .embedpluswarning img
628 {
629 vertical-align: text-bottom;
630 }
631 div.bgyellow {background-color: #FCFC94; position: relative;}
632 a.epxout, a.epxout:hover {font-weight: bold; color: #ffffff; background-color: #ff8888; text-decoration: none;
633 border-radius: 20px; font-size: 15px; position: absolute; top: 3px; right: 3px;
634 line-height: 20px; text-align: center; width: 20px; height: 20px; display: block; cursor: pointer;}
635 </style>
636 <div class="error bgyellow embedpluswarningbox">
637 <p class="embedpluswarning">
638 <?php
639 if ($pagenow == 'plugins.php')
640 {
641 echo '<a class="epxout">&times;</a>';
642 }
643 ?>
644 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>
645 </div>
646 <iframe allowTransparency="true" src="<?php echo self::$epbase . '/both-plugins-conflict.aspx' ?>" style="width:2px; height: 2px;" ></iframe>
647 <script type="text/javascript">
648 (function ($) {
649 $(document).ready(function () {
650 $('.epxout').click(function () {
651 $.ajax({
652 type: "post",
653 dataType: "json",
654 timeout: 30000,
655 url: wpajaxurl,
656 data: {action: 'my_embedplus_dismiss_double_plugin_warning'},
657 success: function (response) {
658 if (response.type == "success") {
659 $(".embedpluswarningbox").hide();
660 }
661 },
662 error: function (xhr, ajaxOptions, thrownError) {
663 },
664 complete: function () {
665 }
666 });
667 });
668
669 });
670 })(jQuery);
671 </script>
672 <?php
673 }
674 }
675 }
676
677 public static function my_embedplus_dismiss_double_plugin_warning()
678 {
679 $result = array();
680 if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
681 {
682 $user_id = get_current_user_id();
683 update_user_meta($user_id, 'embedplus_double_plugin_warning', 1);
684 $result['type'] = 'success';
685 echo json_encode($result);
686 }
687 else
688 {
689 $result['type'] = 'error';
690 header("Location: " . $_SERVER["HTTP_REFERER"]);
691 }
692 die();
693 }
694
695 public static function jsvars()
696 {
697 $loggedin = current_user_can('edit_posts');
698 if (!($loggedin && self::$alloptions[self::$opt_admin_off_scripts]))
699 {
700 ?>
701 <script data-cfasync="false">
702 window._EPYT_ = window._EPYT_ || {
703 ajaxurl: "<?php echo admin_url('admin-ajax.php'); ?>",
704 security: "<?php echo wp_create_nonce('embedplus-nonce'); ?>",
705 gallery_scrolloffset: <?php echo intval(self::$alloptions[self::$opt_gallery_scrolloffset]) ?>,
706 eppathtoscripts: "<?php echo plugins_url('scripts/', __FILE__); ?>",
707 epresponsiveselector: <?php echo self::get_responsiveselector(); ?>,
708 version: "<?php echo self::$alloptions[self::$opt_version] ?>",
709 epdovol: true,
710 evselector: '<?php echo self::get_evselector(); ?>'
711 };
712 </script>
713 <?php
714 }
715 }
716
717 public static function fitvids()
718 {
719 $loggedin = current_user_can('edit_posts');
720 if (!($loggedin && self::$alloptions[self::$opt_admin_off_scripts]))
721 {
722 wp_enqueue_script('__ytprefsfitvids__', plugins_url('scripts/fitvids' . self::$min . '.js', __FILE__), array('__ytprefs__'), false, true);
723 }
724 }
725
726 public static function initoptions()
727 {
728 //vanilla defaults
729 $_center = 0;
730 $_glance = 1;
731 $_autoplay = get_option('youtubeprefs_autoplay', 0);
732 $_cc_load_policy = get_option('youtubeprefs_cc_load_policy', 0);
733 $_iv_load_policy = get_option('youtubeprefs_iv_load_policy', 1);
734 $_loop = get_option('youtubeprefs_loop', 0);
735 $_modestbranding = get_option('youtubeprefs_modestbranding', 0);
736 $_rel = get_option('youtubeprefs_rel', 1);
737 $_showinfo = get_option('youtubeprefs_showinfo', 1);
738 $_html5 = get_option('youtubeprefs_html5', 0);
739 $_theme = get_option('youtubeprefs_theme', 'dark');
740 $_color = get_option('youtubeprefs_color', 'red');
741 $_vq = get_option('youtubeprefs_vq', '');
742 $_autohide = 2;
743 $_pro = '';
744 $_ssl = 0;
745 $_nocookie = 0;
746 $_playlistorder = 0;
747 $_acctitle = 0;
748 $_ogvideo = 0;
749 $_migrate = 0;
750 $_migrate_youtube = 0;
751 $_controls = 2;
752 $_oldspacing = 1;
753 $_responsive = 0;
754 $_responsive_all = 1;
755 $_widgetfit = 1;
756 $_evselector_light = 0;
757 $_schemaorg = 0;
758 $_ftpostimg = 0;
759 $_spdc = 0;
760 $_spdcexp = 24;
761 $_dynload = 0;
762 $_dyntype = '';
763 $_wmode = 'opaque';
764 $_defaultdims = 0;
765 $_defaultwidth = '';
766 $_defaultheight = '';
767 $_playsinline = 0;
768 $_origin = 0;
769 $_defaultvol = 0;
770 $_vol = '';
771 $_apikey = '';
772 $_hl = '';
773 $_dohl = 0;
774 $_gallery_columns = 3;
775 $_gallery_scrolloffset = 20;
776 $_gallery_showtitle = 1;
777 $_gallery_showpaging = 1;
778 $_gallery_autonext = 0;
779 $_gallery_thumbplay = 1;
780 $_gallery_channelsub = 0;
781 $_gallery_channelsublink = '';
782 $_gallery_channelsubtext = 'Subscribe to my channel';
783 $_gallery_customarrows = 0;
784 $_gallery_customprev = 'Prev';
785 $_gallery_customnext = 'Next';
786 $_gallery_pagesize = 15;
787 $_gallery_style = 'grid';
788 $_gallery_showdsc = 0;
789 $_gallery_thumbcrop = 'box';
790 $_gallery_disptype = 'default';
791 $_debugmode = 0;
792 $_admin_off_scripts = 0;
793 $_old_script_method = 0;
794
795 $arroptions = get_option(self::$opt_alloptions);
796
797 //update vanilla to previous settings if exists
798 if ($arroptions !== false)
799 {
800 $_center = self::tryget($arroptions, self::$opt_center, 0);
801 $_glance = self::tryget($arroptions, self::$opt_glance, 1);
802 $_autoplay = self::tryget($arroptions, self::$opt_autoplay, 0);
803 $_debugmode = self::tryget($arroptions, self::$opt_debugmode, 0);
804 $_old_script_method = self::tryget($arroptions, self::$opt_old_script_method, 0);
805 $_cc_load_policy = self::tryget($arroptions, self::$opt_cc_load_policy, 0);
806 $_iv_load_policy = self::tryget($arroptions, self::$opt_iv_load_policy, 1);
807 $_loop = self::tryget($arroptions, self::$opt_loop, 0);
808 $_modestbranding = self::tryget($arroptions, self::$opt_modestbranding, 0);
809 $_rel = self::tryget($arroptions, self::$opt_rel, 1);
810 $_showinfo = self::tryget($arroptions, self::$opt_showinfo, 1);
811 $_playsinline = self::tryget($arroptions, self::$opt_playsinline, 0);
812 $_origin = self::tryget($arroptions, self::$opt_origin, 0);
813 $_html5 = self::tryget($arroptions, self::$opt_html5, 0);
814 $_hl = self::tryget($arroptions, self::$opt_hl, '');
815 $_dohl = self::tryget($arroptions, self::$opt_dohl, 0);
816 $_theme = self::tryget($arroptions, self::$opt_theme, 'dark');
817 $_color = self::tryget($arroptions, self::$opt_color, 'red');
818 $_wmode = self::tryget($arroptions, self::$opt_wmode, 'opaque');
819 $_vq = self::tryget($arroptions, self::$opt_vq, '');
820 $_pro = self::tryget($arroptions, self::$opt_pro, '');
821 $_ssl = self::tryget($arroptions, self::$opt_ssl, 0);
822 $_nocookie = self::tryget($arroptions, self::$opt_nocookie, 0);
823 $_playlistorder = self::tryget($arroptions, self::$opt_playlistorder, 0);
824 $_acctitle = self::tryget($arroptions, self::$opt_acctitle, 0);
825 $_ogvideo = self::tryget($arroptions, self::$opt_ogvideo, 0);
826 $_migrate = self::tryget($arroptions, self::$opt_migrate, 0);
827 $_migrate_youtube = self::tryget($arroptions, self::$opt_migrate_youtube, 0);
828 $_controls = self::tryget($arroptions, self::$opt_controls, 2);
829 $_autohide = self::tryget($arroptions, self::$opt_autohide, 2);
830 $_oldspacing = self::tryget($arroptions, self::$opt_oldspacing, 1);
831 $_responsive = self::tryget($arroptions, self::$opt_responsive, 0);
832 $_responsive_all = self::tryget($arroptions, self::$opt_responsive_all, 1);
833 $_widgetfit = self::tryget($arroptions, self::$opt_widgetfit, 1);
834 $_evselector_light = self::tryget($arroptions, self::$opt_evselector_light, 0);
835 $_schemaorg = self::tryget($arroptions, self::$opt_schemaorg, 0);
836 $_ftpostimg = self::tryget($arroptions, self::$opt_ftpostimg, 0);
837 $_spdc = self::tryget($arroptions, self::$opt_spdc, 0);
838 $_spdcexp = self::tryget($arroptions, self::$opt_spdcexp, 24);
839 $_dynload = self::tryget($arroptions, self::$opt_dynload, 0);
840 $_dyntype = self::tryget($arroptions, self::$opt_dyntype, '');
841 $_defaultdims = self::tryget($arroptions, self::$opt_defaultdims, 0);
842 $_defaultwidth = self::tryget($arroptions, self::$opt_defaultwidth, '');
843 $_defaultheight = self::tryget($arroptions, self::$opt_defaultheight, '');
844 $_defaultvol = self::tryget($arroptions, self::$opt_defaultvol, 0);
845 $_vol = self::tryget($arroptions, self::$opt_vol, '');
846 $_apikey = self::tryget($arroptions, self::$opt_apikey, '');
847 $_gallery_pagesize = self::tryget($arroptions, self::$opt_gallery_pagesize, 15);
848 $_gallery_columns = self::tryget($arroptions, self::$opt_gallery_columns, 3);
849 $_gallery_scrolloffset = self::tryget($arroptions, self::$opt_gallery_scrolloffset, 20);
850 $_gallery_showtitle = self::tryget($arroptions, self::$opt_gallery_showtitle, 1);
851 $_gallery_showpaging = self::tryget($arroptions, self::$opt_gallery_showpaging, 1);
852 $_gallery_autonext = self::tryget($arroptions, self::$opt_gallery_autonext, 0);
853 $_gallery_thumbplay = self::tryget($arroptions, self::$opt_gallery_thumbplay, 1);
854 $_gallery_style = self::tryget($arroptions, self::$opt_gallery_style, 'grid');
855 $_gallery_thumbcrop = self::tryget($arroptions, self::$opt_gallery_thumbcrop, 'box');
856 $_gallery_disptype = self::tryget($arroptions, self::$opt_gallery_disptype, 'default');
857 $_gallery_channelsub = self::tryget($arroptions, self::$opt_gallery_channelsub, $_gallery_channelsub);
858 $_gallery_channelsublink = self::tryget($arroptions, self::$opt_gallery_channelsublink, $_gallery_channelsublink);
859 $_gallery_channelsubtext = self::tryget($arroptions, self::$opt_gallery_channelsubtext, $_gallery_channelsubtext);
860 $_gallery_customarrows = self::tryget($arroptions, self::$opt_gallery_customarrows, $_gallery_customarrows);
861 $_gallery_customnext = self::tryget($arroptions, self::$opt_gallery_customnext, $_gallery_customnext);
862 $_gallery_customprev = self::tryget($arroptions, self::$opt_gallery_customprev, $_gallery_customprev);
863 $_gallery_showdsc = self::tryget($arroptions, self::$opt_gallery_showdsc, $_gallery_showdsc);
864 $_admin_off_scripts = self::tryget($arroptions, self::$opt_admin_off_scripts, $_admin_off_scripts);
865 }
866 else
867 {
868 $_oldspacing = 0;
869 }
870
871 $all = array(
872 self::$opt_version => self::$version,
873 self::$opt_center => $_center,
874 self::$opt_glance => $_glance,
875 self::$opt_autoplay => $_autoplay,
876 self::$opt_cc_load_policy => $_cc_load_policy,
877 self::$opt_iv_load_policy => $_iv_load_policy,
878 self::$opt_loop => $_loop,
879 self::$opt_modestbranding => $_modestbranding,
880 self::$opt_rel => $_rel,
881 self::$opt_showinfo => $_showinfo,
882 self::$opt_playsinline => $_playsinline,
883 self::$opt_origin => $_origin,
884 self::$opt_autohide => $_autohide,
885 self::$opt_html5 => $_html5,
886 self::$opt_hl => $_hl,
887 self::$opt_dohl => $_dohl,
888 self::$opt_theme => $_theme,
889 self::$opt_color => $_color,
890 self::$opt_wmode => $_wmode,
891 self::$opt_vq => $_vq,
892 self::$opt_pro => $_pro,
893 self::$opt_ssl => $_ssl,
894 self::$opt_nocookie => $_nocookie,
895 self::$opt_playlistorder => $_playlistorder,
896 self::$opt_acctitle => $_acctitle,
897 self::$opt_ogvideo => $_ogvideo,
898 self::$opt_migrate => $_migrate,
899 self::$opt_migrate_youtube => $_migrate_youtube,
900 self::$opt_controls => $_controls,
901 self::$opt_oldspacing => $_oldspacing,
902 self::$opt_responsive => $_responsive,
903 self::$opt_responsive_all => $_responsive_all,
904 self::$opt_widgetfit => $_widgetfit,
905 self::$opt_evselector_light => $_evselector_light,
906 self::$opt_schemaorg => $_schemaorg,
907 self::$opt_ftpostimg => $_ftpostimg,
908 self::$opt_spdc => $_spdc,
909 self::$opt_spdcexp => $_spdcexp,
910 self::$opt_dynload => $_dynload,
911 self::$opt_dyntype => $_dyntype,
912 self::$opt_defaultdims => $_defaultdims,
913 self::$opt_defaultwidth => $_defaultwidth,
914 self::$opt_defaultheight => $_defaultheight,
915 self::$opt_defaultvol => $_defaultvol,
916 self::$opt_vol => $_vol,
917 self::$opt_apikey => $_apikey,
918 self::$opt_gallery_columns => $_gallery_columns,
919 self::$opt_gallery_scrolloffset => $_gallery_scrolloffset,
920 self::$opt_gallery_showtitle => $_gallery_showtitle,
921 self::$opt_gallery_showpaging => $_gallery_showpaging,
922 self::$opt_gallery_autonext => $_gallery_autonext,
923 self::$opt_gallery_thumbplay => $_gallery_thumbplay,
924 self::$opt_gallery_channelsub => $_gallery_channelsub,
925 self::$opt_gallery_channelsublink => $_gallery_channelsublink,
926 self::$opt_gallery_channelsubtext => $_gallery_channelsubtext,
927 self::$opt_gallery_customarrows => $_gallery_customarrows,
928 self::$opt_gallery_customnext => $_gallery_customnext,
929 self::$opt_gallery_customprev => $_gallery_customprev,
930 self::$opt_gallery_showdsc => $_gallery_showdsc,
931 self::$opt_gallery_style => $_gallery_style,
932 self::$opt_gallery_thumbcrop => $_gallery_thumbcrop,
933 self::$opt_gallery_disptype => $_gallery_disptype,
934 self::$opt_gallery_pagesize => $_gallery_pagesize,
935 self::$opt_debugmode => $_debugmode,
936 self::$opt_admin_off_scripts => $_admin_off_scripts,
937 self::$opt_old_script_method => $_old_script_method
938 );
939
940 update_option(self::$opt_alloptions, $all);
941 update_option('embed_autourls', 1);
942 self::$alloptions = get_option(self::$opt_alloptions);
943 }
944
945 public static function tryget($array, $key, $default = null)
946 {
947 return isset($array[$key]) ? $array[$key] : $default;
948 }
949
950 public static function wp_above_version($ver)
951 {
952 global $wp_version;
953 if (version_compare($wp_version, $ver, '>='))
954 {
955 return true;
956 }
957 return false;
958 }
959
960 public static function do_ytprefs()
961 {
962 add_filter('autoptimize_filter_js_exclude', 'YouTubePrefs::ao_override_jsexclude', 10, 1);
963 if (!is_admin())
964 {
965 add_filter('the_content', 'YouTubePrefs::apply_prefs_content', 1);
966 add_filter('widget_text', 'YouTubePrefs::apply_prefs_widget', 1);
967 add_shortcode('embedyt', array('YouTubePrefs', 'apply_prefs_shortcode'));
968 if (self::$alloptions[self::$opt_migrate] == 1)
969 {
970 if (self::$alloptions[self::$opt_migrate_youtube] == 1)
971 {
972 add_shortcode('youtube', array('YouTubePrefs', 'apply_prefs_shortcode_youtube'));
973 add_shortcode('youtube_video', array('YouTubePrefs', 'apply_prefs_shortcode_youtube'));
974 }
975 }
976 }
977 else
978 {
979 if (self::$alloptions[self::$opt_ftpostimg] == 1 && self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0)
980 {
981 add_action('save_post', array('YouTubePrefs', 'doftpostimg'), 110, 3);
982 }
983 }
984 }
985
986 public static function ao_override_jsexclude($exclude)
987 {
988 if (strpos($exclude, 'ytprefs' . self::$min . '.js') === false)
989 {
990 return $exclude . ",ytprefs' . self::$min . '.js,__ytprefs__";
991 }
992 return $exclude;
993 }
994
995 public static function apply_prefs_shortcode($atts, $content = null)
996 {
997 $content = trim($content);
998 $currfilter = current_filter();
999 if (preg_match(self::$justurlregex, $content))
1000 {
1001 return self::get_html(array($content), $currfilter == 'widget_text' ? false : true);
1002 }
1003 return '';
1004 }
1005
1006 public static function apply_prefs_shortcode_youtube($atts, $content = null)
1007 {
1008 $content = 'https://www.youtube.com/watch?v=' . trim($content);
1009 $currfilter = current_filter();
1010 if (preg_match(self::$justurlregex, $content))
1011 {
1012 return self::get_html(array($content), $currfilter == 'widget_text' ? false : true);
1013 }
1014 return '';
1015 }
1016
1017 public static function apply_prefs_content($content)
1018 {
1019 $content = preg_replace_callback(self::$ytregex, "YouTubePrefs::get_html_content", $content);
1020 return $content;
1021 }
1022
1023 public static function apply_prefs_widget($content)
1024 {
1025 $content = preg_replace_callback(self::$ytregex, "YouTubePrefs::get_html_widget", $content);
1026 return $content;
1027 }
1028
1029 public static function get_html_content($m)
1030 {
1031 return self::get_html($m, true);
1032 }
1033
1034 public static function get_html_widget($m)
1035 {
1036 return self::get_html($m, false);
1037 }
1038
1039 public static function get_gallery_page($options)
1040 {
1041 $gallobj = new stdClass();
1042
1043 $options->pageSize = min(intval($options->pageSize), 50);
1044 $options->columns = intval($options->columns);
1045 $options->showTitle = intval($options->showTitle);
1046 $options->showPaging = intval($options->showPaging);
1047 $options->autonext = intval($options->autonext);
1048 $options->thumbplay = intval($options->thumbplay);
1049 $options->showDsc = intval($options->showDsc);
1050 $options->thumbcrop = sanitize_html_class($options->thumbcrop);
1051 $options->style = sanitize_html_class($options->style);
1052
1053 if (empty($options->apiKey))
1054 {
1055 $gallobj->html = '<div>Please enter your YouTube API key to embed galleries.</div>';
1056 return $gallobj;
1057 }
1058
1059 $apiEndpoint = 'https://www.googleapis.com/youtube/v3/playlistItems?part=snippet,status&playlistId=' . $options->playlistId
1060 . '&maxResults=' . $options->pageSize
1061 . '&key=' . $options->apiKey;
1062 if ($options->pageToken != null)
1063 {
1064 $apiEndpoint .= '&pageToken=' . $options->pageToken;
1065 }
1066 $spdckey = '';
1067 if (self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 9 && self::$alloptions[self::$opt_spdc] == 1)
1068 {
1069 try
1070 {
1071 $optionsstr = json_encode($options);
1072 $spdckey = self::$spdcprefix . '_' . md5($apiEndpoint . $optionsstr);
1073 $spdcval = get_transient($spdckey);
1074 if (!empty($spdcval))
1075 {
1076 //self::debuglog((microtime(true) - $time_start) . "\t" . $spdckey . "\t" . $spdcval . "\r\n");
1077 $gallobj->html = $spdcval;
1078 return $gallobj;
1079 }
1080 }
1081 catch (Exception $ex)
1082 {
1083
1084 }
1085 }
1086
1087 $code = '';
1088 $init_id = null;
1089
1090 $apiResult = wp_remote_get($apiEndpoint);
1091
1092 if (is_wp_error($apiResult))
1093 {
1094 $gallobj->html = '<div>Sorry, there was a YouTube API error: <em>' . htmlspecialchars(strip_tags($apiResult->get_error_message())) . '</em>' .
1095 ' Please make sure you performed the <a href="https://www.youtube.com/watch?v=px8LvNIVblg" target="_blank">steps in this video</a> to create and save a proper API key.' .
1096 '</div>';
1097 return $gallobj;
1098 }
1099
1100 if (self::$alloptions[self::$opt_debugmode] == 1 && current_user_can('manage_options'))
1101 {
1102 $redactedEndpoint = preg_replace('@&key=[^&]+@i', '&key=PRIVATE', $apiEndpoint);
1103 $gallobj->html = '<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>';
1104 return $gallobj;
1105 }
1106
1107 $jsonResult = json_decode($apiResult['body']);
1108
1109 if (isset($jsonResult->error))
1110 {
1111 if (isset($jsonResult->error->message))
1112 {
1113 $gallobj->html = '<div>Sorry, there was a YouTube API error: <em>' . htmlspecialchars(strip_tags($jsonResult->error->message)) . '</em>' .
1114 ' Please make sure you performed the <a href="https://www.youtube.com/watch?v=px8LvNIVblg" target="_blank">steps in this video</a> to create and save a proper API key.' .
1115 '</div>';
1116 return $gallobj;
1117 }
1118 $gallobj->html = '<div>Sorry, there may be an issue with your YouTube API key. Please make sure you performed the <a href="https://www.youtube.com/watch?v=px8LvNIVblg" target="_blank">steps in this video</a> to create and save a proper API key.</div>';
1119 return $gallobj;
1120 }
1121
1122
1123
1124 $resultsPerPage = $options->pageSize; // $jsonResult->pageInfo->resultsPerPage;
1125 $totalResults = $jsonResult->pageInfo->totalResults;
1126
1127 $nextPageToken = '';
1128 $prevPageToken = '';
1129 if (isset($jsonResult->nextPageToken))
1130 {
1131 $nextPageToken = $jsonResult->nextPageToken;
1132 }
1133
1134 if (isset($jsonResult->prevPageToken))
1135 {
1136 $prevPageToken = $jsonResult->prevPageToken;
1137 }
1138
1139 $cnt = 0;
1140 $colclass = '';
1141 if (in_array($options->style, array('grid', '')))
1142 {
1143 $colclass = ' epyt-cols-' . $options->columns . ' ';
1144 }
1145
1146 $cropclass = '';
1147 if (!in_array($options->thumbcrop, array('box', '')))
1148 {
1149 $cropclass = ' epyt-thumb-' . $options->thumbcrop . ' ';
1150 }
1151
1152 $code.= '<div class="epyt-gallery-allthumbs ' . $cropclass . $colclass . '">';
1153
1154
1155
1156
1157 if (isset($jsonResult->items) && $jsonResult->items != null && is_array($jsonResult->items))
1158 {
1159
1160 foreach ($jsonResult->items as $item)
1161 {
1162
1163 $thumb = new stdClass();
1164
1165 $thumb->id = isset($item->snippet->resourceId->videoId) ? $item->snippet->resourceId->videoId : null;
1166 $thumb->id = $thumb->id ? $thumb->id : $item->id->videoId;
1167 $thumb->title = $options->showTitle ? $item->snippet->title : '';
1168 $thumb->privacyStatus = isset($item->status->privacyStatus) ? $item->status->privacyStatus : null;
1169
1170 if ($cnt == 0 && $options->pageToken == null)
1171 {
1172 $init_id = $thumb->id;
1173 }
1174
1175 if (self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0 && $options->style == 'listview')
1176 {
1177 $thumb->dsc = $options->showDsc ? $item->snippet->description : '';
1178 }
1179
1180 if ($thumb->privacyStatus == 'private')
1181 {
1182 $thumb->img = plugins_url('/images/private.png', __FILE__);
1183 $thumb->quality = 'medium';
1184 }
1185 else
1186 {
1187 if (isset($item->snippet->thumbnails->high->url))
1188 {
1189 $thumb->img = $item->snippet->thumbnails->high->url;
1190 $thumb->quality = 'high';
1191 }
1192 elseif (isset($item->snippet->thumbnails->default->url))
1193 {
1194 $thumb->img = $item->snippet->thumbnails->default->url;
1195 $thumb->quality = 'default';
1196 }
1197 else
1198 {
1199 $thumb->img = $item->snippet->thumbnails->medium->url;
1200 $thumb->quality = 'medium';
1201 }
1202 }
1203
1204 $code .= self::get_thumbnail_html($thumb, $options);
1205 $cnt++;
1206
1207 if ($cnt % $options->columns === 0 && $options->style !== 'carousel')
1208 {
1209 $code .= '<div class="epyt-gallery-rowbreak"></div>';
1210 }
1211 }
1212 }
1213
1214 $code .= '<div class="epyt-gallery-clear"></div></div>';
1215
1216 if ($options->style === 'carousel' && $options->showTitle)
1217 {
1218 $code .= '<div class="epyt-gallery-rowtitle"></div>';
1219 }
1220
1221
1222 $totalPages = ceil($totalResults / $resultsPerPage);
1223 $pagination = '<div class="epyt-pagination">';
1224
1225 $txtprev = self::$alloptions[self::$opt_gallery_customarrows] ? self::$alloptions[self::$opt_gallery_customprev] : _('Prev');
1226 $pagination .= '<div class="epyt-pagebutton epyt-prev ' . (empty($prevPageToken) ? ' hide ' : '') . '" data-playlistid="' . esc_attr($options->playlistId)
1227 . '" data-pagesize="' . intval($options->pageSize)
1228 . '" data-pagetoken="' . esc_attr($prevPageToken)
1229 . '" data-style="' . esc_attr($options->style)
1230 . '" data-columns="' . intval($options->columns)
1231 . '" data-showtitle="' . intval($options->showTitle)
1232 . '" data-showpaging="' . intval($options->showPaging)
1233 . '" data-autonext="' . intval($options->autonext)
1234 . '" data-thumbplay="' . intval($options->thumbplay)
1235 . ((self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 9 && $options->style == 'listview' && $options->showDsc) ? '" data-showdsc="' . intval($options->showDsc) : '')
1236 . ((self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 9 && !in_array($options->thumbcrop, array('box', ''))) ? '" data-thumbcrop="' . $options->thumbcrop : '')
1237 . '"><div class="arrow">&laquo;</div> <div>' . $txtprev . '</div></div>';
1238
1239
1240 $pagination .= '<div class="epyt-pagenumbers ' . ($totalPages > 1 ? '' : 'hide') . '">';
1241 $pagination .= '<div class="epyt-current">1</div><div class="epyt-pageseparator"> / </div><div class="epyt-totalpages">' . $totalPages . '</div>';
1242 $pagination .= '</div>';
1243
1244 $txtnext = self::$alloptions[self::$opt_gallery_customarrows] ? self::$alloptions[self::$opt_gallery_customnext] : _('Next');
1245 $pagination .= '<div class="epyt-pagebutton epyt-next' . (empty($nextPageToken) ? ' hide ' : '') . '" data-playlistid="' . esc_attr($options->playlistId)
1246 . '" data-pagesize="' . intval($options->pageSize)
1247 . '" data-pagetoken="' . esc_attr($nextPageToken)
1248 . '" data-style="' . esc_attr($options->style)
1249 . '" data-columns="' . intval($options->columns)
1250 . '" data-showtitle="' . intval($options->showTitle)
1251 . '" data-showpaging="' . intval($options->showPaging)
1252 . '" data-autonext="' . intval($options->autonext)
1253 . '" data-thumbplay="' . intval($options->thumbplay)
1254 . ((self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0 && $options->style == 'listview' && $options->showDsc) ? '" data-showdsc="' . intval($options->showDsc) : '')
1255 . ((self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 9 && !in_array($options->thumbcrop, array('box', ''))) ? '" data-thumbcrop="' . $options->thumbcrop : '')
1256 . '"><div>' . $txtnext . '</div> <div class="arrow">&raquo;</div></div>';
1257
1258 $pagination .= '<div class="epyt-loader"><img width="16" height="11" src="' . plugins_url('images/gallery-page-loader.gif', __FILE__) . '"></div>';
1259
1260 $pagination .= '</div>';
1261
1262 if ($options->showPaging == 0)
1263 {
1264 $pagination = '';
1265 }
1266 $code = $pagination . $code . $pagination;
1267
1268 if (self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0 && self::$alloptions[self::$opt_spdc] == 1)
1269 {
1270 $daysecs = self::$alloptions[self::$opt_spdcexp] * 60 * 60;
1271 set_transient($spdckey, $code, $daysecs);
1272 $allk = get_option(self::$spdcall, array());
1273 $allk[] = $spdckey;
1274 update_option(self::$spdcall, $allk);
1275
1276 //self::debuglog((microtime(true) - $time_start) . "\t" . $spdckey . "\t" . $code . "\r\n");
1277 }
1278
1279 $gallobj->html = $code;
1280 $gallobj->init_id = $init_id;
1281 return $gallobj;
1282 }
1283
1284 public static function get_thumbnail_html($thumb, $options)
1285 {
1286 $escId = esc_attr($thumb->id);
1287 $code = '';
1288 $styleclass = '';
1289 $rawstyle = '';
1290 $dschtml = '';
1291 if (self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0)
1292 {
1293 if ($options->style == 'listview')
1294 {
1295 $styleclass = 'epyt-listview';
1296 $dschtml = isset($thumb->dsc) && !empty($thumb->dsc) ? '<div class="epyt-gallery-dsc">' . $thumb->dsc . '</div>' : '';
1297 }
1298 else if ($options->style == 'carousel')
1299 {
1300 $rawstyle = ' style="width: ' . (100.0 / floatval($options->pageSize)) . '%;" ';
1301 }
1302 }
1303
1304 $code .= '<div data-videoid="' . $escId . '" class="epyt-gallery-thumb ' . $styleclass . '" ' . $rawstyle . '>';
1305 $code .= '<div class="epyt-gallery-img-box"><div class="epyt-gallery-img" style="background-image: url(' . esc_attr($thumb->img) . ')">' .
1306 '<div class="epyt-gallery-playhover"><img class="epyt-play-img" width="30" height="23" src="' . plugins_url('images/playhover.png', __FILE__) . '" /><div class="epyt-gallery-playcrutch"></div></div>' .
1307 '</div></div>';
1308 if ($options->style != 'carousel' && !empty($thumb->title))
1309 {
1310 $code .= '<div class="epyt-gallery-title">' . esc_html($thumb->title) . '</div>';
1311 }
1312 else
1313 {
1314 $code .= '<div class="epyt-gallery-notitle"><span>' . esc_html($thumb->title) . '</span></div>';
1315 }
1316 $code .= $dschtml . '</div>';
1317
1318
1319 return $code;
1320 }
1321
1322 public static function my_embedplus_gallery_page()
1323 {
1324 if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
1325 {
1326 //check_ajax_referer('embedplus-nonce', 'security');
1327 $options = (object) $_POST['options'];
1328 $options->apiKey = self::$alloptions[self::$opt_apikey];
1329 echo self::get_gallery_page($options)->html;
1330 die();
1331 }
1332 }
1333
1334 public static function get_html($m, $iscontent)
1335 {
1336 //$time_start = microtime(true);
1337
1338 $link = trim(str_replace(self::$badentities, self::$goodliterals, $m[0]));
1339
1340 $link = preg_replace('/\s/', '', $link);
1341 $linkparamstemp = explode('?', $link);
1342
1343 $linkparams = array();
1344 if (count($linkparamstemp) > 1)
1345 {
1346 $linkparams = self::keyvalue($linkparamstemp[1], true);
1347 }
1348 if (strpos($linkparamstemp[0], 'youtu.be') !== false && !isset($linkparams['v']))
1349 {
1350 $vtemp = explode('/', $linkparamstemp[0]);
1351 $linkparams['v'] = array_pop($vtemp);
1352 }
1353
1354 //$linkscheme = 'http';
1355 $youtubebaseurl = 'youtube';
1356 $schemaorgoutput = '';
1357 $voloutput = '';
1358 $dynsrc = '';
1359 $dyntype = '';
1360 $acctitle = '';
1361 $videoseries = '';
1362 $disptype = '';
1363 $beginlb = '';
1364 $endlb = '';
1365 $disptypeif = '';
1366
1367 $finalparams = $linkparams + self::$alloptions;
1368
1369 $spdckey = '';
1370 if (self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0 && self::$alloptions[self::$opt_spdc] == 1)
1371 {
1372 try
1373 {
1374 $kparams = $finalparams;
1375 $kparams['iscontent'] = $iscontent;
1376 ksort($kparams);
1377 $jparams = json_encode($kparams);
1378 $spdckey = self::$spdcprefix . '_' . md5($jparams);
1379 $spdcval = get_transient($spdckey);
1380 if (!empty($spdcval))
1381 {
1382 //self::debuglog((microtime(true) - $time_start) . "\t" . $spdckey . "\t" . $spdcval . "\r\n");
1383 return $spdcval;
1384 }
1385 }
1386 catch (Exception $ex)
1387 {
1388
1389 }
1390 }
1391
1392 self::init_dimensions($link, $linkparams, $finalparams);
1393
1394 if (self::$alloptions[self::$opt_nocookie] == 1)
1395 {
1396 $youtubebaseurl = 'youtube-nocookie';
1397 }
1398
1399
1400 // if (self::$alloptions[self::$opt_ssl] == 1)
1401 // {
1402 // $linkscheme = 'https';
1403 // }
1404
1405 if (self::$alloptions[self::$opt_defaultvol] == 1)
1406 {
1407 $voloutput = ' data-vol="' . self::$alloptions[self::$opt_vol] . '" ';
1408 }
1409
1410
1411 // if (!(self::$alloptions[self::$opt_dohl] == 1 && isset($finalparams[self::$opt_hl]) && strlen($finalparams[self::$opt_hl]) == 2))
1412 // {
1413 // unset($finalparams[self::$opt_hl]);
1414 // }
1415 if (self::$alloptions[self::$opt_dohl] == 1)
1416 {
1417 $locale = get_locale();
1418 $finalparams[self::$opt_hl] = $locale;
1419 }
1420 else
1421 {
1422 unset($finalparams[self::$opt_hl]);
1423 }
1424
1425 if (isset($finalparams[self::$opt_html5]) && $finalparams[self::$opt_html5] == 0)
1426 {
1427 unset($finalparams[self::$opt_html5]);
1428 }
1429
1430 if (self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 10)
1431 {
1432
1433 if (self::$alloptions[self::$opt_schemaorg] == 1 && isset($finalparams['v']))
1434 {
1435 $schemaorgoutput = self::getschemaorgoutput($finalparams['v']);
1436 }
1437
1438 if (self::$alloptions[self::$opt_dynload] == 1
1439 //&& $finalparams[self::$opt_autoplay] != 1
1440 )
1441 {
1442 $dynsrc = 'data-ep-';
1443 $dyntype = ' data-ep-a="' . self::$alloptions[self::$opt_dyntype] . '" ';
1444 }
1445
1446 if (isset($linkparams[self::$opt_vol]) && is_numeric(trim($linkparams[self::$opt_vol])))
1447 {
1448 $voloutput = ' data-vol="' . $linkparams[self::$opt_vol] . '" ';
1449 }
1450
1451
1452 if (isset($finalparams['layout']) && strtolower($finalparams['layout']) == 'gallery' && isset($finalparams['list']) && isset($finalparams[self::$opt_gallery_disptype]) && $finalparams[self::$opt_gallery_disptype] === 'lb')
1453 {
1454 $disptype = ' epyt-lb';
1455 $beginlb = '<div class="lity-hide">';
1456 $endlb = '</div>';
1457 $disptypeif = ' epyt-lbif';
1458 }
1459 }
1460 else
1461 {
1462 if (isset($finalparams[self::$opt_vol]))
1463 {
1464 unset($finalparams[self::$opt_vol]);
1465 }
1466 if (isset($finalparams[self::$opt_gallery_disptype]))
1467 {
1468 unset($finalparams[self::$opt_gallery_disptype]);
1469 }
1470 }
1471
1472 $centercode = '';
1473 if ($finalparams[self::$opt_center] == 1)
1474 {
1475 $centercode = ' style="display: block; margin: 0px auto;" ';
1476 }
1477
1478 if (self::$alloptions[self::$opt_acctitle] == 1)
1479 {
1480 try
1481 {
1482 //attr escape
1483 if (self::$oembeddata)
1484 {
1485 $acctitle = self::$oembeddata->title;
1486 }
1487 else
1488 {
1489
1490 if (isset($linkparams['list']))
1491 {
1492 $odata = self::get_oembed('http://youtube.com/playlist?list=' . $linkparams['list'], 1920, 1280);
1493 $acctitle = $odata->title;
1494 }
1495 else
1496 {
1497 $odata = self::get_oembed('http://youtube.com/watch?v=' . $linkparams['v'], 1920, 1280);
1498 $acctitle = $odata->title;
1499 }
1500 }
1501
1502 if ($acctitle)
1503 {
1504 $acctitle = ' title="' . esc_attr($acctitle) . '" ';
1505 }
1506 }
1507 catch (Exception $e)
1508 {
1509
1510 }
1511 }
1512
1513 // playlist cleanup
1514 $videoidoutput = isset($linkparams['v']) ? $linkparams['v'] : '';
1515 if (!isset($finalparams['layout']) && isset($finalparams['list']))
1516 {
1517 //$videoseries = 'videoseries/';
1518 }
1519 if ((self::$alloptions[self::$opt_playlistorder] == 1 || isset($finalparams['plindex'])) && isset($finalparams['list']))
1520 {
1521 try
1522 {
1523 $videoidoutput = '';
1524 if (isset($finalparams['plindex']))
1525 {
1526 $finalparams['index'] = intval($finalparams['plindex']);
1527 }
1528 }
1529 catch (Exception $ex)
1530 {
1531
1532 }
1533 }
1534
1535 $galleryWrapper1 = '';
1536 $galleryWrapper2 = '';
1537 $galleryCode = '';
1538 if (
1539 isset($finalparams['layout']) && strtolower($finalparams['layout']) == 'gallery' && isset($finalparams['list'])
1540 )
1541 {
1542 $gallery_options = new stdClass();
1543 $gallery_options->playlistId = $finalparams['list'];
1544 $gallery_options->pageToken = null;
1545 $gallery_options->pageSize = $finalparams[self::$opt_gallery_pagesize];
1546 $gallery_options->columns = intval($finalparams[self::$opt_gallery_columns]);
1547 $gallery_options->showTitle = intval($finalparams[self::$opt_gallery_showtitle]);
1548 $gallery_options->showPaging = intval($finalparams[self::$opt_gallery_showpaging]);
1549 $gallery_options->autonext = intval($finalparams[self::$opt_gallery_autonext]);
1550 $gallery_options->thumbplay = intval($finalparams[self::$opt_gallery_thumbplay]);
1551 $gallery_options->showDsc = intval($finalparams[self::$opt_gallery_showdsc]);
1552 $gallery_options->style = $finalparams[self::$opt_gallery_style];
1553 $gallery_options->thumbcrop = $finalparams[self::$opt_gallery_thumbcrop];
1554 $gallery_options->apiKey = self::$alloptions[self::$opt_apikey];
1555
1556 $subbutton = '';
1557 if (self::$alloptions[self::$opt_gallery_channelsub] == 1)
1558 {
1559 $subbutton = '<div class="epyt-gallery-subscribe"><a target="_blank" class="epyt-gallery-subbutton" href="' .
1560 esc_attr(self::$alloptions[self::$opt_gallery_channelsublink]) . '?sub_confirmation=1"><img src="' . plugins_url('images/play-subscribe.png', __FILE__) . '" />' .
1561 htmlspecialchars(self::$alloptions[self::$opt_gallery_channelsubtext], ENT_QUOTES) . '</a></div>';
1562 }
1563
1564
1565 $gallery_page_obj = self::get_gallery_page($gallery_options);
1566
1567 //$dynsrc = '';// 'data-ep-gallery';
1568 $galleryWrapper1 = '<div class="epyt-gallery ' . $disptype . '" data-currpage="1">';
1569 $galleryWrapper2 = '</div>';
1570 $galleryCode = $subbutton . '<div class="epyt-gallery-list epyt-gallery-style-' . esc_attr($gallery_options->style) . '">' .
1571 $gallery_page_obj->html .
1572 '</div>';
1573 $videoidoutput = isset($gallery_page_obj->init_id) ? $gallery_page_obj->init_id : ''; // 'GALLERYVIDEOID';
1574 }
1575
1576
1577 $code1 = $beginlb . '<iframe ' . $dyntype . $centercode . ' id="_ytid_' . rand(10000, 99999) . '" width="' . self::$defaultwidth . '" height="' . self::$defaultheight .
1578 '" ' . $dynsrc . 'src="https://www.' . $youtubebaseurl . '.com/embed/' . $videoseries . $videoidoutput . '?';
1579 $code2 = '" frameborder="0" class="__youtube_prefs__' . ($iscontent ? '' : ' __youtube_prefs_widget__') . $disptypeif .
1580 '"' . $voloutput . $acctitle . ' allowfullscreen ></iframe>' . $endlb . $schemaorgoutput;
1581
1582 $origin = '';
1583
1584 try
1585 {
1586 if (self::$alloptions[self::$opt_origin] == 1)
1587 {
1588 $url_parts = parse_url(site_url());
1589 $origin = 'origin=' . $url_parts['scheme'] . '://' . $url_parts['host'] . '&';
1590 }
1591 }
1592 catch (Exception $e)
1593 {
1594 $origin = '';
1595 }
1596 $finalsrc = 'enablejsapi=1&' . $origin;
1597
1598 if (count($finalparams) > 1)
1599 {
1600 foreach ($finalparams as $key => $value)
1601 {
1602 if (in_array($key, self::$yt_options))
1603 {
1604 if (!empty($galleryCode) && ($key == 'listType' || $key == 'list'))
1605 {
1606
1607 }
1608 else
1609 {
1610 $finalsrc .= htmlspecialchars($key) . '=' . htmlspecialchars($value) . '&';
1611 if ($key == 'loop' && $value == 1 && !isset($finalparams['list']))
1612 {
1613 $finalsrc .= 'playlist=' . $finalparams['v'] . '&';
1614 }
1615 }
1616 }
1617 }
1618 }
1619
1620 $code = $galleryWrapper1 . $code1 . $finalsrc . $code2 . $galleryCode . $galleryWrapper2; //. '<!--' . $m[0] . '-->';
1621 // reset static vals for next embed
1622 self::$defaultheight = null;
1623 self::$defaultwidth = null;
1624 self::$oembeddata = null;
1625
1626
1627
1628
1629
1630 if (self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0 && self::$alloptions[self::$opt_spdc] == 1)
1631 {
1632 $daysecs = self::$alloptions[self::$opt_spdcexp] * 60 * 60;
1633 set_transient($spdckey, $code, $daysecs);
1634 $allk = get_option(self::$spdcall, array());
1635 $allk[] = $spdckey;
1636 update_option(self::$spdcall, $allk);
1637
1638 //self::debuglog((microtime(true) - $time_start) . "\t" . $spdckey . "\t" . $code . "\r\n");
1639 }
1640 return $code;
1641 }
1642
1643 public static function debuglog($str)
1644 {
1645 $handle = fopen(__DIR__ . "\\debug.txt", "a+");
1646 fwrite($handle, $str);
1647 fclose($handle);
1648 }
1649
1650 public static function spdcpurge()
1651 {
1652 $allk = get_option(self::$spdcall, array());
1653 if (is_array($allk))
1654 {
1655 foreach ($allk as $t)
1656 {
1657 $success = delete_transient($t);
1658 }
1659 }
1660 update_option(self::$spdcall, array());
1661 }
1662
1663 public static function keyvalue($qry, $includev)
1664 {
1665 $ytvars = explode('&', $qry);
1666 $ytkvp = array();
1667 foreach ($ytvars as $k => $v)
1668 {
1669 $kvp = explode('=', $v);
1670 if (count($kvp) == 2 && ($includev || strtolower($kvp[0]) != 'v'))
1671 {
1672 $ytkvp[$kvp[0]] = $kvp[1];
1673 }
1674 }
1675
1676 return $ytkvp;
1677 }
1678
1679 public static function getschemaorgoutput($vidid)
1680 {
1681 $schemaorgcode = '';
1682 try
1683 {
1684 $ytapilink = 'https://www.googleapis.com/youtube/v3/videos?id=' . $vidid . '&part=contentDetails,snippet&key=' . self::$alloptions[self::$opt_apikey];
1685
1686
1687 $apidata = wp_remote_get($ytapilink);
1688 if (!is_wp_error($apidata))
1689 {
1690 $raw = wp_remote_retrieve_body($apidata);
1691 if (!empty($raw))
1692 {
1693 $json = json_decode($raw, true);
1694 if (is_array($json))
1695 {
1696 $_name = esc_attr(sanitize_text_field(str_replace("@", "&#64;", $json['items'][0]['snippet']['title'])));
1697 $_description = esc_attr(sanitize_text_field(str_replace("@", "&#64;", $json['items'][0]['snippet']['description'])));
1698 $_thumbnailUrl = esc_url("https://i.ytimg.com/vi/" . $vidid . "/0.jpg");
1699 $_duration = $json['items'][0]['contentDetails']['duration']; // "T0H9M35S" "PT9M35S"
1700 $_uploadDate = sanitize_text_field($json['items'][0]['snippet']['publishedAt']); // "2014-10-03T15:30:12.000Z"
1701
1702 $schemaorgcode = '<span itemprop="video" itemscope itemtype="http://schema.org/VideoObject">';
1703 $schemaorgcode .= '<meta itemprop="embedURL" content="https://www.youtube.com/embed/' . $vidid . '">';
1704 $schemaorgcode .= '<meta itemprop="name" content="' . $_name . '">';
1705 $schemaorgcode .= '<meta itemprop="description" content="' . $_description . '">';
1706 $schemaorgcode .= '<meta itemprop="thumbnailUrl" content="' . $_thumbnailUrl . '">';
1707 $schemaorgcode .= '<meta itemprop="duration" content="' . $_duration . '">';
1708 $schemaorgcode .= '<meta itemprop="uploadDate" content="' . $_uploadDate . '">';
1709 $schemaorgcode .= '</span>';
1710 }
1711 }
1712 }
1713 }
1714 catch (Exception $ex)
1715 {
1716
1717 }
1718 return $schemaorgcode;
1719 }
1720
1721 public static function secondsToDuration($seconds)
1722 {
1723 $remaining = $seconds;
1724 $parts = array();
1725 $multipliers = array(
1726 'hours' => 3600,
1727 'minutes' => 60,
1728 'seconds' => 1
1729 );
1730
1731 foreach ($multipliers as $type => $m)
1732 {
1733 $parts[$type] = (int) ($remaining / $m);
1734 $remaining -= ($parts[$type] * $m);
1735 }
1736
1737 return $parts;
1738 }
1739
1740 public static function formatDuration($parts)
1741 {
1742 $default = array(
1743 'hours' => 0,
1744 'minutes' => 0,
1745 'seconds' => 0
1746 );
1747
1748 extract(array_merge($default, $parts));
1749
1750 return "T{$hours}H{$minutes}M{$seconds}S";
1751 }
1752
1753 public static function init_dimensions($url, $urlkvp, $finalparams)
1754 {
1755 // get default dimensions; try embed size in settings, then try theme's content width, then just 480px
1756 if (self::$defaultwidth == null)
1757 {
1758 global $content_width;
1759 if (empty($content_width))
1760 {
1761 $content_width = $GLOBALS['content_width'];
1762 }
1763
1764 if (isset($urlkvp['width']) && is_numeric($urlkvp['width']))
1765 {
1766 self::$defaultwidth = $urlkvp['width'];
1767 }
1768 else if (self::$alloptions[self::$opt_defaultdims] == 1 && (isset(self::$alloptions[self::$opt_defaultwidth]) && is_numeric(self::$alloptions[self::$opt_defaultwidth])))
1769 {
1770 self::$defaultwidth = self::$alloptions[self::$opt_defaultwidth];
1771 }
1772 else if (self::$optembedwidth)
1773 {
1774 self::$defaultwidth = self::$optembedwidth;
1775 }
1776 else if ($content_width)
1777 {
1778 self::$defaultwidth = $content_width;
1779 }
1780 else
1781 {
1782 self::$defaultwidth = 480;
1783 }
1784
1785
1786
1787 if (isset($urlkvp['height']) && is_numeric($urlkvp['height']))
1788 {
1789 self::$defaultheight = $urlkvp['height'];
1790 }
1791 else if (self::$alloptions[self::$opt_defaultdims] == 1 && (isset(self::$alloptions[self::$opt_defaultheight]) && is_numeric(self::$alloptions[self::$opt_defaultheight])))
1792 {
1793 self::$defaultheight = self::$alloptions[self::$opt_defaultheight];
1794 }
1795 else
1796 {
1797 self::$defaultheight = self::get_aspect_height($url, $urlkvp, $finalparams);
1798 }
1799 }
1800 }
1801
1802 public static function get_oembed($url, $height, $width)
1803 {
1804 require_once( ABSPATH . WPINC . '/class-oembed.php' );
1805 $oembed = _wp_oembed_get_object();
1806 $args = array();
1807 $args['width'] = $width;
1808 $args['height'] = $height;
1809 $args['discover'] = false;
1810 self::$oembeddata = $oembed->fetch('https://www.youtube.com/oembed', $url, $args);
1811 return self::$oembeddata;
1812 }
1813
1814 public static function get_aspect_height($url, $urlkvp, $finalparams)
1815 {
1816
1817 // attempt to get aspect ratio correct height from oEmbed
1818 $aspectheight = round((self::$defaultwidth * 9) / 16, 0);
1819
1820
1821 if ($url)
1822 {
1823 $odata = self::get_oembed($url, self::$defaultwidth, self::$defaultwidth);
1824
1825 if ($odata)
1826 {
1827 $aspectheight = $odata->height;
1828 }
1829 }
1830
1831 if ($finalparams[self::$opt_controls] != 0 && $finalparams[self::$opt_autohide] != 1)
1832 {
1833 //add 28 for YouTube's own bar: DEPRECATED
1834 //$aspectheight += 28;
1835 }
1836 return $aspectheight;
1837 }
1838
1839 public static function doftpostimg($postid, $post, $update)
1840 {
1841 if (current_user_can('edit_posts'))
1842 {
1843 if ((defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) || !in_array($post->post_status, array('publish', 'pending', 'draft', 'future', 'private')))
1844 {
1845 return;
1846 }
1847 try
1848 {
1849 self::doftpostimgfor($post);
1850 }
1851 catch (Exception $ex)
1852 {
1853 // display error message
1854 }
1855 }
1856 }
1857
1858 public static function doftpostimgfor($post)
1859 {
1860 $search_content = isset($post->post_content) ? $post->post_content : '';
1861 $search_content = substr(wp_strip_all_tags($search_content), 0, 5000);
1862
1863 $search_content = apply_filters('youtube_embedplus_video_content', $search_content);
1864
1865 $vid_match = null;
1866 if ($search_content && $post->ID && !has_post_thumbnail($post->ID) && preg_match(self::$justurlregex, $search_content, $vid_match)
1867 )
1868 {
1869
1870 $first_vid_link = trim(str_replace(self::$badentities, self::$goodliterals, $vid_match[0]));
1871
1872 $first_vid_link = preg_replace('/\s/', '', $first_vid_link);
1873 $linkparamstemp = explode('?', $first_vid_link);
1874
1875 $linkparams = array();
1876 if (count($linkparamstemp) > 1)
1877 {
1878 $linkparams = self::keyvalue($linkparamstemp[1], true);
1879 }
1880 if (strpos($linkparamstemp[0], 'youtu.be') !== false && !isset($linkparams['v']))
1881 {
1882 $vtemp = explode('/', $linkparamstemp[0]);
1883 $linkparams['v'] = array_pop($vtemp);
1884 }
1885
1886 $just_id = $linkparams['v'];
1887
1888 if ($just_id == null && isset($linkparams['list']))
1889 {
1890 $apiEndpoint = 'https://www.googleapis.com/youtube/v3/playlistItems?part=snippet,status&playlistId=' . $linkparams['list']
1891 . '&maxResults=10&key=' . self::$alloptions[self::$opt_apikey];
1892 try
1893 {
1894 $apiResult = wp_remote_get($apiEndpoint);
1895 if (!is_wp_error($apiResult))
1896 {
1897 $jsonResult = json_decode($apiResult['body']);
1898 if (!isset($jsonResult->error) && isset($jsonResult->items) && $jsonResult->items != null && is_array($jsonResult->items))
1899 {
1900
1901 $item = $jsonResult->items[0];
1902 $just_id = isset($item->snippet->resourceId->videoId) ? $item->snippet->resourceId->videoId : null;
1903 $just_id = $just_id ? $just_id : $item->id->videoId;
1904 }
1905 }
1906 }
1907 catch (Exception $ex)
1908 {
1909
1910 }
1911 }
1912
1913 if ($just_id != null)
1914 {
1915 $ftimgurl = "https://img.youtube.com/vi/" . $just_id . "/maxresdefault.jpg";
1916 $ftimgid = self::media_sideload($ftimgurl, $post->ID, sanitize_title(preg_replace("/[^a-zA-Z0-9\s]/", "-", $post->post_title)));
1917
1918 if (!ftimgid || is_wp_error($ftimgid))
1919 {
1920 $ftimgurl = null;
1921 $ftimgid = 0;
1922 if ($just_id)
1923 {
1924 require_once( ABSPATH . WPINC . '/class-oembed.php' );
1925 $oembed = _wp_oembed_get_object();
1926 $args = array();
1927 $args['width'] = 1920;
1928 $args['height'] = 1080;
1929 $args['discover'] = false;
1930 $odata = $oembed->fetch('https://www.youtube.com/oembed', 'http://youtube.com/watch?v=' . $just_id, $args);
1931
1932 if ($odata)
1933 {
1934 $ftimgurl = $odata->thumbnail_url;
1935 }
1936 }
1937
1938 $ftimgid = $ftimgurl && !is_wp_error($ftimgurl) ? self::media_sideload($ftimgurl, $post->ID, sanitize_title(preg_replace("/[^a-zA-Z0-9\s]/", "-", $post->title))) : 0;
1939
1940 if (!$ftimgid || is_wp_error($ftimgid))
1941 {
1942 return;
1943 }
1944 }
1945 set_post_thumbnail($post->ID, $ftimgid);
1946 }
1947 }
1948 }
1949
1950 public static function media_sideload($url, $post_id, $filename = null)
1951 {
1952 if (!$url || !$post_id)
1953 {
1954 return new WP_Error('missing', __('Please provide a valid URL and post ID', ''));
1955 }
1956
1957 $post_title = get_the_title($post_id);
1958
1959 require_once(ABSPATH . 'wp-admin/includes/file.php');
1960 $tmp = download_url($url);
1961
1962 if (is_wp_error($tmp))
1963 {
1964 @unlink($file_array['tmp_name']);
1965 $file_array['tmp_name'] = '';
1966 return $tmp;
1967 }
1968
1969 preg_match('/[^\?]+\.(jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG)/', $url, $matches);
1970 $url_filename = basename($matches[0]);
1971 $url_type = wp_check_filetype($url_filename);
1972
1973 if (!empty($filename))
1974 {
1975 $filename = sanitize_file_name($filename);
1976 $tmppath = pathinfo($tmp);
1977 $new = $tmppath['dirname'] . '/' . $filename . '.' . $tmppath['extension'];
1978 rename($tmp, $new);
1979 $tmp = $new;
1980 }
1981
1982 $file_array['tmp_name'] = $tmp;
1983 if (!empty($filename))
1984 {
1985 $file_array['name'] = $filename . '.' . $url_type['ext'];
1986 }
1987 else
1988 {
1989 $file_array['name'] = $url_filename;
1990 }
1991
1992 $post_data = array(
1993 'post_title' => $post_title,
1994 'post_parent' => $post_id,
1995 );
1996
1997 require_once( ABSPATH . 'wp-admin/includes/file.php' );
1998 require_once( ABSPATH . 'wp-admin/includes/media.php' );
1999 require_once( ABSPATH . 'wp-admin/includes/image.php' );
2000
2001 $att_id = media_handle_sideload($file_array, $post_id, null, $post_data);
2002
2003 if (is_wp_error($att_id))
2004 {
2005 @unlink($file_array['tmp_name']);
2006 return $att_id;
2007 }
2008
2009 return $att_id;
2010 }
2011
2012 public static function do_ogvideo()
2013 {
2014 global $wp_query;
2015 $the_content = $wp_query->post->post_content;
2016 $matches = Array();
2017 $ismatch = preg_match_all(self::$justurlregex, $the_content, $matches);
2018
2019 if ($ismatch)
2020 {
2021 $match = $matches[0][0];
2022
2023 $link = trim(preg_replace('/&amp;/i', '&', $match));
2024 $link = preg_replace('/\s/', '', $link);
2025 $link = trim(str_replace(self::$badentities, self::$goodliterals, $link));
2026
2027 $linkparamstemp = explode('?', $link);
2028
2029 $linkparams = array();
2030 if (count($linkparamstemp) > 1)
2031 {
2032 $linkparams = self::keyvalue($linkparamstemp[1], true);
2033 }
2034 if (strpos($linkparamstemp[0], 'youtu.be') !== false && !isset($linkparams['v']))
2035 {
2036 $vtemp = explode('/', $linkparamstemp[0]);
2037 $linkparams['v'] = array_pop($vtemp);
2038 }
2039
2040 if (isset($linkparams['v']))
2041 {
2042 ?>
2043 <meta property="og:type" content="video">
2044 <meta property="og:video" content="https://www.youtube.com/v/<?php echo $linkparams['v']; ?>?autohide=1&amp;version=3">
2045 <meta property="og:video:type" content="application/x-shockwave-flash">
2046 <meta property="og:video:width" content="480">
2047 <meta property="og:video:height" content="360">
2048 <meta property="og:image" content="https://img.youtube.com/vi/<?php echo $linkparams['v']; ?>/0.jpg">
2049 <?php
2050 }
2051 }
2052 }
2053
2054 public static function ytprefs_plugin_menu()
2055 {
2056 if (self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0)
2057 {
2058 add_menu_page('YouTube Settings', 'YouTube PRO', 'manage_options', 'youtube-my-preferences', 'YouTubePrefs::ytprefs_show_options', plugins_url('images/youtubeicon16.png', __FILE__), '10.000392854349');
2059 add_submenu_page('youtube-my-preferences', '', '', 'manage_options', 'youtube-my-preferences', 'YouTubePrefs::ytprefs_show_options');
2060 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');
2061 }
2062 else
2063 {
2064 add_menu_page('YouTube Settings', 'YouTube Free', 'manage_options', 'youtube-my-preferences', 'YouTubePrefs::ytprefs_show_options', plugins_url('images/youtubeicon16.png', __FILE__), '10.000392854349');
2065 add_submenu_page('youtube-my-preferences', '', '', 'manage_options', 'youtube-my-preferences', 'YouTubePrefs::ytprefs_show_options');
2066 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');
2067 }
2068 add_submenu_page(null, 'YouTube Posts', 'YouTube Posts', 'manage_options', 'youtube-ep-glance', 'YouTubePrefs::glance_page');
2069 }
2070
2071 public static function epstats_show_options()
2072 {
2073
2074 if (!current_user_can('manage_options'))
2075 {
2076 wp_die(__('You do not have sufficient permissions to access this page.'));
2077 }
2078
2079 if (self::$double_plugin)
2080 {
2081 //add_action('admin_notices', array("YouTubePrefs", "double_plugin_warning"));
2082 self::double_plugin_warning();
2083 }
2084
2085
2086 // Now display the settings editing screen
2087 ?>
2088 <div class="wrap">
2089 <style type="text/css">
2090 .wrap {font-family: Arial;}
2091 .epicon { width: 20px; height: 20px; vertical-align: middle; padding-right: 5px;}
2092 .epindent {padding-left: 25px;}
2093 iframe.shadow {-webkit-box-shadow: 0px 0px 20px 0px #000000; box-shadow: 0px 0px 20px 0px #000000;}
2094 .bold {font-weight: bold;}
2095 .orange {color: #f85d00;}
2096 </style>
2097 <br>
2098 <?php
2099 $thishost = (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : "");
2100 $thiskey = self::$alloptions[self::$opt_pro];
2101
2102 $dashurl = self::$epbase . "/dashboard/pro-easy-video-analytics.aspx?ref=protab&domain=" . $thishost . "&prokey=" . $thiskey;
2103
2104 if (self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0)
2105 {
2106 //// header
2107 echo "<h2>" . '<img src="' . plugins_url('images/epstats16.png', __FILE__) . '" /> ' . __('YouTube Analytics Dashboard') . "</h2>";
2108 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>';
2109 }
2110 else
2111 {
2112 //// header
2113 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>";
2114 }
2115 ?>
2116 <iframe class="shadow" src="<?php echo $dashurl ?>" width="1060" height="3600" scrolling="auto"/>
2117 </div>
2118 <?php
2119 }
2120
2121 public static function my_embedplus_pro_record()
2122 {
2123 $result = array();
2124 if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
2125 {
2126 $tmppro = preg_replace('/[^A-Za-z0-9-]/i', '', $_REQUEST[self::$opt_pro]);
2127 $new_options = array();
2128 $new_options[self::$opt_pro] = $tmppro;
2129 $all = get_option(self::$opt_alloptions);
2130 $all = $new_options + $all;
2131 update_option(self::$opt_alloptions, $all);
2132
2133 if (strlen($tmppro) > 0)
2134 {
2135 $result['type'] = 'success';
2136 }
2137 else
2138 {
2139 $result['type'] = 'error';
2140 }
2141 echo json_encode($result);
2142 }
2143 else
2144 {
2145 $result['type'] = 'error';
2146 header("Location: " . $_SERVER["HTTP_REFERER"]);
2147 }
2148 die();
2149 }
2150
2151 public static function my_embedplus_clearspdc()
2152 {
2153 $result = array();
2154 if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
2155 {
2156 try
2157 {
2158 self::spdcpurge();
2159 $result['type'] = 'success';
2160 }
2161 catch (Exception $ex)
2162 {
2163 $result['type'] = 'error';
2164 }
2165 echo json_encode($result);
2166 }
2167 else
2168 {
2169 $result['type'] = 'error';
2170 header("Location: " . $_SERVER["HTTP_REFERER"]);
2171 }
2172 die();
2173 }
2174
2175 public static function custom_admin_pointers_check()
2176 {
2177 //return false; // ooopointer shut all off;
2178 $admin_pointers = self::custom_admin_pointers();
2179 foreach ($admin_pointers as $pointer => $array)
2180 {
2181 if ($array['active'])
2182 return true;
2183 }
2184 }
2185
2186 public static function glance_script()
2187 {
2188 add_thickbox();
2189 ?>
2190 <script type="text/javascript">
2191 function widen_ytprefs_glance() {
2192 setTimeout(function () {
2193 jQuery("#TB_window").animate({marginLeft: '-' + parseInt((780 / 2), 10) + 'px', width: '780px'}, 300);
2194 jQuery("#TB_window iframe").animate({width: '780px'}, 300);
2195 }, 15);
2196 }
2197
2198 (function ($j)
2199 {
2200 $j(document).ready(function () {
2201
2202 $j.ajax({
2203 type: "post",
2204 dataType: "json",
2205 timeout: 30000,
2206 url: wpajaxurl,
2207 data: {action: 'my_embedplus_glance_count'},
2208 success: function (response) {
2209 if (response.type == "success") {
2210 $j(response.container).append(response.data);
2211 $j(".ytprefs_glance_button").click(widen_ytprefs_glance);
2212 $j(window).resize(widen_ytprefs_glance);
2213 if (typeof ep_do_pointers == 'function')
2214 {
2215 //ep_do_pointers($j);
2216 }
2217 }
2218 else {
2219 }
2220 },
2221 error: function (xhr, ajaxOptions, thrownError) {
2222
2223 },
2224 complete: function () {
2225 }
2226 });
2227
2228 });
2229
2230 })(jQuery);
2231 </script>
2232 <?php
2233 }
2234
2235 public static function custom_admin_pointers_footer()
2236 {
2237 $admin_pointers = self::custom_admin_pointers();
2238 ?>
2239 <script type="text/javascript">
2240 /* <![CDATA[ */
2241 function ep_do_pointers($)
2242 {
2243 <?php
2244 foreach ($admin_pointers as $pointer => $array)
2245 {
2246 if ($array['active'])
2247 {
2248 ?>
2249 $('<?php echo $array['anchor_id']; ?>').pointer({
2250 content: '<?php echo $array['content']; ?>',
2251 position: {
2252 edge: '<?php echo $array['edge']; ?>',
2253 align: '<?php echo $array['align']; ?>'
2254 },
2255 close: function () {
2256 $.post(wpajaxurl, {
2257 pointer: '<?php echo $pointer; ?>',
2258 action: 'dismiss-wp-pointer'
2259 });
2260 }
2261 }).pointer('open');
2262 <?php
2263 }
2264 }
2265 ?>
2266 }
2267
2268 ep_do_pointers(jQuery); // switch off all pointers via js ooopointer
2269 /* ]]> */
2270 </script>
2271 <?php
2272 }
2273
2274 public static function custom_admin_pointers()
2275 {
2276 $dismissed = explode(',', (string) get_user_meta(get_current_user_id(), 'dismissed_wp_pointers', true));
2277 $version = str_replace('.', '_', self::$version); // replace all periods in version with an underscore
2278 $prefix = 'custom_admin_pointers' . $version . '_';
2279
2280 $new_pointer_content = '<h3>' . __('New Update') . '</h3>'; // ooopointer
2281
2282 $new_pointer_content .= '<p>'; // ooopointer
2283 if (!(self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0))
2284 {
2285 $new_pointer_content .= __("This update adds improved responsive sizing for AJAX-based themes (Free), and a popup lightbox display option for Pro galleries (<a target=_blank href=" . self::$epbase . '/dashboard/pro-easy-video-analytics.aspx?ref=frompointer' . ">Learn more about Pro &raquo;</a>)");
2286 }
2287 else
2288 {
2289 $new_pointer_content .= __("This update adds improved responsive sizing for AJAX-based themes (Free), and a popup lightbox display option for Pro galleries.");
2290 }
2291 $new_pointer_content .= '</p>';
2292
2293 return array(
2294 $prefix . 'new_items' => array(
2295 'content' => $new_pointer_content,
2296 'anchor_id' => 'a.toplevel_page_youtube-my-preferences', //'#ytprefs_glance_button',
2297 'edge' => 'top',
2298 'align' => 'left',
2299 'active' => (!in_array($prefix . 'new_items', $dismissed) )
2300 ),
2301 );
2302 }
2303
2304 public static function postchecked($idx)
2305 {
2306 return isset($_POST[$idx]) && $_POST[$idx] == (true || 'on');
2307 }
2308
2309 public static function ytprefs_show_options()
2310 {
2311
2312 if (!current_user_can('manage_options'))
2313 {
2314 wp_die(__('You do not have sufficient permissions to access this page.'));
2315 }
2316
2317 if (self::$double_plugin)
2318 {
2319 //add_action('admin_notices', array("YouTubePrefs", "double_plugin_warning"));
2320 self::double_plugin_warning();
2321 }
2322
2323
2324 // variables for the field and option names
2325 $ytprefs_submitted = 'ytprefs_submitted';
2326
2327 // Read in existing option values from database
2328
2329 $all = get_option(self::$opt_alloptions);
2330
2331 // See if the user has posted us some information
2332 // If they did, this hidden field will be set to 'Y'
2333 if (isset($_POST[$ytprefs_submitted]) && $_POST[$ytprefs_submitted] == 'Y')
2334 {
2335 // Read their posted values
2336
2337 $new_options = array();
2338 $new_options[self::$opt_center] = self::postchecked(self::$opt_center) ? 1 : 0;
2339 $new_options[self::$opt_glance] = self::postchecked(self::$opt_glance) ? 1 : 0;
2340 $new_options[self::$opt_autoplay] = self::postchecked(self::$opt_autoplay) ? 1 : 0;
2341 $new_options[self::$opt_debugmode] = self::postchecked(self::$opt_debugmode) ? 1 : 0;
2342 $new_options[self::$opt_admin_off_scripts] = self::postchecked(self::$opt_admin_off_scripts) ? 1 : 0;
2343 $new_options[self::$opt_old_script_method] = self::postchecked(self::$opt_old_script_method) ? 1 : 0;
2344 $new_options[self::$opt_cc_load_policy] = self::postchecked(self::$opt_cc_load_policy) ? 1 : 0;
2345 $new_options[self::$opt_iv_load_policy] = self::postchecked(self::$opt_iv_load_policy) ? 1 : 3;
2346 $new_options[self::$opt_loop] = self::postchecked(self::$opt_loop) ? 1 : 0;
2347 $new_options[self::$opt_modestbranding] = self::postchecked(self::$opt_modestbranding) ? 1 : 0;
2348 $new_options[self::$opt_rel] = self::postchecked(self::$opt_rel) ? 1 : 0;
2349 $new_options[self::$opt_showinfo] = self::postchecked(self::$opt_showinfo) ? 1 : 0;
2350 $new_options[self::$opt_playsinline] = self::postchecked(self::$opt_playsinline) ? 1 : 0;
2351 $new_options[self::$opt_origin] = self::postchecked(self::$opt_origin) ? 1 : 0;
2352 $new_options[self::$opt_controls] = self::postchecked(self::$opt_controls) ? 2 : 0;
2353 $new_options[self::$opt_autohide] = self::postchecked(self::$opt_autohide) ? 1 : 2;
2354 $new_options[self::$opt_html5] = self::postchecked(self::$opt_html5) ? 1 : 0;
2355 $new_options[self::$opt_theme] = self::postchecked(self::$opt_theme) ? 'dark' : 'light';
2356 $new_options[self::$opt_color] = self::postchecked(self::$opt_color) ? 'red' : 'white';
2357 $new_options[self::$opt_wmode] = self::postchecked(self::$opt_wmode) ? 'opaque' : 'transparent';
2358 $new_options[self::$opt_vq] = self::postchecked(self::$opt_vq) ? 'hd720' : '';
2359 $new_options[self::$opt_nocookie] = self::postchecked(self::$opt_nocookie) ? 1 : 0;
2360 $new_options[self::$opt_playlistorder] = self::postchecked(self::$opt_playlistorder) ? 1 : 0;
2361 $new_options[self::$opt_acctitle] = self::postchecked(self::$opt_acctitle) ? 1 : 0;
2362 $new_options[self::$opt_ogvideo] = self::postchecked(self::$opt_ogvideo) ? 1 : 0;
2363 $new_options[self::$opt_migrate] = self::postchecked(self::$opt_migrate) ? 1 : 0;
2364 $new_options[self::$opt_migrate_youtube] = self::postchecked(self::$opt_migrate_youtube) ? 1 : 0;
2365 //$new_options[self::$opt_ssl] = self::postchecked(self::$opt_ssl) ? 1 : 0;
2366 $new_options[self::$opt_oldspacing] = self::postchecked(self::$opt_oldspacing) ? 1 : 0;
2367 $new_options[self::$opt_responsive] = self::postchecked(self::$opt_responsive) ? 1 : 0;
2368 $new_options[self::$opt_widgetfit] = self::postchecked(self::$opt_widgetfit) ? 1 : 0;
2369 $new_options[self::$opt_evselector_light] = self::postchecked(self::$opt_evselector_light) ? 1 : 0;
2370 $new_options[self::$opt_schemaorg] = self::postchecked(self::$opt_schemaorg) ? 1 : 0;
2371 $new_options[self::$opt_ftpostimg] = self::postchecked(self::$opt_ftpostimg) ? 1 : 0;
2372 $new_options[self::$opt_spdc] = self::postchecked(self::$opt_spdc) ? 1 : 0;
2373 $new_options[self::$opt_dynload] = self::postchecked(self::$opt_dynload) ? 1 : 0;
2374 $new_options[self::$opt_defaultdims] = self::postchecked(self::$opt_defaultdims) ? 1 : 0;
2375 $new_options[self::$opt_defaultvol] = self::postchecked(self::$opt_defaultvol) ? 1 : 0;
2376 $new_options[self::$opt_dohl] = self::postchecked(self::$opt_dohl) ? 1 : 0;
2377 $new_options[self::$opt_gallery_showtitle] = self::postchecked(self::$opt_gallery_showtitle) ? 1 : 0;
2378 $new_options[self::$opt_gallery_showpaging] = self::postchecked(self::$opt_gallery_showpaging) ? 1 : 0;
2379 $new_options[self::$opt_gallery_autonext] = self::postchecked(self::$opt_gallery_autonext) ? 1 : 0;
2380 $new_options[self::$opt_gallery_thumbplay] = self::postchecked(self::$opt_gallery_thumbplay) ? 1 : 0;
2381 $new_options[self::$opt_gallery_channelsub] = self::postchecked(self::$opt_gallery_channelsub) ? 1 : 0;
2382 $new_options[self::$opt_gallery_customarrows] = self::postchecked(self::$opt_gallery_customarrows) ? 1 : 0;
2383 $new_options[self::$opt_gallery_showdsc] = self::postchecked(self::$opt_gallery_showdsc) ? 1 : 0;
2384
2385 $_defaultwidth = '';
2386 try
2387 {
2388 $_defaultwidth = is_numeric(trim($_POST[self::$opt_defaultwidth])) ? intval(trim($_POST[self::$opt_defaultwidth])) : $_defaultwidth;
2389 }
2390 catch (Exception $ex)
2391 {
2392
2393 }
2394 $new_options[self::$opt_defaultwidth] = $_defaultwidth;
2395
2396 $_defaultheight = '';
2397 try
2398 {
2399 $_defaultheight = is_numeric(trim($_POST[self::$opt_defaultheight])) ? intval(trim($_POST[self::$opt_defaultheight])) : $_defaultheight;
2400 }
2401 catch (Exception $ex)
2402 {
2403
2404 }
2405 $new_options[self::$opt_defaultheight] = $_defaultheight;
2406
2407 $_responsive_all = 1;
2408 try
2409 {
2410 $_responsive_all = is_numeric(trim($_POST[self::$opt_responsive_all])) ? intval(trim($_POST[self::$opt_responsive_all])) : $_responsive_all;
2411 }
2412 catch (Exception $ex)
2413 {
2414
2415 }
2416 $new_options[self::$opt_responsive_all] = $_responsive_all;
2417
2418 $_vol = '';
2419 try
2420 {
2421 $_vol = is_numeric(trim($_POST[self::$opt_vol])) ? intval(trim($_POST[self::$opt_vol])) : $_vol;
2422 }
2423 catch (Exception $ex)
2424 {
2425
2426 }
2427 $new_options[self::$opt_vol] = $_vol;
2428
2429 $_gallery_pagesize = 12;
2430 try
2431 {
2432 $_gallery_pagesize = is_numeric(trim($_POST[self::$opt_gallery_pagesize])) ? intval(trim($_POST[self::$opt_gallery_pagesize])) : $_gallery_pagesize;
2433 }
2434 catch (Exception $ex)
2435 {
2436
2437 }
2438 $new_options[self::$opt_gallery_pagesize] = $_gallery_pagesize;
2439
2440
2441 $_gallery_columns = 3;
2442 try
2443 {
2444 $_gallery_columns = is_numeric(trim($_POST[self::$opt_gallery_columns])) ? intval(trim($_POST[self::$opt_gallery_columns])) : $_gallery_columns;
2445 }
2446 catch (Exception $ex)
2447 {
2448
2449 }
2450 $new_options[self::$opt_gallery_columns] = $_gallery_columns;
2451
2452 $_gallery_scrolloffset = 20;
2453 try
2454 {
2455 $_gallery_scrolloffset = is_numeric(trim($_POST[self::$opt_gallery_scrolloffset])) ? intval(trim($_POST[self::$opt_gallery_scrolloffset])) : $_gallery_scrolloffset;
2456 }
2457 catch (Exception $ex)
2458 {
2459
2460 }
2461 $new_options[self::$opt_gallery_scrolloffset] = $_gallery_scrolloffset;
2462
2463 $_gallery_style = 'grid';
2464 try
2465 {
2466 if (isset($_POST[self::$opt_gallery_style]))
2467 {
2468 $_gallery_style = trim(str_replace(array(' ', "'", '"'), array('', '', ''), strip_tags($_POST[self::$opt_gallery_style])));
2469 }
2470 }
2471 catch (Exception $ex)
2472 {
2473 $_gallery_style = 'grid';
2474 }
2475 $new_options[self::$opt_gallery_style] = $_gallery_style;
2476
2477
2478 $_gallery_thumbcrop = 'box';
2479 try
2480 {
2481 if (isset($_POST[self::$opt_gallery_thumbcrop]))
2482 {
2483 $_gallery_thumbcrop = trim(str_replace(array(' ', "'", '"'), array('', '', ''), strip_tags($_POST[self::$opt_gallery_thumbcrop])));
2484 }
2485 }
2486 catch (Exception $ex)
2487 {
2488 $_gallery_thumbcrop = 'box';
2489 }
2490 $new_options[self::$opt_gallery_thumbcrop] = $_gallery_thumbcrop;
2491
2492
2493 $_gallery_disptype = 'default';
2494 try
2495 {
2496 if (isset($_POST[self::$opt_gallery_disptype]))
2497 {
2498 $_gallery_disptype = trim(str_replace(array(' ', "'", '"'), array('', '', ''), strip_tags($_POST[self::$opt_gallery_disptype])));
2499 }
2500 }
2501 catch (Exception $ex)
2502 {
2503 $_gallery_disptype = 'default';
2504 }
2505 $new_options[self::$opt_gallery_disptype] = $_gallery_disptype;
2506
2507
2508 $_gallery_channelsublink = '';
2509 try
2510 {
2511 $_gallery_channelsublink = trim(strip_tags($_POST[self::$opt_gallery_channelsublink]));
2512 $pieces = explode('?', $_gallery_channelsublink);
2513 $_gallery_channelsublink = trim($pieces[0]);
2514 }
2515 catch (Exception $ex)
2516 {
2517 $_gallery_channelsublink = '';
2518 }
2519 $new_options[self::$opt_gallery_channelsublink] = $_gallery_channelsublink;
2520
2521
2522 $_gallery_channelsubtext = '';
2523 try
2524 {
2525 $_gallery_channelsubtext = stripslashes(trim($_POST[self::$opt_gallery_channelsubtext]));
2526 }
2527 catch (Exception $ex)
2528 {
2529 $_gallery_channelsubtext = '';
2530 }
2531 $new_options[self::$opt_gallery_channelsubtext] = $_gallery_channelsubtext;
2532
2533
2534 $_gallery_custom_prev = 'Prev';
2535 try
2536 {
2537 $_gallery_custom_prev = trim(strip_tags($_POST[self::$opt_gallery_customprev]));
2538 }
2539 catch (Exception $ex)
2540 {
2541 $_gallery_custom_prev = 'Prev';
2542 }
2543 $new_options[self::$opt_gallery_customprev] = $_gallery_custom_prev;
2544
2545
2546 $_gallery_custom_next = 'Next';
2547 try
2548 {
2549 $_gallery_custom_next = trim(strip_tags($_POST[self::$opt_gallery_customnext]));
2550 }
2551 catch (Exception $ex)
2552 {
2553 $_gallery_custom_next = 'Next';
2554 }
2555 $new_options[self::$opt_gallery_customnext] = $_gallery_custom_next;
2556
2557
2558 $_apikey = $all[self::$opt_apikey];
2559 try
2560 {
2561 $_curr_apikey = $all[self::$opt_apikey];
2562 $_schema_apikey = '';
2563 if (isset($_POST[self::$opt_apikey]))
2564 {
2565 $_schema_apikey = trim(str_replace(array(' ', "'", '"'), array('', '', ''), strip_tags($_POST[self::$opt_apikey])));
2566 }
2567
2568 $_gallery_apikey = trim(str_replace(array(' ', "'", '"'), array('', '', ''), strip_tags($_POST[self::$opt_gallery_apikey])));
2569
2570 if (!empty($_schema_apikey) && $_schema_apikey != $_curr_apikey)
2571 {
2572 $_apikey = $_schema_apikey;
2573 }
2574 if (!empty($_gallery_apikey) && $_gallery_apikey != $_curr_apikey)
2575 {
2576 $_apikey = $_gallery_apikey;
2577 }
2578 }
2579 catch (Exception $ex)
2580 {
2581
2582 }
2583 $new_options[self::$opt_apikey] = $_apikey;
2584
2585 // $_hl = '';
2586 // try
2587 // {
2588 // $temphl = strtolower(trim($_POST[self::$opt_hl]));
2589 // $_hl = preg_match('/^[a-z][a-z]$/i', $temphl) ? $temphl : '';
2590 // }
2591 // catch (Exception $ex)
2592 // {
2593 //
2594 // }
2595 // $new_options[self::$opt_hl] = $_hl;
2596
2597 $_dyntype = '';
2598 try
2599 {
2600 if (isset($_POST[self::$opt_dyntype]))
2601 {
2602 $tempdyntype = trim($_POST[self::$opt_dyntype]);
2603 $_dyntype = preg_match('/^[a-zA-Z-]+$/i', $tempdyntype) ? $tempdyntype : '';
2604 }
2605 }
2606 catch (Exception $ex)
2607 {
2608
2609 }
2610 $new_options[self::$opt_dyntype] = $_dyntype;
2611
2612 $_spdcexp = 24;
2613 try
2614 {
2615 $_spdcexp = isset($_POST[self::$opt_spdcexp]) && is_numeric(trim($_POST[self::$opt_spdcexp])) ? intval(trim($_POST[self::$opt_spdcexp])) : $_spdcexp;
2616 }
2617 catch (Exception $ex)
2618 {
2619
2620 }
2621 $new_options[self::$opt_spdcexp] = $_spdcexp;
2622
2623
2624
2625 $all = $new_options + $all;
2626
2627 update_option(self::$opt_alloptions, $all);
2628
2629 try
2630 {
2631 self::spdcpurge();
2632 if ($all[self::$opt_spdc] == 1)
2633 {
2634 wp_remote_get(site_url());
2635 }
2636 }
2637 catch (Exception $ex)
2638 {
2639
2640 }
2641 ?>
2642 <div class="updated"><p><strong><?php _e('Changes saved.'); ?></strong></p></div>
2643 <?php
2644 }
2645
2646
2647 // Now display the settings editing screen
2648
2649 echo '<div class="wrap" style="max-width: 1000px;">';
2650
2651 // header
2652
2653 echo "<h2>" . '<img src="' . plugins_url('images/youtubeicon16.png', __FILE__) . '" /> ' . __('YouTube Settings') . "</h2>";
2654
2655 // settings form
2656 ?>
2657
2658 <style type="text/css">
2659 .wrap {font-family: Arial; color: #000000;}
2660 #ytform p { line-height: 20px; margin-bottom: 11px; }
2661 #ytform ul li {margin-left: 30px; list-style: disc outside none;}
2662 .ytindent {padding: 0px 0px 0px 20px; font-size: 12px;}
2663 .ytindent ul, .ytindent p {font-size: 12px;}
2664 .shadow {-webkit-box-shadow: 0px 0px 20px 0px #000000; box-shadow: 0px 0px 20px 0px #000000;}
2665 .gopro {margin: 0px;}
2666 .gopro img {vertical-align: middle;
2667 width: 19px;
2668 height: 19px;
2669 padding-bottom: 4px;}
2670 .gopro li {margin-bottom: 0px;}
2671 .orange {color: #f85d00;}
2672 .bold {font-weight: bold;}
2673 .grey{color: #888888;}
2674 #goprobox {border-radius: 15px; padding: 10px 15px 15px 15px; margin-top: 15px; border: 3px solid #CCE5EC; position: relative;}
2675 #salenote {position: absolute; right: 10px; top: 10px; width: 75px; height: 30px;}
2676 #nonprosupport {border-radius: 15px; padding: 10px 15px 20px 15px; border: 3px solid #ff6655;}
2677 .pronon {font-weight: bold; color: #f85d00;}
2678 ul.reglist li {margin: 0px 0px 0px 30px; list-style: disc outside none;}
2679 .procol {width: 475px; float: left;}
2680 .ytindent .procol ul {font-size: 11px;}
2681 .smallnote, .ytindent .smallnote {font-style: italic; font-size: 10px;}
2682 .italic {font-style: italic;}
2683 .ytindent h3 {font-size: 15px; line-height: 22px; margin: 5px 0px 10px 0px;}
2684 #wizleftlink {float: left; display: block; width: 240px; font-style: italic; text-align: center; text-decoration: none;}
2685 .button-primary {font-weight: bold; white-space: nowrap;}
2686 p.submit {margin: 10px 0 0 0; padding: 10px 0 5px 0;}
2687 .wp-core-ui p.submit .button-primary {font-size: 20px; height: 50px; padding: 0 20px 1px;
2688 background: #2ea2cc; /* Old browsers */
2689 background: -moz-linear-gradient(top, #2ea2cc 0%, #007396 98%); /* FF3.6+ */
2690 background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#2ea2cc), color-stop(98%,#007396)); /* Chrome,Safari4+ */
2691 background: -webkit-linear-gradient(top, #2ea2cc 0%,#007396 98%); /* Chrome10+,Safari5.1+ */
2692 background: -o-linear-gradient(top, #2ea2cc 0%,#007396 98%); /* Opera 11.10+ */
2693 background: -ms-linear-gradient(top, #2ea2cc 0%,#007396 98%); /* IE10+ */
2694 background: linear-gradient(to bottom, #2ea2cc 0%,#007396 98%); /* W3C */
2695 filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#2ea2cc', endColorstr='#007396',GradientType=0 ); /* IE6-9 */
2696 }
2697 p.submit em {display: inline-block; padding-left: 20px; vertical-align: middle; width: 240px; margin-top: -6px;}
2698 #opt_pro {box-shadow: 0px 0px 5px 0px #1870D5; width: 320px;vertical-align: top;}
2699 #goprobox h3 {font-size: 13px;}
2700 .chx {border-left: 5px solid rgba(100, 100, 100,.1); margin-bottom: 20px;}
2701 .chx p {margin: 0px 0px 5px 0px;}
2702 .cuz {background-image: linear-gradient(to bottom,#4983FF,#0C5597) !important; color: #ffffff;}
2703 .brightpro {background-image: linear-gradient(to bottom,#ff5500,#cc2200) !important; color: #ffffff;}
2704 #boxdefaultdims {font-weight: bold; padding: 0px 10px; <?php echo $all[self::$opt_defaultdims] ? '' : 'display: none;' ?>}
2705 #boxcustomarrows {font-weight: bold; padding: 0px 10px; <?php echo $all[self::$opt_gallery_customarrows] ? 'display: block;' : 'display: none;' ?>}
2706 #boxchannelsub {font-weight: bold; padding: 0px 10px; <?php echo $all[self::$opt_gallery_channelsub] ? 'display: block;' : 'display: none;' ?>}
2707 .textinput {border-width: 2px !important;}
2708 h3.sect {border-radius: 10px; background-color: #D9E9F7; padding: 5px 5px 5px 10px; position: relative; font-weight: bold;}
2709 h3.sect a {text-decoration: none; color: #E20000;}
2710 h3.sect a.button-primary {color: #ffffff;}
2711 h4.sect {border-radius: 10px; background-color: #D9E9F7; padding: 5px 5px 5px 10px; position: relative; font-weight: bold;}
2712
2713 .ytnav {margin-bottom: 15px;}
2714 .ytnav a {font-weight: bold; display: inline-block; padding: 5px 10px; margin: 0px 15px 0px 0px; border: 1px solid #cccccc; border-radius: 6px;
2715 text-decoration: none; background-color: #ffffff;}
2716 .ytnav a:last-child {margin-right: 0;}
2717 .jumper {height: 25px;}
2718 .ssschema {float: right; width: 350px; height: auto; margin-right: 10px;}
2719 .ssfb {float: right; height: auto; margin-right: 10px; margin-left: 15px; margin-bottom: 10px;}
2720 .totop {position: absolute; right: 20px; top: 5px; color: #444444; font-size: 10px;}
2721 input[type=checkbox] {border: 1px solid #000000;}
2722 .chktitle {display: inline-block; padding: 1px 5px 1px 5px; border-radius: 3px; background-color: #ffffff; border: 1px solid #dddddd;}
2723 b, strong {font-weight: bold;}
2724 input.checkbox[disabled], input[type=radio][disabled] {border: 1px dashed #444444;}
2725 .pad10 {padding: 10px;}
2726 #boxdohl {font-weight: bold; padding: 0px 10px; <?php echo $all[self::$opt_dohl] ? '' : 'display: none;' ?>}
2727 #boxdyn {font-weight: bold; padding: 0px 10px; <?php echo $all[self::$opt_dynload] ? 'display: block;' : 'display: none;' ?>}
2728 #boxspdc {padding: 0px 10px; <?php echo $all[self::$opt_spdc] ? '' : 'display: none;' ?>}
2729 #boxdefaultvol {font-weight: bold; padding: 0px 10px; <?php echo $all[self::$opt_defaultvol] ? '' : 'display: none;' ?>}
2730 .vol-output {display: none; width: 30px; color: #008800;}
2731 .vol-range {background-color: #dddddd; border-radius: 3px; cursor: pointer;}
2732 input#vol {vertical-align: middle;}
2733 .vol-seeslider {display: none;}
2734 input#spdcexp {width: 70px;}
2735 .indent-option {margin-left: 25px;}
2736 #boxschemaorg {font-weight: bold; padding: 7px 0; <?php echo $all[self::$opt_schemaorg] ? 'display: block;' : 'display: none;' ?>}
2737 #boxmigratelist { <?php echo $all[self::$opt_migrate] ? '' : 'display: none;' ?>}
2738 #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;}
2739 .apikey-msg {display: inline-block; width: 45%; vertical-align: top;}
2740 .apikey-video{margin-left: 3%; display: inline-block; width: 50%; position: relative; padding-top: 29%}
2741 .apikey-video iframe{display: block; width: 100%; height: 100%; position: absolute; top: 0; left: 0;}
2742 #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;' ?>}
2743 .strike {text-decoration: line-through;}
2744 .upgchecks { padding: 20px; border-radius: 15px; border: 1px dotted #777777; background-color: #fcfcfc; }
2745 .clearboth {clear: both;}
2746 div.hr {clear: both; border-bottom: 1px dotted #A8BDD8; margin: 20px 0 20px 0;}
2747 .wp-pointer-buttons a.close {margin-top: 0 !important;}
2748 .pad20{padding: 20px 0 20px 0;}
2749 .ssgallery {float: right; width: 130px; height: auto; margin-left: 15px; border: 3px solid #ffffff;}
2750 .sssubscribe{display: block; width: 400px; height: auto;}
2751 .ssaltgallery {float: right; height: auto; margin-right: 10px; margin-left: 15px; margin-bottom: 10px; width: 350px;}
2752 .sspopupplayer {float: right; height: auto; margin-right: 10px; margin-left: 15px; margin-bottom: 10px; width: 350px;}
2753 .sswizardbutton { max-width: 70%; height: auto;}
2754 .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;
2755 -webkit-box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.75);
2756 -moz-box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.75);
2757 box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.75); }
2758 </style>
2759 <div class="ytindent">
2760 <br>
2761 <div id="jumphowto"></div>
2762 <div class="ytnav">
2763 <a href="#jumphowto">How To Embed</a>
2764 <a href="#jumpwiz">Visual Wizard</a>
2765 <a href="#jumpdefaults">Defaults</a>
2766 <a href="#jumpcompat">Compatibility</a>
2767 <a href="#jumpgallery">Galleries</a>
2768 <a href="#jumpprosettings">PRO Settings</a>
2769 <a href="#jumpoverride">Override Defaults</a>
2770 <a target="_blank" href="<?php echo self::$epbase . "/dashboard/pro-easy-video-analytics.aspx?ref=protab" ?>" style="border-color: #888888;">Upgrade?</a>
2771 <a href="#jumpsupport">Support</a>
2772 </div>
2773
2774 <form name="form1" method="post" action="" id="ytform">
2775 <input type="hidden" name="<?php echo $ytprefs_submitted; ?>" value="Y">
2776
2777 <h3 class="sect">
2778 How to Insert a YouTube Video or Playlist &nbsp; <a class="smallnote" href="#jumpgallery">(For gallery directions, go here &raquo;)</a>
2779 </h3>
2780 <p>
2781 <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>
2782 <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).
2783 </p>
2784 <p>
2785 <b>For galleries:</b> <a href="#jumpgallery">Click here</a> to scroll down to gallery settings and directions.
2786 </p>
2787 <p>
2788 <b>For self-contained 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.
2789 </p>
2790 <p>
2791 <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.
2792 </p>
2793 <p>
2794 <b>Examples:</b><br><br>
2795 <img style="width: 900px; height: auto;" class="shadow" src="<?php echo plugins_url('images/sshowto.png', __FILE__) ?>" />
2796 </p>
2797 <p>
2798 Always follow these rules for any URL:
2799 </p>
2800 <ul class="reglist">
2801 <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>
2802 <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>
2803 <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>
2804 <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>
2805 <code>[embedyt]http://www.youtube.com/watch?v=ABCDEF[/embedyt] [embedyt]http://www.youtube.com/watch?v=GHIJK[/embedyt]</code>
2806 </ul>
2807
2808 <div class="jumper" id="jumpwiz"></div>
2809 <h3 class="sect">Visual YouTube Wizard <a href="#top" class="totop">&#9650; top</a></h3>
2810
2811 <p>
2812 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.
2813 Simply click the <img style="vertical-align: text-bottom;" src="<?php echo plugins_url('images/wizbuttonbig.png', __FILE__) ?>"> wizard button found above
2814 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.
2815 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
2816 you can click to directly embed the desired video link to your post without having to copy and paste.
2817 </p>
2818 <p>
2819 The ability to read the latest Internet discussions about the videos you want to embed is now free to all users.
2820 </p>
2821 <p>
2822 <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.
2823 <br>
2824 <br>
2825
2826 <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>
2827
2828 </p>
2829 <div class="jumper" id="jumpdefaults"></div>
2830 <h3 class="sect">
2831 <?php _e("Default YouTube Options") ?> <a href="#top" class="totop">&#9650; top</a>
2832 </h3>
2833 <p>
2834 <?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.") ?>
2835 </p>
2836 <?php // self::save_changes_button(); ?>
2837
2838 <div class="ytindent chx">
2839 <p>
2840 <input name="<?php echo self::$opt_glance; ?>" id="<?php echo self::$opt_glance; ?>" <?php checked($all[self::$opt_glance], 1); ?> type="checkbox" class="checkbox">
2841 <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>
2842 </p>
2843 <p>
2844 <input name="<?php echo self::$opt_center; ?>" id="<?php echo self::$opt_center; ?>" <?php checked($all[self::$opt_center], 1); ?> type="checkbox" class="checkbox">
2845 <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>
2846 </p>
2847 <p>
2848 <input name="<?php echo self::$opt_autoplay; ?>" id="<?php echo self::$opt_autoplay; ?>" <?php checked($all[self::$opt_autoplay], 1); ?> type="checkbox" class="checkbox">
2849 <label for="<?php echo self::$opt_autoplay; ?>"><?php _e('<b class="chktitle">Autoplay:</b> Automatically start playing your videos.') ?></label>
2850 </p>
2851 <p>
2852 <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">
2853 <label for="<?php echo self::$opt_iv_load_policy; ?>"><?php _e('<b class="chktitle">Annotations:</b> Show annotations by default.') ?></label>
2854 </p>
2855 <p>
2856 <input name="<?php echo self::$opt_loop; ?>" id="<?php echo self::$opt_loop; ?>" <?php checked($all[self::$opt_loop], 1); ?> type="checkbox" class="checkbox">
2857 <label for="<?php echo self::$opt_loop; ?>"><?php _e('<b class="chktitle">Looping:</b> Loop all your videos.') ?></label>
2858 </p>
2859 <p>
2860 <input name="<?php echo self::$opt_modestbranding; ?>" id="<?php echo self::$opt_modestbranding; ?>" <?php checked($all[self::$opt_modestbranding], 1); ?> type="checkbox" class="checkbox">
2861 <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>
2862 </p>
2863 <p>
2864 <input name="<?php echo self::$opt_rel; ?>" id="<?php echo self::$opt_rel; ?>" <?php checked($all[self::$opt_rel], 1); ?> type="checkbox" class="checkbox">
2865 <label for="<?php echo self::$opt_rel; ?>"><?php _e('<b class="chktitle">Related Videos:</b> Show related videos at the end.') ?></label>
2866 </p>
2867 <p>
2868 <input name="<?php echo self::$opt_showinfo; ?>" id="<?php echo self::$opt_showinfo; ?>" <?php checked($all[self::$opt_showinfo], 1); ?> type="checkbox" class="checkbox">
2869 <label for="<?php echo self::$opt_showinfo; ?>"><?php _e('<b class="chktitle">Show Title:</b> Show the video title and other info.') ?></label>
2870 </p>
2871 <p>
2872 <input name="<?php echo self::$opt_acctitle; ?>" id="<?php echo self::$opt_acctitle; ?>" <?php checked($all[self::$opt_acctitle], 1); ?> type="checkbox" class="checkbox">
2873 <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>
2874 </p>
2875 <p>
2876 <input name="<?php echo self::$opt_theme; ?>" id="<?php echo self::$opt_theme; ?>" <?php checked($all[self::$opt_theme], 'dark'); ?> type="checkbox" class="checkbox">
2877 <label for="<?php echo self::$opt_theme; ?>"><?php _e('<b class="chktitle strike">Dark Theme:</b> Use the dark theme (uncheck to use light theme). <b>Note: YouTube has deprecated this option and will always use the dark theme.</b>') ?></label>
2878 </p>
2879 <p>
2880 <input name="<?php echo self::$opt_color; ?>" id="<?php echo self::$opt_color; ?>" <?php checked($all[self::$opt_color], 'red'); ?> type="checkbox" class="checkbox">
2881 <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>
2882 </p>
2883 <p>
2884 <input name="<?php echo self::$opt_vq; ?>" id="<?php echo self::$opt_vq; ?>" <?php checked($all[self::$opt_vq], 'hd720'); ?> type="checkbox" class="checkbox">
2885 <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>
2886 </p>
2887 <p>
2888 <input name="<?php echo self::$opt_wmode; ?>" id="<?php echo self::$opt_wmode; ?>" <?php checked($all[self::$opt_wmode], 'opaque'); ?> type="checkbox" class="checkbox">
2889 <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>
2890 </p>
2891 <p>
2892 <input name="<?php echo self::$opt_defaultdims; ?>" id="<?php echo self::$opt_defaultdims; ?>" <?php checked($all[self::$opt_defaultdims], 1); ?> type="checkbox" class="checkbox">
2893 <span id="boxdefaultdims">
2894 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;
2895 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;">
2896 </span>
2897
2898 <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>
2899 </p>
2900 <p>
2901 <input name="<?php echo self::$opt_responsive; ?>" id="<?php echo self::$opt_responsive; ?>" <?php checked($all[self::$opt_responsive], 1); ?> type="checkbox" class="checkbox">
2902 <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>
2903 <div id="boxresponsive_all">
2904 <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); ?> >
2905 <label for="<?php echo self::$opt_responsive_all; ?>1">Responsive for all YouTube videos</label> &nbsp;&nbsp;
2906 <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); ?> >
2907 <label for="<?php echo self::$opt_responsive_all; ?>0">Responsive for only videos embedded via this plugin</label>
2908 </div>
2909 </p>
2910 <p>
2911 <input name="<?php echo self::$opt_widgetfit; ?>" id="<?php echo self::$opt_widgetfit; ?>" <?php checked($all[self::$opt_widgetfit], 1); ?> type="checkbox" class="checkbox">
2912 <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>
2913 </p>
2914 <p>
2915 <input name="<?php echo self::$opt_playsinline; ?>" id="<?php echo self::$opt_playsinline; ?>" <?php checked($all[self::$opt_playsinline], 1); ?> type="checkbox" class="checkbox">
2916 <label for="<?php echo self::$opt_playsinline; ?>">
2917 <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.
2918 <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>
2919 </label>
2920 </p>
2921 <p>
2922 <input name="<?php echo self::$opt_origin; ?>" id="<?php echo self::$opt_origin; ?>" <?php checked($all[self::$opt_origin], 1); ?> type="checkbox" class="checkbox">
2923 <label for="<?php echo self::$opt_origin; ?>"><b class="chktitle">Extra Player Security: </b>
2924 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).
2925 </label>
2926 </p>
2927 <p>
2928 <input name="<?php echo self::$opt_nocookie; ?>" id="<?php echo self::$opt_nocookie; ?>" <?php checked($all[self::$opt_nocookie], 1); ?> type="checkbox" class="checkbox">
2929 <span id="boxnocookie">
2930 Uncheck this option if you are planning to embed galleries and playlists on your site. Furthermore, videos on mobile devices may have problems if you leave this checked.
2931 </span>
2932 <label for="<?php echo self::$opt_nocookie; ?>">
2933 <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>
2934 </label>
2935 </p>
2936 <p>
2937 <input name="<?php echo self::$opt_controls; ?>" id="<?php echo self::$opt_controls; ?>" <?php checked($all[self::$opt_controls], 2); ?> type="checkbox" class="checkbox">
2938 <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>
2939 </p>
2940 <p>
2941 <input name="<?php echo self::$opt_autohide; ?>" id="<?php echo self::$opt_autohide; ?>" <?php checked($all[self::$opt_autohide], 1); ?> type="checkbox" class="checkbox">
2942 <label for="<?php echo self::$opt_autohide; ?>"><b class="chktitle strike">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.
2943 <strong>Note: YouTube has deprecated this option, and will always autohide the controls.</strong>
2944 </label>
2945 </p>
2946 <!-- <p>
2947 <input name="<?php echo self::$opt_ssl; ?>" id="<?php echo self::$opt_ssl; ?>" <?php checked($all[self::$opt_ssl], 1); ?> type="checkbox" class="checkbox">
2948 <label for="<?php echo self::$opt_ssl; ?>">
2949 <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.
2950 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>
2951 </label>
2952 </p>-->
2953 <p>
2954 <input name="<?php echo self::$opt_defaultvol; ?>" id="<?php echo self::$opt_defaultvol; ?>" <?php checked($all[self::$opt_defaultvol], 1); ?> type="checkbox" class="checkbox">
2955 <label for="<?php echo self::$opt_defaultvol; ?>">
2956 <b class="chktitle">Volume Initialization: </b>
2957 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>
2958 </label>
2959 <span id="boxdefaultvol">
2960 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]); ?>" >
2961 </span>
2962 </p>
2963
2964 <p>
2965 <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">
2966 <label for="<?php echo self::$opt_cc_load_policy; ?>"><?php _e('<b class="chktitle">Closed Captions:</b> Turn on closed captions by default.') ?></label>
2967 </p>
2968 <p>
2969 <input name="<?php echo self::$opt_dohl; ?>" id="<?php echo self::$opt_dohl; ?>" <?php checked($all[self::$opt_dohl], 1); ?> type="checkbox" class="checkbox">
2970 <!-- <span id="boxdohl">
2971 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">
2972 </span>-->
2973 <label for="<?php echo self::$opt_dohl; ?>"><b class="chktitle">Player Localization / Internationalization: </b>
2974 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>
2975 </p>
2976 <p>
2977 <input name="<?php echo self::$opt_html5; ?>" id="<?php echo self::$opt_html5; ?>" <?php checked($all[self::$opt_html5], 1); ?> type="checkbox" class="checkbox">
2978 <label for="<?php echo self::$opt_html5; ?>">
2979 <b class="chktitle strike">HTML5 First:</b>
2980 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.
2981 </label>
2982 </p>
2983
2984 <p>
2985 <input name="<?php echo self::$opt_playlistorder; ?>" id="<?php echo self::$opt_playlistorder; ?>" <?php checked($all[self::$opt_playlistorder], 1); ?> type="checkbox" class="checkbox">
2986 <label for="<?php echo self::$opt_playlistorder; ?>">
2987 <b class="chktitle">Playlist Ordering:</b>
2988 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).
2989 Note that this is not for setting the thumbnail list order of galleries, just the standard playlist player that YouTube provides.
2990 </label>
2991 </p>
2992
2993
2994
2995 </div>
2996
2997 <div class="jumper" id="jumpcompat"></div>
2998 <h3 class="sect">Compatibility Settings <a href="#top" class="totop">&#9650; top</a></h3>
2999 <p>
3000 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.
3001 </p>
3002 <div class="ytindent chx">
3003 <p>
3004 <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">
3005 <label for="<?php echo self::$opt_old_script_method; ?>">
3006 <b class="chktitle">Use Legacy Scripts: </b>
3007 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.
3008 </label>
3009 </p>
3010 <p>
3011 <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">
3012 <label for="<?php echo self::$opt_admin_off_scripts; ?>">
3013 <b class="chktitle">Turn Off Scripts While Editing: </b>
3014 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.
3015 Don't worry, all other visitors to your site will still view your site normally.
3016 </label>
3017 </p>
3018 <p>
3019 <input name="<?php echo self::$opt_migrate; ?>" id="<?php echo self::$opt_migrate; ?>" <?php checked($all[self::$opt_migrate], 1); ?> type="checkbox" class="checkbox">
3020 <label for="<?php echo self::$opt_migrate; ?>">
3021 <b class="chktitle">Migrate Shortcodes: </b> Inherit other shortcodes.
3022 </label>
3023 <div id="boxmigratelist">
3024 <ul>
3025 <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>
3026 <li class="smallnote orange" style="list-style: none;">This feature is beta. More shortcodes coming.</li>
3027 </ul>
3028
3029 </div>
3030 </p>
3031 <p>
3032 <input name="<?php echo self::$opt_oldspacing; ?>" id="<?php echo self::$opt_oldspacing; ?>" <?php checked($all[self::$opt_oldspacing], 1); ?> type="checkbox" class="checkbox">
3033 <label for="<?php echo self::$opt_oldspacing; ?>">
3034 <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.
3035 </label>
3036 </p>
3037 <p>
3038 <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">
3039 <label for="<?php echo self::$opt_evselector_light; ?>">
3040 <b class="chktitle">Theme Video Problems: </b>
3041 Check this option if you're having issues with autoplayed videos or background videos etc. that have been generated by your theme.
3042 </label>
3043 </p>
3044 <p>
3045 <input name="<?php echo self::$opt_debugmode; ?>" id="<?php echo self::$opt_debugmode; ?>" <?php checked($all[self::$opt_debugmode], 1); ?> type="checkbox" class="checkbox">
3046 <label for="<?php echo self::$opt_debugmode; ?>">
3047 <b class="chktitle">Debug Mode: </b> If you ask for support, we may ask you to turn on debug mode here.
3048 It may print out some diagnostic info so that we can help you solve your issue.
3049 </label>
3050 </p>
3051
3052 </div>
3053 <div class="jumper" id="jumpgallery"></div>
3054 <h3 class="sect">Gallery Settings and Directions <a href="#top" class="totop">&#9650; top</a></h3>
3055 <img class="ssgallery" src="<?php echo plugins_url('images/ssgallery.png', __FILE__) ?>">
3056 <p>
3057 <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>.
3058 Don't worry, it's an easy process. Just <a href="https://www.youtube.com/watch?v=px8LvNIVblg" target="_blank">click this link &raquo;</a> and follow the video on that page to get your API key. Then paste it in the "YouTube API Key" box below, and click the "Save Changes" button.
3059 </p>
3060
3061
3062 <p class="smallnote">
3063 Note: The PRO wizard has steps to visually create and customize playlist, channel, and gallery codes like the above.
3064 </p>
3065 <p>
3066 Below are the settings for galleries:
3067 </p>
3068 <div class="ytindent chx">
3069 <p>
3070 <b class="chktitle">YouTube API Key:</b>
3071 <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;">
3072 Required so your site can get the thumbnails, title text, and other content from YouTube's servers that used to render galleries. <a href="https://www.youtube.com/watch?v=px8LvNIVblg" target="_blank">Click this link &raquo;</a> and follow the video to the right to get your API key.
3073 </p>
3074 <p>
3075 <label for="<?php echo self::$opt_gallery_pagesize; ?>"><b class="chktitle">Gallery Page Size:</b></label>
3076 <select name="<?php echo self::$opt_gallery_pagesize; ?>" id="<?php echo self::$opt_gallery_pagesize; ?>" style="width: 60px;">
3077 <?php
3078 $gps_val = intval(trim($all[self::$opt_gallery_pagesize]));
3079 $gps_val = min($gps_val, 50);
3080 for ($gps = 1; $gps <= 50; $gps++)
3081 {
3082 ?><option <?php echo $gps_val == $gps ? 'selected' : '' ?> value="<?php echo $gps ?>"><?php echo $gps ?></option>
3083 <?php
3084 }
3085 ?>
3086 </select>
3087 Enter how many thumbnails per page should be shown at once (YouTube allows a maximum of 50 per page).
3088 </p>
3089 <p>
3090 <label for="<?php echo self::$opt_gallery_columns; ?>"><b class="chktitle">Number of Columns:</b></label>
3091 <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]); ?>">
3092 Enter how many thumbnails can fit per row.
3093 </p>
3094 <p>
3095 <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">
3096 <label for="<?php echo self::$opt_gallery_showpaging; ?>"><b class="chktitle">Show Pagination:</b> <sup class="orange">NEW</sup> Show the Next/Previous buttons and page numbering.</label>
3097 </p>
3098 <p>
3099 <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">
3100 <label for="<?php echo self::$opt_gallery_customarrows; ?>">
3101 <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.
3102 </label>
3103 <span id="boxcustomarrows">
3104 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;
3105 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;">
3106 </span>
3107 </p>
3108 <p>
3109 <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">
3110 <label for="<?php echo self::$opt_gallery_channelsub; ?>">
3111 <b class="chktitle">Show Subscribe Button: </b> <sup class="orange">NEW</sup> 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.
3112 </label>
3113 <span id="boxchannelsub">
3114 Channel URL: <input type="text" placeholder="https://www.youtube.com/user/YourChannel" name="<?php echo self::$opt_gallery_channelsublink; ?>" id="<?php echo self::$opt_gallery_channelsublink; ?>" value="<?php echo esc_attr(trim($all[self::$opt_gallery_channelsublink])); ?>" class="textinput" style="width: 200px;"> &nbsp;
3115 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;">
3116 </span>
3117 </p>
3118 <p><img class="sssubscribe" src="<?php echo plugins_url('images/sssubscribe.png', __FILE__) ?>"></p>
3119
3120 <p>
3121 <label for="<?php echo self::$opt_gallery_scrolloffset; ?>"><b class="chktitle">Scroll Offset:</b></label>
3122 <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]); ?>">
3123 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.
3124 </p>
3125 <p>
3126 <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">
3127 <label for="<?php echo self::$opt_gallery_showtitle; ?>"><b class="chktitle">Show Thumbnail Title:</b> Show titles with each thumbnail.</label>
3128 </p>
3129 <p>
3130 <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">
3131 <label for="<?php echo self::$opt_gallery_autonext; ?>"><b class="chktitle">Automatic Continuous Play:</b> <sup class="orange">NEW</sup> Automatically play the next video in the gallery as soon as the current video finished.</label>
3132 </p>
3133 <p>
3134 <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">
3135 <label for="<?php echo self::$opt_gallery_thumbplay; ?>"><b class="chktitle">Thumbnail Click Plays Video:</b> <sup class="orange">NEW</sup> Clicking on a gallery thumbnail autoplays the video. Uncheck this and visitors must also click the video's play button after clicking the thumbnail.</label>
3136 </p>
3137 <div class="pad20">
3138 <p>
3139 Ready to get started with an actual gallery? Just click the plugin wizard button and pick your desired gallery embedding choice.
3140 </p>
3141 <p><img class="sswizardbutton" src="<?php echo plugins_url('images/sswizardbutton.jpg', __FILE__) ?>"></p>
3142 </div>
3143 </div>
3144
3145
3146 <div class="jumper" id="jumpprosettings"></div>
3147 <div class="upgchecks">
3148 <h3 class="sect">PRO Features</h3>
3149 <?php
3150 if ($all[self::$opt_pro] && strlen(trim($all[self::$opt_pro])) > 9)
3151 {
3152 ?>
3153 <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>
3154 <p>
3155 <img class="ssaltgallery" src="<?php echo plugins_url('images/ssaltgalleryall.jpg', __FILE__) ?>" />
3156 <?php $cleanstyle = trim($all[self::$opt_gallery_style]); ?>
3157 <select name="<?php echo self::$opt_gallery_style; ?>" id="<?php echo self::$opt_gallery_style; ?>" >
3158 <option value="">Gallery Style</option>
3159 <option value="grid" <?php echo 'grid' === $cleanstyle ? 'selected' : '' ?> >Grid (default)</option>
3160 <option value="listview" <?php echo 'listview' === $cleanstyle ? 'selected' : '' ?> >Vertical List</option>
3161 <option value="carousel" <?php echo 'carousel' === $cleanstyle ? 'selected' : '' ?> >Horizontal Slider</option>
3162 </select>
3163 <label for="<?php echo self::$opt_gallery_style; ?>">
3164 <b>(PRO)</b> <b class="chktitle">Alternate Gallery Styling:</b></b>
3165 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.
3166 <a target="_blank" href="<?php echo self::$epbase ?>/responsive-youtube-playlist-channel-gallery-for-wordpress.aspx">Read more here &raquo;</a>
3167 </label>
3168 </p>
3169
3170 <div class="hr"></div>
3171 <p>
3172 <img class="ssaltgallery" src="<?php echo plugins_url('images/ssverticallayout.png', __FILE__) ?>" />
3173 <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">
3174 <label for="<?php echo self::$opt_gallery_showdsc; ?>">
3175 <b>(PRO)</b> <b class="chktitle">Show Gallery Descriptions (for vertical list styling): </b>
3176 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.
3177 </label>
3178 </p>
3179 <div class="hr"></div>
3180 <p>
3181 <img class="ssaltgallery" src="<?php echo plugins_url('images/ssaltgallerycircles.jpg', __FILE__) ?>" />
3182 <?php $cleancrop = trim($all[self::$opt_gallery_thumbcrop]); ?>
3183 <label for="<?php echo self::$opt_gallery_thumbcrop; ?>">
3184 <b>(PRO)</b> <b class="chktitle">Gallery Thumbnail Shape:</b></b>
3185 Differentiate your gallery by showing different thumbnail shapes. We currently offer rectangle and circle shapes.
3186 </label>
3187 <br>
3188 <select name="<?php echo self::$opt_gallery_thumbcrop; ?>" id="<?php echo self::$opt_gallery_thumbcrop; ?>" >
3189 <option value="">Thumbnail Shape</option>
3190 <option value="box" <?php echo 'box' === $cleancrop ? 'selected' : '' ?> >Rectangle (default)</option>
3191 <option value="portal" <?php echo 'portal' === $cleancrop ? 'selected' : '' ?> >Circular</option>
3192 </select>
3193 </p>
3194 <div class="hr"></div>
3195 <p>
3196 <img class="sspopupplayer" src="<?php echo plugins_url('images/sspopupplayer.jpg', __FILE__) ?>" />
3197 <?php $cleandisp = trim($all[self::$opt_gallery_disptype]); ?>
3198 <label for="<?php echo self::$opt_gallery_disptype; ?>">
3199 <b>(PRO)</b> <b class="chktitle">Gallery Video Display Mode:</b> <sup class="orange">NEW</sup>
3200 Display your gallery videos simply above the thumbnails (default), or as a popup lightbox.
3201 </label>
3202 <br>
3203 <select name="<?php echo self::$opt_gallery_disptype; ?>" id="<?php echo self::$opt_gallery_disptype; ?>" >
3204 <option value="">Display Type</option>
3205 <option value="default" <?php echo 'default' === $cleandisp ? 'selected' : '' ?> >Above Thumbnails (default)</option>
3206 <option value="lb" <?php echo 'lb' === $cleandisp ? 'selected' : '' ?> >Popup Lightbox</option>
3207 </select>
3208 </p>
3209 <div class="hr"></div>
3210
3211 <p>
3212 <input name="<?php echo self::$opt_spdc; ?>" id="<?php echo self::$opt_spdc; ?>" <?php checked($all[self::$opt_spdc], 1); ?> type="checkbox" class="checkbox">
3213 <label for="<?php echo self::$opt_spdc; ?>">
3214 <b>(PRO)</b> <b class="chktitle">Faster Page Loads (Caching): </b>
3215 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.
3216 </label>
3217 <div class="indent-option">
3218 <div id="boxspdc">
3219 <label>
3220 <b class="chktitle">Cache Liftime (hours): </b>
3221 <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"/>
3222 </label>
3223 Tip: If your pages rarely change, you may wish to set this to a much higher value than 24 hours.
3224
3225 <div class="pad20">
3226 <input type="button" class="button button-primary" value="Click to clear YouTube cache"/>
3227 <span style="display: none;" id="clearspdcloading" class="orange bold">Clearing...</span>
3228 <span class="orange bold" style="display: none;" id="clearspdcsuccess">Finished clearing YouTube cache.</span>
3229 <span class="orange bold" style="display: none;" id="clearspdcfailed">Sorry, there seemed to be a problem clearing the cache.</span>
3230 </div>
3231 </div>
3232 </div>
3233 </p>
3234 <div class="hr"></div>
3235
3236 <p>
3237 <input name="<?php echo self::$opt_schemaorg; ?>" id="<?php echo self::$opt_schemaorg; ?>" <?php checked($all[self::$opt_schemaorg], 1); ?> type="checkbox" class="checkbox">
3238 <label for="<?php echo self::$opt_schemaorg; ?>">
3239 <b>(PRO)</b> <b class="chktitle">Video SEO Tags:</b> Update your YouTube embeds with Google, Bing, and Yahoo friendly schema markup for videos.
3240 </label>
3241 <span id="boxschemaorg">
3242 <span class="apikey-msg">
3243 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,
3244 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.
3245 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:
3246 <br>
3247 <span style="vertical-align: middle; display: inline-block;">
3248 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;">
3249 </span>
3250 </span>
3251 <span class="apikey-video">
3252 <iframe width="384" height="216" src="https://www.youtube.com/embed/px8LvNIVblg?rel=0" frameborder="0" allowfullscreen></iframe>
3253 </span>
3254 </span>
3255 </p>
3256 <div class="hr"></div>
3257 <p>
3258 <input name="<?php echo self::$opt_dynload; ?>" id="<?php echo self::$opt_dynload; ?>" <?php checked($all[self::$opt_dynload], 1); ?> type="checkbox" class="checkbox">
3259 <label for="<?php echo self::$opt_dynload; ?>">
3260 <b>(PRO)</b> <b class="chktitle">Special Lazy-Loading Effects:</b>
3261 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>
3262 </label>
3263 <br>
3264 <span id="boxdyn">
3265 Animation:
3266 <?php $cleandyn = trim($all[self::$opt_dyntype]); ?>
3267 <select name="<?php echo self::$opt_dyntype; ?>" id="<?php echo self::$opt_dyntype; ?>" >
3268 <option value="">Select type</option>
3269 <option value="rotateIn" <?php echo 'rotateIn' === $cleandyn ? 'selected' : '' ?> >rotate in</option>
3270 <option value="slideInRight" <?php echo 'slideInRight' === $cleandyn ? 'selected' : '' ?> >slide from right</option>
3271 <option value="slideInLeft" <?php echo 'slideInLeft' === $cleandyn ? 'selected' : '' ?> >slide from left</option>
3272 <option value="bounceIn" <?php echo 'bounceIn' === $cleandyn ? 'selected' : '' ?> >bounce in</option>
3273 <option value="flipInX" <?php echo 'flipInX' === $cleandyn ? 'selected' : '' ?> >flip up/down</option>
3274 <option value="flipInY" <?php echo 'flipInY' === $cleandyn ? 'selected' : '' ?> >flip left/right</option>
3275 <option value="pulse" <?php echo 'pulse' === $cleandyn ? 'selected' : '' ?> >pulse</option>
3276 <option value="tada" <?php echo 'tada' === $cleandyn ? 'selected' : '' ?> >jiggle</option>
3277 <option value="fadeInDown" <?php echo 'fadeInDown' === $cleandyn ? 'selected' : '' ?> >fade in downward</option>
3278 <option value="fadeInUp" <?php echo 'fadeInUp' === $cleandyn ? 'selected' : '' ?> >fade in upward</option>
3279 <option value="zoomInDown" <?php echo 'zoomInDown' === $cleandyn ? 'selected' : '' ?> >zoom in downward</option>
3280 <option value="zoomInUp" <?php echo 'zoomInUp' === $cleandyn ? 'selected' : '' ?> >zoom in upward</option>
3281 </select>
3282 </span>
3283 </p>
3284 <div class="hr"></div>
3285 <p>
3286 <input name="<?php echo self::$opt_ogvideo; ?>" id="<?php echo self::$opt_ogvideo; ?>" <?php checked($all[self::$opt_ogvideo], 1); ?> type="checkbox" class="checkbox">
3287 <label for="<?php echo self::$opt_ogvideo; ?>">
3288 <b>(PRO)</b> <b class="chktitle">Facebook Open Graph Markup:</b> 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>
3289 </label>
3290 </p>
3291 <div class="hr"></div>
3292 <p>
3293 <img class="ssfb" src="<?php echo plugins_url('images/youtube_thumbnail_sample.jpg', __FILE__) ?>" />
3294 <input name="<?php echo self::$opt_ftpostimg; ?>" id="<?php echo self::$opt_ftpostimg; ?>" <?php checked($all[self::$opt_ftpostimg], 1); ?> type="checkbox" class="checkbox">
3295 <label for="<?php echo self::$opt_ftpostimg; ?>">
3296 <b>(PRO)</b> <b class="chktitle">Automatic Video Thumbnails: </b>
3297 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!
3298 (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>
3299 </label>
3300 </p>
3301
3302 <?php
3303 }
3304 else
3305 {
3306 ?>
3307 <p class="smallnote orange">Below are PRO features for enhanced SEO and performance (works for even past embed links). </p>
3308 <p>
3309 <img class="ssaltgallery" src="<?php echo plugins_url('images/ssaltgalleryall.jpg', __FILE__) ?>" />
3310 <select disabled>
3311 <option value="">Gallery Style</option>
3312 </select>
3313 <label>
3314 <b class="chktitle">Alternate Gallery Styling: </b> <span class="pronon">(PRO Users)</span>
3315 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.
3316 <a target="_blank" href="<?php echo self::$epbase ?>/responsive-youtube-playlist-channel-gallery-for-wordpress.aspx">Read more here &raquo;</a>
3317 </label>
3318 </p>
3319
3320 <div class="hr"></div>
3321 <p>
3322 <img class="ssaltgallery" src="<?php echo plugins_url('images/ssverticallayout.png', __FILE__) ?>" />
3323 <input disabled type="checkbox" class="checkbox">
3324 <label>
3325 <b class="chktitle">Show Gallery Descriptions (for vertical list styling): </b> <span class="pronon">(PRO Users)</span>
3326 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.
3327 </label>
3328 </p>
3329 <div class="hr"></div>
3330 <p>
3331 <img class="ssaltgallery" src="<?php echo plugins_url('images/ssaltgallerycircles.jpg', __FILE__) ?>" />
3332 <select disabled>
3333 <option value="">Select Thumbnail Shape</option>
3334 </select>
3335 <label>
3336 <b class="chktitle">Gallery Thumbnail Shape: </b> <span class="pronon">(PRO Users)</span>
3337 Differentiate your gallery by showing different thumbnail shapes. We currently offer rectangle and circle shapes.
3338 <a target="_blank" href="<?php echo self::$epbase ?>/responsive-youtube-playlist-channel-gallery-for-wordpress.aspx">Read more here &raquo;</a>
3339 </label>
3340 </p>
3341
3342 <div class="hr"></div>
3343 <p>
3344 <img class="sspopupplayer" src="<?php echo plugins_url('images/sspopupplayer.jpg', __FILE__) ?>" />
3345 <label>
3346 <b class="chktitle">Gallery Video Display Mode: </b> <sup class="orange">NEW</sup> <span class="pronon">(PRO Users)</span>
3347 Display your gallery videos simply above the thumbnails (default), or as a popup lightbox.
3348 </label>
3349 <br>
3350 <input type="radio" disabled> Default &nbsp; <input type="radio" disabled> Popup lightbox
3351 </p>
3352
3353 <div class="hr"></div>
3354 <p>
3355 <input disabled type="checkbox" class="checkbox">
3356 <label>
3357 <b class="chktitle">Faster Page Loads (Caching): </b> <span class="pronon">(PRO Users)</span>
3358 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.
3359 </label>
3360 <div class="indent-option">
3361 <label>
3362 <b class="chktitle">Cache Lifetime (hours): </b>
3363 <input disabled value="24" type="number">
3364 Tip: If your pages rarely change, you may wish to set this to a much higher value than 24 hours.
3365 </label>
3366 </div>
3367 </p>
3368 <div class="hr"></div>
3369
3370
3371 <p>
3372 <input disabled type="checkbox" class="checkbox">
3373 <label>
3374 <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.
3375 </label>
3376 </p>
3377 <div class="hr"></div>
3378 <p>
3379 <input disabled type="checkbox" class="checkbox">
3380 <label>
3381 <b class="chktitle">Special Loading Effects:</b> <span class="pronon">(PRO Users)</span>
3382 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>
3383 </label>
3384 </p>
3385 <div class="hr"></div>
3386 <p>
3387 <input disabled type="checkbox" class="checkbox">
3388 <label>
3389 <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>
3390 </label>
3391 </p>
3392 <div class="hr"></div>
3393 <p>
3394 <img class="ssfb" src="<?php echo plugins_url('images/youtube_thumbnail_sample.jpg', __FILE__) ?>" />
3395 <input disabled type="checkbox" class="checkbox">
3396 <label>
3397 <b class="chktitle">Automatic Video Thumbnails:</b> <span class="pronon">(PRO Users)</span>
3398 Automatically grab the thumbnail image of the first video embedded in each post or page, and use it as the featured image.
3399 All you have to do is click Update on a post or page and the plugin does the rest!
3400 (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>
3401 </label>
3402 </p>
3403 <div class="hr"></div>
3404 <p>
3405 <a href="<?php echo self::$epbase ?>/dashboard/pro-easy-video-analytics.aspx" target="_blank">Activate the above and several other features &raquo;</a>
3406 </p>
3407 <?php
3408 }
3409 ?>
3410 <div class="clearboth"></div>
3411 </div>
3412 <?php // self::save_changes_button(); ?>
3413
3414 <hr>
3415
3416
3417 <div class="jumper" id="jumpoverride"></div>
3418
3419 <h3 class="sect">
3420 <?php _e("How To Override Defaults / Other Options") ?> <a href="#top" class="totop">&#9650; top</a>
3421 </h3>
3422 <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 '&'.
3423 <br><span class="smallnote orange">PRO users: You can use the big blue <a href="<?php echo self::$epbase . '/dashboard/pro-easy-video-analytics.aspx?ref=protab' ?>" target="_blank">customize</a> buttons that you will see inside the wizard, instead of memorizing the following.</span>
3424 <?php
3425 _e('<ul>');
3426 _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>");
3427 _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>");
3428 _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>");
3429 _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>");
3430 _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>");
3431 _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>");
3432 _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>");
3433 _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>");
3434 _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>");
3435 _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>");
3436 _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>");
3437 _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>");
3438 _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>");
3439 _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>");
3440 _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>");
3441 _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>");
3442 _e('</ul>');
3443
3444 _e("<p>You can also start and end each individual video at particular times. Like the above, each option should begin with '&'</p>");
3445 _e('<ul>');
3446 _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>");
3447 _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>");
3448 _e('</ul>');
3449 ?>
3450 <div class="save-changes-follow"> <?php self::save_changes_button(isset($_POST[$ytprefs_submitted]) && $_POST[$ytprefs_submitted] == 'Y'); ?> </div>
3451 </form>
3452 <div class="jumper" id="jumppro"></div>
3453 <div id="goprobox">
3454 <?php
3455 if ($all[self::$opt_pro] && strlen(trim($all[self::$opt_pro])) > 0)
3456 {
3457 echo "<h3>" . __('Thank you for going PRO.');
3458 echo ' &nbsp;<input type="submit" name="showkey" class="button-primary" style="vertical-align: 15%;" id="showprokey" value="View my PRO key" />';
3459 echo "</h3>";
3460 ?>
3461 <?php
3462 }
3463 else
3464 {
3465 ?>
3466
3467 <h3 class="sect">
3468 <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;
3469 PRO users help keep new features coming and our coffee cups filled. Go PRO and get these perks in return:
3470 </h3>
3471 <div class="procol">
3472 <ul class="gopro">
3473 <li>
3474 <img src="<?php echo plugins_url('images/iconcache.png', __FILE__) ?>">
3475 Faster Page Loads (Caching)
3476 </li>
3477 <li>
3478 <img src="<?php echo plugins_url('images/iconwizard.png', __FILE__) ?>">
3479 Full Visual Embedding Wizard (Easily customize embeds without memorizing codes)
3480 </li>
3481 <li>
3482 <img src="<?php echo plugins_url('images/icongallery.png', __FILE__) ?>">
3483 Alternate Gallery Styling (popup/lightbox player, slider and list layouts, and more)
3484 </li>
3485 <li>
3486 <img src="<?php echo plugins_url('images/iconfx.png', __FILE__) ?>">
3487 Add eye-catching special effects as your videos load
3488 </li>
3489 <li>
3490 <img src="<?php echo plugins_url('images/deletechecker.png', __FILE__) ?>">
3491 Deleted Video Checker (alerts you if YouTube deletes videos you embedded)
3492 </li>
3493 <li>
3494 <img src="<?php echo plugins_url('images/globe.png', __FILE__) ?>">
3495 Alerts when visitors from different countries are blocked from viewing your embeds
3496 </li>
3497 <li>
3498 <img src="<?php echo plugins_url('images/mobilecompat.png', __FILE__) ?>">
3499 Check if your embeds have restrictions that can block mobile viewing
3500 </li>
3501
3502 </ul>
3503 </div>
3504 <div class="procol" style="max-width: 465px;">
3505 <ul class="gopro">
3506 <li>
3507 <img src="<?php echo plugins_url('images/videothumbs.png', __FILE__) ?>">
3508 Automatic video thumbnail images (just click 'Update')
3509 </li>
3510 <li>
3511 <img src="<?php echo plugins_url('images/prioritysupport.png', __FILE__) ?>">
3512 Priority support (Puts your request in front)
3513 </li>
3514 <li>
3515 <img src="<?php echo plugins_url('images/bulletgraph45.png', __FILE__) ?>">
3516 User-friendly video analytics dashboard
3517 </li>
3518
3519 <li id="fbstuff">
3520 <img src="<?php echo plugins_url('images/iconfb.png', __FILE__) ?>">
3521 Automatic Open Graph tagging for Facebook
3522 </li>
3523 <!-- <li>
3524 <img src="<?php echo plugins_url('images/iconythealth.png', __FILE__) ?>">
3525 Instant YouTube embed diagnostic reports
3526 </li> -->
3527 <li>
3528 <img src="<?php echo plugins_url('images/vseo.png', __FILE__) ?>">
3529 Automatic tagging for video SEO (will even work for your old embeds)
3530 </li>
3531 <li>
3532 <img src="<?php echo plugins_url('images/iconvolume.png', __FILE__) ?>">
3533 Fine-Grained Volume Initialization – Individual video volume settings in the wizard
3534 </li>
3535
3536 <li>
3537 <img src="<?php echo plugins_url('images/infinity.png', __FILE__) ?>">
3538 Unlimited PRO upgrades and downloads
3539 </li>
3540 <!-- <li>
3541 <img src="<?php echo plugins_url('images/questionsale.png', __FILE__) ?>">
3542 What else? You tell us!
3543 </li> -->
3544 </ul>
3545 </div>
3546 <div style="clear: both;"></div>
3547 <br>
3548 <h3 class="bold">Enter and save your PRO key (emailed to you):</h3>
3549 <?php } ?>
3550 <form name="form2" method="post" action="" id="epform2" class="submitpro" <?php
3551 if ($all[self::$opt_pro] && strlen(trim($all[self::$opt_pro])) > 0)
3552 {
3553 echo 'style="display: none;"';
3554 }
3555 ?>>
3556
3557 <input name="<?php echo self::$opt_pro; ?>" id="opt_pro" value="<?php echo $all[self::$opt_pro]; ?>" type="text">
3558 <input type="submit" name="Submit" class="button-primary" id="prokeysubmit" value="<?php _e('Save Key') ?>" />
3559 <?php
3560 if (!($all[self::$opt_pro] && strlen(trim($all[self::$opt_pro])) > 0))
3561 {
3562 ?>
3563 &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>
3564 <?php
3565 }
3566 ?>
3567 <br>
3568 <span style="display: none;" id="prokeyloading" class="orange bold">Verifying...</span>
3569 <span class="orange bold" style="display: none;" id="prokeysuccess">Success! Please refresh this page.</span>
3570 <span class="orange bold" style="display: none;" id="prokeyfailed">Sorry, that seems to be an invalid key, or it has been used already. If you're behind a firewall, you may need to try activating on another network.</span>
3571 <span class="orange bold" style="display: none;" id="prokeycancel">Your request is being processed. Response code: CR1.</span>
3572
3573 </form>
3574
3575 </div>
3576 <div class="smallnote">
3577 <!--&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>
3578 writing/editing. It will apply some experimental artificial intelligence techniques on your post content for these recommendations, all at the click of a button.
3579 -->
3580 </div>
3581 <div class="jumper" id="jumpsupport"></div>
3582 <div id="nonprosupport">
3583 <h3 class="bold">Support tips for all users (Free and PRO)</h3>
3584 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:
3585 <ul class="reglist">
3586 <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>
3587 <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>
3588 <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>
3589 <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>
3590 <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>
3591 <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)
3592 </li>
3593 <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>
3594 <li>If your videos always appear full size, try turning off "Responsive video sizing."</li>
3595 <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>
3596 </ul>
3597 <p>
3598 Deactivating the No Cookies option has also been proven to solve player errors.
3599 </p>
3600 <p>
3601 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>
3602 </p>
3603 </div>
3604 <br>
3605 <h3 class="sect">
3606 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>
3607 </h3>
3608 <p>
3609 <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.
3610 </p>
3611
3612
3613 <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>
3614
3615 <?php
3616 if (!($all[self::$opt_pro] && strlen(trim($all[self::$opt_pro])) > 0))
3617 {
3618 ?>
3619 <br>
3620 <br>
3621 <iframe src="<?php echo self::$epbase ?>/dashboard/likecoupon.aspx" width="600" height="500"></iframe>
3622 <?php }
3623 ?>
3624 <div class="ytnav">
3625 <a href="#jumphowto">How To Embed</a>
3626 <a href="#jumpwiz">Visual Wizard</a>
3627 <a href="#jumpdefaults">Defaults</a>
3628 <a href="#jumpcompat">Compatibility</a>
3629 <a href="#jumpgallery">Galleries</a>
3630 <a href="#jumpprosettings">PRO Settings</a>
3631 <a href="#jumpoverride">Override Defaults</a>
3632 <a target="_blank" href="<?php echo self::$epbase . "/dashboard/pro-easy-video-analytics.aspx?ref=protab" ?>" style="border-color: #888888;">Upgrade?</a>
3633 <a href="#jumpsupport">Support</a>
3634 </div>
3635
3636
3637 <script type="text/javascript">
3638
3639 function savevalidate()
3640 {
3641 var valid = true;
3642 var alertmessage = '';
3643 if (jQuery("#<?php echo self::$opt_defaultdims; ?>").is(":checked"))
3644 {
3645 if (!(jQuery.isNumeric(jQuery.trim(jQuery("#<?php echo self::$opt_defaultwidth; ?>").val())) &&
3646 jQuery.isNumeric(jQuery.trim(jQuery("#<?php echo self::$opt_defaultheight; ?>").val()))))
3647 {
3648 alertmessage += "Please enter valid numbers for default height and width, or uncheck the option.";
3649 jQuery("#boxdefaultdims input").css("background-color", "#ffcccc").css("border", "2px solid #000000");
3650 valid = false;
3651 }
3652 }
3653
3654 if (jQuery("#<?php echo self::$opt_gallery_customarrows; ?>").is(":checked"))
3655 {
3656 if (!jQuery.trim(jQuery("#<?php echo self::$opt_gallery_customprev; ?>").val()) ||
3657 !jQuery.trim(jQuery("#<?php echo self::$opt_gallery_customnext; ?>").val()))
3658 {
3659 alertmessage += "Please enter valid text for both the custom gallery Prev and Next buttons, or uncheck the option.";
3660 jQuery("#boxcustomarrows input").css("background-color", "#ffcccc").css("border", "2px solid #000000");
3661 valid = false;
3662 }
3663 }
3664
3665
3666 if (jQuery("#<?php echo self::$opt_gallery_channelsub; ?>").is(":checked"))
3667 {
3668 if (!jQuery.trim(jQuery("#<?php echo self::$opt_gallery_channelsublink; ?>").val()) ||
3669 !jQuery.trim(jQuery("#<?php echo self::$opt_gallery_channelsubtext; ?>").val()))
3670 {
3671 alertmessage += "Please enter valid text for both the subscribe text and subscribe URL, or uncheck the option.";
3672 jQuery("#boxchannelsub input").css("background-color", "#ffcccc").css("border", "2px solid #000000");
3673 valid = false;
3674 }
3675 }
3676
3677 if (jQuery("#<?php echo self::$opt_defaultvol; ?>").is(":checked"))
3678 {
3679 if (!(jQuery.isNumeric(jQuery.trim(jQuery("#<?php echo self::$opt_vol; ?>").val()))))
3680 {
3681 alertmessage += "Please enter a number between 0 and 100 for the default volume, or uncheck the option.";
3682 jQuery("#boxdefaultvol input").css("background-color", "#ffcccc").css("border", "2px solid #000000");
3683 valid = false;
3684 }
3685 }
3686
3687 if (jQuery("#<?php echo self::$opt_spdc; ?>").is(":checked"))
3688 {
3689 if (!(jQuery.isNumeric(jQuery.trim(jQuery("#<?php echo self::$opt_spdcexp; ?>").val()))))
3690 {
3691 alertmessage += "Please enter a valid number of hours (greater than 0) for the cache lifetime, or uncheck the option.";
3692 jQuery("#boxspdc input[type=number], #boxspdc input[type=text]").css("background-color", "#ffcccc").css("border", "2px solid #000000");
3693 valid = false;
3694 }
3695 }
3696
3697
3698
3699 if (jQuery("#<?php echo self::$opt_schemaorg; ?>").is(":checked"))
3700 {
3701 if (!(jQuery.trim(jQuery("#<?php echo self::$opt_apikey; ?>").val()).length > 0))
3702 {
3703 alertmessage += "Please enter a valid YouTube API key, or uncheck the 'Video SEO Tags' option.";
3704 jQuery("#boxschemaorg input").css("background-color", "#ffcccc").css("border", "2px solid #000000");
3705 valid = false;
3706 }
3707 }
3708
3709
3710
3711 if (jQuery("#<?php echo self::$opt_dynload; ?>").is(":checked"))
3712 {
3713 if (!(/^[A-Za-z-]+$/.test(jQuery.trim(jQuery("#<?php echo self::$opt_dyntype; ?>").val()))))
3714 {
3715 alertmessage += "Please select an animation, or uncheck the option.";
3716 jQuery("#boxdyn select").css("background-color", "#ffcccc").css("border", "2px solid #000000");
3717 valid = false;
3718 }
3719 }
3720
3721
3722
3723
3724 // if (jQuery("#<?php echo self::$opt_dohl; ?>").is(":checked"))
3725 // {
3726 // if (!(/^[A-Za-z][A-Za-z]$/.test(jQuery.trim(jQuery("#<?php echo self::$opt_hl; ?>").val()))))
3727 // {
3728 // alertmessage += "Please enter a valid 2-letter language code.";
3729 // jQuery("#boxdohl input").css("background-color", "#ffcccc").css("border", "2px solid #000000");
3730 // valid = false;
3731 // }
3732 // }
3733
3734 if (!valid)
3735 {
3736 alert(alertmessage);
3737 }
3738 return valid;
3739 }
3740
3741 var prokeyval;
3742 var mydomain = escape("http://" + window.location.host.toString());
3743
3744 jQuery(document).ready(function ($) {
3745 jQuery('#<?php echo self::$opt_defaultdims; ?>').change(function ()
3746 {
3747 if (jQuery(this).is(":checked"))
3748 {
3749 jQuery("#boxdefaultdims").show(500);
3750 }
3751 else
3752 {
3753 jQuery("#boxdefaultdims").hide(500);
3754 }
3755
3756 });
3757
3758 jQuery('#<?php echo self::$opt_gallery_customarrows; ?>').change(function ()
3759 {
3760 if (jQuery(this).is(":checked"))
3761 {
3762 jQuery("#boxcustomarrows").show(500);
3763 }
3764 else
3765 {
3766 jQuery("#boxcustomarrows").hide(500);
3767 }
3768
3769 });
3770
3771 jQuery('#<?php echo self::$opt_gallery_channelsub; ?>').change(function ()
3772 {
3773 if (jQuery(this).is(":checked"))
3774 {
3775 jQuery("#boxchannelsub").show(500);
3776 }
3777 else
3778 {
3779 jQuery("#boxchannelsub").hide(500);
3780 }
3781
3782 });
3783
3784 jQuery('#<?php echo self::$opt_dynload; ?>').change(function ()
3785 {
3786 if (jQuery(this).is(":checked"))
3787 {
3788 jQuery("#boxdyn").show(500);
3789 }
3790 else
3791 {
3792 jQuery("#boxdyn").hide(500);
3793 }
3794
3795 });
3796
3797 jQuery('#<?php echo self::$opt_spdc; ?>').change(function ()
3798 {
3799 if (jQuery(this).is(":checked"))
3800 {
3801 jQuery("#boxspdc").show(500);
3802 }
3803 else
3804 {
3805 jQuery("#boxspdc").hide(500);
3806 }
3807 });
3808
3809
3810 jQuery('#<?php echo self::$opt_responsive; ?>').change(function ()
3811 {
3812 if (jQuery(this).is(":checked"))
3813 {
3814 jQuery("#boxresponsive_all").show(500);
3815 }
3816 else
3817 {
3818 jQuery("#boxresponsive_all").hide(500);
3819 }
3820 });
3821
3822
3823
3824 jQuery('#<?php echo self::$opt_migrate; ?>').change(function ()
3825 {
3826 if (jQuery(this).is(":checked"))
3827 {
3828 jQuery("#boxmigratelist").show(500);
3829 }
3830 else
3831 {
3832 jQuery("#boxmigratelist").hide(500);
3833 }
3834 });
3835
3836
3837
3838 jQuery('#<?php echo self::$opt_nocookie; ?>').change(function ()
3839 {
3840 if (jQuery(this).is(":checked"))
3841 {
3842 jQuery("#boxnocookie").show(500);
3843 }
3844 else
3845 {
3846 jQuery("#boxnocookie").hide(500);
3847 }
3848
3849 });
3850
3851 jQuery('#<?php echo self::$opt_schemaorg; ?>').change(function ()
3852 {
3853 if (jQuery(this).is(":checked"))
3854 {
3855 jQuery("#boxschemaorg").show(500);
3856 }
3857 else
3858 {
3859 jQuery("#boxschemaorg").hide(500);
3860 }
3861 });
3862
3863
3864 // jQuery('#<?php echo self::$opt_dohl; ?>').change(function()
3865 // {
3866 // if (jQuery(this).is(":checked"))
3867 // {
3868 // jQuery("#boxdohl").show(500);
3869 // }
3870 // else
3871 // {
3872 // jQuery("#boxdohl").hide(500);
3873 // }
3874 //
3875 // });
3876
3877
3878
3879 jQuery('#<?php echo self::$opt_defaultvol; ?>').change(function ()
3880 {
3881 if (jQuery(this).is(":checked"))
3882 {
3883 jQuery("#boxdefaultvol").show(500);
3884 }
3885 else
3886 {
3887 jQuery("#boxdefaultvol").hide(500);
3888 }
3889
3890 });
3891
3892 var rangedetect = document.createElement("input");
3893 rangedetect.setAttribute("type", "range");
3894 var canrange = rangedetect.type !== "text";
3895 //canrange = false;
3896 if (canrange)
3897 {
3898 $("input#vol").prop("type", "range").addClass("vol-range").on("input change", function () {
3899 $('.vol-output').text($(this).val() > 0 ? $(this).val() + '%' : 'Mute');
3900 });
3901 $('.vol-output').css("display", "inline-block").text($("input#vol").val() > 0 ? $("input#vol").val() + '%' : 'Mute');
3902 $('.vol-seeslider').show();
3903 $('.vol-seetextbox').hide();
3904 }
3905 else
3906 {
3907 $("input#vol").width(40);
3908 }
3909
3910
3911 jQuery('#boxspdc input.button').click(function () {
3912 jQuery('#clearspdcloading').show();
3913 jQuery('#clearspdcfailed').hide();
3914 jQuery('#clearspdcsuccess').hide();
3915
3916 $clearbutton = jQuery(this);
3917 $clearbutton.attr('disabled', 'disabled');
3918
3919 jQuery.ajax({
3920 type: "post",
3921 dataType: "json",
3922 timeout: 30000,
3923 url: wpajaxurl,
3924 data: {action: 'my_embedplus_clearspdc'},
3925 success: function (response) {
3926 if (response.type == "success") {
3927 jQuery("#clearspdcsuccess").show();
3928 }
3929 else {
3930 jQuery("#clearspdcfailed").show();
3931 }
3932 },
3933 error: function (xhr, ajaxOptions, thrownError) {
3934 jQuery("#clearspdcfailed").show();
3935 },
3936 complete: function () {
3937 jQuery('#clearspdcloading').hide();
3938 $clearbutton.removeAttr('disabled');
3939 }
3940
3941 });
3942
3943 });
3944
3945
3946
3947
3948 jQuery("#showcase-validate").click(function () {
3949 window.open("<?php echo self::$epbase . "/showcase-validate.aspx?prokey=" . self::$alloptions[self::$opt_pro] ?>" + "&domain=" + mydomain);
3950 });
3951
3952 jQuery('#showprokey').click(function () {
3953 jQuery('.submitpro').show(500);
3954 return false;
3955 });
3956
3957 jQuery('#prokeysubmit').click(function () {
3958 jQuery(this).attr('disabled', 'disabled');
3959 jQuery('#prokeyfailed').hide();
3960 jQuery('#prokeysuccess').hide();
3961 jQuery('#prokeyloading').show();
3962 prokeyval = jQuery('#opt_pro').val();
3963
3964 var tempscript = document.createElement("script");
3965 tempscript.src = "<?php echo self::$epbase ?>/dashboard/wordpress-pro-validatejp.aspx?simple=1&prokey=" + prokeyval + "&domain=" + mydomain;
3966 var n = document.getElementsByTagName("head")[0].appendChild(tempscript);
3967 setTimeout(function () {
3968 n.parentNode.removeChild(n);
3969 }, 500);
3970 return false;
3971 });
3972
3973 window.embedplus_record_prokey = function (good) {
3974
3975 jQuery.ajax({
3976 type: "post",
3977 dataType: "json",
3978 timeout: 30000,
3979 url: wpajaxurl,
3980 data: {action: 'my_embedplus_pro_record', <?php echo self::$opt_pro; ?>: (good ? prokeyval : "")},
3981 success: function (response) {
3982 if (response.type == "success") {
3983 jQuery("#prokeysuccess").show();
3984 }
3985 else {
3986 jQuery("#prokeyfailed").show();
3987 }
3988 },
3989 error: function (xhr, ajaxOptions, thrownError) {
3990 jQuery('#prokeyfailed').show();
3991 },
3992 complete: function () {
3993 jQuery('#prokeyloading').hide();
3994 jQuery('#prokeysubmit').removeAttr('disabled');
3995 }
3996
3997 });
3998
3999 };
4000
4001
4002 window.embedplus_cancel_prokey = function () {
4003
4004 jQuery.ajax({
4005 type: "post",
4006 dataType: "json",
4007 timeout: 30000,
4008 url: wpajaxurl,
4009 data: {action: 'my_embedplus_pro_record', <?php echo self::$opt_pro; ?>: ""},
4010 success: function (response) {
4011 jQuery("#prokeycancel").show();
4012 },
4013 error: function (xhr, ajaxOptions, thrownError) {
4014 jQuery('#prokeyfailed').show();
4015 },
4016 complete: function () {
4017 jQuery('#prokeyloading').hide();
4018 jQuery('#prokeysubmit').removeAttr('disabled');
4019 }
4020
4021 });
4022
4023 };
4024
4025 });
4026 </script>
4027 <?php
4028 if (function_exists('add_thickbox'))
4029 {
4030 add_thickbox();
4031 }
4032 ?>
4033
4034 <?php
4035 }
4036
4037 public static function save_changes_button($submitted)
4038 {
4039 $button_label = 'Save Changes';
4040 if ($submitted)
4041 {
4042 $button_label = 'Changes Saved';
4043 ?>
4044 <script type="text/javascript">
4045 jQuery(document).ready(function () {
4046 setTimeout(function () {
4047 jQuery('input.ytprefs-submit').val('Save Changes');
4048 }, 3000);
4049 });
4050
4051 </script>
4052 <?php
4053 }
4054 ?>
4055 <p class="submit">
4056 <input type="submit" onclick="return savevalidate();" name="Submit" class="button-primary ytprefs-submit" value="<?php _e($button_label) ?>" />
4057 <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>
4058 </p>
4059 <?php
4060 }
4061
4062 public static function ytprefsscript()
4063 {
4064 $loggedin = current_user_can('edit_posts');
4065 if (!($loggedin && self::$alloptions[self::$opt_admin_off_scripts]))
4066 {
4067 wp_enqueue_style(
4068 '__EPYT__style', plugins_url('styles/ytprefs' . self::$min . '.css', __FILE__)
4069 );
4070 $cols = floatval(self::$alloptions[self::$opt_gallery_columns]);
4071 $cols = $cols == 0 ? 3.0 : $cols;
4072 $colwidth = 100.0 / $cols;
4073 $custom_css = "
4074 .epyt-gallery-thumb {
4075 width: " . round($colwidth, 3) . "%;
4076 }";
4077 wp_add_inline_style('__EPYT__style', $custom_css);
4078
4079 wp_enqueue_script('__ytprefs__', plugins_url('scripts/ytprefs' . self::$min . '.js', __FILE__), array('jquery'));
4080
4081 if (self::$alloptions[self::$opt_old_script_method] != 1)
4082 {
4083 wp_localize_script('__ytprefs__', '_EPYT_', array(
4084 'ajaxurl' => admin_url('admin-ajax.php'),
4085 'security' => wp_create_nonce('embedplus-nonce'),
4086 'gallery_scrolloffset' => intval(self::$alloptions[self::$opt_gallery_scrolloffset]),
4087 'eppathtoscripts' => plugins_url('scripts/', __FILE__),
4088 'epresponsiveselector' => self::get_responsiveselector(),
4089 'epdovol' => true,
4090 'version' => self::$alloptions[self::$opt_version],
4091 'evselector' => self::get_evselector()
4092 ));
4093 }
4094
4095 ////////////////////// cloudflare accomodation
4096 //add_filter('script_loader_tag', 'YouTubePrefs::set_cfasync', 10, 3);
4097
4098 if (!is_admin() && (self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0) && self::$alloptions[self::$opt_dynload] == 1)
4099 {
4100 wp_enqueue_style('__dyntype__', plugins_url('scripts/embdyn.min.css', __FILE__));
4101 wp_enqueue_script('__dynload__', plugins_url('scripts/embdyn' . self::$min . '.js', __FILE__), array('jquery'));
4102 }
4103
4104 if (!is_admin() && (self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 8))
4105 {
4106 wp_enqueue_style('__disptype__', plugins_url('scripts/lity' . self::$min . '.css', __FILE__));
4107 wp_enqueue_script('__dispload__', plugins_url('scripts/lity' . self::$min . '.js', __FILE__), array('jquery', '__ytprefs__'));
4108 }
4109 }
4110 }
4111
4112 public static function set_cfasync($tag, $handle, $src)
4113 {
4114 if ('__ytprefs__' !== $handle)
4115 {
4116 return $tag;
4117 }
4118 return str_replace('<script', '<script data-cfasync="false" ', $tag);
4119 }
4120
4121 public static function get_evselector()
4122 {
4123 $evselector = 'iframe.__youtube_prefs__[src], iframe[src*="youtube.com/embed/"], iframe[src*="youtube-nocookie.com/embed/"]';
4124
4125 if (self::$alloptions[self::$opt_evselector_light] == 1)
4126 {
4127 $evselector = 'iframe.__youtube_prefs__[src]';
4128 }
4129
4130 return $evselector;
4131 }
4132
4133 public static function get_responsiveselector()
4134 {
4135 $responsiveselector = '[]';
4136 if (self::$alloptions[self::$opt_widgetfit] == 1)
4137 {
4138 $responsiveselector = '["iframe.__youtube_prefs_widget__"]';
4139 }
4140 if (self::$alloptions[self::$opt_responsive] == 1)
4141 {
4142 if (self::$alloptions[self::$opt_responsive_all] == 1)
4143 {
4144 $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\']"]';
4145 }
4146 else
4147 {
4148 $responsiveselector = '["iframe.__youtube_prefs__"]';
4149 }
4150 }
4151 return $responsiveselector;
4152 }
4153
4154 public static function get_blogwidth()
4155 {
4156 $blogwidth = null;
4157 try
4158 {
4159 $embed_size_w = intval(get_option('embed_size_w'));
4160
4161 global $content_width;
4162 if (empty($content_width))
4163 {
4164 $content_width = $GLOBALS['content_width'];
4165 }
4166
4167 $blogwidth = $embed_size_w ? $embed_size_w : ($content_width ? $content_width : 450);
4168 }
4169 catch (Exception $ex)
4170 {
4171
4172 }
4173
4174 $blogwidth = preg_replace('/\D/', '', $blogwidth); //may have px
4175
4176 return $blogwidth;
4177 }
4178
4179 }
4180
4181 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
4182 //class start
4183 class Add_new_tinymce_btn_Youtubeprefs
4184 {
4185
4186 public $btn_arr;
4187 public $js_file;
4188
4189 /*
4190 * call the constructor and set class variables
4191 * From the constructor call the functions via wordpress action/filter
4192 */
4193
4194 function __construct($seperator, $btn_name, $javascrip_location)
4195 {
4196 $this->btn_arr = array("Seperator" => $seperator, "Name" => $btn_name);
4197 $this->js_file = $javascrip_location;
4198 add_action('init', array($this, 'add_tinymce_button'));
4199 add_filter('tiny_mce_version', array($this, 'refresh_mce_version'));
4200 }
4201
4202 /*
4203 * create the buttons only if the user has editing privs.
4204 * If so we create the button and add it to the tinymce button array
4205 */
4206
4207 function add_tinymce_button()
4208 {
4209 if (!current_user_can('edit_posts') && !current_user_can('edit_pages'))
4210 return;
4211 if (get_user_option('rich_editing') == 'true')
4212 {
4213 //the function that adds the javascript
4214 add_filter('mce_external_plugins', array($this, 'add_new_tinymce_plugin'));
4215 //adds the button to the tinymce button array
4216 add_filter('mce_buttons', array($this, 'register_new_button'));
4217 }
4218 }
4219
4220 /*
4221 * add the new button to the tinymce array
4222 */
4223
4224 function register_new_button($buttons)
4225 {
4226 array_push($buttons, $this->btn_arr["Seperator"], $this->btn_arr["Name"]);
4227 return $buttons;
4228 }
4229
4230 /*
4231 * Call the javascript file that loads the
4232 * instructions for the new button
4233 */
4234
4235 function add_new_tinymce_plugin($plugin_array)
4236 {
4237 $plugin_array[$this->btn_arr['Name']] = $this->js_file;
4238 return $plugin_array;
4239 }
4240
4241 /*
4242 * This function tricks tinymce in thinking
4243 * it needs to refresh the buttons
4244 */
4245
4246 function refresh_mce_version($ver)
4247 {
4248 $ver += 3;
4249 return $ver;
4250 }
4251
4252 }
4253
4254 //class end
4255
4256
4257 register_activation_hook(__FILE__, array('YouTubePrefs', 'initoptions'));
4258 $youtubeplgplus = new YouTubePrefs();
4259
4260
4261 add_action("wp_ajax_my_embedplus_pro_record", array('YouTubePrefs', 'my_embedplus_pro_record'));
4262 add_action("wp_ajax_my_embedplus_clearspdc", array('YouTubePrefs', 'my_embedplus_clearspdc'));
4263 add_action("wp_ajax_my_embedplus_glance_vids", array('YouTubePrefs', 'my_embedplus_glance_vids'));
4264 add_action("wp_ajax_my_embedplus_glance_count", array('YouTubePrefs', 'my_embedplus_glance_count'));
4265 add_action("wp_ajax_my_embedplus_dismiss_double_plugin_warning", array('YouTubePrefs', 'my_embedplus_dismiss_double_plugin_warning'));
4266 add_action("wp_ajax_my_embedplus_gallery_page", array('YouTubePrefs', 'my_embedplus_gallery_page'));
4267 add_action("wp_ajax_nopriv_my_embedplus_gallery_page", array('YouTubePrefs', 'my_embedplus_gallery_page'));
4268
4269 add_action('admin_enqueue_scripts', 'youtubeprefs_admin_enqueue_scripts');
4270
4271 function youtubeprefs_admin_enqueue_scripts()
4272 {
4273 wp_enqueue_style('embedplusyoutube', plugins_url() . '/youtube-embed-plus/scripts/embedplus_mce.css');
4274 add_action('wp_print_scripts', 'youtubeprefs_output_scriptvars');
4275 wp_enqueue_script('__ytprefs_admin__', plugins_url('scripts/ytprefs-admin.min.js', __FILE__), array('jquery'));
4276
4277 if (
4278 //(!(isset(YouTubePrefs::$alloptions[YouTubePrefs::$opt_pro]) && strlen(trim(YouTubePrefs::$alloptions[YouTubePrefs::$opt_pro])) > 0)) && // display only if not pro ooopointer
4279 (get_bloginfo('version') >= '3.3') && YouTubePrefs::custom_admin_pointers_check()
4280 )
4281 {
4282 add_action('admin_print_footer_scripts', 'YouTubePrefs::custom_admin_pointers_footer');
4283
4284 wp_enqueue_script('wp-pointer');
4285 wp_enqueue_style('wp-pointer');
4286 }
4287
4288 if (YouTubePrefs::$alloptions['glance'] == 1)
4289 {
4290 add_action('admin_print_footer_scripts', 'YouTubePrefs::glance_script');
4291 }
4292 }
4293
4294 function youtubeprefs_output_scriptvars()
4295 {
4296 YouTubePrefs::$scriptsprinted++;
4297 if (YouTubePrefs::$scriptsprinted == 1)
4298 {
4299 $blogwidth = YouTubePrefs::get_blogwidth();
4300 $epprokey = YouTubePrefs::$alloptions[YouTubePrefs::$opt_pro];
4301 $myytdefaults = http_build_query(YouTubePrefs::$alloptions);
4302 ?>
4303 <script type="text/javascript">
4304 var wpajaxurl = "<?php echo admin_url('admin-ajax.php') ?>";
4305 if (window.location.toString().indexOf('https://') == 0)
4306 {
4307 wpajaxurl = wpajaxurl.replace("http://", "https://");
4308 }
4309
4310 var epblogwidth = <?php echo $blogwidth; ?>;
4311 var epprokey = '<?php echo $epprokey; ?>';
4312 var epbasesite = '<?php echo YouTubePrefs::$epbase; ?>';
4313 var epversion = '<?php echo YouTubePrefs::$version; ?>';
4314 var myytdefaults = '<?php echo $myytdefaults; ?>';
4315 var eppluginadminurl = '<?php echo admin_url('admin.php?page=youtube-my-preferences'); ?>';
4316
4317 // Create IE + others compatible event handler
4318 var epeventMethod = window.addEventListener ? "addEventListener" : "attachEvent";
4319 var epeventer = window[epeventMethod];
4320 var epmessageEvent = epeventMethod == "attachEvent" ? "onmessage" : "message";
4321
4322 // Listen to message from child window
4323 epeventer(epmessageEvent, function (e)
4324 {
4325 var embedcode = "";
4326 try
4327 {
4328 if (e.data.indexOf("youtubeembedplus") == 0)
4329 {
4330
4331 embedcode = e.data.split("|")[1];
4332 if (embedcode.indexOf("[") !== 0)
4333 {
4334 embedcode = "<p>" + embedcode + "</p>";
4335 }
4336
4337 if (window.tinyMCE !== null && window.tinyMCE.activeEditor !== null && !window.tinyMCE.activeEditor.isHidden())
4338 {
4339 if (typeof window.tinyMCE.execInstanceCommand !== 'undefined')
4340 {
4341 window.tinyMCE.execInstanceCommand(
4342 window.tinyMCE.activeEditor.id,
4343 'mceInsertContent',
4344 false,
4345 embedcode);
4346 }
4347 else
4348 {
4349 send_to_editor(embedcode);
4350 }
4351 }
4352 else
4353 {
4354 embedcode = embedcode.replace('<p>', '\n').replace('</p>', '\n');
4355 if (typeof QTags.insertContent === 'function')
4356 {
4357 QTags.insertContent(embedcode);
4358 }
4359 else
4360 {
4361 send_to_editor(embedcode);
4362 }
4363 }
4364 tb_remove();
4365
4366 }
4367 }
4368 catch (err)
4369 {
4370 if (typeof console !== 'undefined')
4371 console.log(err.message);
4372 }
4373
4374
4375 }, false);
4376
4377
4378
4379 </script>
4380 <?php
4381 }
4382 }
4383
4384 // function embedplus_strip_shortcode_from_excerpt($content)
4385 // {
4386 // $content = strip_shortcodes($content);
4387 // return 'STRIPPED' . $content;
4388 // }
4389 //
4390 // add_filter('the_excerpt', 'embedplus_strip_shortcode_from_excerpt', 5);
4391 // add_filter('get_the_excerpt', 'embedplus_strip_shortcode_from_excerpt', 5);
4392