Smart YouTube PRO - Version 3.8

Version Description

  • Support for new IFRAME embed code
  • Support for HD playlists (httpvhp://)
  • Support for new play formats (1280x745 & 960x745)
Download this release

Release Info

Developer freediver
Plugin Icon 128x128 Smart YouTube PRO
Version 3.8
Comparing to
See all releases

Code changes from version 3.7 to 3.8

Files changed (4) hide show
  1. readme.txt +16 -7
  2. smartyoutube.class.php +144 -50
  3. smartyoutube.php +46 -34
  4. style.css → styleyt.css +4 -5
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: freediver
3
  Donate link: https://www.networkforgood.org/donation/MakeDonation.aspx?ORGID2=520781390
4
  Tags: youtube, video, play, media, Post, posts, admin
5
  Requires at least: 2.0
6
- Tested up to: 3.0
7
  Stable tag: trunk
8
 
9
  Smart Youtube plugin allows you to insert full featured YouTube videos into your post, comments and in RSS feed.
@@ -14,18 +14,18 @@ Smart Youtube is a Wordpress Youtube Plugin that allows you to easily insert You
14
 
15
  The main purpose of the plugin is to correctly embed youtube videos into your blog post. The video will be shown in full in your RSS feed as well.
16
 
17
- Smart youtube also supports playback of high quality videos, works on iPhone, produces xHTML valid code (unlike YouTube embed code), allows you to view videos in fullscreen and most recently supports YouTube playlists.
18
 
19
  The plugin is designed to be small and fast and not use any external resources. It has a number of customizable options.
20
 
21
  Main Features:
22
 
23
- * Easily embeds YouTube videos
24
- * Embed YouTube playlist
25
  * Supports latest high quality video protocols (360p and HD quality 720p)
26
- * Allows full YouTube customization (colors, border, full screen...)
27
  * Supports video deep linking (starting at desired point with &start=time parameter)
28
- * Works on iPod and iPhone
29
  * Supports migrated blogs from Wordpress.com
30
  * Supports migration from other Youtube plugins such as wp-youtube
31
  * Provides a sidebar widget for videos as well
@@ -37,6 +37,15 @@ Plugin by Vladimir Prelovac. Looking for <a href="http://www.prelovac.com/vladim
37
 
38
  == Changelog ==
39
 
 
 
 
 
 
 
 
 
 
40
  = 3.7 =
41
  * WP3.0 checked
42
  * Fixed hd and related videos parameter option
@@ -141,4 +150,4 @@ Of course, visit <a href="http://www.prelovac.com/vladimir/wordpress-plugins/sma
141
 
142
  = I love your work, are you available for hire? =
143
 
144
- Yes I am, visit my <a href="http://www.prelovac.com/vladimir/services">WordPress Consulting</a> page to find out more.
3
  Donate link: https://www.networkforgood.org/donation/MakeDonation.aspx?ORGID2=520781390
4
  Tags: youtube, video, play, media, Post, posts, admin
5
  Requires at least: 2.0
6
+ Tested up to: 3.0.1
7
  Stable tag: trunk
8
 
9
  Smart Youtube plugin allows you to insert full featured YouTube videos into your post, comments and in RSS feed.
14
 
15
  The main purpose of the plugin is to correctly embed youtube videos into your blog post. The video will be shown in full in your RSS feed as well.
16
 
17
+ Smart youtube also supports playback of high quality videos, works on iPhone, produces xHTML valid code (unlike YouTube embed code), allows you to view videos in fullscreen, supports YouTube playlists (normal/HD) and the new outube IFRAME embed code.
18
 
19
  The plugin is designed to be small and fast and not use any external resources. It has a number of customizable options.
20
 
21
  Main Features:
22
 
23
+ * Easily embeds YouTube videos (normal/HD)
24
+ * Embed YouTube playlist (normal/HD)
25
  * Supports latest high quality video protocols (360p and HD quality 720p)
26
+ * Allows full YouTube customization (colors, border, size, full screen...)
27
  * Supports video deep linking (starting at desired point with &start=time parameter)
28
+ * Works on iPhone, iPad and iPod
29
  * Supports migrated blogs from Wordpress.com
30
  * Supports migration from other Youtube plugins such as wp-youtube
31
  * Provides a sidebar widget for videos as well
37
 
38
  == Changelog ==
39
 
40
+ = 3.8 =
41
+ * Support for new IFRAME embed code
42
+ * Support for HD playlists (httpvhp://)
43
+ * Support for new play formats (1280x745 & 960x745)
44
+
45
+ = 3.7.1 =
46
+ * Widget function now supports multi-languge plugins (thanks Emmanuel Gravel)
47
+ * Playlist link in the feeds correctly displayed
48
+
49
  = 3.7 =
50
  * WP3.0 checked
51
  * Fixed hd and related videos parameter option
150
 
151
  = I love your work, are you available for hire? =
152
 
153
+ Yes I am, visit my <a href="http://www.prelovac.com/vladimir/services">WordPress Consulting</a> page to find out more.
smartyoutube.class.php CHANGED
@@ -14,7 +14,7 @@ class SmartYouTube
14
 
15
  function __construct()
16
  {
17
- $this->local_version = '3.6.1'; // TODO: Change this number???
18
  $this->custom_colors = array(
19
  'blank' => array('d6d6d6', 'f0f0f0'),
20
  'storm' => array('3a3a3a', '999999'),
@@ -66,7 +66,7 @@ class SmartYouTube
66
 
67
  function options_page()
68
  {
69
- $status = $this->get_info();
70
 
71
  $the_version = $status[1];
72
  $the_message = $status[3];
@@ -76,7 +76,7 @@ class SmartYouTube
76
  $msg = 'Latest version available '.' <strong>'.$the_version.'</strong><br />'.$the_message;
77
  _e('<div id="message" class="updated fade"><p>' . $msg . '</p></div>');
78
  }
79
-
80
 
81
  // If form was submitted
82
  if (isset($_POST['submitted']))
@@ -109,6 +109,7 @@ class SmartYouTube
109
 
110
  $this->options['posts'] = !isset($_POST['disp_posts']) ? 'off' : 'on';
111
  $this->options['comments'] = !isset($_POST['disp_comments']) ? 'off' : 'on';
 
112
 
113
  $this->options['template'] = !isset($_POST['disp_template']) ?
114
  '{video}' :
@@ -143,13 +144,14 @@ class SmartYouTube
143
 
144
  $disp_autoplay = $this->options['autoplay'] ? 'checked="checked"' : '';
145
  $disp_rel = $this->options['rel'] ? 'checked="checked"' : '';
146
- $disp_rel2 = $disp_rel ? '' : 'checked="checked"';
147
  $disp_border = $this->options['border'] ? 'checked="checked"' : '';
148
  $disp_color = $this->options['color'];
149
  $disp_posts = $this->options['posts'] == 'on' ? 'checked="checked"' : '' ;
150
  $disp_comments = $this->options['comments'] == 'on' ? 'checked="checked"' : '';
151
 
152
- $disp_privacy = $this->options['privacy'] ? 'checked="checked"' : '';
 
153
 
154
  $disp_template = wp_specialchars($this->options['template']);
155
  $tag = $this->options['tag'];
@@ -170,7 +172,7 @@ class SmartYouTube
170
  $embed_img = $this->plugin_url . '/img/embed_selection-vfl29294.png';
171
 
172
  echo '<script src="' . $this->plugin_url . '/yt.js" type="text/javascript"></script>
173
- <link rel="stylesheet" type="text/css" href="' . $this->plugin_url . '/style.css" />';
174
 
175
  $imgpath = $this->plugin_url.'/i';
176
  $actionurl = $_SERVER['REQUEST_URI'];
@@ -180,22 +182,15 @@ class SmartYouTube
180
  // Configuration Page
181
 
182
  echo <<<END
183
- <div class="wrap smartyoutube" style="max-width:950px !important;">
184
  <div id="icon-options-general" class="icon32"><br /></div>
185
  <h2>Smart YouTube</h2>
186
  <div id="poststuff" style="margin-top:10px;">
187
- <div id="sideblock" style="float:right;width:220px;margin-left:10px;">
188
- <h2>Information</h2>
189
- <ul id="dbx-content" style="text-decoration:none;">
190
- <li><img src="$imgpath/home.png"><a style="text-decoration:none;" href="http://www.prelovac.com/vladimir/wordpress-plugins/smart-youtube"> Smart Youtube Home</a></li>
191
- <li><img src="$imgpath/rate.png"><a style="text-decoration:none;" href="http://wordpress.org/extend/plugins/smart-youtube/"> Rate this plugin</a></li>
192
- <li><img src="$imgpath/help.png"><a style="text-decoration:none;" href="http://www.prelovac.com/vladimir/forum"> Support and Help</a></li>
193
- <li><a style="text-decoration:none;" href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2567254&lc=US"><img src="$imgpath/paypal.gif"></a></li>
194
- <li><img src="$imgpath/more.png"><a style="text-decoration:none;" href="http://www.prelovac.com/vladimir/wordpress-plugins"> Cool WordPress Plugins</a></li>
195
- <li><img src="$imgpath/twit.png"><a style="text-decoration:none;" href="http://twitter.com/vprelovac"> Follow updates on Twitter</a></li>
196
- <li><img src="$imgpath/idea.png"><a style="text-decoration:none;" href="http://www.prelovac.com/vladimir/services"> Need a WordPress Expert?</a></li>
197
- </ul>
198
- </div>
199
 
200
  <div id="mainblock" style="width:710px">
201
  <div class="dbx-content">
@@ -213,6 +208,7 @@ class SmartYouTube
213
  <li>httpv:// - regular video</li>
214
  <li>httpvh:// - high/HD quality</li>
215
  <li>httpvp:// - playlist</li>
 
216
  <li>[youtube=youtubeadresss] - supported for blogs migrated from wordpress.com</li>
217
  </ul>
218
  </div>
@@ -232,6 +228,11 @@ class SmartYouTube
232
  <input id="check4" type="checkbox" name="disp_comments" $disp_comments />
233
  <label for="check4">Display videos in comments</label>
234
  </div>
 
 
 
 
 
235
 
236
 
237
  <h3>Video Appearence</h3>
@@ -267,6 +268,12 @@ class SmartYouTube
267
  <div></div>
268
  </div>
269
  </a>
 
 
 
 
 
 
270
  <br clear="both" />
271
  </div>
272
 
@@ -298,6 +305,12 @@ class SmartYouTube
298
  <div class="outer">
299
  <div></div>
300
  </div>
 
 
 
 
 
 
301
  </a>
302
  <br clear="both" />
303
  </div>
@@ -330,7 +343,7 @@ class SmartYouTube
330
  <input type="checkbox" id="disp_search" name="disp_search" $disp_search /><label for="disp_search"> Display search box</label><br />
331
  <input type="checkbox" id="disp_info" name="disp_info" $disp_info /><label for="disp_info"> Remove Titles & Ratings</label><br />
332
  <input type="checkbox" id="disp_ann" name="disp_ann" $disp_ann /><label for="disp_ann"> Remove Annotations</label><br />
333
- <input type="checkbox" id="privacy" name="disp_privacy" $disp_privacy /><label for="privacy"> Enable privacy-enhanced mode [<a target="_blank" href="http://www.google.com/support/youtube/bin/answer.py?answer=141046">?</a>]</label>
334
  </div>
335
 
336
  <h3>Custom code compatibility</h3>
@@ -340,7 +353,7 @@ class SmartYouTube
340
  <label for="tag">Custom code</label>
341
 
342
  <h3>xHTML validation</h3>
343
- <p class="instruct">Enabling the option below will change default YouTube code to be xHTML valid.</p>
344
  <input id="valid" type="checkbox" name="valid" $valid />
345
  <label for="valid">Enable xHTML Validation</label>
346
 
@@ -387,7 +400,7 @@ END;
387
  $the_content = preg_replace("/http".$match[1].":\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/|#!v=)([a-zA-Z0-9\-\_]{11})([^\s<]*)/", $this->tag($match[4], $match[1], $match[5], $side), $the_content, 1);
388
  }
389
 
390
- preg_match_all("/http(vp):\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/view_play_list(\?p\=|\/v\/|#!v=)([a-zA-Z0-9\-\_]{16})([^<\s]*)/", $the_content, $matches, PREG_SET_ORDER);
391
  foreach ($matches as $match)
392
  {
393
  $the_content = preg_replace("/http".$match[1].":\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/view_play_list(\?p\=|\/v\/|#!v=)([a-zA-Z0-9\-\_]{16})([^\s<]*)/", $this->tag($match[4], $match[1], $match[5], $side), $the_content, 1);
@@ -447,6 +460,10 @@ END;
447
  case 'vp':
448
  $high = '';
449
  $playlist = 1;
 
 
 
 
450
  break;
451
  default:
452
  $high = '';
@@ -477,11 +494,19 @@ END;
477
  }
478
 
479
  $root_url = $this->options['privacy'] ? 'http://www.youtube-nocookie.com' : 'http://www.youtube.com';
480
-
 
 
 
 
 
481
  if ($playlist)
482
  {
483
- $video_url = htmlspecialchars("$root_url/p/$file&color1={$this->custom_colors[$disp_color][0]}&color2={$this->custom_colors[$disp_color][1]}&border=$disp_border&fs=1&hl=en&autoplay=$autoplay{$disp_info}$disp_ann&showsearch=$disp_search?rel=$disp_rel", ENT_QUOTES) . $high . $time;
484
- $yte_tag = <<<EOT
 
 
 
485
  <span class="youtube">
486
  <object type="application/x-shockwave-flash" width="$width" height="$height" data="$video_url" >
487
  <param name="movie" value="$video_url" />
@@ -493,22 +518,34 @@ EOT;
493
  }
494
  elseif ($valid == 'off' || strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone')===TRUE || strpos($_SERVER['HTTP_USER_AGENT'], 'iPod')===TRUE || strpos($_SERVER['HTTP_USER_AGENT'], 'iPad')===TRUE)
495
  {
496
- $video_url = htmlspecialchars("$root_url/v/$file&color1={$this->custom_colors[$disp_color][0]}&color2={$this->custom_colors[$disp_color][1]}&border=$disp_border&fs=1&hl=en&autoplay=$autoplay{$disp_info}$disp_ann&showsearch=$disp_search?rel=$disp_rel", ENT_QUOTES) . $high . $time;
 
 
 
 
 
 
497
  $yte_tag = <<<EOT
498
  <span class="youtube">
499
  <object width="$width" height="$height">
500
  <param name="movie" value="$video_url" />
501
  <param name="allowFullScreen" value="true" />
502
- <embed wmode="transparent" src="$video_url" type="application/x-shockwave-flash" allowfullscreen="true" width="$width" height="$height"></embed>
503
- <param name="wmode" value="transparent" />
504
  </object>
505
  </span>
506
  EOT;
507
  }
508
  else
509
  {
510
- $video_url = htmlspecialchars("$root_url/v/$file&color1={$this->custom_colors[$disp_color][0]}&color2={$this->custom_colors[$disp_color][1]}&border=$disp_border&fs=1&hl=en&autoplay=$autoplay{$disp_info}$disp_ann&showsearch=$disp_search?rel=$disp_rel", ENT_QUOTES) . $high . $time;
511
-
 
 
 
 
 
 
512
  $yte_tag = <<<EOT
513
  <span class="youtube">
514
  <object type="application/x-shockwave-flash" width="$width" height="$height" data="$video_url">
@@ -527,15 +564,19 @@ EOT;
527
  {
528
  $high = '&fmt=18';
529
  }
530
-
 
 
 
 
531
  if ($this->options['img'] == 'on')
532
  {
533
- $yte_tag .= '<p><a href="http://www.youtube.com/watch?v=' . $file . $high. '"><img src="http://img.youtube.com/vi/' . $file . '/default.jpg" width="130" height="97" border=0></a></p>';
534
  }
535
 
536
  if ($this->options['link'] == 'on')
537
  {
538
- $yte_tag.='<p><a href="http://www.youtube.com/watch?v=' . $file . $high . '">www.youtube.com/watch?v=' . $file . '</a></p>';
539
  }
540
  // if ($this->options['link'] == 'off' && $this->options['img'] == 'off')
541
  // $yte_tag='http://www.youtube.com/watch?v='.$file;
@@ -557,8 +598,10 @@ EOT;
557
  register_widget_control('Smart YouTube', array($this, 'widget_control'));
558
  }
559
 
560
- if (get_option($this->key)) return true;
561
-
 
 
562
  // upgrade the options format (as all-in-one, not single entries)
563
  $this->options = array(
564
  'posts' => 'on',
@@ -570,8 +613,8 @@ EOT;
570
  'heighthq' => 295,
571
  'widthside' => 150,
572
  'heightside' => 125,
573
- 'rel' => 1,
574
- 'color' => 'blank',
575
  'border' => 0,
576
  'link' => 'on',
577
  'valid' => 'off',
@@ -580,10 +623,11 @@ EOT;
580
  'ann' => 'on',
581
  'template' => '{video}',
582
  'autoplay' => 0,
583
- 'privacy' => 0,
584
  'wtext' => '',
585
  'wtitle' => '',
586
- 'tag' => ''
 
587
  );
588
 
589
  // migrate the old-fashion options
@@ -597,19 +641,69 @@ EOT;
597
  delete_option("smart_yt_$key");
598
  }
599
 
600
- add_option($this->key, $this->options);
601
  }
602
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
603
  function widget($args = array())
604
- {
605
- extract ($args);
606
- $text = $this->check($this->options['wtext'], 1);
607
- echo
608
- $before_widget,
609
- $before_title, $this->options['wtitle'], $after_title,
610
- $text,
611
- $after_widget;
612
- }
 
613
 
614
  function widget_control()
615
  {
@@ -682,4 +776,4 @@ EOT;
682
  return $status;
683
  }
684
  }
685
- }
14
 
