Smart YouTube PRO - Version 3.6

Version Description

  • Added compatibility with other Youtube plugins such as wp-youtube ([yt]...[/yt] type code)
Download this release

Release Info

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

Code changes from version 3.4.3 to 3.6

Files changed (4) hide show
  1. readme.txt +7 -0
  2. screenshot-1.png +0 -0
  3. smartyoutube.class.php +51 -55
  4. smartyoutube.php +3 -1
readme.txt CHANGED
@@ -27,6 +27,7 @@ Main Features:
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
  * Provides a sidebar widget for videos as well
31
  * Produces xHTML valid code
32
  * Very fast and light, no extra scripts needed
@@ -36,6 +37,12 @@ Plugin by Vladimir Prelovac. Looking for <a href="http://www.prelovac.com/vladim
36
 
37
  == Changelog ==
38
 
 
 
 
 
 
 
39
  = 3.4.3 =
40
  * Fixed privacy option
41
  * Supports new #! style Youtube URLs
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
32
  * Produces xHTML valid code
33
  * Very fast and light, no extra scripts needed
37
 
38
  == Changelog ==
39
 
40
+ = 3.6 =
41
+ * Added compatibility with other Youtube plugins such as wp-youtube ([yt]...[/yt] type code)
42
+
43
+ = 3.5 =
44
+ * Fixed Iphone Issues
45
+
46
  = 3.4.3 =
47
  * Fixed privacy option
48
  * Supports new #! style Youtube URLs
screenshot-1.png CHANGED
Binary file
smartyoutube.class.php CHANGED
@@ -113,6 +113,7 @@ class SmartYouTube
113
  $this->options['template'] = !isset($_POST['disp_template']) ?
114
  '{video}' :
115
  stripslashes(htmlspecialchars($_POST['disp_template']));;
 
116
 
117
  update_option($this->key, $this->options);
118
 
@@ -151,6 +152,8 @@ class SmartYouTube
151
  $disp_privacy = $this->options['privacy'] ? 'checked="checked"' : '';
152
 
153
  $disp_template = wp_specialchars($this->options['template']);
 
 
154
 
155
  if (!$disp_width)
156
  {
@@ -330,8 +333,14 @@ class SmartYouTube
330
  <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>
331
  </div>
332
 
 
 
 
 
 
 
333
  <h3>xHTML validation</h3>
334
- <p class="instruct">Enabling the option below will make your YouTube code xHTML valid. </p>
335
  <input id="valid" type="checkbox" name="valid" $valid />
336
  <label for="valid">Enable xHTML Validation</label>
337
 
@@ -350,7 +359,7 @@ class SmartYouTube
350
  </div>
351
  </div>
352
  </div>
353
- <h5 class="author">Another fine plugin by <a href="http://www.prelovac.com/vladimir/">Vladimir Prelovac</a></h5>
354
  END;
355
  }
356
 
@@ -392,6 +401,17 @@ END;
392
  $the_content = preg_replace("/\[youtube\=http:\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/|#!v=)([a-zA-Z0-9\-\_]{11})([^\s<]*)\]/", $this->tag($match[3], '', $match[4], $side), $the_content, 1);
393
  }
394
  }
 
 
 
 
 
 
 
 
 
 
 
395
 
396
  return $the_content;
397
  }
