Smart YouTube PRO - Version 4.1.2

Version Description

  • Playlists fixed, make sure to use the new format for playlist embed ie. httpvp://www.youtube.com/playlist?list=PL050E43A49BC5E5E5
Download this release

Release Info

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

Code changes from version 4.1.1 to 4.1.2

Files changed (2) hide show
  1. readme.txt +6 -0
  2. smartyoutube.php +12 -11
readme.txt CHANGED
@@ -40,6 +40,12 @@ Plugin by Vladimir Prelovac. Also check out <a href="http://managewp.com">Manage
40
 
41
  == Changelog ==
42
 
 
 
 
 
 
 
43
  = 4.1.1 =
44
  * Logo-less mode fix
45
 
40
 
41
  == Changelog ==
42
 
43
+ = 4.1.3 =
44
+ * Fixed support for videos in RSS feed
45
+
46
+ = 4.1.2 =
47
+ * Playlists fixed, make sure to use the new format for playlist embed ie. httpvp://www.youtube.com/playlist?list=PL050E43A49BC5E5E5
48
+
49
  = 4.1.1 =
50
  * Logo-less mode fix
51
 
smartyoutube.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Smart Youtube PRO
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: 4.1.1
8
  Author URI: http://www.prelovac.com/vladimir/
9
 
10
 
