YouTube - Version 8.2

Version Description

Download this release

Release Info

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

Code changes from version 8.1 to 8.2

Files changed (4) hide show
  1. images/globe.png +0 -0
  2. images/iconcoupon.png +0 -0
  3. readme.txt +23 -15
  4. youtube.php +286 -287
images/globe.png ADDED
Binary file
images/iconcoupon.png ADDED
Binary file
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: embedplus
3
  Plugin Name: YouTube Embed
4
  Tags: at a glance, channel, annotations, music, music video, songs, song, lyrics, responsive, short code, shortcode, youtube shortcode, health, diagnostic, youtube status, seo, video seo, rich snippets, reddit, google+, google plus, comments, search, widget, sidebar, responsive, fluid, iphone, mobile, android, tablet, ipad, youtube playlist, playlists, playlist, wmode, hd, autohd, auto hd, video analytics, analytics, google, google analytics, view count, vlog, vlogging, web videos, youtube analytics, youtube, youtube plugin, youtube shortcode, embed youtube, plugin, video, video shortcode, embed videos, youtube player, shortcode, simple, simple youtube, smart youtube playback, youtube embed, wordpress youtube embed, embedding youtube, youtube embedding, video plugin, https, ssl, secure, no-cookie, cookie, html5, youtube html5
5
  Requires at least: 2.9
6
- Tested up to: 3.8.1
7
- Stable tag: 8.1
8
  License: GPLv3 or later
9
 
10
  YouTube embed plugin with basic features and convenient defaults. Upgrade now to add tracking, instant video SEO tags, and much more!
@@ -13,31 +13,34 @@ YouTube embed plugin with basic features and convenient defaults. Upgrade now to
13
 
14
  **400,000+ downloads! Here are some recently added features:**
15
 
16
- * "At a Glance" direct access to YouTube posts/pages
17
- * Built-in YouTube video search, viewing, and insertion right from your editor.
18
- * One-click Video SEO tags.
19
- * Music video embedding extras.
20
- * Analytics and deleted video alerts work with past YouTube videos that you embedded with many other YouTube plugins.
21
- * Review the latest web discussions about videos you want to embed before embedding.
22
- * Shortcode support for embedding multiple videos on one line.
 
 
 
23
  * And more...
24
 
25
- This YouTube embed plugin for WordPress keeps things simple, but it can be upgraded for enhanced SEO, performance, privacy and security for you and your visitors. It provides the basic features of the YouTube embedded player and will have you posting videos in seconds after installing it. **All you have to do is simply paste an unformatted YouTube link on its own line (shortcodes are also supported).** Your YouTube embed will then show up when you preview or publish the post. The settings page has plenty of default options that you can automatically apply to all your embedded YouTube videos:
26
 
27
  * Force HD quality when available
28
  * Make your videos responsive so that they dynamically fit in all screen sizes (smart phone, PC and tablet)
29
  * Modest branding - hide YouTube logo while playing
 
30
  * Automatically center all your videos
31
  * Automatically start playing your videos
32
- * Turn on/off closed captions by default
33
- * Show/hide annotations by default
34
  * Loop your videos
35
  * Show/hide related videos at the end
36
  * Show/hide the video title and other info
37
  * Use the light theme
38
  * Show/hide player controls
 
39
  * Use "opaque" wmode
40
- * Autohide controls until hovering
41
 
42
  Customizations can be also made to each YouTube embed by adding more to the link as shown below. Adding these will override the above global defaults that you set:
43
 
@@ -59,6 +62,8 @@ You can also start and end each individual video at particular times. Like the a
59
  * start - Sets the time (in seconds) to start the video. Example: `http://www.youtube.com/watch?v=quwebVjAEJA&width=500&height=350&start=20`
60
  * end - Sets the time (in seconds) to stop the video. Example: `http://www.youtube.com/watch?v=quwebVjAEJA&width=500&height=350&end=100`
61
 
 
 
62
  Beyond the above features, you have the option of upgrading to PRO to add enhanced features like the full visual embedding wizard (so you can avoid memorizing codes), priority support, and security/performance. As a PRO user, you also get access to our deleted video alerts to help avoid showing embedded videos that are later removed from YouTube.com. You even get an embedder-centric analytics dashboard that adds view tracking to each of your embeds so that you can answers questions like:
63
 
64
  * How much are your visitors actually watching the videos you post?
@@ -66,7 +71,7 @@ Beyond the above features, you have the option of upgrading to PRO to add enhanc
66
  * What and when are your best and worst performing YouTube embeds?
67
  * How much do the producers of the YouTube videos you embed rely on **your site**, versus other sites and YouTube.com, for views?
68
 
69
- Recently, we also added One-Click Video SEO, which adds markup that can improve your click rates and video SERP rankings.
70
 
71
  See more details after installing. Enjoy!
72
 
@@ -117,6 +122,9 @@ You can also start and end each individual video at particular times. Like the a
117
 
118
  == Changelog ==
119
 
 
 
 
120
  = YouTube Embed 8.1 =
121
  Fixes rare YouTube ID issue.
122
 
@@ -251,4 +259,4 @@ First release uploaded to the plugin repository.
251
 
252
  == Other Notes ==
253
 
