Smart YouTube PRO - Version 2.6

Version Description

Download this release

Release Info

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

Code changes from version 2.5 to 2.6

Files changed (2) hide show
  1. readme.txt +5 -0
  2. smartyoutube.php +27 -7
readme.txt CHANGED
@@ -32,6 +32,11 @@ Main Features:
32
 
33
 
34
  Change Log:
 
 
 
 
 
35
  v2.5:
36
  - Support for 720p HD (DVD quality) YouTube videos. Use httpvhd://
37
 
32
 
33
 
34
  Change Log:
35
+
36
+
37
+ v2.6:
38
+ - Added option to disable search box
39
+
40
  v2.5:
41
  - Support for 720p HD (DVD quality) YouTube videos. Use httpvhd://
42
 
smartyoutube.php CHANGED
@@ -2,12 +2,13 @@
2
  /*
3
  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.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
@@ -24,7 +25,7 @@ To-Doo:
24
  - localization
25
  */
26
 
27
- $yte_localversion="2.5";
28
 
29
  $CustomColors=array (
30
  "blank" => array("d6d6d6","f0f0f0"),
@@ -70,14 +71,17 @@ function yte_options_page()
70
  // If form was submitted
71
  if (isset($_POST['submitted']))
72
  {
73
-
 
74
  $disp_img = !isset($_POST['disp_img'])? 'off': 'on';
75
  $disp_link = !isset($_POST['disp_link'])? 'off': 'on';
 
76
  $valid = !isset($_POST['valid'])? 'off': 'on';
77
 
78
  update_option('smart_yt_img', $disp_img);
79
  update_option('smart_yt_link', $disp_link);
80
  update_option('smart_yt_valid', $valid);
 
81
 
82
  $disp_width = (int) ($_POST['disp_width']=="")? '425': $_POST['disp_width'];
83
  $disp_height = (int) ($_POST['disp_height']=="")? '344': $_POST['disp_height'];
@@ -92,6 +96,7 @@ function yte_options_page()
92
  update_option('smart_yt_heighthq', $disp_heighthq);
93
 
94
  $disp_rel = !isset($_POST['embedRel'])? '1': $_POST['embedRel'];
 
95
  $disp_border = !isset($_POST['embedBorder'])? '0': '1';
96
  $disp_color = !isset($_POST['embedColor'])? 'blank': $_POST['embedColor'];
97
 
@@ -99,6 +104,7 @@ function yte_options_page()
99
 
100
 
101
  update_option('smart_yt_rel', $disp_rel);
 
102
  update_option('smart_yt_border', $disp_border);
103
  update_option('smart_yt_color', $disp_color);
104
 
@@ -124,6 +130,7 @@ function yte_options_page()
124
  // Fetch code from DB
125
  $disp_img = (get_option('smart_yt_img')=='on') ? 'checked':'';
126
  $disp_link = (get_option('smart_yt_link')=='on') ? 'checked':'';
 
127
 
128
  $valid = (get_option('smart_yt_valid')=='on') ? 'checked':'';
129
 
@@ -138,6 +145,7 @@ function yte_options_page()
138
 
139
 
140
  $disp_rel = (get_option('smart_yt_rel')=='1') ? 'checked':'';
 
141
  $disp_rel2=$disp_rel ? "" : "checked";
142
  $disp_border = (get_option('smart_yt_border')=='1') ? 'checked':'';
143
  $disp_color = get_option('smart_yt_color');
@@ -283,7 +291,9 @@ text-decoration:none;
283
 
284
  $imgpath=$wp_yte_plugin_url.'/i';
285
  $actionurl=$_SERVER['REQUEST_URI'];
 
286
  // Configuration Page
 
287
 
288
 
289
  echo <<<END
@@ -313,6 +323,7 @@ text-decoration:none;
313
  <div class="dbx-content">
314
  <form name="yteform" action="$action_url" method="post">
315
  <input type="hidden" name="submitted" value="1" />
 
316
  <h3>Usage</h3>
317
 
318
  <p>To use the video in your posts, paste YouTube video URL with <strong>httpv://</strong> (notice the 'v'). </p>
@@ -365,6 +376,9 @@ text-decoration:none;
365
  <div style="margin: 0px 0px 0px 4px; clear: both;">
366
  <input type="checkbox" onchange="onUpdatePreviewImage();" id="show_border_checkbox" name="embedBorder" $disp_border /><label for="show_border_checkbox"> Show Border</label><br>
367
  <input type="checkbox" id="autoplay_checkbox" name="autoplay" $disp_autoplay /><label for="autoplay_checkbox"> Autoplay videos</label><br>
 
 
 
368
  </div>
369
 
370
 
@@ -373,6 +387,8 @@ text-decoration:none;
373
  <p>Enabling the option below will make your YouTube code xHTML valid. But be warned that code may not work in some browsers like iPhone and in feed readers.</p>
374
  <div><input id="valid" type="checkbox" name="valid" $valid />
375
  <label for="valid">Enable xHTML Validation</label></div>
 
 
376
 
377
  <br>
378
  <p><strong>RSS feed options</strong></p>
@@ -414,6 +430,8 @@ global $CustomColors;
414
  $disp_border = get_option('smart_yt_border');
415
  $disp_color = get_option('smart_yt_color');
416
  $autoplay = get_option('smart_yt_autoplay');
 
 
417
 
418
  $valid=get_option('smart_yt_valid');
419
 
@@ -442,9 +460,9 @@ global $CustomColors;
442
  // if ( strpos($_SERVER['HTTP_USER_AGENT'], "iPhone") || strpos($_SERVER['HTTP_USER_AGENT'], "iPod") )
443
 
444
  if ($valid=="off")
445
- $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, 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, ENT_QUOTES).$high.$time.'" type="application/x-shockwave-flash" allowfullscreen="true" width="'.$width.'" height="'.$height.'" ></embed><param name="wmode" value="transparent" /></object></span>';
446
  else
447
- $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, 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, ENT_QUOTES).$high.$time.'"></param><param name="allowFullScreen" value="true"></param><param name="wmode" value="transparent" /></object></span>';
448
 
