Smart YouTube PRO - Version 1.91

Version Description

Download this release

Release Info

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

Code changes from version 1.9 to 1.91

help.png → i/help.png RENAMED
File without changes
home.png → i/home.png RENAMED
File without changes
idea.png → i/idea.png RENAMED
File without changes
more.png → i/more.png RENAMED
File without changes
p1.png → i/p1.png RENAMED
File without changes
i/rate.png ADDED
Binary file
readme.txt CHANGED
@@ -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.9:
21
  Added video autoplay option.
22
 
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.91:
21
+ Rewritten old parts of plugin and general tweaks.
22
+
23
  Changes v1.9:
24
  Added video autoplay option.
25
 
smartyoutube.php CHANGED
@@ -4,7 +4,7 @@ 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.9
8
  Author URI: http://www.prelovac.com/vladimir/
9
 
10
  Updates:
@@ -18,7 +18,7 @@ To-Doo:
18
  - localization
19
  */
20
 
21
- $yte_localversion="1.9";
22
 
23
  $CustomColors=array (
24
  "blank" => array("d6d6d6","f0f0f0"),
@@ -32,6 +32,7 @@ $CustomColors=array (
32
  "rubyred" => array("5d1719","cd311b")
33
  );
34
 
 
35
 
36
  // Admin Panel
37
  function yte_add_pages()
@@ -61,7 +62,7 @@ function yte_options_page()
61
 
62
 
63
  // If form was submitted
64
- if (isset($_POST['yte_update']))
65
  {
66
  $disp_img = !isset($_POST['disp_img'])? 'off': 'on';
67
  $disp_link = !isset($_POST['disp_link'])? 'off': 'on';
@@ -104,27 +105,28 @@ function yte_options_page()
104
  _e('<div id="message" class="updated fade"><p>' . $msg_status . '</p></div>');
105
 
106
  }
107
- else
108
- {
109
-
110
  // Fetch code from DB
111
- $disp_img = get_option('smart_yt_img');
112
- $disp_link = get_option('smart_yt_link');
113
 
114
 
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');
 
123
  $disp_color = get_option('smart_yt_color');
124
 
125
- $disp_posts = get_option('smart_yt_posts');
126
- $disp_comments = get_option('smart_yt_comments');
127
- $disp_rss = get_option('smart_yt_rss');
 
 
128
 
129
 
130
  if ($disp_width=="")
@@ -132,11 +134,12 @@ function yte_options_page()
132
  if ($disp_height=="")
133
  $disp_height="355";
134
 
135
- }
136
  global $wp_version;
137
- $embed_img=get_bloginfo('wpurl') . '/wp-content/plugins/smart-youtube/img/embed_selection-vfl29294.png';
 
138
 
139
- echo '<script src="' . get_bloginfo('wpurl') . '/wp-content/plugins/smart-youtube' . '/yt.js" type="text/javascript"></script>' . "\n";
140
  _e('<style type="text/css">
141
  #watch-embed-div,
142
  #watch-url-div{
@@ -256,168 +259,115 @@ text-decoration:none;
256
  </style>
257
  ');
258
 
259
- if(version_compare($wp_version,"2.5",">=")) {
260
- _e('
261
-
262
- <style type="text/css">
263
- .wrap {
264
- max-width:1000px !important;
265
- }
266
- div#moremeta {
267
- float:right;
268
- width:220px;
269
- margin-left:10px;
270
- }
271
- div#advancedstuff {
272
- width:770px;
273
- }
274
- div#poststuff {
275
- margin-top:10px;
276
- }
277
- fieldset.dbx-box {
278
- margin-bottom:5px;
279
- }
280
-
281
-
282
- </style>
283
- <!--[if lt IE 7]>
284
- <style type="text/css">
285
- div#advancedstuff {
286
- width:735px;
287
- }
288
- </style>
289
- <![endif]-->
290
-
291
-
292
 
293
 
294
- ');
295
- }
296
-
297
  // Configuration Page