254
- This YouTube plugin includes premium features like [one-click video SEO tags, YouTube embed analytics, and deleted video checking](https://www.embedplus.com/dashboard/pro-easy-video-analytics.aspx).
3
  Plugin Name: YouTube Embed
4
  Tags: at a glance, channel, annotations, music, music video, songs, song, lyrics, responsive, short code, shortcode, youtube shortcode, health, diagnostic, youtube status, seo, video seo, rich snippets, reddit, google+, google plus, comments, search, widget, sidebar, responsive, fluid, iphone, mobile, android, tablet, ipad, youtube playlist, playlists, playlist, wmode, hd, autohd, auto hd, video analytics, analytics, google, google analytics, view count, vlog, vlogging, web videos, youtube analytics, youtube, youtube plugin, youtube shortcode, embed youtube, plugin, video, video shortcode, embed videos, youtube player, shortcode, simple, simple youtube, smart youtube playback, youtube embed, wordpress youtube embed, embedding youtube, youtube embedding, video plugin, https, ssl, secure, no-cookie, cookie, html5, youtube html5
5
  Requires at least: 2.9
6
+ Tested up to: 3.8.3
7
+ Stable tag: 8.2
8
  License: GPLv3 or later
9
 
10
  YouTube embed plugin with basic features and convenient defaults. Upgrade now to add tracking, instant video SEO tags, and much more!
13
 
14
  **400,000+ downloads! Here are some recently added features:**
15
 
16
+ * "At a Glance" direct access to your YouTube posts/pages
17
+ * Visual YouTube video searching and viewing
18
+ * Easy "Insert" button for both the Visual and Text mode of the editor
19
+ * Review the latest web discussions about videos you want to embed before embedding
20
+ * Shortcode support for embedding multiple videos on one line
21
+ * Playlist support
22
+ * (PRO) One-click Video SEO tags
23
+ * (PRO) Analytics and deleted video alerts work with past YouTube videos that you embedded with many other YouTube plugins
24
+ * (PRO) Alerts when visitors from different countries are blocked from viewing your embeds
25
+ * (PRO) Music video embedding extras
26
  * And more...
27
 
28
+ This YouTube embed plugin for WordPress keeps things easy and simple, but it can also be upgraded to PRO for enhanced SEO, performance, privacy and security for you and your visitors. It provides the basic features of the YouTube embedded player and will have you posting videos in seconds after installing it. **All you have to do is simply paste an unformatted YouTube link on its own line (shortcodes are also supported).** Your YouTube embed will then show up when you preview or publish the post. The settings page has plenty of default options that you can automatically apply to all your embedded YouTube videos. **Check out the free options below:**
29
 
30
  * Force HD quality when available
31
  * Make your videos responsive so that they dynamically fit in all screen sizes (smart phone, PC and tablet)
32
  * Modest branding - hide YouTube logo while playing
33
+ * Turn on/off all annotations by default
34
  * Automatically center all your videos
35
  * Automatically start playing your videos
36
+ * Autohide controls until hovering
 
37
  * Loop your videos
38
  * Show/hide related videos at the end
39
  * Show/hide the video title and other info
40
  * Use the light theme
41
  * Show/hide player controls
42
+ * Turn on/off closed captions by default
43
  * Use "opaque" wmode
 
44
 
45
  Customizations can be also made to each YouTube embed by adding more to the link as shown below. Adding these will override the above global defaults that you set:
46
 
62
  * start - Sets the time (in seconds) to start the video. Example: `http://www.youtube.com/watch?v=quwebVjAEJA&width=500&height=350&start=20`
63
  * end - Sets the time (in seconds) to stop the video. Example: `http://www.youtube.com/watch?v=quwebVjAEJA&width=500&height=350&end=100`
64
 
65
+ **About the PRO version:**
66
+
67
  Beyond the above features, you have the option of upgrading to PRO to add enhanced features like the full visual embedding wizard (so you can avoid memorizing codes), priority support, and security/performance. As a PRO user, you also get access to our deleted video alerts to help avoid showing embedded videos that are later removed from YouTube.com. You even get an embedder-centric analytics dashboard that adds view tracking to each of your embeds so that you can answers questions like:
68
 
69
  * How much are your visitors actually watching the videos you post?
71
  * What and when are your best and worst performing YouTube embeds?
72
  * How much do the producers of the YouTube videos you embed rely on **your site**, versus other sites and YouTube.com, for views?
73
 
74
+ Recently, we also added One-Click Video SEO tags, which adds markup that can improve your click rates and video SERP rankings.
75
 
76
  See more details after installing. Enjoy!
77
 
122
 
123
  == Changelog ==
124
 
125
+ = YouTube Embed 8.2 =
126
+ An at a glance regex impromevent (all users). Dashboard now warns you of embeds that are blocked from your visitors in other countries (PRO).
127
+
128
  = YouTube Embed 8.1 =
129
  Fixes rare YouTube ID issue.
130
 
259
 
260
  == Other Notes ==
261
 
262
+ This YouTube plugin can include premium features like [one-click video SEO tags, YouTube embed analytics, and deleted video checking when you upgrade to PRO](https://www.embedplus.com/dashboard/pro-easy-video-analytics.aspx).
youtube.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: YouTube
4
  Plugin URI: http://www.embedplus.com/dashboard/pro-easy-video-analytics.aspx
5
  Description: YouTube embed plugin with basic features and convenient defaults. Upgrade now to add tracking, instant video SEO tags, and much more!
6
- Version: 8.1
7
  Author: EmbedPlus Team
8
  Author URI: http://www.embedplus.com
9
  */
@@ -32,7 +32,7 @@
32
  class YouTubePrefs
33
  {
34
 
35
- public static $version = '8.1';
36
  public static $opt_version = 'version';
37
  public static $optembedwidth = null;
38
  public static $optembedheight = null;
@@ -71,6 +71,10 @@ class YouTubePrefs
71
  public static $epbase = '//www.embedplus.com';
72
  public static $double_plugin = false;
73
  public static $scriptsprinted = 0;
 
 
 
 
74
  /*
75
  listType
76
  */
@@ -82,7 +86,7 @@ class YouTubePrefs
82
  //public static $ytregex = '@^[\r\n]{0,1}[[:blank:]]*https?://(?:www\.)?(?:(?:youtube.com/watch\?)|(?:youtu.be/))([^\s"]+)[[:blank:]]*[\r\n]{0,1}$@im';
83
  public static $oldytregex = '@^\s*https?://(?:www\.)?(?:(?:youtube.com/(?:(?:watch)|(?:embed))/{0,1}\?)|(?:youtu.be/))([^\s"]+)\s*$@im';
84
  public static $ytregex = '@^[\r\t ]*https?://(?:www\.)?(?:(?:youtube.com/(?:(?:watch)|(?:embed))/{0,1}\?)|(?:youtu.be/))([^\s"]+)[\r\t ]*$@im';
85
- public static $justurlregex = '@https?://(?:www\.)?(?:(?:youtube.com/(?:(?:watch)|(?:embed))/{0,1}\?)|(?:youtu.be/))([^\s"]+)@';
86
 
87
  ///////////////////////////////////////////////////////////////////////////////////////////////////
88
  ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -286,16 +290,9 @@ class YouTubePrefs
286
  echo '<h2><img src="' . plugins_url('images/youtubeicon16.png', __FILE__) . '" /> 10 Latest Posts/Pages with YouTube Videos (' . $total . ' Total)</h2>';
287
  ?>
288
 
289
- 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.
290
 
291
  <?php
292
- if (!(self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0))
293
- {
294
- ?>
295
- <i>New:</i> <a target="_blank" href="https://www.embedplus.com/dashboard/pro-easy-video-analytics.aspx?coupon=400K-4OFF">Coupon code <span class="bold">400K-4OFF</span> is now active to help non-PRO users &raquo;</a>
296
- <?php
297
- }
298
-
299
  if ($total > 0)
300
  {
301
  echo '<ul class="accord">';
@@ -317,163 +314,177 @@ class YouTubePrefs
317
  wp_reset_postdata();
318
  ?>
319
  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>.
 
 
 
 
 
 
 
 
 
 
 
 
320
  </div>
321
- <?php
322
- }
323
 
324
- public static function my_embedplus_glance_vids()
325
- {
326
- $result = array();
327
- if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
328
  {
329
- $postid = intval($_REQUEST['postid']);
330
- $currpost = get_post($postid);
 
 
 
331
 
332
- $thehtml = '<img class="accclose" onclick="accclose(this)" src="' . plugins_url('images/accclose.png', __FILE__) . '" />';
333
 
334
- $matches = Array();
335
- $ismatch = preg_match_all(self::$justurlregex, $currpost->post_content, $matches);
336
 
337
- if ($ismatch)
338
- {
339
- foreach ($matches[0] as $match)
340
  {
341
- $link = trim(preg_replace('/&amp;/i', '&', $match));
342
- $link = preg_replace('/\s/', '', $link);
343
- $linkparamstemp = explode('?', $link);
344
-
345
- $linkparams = array();
346
- if (count($linkparamstemp) > 1)
347
- {
348
- $linkparams = self::keyvalue($linkparamstemp[1], true);
349
- }
350
- if (strpos($linkparamstemp[0], 'youtu.be') !== false && !isset($linkparams['v']))
351
  {
352
- $vtemp = explode('/', $linkparamstemp[0]);
353
- $linkparams['v'] = array_pop($vtemp);
354
- }
355
 
356
- $vidid = $linkparams['v'];
357
 
358
- try
359
- {
360
- $ytapilink = 'http://gdata.youtube.com/feeds/api/videos/' . $vidid . '?v=2&alt=json&fields=id,published,title,content,media:group(media:description,yt:duration)';
361
- $apidata = wp_remote_get($ytapilink);
362
- if (!is_wp_error($apidata))
363
  {
364
- $raw = wp_remote_retrieve_body($apidata);
365
- if (!empty($raw))
 
 
 
 
 
 
 
 
 
 
 
 
 
366
  {
367
- $postlink = get_permalink($postid);
368
- $json = json_decode($raw, true);
369
- if (is_array($json))
370
- {
371
- $_name = esc_attr(sanitize_text_field($json['entry']['title']['$t']));
372
- $_description = esc_attr(sanitize_text_field($json['entry']['media$group']['media$description']['$t']));
373
- $_thumbnailUrl = esc_url("//i.ytimg.com/vi/" . $vidid . "/0.jpg");
374
- $_duration = self::formatDuration(self::secondsToDuration(intval($json['entry']['media$group']['yt$duration']['seconds'])));
375
- $_uploadDate = sanitize_text_field($json['entry']['published']['$t']);
376
-
377
- $thehtml .= '<a target="_blank" href="' . $postlink . '" class="accthumb"><img src="' . $_thumbnailUrl . '" /></a>';
378
- $thehtml .= '<div class="accinfo">';
379
- $thehtml .= '<a target="_blank" href="' . $postlink . '" class="accvidtitle">' . $_name . '</a>';
380
- $thehtml .= '<div class="accdesc">' . (strlen($_description) > 400 ? substr($_description, 0, 400) . "..." : $_description) . '</div>';
381
- $thehtml .= '</div>';
382
- $thehtml .= '<div class="clearboth pad20"></div>';
383
- }
384
- else
385
  {
386
- $thehtml .= '<p class="center bold orange">This <a target="_blank" href="' . $postlink . '">post/page</a> contains a video that has been removed from YouTube.';
387
-
388
- if (!(self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
389
  {
390
- $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>';
 
 
 
 
 
 
391
  }
392
- $thehtml .= '</strong>';
393
  }
394
  }
395
  }
396
- }
397
- catch (Exception $ex)
398
- {
399
-
400
  }
401
  }
402
- }
403
 
404
 
405
 
406
- if ($currpost != null)
407
- {
408
- $result['type'] = 'success';
409
- $result['data'] = $thehtml;
 
 
 
 
 
 
410
  }
411
  else
412
  {
413
  $result['type'] = 'error';
 
414
  }
415
- echo json_encode($result);
416
  }
417
- else
418
- {
419
- $result['type'] = 'error';
420
- header("Location: " . $_SERVER["HTTP_REFERER"]);
421
- }
422
- die();
423
- }
424
 
425
- public static function my_embedplus_glance_count()
426
- {
427
- $result = array();
428
- if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
429
  {
430
- $thehtml = '';
431
-
432
- try
433
  {
434
- if (version_compare(get_bloginfo('version'), '3.8', '>='))
 
 
435
  {
436
- $result['container'] = '#dashboard_right_now ul';
437
- $thehtml .= self::show_glance_list();
 
 
 
 
 
 
 
 
 
 
438
  }
439
- else
440
  {
441
- $result['container'] = '#dashboard_right_now .table_content table tbody';
442
- $thehtml .= self::show_glance_table();
443
  }
444
- $result['type'] = 'success';
445
- $result['data'] = $thehtml;
446
  }
447
- catch (Exception $e)
448
  {
449
  $result['type'] = 'error';
 
450
  }
451
-
452
- echo json_encode($result);
453
- }
454
- else
455
- {
456
- $result['type'] = 'error';
457
- header("Location: " . $_SERVER["HTTP_REFERER"]);
458
  }
459
- die();
460
- }
461
 
462
- public static function media_button_wizard()
463
- {
464
- add_thickbox();
465
-
466
- $wizhref = self::$epbase . '/wpembedcode-simple-search.aspx?pluginversion=' . YouTubePrefs::$version .
467
- '&wpversion=' . get_bloginfo('version') .
468
- '&settingsurl=' . urlencode(admin_url('admin.php?page=youtube-my-preferences#jumpdefaults')) .
469
- '&dashurl=' . urlencode(admin_url('admin.php?page=youtube-ep-analytics-dashboard')) .
470
- '&blogwidth=' . YouTubePrefs::get_blogwidth() .
471
- '&domain=' . urlencode(site_url()) .
472
- '&prokey=' . urlencode(YouTubePrefs::$alloptions[YouTubePrefs::$opt_pro]) .
473
- '&myytdefaults=' . urlencode(http_build_query(YouTubePrefs::$alloptions)) .
474
- '&random=' . rand(1, 1000) .
475
- '&TB_iframe=true&width=950&height=800';
476
- ?>
477
  <script type="text/javascript">
478
  function widen_ytprefs_wiz() {
479
  setTimeout(function() {
@@ -510,6 +521,7 @@ class YouTubePrefs
510
  <div class="error">
511
  <p class="embedpluswarning">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>
512
  </div>
 
513
  <?php
514
  }
515
 
@@ -693,9 +705,7 @@ class YouTubePrefs
693
  public static function get_html($m, $iscontent)
694
  {
695
  //$link = trim(preg_replace('/&amp;/i', '&', $m[0]));
696
- $badentities = array('&#215;', '×', '&#8211;', '–', '&amp;');
697
- $goodliterals = array('x', 'x', '--', '--', '&');
698
- $link = trim(str_replace($badentities, $goodliterals, $m[0]));
699
 
700
  $link = preg_replace('/\s/', '', $link);
701
  $linkparamstemp = explode('?', $link);
@@ -978,7 +988,7 @@ class YouTubePrefs
978
  {
979
  add_menu_page('YouTube Settings', 'YouTube Free', 'manage_options', 'youtube-my-preferences', 'YouTubePrefs::ytprefs_show_options', plugins_url('images/youtubeicon16.png', __FILE__), '10.000392854349');
980
  add_submenu_page('youtube-my-preferences', '', '', 'manage_options', 'youtube-my-preferences', 'YouTubePrefs::ytprefs_show_options');
981
- add_submenu_page('youtube-my-preferences', 'YouTube PRO', 'YouTube PRO', 'manage_options', 'youtube-ep-analytics-dashboard', 'YouTubePrefs::epstats_show_options');
982
  }
983
  add_submenu_page(null, 'YouTube Posts', 'YouTube Posts', 'manage_options', 'youtube-ep-glance', 'YouTubePrefs::glance_page');
984
  }
@@ -1010,73 +1020,73 @@ class YouTubePrefs
1010
  .orange {color: #f85d00;}
1011
  </style>
1012
  <br>
1013
- <?php
1014
- $thishost = (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : "");
1015
- $thiskey = self::$alloptions[self::$opt_pro];
1016
 
1017
- $dashurl = self::$epbase . "/dashboard/pro-easy-video-analytics.aspx?ref=protab&domain=" . $thishost . "&prokey=" . $thiskey . '&coupon=400K-4OFF';
1018
 
1019
- if (self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0)
1020
- {
1021
- //// header
1022
- echo "<h2>" . '<img src="' . plugins_url('images/epstats16.png', __FILE__) . '" /> ' . __('YouTube Analytics Dashboard') . "</h2>";
1023
- 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>';
1024
- }
1025
- else
1026
- {
1027
- //// header
1028
- echo "<h2>" . '<img src="' . plugins_url('images/epstats16.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>";
1029
- }
1030
- ?>
1031
  <iframe class="shadow" src="<?php echo $dashurl ?>" width="1060" height="2700" scrolling="auto"/>
1032
  </div>
1033
- <?php
1034
- }
1035
 
1036
- public static function my_embedplus_pro_record()
1037
- {
1038
- $result = array();
1039
- if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
1040
  {
1041
- $tmppro = preg_replace('/[^A-Za-z0-9-]/i', '', $_REQUEST[self::$opt_pro]);
1042
- $new_options = array();
1043
- $new_options[self::$opt_pro] = $tmppro;
1044
- $all = get_option(self::$opt_alloptions);
1045
- $all = $new_options + $all;
1046
- update_option(self::$opt_alloptions, $all);
1047
-
1048
- if (strlen($tmppro) > 0)
1049
  {
1050
- $result['type'] = 'success';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1051
  }
1052
  else
1053
  {
1054
  $result['type'] = 'error';
 
1055
  }
1056
- echo json_encode($result);
1057
- }
1058
- else
1059
- {
1060
- $result['type'] = 'error';
1061
- header("Location: " . $_SERVER["HTTP_REFERER"]);
1062
  }
1063
- die();
1064
- }
1065
 
1066
- public static function custom_admin_pointers_check()
1067
- {
1068
- $admin_pointers = self::custom_admin_pointers();
1069
- foreach ($admin_pointers as $pointer => $array)
1070
  {
1071
- if ($array['active'])
1072
- return true;
 
 
 
 
1073
  }
1074
- }
1075
 
1076
- public static function glance_script()
1077
- {
1078
- add_thickbox();
1079
- ?>
1080
  <script type="text/javascript">
1081
  function widen_ytprefs_glance() {
1082
  setTimeout(function() {
@@ -1155,7 +1165,7 @@ class YouTubePrefs
1155
  ?>
1156
  }
1157
 
1158
- //////////////////////////////////////////////////////////ep_do_pointers(jQuery);
1159
  /* ]]> */
1160
  </script>
1161
  <?php
@@ -1164,27 +1174,26 @@ class YouTubePrefs
1164
  public static function custom_admin_pointers()
1165
  {
1166
  $dismissed = explode(',', (string) get_user_meta(get_current_user_id(), 'dismissed_wp_pointers', true));
1167
- $version = str_replace('.', '_', self::$version); // replace all periods in 1.0 with an underscore
1168
  $prefix = 'custom_admin_pointers' . $version . '_';
1169
 
1170
- $new_pointer_content = '<h3>' . __('New Update') . '</h3>';
1171
-
1172
 
1173
- $new_pointer_content .= '<p>' . __('YouTube searching and inserting now works for Visual mode <i>and</i> Text mode of the editor for all users, both Free and ');
1174
  if (!(self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0))
1175
  {
1176
- $new_pointer_content .= __('<a class="bold orange" target="_blank" href="' . self::$epbase . '/dashboard/pro-easy-video-analytics.aspx?ref=frompointer&coupon=400K-4OFF' . '">PRO &raquo;</a>');
1177
  }
1178
  else
1179
  {
1180
- $new_pointer_content .= __('PRO.');
1181
  }
1182
  $new_pointer_content .= '</p>';
1183
 
1184
  return array(
1185
  $prefix . 'new_items' => array(
1186
  'content' => $new_pointer_content,
1187
- 'anchor_id' => '#toplevel_page_youtube-my-preferences', //'#ytprefs_glance_button',
1188
  'edge' => 'top',
1189
  'align' => 'left',
1190
  'active' => (!in_array($prefix . 'new_items', $dismissed) )
@@ -1358,7 +1367,7 @@ class YouTubePrefs
1358
  <input type="hidden" name="<?php echo $ytprefs_submitted; ?>" value="Y">
1359
 
1360
  <h3 class="sect">
1361
- <?php _e("How to Insert a YouTube Video or Playlist") ?> <!--<span class="pronon">(For Free and <a href="<?php echo self::$epbase ?>/dashboard/pro-easy-video-analytics.aspx" target="_blank">PRO Users &raquo;</a>)</span>-->
1362
  </h3>
1363
  <p>
1364
  <b>For videos:</b> <i>Method 1 - </i> Do you already have a URL to the video you want to embed? All you have to do is paste it on its own line, as shown below (including the http:// part). Easy, eh?<br>
@@ -1406,7 +1415,7 @@ class YouTubePrefs
1406
  </p>
1407
  <div class="jumper" id="jumpdefaults"></div>
1408
  <h3 class="sect">
1409
- <?php _e("Default YouTube Options") ?> <a href="#top" class="totop">&#9650; top</a>
1410
  </h3>
1411
  <p>
1412
  <?php _e("Below you can set the default options for all your videos (click \"Save Changes\" when finished). However, you can override them (and more) on a per-video basis. Directions on how to do that are in the next section.") ?>
@@ -1504,10 +1513,10 @@ class YouTubePrefs
1504
 
1505
 
1506
  <p class="smallnote orange">Below are PRO features for enhanced SEO, performance, privacy, and security (works for even past embed links):</p>
1507
- <?php
1508
- if ($haspro)
1509
- {
1510
- ?>
1511
  <p>
1512
  <input name="<?php echo self::$opt_ssl; ?>" id="<?php echo self::$opt_ssl; ?>" <?php checked($all[self::$opt_ssl], 1); ?> type="checkbox" class="checkbox">
1513
  <label for="<?php echo self::$opt_ssl; ?>">
@@ -1528,11 +1537,11 @@ class YouTubePrefs
1528
  </label>
1529
 
1530
  </p>
1531
- <?php
1532
- }
1533
- else
1534
- {
1535
- ?>
1536
  <p>
1537
  <input disabled type="checkbox" class="checkbox">
1538
  <label>
@@ -1553,9 +1562,9 @@ class YouTubePrefs
1553
  </label>
1554
  </p>
1555
 
1556
- <?php
1557
- }
1558
- ?>
1559
 
1560
  <p class="submit">
1561
  <input type="submit" onclick="return savevalidate();" name="Submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
@@ -1563,66 +1572,66 @@ class YouTubePrefs
1563
 
1564
  <hr>
1565
 
1566
- <?php
1567
- if ($haspro)
1568
- {
1569
- ?>
1570
  <p>
1571
  <b>(PRO)</b> We plan to promote this plugin right from our <a target="_blank" href="<?php echo self::$epbase; ?>">embedplus.com</a> homepage by listing example sites that use it. <a id="showcase-validate" class="button-primary" target="_blank">Click this button</a> to automatically include your site for evaluation. It will give you a chance to promote your quality site.
1572
  </p>
1573
- <?php
1574
- }
1575
- else
1576
- {
1577
- ?>
1578
 
1579
  <p>
1580
  <span class="pronon">(PRO Users)</span> We plan to promote this plugin right from our <a target="_blank" href="<?php echo self::$epbase; ?>">embedplus.com</a> homepage by listing example sites that use it. <a class="button-primary" disabled>Click this button</a> to automatically include your site for evaluation. It will give you a chance to promote your quality site.
1581
  </p>
1582
- <?php } ?>
1583
  </div>
1584
  <div class="jumper" id="jumpoverride"></div>
1585
 
1586
  <h3 class="sect">
1587
- <?php _e("How To Override Defaults / Other Options") ?> <a href="#top" class="totop">&#9650; top</a>
1588
  </h3>
1589
  <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 '&'.
1590
  <br><span class="pronon">PRO users: You can use the <span class="button-primary cuz">&#9658; Customize</span> button in the wizard instead of memorizing the following.</span>
1591
- <?php
1592
- _e('<ul>');
1593
- _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>");
1594
- _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>");
1595
- _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>");
1596
- _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>");
1597
- _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>");
1598
- _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>");
1599
- _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>");
1600
- _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>");
1601
- _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>");
1602
- _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>");
1603
- _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>");
1604
- _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>");
1605
- _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>");
1606
- _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>");
1607
- _e('</ul>');
1608
-
1609
- _e("<p>You can also start and end each individual video at particular times. Like the above, each option should begin with '&'</p>");
1610
- _e('<ul>');
1611
- _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>");
1612
- _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>");
1613
- _e('</ul>');
1614
- ?>
1615
 
1616
  </form>
1617
  <div class="jumper" id="jumppro"></div>
1618
  <div id="goprobox">
1619
- <?php
1620
- if ($haspro)
1621
- {
1622
- echo "<h3>" . __('Thank you for going PRO.');
1623
- echo ' &nbsp;<input type="submit" name="showkey" class="button-primary" style="vertical-align: 15%;" id="showprokey" value="View my PRO key" />';
1624
- echo "</h3>";
1625
- ?>
1626
  <?php
1627
  }
1628
  else
@@ -1643,10 +1652,6 @@ class YouTubePrefs
1643
  <img src="<?php echo plugins_url('images/vseo.png', __FILE__) ?>">
1644
  One-Click Video SEO Tags (markup that can help drive more traffic)
1645
  </li>
1646
- <li>
1647
- <img src="<?php echo plugins_url('images/iconmusic.png', __FILE__) ?>">
1648
- Music video extras to inspire your posts <sup class="orange bold">NEW</sup>
1649
- </li>
1650
  <li>
1651
  <img src="<?php echo plugins_url('images/html5.png', __FILE__) ?>">
1652
  HTML5-first to speedup page loads (will even work for your old embeds)
@@ -1655,19 +1660,18 @@ class YouTubePrefs
1655
  <img src="<?php echo plugins_url('images/deletechecker.png', __FILE__) ?>">
1656
  Deleted Video Checker (alerts you if YouTube deletes videos you embedded)
1657
  </li>
1658
- <!--
1659
  <li>
1660
- <img src="<?php echo plugins_url('images/icondiscuss.png', __FILE__) ?>">
1661
- Read the latest Internet discussions about the videos you want to embed
1662
  </li>
1663
- -->
1664
  <li>
1665
  <img src="<?php echo plugins_url('images/lock.png', __FILE__) ?>">
1666
- Secure YouTube player (will even work for your old embeds)
1667
  </li>
 
1668
  </ul>
1669
  </div>
1670
- <div class="procol" style="width: 340px;">
1671
  <ul class="gopro">
1672
  <li>
1673
  <img src="<?php echo plugins_url('images/prioritysupport.png', __FILE__) ?>">
@@ -1677,6 +1681,10 @@ class YouTubePrefs
1677
  <img src="<?php echo plugins_url('images/bulletgraph45.png', __FILE__) ?>">
1678
  User-friendly video analytics dashboard
1679
  </li>
 
 
 
 
1680
  <li>
1681
  <img src="<?php echo plugins_url('images/iconythealth.png', __FILE__) ?>">
1682
  Instant YouTube embed diagnostic reports
@@ -1689,30 +1697,30 @@ class YouTubePrefs
1689
  <img src="<?php echo plugins_url('images/showcase.png', __FILE__) ?>">
1690
  A chance to showcase your site right from our homepage
1691
  </li>
1692
- <li>
1693
- <img src="<?php echo plugins_url('images/questionsale.png', __FILE__) ?>">
1694
- What else? You tell us!
1695
- </li>
1696
  </ul>
1697
  </div>
1698
  <br>
1699
  <br>
1700
  <div style="clear: both;"></div>
1701
  <h3 class="bold">Enter and save your PRO key (emailed to you):</h3>
1702
- <?php } ?>
1703
  <form name="form2" method="post" action="" id="epform2" class="submitpro" <?php
1704
- if ($haspro)
1705
- {
1706
- echo 'style="display: none;"';
1707
- }
1708
- ?>>
1709
 
1710
  <input name="<?php echo self::$opt_pro; ?>" id="opt_pro" value="<?php echo $all[self::$opt_pro]; ?>" type="text">
1711
  <input type="submit" name="Submit" class="button-primary" id="prokeysubmit" value="<?php _e('Save Key') ?>" />
1712
- <?php
1713
- if (!$haspro)
1714
- {
1715
- ?>
1716
  &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>
1717
  <?php
1718
  }
@@ -1758,14 +1766,6 @@ class YouTubePrefs
1758
 
1759
  <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="500"></iframe>
1760
 
1761
- <p class="bold">Keep us going!
1762
- <br>
1763
- <iframe src="<?php echo self::$epbase ?>/wplikeus.aspx?prokey=<?php echo $all[self::$opt_pro]; ?>" width="350" height="100"></iframe>
1764
- </p>
1765
- <!--
1766
- <h3 class="orange">What's next for us? Take this survey.</h3>
1767
- <div id="surveyMonkeyInfo" style="width:700px;font-size:10px;color:#666;border:1px solid #ccc;padding:4px;"><div><iframe id="sm_e_s" src="http://www.surveymonkey.com/jsEmbed.aspx?sm=uYXvJKm2UNLkrpXHzLJ57Q_3d_3d" width="700" height="800" style="border:0px;padding-bottom:4px;" frameborder="0" allowtransparency="true" ></iframe></div></div>
1768
- -->
1769
 
1770
  <script type="text/javascript">
1771
 
@@ -1860,12 +1860,12 @@ class YouTubePrefs
1860
 
1861
  });
1862
  </script>
1863
- <?php
1864
- if (function_exists('add_thickbox'))
1865
- {
1866
- add_thickbox();
1867
- }
1868
- ?>
1869
 
1870
  <?php
1871
  }
@@ -1895,7 +1895,7 @@ class YouTubePrefs
1895
 
1896
  }
1897
 
1898
- $blogwidth = preg_replace('/\D/', '', $blogwidth);
1899
 
1900
  return $blogwidth;
1901
  }
@@ -1995,7 +1995,7 @@ class YouTubePrefs
1995
  add_action('wp_print_scripts', 'youtubeprefs_output_scriptvars');
1996
 
1997
  if (
1998
- //(!(isset(YouTubePrefs::$alloptions[YouTubePrefs::$opt_pro]) && strlen(trim(YouTubePrefs::$alloptions[YouTubePrefs::$opt_pro])) > 0)) &&
1999
  (get_bloginfo('version') >= '3.3') && YouTubePrefs::custom_admin_pointers_check()
2000
  )
2001
  {
@@ -2093,7 +2093,6 @@ class YouTubePrefs
2093
 
2094
 
2095
  </script>
2096
- <?php
2097
- }
2098
  }
2099
-
3
  Plugin Name: YouTube
4
  Plugin URI: http://www.embedplus.com/dashboard/pro-easy-video-analytics.aspx
5
  Description: YouTube embed plugin with basic features and convenient defaults. Upgrade now to add tracking, instant video SEO tags, and much more!
6
+ Version: 8.2
7
  Author: EmbedPlus Team
8
  Author URI: http://www.embedplus.com
9
  */
32
  class YouTubePrefs
33
  {
34
 
35
+ public static $version = '8.2';
36
  public static $opt_version = 'version';
37
  public static $optembedwidth = null;
38
  public static $optembedheight = null;
71
  public static $epbase = '//www.embedplus.com';
72
  public static $double_plugin = false;
73
  public static $scriptsprinted = 0;
74
+ public static $badentities = array('&#215;', '×', '&#8211;', '–', '&amp;');
75
+ public static $goodliterals = array('x', 'x', '--', '--', '&');
76
+
77
+
78
  /*
79
  listType
80
  */
86
  //public static $ytregex = '@^[\r\n]{0,1}[[:blank:]]*https?://(?:www\.)?(?:(?:youtube.com/watch\?)|(?:youtu.be/))([^\s"]+)[[:blank:]]*[\r\n]{0,1}$@im';
87
  public static $oldytregex = '@^\s*https?://(?:www\.)?(?:(?:youtube.com/(?:(?:watch)|(?:embed))/{0,1}\?)|(?:youtu.be/))([^\s"]+)\s*$@im';
88
  public static $ytregex = '@^[\r\t ]*https?://(?:www\.)?(?:(?:youtube.com/(?:(?:watch)|(?:embed))/{0,1}\?)|(?:youtu.be/))([^\s"]+)[\r\t ]*$@im';
89
+ public static $justurlregex = '@https?://(?:www\.)?(?:(?:youtube.com/(?:(?:watch)|(?:embed))/{0,1}\?)|(?:youtu.be/))([^\[\s"]+)@i';
90
 
91
  ///////////////////////////////////////////////////////////////////////////////////////////////////
92
  ///////////////////////////////////////////////////////////////////////////////////////////////////
290
  echo '<h2><img src="' . plugins_url('images/youtubeicon16.png', __FILE__) . '" /> 10 Latest Posts/Pages with YouTube Videos (' . $total . ' Total)</h2>';
291
  ?>
292
 
293
+ 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.
294
 
295
  <?php
 
 
 
 
 
 
 
296
  if ($total > 0)
297
  {
298
  echo '<ul class="accord">';
314
  wp_reset_postdata();
315
  ?>
316
  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>.
317
+
318
+ <?php
319
+ if (!(self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0))
320
+ {
321
+ ?>
322
+ <div class="center">
323
+ <i>New:</i> <a target="_blank" href="https://www.embedplus.com/dashboard/pro-easy-video-analytics.aspx?coupon=400K-4OFF">Coupon code <span class="bold">400K-4OFF</span> is now active &raquo;</a>
324
+ </div>
325
+ <?php
326
+ }
327
+ ?>
328
+
329
  </div>
330
+ <?php
331
+ }
332
 
333
+ public static function my_embedplus_glance_vids()
 
 
 
334
  {
335
+ $result = array();
336
+ if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
337
+ {
338
+ $postid = intval($_REQUEST['postid']);
339
+ $currpost = get_post($postid);
340
 
341
+ $thehtml = '<img class="accclose" onclick="accclose(this)" src="' . plugins_url('images/accclose.png', __FILE__) . '" />';
342
 
343
+ $matches = Array();
344
+ $ismatch = preg_match_all(self::$justurlregex, $currpost->post_content, $matches);
345
 
346
+ if ($ismatch)
 
 
347
  {
348
+ foreach ($matches[0] as $match)
 
 
 
 
 
 
 
 
 
349
  {
350
+ $link = trim(preg_replace('/&amp;/i', '&', $match));
351
+ $link = preg_replace('/\s/', '', $link);
352
+ $link = trim(str_replace(self::$badentities, self::$goodliterals, $link));
353
 
354
+ $linkparamstemp = explode('?', $link);
355
 
356
+ $linkparams = array();
357
+ if (count($linkparamstemp) > 1)
 
 
 
358
  {
359
+ $linkparams = self::keyvalue($linkparamstemp[1], true);
360
+ }
361
+ if (strpos($linkparamstemp[0], 'youtu.be') !== false && !isset($linkparams['v']))
362
+ {
363
+ $vtemp = explode('/', $linkparamstemp[0]);
364
+ $linkparams['v'] = array_pop($vtemp);
365
+ }
366
+
367
+ $vidid = $linkparams['v'];
368
+
369
+ try
370
+ {
371
+ $ytapilink = 'http://gdata.youtube.com/feeds/api/videos/' . $vidid . '?v=2&alt=json&fields=id,published,title,content,media:group(media:description,yt:duration)';
372
+ $apidata = wp_remote_get($ytapilink);
373
+ if (!is_wp_error($apidata))
374
  {
375
+ $raw = wp_remote_retrieve_body($apidata);
376
+ if (!empty($raw))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
377
  {
378
+ $postlink = get_permalink($postid);
379
+ $json = json_decode($raw, true);
380
+ if (is_array($json))
381
+ {
382
+ $_name = esc_attr(sanitize_text_field($json['entry']['title']['$t']));
383
+ $_description = esc_attr(sanitize_text_field($json['entry']['media$group']['media$description']['$t']));
384
+ $_thumbnailUrl = esc_url("//i.ytimg.com/vi/" . $vidid . "/0.jpg");
385
+ $_duration = self::formatDuration(self::secondsToDuration(intval($json['entry']['media$group']['yt$duration']['seconds'])));
386
+ $_uploadDate = sanitize_text_field($json['entry']['published']['$t']);
387
+
388
+ $thehtml .= '<a target="_blank" href="' . $postlink . '" class="accthumb"><img src="' . $_thumbnailUrl . '" /></a>';
389
+ $thehtml .= '<div class="accinfo">';
390
+ $thehtml .= '<a target="_blank" href="' . $postlink . '" class="accvidtitle">' . $_name . '</a>';
391
+ $thehtml .= '<div class="accdesc">' . (strlen($_description) > 400 ? substr($_description, 0, 400) . "..." : $_description) . '</div>';
392
+ $thehtml .= '</div>';
393
+ $thehtml .= '<div class="clearboth pad20"></div>';
394
+ }
395
+ else
396
  {
397
+ $thehtml .= '<p class="center bold orange">This <a target="_blank" href="' . $postlink . '">post/page</a> contains a video that has been removed from YouTube.';
398
+
399
+ if (!(self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0))
400
+ {
401
+ $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>';
402
+ }
403
+ $thehtml .= '</strong>';
404
  }
 
405
  }
406
  }
407
  }
408
+ catch (Exception $ex)
409
+ {
410
+
411
+ }
412
  }
413
  }
 
414
 
415
 
416
 
417
+ if ($currpost != null)
418
+ {
419
+ $result['type'] = 'success';
420
+ $result['data'] = $thehtml;
421
+ }
422
+ else
423
+ {
424
+ $result['type'] = 'error';
425
+ }
426
+ echo json_encode($result);
427
  }
428
  else
429
  {
430
  $result['type'] = 'error';
431
+ header("Location: " . $_SERVER["HTTP_REFERER"]);
432
  }
433
+ die();
434
  }
 
 
 
 
 
 
 
435
 
436
+ public static function my_embedplus_glance_count()
 
 
 
437
  {
438
+ $result = array();
439
+ if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
 
440
  {
441
+ $thehtml = '';
442
+
443
+ try
444
  {
445
+ if (version_compare(get_bloginfo('version'), '3.8', '>='))
446
+ {
447
+ $result['container'] = '#dashboard_right_now ul';
448
+ $thehtml .= self::show_glance_list();
449
+ }
450
+ else
451
+ {
452
+ $result['container'] = '#dashboard_right_now .table_content table tbody';
453
+ $thehtml .= self::show_glance_table();
454
+ }
455
+ $result['type'] = 'success';
456
+ $result['data'] = $thehtml;
457
  }
458
+ catch (Exception $e)
459
  {
460
+ $result['type'] = 'error';
 
461
  }
462
+
463
+ echo json_encode($result);
464
  }
465
+ else
466
  {
467
  $result['type'] = 'error';
468
+ header("Location: " . $_SERVER["HTTP_REFERER"]);
469
  }
470
+ die();
 
 
 
 
 
 
471
  }
 
 
472
 
473
+ public static function media_button_wizard()
474
+ {
475
+ add_thickbox();
476
+
477
+ $wizhref = self::$epbase . '/wpembedcode-simple-search.aspx?pluginversion=' . YouTubePrefs::$version .
478
+ '&wpversion=' . get_bloginfo('version') .
479
+ '&settingsurl=' . urlencode(admin_url('admin.php?page=youtube-my-preferences#jumpdefaults')) .
480
+ '&dashurl=' . urlencode(admin_url('admin.php?page=youtube-ep-analytics-dashboard')) .
481
+ '&blogwidth=' . YouTubePrefs::get_blogwidth() .
482
+ '&domain=' . urlencode(site_url()) .
483
+ '&prokey=' . urlencode(YouTubePrefs::$alloptions[YouTubePrefs::$opt_pro]) .
484
+ '&myytdefaults=' . urlencode(http_build_query(YouTubePrefs::$alloptions)) .
485
+ '&random=' . rand(1, 1000) .
486
+ '&TB_iframe=true&width=950&height=800';
487
+ ?>
488
  <script type="text/javascript">
489
  function widen_ytprefs_wiz() {
490
  setTimeout(function() {
521
  <div class="error">
522
  <p class="embedpluswarning">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>
523
  </div>
524
+ <iframe allowTransparency="true" src="<?php echo self::$epbase . '/both-plugins-conflict.aspx' ?>" style="width:2px; height: 2px;" ></iframe>
525
  <?php
526
  }
527
 
705
  public static function get_html($m, $iscontent)
706
  {
707
  //$link = trim(preg_replace('/&amp;/i', '&', $m[0]));
708
+ $link = trim(str_replace(self::$badentities, self::$goodliterals, $m[0]));
 
 
709
 
710
  $link = preg_replace('/\s/', '', $link);
711
  $linkparamstemp = explode('?', $link);
988
  {
989
  add_menu_page('YouTube Settings', 'YouTube Free', 'manage_options', 'youtube-my-preferences', 'YouTubePrefs::ytprefs_show_options', plugins_url('images/youtubeicon16.png', __FILE__), '10.000392854349');
990
  add_submenu_page('youtube-my-preferences', '', '', 'manage_options', 'youtube-my-preferences', 'YouTubePrefs::ytprefs_show_options');
991
+ 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');
992
  }
993
  add_submenu_page(null, 'YouTube Posts', 'YouTube Posts', 'manage_options', 'youtube-ep-glance', 'YouTubePrefs::glance_page');
994
  }
1020
  .orange {color: #f85d00;}
1021
  </style>
1022
  <br>
1023
+ <?php
1024
+ $thishost = (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : "");
1025
+ $thiskey = self::$alloptions[self::$opt_pro];
1026
 
1027
+ $dashurl = self::$epbase . "/dashboard/pro-easy-video-analytics.aspx?ref=protab&domain=" . $thishost . "&prokey=" . $thiskey . '&coupon=400K-4OFF';
1028
 
1029
+ if (self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0)
1030
+ {
1031
+ //// header
1032
+ echo "<h2>" . '<img src="' . plugins_url('images/epstats16.png', __FILE__) . '" /> ' . __('YouTube Analytics Dashboard') . "</h2>";
1033
+ 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>';
1034
+ }
1035
+ else
1036
+ {
1037
+ //// header
1038
+ 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>";
1039
+ }
1040
+ ?>
1041
  <iframe class="shadow" src="<?php echo $dashurl ?>" width="1060" height="2700" scrolling="auto"/>
1042
  </div>
1043
+ <?php
1044
+ }
1045
 
1046
+ public static function my_embedplus_pro_record()
 
 
 
1047
  {
1048
+ $result = array();
1049
+ if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
 
 
 
 
 
 
1050
  {
1051
+ $tmppro = preg_replace('/[^A-Za-z0-9-]/i', '', $_REQUEST[self::$opt_pro]);
1052
+ $new_options = array();
1053
+ $new_options[self::$opt_pro] = $tmppro;
1054
+ $all = get_option(self::$opt_alloptions);
1055
+ $all = $new_options + $all;
1056
+ update_option(self::$opt_alloptions, $all);
1057
+
1058
+ if (strlen($tmppro) > 0)
1059
+ {
1060
+ $result['type'] = 'success';
1061
+ }
1062
+ else
1063
+ {
1064
+ $result['type'] = 'error';
1065
+ }
1066
+ echo json_encode($result);
1067
  }
1068
  else
1069
  {
1070
  $result['type'] = 'error';
1071
+ header("Location: " . $_SERVER["HTTP_REFERER"]);
1072
  }
1073
+ die();
 
 
 
 
 
1074
  }
 
 
1075
 
1076
+ public static function custom_admin_pointers_check()
 
 
 
1077
  {
1078
+ $admin_pointers = self::custom_admin_pointers();
1079
+ foreach ($admin_pointers as $pointer => $array)
1080
+ {
1081
+ if ($array['active'])
1082
+ return true;
1083
+ }
1084
  }
 
1085
 
1086
+ public static function glance_script()
1087
+ {
1088
+ add_thickbox();
1089
+ ?>
1090
  <script type="text/javascript">
1091
  function widen_ytprefs_glance() {
1092
  setTimeout(function() {
1165
  ?>
1166
  }
1167
 
1168
+ ep_do_pointers(jQuery); // switch off all pointers ooopointer
1169
  /* ]]> */
1170
  </script>
1171
  <?php
1174
  public static function custom_admin_pointers()
1175
  {
1176
  $dismissed = explode(',', (string) get_user_meta(get_current_user_id(), 'dismissed_wp_pointers', true));
1177
+ $version = str_replace('.', '_', self::$version); // replace all periods in version with an underscore
1178
  $prefix = 'custom_admin_pointers' . $version . '_';
1179
 
1180
+ $new_pointer_content = '<h3>' . __('New Update') . '</h3>'; // ooopointer
 
1181
 
1182
+ $new_pointer_content .= '<p>' . __('Version 8.2 adds an "At a Glance" improvement (all users). Also, the PRO dashboard now warns you of embeds that are blocked from your visitors in other countries. '); // ooopointer
1183
  if (!(self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0))
1184
  {
1185
+ $new_pointer_content .= __('<a class="bold orange" target="_blank" href="' . self::$epbase . '/dashboard/pro-easy-video-analytics.aspx?ref=frompointer&coupon=400K-4OFF' . '">Read more here &raquo;</a>');
1186
  }
1187
  else
1188
  {
1189
+ $new_pointer_content .= __('PRO).');
1190
  }
1191
  $new_pointer_content .= '</p>';
1192
 
1193
  return array(
1194
  $prefix . 'new_items' => array(
1195
  'content' => $new_pointer_content,
1196
+ 'anchor_id' => 'a.toplevel_page_youtube-my-preferences', //'#ytprefs_glance_button',
1197
  'edge' => 'top',
1198
  'align' => 'left',
1199
  'active' => (!in_array($prefix . 'new_items', $dismissed) )
1367
  <input type="hidden" name="<?php echo $ytprefs_submitted; ?>" value="Y">
1368
 
1369
  <h3 class="sect">
1370
+ <?php _e("How to Insert a YouTube Video or Playlist") ?> <!--<span class="pronon">(For Free and <a href="<?php echo self::$epbase ?>/dashboard/pro-easy-video-analytics.aspx" target="_blank">PRO Users &raquo;</a>)</span>-->
1371
  </h3>
1372
  <p>
1373
  <b>For videos:</b> <i>Method 1 - </i> Do you already have a URL to the video you want to embed? All you have to do is paste it on its own line, as shown below (including the http:// part). Easy, eh?<br>
1415
  </p>
1416
  <div class="jumper" id="jumpdefaults"></div>
1417
  <h3 class="sect">
1418
+ <?php _e("Default YouTube Options") ?> <a href="#top" class="totop">&#9650; top</a>
1419
  </h3>
1420
  <p>
1421
  <?php _e("Below you can set the default options for all your videos (click \"Save Changes\" when finished). However, you can override them (and more) on a per-video basis. Directions on how to do that are in the next section.") ?>
1513
 
1514
 
1515
  <p class="smallnote orange">Below are PRO features for enhanced SEO, performance, privacy, and security (works for even past embed links):</p>
1516
+ <?php
1517
+ if ($haspro)
1518
+ {
1519
+ ?>
1520
  <p>
1521
  <input name="<?php echo self::$opt_ssl; ?>" id="<?php echo self::$opt_ssl; ?>" <?php checked($all[self::$opt_ssl], 1); ?> type="checkbox" class="checkbox">
1522
  <label for="<?php echo self::$opt_ssl; ?>">
1537
  </label>
1538
 
1539
  </p>
1540
+ <?php
1541
+ }
1542
+ else
1543
+ {
1544
+ ?>
1545
  <p>
1546
  <input disabled type="checkbox" class="checkbox">
1547
  <label>
1562
  </label>
1563
  </p>
1564
 
1565
+ <?php
1566
+ }
1567
+ ?>
1568
 
1569
  <p class="submit">
1570
  <input type="submit" onclick="return savevalidate();" name="Submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
1572
 
1573
  <hr>
1574
 
1575
+ <?php
1576
+ if ($haspro)
1577
+ {
1578
+ ?>
1579
  <p>
1580
  <b>(PRO)</b> We plan to promote this plugin right from our <a target="_blank" href="<?php echo self::$epbase; ?>">embedplus.com</a> homepage by listing example sites that use it. <a id="showcase-validate" class="button-primary" target="_blank">Click this button</a> to automatically include your site for evaluation. It will give you a chance to promote your quality site.
1581
  </p>
1582
+ <?php
1583
+ }
1584
+ else
1585
+ {
1586
+ ?>
1587
 
1588
  <p>
1589
  <span class="pronon">(PRO Users)</span> We plan to promote this plugin right from our <a target="_blank" href="<?php echo self::$epbase; ?>">embedplus.com</a> homepage by listing example sites that use it. <a class="button-primary" disabled>Click this button</a> to automatically include your site for evaluation. It will give you a chance to promote your quality site.
1590
  </p>
1591
+ <?php } ?>
1592
  </div>
1593
  <div class="jumper" id="jumpoverride"></div>
1594
 
1595
  <h3 class="sect">
1596
+ <?php _e("How To Override Defaults / Other Options") ?> <a href="#top" class="totop">&#9650; top</a>
1597
  </h3>
1598
  <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 '&'.
1599
  <br><span class="pronon">PRO users: You can use the <span class="button-primary cuz">&#9658; Customize</span> button in the wizard instead of memorizing the following.</span>
1600
+ <?php
1601
+ _e('<ul>');
1602
+ _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>");
1603
+ _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>");
1604
+ _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>");
1605
+ _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>");
1606
+ _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>");
1607
+ _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>");
1608
+ _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>");
1609
+ _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>");
1610
+ _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>");
1611
+ _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>");
1612
+ _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>");
1613
+ _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>");
1614
+ _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>");
1615
+ _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>");
1616
+ _e('</ul>');
1617
+
1618
+ _e("<p>You can also start and end each individual video at particular times. Like the above, each option should begin with '&'</p>");
1619
+ _e('<ul>');
1620
+ _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>");
1621
+ _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>");
1622
+ _e('</ul>');
1623
+ ?>
1624
 
1625
  </form>
1626
  <div class="jumper" id="jumppro"></div>
1627
  <div id="goprobox">
1628
+ <?php
1629
+ if ($haspro)
1630
+ {
1631
+ echo "<h3>" . __('Thank you for going PRO.');
1632
+ echo ' &nbsp;<input type="submit" name="showkey" class="button-primary" style="vertical-align: 15%;" id="showprokey" value="View my PRO key" />';
1633
+ echo "</h3>";
1634
+ ?>
1635
  <?php
1636
  }
1637
  else
1652
  <img src="<?php echo plugins_url('images/vseo.png', __FILE__) ?>">
1653
  One-Click Video SEO Tags (markup that can help drive more traffic)
1654
  </li>
 
 
 
 
1655
  <li>
1656
  <img src="<?php echo plugins_url('images/html5.png', __FILE__) ?>">
1657
  HTML5-first to speedup page loads (will even work for your old embeds)
1660
  <img src="<?php echo plugins_url('images/deletechecker.png', __FILE__) ?>">
1661
  Deleted Video Checker (alerts you if YouTube deletes videos you embedded)
1662
  </li>
 
1663
  <li>
1664
+ <img src="<?php echo plugins_url('images/globe.png', __FILE__) ?>">
1665
+ Alerts when visitors from different countries are blocked from viewing your embeds <sup class="orange bold">NEW</sup>
1666
  </li>
 
1667
  <li>
1668
  <img src="<?php echo plugins_url('images/lock.png', __FILE__) ?>">
1669
+ HTTPS Secure YouTube player (will even work for your old embeds)
1670
  </li>
1671
+
1672
  </ul>
1673
  </div>
1674
+ <div class="procol" style="max-width: 400px;">
1675
  <ul class="gopro">
1676
  <li>
1677
  <img src="<?php echo plugins_url('images/prioritysupport.png', __FILE__) ?>">
1681
  <img src="<?php echo plugins_url('images/bulletgraph45.png', __FILE__) ?>">
1682
  User-friendly video analytics dashboard
1683
  </li>
1684
+ <li>
1685
+ <img src="<?php echo plugins_url('images/iconmusic.png', __FILE__) ?>">
1686
+ Music video extras to inspire your posts <sup class="orange bold">NEW</sup>
1687
+ </li>
1688
  <li>
1689
  <img src="<?php echo plugins_url('images/iconythealth.png', __FILE__) ?>">
1690
  Instant YouTube embed diagnostic reports
1697
  <img src="<?php echo plugins_url('images/showcase.png', __FILE__) ?>">
1698
  A chance to showcase your site right from our homepage
1699
  </li>
1700
+ <!-- <li>
1701
+ <img src="<?php echo plugins_url('images/questionsale.png', __FILE__) ?>">
1702
+ What else? You tell us!
1703
+ </li> -->
1704
  </ul>
1705
  </div>
1706
  <br>
1707
  <br>
1708
  <div style="clear: both;"></div>
1709
  <h3 class="bold">Enter and save your PRO key (emailed to you):</h3>
1710
+ <?php } ?>
1711
  <form name="form2" method="post" action="" id="epform2" class="submitpro" <?php
1712
+ if ($haspro)
1713
+ {
1714
+ echo 'style="display: none;"';
1715
+ }
1716
+ ?>>
1717
 
1718
  <input name="<?php echo self::$opt_pro; ?>" id="opt_pro" value="<?php echo $all[self::$opt_pro]; ?>" type="text">
1719
  <input type="submit" name="Submit" class="button-primary" id="prokeysubmit" value="<?php _e('Save Key') ?>" />
1720
+ <?php
1721
+ if (!$haspro)
1722
+ {
1723
+ ?>
1724
  &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>
1725
  <?php
1726
  }
1766
 
1767
  <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="500"></iframe>
1768
 
 
 
 
 
 
 
 
 
1769
 
1770
  <script type="text/javascript">
1771
 
1860
 
1861
  });
1862
  </script>
1863
+ <?php
1864
+ if (function_exists('add_thickbox'))
1865
+ {
1866
+ add_thickbox();
1867
+ }
1868
+ ?>
1869
 
1870
  <?php
1871
  }
1895
 
1896
  }
1897
 
1898
+ $blogwidth = preg_replace('/\D/', '', $blogwidth); //may have px
1899
 
1900
  return $blogwidth;
1901
  }
1995
  add_action('wp_print_scripts', 'youtubeprefs_output_scriptvars');
1996
 
1997
  if (
1998
+ (!(isset(YouTubePrefs::$alloptions[YouTubePrefs::$opt_pro]) && strlen(trim(YouTubePrefs::$alloptions[YouTubePrefs::$opt_pro])) > 0)) && // display only if not pro ooopointer
1999
  (get_bloginfo('version') >= '3.3') && YouTubePrefs::custom_admin_pointers_check()
2000
  )
2001
  {
2093
 
2094
 
2095
  </script>
2096
+ <?php
 
2097
  }
2098
+ }