Smart YouTube PRO - Version 2.8

Version Description

Download this release

Release Info

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

Code changes from version 2.7.5 to 2.8

Files changed (2) hide show
  1. readme.txt +12 -4
  2. smartyoutube.php +30 -12
readme.txt CHANGED
@@ -11,17 +11,18 @@ Smart Youtube plugin allows you to insert full featured YouTube videos into your
11
 
12
  == Description ==
13
 
14
- Smart Youtube is a Wordpress Youtube Plugin that allows you to easily insert Youtube videos in your post, comments and in RSS feed.
15
 
16
  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.
17
 
18
- From version 2.0 Smart youtube also supports playback of high quality videos, works on iPhone, produces xHTML valid code (unlike YouTUbe embed code) and allows you to view videos in fullscreen.
19
 
20
  The plugin is designed to be small and fast and not use any external resources. It has a number of customizable options.
21
 
22
  Main Features:
23
 
24
  * Easily embeds YouTube videos
 
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)
@@ -33,6 +34,9 @@ Main Features:
33
 
34
  Change Log:
35
 
 
 
 
36
  v2.7.5
37
  - WP_PLUGIN_URL used
38
 
@@ -61,7 +65,7 @@ v2.2:
61
  - Full xHTML validation
62
 
63
 
64
- Plugin by Vladimir Prelovac. Need a <a href="http://www.prelovac.com/vladimir/services">WordPress Consultant</a>?
65
 
66
  == Credits ==
67
 
@@ -87,6 +91,10 @@ Example: httpv://www.youtube.com/watch?v=OWfksMD4PAg
87
  If you want to post a high quality video (check if the video exists first!) you would use httpvh:// ('vh' for video high)
88
  If you want to post a HD (DVD quality, 720p) quality video you would use httpvhd:// ('vhd' for video high definition)
89
 
 
 
 
 
90
  Additionally, you can set how do you want the video to be displayed in your RSS feed. Smart Youtube can show the preview image of the video (automatically grabbed from Youtube), the link to the video, or both. I recommend enabling only the preview image.
91
 
92
  == Screenshots ==
@@ -122,4 +130,4 @@ Of course, visit <a href="http://www.prelovac.com/vladimir/wordpress-plugins/sma
122
 
123
  = I love your work, are you available for hire? =
124
 
125
- Yes I am, visit my <a href="http://www.prelovac.com/vladimir/services">WordPress Services</a> page to find out more.
11
 
12
  == Description ==
13
 
14
+ Smart Youtube is a Wordpress Youtube Plugin that allows you to easily insert Youtube videos/playlists in your post, comments and in RSS feed.
15
 
16
  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.
17
 
18
+ From version 2.0 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.
19
 
20
  The plugin is designed to be small and fast and not use any external resources. It has a number of customizable options.
21
 
22
  Main Features:
23
 
24
  * Easily embeds YouTube videos
25
+ * Embed YouTube playlist
26
  * Supports latest high quality video protocols (360p and HD quality 720p)
27
  * Allows full YouTube customization (colors, border, full screen...)
28
  * Supports video deep linking (starting at desired point with &start=time parameter)
34
 
35
  Change Log:
36
 
37
+ v2.8
38
+ - Supports Playlists
39
+
40
  v2.7.5
41
  - WP_PLUGIN_URL used
42
 
65
  - Full xHTML validation
66
 
67
 
68
+ Plugin by Vladimir Prelovac. Looking for <a href="http://www.prelovac.com/vladimir/services">WordPress Consulting</a>?
69
 
70
  == Credits ==
71
 
91
  If you want to post a high quality video (check if the video exists first!) you would use httpvh:// ('vh' for video high)
92
  If you want to post a HD (DVD quality, 720p) quality video you would use httpvhd:// ('vhd' for video high definition)
93
 
94
+ To embed a playlist use extension 'vp'
95
+
96
+ httpvp://www.youtube.com/view_play_list?p=528026B4F7B34094
97
+
98
  Additionally, you can set how do you want the video to be displayed in your RSS feed. Smart Youtube can show the preview image of the video (automatically grabbed from Youtube), the link to the video, or both. I recommend enabling only the preview image.
99
 
100
  == Screenshots ==
130
 
131
  = I love your work, are you available for hire? =