298
- _e('
299
- <div class="wrap" id="options-div">
300
-
301
- <form name="form_yte" method="post" action="' . $_SERVER['REQUEST_URI'] . '">
302
- <h2>Smart Youtube '.$yte_localversion.'</h2>
303
-
304
- <div id="poststuff">
305
- <div id="moremeta">
306
- <div id="sidebarBlocks" class="dbx-group">
307
- <fieldset id="about" class="dbx-box">
308
- <h3 class="dbx-handle">Information</h3>
309
- <div id="dbx-content">
310
- <img src="'. trailingslashit(get_option('siteurl')). 'wp-content/plugins/smart-youtube/home.png"><a href="http://www.prelovac.com/vladimir/wordpress-plugins/smart-youtube"> Smart YouTube Home</a><br /><br />
311
- <img src="'. trailingslashit(get_option('siteurl')). 'wp-content/plugins/smart-youtube/idea.png"><a href="http://www.prelovac.com/vladimir/wordpress-plugins/smart-youtube#comments"> Suggest a Feature</a><br /><br />
312
- <img src="'. trailingslashit(get_option('siteurl')). 'wp-content/plugins/smart-youtube/more.png"><a href="http://www.prelovac.com/vladimir/wordpress-plugins"> My WordPress Plugins</a><br /><br />
313
  <br />
314
 
315
  <p align="center">
316
- <img src="'. trailingslashit(get_option('siteurl')). 'wp-content/plugins/smart-youtube/p1.png"></p>
317
 
318
- <p> <img src="'. trailingslashit(get_option('siteurl')). 'wp-content/plugins/smart-youtube/help.png"><a href="http://www.prelovac.com/vladimir/services"> Need a WordPress Expert?</a></p>
319
  </div>
320
- </div>
321
- </div>
322
-
323
- <div id="advancedstuff">
324
- <div id="mainBlocks" class="dbx-group" >
325
- <div class="dbx-b-ox-wrapper">
326
- <fieldset id="block-description" class="dbx-box">
327
-
328
- <div class="dbx-h-andle-wrapper">
329
- <h3 class="dbx-handle">Options</h3>
330
- </div>
331
-
332
- <div class="dbx-c-ontent-wrapper">
333
- <div class="dbx-content">
334
 
335
- <p>To use the video in your posts, paste YouTube video URL with <strong>httpv://</strong> (notice the \'v\'). The URL should just be copied into your post, do not create a link.</p>
 
336
  <p>Example: httpv://www.youtube.com/watch?v=OWfksMD4PAg</p>
337
 
338
 
339
  <p><strong>Video settings</strong></p>
340
 
341
- <div><input id="check3" type="checkbox" name="disp_posts"' .($disp_posts=="on"?'CHECKED':'').'/>
342
  <label for="check3">Display videos in posts</label></div>
343
 
344
- <div><input id="check4" type="checkbox" name="disp_comments"' .($disp_comments=="on"?'CHECKED':'').'/>
345
  <label for="check4">Display videos in comments</label></div>
346
 
347
 
348
  <br><br><strong>Video Appearence</strong><br><br>
349
 
350
 
351
- <div><input id="disp_width" name="disp_width" value="' .$disp_width.'"/>
352
  <label for="disp_width">Width</label></div>
353
 
354
- <div><input id="disp_height" name="disp_height" value="' .$disp_height.'"/>
355
  <label for="disp_height">Height</label></div>
356
- <br>
357
 
358
- <div id="watch-customize-embed-theme">
359
  <div id="watch-customize-embed-form">
360
- <input type="radio"'.($disp_rel ? 'checked':'').' id="embedCustomization1" name="embedRel" value="1"/>
361
  <label for="embedCustomization1">Include related videos</label><br/>
362
- <input type="radio"'.(!$disp_rel ? 'checked':'').' id="embedCustomization0" name="embedRel" value="0"/>
363
- <label for="embedCustomization0">Don\'t include related videos</label><br/>
364
  </div>
365
- <img id="watch-customize-embed-theme-preview" src="img/preview_embed_blank_sm.gif"/>
366
  <div id="watch-customize-embed-theme-swatches">
367
- <a onclick="onChangeColor(\'blank\'); return false;" class="watch-image-radio-link radio_selected" href="#" id="theme_color_blank_img"><img alt="" src="http://s.ytimg.com/yt/img/pixel-vfl73.gif" class="watch-embed-select watch-embed-blank"/></a>
368
- <a onclick="onChangeColor(\'storm\'); return false;" class="watch-image-radio-link" href="#" id="theme_color_storm_img"><img alt="" src="http://s.ytimg.com/yt/img/pixel-vfl73.gif" class="watch-embed-select watch-embed-storm"/></a>
369
- <a onclick="onChangeColor(\'iceberg\'); return false;" class="watch-image-radio-link " href="#" id="theme_color_iceberg_img"><img alt="" src="http://s.ytimg.com/yt/img/pixel-vfl73.gif" class="watch-embed-select watch-embed-iceberg"/></a>
370
- <a onclick="onChangeColor(\'acid\'); return false;" class="watch-image-radio-link" href="#" id="theme_color_acid_img"><img alt="" src="http://s.ytimg.com/yt/img/pixel-vfl73.gif" class="watch-embed-select watch-embed-acid"/></a>
371
- <a onclick="onChangeColor(\'green\'); return false;" class="watch-image-radio-link" href="#" id="theme_color_green_img"><img alt="" src="http://s.ytimg.com/yt/img/pixel-vfl73.gif" class="watch-embed-select watch-embed-green"/></a>
372
- <a onclick="onChangeColor(\'orange\'); return false;" class="watch-image-radio-link" href="#" id="theme_color_orange_img"><img alt="" src="http://s.ytimg.com/yt/img/pixel-vfl73.gif" class="watch-embed-select watch-embed-orange"/></a>
373
- <a onclick="onChangeColor(\'pink\'); return false;" class="watch-image-radio-link" href="#" id="theme_color_pink_img"><img alt="" src="http://s.ytimg.com/yt/img/pixel-vfl73.gif" class="watch-embed-select watch-embed-pink"/></a>
374
- <a onclick="onChangeColor(\'purple\'); return false;" class="watch-image-radio-link" href="#" id="theme_color_purple_img"><img alt="" src="http://s.ytimg.com/yt/img/pixel-vfl73.gif" class="watch-embed-select watch-embed-purple"/></a>
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;" />
399
- </p>
400
- </form>
401
-
402
-
403
-
404
- </div>
405
- </div>
406
-
407
- </fieldset>
408
-
409
- </div>
410
- </div>
411
- </div>
412
- <h4>plugin by <a href="http://www.prelovac.com/vladimir/">Vladimir Prelovac</a></h4>
413
- </div>
414
-
415
-
416
-
417
 
 
 
 
418
  </div>
419
-
420
- ');
421
 
422
  }
