PluginProbe
Embed Plus for YouTube Gallery, Livestream and Lazy Loading with Facades / 11.4
Embed Plus for YouTube Gallery, Livestream and Lazy Loading with Facades v11.4
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.4, at youtube.php

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