15
  function __construct()
16
  {
17
+ $this->local_version = '3.8'; // TODO: Change this number???
18
  $this->custom_colors = array(
19
  'blank' => array('d6d6d6', 'f0f0f0'),
20
  'storm' => array('3a3a3a', '999999'),
66
 
67
  function options_page()
68
  {
69
+ /* $status = $this->get_info();
70
 
71
  $the_version = $status[1];
72
  $the_message = $status[3];
76
  $msg = 'Latest version available '.' <strong>'.$the_version.'</strong><br />'.$the_message;
77
  _e('<div id="message" class="updated fade"><p>' . $msg . '</p></div>');
78
  }
79
+ */
80
 
81
  // If form was submitted
82
  if (isset($_POST['submitted']))
109
 
110
  $this->options['posts'] = !isset($_POST['disp_posts']) ? 'off' : 'on';
111
  $this->options['comments'] = !isset($_POST['disp_comments']) ? 'off' : 'on';
112
+ $this->options['iframe'] = !isset($_POST['iframe']) ? 'off' : 'on';
113
 
114
  $this->options['template'] = !isset($_POST['disp_template']) ?
115
  '{video}' :
144
 
145
  $disp_autoplay = $this->options['autoplay'] ? 'checked="checked"' : '';
146
  $disp_rel = $this->options['rel'] ? 'checked="checked"' : '';
147
+ $disp_rel2 = $disp_rel == 'on' ? '' : 'checked="checked"';
148
  $disp_border = $this->options['border'] ? 'checked="checked"' : '';
149
  $disp_color = $this->options['color'];
150
  $disp_posts = $this->options['posts'] == 'on' ? 'checked="checked"' : '' ;
151
  $disp_comments = $this->options['comments'] == 'on' ? 'checked="checked"' : '';
152
 
153
+ $disp_privacy = $this->options['privacy'] ? 'checked="checked"' : '';
154
+ $iframe = $this->options['iframe'] =='on' ? 'checked="checked"' : '';
155
 
156
  $disp_template = wp_specialchars($this->options['template']);
157
  $tag = $this->options['tag'];
172
  $embed_img = $this->plugin_url . '/img/embed_selection-vfl29294.png';
173
 
174
  echo '<script src="' . $this->plugin_url . '/yt.js" type="text/javascript"></script>
175
+ <link rel="stylesheet" type="text/css" href="' . $this->plugin_url . '/styleyt.css" />';
176
 
177
  $imgpath = $this->plugin_url.'/i';
178
  $actionurl = $_SERVER['REQUEST_URI'];
182
  // Configuration Page
183
 
184
  echo <<<END
185
+ <div class="wrap smartyoutube" >
186
  <div id="icon-options-general" class="icon32"><br /></div>
187
  <h2>Smart YouTube</h2>
188
  <div id="poststuff" style="margin-top:10px;">
189
+ <div id="sideblock" style="float:right;width:270px;margin-left:10px;">
190
+
191
+ <iframe width=270 height=800 frameborder="0" src="http://www.prelovac.com/plugin/news.php?id=0&utm_source=plugin&utm_medium=plugin&utm_campaign=Smart%2BYoutube"></iframe>
192
+
193
+ </div>
 
 
 
 
 
 
 
194
 
195
  <div id="mainblock" style="width:710px">
196
  <div class="dbx-content">
208
  <li>httpv:// - regular video</li>
209
  <li>httpvh:// - high/HD quality</li>
210
  <li>httpvp:// - playlist</li>
211
+ <li>httpvhp:// - HD playlist</li>
212
  <li>[youtube=youtubeadresss] - supported for blogs migrated from wordpress.com</li>
213
  </ul>
214
  </div>
228
  <input id="check4" type="checkbox" name="disp_comments" $disp_comments />
229
  <label for="check4">Display videos in comments</label>
230
  </div>
231
+ <br />
232
+ <div>
233
+ <input id="iframe" type="checkbox" name="iframe" $iframe />
234
+ <label for="iframe">Use IFRAME embed code</label> [<a target="_blank" href="http://apiblog.youtube.com/2010/07/new-way-to-embed-youtube-videos.html">?</a>]
235
+ </div>
236
 
237
 
238
  <h3>Video Appearence</h3>
268
  <div></div>
269
  </div>
270
  </a>
271
+ <a v-width="960" v-height="745" href="#">
272
+ <span></span>
273
+ <div class="outer">
274
+ <div></div>
275
+ </div>
276
+ </a>
277
  <br clear="both" />
278
  </div>
279
 
305
  <div class="outer">
306
  <div></div>
307
  </div>
308
+ </a>
309
+ <a v-width="1280" v-height="745" href="#">
310
+ <span></span>
311
+ <div class="outer">
312
+ <div></div>
313
+ </div>
314
  </a>
315
  <br clear="both" />
316
  </div>
343
  <input type="checkbox" id="disp_search" name="disp_search" $disp_search /><label for="disp_search"> Display search box</label><br />
344
  <input type="checkbox" id="disp_info" name="disp_info" $disp_info /><label for="disp_info"> Remove Titles & Ratings</label><br />
345
  <input type="checkbox" id="disp_ann" name="disp_ann" $disp_ann /><label for="disp_ann"> Remove Annotations</label><br />
346
+ <input type="checkbox" id="privacy" name="disp_privacy" $disp_privacy /><label for="privacy"> Enable privacy-enhanced mode [<a target="_blank" href="http://www.google.com/support/youtube/bin/answer.py?answer=141046">?</a>] (videos may not work for Iphone users)</label>
347
  </div>
348
 
349
  <h3>Custom code compatibility</h3>
353
  <label for="tag">Custom code</label>
354
 
355
  <h3>xHTML validation</h3>
356
+ <p class="instruct">Enabling the option below will change default YouTube code to be xHTML valid. (videos may not work for Iphone users)</p>
357
  <input id="valid" type="checkbox" name="valid" $valid />
358
  <label for="valid">Enable xHTML Validation</label>
359
 
400
  $the_content = preg_replace("/http".$match[1].":\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/|#!v=)([a-zA-Z0-9\-\_]{11})([^\s<]*)/", $this->tag($match[4], $match[1], $match[5], $side), $the_content, 1);
401
  }
402
 
403
+ preg_match_all("/http(vp|vhp):\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/view_play_list(\?p\=|\/v\/|#!v=)([a-zA-Z0-9\-\_]{16})([^<\s]*)/", $the_content, $matches, PREG_SET_ORDER);
404
  foreach ($matches as $match)
405
  {
406
  $the_content = preg_replace("/http".$match[1].":\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/view_play_list(\?p\=|\/v\/|#!v=)([a-zA-Z0-9\-\_]{16})([^\s<]*)/", $this->tag($match[4], $match[1], $match[5], $side), $the_content, 1);
460
  case 'vp':
461
  $high = '';
462
  $playlist = 1;
463
+ break;
464
+ case 'vhp':
465
+ $high = '&amp;hd=1';
466
+ $playlist = 1;
467
  break;
468
  default:
469
  $high = '';
494
  }
495
 
496
  $root_url = $this->options['privacy'] ? 'http://www.youtube-nocookie.com' : 'http://www.youtube.com';
497
+
498
+ if ($this->options['iframe']=='on')
499
+ $video_url = htmlspecialchars("$root_url/embed/$file?color1={$this->custom_colors[$disp_color][0]}&color2={$this->custom_colors[$disp_color][1]}&border=$disp_border&fs=1&hl=en&autoplay=$autoplay{$disp_info}$disp_ann&showsearch=$disp_search&rel=$disp_rel", ENT_QUOTES) . $high . $time;
500
+ else
501
+ $video_url = htmlspecialchars("$root_url/v/$file?color1={$this->custom_colors[$disp_color][0]}&color2={$this->custom_colors[$disp_color][1]}&border=$disp_border&fs=1&hl=en&autoplay=$autoplay{$disp_info}$disp_ann&showsearch=$disp_search&rel=$disp_rel", ENT_QUOTES) . $high . $time;
502
+
503
  if ($playlist)
504
  {
505
+
506
+ $video_url = htmlspecialchars("$root_url/p/$file?color1={$this->custom_colors[$disp_color][0]}&color2={$this->custom_colors[$disp_color][1]}&border=$disp_border&fs=1&hl=en&autoplay=$autoplay{$disp_info}$disp_ann&showsearch=$disp_search&rel=$disp_rel", ENT_QUOTES) . $high . $time;
507
+
508
+
509
+ $yte_tag = <<<EOT
510
  <span class="youtube">
511
  <object type="application/x-shockwave-flash" width="$width" height="$height" data="$video_url" >
512
  <param name="movie" value="$video_url" />
518
  }
519
  elseif ($valid == 'off' || strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone')===TRUE || strpos($_SERVER['HTTP_USER_AGENT'], 'iPod')===TRUE || strpos($_SERVER['HTTP_USER_AGENT'], 'iPad')===TRUE)
520
  {
521
+ if ($this->options['iframe']=='on')
522
+ $yte_tag = <<<EOT
523
+ <span class="youtube">
524
+ <iframe title="YouTube video player" class="youtube-player" type="text/html" width="$width" height="$height" src="$video_url" frameborder="0"></iframe>
525
+ </span>
526
+ EOT;
527
+ else
528
  $yte_tag = <<<EOT
529
  <span class="youtube">
530
  <object width="$width" height="$height">
531
  <param name="movie" value="$video_url" />
532
  <param name="allowFullScreen" value="true" />
533
+ <param name="allowscriptaccess" value="always">
534
+ <embed src="$video_url" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="$width" height="$height"></embed>
535
  </object>
536
  </span>
537
  EOT;
538
  }
539
  else
540
  {
541
+
542
+ if ($this->options['iframe']=='on')
543
+ $yte_tag = <<<EOT
544
+ <span class="youtube">
545
+ <iframe title="YouTube video player" class="youtube-player" type="text/html" width="$width" height="$height" src="$video_url" frameborder="0"></iframe>
546
+ </span>
547
+ EOT;
548
+ else
549
  $yte_tag = <<<EOT
550
  <span class="youtube">
551
  <object type="application/x-shockwave-flash" width="$width" height="$height" data="$video_url">
564
  {
565
  $high = '&fmt=18';
566
  }
567
+ if ($playlist)
568
+ $url='http://www.youtube.com/view_play_list?p=';
569
+ else
570
+ $url='http://www.youtube.com/watch?v=';
571
+
572
  if ($this->options['img'] == 'on')
573
  {
574
+ $yte_tag .= '<p><a href="'.$url . $file . $high. '"><img src="http://img.youtube.com/vi/' . $file . '/default.jpg" width="130" height="97" border=0></a></p>';
575
  }
576
 
577
  if ($this->options['link'] == 'on')
578
  {
579
+ $yte_tag.='<p><a href="'.$url . $file . $high . '">www.youtube.com/watch?v=' . $file . '</a></p>';
580
  }
581
  // if ($this->options['link'] == 'off' && $this->options['img'] == 'off')
582
  // $yte_tag='http://www.youtube.com/watch?v='.$file;
598
  register_widget_control('Smart YouTube', array($this, 'widget_control'));
599
  }
600
 
601
+ if (get_option($this->key)) {
602
+ $this->options=$this->get_options();
603
+ }
604
+ /*
605
  // upgrade the options format (as all-in-one, not single entries)
606
  $this->options = array(
607
  'posts' => 'on',
613
  'heighthq' => 295,
614
  'widthside' => 150,
615
  'heightside' => 125,
616
+ 'rel' => 1,
617
+ 'color' => 'blank',
618
  'border' => 0,
619
  'link' => 'on',
620
  'valid' => 'off',
623
  'ann' => 'on',
624
  'template' => '{video}',
625
  'autoplay' => 0,
626
+ 'privacy' => 0,
627
  'wtext' => '',
628
  'wtitle' => '',
629
+ 'tag' => '',
630
+ 'iframe' => 'on'
631
  );
632
 
633
  // migrate the old-fashion options
641
  delete_option("smart_yt_$key");
642
  }
643
 
644
+ add_option($this->key, $this->options);*/
645
  }
646
 
647
+ // Handle our options
648
+ function get_options()
649
+ {
650
+
651
+ $options = array(
652
+ 'posts' => 'on',
653
+ 'comments' => 'off',
654
+ 'img' => 'off',
655
+ 'width' => 425,
656
+ 'height' => 344,
657
+ 'widthhq' => 480,
658
+ 'heighthq' => 295,
659
+ 'widthside' => 150,
660
+ 'heightside' => 125,
661
+ 'rel' => 1,
662
+ 'color' => 'blank',
663
+ 'border' => 0,
664
+ 'link' => 'on',
665
+ 'valid' => 'off',
666
+ 'search' => 'off',
667
+ 'info' => 'on',
668
+ 'ann' => 'on',
669
+ 'template' => '{video}',
670
+ 'autoplay' => 0,
671
+ 'privacy' => 0,
672
+ 'wtext' => '',
673
+ 'wtitle' => '',
674
+ 'tag' => '',
675
+ 'iframe' => ''
676
+ );
677
+
678
+ $saved = get_option($this->key);
679
+
680
+ if (!empty($saved)) {
681
+ foreach ($saved as $key => $option)
682
+ $options[$key] = $option;
683
+ }
684
+
685
+ if ($saved != $options)
686
+ update_option($this->key, $options);
687
+
688
+
689
+
690
+
691
+
692
+ return $options;
693
+ }
694
+
695
+
696
  function widget($args = array())
697
+ {
698
+ extract ($args);
699
+ $text = apply_filters( 'widget_text', $this->check($this->options['wtext'], 1));
700
+ $title = apply_filters( 'widget_title', $this->options['wtitle']);
701
+ echo
702
+ $before_widget,
703
+ $before_title, $title, $after_title,
704
+ $text,
705
+ $after_widget;
706
+ }
707
 
708
  function widget_control()
709
  {
776
  return $status;
777
  }
778
  }
779
+ }
smartyoutube.php CHANGED
@@ -4,44 +4,56 @@ Plugin Name: Smart Youtube
4
  Plugin URI: http://www.prelovac.com/vladimir/wordpress-plugins/smart-youtube
