Smart YouTube PRO - Version 1.9

Version Description

Download this release

Release Info

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

Code changes from version 1.8 to 1.9

Files changed (2) hide show
  1. readme.txt +4 -1
  2. smartyoutube.php +41 -19
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.networkforgood.org/donation/MakeDonation.aspx?ORGID2=52
4
  Tags: youtube, video, play, media, Post, posts, admin
5
  Requires at least: 2.0
6
  Tested up to: 2.5.1
7
- Stable tag: 1.8
8
 
9
  Smart Youtube plugin allows you to insert full featured YouTube videos into your post, comments and in RSS feed.
10
 
@@ -17,6 +17,9 @@ The main purpose of the plugin is to correctly embed youtube videos into your bl
17
 
18
  The plugin is designed to be small and fast and not use any external resources. It has a number of cutomizable options.
19
 
 
 
 
20
  Changes v1.8:
21
  Solved problem with HTML validation, added full video in RSS feed.
22
 
4
  Tags: youtube, video, play, media, Post, posts, admin
5
  Requires at least: 2.0
6
  Tested up to: 2.5.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.
10
 
17
 
18
  The plugin is designed to be small and fast and not use any external resources. It has a number of cutomizable options.
19
 
20
+ Changes v1.9:
21
+ Added video autoplay option.
22
+
23
  Changes v1.8:
24
  Solved problem with HTML validation, added full video in RSS feed.
25
 
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: 1.8
8
  Author URI: http://www.prelovac.com/vladimir/
9
 
10
  Updates:
 
11
  1.8 - Solved Problem with HTML validation, enabled full video preview in RSS
12
  1.6 - Solving a problem with wordpress handling special characters
13
  1.5 - Added new admin interface and more options to control the video
@@ -17,7 +18,7 @@ To-Doo:
17
  - localization
18
  */
19
 
20
- $yte_localversion="1.8";
21
 