423
 
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.91
8
  Author URI: http://www.prelovac.com/vladimir/
9
 
10
  Updates:
18
  - localization
19
  */
20
 
21
+ $yte_localversion="1.91";
22
 
23
  $CustomColors=array (
24
  "blank" => array("d6d6d6","f0f0f0"),
32
  "rubyred" => array("5d1719","cd311b")
33
  );
34
 
35
+ $wp_yte_plugin_url = trailingslashit( get_bloginfo('wpurl') ).PLUGINDIR.'/'. dirname( plugin_basename(__FILE__) );
36
 
37
  // Admin Panel
38
  function yte_add_pages()
62
 
63
 
64
  // If form was submitted
65
+ if (isset($_POST['submitted']))
66
  {
67
  $disp_img = !isset($_POST['disp_img'])? 'off': 'on';
68
  $disp_link = !isset($_POST['disp_link'])? 'off': 'on';
105
  _e('<div id="message" class="updated fade"><p>' . $msg_status . '</p></div>');
106
 
107
  }
108
+
 
 
109
  // Fetch code from DB
110
+ $disp_img = (get_option('smart_yt_img')=='on') ? 'checked':'';
111
+ $disp_link = (get_option('smart_yt_link')=='on') ? 'checked':'';
112
 
113
 
114
  $disp_width = get_option('smart_yt_width');
115
  $disp_height = get_option('smart_yt_height');
116
 
117
+ $disp_autoplay = (get_option('smart_yt_autoplay')=='1') ? 'checked':'';
118
 
119
 
120
+ $disp_rel = (get_option('smart_yt_rel')=='on') ? 'checked':'';
121
+ $disp_rel2=$disp_rel ? "" : "checked";
122
+ $disp_border = (get_option('smart_yt_border')=='1') ? 'checked':'';
123
  $disp_color = get_option('smart_yt_color');
124
 