5
  Description: Insert YouTube videos in posts, comments and RSS feeds with ease and full customization.
6
  Author: Vladimir Prelovac
7
- Version: 3.7
8
  Author URI: http://www.prelovac.com/vladimir/
9
 
10
- Updates:
11
- 3.7 - wp3.0 compatibility
12
- 3.6.1 - Added Ipad compatbility (credits Lew Ayotte)
13
- 3.6 - Added compatibility with other youtube plugins such as wp-youtube ([yt]...[/yt] type code)
14
- 3.5 - Fixed Iphone issues
15
- 3.4.3 - Fixed privacy option
16
- 3.4.2 - Supports new #! style youtube urls
17
- 3.4.1 - Fixed widget
18
- 3.4 - Completely rewritten the plugin, added new HD video support, added video privacy option
19
- 3.3.2 - Fixed xHTML validation for playlists (credit Dietmar)
20
- 3.3.1 - Fixed Iphone validation (credit John Neumann)
21
- 3.3 - Supports migrated blogs from Wordpress.com replacing [youtube=youtubeadresss]
22
- 3.2 - Added title to widget, fixed HTML code issue with widget
23
- 3.1.1 - param closed properly for validation
24
- 3.1 - wmode transparent parameter updated to better handle transparancy
25
- 3.0 - Added video template, option to set sidebar video size, fixed sidebar widget code, fixed video syntax issue
26
- 2.8.1 - Display Annotioans added as option
27
- 2.8 - Support for playlists
28
- 2.7.5 - Plugin url updated to use WP_PLUGIN_URL
29
- 2.7.4 - Added option to remove info&ratings
30
- 2.7.3 - Removed annotiations
31
- 2.7 - Supports a sidebar widget for videos
32
- 2.6 - Added option to remove search button
33
- 2.5 - Added DVD quality support (httpvq)
34
- 2.4.1 - Small fixes in embed and rss links
35
- 2.4 - Added support for extra parameters like &start=50 to start the video at 50th second of play
36
- 2.2 - Full xHTML validaiton
37
- 2.1 - Made the application iPhone compatible and allowed full screen
38
- 2.0 - Support for playback high quality YouTube videos
39
- 1.9 - Added video autoplay option
40
- 1.8 - Solved Problem with HTML validation, enabled full video preview in RSS
41
- 1.6 - Solving a problem with wordpress handling special characters
42
- 1.5 - Added new admin interface and more options to control the video
43
 