@@ -359,7 +359,7 @@ class SmartYouTube_PRO {
359
  <p><?php _e( 'Vimeo Example: httpv://vimeo.com/27287078', 'smart-youtube' ); ?></p>
360
  <p><?php _e( 'Metacafe Example: httpvh://vww.metacafe.com/watch/7815470/harry_potter_and_the_deathly_hallows_dvd_interview/', 'smart-youtube' ); ?></p>
361
  <p><?php _e( 'Live Leak Example: httpv://www.liveleak.com/view?i=cad_1322822486', 'smart-youtube' ); ?></p>
362
- <p><?php _e( 'To embed playlists use httpvp:// (eg. httpvp://www.youtube.com/view_play_list?p=528026B4F7B34094)', 'smart-youtube' ); ?></p>
363
  <p><?php _e( 'Smart Youtube also supports migrated blogs from Wordpress.com using [youtube=youtubeadresss]', 'smart-youtube' ); ?></p>
364
  <ul>
365
  <li><?php _e( 'httpv:// - regular video', 'smart-youtube' ); ?></li>
@@ -667,7 +667,7 @@ class SmartYouTube_PRO {
667
 
668
  $context = $side ? 'side' : 'post';
669
 
670
- preg_match_all( "/((http(v|vh|vhd)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?youtube\.com\/watch(\?v\=|\/v\/|#!v=)([a-zA-Z0-9\-\_]{11})([^<\s]*))|((http(v|vh|vhd)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?youtu\.be\/([a-zA-Z0-9\-\_]{11}))|((http(v|vh|vhd)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?metacafe\.com\/watch\/([a-zA-Z0-9\-\_]{7})\/([^<^\/\s]*)([\/])?)|((http(v|vh|vhd)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?vimeo\.com\/([a-zA-Z0-9\-\_]{8})([\/])?)|((http(v|vh|vhd)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?liveleak\.com\/view(\?i\=)([a-zA-Z0-9\-\_]*))|((http(v|vh|vhd)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?facebook\.com\/video\/video.php\?v\=([a-zA-Z0-9\-\_]*))|((http(vp|vhp)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?youtube\.com\/(view_play_list\?p\=|playlist\?list\=)(|\/v\/|#!v=)([a-zA-Z0-9\-\_])([^<\s]*))/", $the_content, $matches, PREG_SET_ORDER );
671
 
672
  foreach ( $matches as $match ) {
673
  if ( $match[1] != '' ) {
@@ -749,17 +749,18 @@ class SmartYouTube_PRO {
749
  $the_content = str_replace( $match[32], $this->tag_facebook( $context, $match[36], $match[34] ), $the_content );
750
  }
751
  } elseif ( $match[37] != '' ) {
 
752
  if ( 'on' == $this->options['wiziapp'] ) {
753
  $videos = array();
754
- $video_info['src'] = "http://www.youtube.com/playlist?list={$match[43]}";
755
  array_push( $videos, $video_info );
756
  $replace_text = '';
757
  $replace_text = apply_filters( 'wiziapp_3rd_party_plugin', $replace_text, 'video', $videos );
758
  $the_content = str_replace( $match[1], $replace_text, $the_content );
759
  } else if ( ( $match[38] == 'http://' && $this->options['http'] == 'on' ) || ( $match[38] == '' && $this->options['www'] == 'on' ) ) {
760
- $the_content = str_replace( $match[37], $this->tag_youtube( $context, $match[43], 'vp', $match[44] ), $the_content );
761
  } else if ( $match[39] == 'vp' || $match[39] == 'vhp' ) {
762
- $the_content = str_replace( $match[37], $this->tag_youtube( $context, $match[43], $match[39], $match[44] ), $the_content );
763
  }
764
  }
765
  }
@@ -1040,7 +1041,7 @@ EOT;
1040
  else
1041
  $video_url = htmlspecialchars( "$root_url/v/$file?wmode=transparent&fs=1&hl=en&$ap$ll&loop=$loop{$disp_info}$disp_ann&showsearch=$disp_search&rel=$disp_rel&theme=$theme", ENT_QUOTES ) . $high . $time;
1042
 
1043
- if ( $playlist ) {
1044
  $video_url = htmlspecialchars( "$root_url/embed/videoseries?list=$file&fs=1&hl=en$ap$ll&loop=$loop{$disp_info}$disp_ann&showsearch=$disp_search&rel=$disp_rel&theme=$theme", ENT_QUOTES ) . $high . $time;
1045
  $yte_tag = <<<EOT
1046
  <span class="youtube"><iframe class="youtube-player" src="$video_url" width="$width" height="$height" frameborder="0" allowfullscreen></iframe></span>
@@ -1084,21 +1085,21 @@ EOT;
1084
  $high = '&fmt=18';
1085
  }
1086
  if ( $playlist )
1087
- $url = 'http://www.youtube.com/view_play_list?p=';
1088
  else
1089
  $url = 'http://www.youtube.com/watch?v=';
1090
 
1091
  $yte_tag = '';
1092
  if ( $this->options['link'] == 'on' ) {
1093
- $yte_tag .= '<p><a href="' . $url . $file . $high . '">www.youtube.com/watch?v=' . $file . '</a></p>';
1094
  }
1095
 
1096
  if ( $this->options['img'] == 'on' ) {
1097
  $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>';
1098
  }
1099
 
1100
- // if ($this->options['link'] == 'off' && $this->options['img'] == 'off')
1101
- // $yte_tag='http://www.youtube.com/watch?v='.$file;
1102
  }
1103
 
1104
  return str_replace( '{video}', $yte_tag, html_entity_decode( $template ) );
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: 4.1.3
8
  Author URI: http://www.prelovac.com/vladimir/
9
 
10
 
359
  <p><?php _e( 'Vimeo Example: httpv://vimeo.com/27287078', 'smart-youtube' ); ?></p>
360
  <p><?php _e( 'Metacafe Example: httpvh://vww.metacafe.com/watch/7815470/harry_potter_and_the_deathly_hallows_dvd_interview/', 'smart-youtube' ); ?></p>
361
  <p><?php _e( 'Live Leak Example: httpv://www.liveleak.com/view?i=cad_1322822486', 'smart-youtube' ); ?></p>
362
+ <p><?php _e( 'To embed playlists use httpvp:// (eg. httpvp://www.youtube.com/playlist?list=PL050E43A49BC5E5E5)', 'smart-youtube' ); ?></p>
363
  <p><?php _e( 'Smart Youtube also supports migrated blogs from Wordpress.com using [youtube=youtubeadresss]', 'smart-youtube' ); ?></p>
364
  <ul>
365
  <li><?php _e( 'httpv:// - regular video', 'smart-youtube' ); ?></li>
667
 
668
  $context = $side ? 'side' : 'post';
669
 
670
+ preg_match_all( "/((http(v|vh|vhd)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?youtube\.com\/watch(\?v\=|\/v\/|#!v=)([a-zA-Z0-9\-\_]{11})([^<\s]*))|((http(v|vh|vhd)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?youtu\.be\/([a-zA-Z0-9\-\_]{11}))|((http(v|vh|vhd)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?metacafe\.com\/watch\/([a-zA-Z0-9\-\_]{7})\/([^<^\/\s]*)([\/])?)|((http(v|vh|vhd)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?vimeo\.com\/([a-zA-Z0-9\-\_]{8})([\/])?)|((http(v|vh|vhd)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?liveleak\.com\/view(\?i\=)([a-zA-Z0-9\-\_]*))|((http(v|vh|vhd)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?facebook\.com\/video\/video.php\?v\=([a-zA-Z0-9\-\_]*))|((http(vp|vhp)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?youtube\.com\/(view_play_list\?p\=|playlist\?list\=)([a-zA-Z0-9\-\_]{18})([^<\s]*))/", $the_content, $matches, PREG_SET_ORDER );
671
 
672
  foreach ( $matches as $match ) {
673
  if ( $match[1] != '' ) {
749
  $the_content = str_replace( $match[32], $this->tag_facebook( $context, $match[36], $match[34] ), $the_content );
750
  }
751
  } elseif ( $match[37] != '' ) {
752
+
753
  if ( 'on' == $this->options['wiziapp'] ) {
754
  $videos = array();
755
+ $video_info['src'] = "http://www.youtube.com/playlist?list={$match[42]}";
756
  array_push( $videos, $video_info );
757
  $replace_text = '';
758
  $replace_text = apply_filters( 'wiziapp_3rd_party_plugin', $replace_text, 'video', $videos );
759
  $the_content = str_replace( $match[1], $replace_text, $the_content );
760
  } else if ( ( $match[38] == 'http://' && $this->options['http'] == 'on' ) || ( $match[38] == '' && $this->options['www'] == 'on' ) ) {
761
+ $the_content = str_replace( $match[37], $this->tag_youtube( $context, $match[42], 'vp', $match[43] ), $the_content );
762
  } else if ( $match[39] == 'vp' || $match[39] == 'vhp' ) {
763
+ $the_content = str_replace( $match[37], $this->tag_youtube( $context, $match[42], $match[39], $match[43] ), $the_content );
764
  }
765
  }
766
  }