132
 
133
+ Yes I am, visit my <a href="http://www.prelovac.com/vladimir/services">WordPress Consulting</a> page to find out more.
smartyoutube.php CHANGED
@@ -4,10 +4,11 @@ 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: 2.7.5
8
  Author URI: http://www.prelovac.com/vladimir/
9
 
10
  Updates:
 
11
  2.7.5 - Plugin url updated to use WP_PLUGIN_URL
12
  2.7.4 - Added option to remove info&ratings
13
  2.7.3 - Removed annotiations
@@ -25,7 +26,6 @@ Updates:
25
  1.5 - Added new admin interface and more options to control the video
26
 
27
  To-Doo:
28
- - play playlists
29
  - marinas javascript suggestion for hq videos
30
  - add editor button
31
  - 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.
@@ -340,11 +340,17 @@ text-decoration:none;
340
  <h2>Usage</h2>
341
 
342
  <p>To use the video in your posts, paste YouTube video URL with <strong>httpv://</strong> (notice the 'v'). </p>
343
- <p><strong>Important:</strong> The URL should just be copied into your post normally and the letter 'v' added, do not create a link of it.</p>
344
  <p>Example: httpv://www.youtube.com/watch?v=OWfksMD4PAg</p>
345
- <p>If you want to embed high quality video (for thuse videos that have their HQ counterparts) use httpvh:// instead (Video High).</p>
346
  <p>If you want to embed HD Quality (DVD quality 720p) video use httpvhd:// instead (Video High Defintion).</p>
347
-
 
 
 
 
 
 
348
  <h2>Options</h2>
349
  <p> You can adjust the way your embeded youtube videos behave in the options below.</p>
350
  <p><strong>Video settings</strong></p>
@@ -436,7 +442,7 @@ add_action('admin_menu', 'yte_add_pages');
436
  function yte_tag($file, $high='v', $time = "") {
437
  global $CustomColors;
438
 
439
-
440
 
441
  $disp_rel = get_option('smart_yt_rel');
442
  $disp_border = get_option('smart_yt_border');
@@ -454,6 +460,7 @@ global $CustomColors;
454
  case 'v': $high=""; break;
455
  case 'vh': $high="&amp;ap=%2526fmt%3D18"; break;
456
  case 'vhd': $high="&amp;ap=%2526fmt%3D22"; break;
 
457
  default : $high=""; break;
458
  }
459
 
@@ -471,12 +478,16 @@ global $CustomColors;
471
 
472
 
473
  // if ( strpos($_SERVER['HTTP_USER_AGENT'], "iPhone") || strpos($_SERVER['HTTP_USER_AGENT'], "iPod") )
474
-
475
- if ($valid=="off")
476
- $yte_tag = '<!-- Smart Youtube --><span class="youtube"><object width="'.$width.'" height="'.$height.'"><param name="movie" value="'.htmlspecialchars('http://www.youtube.com/v/'.$file.'&rel='.$disp_rel.'&color1='.$CustomColors[$disp_color][0].'&color2='.$CustomColors[$disp_color][1].'&border='.$disp_border.'&fs=1&hl=en&autoplay='.$autoplay.$disp_info.'&iv_load_policy=3&showsearch='.$disp_search, ENT_QUOTES).$high.$time.'"></param><param name="allowFullScreen" value="true"></param><embed src="'.htmlspecialchars('http://www.youtube.com/v/'.$file.'&rel='.$disp_rel.'&color1='.$CustomColors[$disp_color][0].'&color2='.$CustomColors[$disp_color][1].'&border='.$disp_border.'&fs=1&hl=en&autoplay='.$autoplay.$disp_info.'&iv_load_policy=3&showsearch='.$disp_search, ENT_QUOTES).$high.$time.'" type="application/x-shockwave-flash" allowfullscreen="true" width="'.$width.'" height="'.$height.'" ></embed><param name="wmode" value="transparent" /></object></span>';
477
- else
478
- $yte_tag = '<!-- Smart Youtube --><span class="youtube"><object type="application/x-shockwave-flash" width="'.$width.'" height="'.$height.'" data="'.htmlspecialchars('http://www.youtube.com/v/'.$file.'&rel='.$disp_rel.'&color1='.$CustomColors[$disp_color][0].'&color2='.$CustomColors[$disp_color][1].'&border='.$disp_border.'&fs=1&hl=en&autoplay='.$autoplay.$disp_info.'&iv_load_policy=3&showsearch='.$disp_search, ENT_QUOTES).$high.$time.'"><param name="movie" value="'.htmlspecialchars('http://www.youtube.com/v/'.$file.'&rel='.$disp_rel.'&color1='.$CustomColors[$disp_color][0].'&color2='.$CustomColors[$disp_color][1].'&border='.$disp_border.'&fs=1&hl=en&autoplay='.$autoplay.$disp_info.'&iv_load_policy=3&showsearch='.$disp_search, ENT_QUOTES).$high.$time.'"></param><param name="allowFullScreen" value="true"></param><param name="wmode" value="transparent" /></object></span>';
479
-
 
 
 
 
480
 