125
+
126
+ $disp_posts = (get_option('smart_yt_posts')=='on') ? 'checked' :'' ;
127
+ $disp_comments = (get_option('smart_yt_comments')=='on') ? 'checked':'';
128
+
129
+
130
 
131
 
132
  if ($disp_width=="")
134
  if ($disp_height=="")
135
  $disp_height="355";
136
 
137
+
138
  global $wp_version;
139
+ global $wp_yte_plugin_url;
140
+ $embed_img=$wp_yte_plugin_url.'/img/embed_selection-vfl29294.png';
141
 
142
+ echo '<script src="' . $wp_yte_plugin_url . '/yt.js" type="text/javascript"></script>' . "\n";
143
  _e('<style type="text/css">
144
  #watch-embed-div,
145
  #watch-url-div{
259
  </style>
260
  ');
261
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
262
 
263
 
264
+ $imgpath=$wp_yte_plugin_url.'/i';
265
+ $actionurl=$_SERVER['REQUEST_URI'];
 
266
  // Configuration Page
267
+
268
+
269
+ echo <<<END
270
+ <div class="wrap" style="max-width:950px !important;">
271
+ <h2>Smart YouTube $yte_localversion</h2>
272
+
273
+ <div id="poststuff" style="margin-top:10px;">
274
+
275
+ <div id="sideblock" style="float:right;width:220px;margin-left:10px;">
276
+ <h3>Information</h3>
277
+ <div id="dbx-content" style="text-decoration:none;">
278
+ <img src="$imgpath/home.png"><a href="http://www.prelovac.com/vladimir/wordpress-plugins/smart-youtube"> Smart YouTube Home</a><br /><br />
279
+ <img src="$imgpath/help.png"><a href="http://www.prelovac.com/vladimir/wordpress-plugins/smart-youtube#comments"> Suggest a Feature</a><br /><br />
280
+ <img src="$imgpath/rate.png"><a href="http://wordpress.org/extend/plugins/smart-youtube/"> Rate Smart YouTube</a><br /><br />
281
+ <img src="$imgpath/more.png"><a href="http://www.prelovac.com/vladimir/wordpress-plugins"> My WordPress Plugins</a><br /><br />
282
  <br />
283
 
284
  <p align="center">
285
+ <img src="$imgpath/p1.png"></p>
286
 
287
+ <p> <img src="$imgpath/idea.png"><a href="http://www.prelovac.com/vladimir/services"> Need a WordPress Expert?</a></p>
288
  </div>
289
+ </div>
290
+
291
+ <div id="mainblock" style="width:710px">
292
+
293
+ <div class="dbx-content">
294
+ <form name="yteform" action="$action_url" method="post">
295
+ <input type="hidden" name="submitted" value="1" />
296
+ <h3> General Options</h3>
 
 
 
 
 
 
297
 
298
+ <p>To use the video in your posts, paste YouTube video URL with <strong>httpv://</strong> (notice the 'v'). </p>
299
+ <p><strong>Important:</strong> The URL should just be pasted into your post as normal text, do not create a link as it will not work.</p>
300
  <p>Example: httpv://www.youtube.com/watch?v=OWfksMD4PAg</p>
301
 
302
 
303
  <p><strong>Video settings</strong></p>
304
 
305
+ <div><input id="check3" type="checkbox" name="disp_posts" $disp_posts />
306
  <label for="check3">Display videos in posts</label></div>
307
 
308
+ <div><input id="check4" type="checkbox" name="disp_comments" $disp_comments />
309
  <label for="check4">Display videos in comments</label></div>
310
 
311
 
312
  <br><br><strong>Video Appearence</strong><br><br>
313
 
314
 
315
+ <div><input id="disp_width" name="disp_width" value="$disp_width"/>
316
  <label for="disp_width">Width</label></div>
317
 
318
+ <div><input id="disp_height" name="disp_height" value="$disp_height"/>
319
  <label for="disp_height">Height</label></div>
 
320
 
321
+ <br />
322
  <div id="watch-customize-embed-form">
323
+ <input type="radio" $disp_rel id="embedCustomization1" name="embedRel" value="1"/>
324
  <label for="embedCustomization1">Include related videos</label><br/>
325
+ <input type="radio" $disp_rel2 id="embedCustomization0" name="embedRel" value="0"/>
326
+ <label for="embedCustomization0">Do not include related videos</label><br/>
327
  </div>
328
+ <img id="watch-customize-embed-theme-preview" src="$wp_yte_plugin_url/img/preview_embed_blank_sm.gif"/>
329
  <div id="watch-customize-embed-theme-swatches">
330
+ <a onclick="onChangeColor('blank'); return false;" class="watch-image-radio-link radio_selected" href="#" id="theme_color_blank_img"><img alt="" src="http://s.ytimg.com/yt/img/pixel-vfl73.gif" class="watch-embed-select watch-embed-blank"/></a>
331
+ <a onclick="onChangeColor('storm'); return false;" class="watch-image-radio-link" href="#" id="theme_color_storm_img"><img alt="" src="http://s.ytimg.com/yt/img/pixel-vfl73.gif" class="watch-embed-select watch-embed-storm"/></a>
332
+ <a onclick="onChangeColor('iceberg'); return false;" class="watch-image-radio-link " href="#" id="theme_color_iceberg_img"><img alt="" src="http://s.ytimg.com/yt/img/pixel-vfl73.gif" class="watch-embed-select watch-embed-iceberg"/></a>
333
+ <a onclick="onChangeColor('acid'); return false;" class="watch-image-radio-link" href="#" id="theme_color_acid_img"><img alt="" src="http://s.ytimg.com/yt/img/pixel-vfl73.gif" class="watch-embed-select watch-embed-acid"/></a>
334
+ <a onclick="onChangeColor('green'); return false;" class="watch-image-radio-link" href="#" id="theme_color_green_img"><img alt="" src="http://s.ytimg.com/yt/img/pixel-vfl73.gif" class="watch-embed-select watch-embed-green"/></a>
335
+ <a onclick="onChangeColor('orange'); return false;" class="watch-image-radio-link" href="#" id="theme_color_orange_img"><img alt="" src="http://s.ytimg.com/yt/img/pixel-vfl73.gif" class="watch-embed-select watch-embed-orange"/></a>
336
+ <a onclick="onChangeColor('pink'); return false;" class="watch-image-radio-link" href="#" id="theme_color_pink_img"><img alt="" src="http://s.ytimg.com/yt/img/pixel-vfl73.gif" class="watch-embed-select watch-embed-pink"/></a>
337
+ <a onclick="onChangeColor('purple'); return false;" class="watch-image-radio-link" href="#" id="theme_color_purple_img"><img alt="" src="http://s.ytimg.com/yt/img/pixel-vfl73.gif" class="watch-embed-select watch-embed-purple"/></a>
338
+ <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>
339
+ <input id="embedColor" type="hidden" name="embedColor" value="$disp_color">
340
+ <input id="prevUrl" type="hidden" name="prevUrl" value="$wp_yte_plugin_url/img/">
341
  </div>
342
  <div style="margin: 0px 0px 0px 4px; clear: both;">
343
+ <input type="checkbox" onchange="onUpdatePreviewImage();" id="show_border_checkbox" name="embedBorder" $disp_border /><label for="show_border_checkbox"> Show Border</label><br>
344
+ <input type="checkbox" id="autoplay_checkbox" name="autoplay" $disp_autoplay /><label for="autoplay_checkbox"> Autoplay videos</label><br>
345
  </div>
346
 
 
347
 
348
  <br>
349
  <p><strong>RSS feed options</strong></p>
350
  <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>
351
  <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>
352
 
353
+ <div><input id="check2" type="checkbox" name="disp_link" $disp_link />
354
  <label for="check2">Display video link in RSS feed</label></div>
355
 
356
+ <div><input id="check1" type="checkbox" name="disp_img" $disp_img />
357
  <label for="check1">Display video preview image in RSS feed</label></div>
358
 
359
+ <div class="submit"><input type="submit" name="Submit" value="Update options" /></div>
360
+ </form>
361
+ </div>
362
+
363
+ <br/><br/><h3>&nbsp;</h3>
364
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
365
 
366
+ </div>
367
+
368
+ <h5>WordPress plugin by <a href="http://www.prelovac.com/vladimir/">Vladimir Prelovac</a></h5>
369
  </div>
370
+ END;
 
371
 
372
  }
373