44
  To-Do:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  - marinas javascript suggestion for hq videos
46
  - add editor button
47
  - The plugin places a preview image in the RSS feed which is great, but it links to the video on http://www.youtube.com. I would like to change it so the image links to the blog post so I can generate some traffic on my blog.
4
  Plugin URI: http://www.prelovac.com/vladimir/wordpress-plugins/smart-youtube
5
  Description: Insert YouTube videos in posts, comments and RSS feeds with ease and full customization.
6
  Author: Vladimir Prelovac
7
+ Version: 3.8
8
  Author URI: http://www.prelovac.com/vladimir/
9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
  To-Do:
12
+
13
+ - Is there a way to have smart youtube display multiple thumbnails of youtube videos in this fashion:
14
+ http://wordpress.org/extend/plugins/my-youtube-playlist/
15
+
16
+ The author of this plugin has done a good job in birthing the concept, but is unable to really do much by way of support or add features, e.g. highlight thumbnail currently playing, flexible grouping styles of thumbnails (horizontal, vertical listing) etc.
17
+
18
+ - Wondering if there's a way to have smartyoutube generate a thumbnail of the youtube video that shows up as one of the thumbnail options for the article when someone shares the blog post?
19
+
20
+ - Would it be possible to overwrite the global autoplay param in a post, something like httpv://www.youtube.com/watch?v=00000000&autoplay=true; I tried to add autoplay=1 but unfortunately in the resuling html it adds autoplay=0 (the global option) and also autoplay=1
21
+ The result is no autoplay :(
22
+
23
+ - Instead of editing the shortcut, we have copied from youtube.
24
+ I would love to have a button,
25
+ like insert Smart YouTube Video
26
+ A dialogue box would pop up,
27
+ and allow me to just simply paste the link.
28
+ Then having check boxes on the side,
29
+ which allow me to choose whether you would like HD or not.
30
+ thus editing the link correctly.
31
+
32
+ I find this would greatly help, especiall when I help create video blogs for community provider who have very little computer background.
33
+
34
+ - Please add support for it on the BuddyPress Acitivity page, currently it just shows the url (which won't work because of the httpv and httpvh)
35
+
36
+ - Was wondering if it was possible for you to have the plugin take the URL for the Youtube thumbnail for the video and place it into a user defined custom field. The plugin "YoutubeThumb2CustomField" but no longer works in WP 3.0 (network).
37
+
38
+ - love to see vimeo support! i have video intensive site...love Vimeo
39
+
40
+ Only issue is I would LOVE to add the widget into another sidebar and I do not see this possibility. Can you have multiple Smart YouTubes?
41
+
42
+ - 1. Adding few possibilities for posting videos into post � I have great production of videos but before end of 2009 all was in 320 x 240 and after end of 2009 I start publishing video in 640 x 480 resolution. I have adjusted player video for 640 x 480 but now 320 x 240 videos are stretched across all of player window.
43
+
44
+ For changes to be easy implemented � I suggest adding 2 or even 3 possibilities for playing videos � like this:
45
+ Your original code httpv://www.youtube.com/********************
46
+ Another version of httpv#1://www.youtube.com/********************
47
+ Another version of httpv#2://www.youtube.com/********************
48
+ Another version of httpv#3://www.youtube.com/********************
49
+
50
+ Adding #1 after v will allow us to predefine what will be size of player for #1 or number #2 or number #3 � I think it is good idea
51
+
52
+ If you don�t put #1, #2, #3 player will be those which is default (without number) � in my case that is 640 x 480.
53
+
54
+ 2. If some video is for �personal use� which mean somebody must be log into you tube to see it, than I suggest making possibility for login for authors of those videos � If I put all my materials to be private (up to 25 people can see it) � than I cant publish them trough this way � and allowing authors to write theirs username and password will allow that those vides can be seen on my posts. That way I can protect all my archive of video on youtube, but allow those video can be visible on my blog � which can increase hits, visits and others possibility � that possibility is visible on this plug in http://tubepress.org/ where people can use its username and password for publishing all vides from if they have account on youtube
55
+
56
+
57
  - marinas javascript suggestion for hq videos
58
  - add editor button
59
  - The plugin places a preview image in the RSS feed which is great, but it links to the video on http://www.youtube.com. I would like to change it so the image links to the blog post so I can generate some traffic on my blog.
style.css → styleyt.css RENAMED
@@ -129,9 +129,7 @@ text-decoration:none;
129
 
130
  #sideblock
131
  {
132
- padding: 10px 0 10px 10px;
133
- background: #fdffee;
134
- border: 1px solid #ddd;
135
  }
136
 
137
  #sideblock h2
@@ -154,7 +152,8 @@ h5.author
154
  border: 1px solid #ddd;
155
  padding: 5px;
156
  margin: 3px 0 10px;
157
- width: 400px;
 
158
  }
159
 
160
  .size-chooser a
@@ -210,4 +209,4 @@ h5.author
210
  {
211
  font-size: 10px;
212
  font-style: normal;
213
- }
129
 
130
  #sideblock
131
  {
132
+
 
 
133
  }
134
 
135
  #sideblock h2
152
  border: 1px solid #ddd;
153
  padding: 5px;
154
  margin: 3px 0 10px;
155
+ width: 560px;
156
+ height:125px;
157
  }
158
 
159
  .size-chooser a
209
  {
210
  font-size: 10px;
211
  font-style: normal;
212
+ }