481
 
482
  if (is_feed())
@@ -507,8 +518,15 @@ function yte_check($the_content) {
507
  $the_content = preg_replace("/http".$match[1].":\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/)([a-zA-Z0-9\-\_]{11})([^\s<]*)/", yte_tag($match[4], $match[1], $match[5]), $the_content, 1);
508
  }
509
 
 
 
 
 
 
510
 
511
  }
 
 
512
  return $the_content;
513
  }
514
 
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: 2.8
8
  Author URI: http://www.prelovac.com/vladimir/
9
 
10
  Updates:
11
+ 2.8 - Support for playlists
12
  2.7.5 - Plugin url updated to use WP_PLUGIN_URL
13
  2.7.4 - Added option to remove info&ratings
14
  2.7.3 - Removed annotiations
26
  1.5 - Added new admin interface and more options to control the video
27
 
28
  To-Doo:
 
29
  - marinas javascript suggestion for hq videos
30
  - add editor button
31
  - 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.
340
  <h2>Usage</h2>
341
 
342
  <p>To use the video in your posts, paste YouTube video URL with <strong>httpv://</strong> (notice the 'v'). </p>
343
+ <p><strong>Important:</strong> The URL should just be copied into your post normally and the letter 'v' added, do not create a clickable link!</p>
344
  <p>Example: httpv://www.youtube.com/watch?v=OWfksMD4PAg</p>
345
+ <p>If you want to embed high quality video (for videos that have them) use httpvh:// instead (Video High).</p>
346
  <p>If you want to embed HD Quality (DVD quality 720p) video use httpvhd:// instead (Video High Defintion).</p>
347
+ <p>To embed playlists use httpvp:// (eg. httpvp://www.youtube.com/view_play_list?p=528026B4F7B34094)</p>
348
+ <ul>
349
+ <li>httpv:// - regular video</li>
350
+ <li>httpvh:// - high quality</li>
351
+ <li>httpvhd:// - HD quality</li>
352
+ <li>httpvp:// - playlist</li>
353
+ </ul>
354
  <h2>Options</h2>
355
  <p> You can adjust the way your embeded youtube videos behave in the options below.</p>
356
  <p><strong>Video settings</strong></p>
442
  function yte_tag($file, $high='v', $time = "") {
443
  global $CustomColors;
444
 
445
+ $playlist=0;
446
 
447
  $disp_rel = get_option('smart_yt_rel');
448
  $disp_border = get_option('smart_yt_border');
460
  case 'v': $high=""; break;
461
  case 'vh': $high="&amp;ap=%2526fmt%3D18"; break;
462
  case 'vhd': $high="&amp;ap=%2526fmt%3D22"; break;
463
+ case 'vp': $high=""; $playlist=1; break;
464
  default : $high=""; break;
465
  }
466
 
478
 
479
 
480
  // if ( strpos($_SERVER['HTTP_USER_AGENT'], "iPhone") || strpos($_SERVER['HTTP_USER_AGENT'], "iPod") )
