YouTube - Version 8.3

Version Description

Download this release

Release Info

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

Code changes from version 8.2 to 8.3

Files changed (2) hide show
  1. readme.txt +5 -2
  2. youtube.php +262 -254
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.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!
@@ -122,6 +122,9 @@ You can also start and end each individual video at particular times. Like the a
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
 
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.9
7
+ Stable tag: 8.3
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!
122
 
123
  == Changelog ==
124
 
125
+ = YouTube Embed 8.3 =
126
+ Now compatible with WordPress 3.9.
127
+
128
  = YouTube Embed 8.2 =
129
  An at a glance regex impromevent (all users). Dashboard now warns you of embeds that are blocked from your visitors in other countries (PRO).
130
 
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.2
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.2';
36
  public static $opt_version = 'version';
37
  public static $optembedwidth = null;
38
  public static $optembedheight = null;
@@ -319,172 +319,172 @@ class YouTubePrefs
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() {
@@ -1020,73 +1020,73 @@ class YouTubePrefs
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() {
@@ -1179,14 +1179,14 @@ class YouTubePrefs
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
 
@@ -1367,7 +1367,7 @@ class YouTubePrefs
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,7 +1415,7 @@ class YouTubePrefs
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,10 +1513,10 @@ class YouTubePrefs
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,11 +1537,11 @@ class YouTubePrefs
1537
  </label>
1538
 
1539
  </p>
1540
- <?php
1541
- }
1542
- else
1543
- {
1544
- ?>
1545
  <p>
1546
  <input disabled type="checkbox" class="checkbox">
1547
  <label>
@@ -1562,9 +1562,9 @@ class YouTubePrefs
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,66 +1572,66 @@ class YouTubePrefs
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
@@ -1707,20 +1707,20 @@ class YouTubePrefs
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
  }
@@ -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
  }
@@ -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)) && // display only if not pro ooopointer
1999
  (get_bloginfo('version') >= '3.3') && YouTubePrefs::custom_admin_pointers_check()
2000
  )
2001
  {
@@ -2056,11 +2056,18 @@ class YouTubePrefs
2056
 
2057
  if (window.tinyMCE !== null && window.tinyMCE.activeEditor !== null && !window.tinyMCE.activeEditor.isHidden())
2058
  {
2059
- window.tinyMCE.execInstanceCommand(
2060
- window.tinyMCE.activeEditor.id,
2061
- 'mceInsertContent',
2062
- false,
2063
- embedcode);
 
 
 
 
 
 
 
2064
  }
2065
  else
2066
  {
@@ -2093,6 +2100,7 @@ class YouTubePrefs
2093
 
2094
 
2095
  </script>
2096
- <?php
 
2097
  }
2098
- }
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.3
7
  Author: EmbedPlus Team
8
  Author URI: http://www.embedplus.com
9
  */
32
  class YouTubePrefs
33
  {
34
 
35
+ public static $version = '8.3';
36
  public static $opt_version = 'version';
37
  public static $optembedwidth = null;
38
  public static $optembedheight = null;
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() {
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() {
1179
 
1180
  $new_pointer_content = '<h3>' . __('New Update') . '</h3>'; // ooopointer
1181
 
1182
+ $new_pointer_content .= '<p>' . __('Now compatible with the new WordPress 3.9! '); // ooopointer
1183
  if (!(self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0))
1184
  {
1185
+ $new_pointer_content .= __('This update is applied to both plugin versions, free and <a class="bold orange" target="_blank" href="' . self::$epbase . '/dashboard/pro-easy-video-analytics.aspx?ref=frompointer&coupon=400K-4OFF' . '">PRO &raquo;</a>');
1186
  }
1187
  else
1188
  {
1189
+ $new_pointer_content .= __('');
1190
  }
1191
  $new_pointer_content .= '</p>';
1192
 
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
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
  }
1860
 
1861
  });
1862
  </script>
1863
+ <?php
1864
+ if (function_exists('add_thickbox'))
1865
+ {
1866
+ add_thickbox();
1867
+ }
1868
+ ?>
1869
 
1870
  <?php
1871
  }
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
  {
2056
 
2057
  if (window.tinyMCE !== null && window.tinyMCE.activeEditor !== null && !window.tinyMCE.activeEditor.isHidden())
2058
  {
2059
+ if (typeof window.tinyMCE.execInstanceCommand !== 'undefined')
2060
+ {
2061
+ window.tinyMCE.execInstanceCommand(
2062
+ window.tinyMCE.activeEditor.id,
2063
+ 'mceInsertContent',
2064
+ false,
2065
+ embedcode);
2066
+ }
2067
+ else
2068
+ {
2069
+ send_to_editor(embedcode);
2070
+ }
2071
  }
2072
  else
2073
  {
2100
 
2101
 
2102
  </script>
2103
+ <?php
2104
+ }
2105
  }
2106
+