Smart YouTube PRO - Version 1.8

Version Description

Download this release

Release Info

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

Version 1.8

help.png ADDED
Binary file
home.png ADDED
Binary file
idea.png ADDED
Binary file
img/embed_selection-vfl29294.png ADDED
Binary file
img/preview_embed_acid_sm.gif ADDED
Binary file
img/preview_embed_acid_sm_nb.gif ADDED
Binary file
img/preview_embed_blank_sm.gif ADDED
Binary file
img/preview_embed_blank_sm_nb.gif ADDED
Binary file
img/preview_embed_green_sm.gif ADDED
Binary file
img/preview_embed_green_sm_nb.gif ADDED
Binary file
img/preview_embed_iceberg_sm.gif ADDED
Binary file
img/preview_embed_iceberg_sm_nb.gif ADDED
Binary file
img/preview_embed_orange_sm.gif ADDED
Binary file
img/preview_embed_orange_sm_nb.gif ADDED
Binary file
img/preview_embed_pink_sm.gif ADDED
Binary file
img/preview_embed_pink_sm_nb.gif ADDED
Binary file
img/preview_embed_purple_sm.gif ADDED
Binary file
img/preview_embed_purple_sm_nb.gif ADDED
Binary file
img/preview_embed_rubyred_sm.gif ADDED
Binary file
img/preview_embed_rubyred_sm_nb.gif ADDED
Binary file
img/preview_embed_storm_sm.gif ADDED
Binary file
img/preview_embed_storm_sm_nb.gif ADDED
Binary file
more.png ADDED
Binary file
p1.png ADDED
Binary file
readme.txt ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Smart YouTube ===
2
+ Contributors: freediver
3
+ Donate link: https://www.networkforgood.org/donation/MakeDonation.aspx?ORGID2=520781390
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
+
11
+
12
+ == Description ==
13
+
14
+ Smart Youtube is a Wordpress Youtube Plugin that allows you to easily insert Youtube videos in your post, comments and in RSS feed. It is small, fast and does not depend on any external scripts.
15
+
16
+ The main purpose of the plugin is to correctly embed youtube videos into your blog post. The video will be shown in full in your RSS feed as well.
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
+
23
+ Changes v1.6:
24
+ Solved problem with WordPress handling special characters.
25
+
26
+ Changes v1.5:
27
+ Reworked admin interface, add more features like video color and border.
28
+
29
+ Changes v1.4:
30
+ All youtube servers work now (like uk.youtube.com, es.youtube.com).
31
+
32
+ Changes v1.3:
33
+ The plugin now allows embedding video in comments too. Syntax is the same.
34
+
35
+ Changes v1.2:
36
+ Added Width and Height option and made plugin code xHTML valid.
37
+
38
+ == Credits ==
39
+
40
+ Some of the functions of SmartYoutube plugin came from other plugins. So I can at least thank these people:
41
+
42
+ * [Oliver](http://www.deliciousdays.com/ "Oliver") for his [cforms II](http://www.deliciousdays.com/cforms-plugin "cforms II") plugin
43
+ * [Scott](http://www.plaintxt.org/ "Scott") for his excellent readme.txt file
44
+ * [YouTube](http://www.youtube.com/ "YouTube") folks for their service and javascript selector
45
+
46
+ Thanks.
47
+
48
+ == Installation ==
49
+
50
+ 1. Upload the whole plugin folder to your /wp-content/plugins/ folder.
51
+ 2. Go to the Plugins page and activate the plugin.
52
+ 3. Use the Options page to change your options
53
+ 4. When you want to display Youtube video in your post, paste the video URL with httpv:// (notice the �v�)
54
+
55
+ The video will be automatically embedded to your post in the proper way.
56
+
57
+ Example: httpv://www.youtube.com/watch?v=OWfksMD4PAg
58
+
59
+ Additionally, you can set how do you want the video to be displayed in your RSS feed. Smart Youtube can show the preview image of the video (automatically grabbed from Youtube), the link to the video, or both. I recommend enabling only the preview image.
60
+
61
+ == Screenshots ==
62
+
63
+ 1. Plugin Admin Panel
64
+ 2. Plugin in action in your RSS feed
65
+
66
+ == License ==
67
+
68
+ This file is part of Smart YouTube.
69
+
70
+ Smart YouTube is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
71
+
72
+ Smart YouTube is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
73
+
74
+ You should have received a copy of the GNU General Public License along with Smart YouTube. If not, see <http://www.gnu.org/licenses/>.
75
+
76
+
77
+ == Frequently Asked Questions ==
78
+
79
+ = How do I correctly use this plugin? =
80
+
81
+ Copy the URL of YouTube video you want to watch. Paste it in your post anywhere. Example: httpv://www.youtube.com/watch?v=OWfksMD4PAg
82
+
83
+ = The plugin still does not show up a video! =
84
+
85
+ Make sure you copied the URL as text, do not create a link!
86
+
87
+
88
+ = Can I suggest an feature for the plugin? =
89
+
90
+ Of course, visit <a href="http://www.prelovac.com/vladimir/wordpress-plugins/smart-youtube#comments">Smart YouTube Home Page</a>
91
+
92
+ = I love your work, are you available for hire? =
93
+
94
+ Yes I am, visit my <a href="http://www.prelovac.com/vladimir/services">WordPress Services</a> page to find out more.
screenshot-1.png ADDED
Binary file
screenshot-2.png ADDED
Binary file
smartyoutube.chk ADDED
@@ -0,0 +1,2 @@
 
 
1
+ Version@1.5@
2
+ Message@<ul><li>New video customization features including color and border</li></ul>
smartyoutube.php ADDED
@@ -0,0 +1,548 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
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: 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
14
+
15
+ To-Doo:
16
+ - add editor button
17
+ - localization
18
+ */
19
+
20
+ $yte_localversion="1.8";
21
+
22
+ $CustomColors=array (
23
+ "blank" => array("d6d6d6","f0f0f0"),
24
+ "storm" => array("3a3a3a","999999"),
25
+ "iceberg" => array("2b405b","6b8ab6"),
26
+ "acid" => array("006699","54abd6"),
27
+ "green" => array("234900","4e9e00"),
28
+ "orange" => array("e1600f","febd01"),
29
+ "pink" => array("cc2550","e87a9f"),
30
+ "purple" => array("402061","9461ca"),
31
+ "rubyred" => array("5d1719","cd311b")
32
+ );
33
+
34
+
35
+ // Admin Panel
36
+ function yte_add_pages()
37
+ {
38
+ add_options_page('Smart Youtube options', 'Smart Youtube', 8, __FILE__, 'yte_options_page');
39
+ }
40
+
41
+
42
+
43
+ // Options Page
44
+ function yte_options_page()
45
+ {
46
+ global $yte_localversion;
47
+ $status=yte_getinfo();
48
+
49
+ $theVersion = $status[1];
50
+ $theMessage = $status[3];
51
+
52
+
53
+
54
+ if( (version_compare(strval($theVersion), strval($yte_localversion), '>') == 1) )
55
+ {
56
+ $msg = 'Latest version available '.' <strong>'.$theVersion.'</strong><br />'.$theMessage;
57
+ _e('<div id="message" class="updated fade"><p>' . $msg . '</p></div>');
58
+
59
+ }
60
+
61
+
62
+ // If form was submitted
63
+ if (isset($_POST['yte_update']))
64
+ {
65
+ $disp_img = !isset($_POST['disp_img'])? 'off': 'on';
66
+ $disp_link = !isset($_POST['disp_link'])? 'off': 'on';
67
+
68
+ update_option('smart_yt_img', $disp_img);
69
+ update_option('smart_yt_link', $disp_link);
70
+
71
+ $disp_width = ($_POST['disp_width']=="")? '425': $_POST['disp_width'];
72
+ $disp_height = ($_POST['disp_height']=="")? '355': $_POST['disp_height'];
73
+
74
+ update_option('smart_yt_width', $disp_width);
75
+ update_option('smart_yt_height', $disp_height);
76
+
77
+ $disp_rel = !isset($_POST['embedRel'])? '1': $_POST['embedRel'];
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
+
89
+
90
+ update_option('smart_yt_posts', $disp_posts);
91
+ update_option('smart_yt_comments', $disp_comments);
92
+
93
+
94
+
95
+
96
+ $msg_status = 'Smart Youtube options saved.';
97
+
98
+ // Show message
99
+ _e('<div id="message" class="updated fade"><p>' . $msg_status . '</p></div>');
100
+
101
+ }
102
+ else
103
+ {
104
+
105
+ // Fetch code from DB
106
+ $disp_img = get_option('smart_yt_img');
107
+ $disp_link = get_option('smart_yt_link');
108
+
109
+
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');
116
+ $disp_color = get_option('smart_yt_color');
117
+
118
+ $disp_posts = get_option('smart_yt_posts');
119
+ $disp_comments = get_option('smart_yt_comments');
120
+ $disp_rss = get_option('smart_yt_rss');
121
+
122
+
123
+ if ($disp_width=="")
124
+ $disp_width="425";
125
+ if ($disp_height=="")
126
+ $disp_height="355";
127
+
128
+ }
129
+ global $wp_version;
130
+ $embed_img=get_bloginfo('wpurl') . '/wp-content/plugins/smart-youtube/img/embed_selection-vfl29294.png';
131
+
132
+ echo '<script src="' . get_bloginfo('wpurl') . '/wp-content/plugins/smart-youtube' . '/yt.js" type="text/javascript"></script>' . "\n";
133
+ _e('<style type="text/css">
134
+ #watch-embed-div,
135
+ #watch-url-div{
136
+ border-top:1px solid #CCC;
137
+ font-size:11px;
138
+ }
139
+ #watch-url-div{
140
+ margin:5px 0;
141
+ }
142
+ #watch-url-field{
143
+ font-size:10px;
144
+ width:340px;
145
+ margin-top:2px;
146
+ }
147
+ #watch-embed-div label,
148
+ #watch-url-div label{
149
+ color:#999;
150
+ line-height:18px;
151
+ font-size:12px;
152
+ }
153
+ #watch-embed-div input{
154
+ font-size:10px;
155
+ width:339px;
156
+ margin-top:2px;
157
+ }
158
+ #watch-embed-div #watch-embed-customize{
159
+ font-weight:normal;
160
+ color:#03c;
161
+ }
162
+ #watch-customize-embed-div{
163
+ display:none;
164
+ background-color:white;
165
+ border-top:1px solid #CCC;
166
+ margin-top:5px;
167
+ padding:5px;
168
+ }
169
+ #watch-customize-embed-form{
170
+ display:block;
171
+ width:210px;
172
+ }
173
+ #watch-customize-embed-desc{
174
+ display:block;
175
+ padding:6px;
176
+ }
177
+ #watch-customize-embed-theme{
178
+ display:block;
179
+ clear:both;
180
+ }
181
+ #watch-customize-embed-theme-swatches{
182
+ padding:5px;
183
+ display:block;
184
+ margin-top:5px;
185
+ width:310px;
186
+ height:80px;
187
+ }
188
+ #watch-customize-embed-theme-preview{
189
+ display:block;
190
+ float:right;
191
+ margin:4px 140px;
192
+ background:transparent url('.$embed_img.') no-repeat scroll 0px -23px;
193
+ width:100px;
194
+ height:86px;
195
+ }
196
+ .watch-image-radio-link{
197
+ border:0;
198
+ display:inline-block;
199
+ float:left;
200
+ margin:3px;
201
+ }
202
+ .watch-image-radio-link:hover{
203
+ background-color:#ADD8E6;
204
+ }
205
+ .watch-image-radio-link.radio_selected{
206
+ border:1px solid #000;
207
+ margin:2px;
208
+ }
209
+ .watch-image-radio-link img{
210
+ border:1px solid #fff;
211
+ background-color:#fff;
212
+ padding:0px;
213
+ margin:4px;
214
+ }
215
+ .watch-embed-select{
216
+ width:46px;
217
+ height:23px;
218
+ }
219
+ .watch-embed-iceberg{
220
+ background:transparent url('.$embed_img.') no-repeat scroll 0px 0px;
221
+ }
222
+ .watch-embed-blank{
223
+ background:transparent url('.$embed_img.') no-repeat scroll -46px 0px;
224
+ }
225
+ .watch-embed-acid{
226
+ background:transparent url('.$embed_img.') no-repeat scroll -92px 0px;
227
+ }
228
+ .watch-embed-storm{
229
+ background:transparent url('.$embed_img.') no-repeat scroll -138px 0px;
230
+ }
231
+ .watch-embed-green{
232
+ background:transparent url('.$embed_img.') no-repeat scroll -184px 0px;
233
+ }
234
+ .watch-embed-orange{
235
+ background:transparent url('.$embed_img.') no-repeat scroll -230px 0px;
236
+ }
237
+ .watch-embed-pink{
238
+ background:transparent url('.$embed_img.') no-repeat scroll -276px 0px;
239
+ }
240
+ .watch-embed-purple{
241
+ background:transparent url('.$embed_img.') no-repeat scroll -322px 0px;
242
+ }
243
+ .watch-embed-rubyred{
244
+ background:transparent url('.$embed_img.') no-repeat scroll -368px 0px;
245
+ }
246
+ div#dbx-content a{
247
+ text-decoration:none;
248
+ }
249
+ </style>
250
+ ');
251
+
252
+ if(version_compare($wp_version,"2.5",">=")) {
253
+ _e('
254
+
255
+ <style type="text/css">
256
+ .wrap {
257
+ max-width:1000px !important;
258
+ }
259
+ div#moremeta {
260
+ float:right;
261
+ width:220px;
262
+ margin-left:10px;
263
+ }
264
+ div#advancedstuff {
265
+ width:770px;
266
+ }
267
+ div#poststuff {
268
+ margin-top:10px;
269
+ }
270
+ fieldset.dbx-box {
271
+ margin-bottom:5px;
272
+ }
273
+
274
+
275
+ </style>
276
+ <!--[if lt IE 7]>
277
+ <style type="text/css">
278
+ div#advancedstuff {
279
+ width:735px;
280
+ }
281
+ </style>
282
+ <![endif]-->
283
+
284
+
285
+
286
+
287
+ ');
288
+ }
289
+
290
+ // Configuration Page
291
+ _e('
292
+ <div class="wrap" id="options-div">
293
+
294
+ <form name="form_yte" method="post" action="' . $_SERVER['REQUEST_URI'] . '">
295
+ <h2>Smart Youtube '.$yte_localversion.'</h2>
296
+
297
+ <div id="poststuff">
298
+ <div id="moremeta">
299
+ <div id="sidebarBlocks" class="dbx-group">
300
+ <fieldset id="about" class="dbx-box">
301
+ <h3 class="dbx-handle">Information</h3>
302
+ <div id="dbx-content">
303
+ <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 />
304
+ <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 />
305
+ <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 />
306
+ <br />
307
+
308
+ <p align="center">
309
+ <img src="'. trailingslashit(get_option('siteurl')). 'wp-content/plugins/smart-youtube/p1.png"></p>
310
+
311
+ <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>
312
+ </div>
313
+ </div>
314
+ </div>
315
+
316
+ <div id="advancedstuff">
317
+ <div id="mainBlocks" class="dbx-group" >
318
+ <div class="dbx-b-ox-wrapper">
319
+ <fieldset id="block-description" class="dbx-box">
320
+
321
+ <div class="dbx-h-andle-wrapper">
322
+ <h3 class="dbx-handle">Options</h3>
323
+ </div>
324
+
325
+ <div class="dbx-c-ontent-wrapper">
326
+ <div class="dbx-content">
327
+
328
+ <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>
329
+ <p>Example: httpv://www.youtube.com/watch?v=OWfksMD4PAg</p>
330
+
331
+
332
+ <p><strong>Video settings</strong></p>
333
+
334
+ <div><input id="check3" type="checkbox" name="disp_posts"' .($disp_posts=="on"?'CHECKED':'').'/>
335
+ <label for="check3">Display videos in posts</label></div>
336
+
337
+ <div><input id="check4" type="checkbox" name="disp_comments"' .($disp_comments=="on"?'CHECKED':'').'/>
338
+ <label for="check4">Display videos in comments</label></div>
339
+
340
+
341
+ <br><br><strong>Video Appearence</strong><br><br>
342
+
343
+
344
+ <div><input id="disp_width" name="disp_width" value="' .$disp_width.'"/>
345
+ <label for="disp_width">Width</label></div>
346
+
347
+ <div><input id="disp_height" name="disp_height" value="' .$disp_height.'"/>
348
+ <label for="disp_height">Height</label></div>
349
+ <br>
350
+
351
+ <div id="watch-customize-embed-theme">
352
+ <div id="watch-customize-embed-form">
353
+ <input type="radio"'.($disp_rel ? 'checked':'').' id="embedCustomization1" name="embedRel" value="1"/>
354
+ <label for="embedCustomization1">Include related videos</label><br/>
355
+ <input type="radio"'.(!$disp_rel ? 'checked':'').' id="embedCustomization0" name="embedRel" value="0"/>
356
+ <label for="embedCustomization0">Don\'t include related videos</label><br/>
357
+ </div>
358
+ <img id="watch-customize-embed-theme-preview" src="img/preview_embed_blank_sm.gif"/>
359
+ <div id="watch-customize-embed-theme-swatches">
360
+ <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>
361
+ <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>
362
+ <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>
363
+ <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>
364
+ <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>
365
+ <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>
366
+ <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>
367
+ <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>
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;" />
380
+ </p>
381
+ </form>
382
+
383
+
384
+
385
+ </div>
386
+ </div>
387
+
388
+ </fieldset>
389
+
390
+ </div>
391
+ </div>
392
+ </div>
393
+ <h4>plugin by <a href="http://www.prelovac.com/vladimir/">Vladimir Prelovac</a></h4>
394
+ </div>
395
+
396
+
397
+
398
+
399
+ </div>
400
+
401
+ ');
402
+
403
+ }
404
+
405
+ // Add Options Page
406
+ add_action('admin_menu', 'yte_add_pages');
407
+
408
+
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";
432
+ if ($height=="")
433
+ $height="355";
434
+
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
+
443
+ function yte_check($the_content) {
444
+ if(strpos($the_content, "httpv://")!==FALSE) {
445
+
446
+ $char_codes = array('&#215;');
447
+ $replacements = array("x");
448
+ $the_content=str_replace($char_codes, $replacements, $the_content);
449
+
450
+ preg_match_all("/httpv:\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/)([a-zA-Z0-9\-\_]{11})([^<\s]*)/", $the_content, $matches, PREG_SET_ORDER);
451
+ foreach($matches as $match) {
452
+ $the_content = preg_replace("/httpv:\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/)([a-zA-Z0-9\-\_]{11})([^\s<]*)/", yte_tag($match[3]), $the_content, 1);
453
+ }
454
+ }
455
+ return $the_content;
456
+ }
457
+
458
+
459
+ function yte_install(){
460
+ if(get_option('smart_yt_posts' == '') || !get_option('smart_yt_posts')){
461
+ add_option('smart_yt_posts', 'on');
462
+ }
463
+ if(get_option('smart_yt_width' == '') || !get_option('smart_yt_width')){
464
+ add_option('smart_yt_width', '425');
465
+ }
466
+ if(get_option('smart_yt_height' == '') || !get_option('smart_yt_height')){
467
+ add_option('smart_yt_height', '355');
468
+ }
469
+
470
+ if(get_option('smart_yt_rel' == '') || !get_option('smart_yt_rel')){
471
+ add_option('smart_yt_rel', '1');
472
+ }
473
+ if(get_option('smart_yt_color' == '') || !get_option('smart_yt_color')){
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') {
484
+ yte_install();
485
+ }
486
+
487
+ if (get_option('smart_yt_posts')=='on') {
488
+ add_filter('the_content', 'yte_check', 100);
489
+ add_filter('the_excerpt','yte_check', 100);
490
+
491
+
492
+ }
493
+ if (get_option('smart_yt_comments')=='on') {
494
+ add_filter('comment_text','yte_check', 100);
495
+
496
+ }
497
+
498
+ add_action( 'plugins_loaded', 'yte_install' );
499
+
500
+ add_action( 'after_plugin_row', 'yte_check_plugin_version' );
501
+
502
+ function yte_getinfo()
503
+ {
504
+ $checkfile = "http://svn.wp-plugins.org/smart-youtube/trunk/smartyoutube.chk";
505
+ //$checkfile = "http://www.prelovac.com/plugin/smartyoutube.chk";
506
+
507
+ $status=array();
508
+ return $status;
509
+ $vcheck = wp_remote_fopen($checkfile);
510
+
511
+ if($vcheck)
512
+ {
513
+ $version = $yte_localversion;
514
+
515
+ $status = explode('@', $vcheck);
516
+ return $status;
517
+ }
518
+ }
519
+
520
+ function yte_check_plugin_version($plugin)
521
+ {
522
+ global $plugindir,$yte_localversion;
523
+
524
+ if( strpos($plugin,'smartyoutube.php')!==false )
525
+ {
526
+
527
+
528
+ $status=yte_getinfo();
529
+
530
+ $theVersion = $status[1];
531
+ $theMessage = $status[3];
532
+
533
+ if( (version_compare(strval($theVersion), strval($yte_localversion), '>') == 1) )
534
+ {
535
+ $msg = 'Latest version available '.' <strong>'.$theVersion.'</strong><br />'.$theMessage;
536
+ echo '<td colspan="5" class="plugin-update" style="line-height:1.2em;">'.$msg.'</td>';
537
+ } else {
538
+ return;
539
+ }
540
+
541
+ }
542
+ }
543
+
544
+
545
+
546
+
547
+
548
+ ?>
yt.js ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ function toggleClass(element, className) {
4
+ var e = ref(element);
5
+ if (!e) return;
6
+ if (hasClass(e, className)) {
7
+ removeClass(e, className);
8
+ } else {
9
+ addClass(e, className);
10
+ }
11
+ }
12
+ function hasClass(element, _className) {
13
+ if (!element) {
14
+ return;
15
+ }
16
+ var upperClass = _className.toUpperCase();
17
+ if (element.className) {
18
+ var classes = element.className.split(' ');
19
+ for (var i = 0; i < classes.length; i++) {
20
+ if (classes[i].toUpperCase() == upperClass) {
21
+ return true;
22
+ }
23
+ }
24
+ }
25
+ return false;
26
+ }
27
+ function addClass(element, _class) {
28
+ if (!hasClass(element, _class)) {
29
+ element.className += element.className ? (" " + _class) : _class;
30
+ }
31
+ }
32
+ function getClassList(element) {
33
+ if (element.className) {
34
+ return element.className.split(' ');
35
+ } else {
36
+ return [];
37
+ }
38
+ }
39
+ function removeClass(element, _class) {
40
+ var upperClass = _class.toUpperCase();
41
+ var remainingClasses = [];
42
+ if (element.className) {
43
+ var classes = element.className.split(' ');
44
+ for (var i = 0; i < classes.length; i++) {
45
+ if (classes[i].toUpperCase() != upperClass) {
46
+ remainingClasses[remainingClasses.length] = classes[i];
47
+ }
48
+ }
49
+ element.className = remainingClasses.join(' ');
50
+ }
51
+ }
52
+ function findAncestorByClass(element, className) {
53
+ var temp = element;
54
+ while (temp != document) {
55
+ if (hasClass(temp, className)) return temp;
56
+ temp = temp.parentNode;
57
+ }
58
+ return null;
59
+ }
60
+
61
+ var selectedThemeColor='blank';
62
+ function onChangeColor(color){
63
+ var oldTheme=document.getElementById('theme_color_'+selectedThemeColor+'_img');
64
+ var newTheme=document.getElementById('theme_color_'+color+'_img');
65
+
66
+ var embedColor=document.getElementById('embedColor');
67
+ embedColor.value=color;
68
+
69
+ removeClass(oldTheme,'radio_selected');
70
+ addClass(newTheme,'radio_selected');
71
+ selectedThemeColor=color;
72
+ onUpdatePreviewImage();
73
+ return false;
74
+ }
75
+
76
+ function onUpdatePreviewImage(){
77
+ var previewImage=document.getElementById('watch-customize-embed-theme-preview');
78
+ var showBorderCheckBox=document.getElementById('show_border_checkbox');
79
+ var embedColor=document.getElementById('embedColor');
80
+ var border=(!showBorderCheckBox.checked?'_nb':'');
81
+ var prevUrl=document.getElementById('prevUrl');
82
+
83
+ selectedThemeColor=embedColor.value;
84
+ previewImage.src=prevUrl.value+'preview_embed_'+selectedThemeColor+'_sm'+border+'.gif';
85
+ //previewImage.src='http://www.youtube.com/img/preview_embed_'+selectedThemeColor+'_sm'+border+'.gif';
86
+ }
87
+
88
+ function loaded()
89
+ {
90
+ var previewImage=document.getElementById('watch-customize-embed-theme-preview');
91
+ var showBorderCheckBox=document.getElementById('show_border_checkbox');
92
+ var embedColor=document.getElementById('embedColor');
93
+ var prevUrl=document.getElementById('prevUrl');
94
+ var border=(!showBorderCheckBox.checked?'_nb':'');
95
+
96
+ selectedThemeColor="blank";
97
+
98
+ onChangeColor(embedColor.value);
99
+ previewImage.src=prevUrl.value+'preview_embed_'+selectedThemeColor+'_sm'+border+'.gif';
100
+
101
+ }
102
+ window.onload = loaded;