481
+ if ($playlist)
482
+ {
483
+ $yte_tag = '<!-- Smart Youtube --><span class="youtube"><object width="'.$width.'" height="'.$height.'"><param name="movie" value="'.htmlspecialchars('http://www.youtube.com/p/'.$file.'&rel='.$disp_rel.'&color1='.$CustomColors[$disp_color][0].'&color2='.$CustomColors[$disp_color][1].'&border='.$disp_border.'&fs=1&hl=en&autoplay='.$autoplay.$disp_info.'&iv_load_policy=3&showsearch='.$disp_search, ENT_QUOTES).$high.$time.'"></param><param name="allowFullScreen" value="true"></param><embed src="'.htmlspecialchars('http://www.youtube.com/p/'.$file.'&rel='.$disp_rel.'&color1='.$CustomColors[$disp_color][0].'&color2='.$CustomColors[$disp_color][1].'&border='.$disp_border.'&fs=1&hl=en&autoplay='.$autoplay.$disp_info.'&iv_load_policy=3&showsearch='.$disp_search, ENT_QUOTES).$high.$time.'" type="application/x-shockwave-flash" allowfullscreen="true" width="'.$width.'" height="'.$height.'" ></embed><param name="wmode" value="transparent" /></object></span>';
484
+ }
485
+ else {
486
+ if ($valid=="off")
487
+ $yte_tag = '<!-- Smart Youtube --><span class="youtube"><object width="'.$width.'" height="'.$height.'"><param name="movie" value="'.htmlspecialchars('http://www.youtube.com/v/'.$file.'&rel='.$disp_rel.'&color1='.$CustomColors[$disp_color][0].'&color2='.$CustomColors[$disp_color][1].'&border='.$disp_border.'&fs=1&hl=en&autoplay='.$autoplay.$disp_info.'&iv_load_policy=3&showsearch='.$disp_search, ENT_QUOTES).$high.$time.'"></param><param name="allowFullScreen" value="true"></param><embed src="'.htmlspecialchars('http://www.youtube.com/v/'.$file.'&rel='.$disp_rel.'&color1='.$CustomColors[$disp_color][0].'&color2='.$CustomColors[$disp_color][1].'&border='.$disp_border.'&fs=1&hl=en&autoplay='.$autoplay.$disp_info.'&iv_load_policy=3&showsearch='.$disp_search, ENT_QUOTES).$high.$time.'" type="application/x-shockwave-flash" allowfullscreen="true" width="'.$width.'" height="'.$height.'" ></embed><param name="wmode" value="transparent" /></object></span>';
488
+ else
489
+ $yte_tag = '<!-- Smart Youtube --><span class="youtube"><object type="application/x-shockwave-flash" width="'.$width.'" height="'.$height.'" data="'.htmlspecialchars('http://www.youtube.com/v/'.$file.'&rel='.$disp_rel.'&color1='.$CustomColors[$disp_color][0].'&color2='.$CustomColors[$disp_color][1].'&border='.$disp_border.'&fs=1&hl=en&autoplay='.$autoplay.$disp_info.'&iv_load_policy=3&showsearch='.$disp_search, ENT_QUOTES).$high.$time.'"><param name="movie" value="'.htmlspecialchars('http://www.youtube.com/v/'.$file.'&rel='.$disp_rel.'&color1='.$CustomColors[$disp_color][0].'&color2='.$CustomColors[$disp_color][1].'&border='.$disp_border.'&fs=1&hl=en&autoplay='.$autoplay.$disp_info.'&iv_load_policy=3&showsearch='.$disp_search, ENT_QUOTES).$high.$time.'"></param><param name="allowFullScreen" value="true"></param><param name="wmode" value="transparent" /></object></span>';
490
+ }
491
 
492
 
493
  if (is_feed())
518
  $the_content = preg_replace("/http".$match[1].":\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/)([a-zA-Z0-9\-\_]{11})([^\s<]*)/", yte_tag($match[4], $match[1], $match[5]), $the_content, 1);
519
  }
520
 
521
+ preg_match_all("/http(vp):\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/view_play_list(\?p\=|\/v\/)([a-zA-Z0-9\-\_]{16})([^<\s]*)/", $the_content, $matches, PREG_SET_ORDER);
522
+ foreach($matches as $match) {
523
+ $the_content = preg_replace("/http".$match[1].":\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/view_play_list(\?p\=|\/v\/)([a-zA-Z0-9\-\_]{16})([^\s<]*)/", yte_tag($match[4], $match[1], $match[5]), $the_content, 1);
524
+ }
525
+
526
 
527
  }
528
+
529
+
530
  return $the_content;
531
  }
532