@@ -458,51 +478,27 @@ END;
458
  {
459
  $video_url = htmlspecialchars("$root_url/p/$file&rel=$disp_rel&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", ENT_QUOTES) . $high . $time;
460
  $yte_tag = <<<EOT
461
- <!-- Smart Youtube -->
462
- <span class="youtube">
463
- <object type="application/x-shockwave-flash" width="$width" height="$height" data="$video_url" >
464
- <param name="movie" value="$video_url" />
465
- <param name="allowFullScreen" value="true" />
466
- <param name="allowscriptaccess" value="always" />
467
- </object>
468
- </span>
469
  EOT;
470
- }
471
- // This was added to check for iPhone and iPod devices and checks to see if having valid xhtml is on. If valid xhtml is on then the iPhone/iPod will not see the video, so instead we just output the same code that we would if the valid flag was off. This allows us to serve up valid xhtml for our web users and non-valid xhtml to our iPhone/iPod users so they can still enjoy the experience.
472
- elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone') || strpos($_SERVER['HTTP_USER_AGENT'], 'iPod') && $valid == 'on')
473
- {
474
- $video_url = htmlspecialchars("$root_url/v/$file&rel=$disp_rel&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", ENT_QUOTES) . $high . $time;
475
-
476
- $yte_tag = <<<EOT
477
- <!-- Smart Youtube -->
478
- <span class="youtube">
479
- <object type="application/x-shockwave-flash" width="$width" height="$height" data="$video_url">
480
- <param name="movie" value="$video_url" />
481
- <param name="allowFullScreen" value="true" />
482
- <param name="wmode" value="transparent" />
483
- </object>
484
- </span>
485
- EOT;
486
- }
487
- elseif ($valid == 'off')
488
  {
489
  $video_url = htmlspecialchars("$root_url/v/$file&rel=$disp_rel&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", ENT_QUOTES) . $high . $time;
490
  $yte_tag = <<<EOT
491
- <!-- Smart Youtube -->
492
- <span class="youtube">
493
- <object width="$width" height="$height">
494
- <param name="movie" value="$video_url" />
495
- <param name="allowFullScreen" value="true" />
496
- <embed wmode="transparent"
497
- src="$video_url"
498
- type="application/x-shockwave-flash"
499
- allowfullscreen="true"
500
- width="$width"
501
- height="$height">
502
- </embed>
503
- <param name="wmode" value="transparent" />
504
- </object>
505
- </span>
506
  EOT;
507
  }
508
  else
@@ -510,14 +506,13 @@ EOT;
510
  $video_url = htmlspecialchars("$root_url/v/$file&rel=$disp_rel&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", ENT_QUOTES) . $high . $time;
511
 
512
  $yte_tag = <<<EOT
513
- <!-- Smart Youtube -->
514
- <span class="youtube">
515
- <object type="application/x-shockwave-flash" width="$width" height="$height" data="$video_url">
516
- <param name="movie" value="$video_url" />
517
- <param name="allowFullScreen" value="true" />
518
- <param name="wmode" value="transparent" />
519
- </object>
520
- </span>
521
  EOT;
522
  }
523
 
@@ -531,12 +526,12 @@ EOT;
531
 
532
  if ($this->options['img'] == 'on')
533
  {
534
- $yte_tag .= '<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>';
535
  }
536
 
537
  if ($this->options['link'] == 'on')
538
  {
539
- $yte_tag.='<a href="http://www.youtube.com/watch?v=' . $file . $high . '">www.youtube.com/watch?v=' . $file . '</a>';
540
  }
541
  // if ($this->options['link'] == 'off' && $this->options['img'] == 'off')
542
  // $yte_tag='http://www.youtube.com/watch?v='.$file;
@@ -571,8 +566,8 @@ EOT;
571
  'heighthq' => 295,
572
  'widthside' => 150,
573
  'heightside' => 125,
574
- 'rel' => 1,
575
- 'color' => 'blank',
576
  'border' => 0,
577
  'link' => 'on',
578
  'valid' => 'off',
@@ -584,6 +579,7 @@ EOT;
584
  'privacy' => 0,
585
  'wtext' => '',
586
  'wtitle' => '',
 
587
  );
588
 
589
  // migrate the old-fashion options
113
  $this->options['template'] = !isset($_POST['disp_template']) ?
114
  '{video}' :
115
  stripslashes(htmlspecialchars($_POST['disp_template']));;
116
+ $this->options['tag'] = !isset($_POST['tag']) ? '' : $_POST['tag'];
117
 
118
  update_option($this->key, $this->options);
119
 
152
  $disp_privacy = $this->options['privacy'] ? 'checked="checked"' : '';
153
 
154
  $disp_template = wp_specialchars($this->options['template']);
155
+ $tag = $this->options['tag'];
156
+
157
 
158
  if (!$disp_width)
159
  {
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>
337
+ <p>Use this option if you have used another youtube plugin and switched over to Smart Youtube.<p>
338
+ <p>For example if you used [yt]qYWWBwf2wHE[/yt] type of code, you would type yt in the box below.</p>
339
+ <input id="tag" type="text" name="tag" value="$tag" />
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
 
359
  </div>
360
  </div>
361
  </div>
362
+ <h5 class="author">Another fine WordPress plugin by <a href="http://www.prelovac.com/vladimir/">Vladimir Prelovac</a></h5>
363
  END;
364
  }
365
 
401
  $the_content = preg_replace("/\[youtube\=http:\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/|#!v=)([a-zA-Z0-9\-\_]{11})([^\s<]*)\]/", $this->tag($match[3], '', $match[4], $side), $the_content, 1);
402
  }
403
  }