449
 
450
 
@@ -515,7 +533,9 @@ function yte_install(){
515
  add_option('smart_yt_valid', 'off');
516
  }
517
 
518
-
 
 
519
 
520
  }
521
 
2
  /*
3
  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.6
8
  Author URI: http://www.prelovac.com/vladimir/
9
 
10
  Updates:
11
+ 2.6 - Added option to remove search button
12
  2.5 - Added DVD quality support (httpvq)
13
  2.4.1 - Small fixes in embed and rss links
14
  2.4 - Added support for extra parameters like &start=50 to start the video at 50th second of play
25
  - localization
26
  */
27
 
28
+ $yte_localversion="2.6";
29
 
30
  $CustomColors=array (
31
  "blank" => array("d6d6d6","f0f0f0"),
71
  // If form was submitted
72
  if (isset($_POST['submitted']))
73
  {
74
+ check_admin_referer('smart-youtube');
75
+
76
  $disp_img = !isset($_POST['disp_img'])? 'off': 'on';
77
  $disp_link = !isset($_POST['disp_link'])? 'off': 'on';
78
+ $disp_search = !isset($_POST['disp_search'])? 'off': 'on';
79
  $valid = !isset($_POST['valid'])? 'off': 'on';
80
 
81
  update_option('smart_yt_img', $disp_img);
82
  update_option('smart_yt_link', $disp_link);
83
  update_option('smart_yt_valid', $valid);
84
+ update_option('smart_yt_search', $disp_search);
85
 
86
  $disp_width = (int) ($_POST['disp_width']=="")? '425': $_POST['disp_width'];
87
  $disp_height = (int) ($_POST['disp_height']=="")? '344': $_POST['disp_height'];
96
  update_option('smart_yt_heighthq', $disp_heighthq);
97
 
98
  $disp_rel = !isset($_POST['embedRel'])? '1': $_POST['embedRel'];
99
+
100
  $disp_border = !isset($_POST['embedBorder'])? '0': '1';
101
  $disp_color = !isset($_POST['embedColor'])? 'blank': $_POST['embedColor'];
102
 
104
 
105
 
106
  update_option('smart_yt_rel', $disp_rel);
107
+
108
  update_option('smart_yt_border', $disp_border);
109
  update_option('smart_yt_color', $disp_color);
110
 
130
  // Fetch code from DB
131
  $disp_img = (get_option('smart_yt_img')=='on') ? 'checked':'';
132
  $disp_link = (get_option('smart_yt_link')=='on') ? 'checked':'';
133
+ $disp_search = (get_option('smart_yt_search')=='on') ? 'checked':'';
134
 
135
  $valid = (get_option('smart_yt_valid')=='on') ? 'checked':'';
136
 
145
 
146
 
147
  $disp_rel = (get_option('smart_yt_rel')=='1') ? 'checked':'';
148
+
149
  $disp_rel2=$disp_rel ? "" : "checked";
150
  $disp_border = (get_option('smart_yt_border')=='1') ? 'checked':'';
151
  $disp_color = get_option('smart_yt_color');
291
 
292
  $imgpath=$wp_yte_plugin_url.'/i';
293
  $actionurl=$_SERVER['REQUEST_URI'];
294
+ $nonce=wp_create_nonce( 'smart-youtube');
295
  // Configuration Page
296
+
297
 
298
 
299
  echo <<<END
323
  <div class="dbx-content">
324
  <form name="yteform" action="$action_url" method="post">
325
  <input type="hidden" name="submitted" value="1" />
326
+ <input type="hidden" id="_wpnonce" name="_wpnonce" value="$nonce" />'
327
  <h3>Usage</h3>
328
 
329
  <p>To use the video in your posts, paste YouTube video URL with <strong>httpv://</strong> (notice the 'v'). </p>
376
  <div style="margin: 0px 0px 0px 4px; clear: both;">
377
  <input type="checkbox" onchange="onUpdatePreviewImage();" id="show_border_checkbox" name="embedBorder" $disp_border /><label for="show_border_checkbox"> Show Border</label><br>
378
  <input type="checkbox" id="autoplay_checkbox" name="autoplay" $disp_autoplay /><label for="autoplay_checkbox"> Autoplay videos</label><br>
379
+ <input type="checkbox" id="disp_search" name="disp_search" $disp_search /><label for="disp_search"> Display search box</label>
380
+
381
+
382
  </div>
383
 
384
 
387
  <p>Enabling the option below will make your YouTube code xHTML valid. But be warned that code may not work in some browsers like iPhone and in feed readers.</p>
388
  <div><input id="valid" type="checkbox" name="valid" $valid />
389
  <label for="valid">Enable xHTML Validation</label></div>
390
+ <br />
391
+
392
 
393
  <br>
394
  <p><strong>RSS feed options</strong></p>
430
  $disp_border = get_option('smart_yt_border');
431
  $disp_color = get_option('smart_yt_color');
432
  $autoplay = get_option('smart_yt_autoplay');
433
+ $disp_search=(get_option('smart_yt_img')=='on') ? "1":"0";
434
+
435
 
436
  $valid=get_option('smart_yt_valid');
437
 
460
  // if ( strpos($_SERVER['HTTP_USER_AGENT'], "iPhone") || strpos($_SERVER['HTTP_USER_AGENT'], "iPod") )
461
 
462
  if ($valid=="off")
463
+ $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.'&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.'&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>';
464
  else
465
+ $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.'&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.'&showsearch='.$disp_search, ENT_QUOTES).$high.$time.'"></param><param name="allowFullScreen" value="true"></param><param name="wmode" value="transparent" /></object></span>';
466
 
467
 
468
 
533
  add_option('smart_yt_valid', 'off');
534
  }
535
 
536
+ if(get_option('smart_yt_search' == '') || !get_option('smart_yt_search')){
537
+ add_option('smart_yt_search', 'off');
538
+ }
539
 
540
  }
541