Smart YouTube PRO - Version 2.5

Version Description

Download this release

Release Info

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

Code changes from version 2.4.1 to 2.5

Files changed (2) hide show
  1. readme.txt +6 -2
  2. smartyoutube.php +24 -15
readme.txt CHANGED
@@ -22,7 +22,7 @@ The plugin is designed to be small and fast and not use any external resources.
22
  Main Features:
23
 
24
  * Easily embeds YouTube videos
25
- * Supports YouTube high quality video protocol
26
  * Supports video deep linking (starting at desired point with &start=time parameter)
27
  * Has an option to show video thumbnail picture in your RSS feed
28
  * Works on iPod and iPhone
@@ -32,6 +32,9 @@ Main Features:
32
 
33
 
34
  Change Log:
 
 
 
35
  v2.4:
36
  - Supports video deep linking. Just add &start=time parameter at the end of url. For example httpv://www.youtube.com/watch?v=OWfksMD4PAg&start=30 will start the video 30 seconds in
37
 
@@ -65,7 +68,8 @@ The video will be automatically embedded to your post in the proper way.
65
 
66
  Example: httpv://www.youtube.com/watch?v=OWfksMD4PAg
67
 
68
- If you want to post a high quality video (not all youtube videos exist in high quality mode so check this first) you would use httpvh:// ('vh' for video high)
 
69
 
70
  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.
71
 
22
  Main Features:
23
 
24
  * Easily embeds YouTube videos
25
+ * Supports latest high quality video protocols (360p and HD quality 720p)
26
  * Supports video deep linking (starting at desired point with &start=time parameter)
27
  * Has an option to show video thumbnail picture in your RSS feed
28
  * Works on iPod and iPhone
32
 
33
 
34
  Change Log:
35
+ v2.5:
36
+ - Support for 720p HD (DVD quality) YouTube videos. Use httpvhd://
37
+
38
  v2.4:
39
  - Supports video deep linking. Just add &start=time parameter at the end of url. For example httpv://www.youtube.com/watch?v=OWfksMD4PAg&start=30 will start the video 30 seconds in
40
 
68
 
69
  Example: httpv://www.youtube.com/watch?v=OWfksMD4PAg
70
 
71
+ If you want to post a high quality video (check if the video exists first!) you would use httpvh:// ('vh' for video high)
72
+ If you want to post a HD (DVD quality, 720p) quality video you would use httpvhd:// ('vhd' for video high definition)
73
 
74
  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.
75
 
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: Easily insert YouTube videos in posts, comments and RSS feeds.
6
  Author: Vladimir Prelovac
7
- Version: 2.4.1
8
  Author URI: http://www.prelovac.com/vladimir/
9
 
10
  Updates:
 
11
  2.4.1 - Small fixes in embed and rss links
12
  2.4 - Added support for extra parameters like &start=50 to start the video at 50th second of play
13
  2.2 - Full xHTML validaiton
@@ -23,7 +24,7 @@ To-Doo:
23
  - localization
24
  */
25
 
26
- $yte_localversion="2.3.2";
27
 