1041
  else
1042
  $video_url = htmlspecialchars( "$root_url/v/$file?wmode=transparent&fs=1&hl=en&$ap$ll&loop=$loop{$disp_info}$disp_ann&showsearch=$disp_search&rel=$disp_rel&theme=$theme", ENT_QUOTES ) . $high . $time;
1043
 
1044
+ if ( $playlist ) {
1045
  $video_url = htmlspecialchars( "$root_url/embed/videoseries?list=$file&fs=1&hl=en$ap$ll&loop=$loop{$disp_info}$disp_ann&showsearch=$disp_search&rel=$disp_rel&theme=$theme", ENT_QUOTES ) . $high . $time;
1046
  $yte_tag = <<<EOT
1047
  <span class="youtube"><iframe class="youtube-player" src="$video_url" width="$width" height="$height" frameborder="0" allowfullscreen></iframe></span>
1085
  $high = '&fmt=18';
1086
  }
1087
  if ( $playlist )
1088
+ $url = 'http://www.youtube.com/playlist?list=';
1089
  else
1090
  $url = 'http://www.youtube.com/watch?v=';
1091
 
1092
  $yte_tag = '';
1093
  if ( $this->options['link'] == 'on' ) {
1094
+ $yte_tag .= '<p><a href="' . $url . $file . $high . '">'.$url. $file . '</a></p>';
1095
  }
1096
 
1097
  if ( $this->options['img'] == 'on' ) {
1098
  $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>';
1099
  }
1100
 
1101
+ if ($this->options['link'] == 'off' && $this->options['img'] == 'off')
1102
+ $yte_tag=$url.$file;
1103
  }
1104
 
1105
  return str_replace( '{video}', $yte_tag, html_entity_decode( $template ) );