404
+ $tag=$this->options['tag'];
405
+
406
+ if ($tag!='' && strpos($the_content, "[".$tag."]") !== false )
407
+ {
408
+ preg_match_all("/\[$tag\]([a-zA-Z0-9\-\_]{11})([^<\s]*)\[\/$tag\]/", $the_content, $matches, PREG_SET_ORDER);
409
+ foreach ($matches as $match)
410
+ {
411
+ //print_r($matches);
412
+ $the_content = preg_replace("/\[$tag\]([a-zA-Z0-9\-\_]{11})([^<\s]*)\[\/$tag\]/", $this->tag($match[1], '', '', $side), $the_content, 1);
413
+ }
414
+ }
415
 
416
  return $the_content;
417
  }
478
  {
479
  $video_url = htmlspecialchars("$root_url/p/$file&rel=$disp_rel&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", ENT_QUOTES) . $high . $time;
480
  $yte_tag = <<<EOT
481
+ <span class="youtube">
482
+ <object type="application/x-shockwave-flash" width="$width" height="$height" data="$video_url" >
483
+ <param name="movie" value="$video_url" />
484
+ <param name="allowFullScreen" value="true" />
485
+ <param name="allowscriptaccess" value="always" />
486
+ </object>
487
+ </span>
 
488
  EOT;
489
+ }
490
+ elseif ($valid == 'off' || strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone')===TRUE || strpos($_SERVER['HTTP_USER_AGENT'], 'iPod')===TRUE)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
491
  {
492
  $video_url = htmlspecialchars("$root_url/v/$file&rel=$disp_rel&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", ENT_QUOTES) . $high . $time;
493
  $yte_tag = <<<EOT
494
+ <span class="youtube">
495
+ <object width="$width" height="$height">
496
+ <param name="movie" value="$video_url" />
497
+ <param name="allowFullScreen" value="true" />
498
+ <embed wmode="transparent" src="$video_url" type="application/x-shockwave-flash" allowfullscreen="true" width="$width" height="$height"></embed>
499
+ <param name="wmode" value="transparent" />
500
+ </object>
501
+ </span>
 
 
 
 
 
 
 
502
  EOT;
503
  }
504
  else
506
  $video_url = htmlspecialchars("$root_url/v/$file&rel=$disp_rel&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", ENT_QUOTES) . $high . $time;
507
 
508
  $yte_tag = <<<EOT
509
+ <span class="youtube">
510
+ <object type="application/x-shockwave-flash" width="$width" height="$height" data="$video_url">
511
+ <param name="movie" value="$video_url" />
512
+ <param name="allowFullScreen" value="true" />
513
+ <param name="wmode" value="transparent" />
514
+ </object>
515
+ </span>
 
516
  EOT;
517
  }
518
 
526
 
527
  if ($this->options['img'] == 'on')
528
  {
529
+ $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>';
530
  }
531
 
532
  if ($this->options['link'] == 'on')
533
  {
534
+ $yte_tag.='<p><a href="http://www.youtube.com/watch?v=' . $file . $high . '">www.youtube.com/watch?v=' . $file . '</a></p>';
535
  }
536
  // if ($this->options['link'] == 'off' && $this->options['img'] == 'off')
537
  // $yte_tag='http://www.youtube.com/watch?v='.$file;
566
  'heighthq' => 295,
567
  'widthside' => 150,
568
  'heightside' => 125,
569
+ 'rel' => 1,
570
+ 'color' => 'blank',
571
  'border' => 0,
572
  'link' => 'on',
573
  'valid' => 'off',
579
  'privacy' => 0,
580
  'wtext' => '',
581
  'wtitle' => '',
582
+ 'tag' => ''
583
  );
584
 
585
  // migrate the old-fashion options
smartyoutube.php CHANGED
@@ -4,10 +4,12 @@ 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.4.3
8
  Author URI: http://www.prelovac.com/vladimir/
9
 
10
  Updates:
 
 
11
  3.4.3 - Fixed privacy option
12
  3.4.2 - Supports new #! style youtube urls
13
  3.4.1 - Fixed widget
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.6.
8
  Author URI: http://www.prelovac.com/vladimir/
9
 
10
  Updates:
11
+ 3.6 - Added compatibility with other youtube plugins such as wp-youtube ([yt]...[/yt] type code)
12
+ 3.5 - Fixed Iphone issues
13
  3.4.3 - Fixed privacy option
14
  3.4.2 - Supports new #! style youtube urls
15
  3.4.1 - Fixed widget