28
  $CustomColors=array (
29
  "blank" => array("d6d6d6","f0f0f0"),
@@ -317,7 +318,8 @@ text-decoration:none;
317
  <p>To use the video in your posts, paste YouTube video URL with <strong>httpv://</strong> (notice the 'v'). </p>
318
  <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>
319
  <p>Example: httpv://www.youtube.com/watch?v=OWfksMD4PAg</p>
320
- <p>If you want to embed high quality video (for thuse videos that have their HQ counterparts) use httpvh:// instead (video high).</p>
 
321
 
322
  <h3>Options</h3>
323
  <p> You can adjust the way your embeded youtube videos behave in the options below.</p>
@@ -403,11 +405,10 @@ add_action('admin_menu', 'yte_add_pages');
403
 
404
 
405
 
406
- function yte_tag($file, $high=0, $time = "") {
407
  global $CustomColors;
408
 
409
- $width=$high ? get_option('smart_yt_widthhq') : get_option('smart_yt_width');
410
- $height=$high ? get_option('smart_yt_heighthq') : get_option('smart_yt_height');
411
 
412
  $disp_rel = get_option('smart_yt_rel');
413
  $disp_border = get_option('smart_yt_border');
@@ -416,12 +417,23 @@ global $CustomColors;
416
 
417
  $valid=get_option('smart_yt_valid');
418
 
419
- $high= $high ? "&amp;ap=%2526fmt%3D18" : "" ;
 
 
 
 
 
 
 
 
 
 
420
 
421
  if ($width=="")
422
- $width=$high ? "480" : "425" ;
423
  if ($height=="")
424
- $height= $high ? "360" : "344";
 
425
 
426
  if ($disp_border)
427
  $height+=18;
@@ -458,16 +470,13 @@ function yte_check($the_content) {
458
  $replacements = array("x");
459
  $the_content=str_replace($char_codes, $replacements, $the_content);
460
 
461
- preg_match_all("/httpv:\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/)([a-zA-Z0-9\-\_]{11})([^<\s]*)/", $the_content, $matches, PREG_SET_ORDER);
462
  foreach($matches as $match) {
463
- $the_content = preg_replace("/httpv:\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/)([a-zA-Z0-9\-\_]{11})([^\s<]*)/", yte_tag($match[3], 0, $match[4]), $the_content, 1);
 
464
  }
465
 
466
- preg_match_all("/httpvh:\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/)([a-zA-Z0-9\-\_]{11})([^<\s]*)/", $the_content, $matches, PREG_SET_ORDER);
467
- foreach($matches as $match) {
468
 
469
- $the_content = preg_replace("/httpvh:\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/)([a-zA-Z0-9\-\_]{11})([^\s<]*)/", yte_tag($match[3], 1), $the_content, 1);
470
- }
471
  }
472
  return $the_content;
473
  }
4
  Plugin URI: http://www.prelovac.com/vladimir/wordpress-plugins/smart-youtube
5
  Description: Easily insert YouTube videos in posts, comments and RSS feeds.
6
  Author: Vladimir Prelovac
7
+ Version: 2.5
8
  Author URI: http://www.prelovac.com/vladimir/
9
 
10
  Updates:
11
+ 2.5 - Added DVD quality support (httpvq)
12
  2.4.1 - Small fixes in embed and rss links
13
  2.4 - Added support for extra parameters like &start=50 to start the video at 50th second of play
14
  2.2 - Full xHTML validaiton
24
  - localization
25
  */
26
 
27
+ $yte_localversion="2.5";
28
 
29
  $CustomColors=array (
30
  "blank" => array("d6d6d6","f0f0f0"),
318
  <p>To use the video in your posts, paste YouTube video URL with <strong>httpv://</strong> (notice the 'v'). </p>
319
  <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>
320
  <p>Example: httpv://www.youtube.com/watch?v=OWfksMD4PAg</p>
321
+ <p>If you want to embed high quality video (for thuse videos that have their HQ counterparts) use httpvh:// instead (Video High).</p>
322
+ <p>If you want to embed HD Quality (DVD quality 720p) video use httpvhd:// instead (Video High Defintion).</p>
323
 
324
  <h3>Options</h3>
325
  <p> You can adjust the way your embeded youtube videos behave in the options below.</p>
405
 
406
 
407
 
408
+ function yte_tag($file, $high='v', $time = "") {
409
  global $CustomColors;
410
 
411
+
 
412
 
413
  $disp_rel = get_option('smart_yt_rel');
414
  $disp_border = get_option('smart_yt_border');
417
 
418
  $valid=get_option('smart_yt_valid');
419
 
420
+
421
+ switch ($high)
422
+ {
423
+ case 'v': $high=""; break;
424
+ case 'vh': $high="&amp;ap=%2526fmt%3D18"; break;
425
+ case 'vhd': $high="&amp;ap=%2526fmt%3D22"; break;
426
+ default : $high=""; break;
427
+ }
428
+
429
+ $width=$high ? get_option('smart_yt_widthhq') : get_option('smart_yt_width');
430
+ $height=$high ? get_option('smart_yt_heighthq') : get_option('smart_yt_height');
431
 
432
  if ($width=="")
433
+ $width=$high!="" ? "480" : "425" ;
434
  if ($height=="")
435
+ $height= $high!="" ? "360" : "344";
436
+
437
 
438
  if ($disp_border)
439
  $height+=18;
470
  $replacements = array("x");
471
  $the_content=str_replace($char_codes, $replacements, $the_content);
472
 
473
+ preg_match_all("/http(v|vh|vhd):\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/)([a-zA-Z0-9\-\_]{11})([^<\s]*)/", $the_content, $matches, PREG_SET_ORDER);
474
  foreach($matches as $match) {
475
+
476
+ $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);
477
  }
478
 
 
 
479
 
 
 
480
  }
481
  return $the_content;
482
  }