22
  $CustomColors=array (
23
  "blank" => array("d6d6d6","f0f0f0"),
@@ -78,11 +79,15 @@ function yte_options_page()
78
  $disp_border = !isset($_POST['embedBorder'])? '0': '1';
79
  $disp_color = !isset($_POST['embedColor'])? 'blank': $_POST['embedColor'];
80
 
 
81
 
82
- update_option('smart_yt_rel', $disp_rel);
 
83
  update_option('smart_yt_border', $disp_border);
84
  update_option('smart_yt_color', $disp_color);
85
 
 
 
86
  $disp_posts = !isset($_POST['disp_posts'])? 'off': 'on';
87
  $disp_comments = !isset($_POST['disp_comments'])? 'off': 'on';
88
 
@@ -110,6 +115,8 @@ function yte_options_page()
110
  $disp_width = get_option('smart_yt_width');
111
  $disp_height = get_option('smart_yt_height');
112
 
 
 
113
 
114
  $disp_rel = get_option('smart_yt_rel');
115
  $disp_border = get_option('smart_yt_border');
@@ -368,12 +375,24 @@ if(version_compare($wp_version,"2.5",">=")) {
368
  <a onclick="onChangeColor(\'rubyred\'); return false;" class="watch-image-radio-link" href="#" id="theme_color_rubyred_img"><img alt="" src="http://s.ytimg.com/yt/img/pixel-vfl73.gif" class="watch-embed-select watch-embed-rubyred"/></a>
369
  <input id="embedColor" type="hidden" name="embedColor" value="'.$disp_color.'">
370
  <input id="prevUrl" type="hidden" name="prevUrl" value="'.get_bloginfo('wpurl') . '/wp-content/plugins/smart-youtube/img/'.'">
 
371
  <div style="margin: 0px 0px 0px 4px; clear: both;">
372
- <input type="checkbox" onchange="onUpdatePreviewImage();" id="show_border_checkbox" name="embedBorder" '.($disp_border ? 'checked':'').'/><label for="show_border_checkbox">Show Border</label>
 
373
  </div>
374
- </div>
375
  </div>
376
 
 
 
 
 
 
 
 
 
 
 
377
 
378
  <p class="submit">
379
  <input type="submit" name="yte_update" value="Update Options &raquo;" />
@@ -409,23 +428,14 @@ add_action('admin_menu', 'yte_add_pages');
409
 
410
  function yte_tag($file) {
411
  global $CustomColors;
412
- /*if (is_feed())
413
- {
414
- if (get_option('smart_yt_img')=='on')
415
- $yte_tag='<a href="http://www.youtube.com/watch?v='.$file.'"><img src="http://img.youtube.com/vi/'.$file.'/default.jpg" width="130" height="97" border=0></a>';
416
- if (get_option('smart_yt_link')=='on')
417
- $yte_tag='<a href="http://www.youtube.com/watch?v='.$file.'">www.youtube.com/watch?v='.$file.'</a>';
418
- if ( (get_option('smart_yt_link')=='off') && (get_option('smart_yt_img')=='off') )
419
- $yte_tag='http://www.youtube.com/watch?v='.$file;
420
- }
421
- else */
422
- {
423
  $width=get_option('smart_yt_width');
424
  $height=get_option('smart_yt_height');
425
 
426
  $disp_rel = get_option('smart_yt_rel');
427
  $disp_border = get_option('smart_yt_border');
428
  $disp_color = get_option('smart_yt_color');
 
429
 
430
  if ($width=="")
431
  $width="425";
@@ -435,8 +445,18 @@ else */
435
  if ($disp_border)
436
  $height+=18;
437
 
438
- $yte_tag = '<!-- Added by Smart Youtube @ www.prelovac.com --><span class="youtube"><object width="'.$width.'" height="'.$height.'" type="application/x-shockwave-flash" data="'.htmlspecialchars('http://www.youtube.com/v/'.$file.'&rel='.$disp_rel.'&color1='.$CustomColors[$disp_color][0].'&color2='.$CustomColors[$disp_color][1].'&border='.$disp_border, ENT_QUOTES).'"> <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, ENT_QUOTES).'" /><param name="wmode" value="transparent" /></object></span>';
 
 
 
 
 
 
 
 
 
439
  }
 
440
  return $yte_tag;
441
  }
442
 
@@ -474,10 +494,12 @@ function yte_install(){
474
  add_option('smart_yt_color', 'blank');
475
  }
476
 
477
- if(get_option('smart_yt_img' == '') || !get_option('smart_yt_img')){
478
- add_option('smart_yt_img', 'on');
479
  }
480
 
 
 
481
  }
482
 
483
  if (isset($_GET['activate']) && $_GET['activate'] == 'true') {
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: 1.9
8
  Author URI: http://www.prelovac.com/vladimir/
9
 
10
  Updates:
11
+ 1.9 - Added video autoplay option
12
  1.8 - Solved Problem with HTML validation, enabled full video preview in RSS
13
  1.6 - Solving a problem with wordpress handling special characters
14
  1.5 - Added new admin interface and more options to control the video
18
  - localization
19
  */
20
 
21
+ $yte_localversion="1.9";
22
 
23
  $CustomColors=array (
24
  "blank" => array("d6d6d6","f0f0f0"),
79
  $disp_border = !isset($_POST['embedBorder'])? '0': '1';
80
  $disp_color = !isset($_POST['embedColor'])? 'blank': $_POST['embedColor'];
81
 
82
+ $disp_autoplay = !isset($_POST['autoplay'])? '0': '1';
83
 
84
+
85
+ update_option('smart_yt_rel', $disp_rel);
86
  update_option('smart_yt_border', $disp_border);
87
  update_option('smart_yt_color', $disp_color);
88
 
89
+ update_option('smart_yt_autoplay', $disp_autoplay);
90
+
91
  $disp_posts = !isset($_POST['disp_posts'])? 'off': 'on';
92
  $disp_comments = !isset($_POST['disp_comments'])? 'off': 'on';
93
 
115
  $disp_width = get_option('smart_yt_width');
116
  $disp_height = get_option('smart_yt_height');
117
 
118
+ $disp_autoplay = get_option('smart_yt_autoplay');
119
+
120
 
121
  $disp_rel = get_option('smart_yt_rel');
122
  $disp_border = get_option('smart_yt_border');
375
  <a onclick="onChangeColor(\'rubyred\'); return false;" class="watch-image-radio-link" href="#" id="theme_color_rubyred_img"><img alt="" src="http://s.ytimg.com/yt/img/pixel-vfl73.gif" class="watch-embed-select watch-embed-rubyred"/></a>
376
  <input id="embedColor" type="hidden" name="embedColor" value="'.$disp_color.'">
377
  <input id="prevUrl" type="hidden" name="prevUrl" value="'.get_bloginfo('wpurl') . '/wp-content/plugins/smart-youtube/img/'.'">
378
+ </div>
379
  <div style="margin: 0px 0px 0px 4px; clear: both;">
380
+ <input type="checkbox" onchange="onUpdatePreviewImage();" id="show_border_checkbox" name="embedBorder" '.($disp_border ? 'checked':'').'/><label for="show_border_checkbox"> Show Border</label><br>
381
+ <input type="checkbox" id="autoplay_checkbox" name="autoplay" '.($disp_autoplay ? 'checked':'').'/><label for="autoplay_checkbox"> Autoplay videos</label><br>
382
  </div>
383
+
384
  </div>
385
 
386
+ <br>
387
+ <p><strong>RSS feed options</strong></p>
388
+ <p>Some RSS feed readers like Bloglines will show embeded YouTube videos. Some will not and Smart YouTube allows you to display a video link and a video screenshot instead.</p>
389
+ <p>Smart YouTube will always embed the video but it can not know if the reader supports embeded video or not. So use these additional options at your own likening.</p>
390
+
391
+ <div><input id="check2" type="checkbox" name="disp_link" ' .($disp_link=="on"?'CHECKED':'').' />
392
+ <label for="check2">Display video link in RSS feed</label></div>
393
+
394
+ <div><input id="check1" type="checkbox" name="disp_img"' .($disp_img=="on"?'CHECKED':'').'/>
395
+ <label for="check1">Display video preview image in RSS feed</label></div>
396
 
397
  <p class="submit">
398
  <input type="submit" name="yte_update" value="Update Options &raquo;" />
428
 
429
  function yte_tag($file) {
430
  global $CustomColors;
431
+
 
 
 
 
 
 
 
 
 
 
432
  $width=get_option('smart_yt_width');
433
  $height=get_option('smart_yt_height');
434
 
435
  $disp_rel = get_option('smart_yt_rel');
436
  $disp_border = get_option('smart_yt_border');
437
  $disp_color = get_option('smart_yt_color');
438
+ $autoplay = get_option('smart_yt_autoplay');
439
 
440
  if ($width=="")
441
  $width="425";
445
  if ($disp_border)
446
  $height+=18;
447
 
448
+ $yte_tag = '<!-- Smart Youtube --><span class="youtube"><object width="'.$width.'" height="'.$height.'" type="application/x-shockwave-flash" data="'.htmlspecialchars('http://www.youtube.com/v/'.$file.'&rel='.$disp_rel.'&color1='.$CustomColors[$disp_color][0].'&color2='.$CustomColors[$disp_color][1].'&border='.$disp_border.'&autoplay='.$autoplay, ENT_QUOTES).'"> <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.'&autoplay='.$autoplay, ENT_QUOTES).'" /><param name="wmode" value="transparent" /></object></span>';
449
+
450
+ if (is_feed())
451
+ {
452
+ if (get_option('smart_yt_img')=='on')
453
+ $yte_tag.='<a href="http://www.youtube.com/watch?v='.$file.'"><img src="http://img.youtube.com/vi/'.$file.'/default.jpg" width="130" height="97" border=0></a>';
454
+ if (get_option('smart_yt_link')=='on')
455
+ $yte_tag.='<a href="http://www.youtube.com/watch?v='.$file.'">www.youtube.com/watch?v='.$file.'</a>';
456
+ // if ( (get_option('smart_yt_link')=='off') && (get_option('smart_yt_img')=='off') )
457
+ // $yte_tag='http://www.youtube.com/watch?v='.$file;
458
  }
459
+
460
  return $yte_tag;
461
  }
462
 
494
  add_option('smart_yt_color', 'blank');
495
  }
496
 
497
+ if(get_option('smart_yt_link' == '') || !get_option('smart_yt_link')){
498
+ add_option('smart_yt_link', 'on');
499
  }
500
 
501
+
502
+
503
  }
504
 
505
  if (isset($_GET['activate']) && $_GET['activate'] == 'true') {