Smart YouTube PRO - Version 3.4

Version Description

  • Completely rewritten the plugin
  • Added new HD video support (use vh now for all high quality videos)
  • Added video privacy option
Download this release

Release Info

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

Code changes from version 3.3.2 to 3.4

Files changed (10) hide show
  1. help.png +0 -0
  2. home.png +0 -0
  3. idea.png +0 -0
  4. more.png +0 -0
  5. p1.png +0 -0
  6. readme.txt +11 -7
  7. smartyoutube.class.php +676 -0
  8. smartyoutube.php +51 -740
  9. style.css +213 -0
  10. yt.js +28 -1
help.png DELETED
Binary file
home.png DELETED
Binary file
idea.png DELETED
Binary file
more.png DELETED
Binary file
p1.png DELETED
Binary file
readme.txt CHANGED
@@ -8,14 +8,13 @@ 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
 
11
-
12
- == Description ==
13
 
14
  Smart Youtube is a Wordpress Youtube Plugin that allows you to easily insert Youtube videos/playlists in your post, comments and in RSS feed.
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
- From version 2.0 Smart youtube also supports playback of high quality videos, works on iPhone, produces xHTML valid code (unlike YouTUbe embed code), allows you to view videos in fullscreen and most recently supports YouTube playlists.
19
 
20
  The plugin is designed to be small and fast and not use any external resources. It has a number of customizable options.
21
 
@@ -27,7 +26,7 @@ Main Features:
27
  * Allows full YouTube customization (colors, border, full screen...)
28
  * Supports video deep linking (starting at desired point with &start=time parameter)
29
  * Works on iPod and iPhone
30
- * Supports migrated blogs from Wordpress.com replacing [youtube=youtubeadresss]
31
  * Provides a sidebar widget for videos as well
32
  * Produces xHTML valid code
33
  * Very fast and light, no extra scripts needed
@@ -37,6 +36,12 @@ Plugin by Vladimir Prelovac. Looking for <a href="http://www.prelovac.com/vladim
37
 
38
  == Changelog ==
39
 
 
 
 
 
 
 
40
  = 3.3.2 =
41
  * Fixed xHTML validation for playlists (credit Dietmar)
42
 
@@ -44,7 +49,7 @@ Plugin by Vladimir Prelovac. Looking for <a href="http://www.prelovac.com/vladim
44
  * Fixed Iphone validation (credits to John Neumann)
45
 
46
  = 3.3 =
47
- * Supports migrated blogs from Wordpress.com replacing [youtube=youtubeadresss]
48
 
49
  = 3.2 =
50
  * Added title to widget, fixed HTML code issue with widget
@@ -74,8 +79,7 @@ The video will be automatically embedded to your post in the proper way.
74
 
75
  Example: httpv://www.youtube.com/watch?v=OWfksMD4PAg
76
 
77
- If you want to post a high quality video (check if the video exists first!) you would use httpvh:// ('vh' for video high)
78
- If you want to post a HD (DVD quality, 720p) quality video you would use httpvhd:// ('vhd' for video high definition)
79
 
80
  To embed a playlist use extension 'vp'
81
 
8
 
9
  Smart Youtube plugin allows you to insert full featured YouTube videos into your post, comments and in RSS feed.
10
 
11
+ == Description ==
 
12
 
13
  Smart Youtube is a Wordpress Youtube Plugin that allows you to easily insert Youtube videos/playlists in your post, comments and in RSS feed.
14
 
15
  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.
16
 
17
+ Smart youtube also supports playback of high quality videos, works on iPhone, produces xHTML valid code (unlike YouTube embed code), allows you to view videos in fullscreen and most recently supports YouTube playlists.
18
 
19
  The plugin is designed to be small and fast and not use any external resources. It has a number of customizable options.
20
 
26
  * Allows full YouTube customization (colors, border, full screen...)
27
  * Supports video deep linking (starting at desired point with &start=time parameter)
28
  * Works on iPod and iPhone
29
+ * Supports migrated blogs from Wordpress.com
30
  * Provides a sidebar widget for videos as well
31
  * Produces xHTML valid code
32
  * Very fast and light, no extra scripts needed
36
 
37
  == Changelog ==
38
 
39
+ = 3.4 =
40
+ * Completely rewritten the plugin
41
+ * Added new HD video support (use vh now for all high quality videos)
42
+ * Added video privacy option
43
+
44
+
45
  = 3.3.2 =
46
  * Fixed xHTML validation for playlists (credit Dietmar)
47
 
49
  * Fixed Iphone validation (credits to John Neumann)
50
 
51
  = 3.3 =
52
+ * Supports migrated blogs from Wordpress.com
53
 
54
  = 3.2 =
55
  * Added title to widget, fixed HTML code issue with widget
79
 
80
  Example: httpv://www.youtube.com/watch?v=OWfksMD4PAg
81
 
82
+ If you want to post a high quality/HD video you would use httpvh:// ('vh' for video high)
 
83
 
84
  To embed a playlist use extension 'vp'
85
 
smartyoutube.class.php ADDED
@@ -0,0 +1,676 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class SmartYouTube
3
+ {
4
+ var $local_version;
5
+ var $custom_colors;
6
+ var $plugin_url;
7
+ var $options;
8
+ var $key;
9
+
10
+ function SmartYouTube()
11
+ {
12
+ $this->__construct();
13
+ }
14
+
15
+ function __construct()
16
+ {
17
+ $this->local_version = '3.4'; // TODO: Change this number???
18
+ $this->custom_colors = array(
19
+ 'blank' => array('d6d6d6', 'f0f0f0'),
20
+ 'storm' => array('3a3a3a', '999999'),
21
+ 'iceberg' => array('2b405b', '6b8ab6'),
22
+ 'acid' => array('006699', '54abd6'),
23
+ 'green' => array('234900', '4e9e00'),
24
+ 'orange' => array('e1600f', 'febd01'),
25
+ 'pink' => array('cc2550', 'e87a9f'),
26
+ 'purple' => array('402061', '9461ca'),
27
+ 'rubyred' => array('5d1719', 'cd311b'),
28
+ );
29
+
30
+ $this->plugin_url = defined('WP_PLUGIN_URL') ?
31
+ trailingslashit(WP_PLUGIN_URL . '/' . dirname(plugin_basename(__FILE__))) :
32
+ trailingslashit(get_bloginfo('wpurl')) . PLUGINDIR . '/' . dirname(plugin_basename(__FILE__));
33
+
34
+ $this->key = 'smart_youtube';
35
+
36
+ $this->options = get_option($this->key);
37
+
38
+ $this->add_filters_and_hooks();
39
+ }
40
+
41
+ function add_filters_and_hooks()
42
+ {
43
+ if ($this->options['posts'] == 'on')
44
+ {
45
+ add_filter('the_content', array($this, 'check'), 100);
46
+ add_filter('the_excerpt', array($this, 'check'), 100);
47
+ }
48
+
49
+ if ($this->options['comments'] == 'on')
50
+ {
51
+ add_filter('comment_text', array($this, 'check'), 100);
52
+ }
53
+
54
+ add_action( 'plugins_loaded', array($this, 'install'));
55
+ add_action( 'after_plugin_row', array($this, 'check_plugin_version'));
56
+
57
+ add_action('admin_menu', array($this, 'add_menu_items'));
58
+
59
+ register_activation_hook(__FILE__, array($this, 'install'));
60
+ }
61
+
62
+ function add_menu_items()
63
+ {
64
+ add_options_page('Smart Youtube options', 'Smart Youtube', 8, __FILE__, array($this, 'options_page'));
65
+ }
66
+
67
+ function options_page()
68
+ {
69
+ $status = $this->get_info();
70
+
71
+ $the_version = $status[1];
72
+ $the_message = $status[3];
73
+
74
+ if ((version_compare(strval($the_version), strval($this->local_version), '>') == 1))
75
+ {
76
+ $msg = 'Latest version available '.' <strong>'.$the_version.'</strong><br />'.$the_message;
77
+ _e('<div id="message" class="updated fade"><p>' . $msg . '</p></div>');
78
+ }
79
+
80
+
81
+ // If form was submitted
82
+ if (isset($_POST['submitted']))
83
+ {
84
+ check_admin_referer('smart-youtube');
85
+
86
+ #---------------------------------------------------------------------#
87
+ $this->options['img'] = !isset($_POST['disp_img']) ? 'off' : 'on';
88
+ $this->options['link'] = !isset($_POST['disp_link']) ? 'off' : 'on';
89
+ $this->options['valid'] = !isset($_POST['valid']) ? 'off' : 'on';
90
+ $this->options['search'] = !isset($_POST['disp_search']) ? 'off' : 'on';
91
+ $this->options['ann'] = !isset($_POST['disp_ann']) ? 'off' : 'on';
92
+
93
+ $this->options['info'] = !isset($_POST['disp_info']) ? 'off' : 'on';
94
+
95
+ $this->options['width'] = !isset($_POST['disp_width']) ? 425 : intval($_POST['disp_width']);
96
+ $this->options['height'] = !isset($_POST['disp_height']) ? 344 : intval($_POST['disp_height']);
97
+
98
+ $this->options['widthhq'] = !isset($_POST['disp_widthhq']) ? 480 : intval($_POST['disp_widthhq']);
99
+ $this->options['heighthq'] = !isset($_POST['disp_heighthq']) ? 295 : intval($_POST['disp_heighthq']);
100
+
101
+ $this->options['widthside'] = !isset($_POST['disp_widthside']) ? 150 : intval($_POST['disp_widthside']);
102
+ $this->options['heightside'] = !isset($_POST['disp_heightside']) ? 125 : intval($_POST['disp_heightside']);
103
+
104
+ $this->options['rel'] = !isset($_POST['embedRel']) ? 1 : $_POST['embedRel'];
105
+ $this->options['border'] = !isset($_POST['embedBorder']) ? 0 : 1;
106
+ $this->options['color'] = !isset($_POST['embedColor']) ? 'blank' : $_POST['embedColor'];
107
+ $this->options['autoplay'] = !isset($_POST['autoplay']) ? 0 : 1;
108
+ $this->options['privacy'] = !isset($_POST['disp_ann']) ? 0 : 1;
109
+
110
+ $this->options['posts'] = !isset($_POST['disp_posts']) ? 'off' : 'on';
111
+ $this->options['comments'] = !isset($_POST['disp_comments']) ? 'off' : 'on';
112
+
113
+ $this->options['template'] = !isset($_POST['disp_template']) ?
114
+ '{video}' :
115
+ stripslashes(htmlspecialchars($_POST['disp_template']));;
116
+
117
+ update_option($this->key, $this->options);
118
+
119
+ $msg_status = 'Smart Youtube options saved.';
120
+
121
+ // Show message
122
+ _e('<div id="message" class="updated fade"><p>' . $msg_status . '</p></div>');
123
+
124
+ }
125
+
126
+ $disp_img = $this->options['img'] == 'on' ? 'checked="checked"' : '';
127
+ $disp_link = $this->options['link'] == 'on' ? 'checked="checked"' : '';
128
+ $disp_search = $this->options['search'] == 'on' ? 'checked="checked"' : '';
129
+ $disp_ann = $this->options['ann'] == 'on' ? 'checked="checked"' : '';
130
+ $disp_info = $this->options['info'] == 'on' ? 'checked="checked"' : '';
131
+
132
+ $valid = $this->options['valid'] == 'on' ? 'checked="checked"' : '';
133
+
134
+ $disp_width = $this->options['width'];
135
+ $disp_height = $this->options['height'];
136
+
137
+ $disp_widthhq = $this->options['widthhq'];
138
+ $disp_heighthq = $this->options['heighthq'];
139
+
140
+ $disp_widthside = $this->options['widthside'];
141
+ $disp_heightside = $this->options['heightside'];
142
+
143
+ $disp_autoplay = $this->options['autoplay'] ? 'checked="checked"' : '';
144
+ $disp_rel = $this->options['rel'] ? 'checked="checked"' : '';
145
+ $disp_rel2 = $disp_rel ? '' : 'checked="checked"';
146
+ $disp_border = $this->options['border'] ? 'checked="checked"' : '';
147
+ $disp_color = $this->options['color'];
148
+ $disp_posts = $this->options['posts'] == 'on' ? 'checked="checked"' : '' ;
149
+ $disp_comments = $this->options['comments'] == 'on' ? 'checked="checked"' : '';
150
+
151
+ $disp_privacy = $this->options['privacy'] ? 'checked="checked"' : '';
152
+
153
+ $disp_template = wp_specialchars($this->options['template']);
154
+
155
+ if (!$disp_width)
156
+ {
157
+ $disp_width = 425;
158
+ }
159
+
160
+ if (!$disp_height)
161
+ {
162
+ $disp_height = 344;
163
+ }
164
+
165
+ global $wp_version;
166
+
167
+ $embed_img = $this->plugin_url . '/img/embed_selection-vfl29294.png';
168
+
169
+ echo '<script src="' . $this->plugin_url . '/yt.js" type="text/javascript"></script>
170
+ <link rel="stylesheet" type="text/css" href="' . $this->plugin_url . '/style.css" />';
171
+
172
+ $imgpath = $this->plugin_url.'/i';
173
+ $actionurl = $_SERVER['REQUEST_URI'];
174
+ $nonce = wp_create_nonce( 'smart-youtube');
175
+ $example = htmlentities('<div style="float:left;margin-right: 10px;">{video}</div>');
176
+
177
+ // Configuration Page
178
+
179
+ echo <<<END
180
+ <div class="wrap smartyoutube" style="max-width:950px !important;">
181
+ <div id="icon-options-general" class="icon32"><br /></div>
182
+ <h2>Smart YouTube</h2>
183
+ <div id="poststuff" style="margin-top:10px;">
184
+ <div id="sideblock" style="float:right;width:220px;margin-left:10px;">
185
+ <h2>Information</h2>
186
+ <ul id="dbx-content" style="text-decoration:none;">
187
+ <li><img src="$imgpath/home.png"><a style="text-decoration:none;" href="http://www.prelovac.com/vladimir/wordpress-plugins/smart-youtube"> Smart Youtube Home</a></li>
188
+ <li><img src="$imgpath/rate.png"><a style="text-decoration:none;" href="http://wordpress.org/extend/plugins/smart-youtube/"> Rate this plugin</a></li>
189
+ <li><img src="$imgpath/help.png"><a style="text-decoration:none;" href="http://www.prelovac.com/vladimir/forum"> Support and Help</a></li>
190
+ <li><a style="text-decoration:none;" href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2567254&lc=US"><img src="$imgpath/paypal.gif"></a></li>
191
+ <li><img src="$imgpath/more.png"><a style="text-decoration:none;" href="http://www.prelovac.com/vladimir/wordpress-plugins"> Cool WordPress Plugins</a></li>
192
+ <li><img src="$imgpath/twit.png"><a style="text-decoration:none;" href="http://twitter.com/vprelovac"> Follow updates on Twitter</a></li>
193
+ <li><img src="$imgpath/idea.png"><a style="text-decoration:none;" href="http://www.prelovac.com/vladimir/services"> Need a WordPress Expert?</a></li>
194
+ </ul>
195
+ </div>
196
+
197
+ <div id="mainblock" style="width:710px">
198
+ <div class="dbx-content">
199
+ <h2 id="usageHeader">Usage <span style="font-size:small">[<a href="#">view instructions</a>]</span></h2>
200
+
201
+ <div id="usage" style="display:none">
202
+ <p>To use the video in your posts, paste YouTube video URL with <strong>httpv://</strong> (notice the 'v'). </p>
203
+ <p><strong>Important:</strong> The URL should just be copied into your post normally and the letter 'v' added, do not create a clickable link!</p>
204
+ <p>Example: httpv://www.youtube.com/watch?v=OWfksMD4PAg</p>
205
+ <p>If you want to embed High/HD Quality video use <strong>httpvh://</strong> instead (Video High Defintion).</p>
206
+ <p>To embed playlists use httpvp:// (eg. httpvp://www.youtube.com/view_play_list?p=528026B4F7B34094)</p>
207
+ <p>Smart Youtube also supports migrated blogs from Wordpress.com using [youtube=youtubeadresss]</p>
208
+
209
+ <ul>
210
+ <li>httpv:// - regular video</li>
211
+ <li>httpvh:// - high/HD quality</li>
212
+ <li>httpvp:// - playlist</li>
213
+ <li>[youtube=youtubeadresss] - supported for blogs migrated from wordpress.com</li>
214
+ </ul>
215
+ </div>
216
+
217
+ <form name="yteform" action="$action_url" method="post">
218
+ <input type="hidden" name="submitted" value="1" />
219
+ <input type="hidden" id="_wpnonce" name="_wpnonce" value="$nonce" />
220
+ <h2>Options</h2>
221
+ <p> You can adjust the way your embeded youtube videos behave in the options below.</p>
222
+
223
+ <h3>Video settings</h3>
224
+ <div>
225
+ <input id="check3" type="checkbox" name="disp_posts" $disp_posts />
226
+ <label for="check3">Display videos in posts</label>
227
+ </div>
228
+ <div>
229
+ <input id="check4" type="checkbox" name="disp_comments" $disp_comments />
230
+ <label for="check4">Display videos in comments</label>
231
+ </div>
232
+
233
+
234
+ <h3>Video Appearence</h3>
235
+ <p class="instruct">Video template. Default is just {video}. <br />
236
+ You can try <code>$example</code> if you want the text to wrap around video.</p>
237
+ <textarea cols="50" id="disp_template" name="disp_template">$disp_template</textarea>
238
+ <p class="instruct">Video width and height in normal mode (httpv://). Default is 425x344. </p>
239
+ <div id="inputSizeNormal">
240
+ <input class="width" name="disp_width" value="$disp_width" size="7"/>x<input class="height" name="disp_height" value="$disp_height" size="7" />
241
+ </div>
242
+ <div class="size-chooser" forDiv="inputSizeNormal">
243
+ <a v-width="320" v-height="265" href="#">
244
+ <span></span>
245
+ <div class="outer">
246
+ <div></div>
247
+ </div>
248
+ </a>
249
+ <a v-width="425" v-height="344" href="#">
250
+ <span></span>
251
+ <div class="outer">
252
+ <div></div>
253
+ </div>
254
+ </a>
255
+ <a v-width="480" v-height="385" href="#">
256
+ <span></span>
257
+ <div class="outer">
258
+ <div></div>
259
+ </div>
260
+ </a>
261
+ <a v-width="640" v-height="505" href="#">
262
+ <span></span>
263
+ <div class="outer">
264
+ <div></div>
265
+ </div>
266
+ </a>
267
+ <br clear="both" />
268
+ </div>
269
+
270
+ <p class="instruct">Video width and height in <strong>high quality</strong> mode (httpvh://). Default is 480x295. </p>
271
+ <div id="inputSizeHQ">
272
+ <input class="width" name="disp_widthhq" value="$disp_widthhq" size="7" />x<input class="height" name="disp_heighthq" value="$disp_heighthq" size="7" />
273
+ </div>
274
+ <div class="size-chooser" forDiv="inputSizeHQ">
275
+ <a v-width="480" v-height="295" href="#">
276
+ <span></span>
277
+ <div class="outer">
278
+ <div></div>
279
+ </div>
280
+ </a>
281
+ <a v-width="560" v-height="340" href="#">
282
+ <span></span>
283
+ <div class="outer">
284
+ <div></div>
285
+ </div>
286
+ </a>
287
+ <a v-width="640" v-height="385" href="#">
288
+ <span></span>
289
+ <div class="outer">
290
+ <div></div>
291
+ </div>
292
+ </a>
293
+ <a v-width="853" v-height="505" href="#">
294
+ <span></span>
295
+ <div class="outer">
296
+ <div></div>
297
+ </div>
298
+ </a>
299
+ <br clear="both" />
300
+ </div>
301
+
302
+ <p class="instruct">Video width and height in <strong>sidebar</strong> mode (regardless of quality). Default is 150x125.</p>
303
+ <input id="disp_widthside" name="disp_widthside" value="$disp_widthside" size="7" />x<input id="disp_heightside" name="disp_heightside" value="$disp_heightside" size="7" /><br /><br />
304
+ <div id="watch-customize-embed-form">
305
+ <input type="radio" $disp_rel id="embedCustomization1" name="embedRel" value="1"/>
306
+ <label for="embedCustomization1">Include related videos</label><br/>
307
+ <input type="radio" $disp_rel2 id="embedCustomization0" name="embedRel" value="0"/>
308
+ <label for="embedCustomization0">Do not include related videos</label><br/>
309
+ </div>
310
+ <img id="watch-customize-embed-theme-preview" src="$this->plugin_url/img/preview_embed_blank_sm.gif"/>
311
+ <div id="watch-customize-embed-theme-swatches">
312
+ <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>
313
+ <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>
314
+ <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>
315
+ <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>
316
+ <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>
317
+ <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>
318
+ <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>
319
+ <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>
320
+ <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>
321
+ <input id="embedColor" type="hidden" name="embedColor" value="$disp_color">
322
+ <input id="prevUrl" type="hidden" name="prevUrl" value="$this->plugin_url/img/">
323
+ </div>
324
+ <div style="margin: 0 0 0 4px; clear: both;">
325
+ <input type="checkbox" onchange="onUpdatePreviewImage();" id="show_border_checkbox" name="embedBorder" $disp_border /><label for="show_border_checkbox"> Show Border</label><br />
326
+ <input type="checkbox" id="autoplay_checkbox" name="autoplay" $disp_autoplay /><label for="autoplay_checkbox"> Autoplay videos</label><br />
327
+ <input type="checkbox" id="disp_search" name="disp_search" $disp_search /><label for="disp_search"> Display search box</label><br />
328
+ <input type="checkbox" id="disp_info" name="disp_info" $disp_info /><label for="disp_info"> Remove Titles & Ratings</label><br />
329
+ <input type="checkbox" id="disp_ann" name="disp_ann" $disp_ann /><label for="disp_ann"> Remove Annotations</label><br />
330
+ <input type="checkbox" id="privacy" name="disp_privacy" $disp_privacy /><label for="privacy"> Enable privacy-enhanced mode [<a target="_blank" href="http://www.google.com/support/youtube/bin/answer.py?answer=141046">?</a>]</label>
331
+ </div>
332
+
333
+ <h3>xHTML validation</h3>
334
+ <p class="instruct">Enabling the option below will make your YouTube code xHTML valid. </p>
335
+ <input id="valid" type="checkbox" name="valid" $valid />
336
+ <label for="valid">Enable xHTML Validation</label>
337
+
338
+ <h3>RSS feed options</h3>
339
+ <p class="instruct">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>
340
+ <p class="instruct">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>
341
+
342
+ <input id="check2" type="checkbox" name="disp_link" $disp_link />
343
+ <label for="check2">Display video link in RSS feed</label><br />
344
+ <input id="check1" type="checkbox" name="disp_img" $disp_img />
345
+ <label for="check1">Display video preview image in RSS feed</label>
346
+
347
+ <div class="submit"><input type="submit" name="Submit" value="Update options" /></div>
348
+ </form>
349
+ </div>
350
+ </div>
351
+ </div>
352
+ </div>
353
+ <h5 class="author">Another fine plugin by <a href="http://www.prelovac.com/vladimir/">Vladimir Prelovac</a></h5>
354
+ END;
355
+ }
356
+
357
+
358
+ function check($the_content, $side = 0)
359
+ {
360
+ if (strpos($the_content, "httpv") !== false )
361
+ {
362
+ $char_codes = array('&#215;', '&#8211;');
363
+ $replacements = array("x", "--");
364
+ $the_content = str_replace($char_codes, $replacements, $the_content);
365
+
366
+ preg_match_all("/http(v|vh|vhd):\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/)([a-zA-Z0-9\-\_]{11})([^<\s]*)/", $the_content, $matches, PREG_SET_ORDER);
367
+ foreach ($matches as $match)
368
+ {
369
+ $the_content = preg_replace("/http".$match[1].":\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/)([a-zA-Z0-9\-\_]{11})([^\s<]*)/", $this->tag($match[4], $match[1], $match[5], $side), $the_content, 1);
370
+ }
371
+
372
+ preg_match_all("/http(vp):\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/view_play_list(\?p\=|\/v\/)([a-zA-Z0-9\-\_]{16})([^<\s]*)/", $the_content, $matches, PREG_SET_ORDER);
373
+ foreach ($matches as $match)
374
+ {
375
+ $the_content = preg_replace("/http".$match[1].":\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/view_play_list(\?p\=|\/v\/)([a-zA-Z0-9\-\_]{16})([^\s<]*)/", $this->tag($match[4], $match[1], $match[5], $side), $the_content, 1);
376
+ }
377
+ }
378
+
379
+ // to work with migrated blogs from Wordpress.com replacing [youtube=youtubeadresss]
380
+ if (strpos($the_content, "[youtube") !== false )
381
+ {
382
+ preg_match_all("/\[youtube\=http:\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/)([a-zA-Z0-9\-\_]{11})([^<\s]*)\]/", $the_content, $matches, PREG_SET_ORDER);
383
+ foreach ($matches as $match)
384
+ {
385
+ $the_content = preg_replace("/\[youtube\=http:\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/)([a-zA-Z0-9\-\_]{11})([^\s<]*)\]/", $this->tag($match[3], '', $match[4], $side), $the_content, 1);
386
+ }
387
+ }
388
+
389
+ return $the_content;
390
+ }
391
+
392
+ function tag($file, $high = 'v', $time = '', $side = 0)
393
+ {
394
+ $playlist = 0;
395
+ $disp_rel = $this->options['rel'];
396
+ $disp_border = $this->options['border'];
397
+ $disp_color = $this->options['color'];
398
+ $autoplay = $this->options['autoplay'];
399
+ $disp_search = $this->options['search'] == 'on' ? 1 : 0;
400
+ $disp_info = $this->options['info'] == 'on' ? '&showinfo=0' : '';
401
+ $disp_ann = $this->options['ann'] == 'on' ? '&iv_load_policy=3' : '';
402
+ $template = $this->options['template'];
403
+ $valid = $this->options['valid'];
404
+
405
+ switch ($high)
406
+ {
407
+ case 'v':
408
+ $high = '';
409
+ break;
410
+ case 'vh':
411
+ $high = '&amp;hd=1';
412
+ break;
413
+ case 'vhd':
414
+ $high = '&amp;hd=1';
415
+ break;
416
+ case 'vp':
417
+ $high = '';
418
+ $playlist = 1;
419
+ break;
420
+ default:
421
+ $high = '';
422
+ break;
423
+ }
424
+
425
+ $width = $side ?
426
+ $this->options['widthside'] :
427
+ ($high ? $this->options['widthhq'] : $this->options['width']);
428
+
429
+ $height = $side ?
430
+ $this->options['heightside'] :
431
+ ($high ? $this->options['heighthq'] : $this->options['height']);
432
+
433
+ if (!$width)
434
+ {
435
+ $width = !$high ? 480 : 425 ;
436
+ }
437
+
438
+ if (!$height)
439
+ {
440
+ $height = !$high ? 360 : 344;
441
+ }
442
+
443
+ if ($disp_border)
444
+ {
445
+ $height += 18;
446
+ }
447
+
448
+ $root_url = $this->options['privacy'] ? 'http://www.youtube-nocookie.com' : 'http://www.youtube.com';
449
+
450
+ if ($playlist)
451
+ {
452
+ $video_url = htmlspecialchars("$root_url/p/$file&rel=$disp_rel&color1={$this->custom_colors[$disp_color][0]}&color2={$this->custom_colors[$disp_color][1]}&border=$disp_border&fs=1&hl=en&autoplay=$autoplay{$disp_info}$disp_ann&showsearch=$disp_search", ENT_QUOTES) . $high . $time;
453
+ $yte_tag = <<<EOT
454
+ <!-- Smart Youtube -->
455
+ <span class="youtube">
456
+ <object type="application/x-shockwave-flash" width="$width" height="$height" data="$video_url" >
457
+ <param name="movie" value="$video_url" />
458
+ <param name="allowFullScreen" value="true" />
459
+ <param name="allowscriptaccess" value="always" />
460
+ </object>
461
+ </span>
462
+ EOT;
463
+ }
464
+ // This was added to check for iPhone and iPod devices and checks to see if having valid xhtml is on. If valid xhtml is on then the iPhone/iPod will not see the video, so instead we just output the same code that we would if the valid flag was off. This allows us to serve up valid xhtml for our web users and non-valid xhtml to our iPhone/iPod users so they can still enjoy the experience.
465
+ elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone') || strpos($_SERVER['HTTP_USER_AGENT'], 'iPod') && $valid == 'on')
466
+ {
467
+ $video_url = htmlspecialchars("$root_url/v/$file&rel=$disp_rel&color1={$this->custom_colors[$disp_color][0]}&color2={$this->custom_colors[$disp_color][1]}&border=$disp_border&fs=1&hl=en&autoplay=$autoplay{$disp_info}$disp_ann&showsearch=$disp_search", ENT_QUOTES) . $high . $time;
468
+
469
+ $yte_tag = <<<EOT
470
+ <!-- Smart Youtube -->
471
+ <span class="youtube">
472
+ <object type="application/x-shockwave-flash" width="$width" height="$height" data="$video_url">
473
+ <param name="movie" value="$video_url" />
474
+ <param name="allowFullScreen" value="true" />
475
+ <param name="wmode" value="transparent" />
476
+ </object>
477
+ </span>
478
+ EOT;
479
+ }
480
+ elseif ($valid == 'off')
481
+ {
482
+ $video_url = htmlspecialchars("$root_url/v/$file&rel=$disp_rel&color1={$this->custom_colors[$disp_color][0]}&color2={$this->custom_colors[$disp_color][1]}&border=$disp_border&fs=1&hl=en&autoplay=$autoplay{$disp_info}$disp_ann&showsearch=$disp_search", ENT_QUOTES) . $high . $time;
483
+ $yte_tag = <<<EOT
484
+ <!-- Smart Youtube -->
485
+ <span class="youtube">
486
+ <object width="$width" height="$height">
487
+ <param name="movie" value="$video_url" />
488
+ <param name="allowFullScreen" value="true" />
489
+ <embed wmode="transparent"
490
+ src="$video_url"
491
+ type="application/x-shockwave-flash"
492
+ allowfullscreen="true"
493
+ width="$width"
494
+ height="$height">
495
+ </embed>
496
+ <param name="wmode" value="transparent" />
497
+ </object>
498
+ </span>
499
+ EOT;
500
+ }
501
+ else
502
+ {
503
+ $video_url = htmlspecialchars("$root_url/v/$file&rel=$disp_rel&color1={$this->custom_colors[$disp_color][0]}&color2={$this->custom_colors[$disp_color][1]}&border=$disp_border&fs=1&hl=en&autoplay=$autoplay{$disp_info}$disp_ann&showsearch=$disp_search", ENT_QUOTES) . $high . $time;
504
+
505
+ $yte_tag = <<<EOT
506
+ <!-- Smart Youtube -->
507
+ <span class="youtube">
508
+ <object type="application/x-shockwave-flash" width="$width" height="$height" data="$video_url">
509
+ <param name="movie" value="$video_url" />
510
+ <param name="allowFullScreen" value="true" />
511
+ <param name="wmode" value="transparent" />
512
+ </object>
513
+ </span>
514
+ EOT;
515
+ }
516
+
517
+ if (is_feed())
518
+ {
519
+
520
+ if ($high)
521
+ {
522
+ $high = '&fmt=18';
523
+ }
524
+
525
+ if ($this->options['img'] == 'on')
526
+ {
527
+ $yte_tag .= '<a href="http://www.youtube.com/watch?v=' . $file . $high. '"><img src="http://img.youtube.com/vi/' . $file . '/default.jpg" width="130" height="97" border=0></a>';
528
+ }
529
+
530
+ if ($this->options['link'] == 'on')
531
+ {
532
+ $yte_tag.='<a href="http://www.youtube.com/watch?v=' . $file . $high . '">www.youtube.com/watch?v=' . $file . '</a>';
533
+ }
534
+ // if ($this->options['link'] == 'off' && $this->options['img'] == 'off')
535
+ // $yte_tag='http://www.youtube.com/watch?v='.$file;
536
+ }
537
+
538
+ return str_replace('{video}', $yte_tag, html_entity_decode($template));
539
+ }
540
+
541
+ function install()
542
+ {
543
+ if (get_option($this->key)) return true;
544
+
545
+ // upgrade the options format (as all-in-one, not single entries)
546
+ $this->options = array(
547
+ 'posts' => 'on',
548
+ 'comments' => 'off',
549
+ 'img' => 'off',
550
+ 'width' => 425,
551
+ 'height' => 344,
552
+ 'widthhq' => 480,
553
+ 'heighthq' => 295,
554
+ 'widthside' => 150,
555
+ 'heightside' => 125,
556
+ 'rel' => 1,
557
+ 'color' => 'blank',
558
+ 'border' => 0,
559
+ 'link' => 'on',
560
+ 'valid' => 'off',
561
+ 'search' => 'off',
562
+ 'info' => 'on',
563
+ 'ann' => 'on',
564
+ 'template' => '{video}',
565
+ 'autoplay' => 0,
566
+ 'privacy' => 0,
567
+ );
568
+
569
+ // migrate the old-fashion options
570
+ foreach ($this->options as $key => $value)
571
+ {
572
+ if (false !== $old_option = get_option("smart_yt_$key"))
573
+ {
574
+ $this->options[$key] = $old_option;
575
+ }
576
+
577
+ delete_option("smart_yt_$key");
578
+ }
579
+
580
+ add_option($this->key, $this->options);
581
+
582
+ // register widget
583
+ if (function_exists('register_sidebar_widget'))
584
+ {
585
+ register_sidebar_widget('Smart YouTube', array($this, 'widget'));
586
+ }
587
+
588
+ if (function_exists('register_widget_control'))
589
+ {
590
+ register_widget_control('Smart YouTube', array($this, 'widget_control'));
591
+ }
592
+ }
593
+
594
+ function widget($args = array())
595
+ {
596
+ extract ($args);
597
+ $text = $this->check($this->options['wtext'], 1);
598
+ echo
599
+ $before_widget,
600
+ $before_title, $this->options['wtext'], $after_title,
601
+ $text,
602
+ $after_widget;
603
+ }
604
+
605
+ function widget_control()
606
+ {
607
+ if ($_REQUEST['submit'])
608
+ {
609
+ $this->options['wtext'] = stripslashes($_REQUEST['yte_text']);
610
+ $this->options['wtitle'] = stripslashes($_REQUEST['yte_title']);
611
+ }
612
+
613
+ update_option($this->key, $this->options);
614
+
615
+ $text = wp_specialchars($this->options['wtext']);
616
+ $title = wp_specialchars($this->options['wtitle']);
617
+
618
+ echo <<<EOT
619
+ Title:<br /><input type="text" id="yte_title" name="yte_title" value="$title" /><br />
620
+ Insert HTML code below. In addition to normal text you may use httpv, httpvh and httpvhd links just like in your posts.<br />
621
+ <textarea id="text" name="yte_text" rows="10" cols="16" class="widefat">$text</textarea>
622
+ <input type="hidden" id="submit" name="submit" value="1" />
623
+ EOT;
624
+ }
625
+
626
+ /**
627
+ * Checks the plugin version
628
+ * @param $plugin
629
+ * @return unknown_type
630
+ */
631
+ function check_plugin_version($plugin)
632
+ {
633
+ global $plugindir;
634
+
635
+ if (strpos($plugin, 'smartyoutube.php') === false) return;
636
+
637
+ $status = $this->get_info();
638
+
639
+ $the_version = $status[1];
640
+ $the_message = $status[3];
641
+
642
+ if ((version_compare(strval($the_version), strval($this->local_version), '>') != 1)) return;
643
+
644
+ $msg = "Latest version available: <strong>$the_version</strong><br />.$the_message";
645
+
646
+ echo <<<EOT
647
+ <td colspan="5" class="plugin-update" style="line-height:1.2em;">
648
+ Latest version available: <strong>$the_version</strong><br />$the_message
649
+ </td>
650
+ EOT;
651
+
652
+ }
653
+
654
+ /**
655
+ * Gets plugin info from WordPress Codex repo
656
+ * @return mixed
657
+ */
658
+ function get_info()
659
+ {
660
+ $checkfile = 'http://svn.wp-plugins.org/smart-youtube/trunk/smartyoutube.chk';
661
+
662
+ $status = array();
663
+
664
+ return $status; //???
665
+
666
+ $vcheck = wp_remote_fopen($checkfile);
667
+
668
+ if ($vcheck)
669
+ {
670
+ $version = $$this->local_version;
671
+
672
+ $status = explode('@', $vcheck);
673
+ return $status;
674
+ }
675
+ }
676
+ }
smartyoutube.php CHANGED
@@ -1,740 +1,51 @@
1
- <?php
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: 3.3.2
8
- Author URI: http://www.prelovac.com/vladimir/
9
-
10
- Updates:
11
- 3.3.2 - Fixed xHTML validation for playlists (credit Dietmar)
12
- 3.3.1 - Fixed Iphone validation (credit John Neumann)
13
- 3.3 - Supports migrated blogs from Wordpress.com replacing [youtube=youtubeadresss]
14
- 3.2 - Added title to widget, fixed HTML code issue with widget
15
- 3.1.1 - param closed properly for validation
16
- 3.1 - wmode transparent parameter updated to better handle transparancy
17
- 3.0 - Added video template, option to set sidebar video size, fixed sidebar widget code, fixed video syntax issue
18
- 2.8.1 - Display Annotioans added as option
19
- 2.8 - Support for playlists
20
- 2.7.5 - Plugin url updated to use WP_PLUGIN_URL
21
- 2.7.4 - Added option to remove info&ratings
22
- 2.7.3 - Removed annotiations
23
- 2.7 - Supports a sidebar widget for videos
24
- 2.6 - Added option to remove search button
25
- 2.5 - Added DVD quality support (httpvq)
26
- 2.4.1 - Small fixes in embed and rss links
27
- 2.4 - Added support for extra parameters like &start=50 to start the video at 50th second of play
28
- 2.2 - Full xHTML validaiton
29
- 2.1 - Made the application iPhone compatible and allowed full screen
30
- 2.0 - Support for playback high quality YouTube videos
31
- 1.9 - Added video autoplay option
32
- 1.8 - Solved Problem with HTML validation, enabled full video preview in RSS
33
- 1.6 - Solving a problem with wordpress handling special characters
34
- 1.5 - Added new admin interface and more options to control the video
35
-
36
- To-Doo:
37
- - marinas javascript suggestion for hq videos
38
- - add editor button
39
- - The plugin places a preview image in the RSS feed which is great, but it links to the video on http://www.youtube.com. I would like to change it so the image links to the blog post so I can generate some traffic on my blog.
40
- - localization
41
- - the images appear under the embedded Smart Youtube videos. Is there any way to edit the z-index for Smart Youtube CSS? I
42
- */
43
-
44
- $yte_localversion="2.7.5";
45
-
46
- $CustomColors=array (
47
- "blank" => array("d6d6d6","f0f0f0"),
48
- "storm" => array("3a3a3a","999999"),
49
- "iceberg" => array("2b405b","6b8ab6"),
50
- "acid" => array("006699","54abd6"),
51
- "green" => array("234900","4e9e00"),
52
- "orange" => array("e1600f","febd01"),
53
- "pink" => array("cc2550","e87a9f"),
54
- "purple" => array("402061","9461ca"),
55
- "rubyred" => array("5d1719","cd311b")
56
- );
57
-
58
- $wp_yte_plugin_url = defined('WP_PLUGIN_URL') ? trailingslashit(WP_PLUGIN_URL . '/' . dirname(plugin_basename(__FILE__))) : trailingslashit(get_bloginfo('wpurl')) . PLUGINDIR . '/' . dirname(plugin_basename(__FILE__));
59
-
60
-
61
-
62
-
63
- // Admin Panel
64
- function yte_add_pages()
65
- {
66
- add_options_page('Smart Youtube options', 'Smart Youtube', 8, __FILE__, 'yte_options_page');
67
- }
68
-
69
-
70
-
71
- // Options Page
72
- function yte_options_page()
73
- {
74
- global $yte_localversion;
75
- $status=yte_getinfo();
76
-
77
- $theVersion = $status[1];
78
- $theMessage = $status[3];
79
-
80
-
81
-
82
- if( (version_compare(strval($theVersion), strval($yte_localversion), '>') == 1) )
83
- {
84
- $msg = 'Latest version available '.' <strong>'.$theVersion.'</strong><br />'.$theMessage;
85
- _e('<div id="message" class="updated fade"><p>' . $msg . '</p></div>');
86
-
87
- }
88
-
89
-
90
- // If form was submitted
91
- if (isset($_POST['submitted']))
92
- {
93
- check_admin_referer('smart-youtube');
94
- $disp_img = !isset($_POST['disp_img'])? 'off': 'on';
95
- $disp_link = !isset($_POST['disp_link'])? 'off': 'on';
96
- $disp_search = !isset($_POST['disp_search'])? 'off': 'on';
97
- $disp_ann = !isset($_POST['disp_ann'])? 'off': 'on';
98
- $disp_info = !isset($_POST['disp_info'])? 'off': 'on';
99
- $valid = !isset($_POST['valid'])? 'off': 'on';
100
-
101
- update_option('smart_yt_img', $disp_img);
102
- update_option('smart_yt_link', $disp_link);
103
- update_option('smart_yt_valid', $valid);
104
- update_option('smart_yt_search', $disp_search);
105
- update_option('smart_yt_ann', $disp_ann);
106
- update_option('smart_yt_info', $disp_info);
107
-
108
- $disp_width = (int) ($_POST['disp_width']=="")? '425': $_POST['disp_width'];
109
- $disp_height = (int) ($_POST['disp_height']=="")? '344': $_POST['disp_height'];
110
-
111
- update_option('smart_yt_width', $disp_width);
112
- update_option('smart_yt_height', $disp_height);
113
-
114
- $disp_widthhq = (int) ($_POST['disp_widthhq']=="")? '480': $_POST['disp_widthhq'];
115
- $disp_heighthq = (int) ($_POST['disp_heighthq']=="")? '360': $_POST['disp_heighthq'];
116
-
117
- update_option('smart_yt_widthhq', $disp_widthhq);
118
- update_option('smart_yt_heighthq', $disp_heighthq);
119
-
120
- $disp_widthside = (int) ($_POST['disp_widthside']=="")? '150': $_POST['disp_widthside'];
121
- $disp_heightside = (int) ($_POST['disp_heightside']=="")? '125': $_POST['disp_heightside'];
122
-
123
- update_option('smart_yt_widthside', $disp_widthside);
124
- update_option('smart_yt_heightside', $disp_heightside);
125
-
126
- $disp_rel = !isset($_POST['embedRel'])? '1': $_POST['embedRel'];
127
-
128
- $disp_border = !isset($_POST['embedBorder'])? '0': '1';
129
- $disp_color = !isset($_POST['embedColor'])? 'blank': $_POST['embedColor'];
130
-
131
- $disp_autoplay = !isset($_POST['autoplay'])? '0': '1';
132
-
133
-
134
- update_option('smart_yt_rel', $disp_rel);
135
-
136
- update_option('smart_yt_border', $disp_border);
137
- update_option('smart_yt_color', $disp_color);
138
-
139
- update_option('smart_yt_autoplay', $disp_autoplay);
140
-
141
- $disp_posts = !isset($_POST['disp_posts'])? 'off': 'on';
142
- $disp_comments = !isset($_POST['disp_comments'])? 'off': 'on';
143
-
144
-
145
- update_option('smart_yt_posts', $disp_posts);
146
- update_option('smart_yt_comments', $disp_comments);
147
-
148
- $disp_template = !isset($_POST['disp_template'])? '{video}': stripslashes(htmlspecialchars($_POST['disp_template']));
149
- update_option('smart_yt_template', $disp_template);
150
-
151
-
152
-
153
- $msg_status = 'Smart Youtube options saved.';
154
-
155
- // Show message
156
- _e('<div id="message" class="updated fade"><p>' . $msg_status . '</p></div>');
157
-
158
- }
159
-
160
- // Fetch code from DB
161
- $disp_img = (get_option('smart_yt_img')=='on') ? 'checked':'';
162
- $disp_link = (get_option('smart_yt_link')=='on') ? 'checked':'';
163
- $disp_search = (get_option('smart_yt_search')=='on') ? 'checked':'';
164
- $disp_ann = (get_option('smart_yt_ann')=='on') ? 'checked':'';
165
- $disp_info = (get_option('smart_yt_info')=='on') ? 'checked':'';
166
-
167
- $valid = (get_option('smart_yt_valid')=='on') ? 'checked':'';
168
-
169
-
170
- $disp_width = get_option('smart_yt_width');
171
- $disp_height = get_option('smart_yt_height');
172
-
173
- $disp_widthhq = get_option('smart_yt_widthhq');
174
- $disp_heighthq = get_option('smart_yt_heighthq');
175
-
176
- $disp_widthside = get_option('smart_yt_widthside');
177
- $disp_heightside = get_option('smart_yt_heightside');
178
-
179
- $disp_autoplay = (get_option('smart_yt_autoplay')=='1') ? 'checked':'';
180
-
181
-
182
- $disp_rel = (get_option('smart_yt_rel')=='1') ? 'checked':'';
183
-
184
- $disp_rel2=$disp_rel ? "" : "checked";
185
- $disp_border = (get_option('smart_yt_border')=='1') ? 'checked':'';
186
- $disp_color = get_option('smart_yt_color');
187
-
188
-
189
- $disp_posts = (get_option('smart_yt_posts')=='on') ? 'checked' :'' ;
190
- $disp_comments = (get_option('smart_yt_comments')=='on') ? 'checked':'';
191
-
192
- $disp_template = wp_specialchars(get_option('smart_yt_template'));
193
-
194
-
195
- if ($disp_width=="")
196
- $disp_width="425";
197
- if ($disp_height=="")
198
- $disp_height="355";
199
-
200
-
201
- global $wp_version;
202
- global $wp_yte_plugin_url;
203
- $embed_img=$wp_yte_plugin_url.'/img/embed_selection-vfl29294.png';
204
-
205
- echo '<script src="' . $wp_yte_plugin_url . '/yt.js" type="text/javascript"></script>' . "\n";
206
- echo '<style type="text/css">
207
- #watch-embed-div,
208
- #watch-url-div{
209
- border-top:1px solid #CCC;
210
- font-size:11px;
211
- }
212
- #watch-url-div{
213
- margin:5px 0;
214
- }
215
- #watch-url-field{
216
- font-size:10px;
217
- width:340px;
218
- margin-top:2px;
219
- }
220
- #watch-embed-div label,
221
- #watch-url-div label{
222
- color:#999;
223
- line-height:18px;
224
- font-size:12px;
225
- }
226
- #watch-embed-div input{
227
- font-size:10px;
228
- width:339px;
229
- margin-top:2px;
230
- }
231
- #watch-embed-div #watch-embed-customize{
232
- font-weight:normal;
233
- color:#03c;
234
- }
235
- #watch-customize-embed-div{
236
- display:none;
237
- background-color:white;
238
- border-top:1px solid #CCC;
239
- margin-top:5px;
240
- padding:5px;
241
- }
242
- #watch-customize-embed-form{
243
- display:block;
244
- width:210px;
245
- }
246
- #watch-customize-embed-desc{
247
- display:block;
248
- padding:6px;
249
- }
250
- #watch-customize-embed-theme{
251
- display:block;
252
- clear:both;
253
- }
254
- #watch-customize-embed-theme-swatches{
255
- padding:5px;
256
- display:block;
257
- margin-top:5px;
258
- width:310px;
259
- height:80px;
260
- }
261
- #watch-customize-embed-theme-preview{
262
- display:block;
263
- float:right;
264
- margin:4px 140px;
265
- background:transparent url('.$embed_img.') no-repeat scroll 0px -23px;
266
- width:100px;
267
- height:86px;
268
- }
269
- .watch-image-radio-link{
270
- border:0;
271
- display:inline-block;
272
- float:left;
273
- margin:3px;
274
- }
275
- .watch-image-radio-link:hover{
276
- background-color:#ADD8E6;
277
- }
278
- .watch-image-radio-link.radio_selected{
279
- border:1px solid #000;
280
- margin:2px;
281
- }
282
- .watch-image-radio-link img{
283
- border:1px solid #fff;
284
- background-color:#fff;
285
- padding:0px;
286
- margin:4px;
287
- }
288
- .watch-embed-select{
289
- width:46px;
290
- height:23px;
291
- }
292
- .watch-embed-iceberg{
293
- background:transparent url('.$embed_img.') no-repeat scroll 0px 0px;
294
- }
295
- .watch-embed-blank{
296
- background:transparent url('.$embed_img.') no-repeat scroll -46px 0px;
297
- }
298
- .watch-embed-acid{
299
- background:transparent url('.$embed_img.') no-repeat scroll -92px 0px;
300
- }
301
- .watch-embed-storm{
302
- background:transparent url('.$embed_img.') no-repeat scroll -138px 0px;
303
- }
304
- .watch-embed-green{
305
- background:transparent url('.$embed_img.') no-repeat scroll -184px 0px;
306
- }
307
- .watch-embed-orange{
308
- background:transparent url('.$embed_img.') no-repeat scroll -230px 0px;
309
- }
310
- .watch-embed-pink{
311
- background:transparent url('.$embed_img.') no-repeat scroll -276px 0px;
312
- }
313
- .watch-embed-purple{
314
- background:transparent url('.$embed_img.') no-repeat scroll -322px 0px;
315
- }
316
- .watch-embed-rubyred{
317
- background:transparent url('.$embed_img.') no-repeat scroll -368px 0px;
318
- }
319
- div#dbx-content a{
320
- text-decoration:none;
321
- }
322
- </style>
323
- ';
324
-
325
-
326
-
327
- $imgpath=$wp_yte_plugin_url.'/i';
328
- $actionurl=$_SERVER['REQUEST_URI'];
329
- $nonce=wp_create_nonce( 'smart-youtube');
330
- $example=htmlentities('<div style="float:left;margin-right: 10px;">{video}</div>');
331
- // Configuration Page
332
-
333
-
334
-
335
- echo <<<END
336
- <div class="wrap" style="max-width:950px !important;">
337
- <h2>Smart YouTube</h2>
338
-
339
- <div id="poststuff" style="margin-top:10px;">
340
-
341
- <div id="sideblock" style="float:right;width:220px;margin-left:10px;">
342
- <h2>Information</h2>
343
- <div id="dbx-content" style="text-decoration:none;">
344
- <img src="$imgpath/home.png"><a style="text-decoration:none;" href="http://www.prelovac.com/vladimir/wordpress-plugins/smart-youtube"> Smart Youtube Home</a><br /><br />
345
- <img src="$imgpath/rate.png"><a style="text-decoration:none;" href="http://wordpress.org/extend/plugins/smart-youtube/"> Rate this plugin</a><br /><br />
346
- <img src="$imgpath/help.png"><a style="text-decoration:none;" href="http://www.prelovac.com/vladimir/forum"> Support and Help</a><br />
347
- <p >
348
- <a style="text-decoration:none;" href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2567254&lc=US"><img src="$imgpath/paypal.gif"></a>
349
- </p><br />
350
- <img src="$imgpath/more.png"><a style="text-decoration:none;" href="http://www.prelovac.com/vladimir/wordpress-plugins"> Cool WordPress Plugins</a><br /><br />
351
- <img src="$imgpath/twit.png"><a style="text-decoration:none;" href="http://twitter.com/vprelovac"> Follow updates on Twitter</a><br /><br />
352
- <img src="$imgpath/idea.png"><a style="text-decoration:none;" href="http://www.prelovac.com/vladimir/services"> Need a WordPress Expert?</a>
353
- </div>
354
- </div>
355
-
356
- <div id="mainblock" style="width:710px">
357
-
358
- <div class="dbx-content">
359
- <form name="yteform" action="$action_url" method="post">
360
- <input type="hidden" name="submitted" value="1" />
361
- <input type="hidden" id="_wpnonce" name="_wpnonce" value="$nonce" />
362
- <h2>Usage</h2>
363
-
364
- <p>To use the video in your posts, paste YouTube video URL with <strong>httpv://</strong> (notice the 'v'). </p>
365
- <p><strong>Important:</strong> The URL should just be copied into your post normally and the letter 'v' added, do not create a clickable link!</p>
366
- <p>Example: httpv://www.youtube.com/watch?v=OWfksMD4PAg</p>
367
- <p>If you want to embed high quality video (for videos that have them) use httpvh:// instead (Video High).</p>
368
- <p>If you want to embed HD Quality (DVD quality 720p) video use httpvhd:// instead (Video High Defintion).</p>
369
- <p>To embed playlists use httpvp:// (eg. httpvp://www.youtube.com/view_play_list?p=528026B4F7B34094)</p>
370
- <p>Smart Youtube also supports migrated blogs from Wordpress.com using [youtube=youtubeadresss]</p>
371
-
372
- <ul>
373
- <li>httpv:// - regular video</li>
374
- <li>httpvh:// - high quality</li>
375
- <li>httpvhd:// - HD quality</li>
376
- <li>httpvp:// - playlist</li>
377
- </ul>
378
- <h2>Options</h2>
379
- <p> You can adjust the way your embeded youtube videos behave in the options below.</p>
380
- <p><strong>Video settings</strong></p>
381
-
382
- <div><input id="check3" type="checkbox" name="disp_posts" $disp_posts />
383
- <label for="check3">Display videos in posts</label></div>
384
-
385
- <div><input id="check4" type="checkbox" name="disp_comments" $disp_comments />
386
- <label for="check4">Display videos in comments</label></div>
387
-
388
-
389
- <br><br><strong>Video Appearence</strong><br><br>
390
- <p>Video template. Default is just {video}. <br />
391
- You can try $example if you want the text to wrap around video.</p>
392
- <textarea cols="50" id="disp_template" name="disp_template">$disp_template</textarea>
393
-
394
- <p>Video width and height in normal mode. Default is 425x344.</p>
395
- <input id="disp_width" name="disp_width" value="$disp_width" size="7"/>x<input id="disp_height" name="disp_height" value="$disp_height" size="7" /><br>
396
-
397
- <p>Video width and height in <strong>high quality</strong> mode. Default is 480x360.</p>
398
- <input id="disp_widthhq" name="disp_widthhq" value="$disp_widthhq" size="7" />x<input id="disp_heighthq" name="disp_heighthq" value="$disp_heighthq" size="7" /><br><br>
399
-
400
- <p>Video width and height in <strong>sidebar</strong> mode (regardless of quality). Default is 150x125.</p>
401
- <input id="disp_widthside" name="disp_widthside" value="$disp_widthside" size="7" />x<input id="disp_heightside" name="disp_heightside" value="$disp_heightside" size="7" /><br><br>
402
-
403
-
404
- <br />
405
- <div id="watch-customize-embed-form">
406
- <input type="radio" $disp_rel id="embedCustomization1" name="embedRel" value="1"/>
407
- <label for="embedCustomization1">Include related videos</label><br/>
408
- <input type="radio" $disp_rel2 id="embedCustomization0" name="embedRel" value="0"/>
409
- <label for="embedCustomization0">Do not include related videos</label><br/>
410
- </div>
411
- <img id="watch-customize-embed-theme-preview" src="$wp_yte_plugin_url/img/preview_embed_blank_sm.gif"/>
412
- <div id="watch-customize-embed-theme-swatches">
413
- <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>
414
- <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>
415
- <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>
416
- <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>
417
- <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>
418
- <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>
419
- <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>
420
- <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>
421
- <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>
422
- <input id="embedColor" type="hidden" name="embedColor" value="$disp_color">
423
- <input id="prevUrl" type="hidden" name="prevUrl" value="$wp_yte_plugin_url/img/">
424
- </div>
425
- <div style="margin: 0px 0px 0px 4px; clear: both;">
426
- <input type="checkbox" onchange="onUpdatePreviewImage();" id="show_border_checkbox" name="embedBorder" $disp_border /><label for="show_border_checkbox"> Show Border</label><br>
427
- <input type="checkbox" id="autoplay_checkbox" name="autoplay" $disp_autoplay /><label for="autoplay_checkbox"> Autoplay videos</label><br>
428
- <input type="checkbox" id="disp_search" name="disp_search" $disp_search /><label for="disp_search"> Display search box</label><br>
429
- <input type="checkbox" id="disp_info" name="disp_info" $disp_info /><label for="disp_info"> Remove Titles & Ratings</label><br>
430
- <input type="checkbox" id="disp_ann" name="disp_ann" $disp_ann /><label for="disp_ann"> Remove Annotations</label>
431
- </div>
432
-
433
-
434
- <br>
435
- <p><strong>xHTML validation</strong></p>
436
- <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>
437
- <div><input id="valid" type="checkbox" name="valid" $valid />
438
- <label for="valid">Enable xHTML Validation</label></div>
439
- <br />
440
-
441
-
442
- <br>
443
- <p><strong>RSS feed options</strong></p>
444
- <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>
445
- <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>
446
-
447
- <div><input id="check2" type="checkbox" name="disp_link" $disp_link />
448
- <label for="check2">Display video link in RSS feed</label></div>
449
-
450
- <div><input id="check1" type="checkbox" name="disp_img" $disp_img />
451
- <label for="check1">Display video preview image in RSS feed</label></div>
452
-
453
- <div class="submit"><input type="submit" name="Submit" value="Update options" /></div>
454
- </form>
455
- </div>
456
-
457
- <br/><br/><h3>&nbsp;</h3>
458
- </div>
459
-
460
- </div>
461
-
462
- <h5>a plugin by <a href="http://www.prelovac.com/vladimir/">Vladimir Prelovac</a></h5>
463
- </div>
464
- END;
465
-
466
- }
467
-
468
- // Add Options Page
469
- add_action('admin_menu', 'yte_add_pages');
470
-
471
-
472
-
473
- function yte_tag($file, $high='v', $time = "", $side = 0) {
474
- global $CustomColors;
475
-
476
-
477
- $playlist=0;
478
-
479
- $disp_rel = get_option('smart_yt_rel');
480
- $disp_border = get_option('smart_yt_border');
481
- $disp_color = get_option('smart_yt_color');
482
- $autoplay = get_option('smart_yt_autoplay');
483
- $disp_search=(get_option('smart_yt_search')=='on') ? "1":"0";
484
- $disp_info=(get_option('smart_yt_info')=='on') ? "&showinfo=0":"";
485
- $disp_ann=(get_option('smart_yt_ann')=='on') ? "&iv_load_policy=3":"";
486
- $template=get_option('smart_yt_template');
487
-
488
-
489
- $valid=get_option('smart_yt_valid');
490
-
491
-
492
- switch ($high)
493
- {
494
- case 'v': $high=""; break;
495
- case 'vh': $high="&amp;ap=%2526fmt%3D18"; break;
496
- case 'vhd': $high="&amp;ap=%2526fmt%3D22"; break;
497
- case 'vp': $high=""; $playlist=1; break;
498
- default : $high=""; break;
499
- }
500
-
501
- $width=$side ? get_option('smart_yt_widthside') : ($high ? get_option('smart_yt_widthhq') : get_option('smart_yt_width'));
502
- $height=$side ? get_option('smart_yt_heightside') : ($high ? get_option('smart_yt_heighthq') : get_option('smart_yt_height'));
503
-
504
-
505
-
506
- if ($width=="")
507
- $width=$high!="" ? "480" : "425" ;
508
- if ($height=="")
509
- $height= $high!="" ? "360" : "344";
510
-
511
-
512
- if ($disp_border)
513
- $height+=18;
514
-
515
-
516
- // if ( strpos($_SERVER['HTTP_USER_AGENT'], "iPhone") || strpos($_SERVER['HTTP_USER_AGENT'], "iPod") )
517
- if ($playlist)
518
- {
519
- $yte_tag = '<!-- Smart Youtube --><span class="youtube"><object width="'.$width.'" height="'.$height.'" type="application/x-shockwave-flash" data="'.htmlspecialchars('http://www.youtube.com/p/'.$file.'&rel='.$disp_rel.'&color1='.$CustomColors[$disp_color][0].'&color2='.$CustomColors[$disp_color][1].'&border='.$disp_border.'&fs=1&hl=en&autoplay='.$autoplay.$disp_info.$disp_ann.'&showsearch='.$disp_search, ENT_QUOTES).$high.$time.'" ><param name="allowFullScreen" value="true" /><param name="movie" value="'.htmlspecialchars('http://www.youtube.com/p/'.$file.'&rel='.$disp_rel.'&color1='.$CustomColors[$disp_color][0].'&color2='.$CustomColors[$disp_color][1].'&border='.$disp_border.'&fs=1&hl=en&autoplay='.$autoplay.$disp_info.$disp_ann.'&showsearch='.$disp_search, ENT_QUOTES).$high.$time.'" /><param name="allowscriptaccess" value="always" /></object></span>';
520
- }
521
- // This was added to check for iPhone and iPod devices and checks to see if having valid xhtml is on. If valid xhtml is on then the iPhone/iPod will not see the video, so instead we just output the same code that we would if the valid flag was off. This allows us to serve up valid xhtml for our web users and non-valid xhtml to our iPhone/iPod users so they can still enjoy the experience.
522
- elseif (strpos($_SERVER['HTTP_USER_AGENT'], "iPhone") || strpos($_SERVER['HTTP_USER_AGENT'], "iPod") && ($valid=="on")) {
523
- $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.$disp_info.$disp_ann.'&showsearch='.$disp_search, ENT_QUOTES).$high.$time.'" /><param name="allowFullScreen" value="true" /><embed wmode="transparent" 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.$disp_info.$disp_ann.'&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>';
524
- }
525
- elseif ($valid=="off") {
526
- $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.$disp_info.$disp_ann.'&showsearch='.$disp_search, ENT_QUOTES).$high.$time.'" /><param name="allowFullScreen" value="true" /><embed wmode="transparent" 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.$disp_info.$disp_ann.'&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>';
527
- }
528
- else {
529
- $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.$disp_info.$disp_ann.'&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.$disp_info.$disp_ann.'&showsearch='.$disp_search, ENT_QUOTES).$high.$time.'" /><param name="allowFullScreen" value="true" /><param name="wmode" value="transparent" /></object></span>';
530
- }
531
-
532
-
533
- if (is_feed())
534
- {
535
- if ($high)
536
- $high="&fmt=18";
537
- if (get_option('smart_yt_img')=='on')
538
- $yte_tag.='<a href="http://www.youtube.com/watch?v='.$file.$high.'"><img src="http://img.youtube.com/vi/'.$file.'/default.jpg" width="130" height="97" border=0></a>';
539
- if (get_option('smart_yt_link')=='on')
540
- $ytE_tag.='<a href="http://www.youtube.com/watch?v='.$file.$high.'">www.youtube.com/watch?v='.$file.'</a>';
541
- // if ( (get_option('smart_yt_link')=='off') && (get_option('smart_yt_img')=='off') )
542
- // $yte_tag='http://www.youtube.com/watch?v='.$file;
543
- }
544
- $result= str_replace('{video}', $yte_tag, html_entity_decode($template));
545
-
546
- return $result;
547
- }
548
-
549
- function yte_check($the_content, $side=0) {
550
- if(strpos($the_content, "httpv")!==FALSE ) {
551
-
552
- $char_codes = array('&#215;','&#8211;');
553
- $replacements = array("x", "--");
554
- $the_content=str_replace($char_codes, $replacements, $the_content);
555
-
556
- preg_match_all("/http(v|vh|vhd):\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/)([a-zA-Z0-9\-\_]{11})([^<\s]*)/", $the_content, $matches, PREG_SET_ORDER);
557
- foreach($matches as $match) {
558
-
559
- $the_content = preg_replace("/http".$match[1].":\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/)([a-zA-Z0-9\-\_]{11})([^\s<]*)/", yte_tag($match[4], $match[1], $match[5], $side), $the_content, 1);
560
- }
561
-
562
- preg_match_all("/http(vp):\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/view_play_list(\?p\=|\/v\/)([a-zA-Z0-9\-\_]{16})([^<\s]*)/", $the_content, $matches, PREG_SET_ORDER);
563
- foreach($matches as $match) {
564
- $the_content = preg_replace("/http".$match[1].":\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/view_play_list(\?p\=|\/v\/)([a-zA-Z0-9\-\_]{16})([^\s<]*)/", yte_tag($match[4], $match[1], $match[5], $side), $the_content, 1);
565
- }
566
-
567
-
568
- }
569
-
570
- // to work with migrated blogs from Wordpress.com replacing [youtube=youtubeadresss]
571
- if(strpos($the_content, "[youtube")!==FALSE ) {
572
- preg_match_all("/\[youtube\=http:\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/)([a-zA-Z0-9\-\_]{11})([^<\s]*)\]/", $the_content, $matches, PREG_SET_ORDER);
573
- foreach($matches as $match) {
574
- $the_content = preg_replace("/\[youtube\=http:\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/)([a-zA-Z0-9\-\_]{11})([^\s<]*)\]/", yte_tag($match[3], '', $match[4], $side), $the_content, 1);
575
- }
576
- }
577
-
578
-
579
- return $the_content;
580
- }
581
-
582
-
583
- function yte_install(){
584
- if(get_option('smart_yt_posts' == '') || !get_option('smart_yt_posts')){
585
- add_option('smart_yt_posts', 'on');
586
- }
587
- if(get_option('smart_yt_width' == '') || !get_option('smart_yt_width')){
588
- add_option('smart_yt_width', '425');
589
- }
590
- if(get_option('smart_yt_height' == '') || !get_option('smart_yt_height')){
591
- add_option('smart_yt_height', '355');
592
- }
593
-
594
- if(get_option('smart_yt_widthhq' == '') || !get_option('smart_yt_widthhq')){
595
- add_option('smart_yt_widthhq', '480');
596
- }
597
- if(get_option('smart_yt_heighthq' == '') || !get_option('smart_yt_heighthq')){
598
- add_option('smart_yt_heighthq', '360');
599
- }
600
-
601
- if(get_option('smart_yt_widthside' == '') || !get_option('smart_yt_widthside')){
602
- add_option('smart_yt_widthside', '150');
603
- }
604
- if(get_option('smart_yt_heightside' == '') || !get_option('smart_yt_heightside')){
605
- add_option('smart_yt_heightside', '125');
606
- }
607
-
608
- if(get_option('smart_yt_rel' == '') || !get_option('smart_yt_rel')){
609
- add_option('smart_yt_rel', '1');
610
- }
611
- if(get_option('smart_yt_color' == '') || !get_option('smart_yt_color')){
612
- add_option('smart_yt_color', 'blank');
613
- }
614
-
615
- if(get_option('smart_yt_link' == '') || !get_option('smart_yt_link')){
616
- add_option('smart_yt_link', 'on');
617
- }
618
-
619
- if(get_option('smart_yt_valid' == '') || !get_option('smart_yt_valid')){
620
- add_option('smart_yt_valid', 'off');
621
- }
622
-
623
- if(get_option('smart_yt_search' == '') || !get_option('smart_yt_search')){
624
- add_option('smart_yt_search', 'off');
625
- }
626
-
627
- if(get_option('smart_yt_info' == '') || !get_option('smart_yt_info')){
628
- add_option('smart_yt_info', 'on');
629
- }
630
-
631
- if(get_option('smart_yt_ann' == '') || !get_option('smart_yt_ann')){
632
- add_option('smart_yt_ann', 'on');
633
- }
634
-
635
- if(get_option('smart_yt_template' == '') || !get_option('smart_yt_template')){
636
- add_option('smart_yt_template', '{video}');
637
- }
638
-
639
-
640
- // register widget
641
- if (function_exists('register_sidebar_widget'))
642
- register_sidebar_widget('Smart YouTube', 'yte_widget');
643
-
644
- if (function_exists('register_widget_control'))
645
- register_widget_control('Smart YouTube', 'yte_widgetcontrol');
646
-
647
-
648
- }
649
-
650
- function yte_widgetcontrol()
651
- {
652
- if ($_REQUEST['submit'])
653
- {
654
- update_option('smart_yt_wtext', stripslashes(($_REQUEST['yte_text'])));
655
- update_option('smart_yt_wtitle', stripslashes(($_REQUEST['yte_title'])));
656
- }
657
- $text=wp_specialchars(get_option('smart_yt_wtext'));
658
- $title=wp_specialchars(get_option('smart_yt_wtitle'));
659
- echo 'Title:<br /><input type="text" id="yte_title" name="yte_title" value="'.$title.'" /><br />';
660
- echo 'Insert HTML code below. In addition to normal text you may use httpv, httpvh and httpvhd links just like in your posts.<br/><textarea id="text" name="yte_text" rows="10" cols="16" class="widefat">'.$text.'</textarea>';
661
- echo '<input type="hidden" id="submit" name="submit" value="1" />';
662
- }
663
-
664
-
665
- function yte_widget($args = array() )
666
- {
667
- extract ($args);
668
- $text = yte_check((get_option('smart_yt_wtext')), 1);
669
- echo $before_widget;
670
- echo $before_title.(get_option('smart_yt_wtitle')).$after_title;
671
- echo $text;
672
- echo $after_widget;
673
-
674
- }
675
-
676
- if (isset($_GET['activate']) && $_GET['activate'] == 'true') {
677
- yte_install();
678
- }
679
-
680
- if (get_option('smart_yt_posts')=='on') {
681
- add_filter('the_content', 'yte_check', 100);
682
- add_filter('the_excerpt','yte_check', 100);
683
-
684
-
685
- }
686
- if (get_option('smart_yt_comments')=='on') {
687
- add_filter('comment_text','yte_check', 100);
688
- }
689
-
690
- add_action( 'plugins_loaded', 'yte_install' );
691
-
692
- add_action( 'after_plugin_row', 'yte_check_plugin_version' );
693
-
694
- function yte_getinfo()
695
- {
696
- $checkfile = "http://svn.wp-plugins.org/smart-youtube/trunk/smartyoutube.chk";
697
- //$checkfile = "http://www.prelovac.com/plugin/smartyoutube.chk";
698
-
699
- $status=array();
700
- return $status;
701
- $vcheck = wp_remote_fopen($checkfile);
702
-
703
- if($vcheck)
704
- {
705
- $version = $yte_localversion;
706
-
707
- $status = explode('@', $vcheck);
708
- return $status;
709
- }
710
- }
711
-
712
- function yte_check_plugin_version($plugin)
713
- {
714
- global $plugindir,$yte_localversion;
715
-
716
- if( strpos($plugin,'smartyoutube.php')!==false )
717
- {
718
-
719
-
720
- $status=yte_getinfo();
721
-
722
- $theVersion = $status[1];
723
- $theMessage = $status[3];
724
-
725
- if( (version_compare(strval($theVersion), strval($yte_localversion), '>') == 1) )
726
- {
727
- $msg = 'Latest version available '.' <strong>'.$theVersion.'</strong><br />'.$theMessage;
728
- echo '<td colspan="5" class="plugin-update" style="line-height:1.2em;">'.$msg.'</td>';
729
- } else {
730
- return;
731
- }
732
-
733
- }
734
- }
735
-
736
-
737
-
738
-
739
-
740
- ?>
1
+ <?php
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: 3.4
8
+ Author URI: http://www.prelovac.com/vladimir/
9
+
10
+ Updates:
11
+ 3.4 - Completely rewritten the plugin, added new HD video support, added video privacy option
12
+ 3.3.2 - Fixed xHTML validation for playlists (credit Dietmar)
13
+ 3.3.1 - Fixed Iphone validation (credit John Neumann)
14
+ 3.3 - Supports migrated blogs from Wordpress.com replacing [youtube=youtubeadresss]
15
+ 3.2 - Added title to widget, fixed HTML code issue with widget
16
+ 3.1.1 - param closed properly for validation
17
+ 3.1 - wmode transparent parameter updated to better handle transparancy
18
+ 3.0 - Added video template, option to set sidebar video size, fixed sidebar widget code, fixed video syntax issue
19
+ 2.8.1 - Display Annotioans added as option
20
+ 2.8 - Support for playlists
21
+ 2.7.5 - Plugin url updated to use WP_PLUGIN_URL
22
+ 2.7.4 - Added option to remove info&ratings
23
+ 2.7.3 - Removed annotiations
24
+ 2.7 - Supports a sidebar widget for videos
25
+ 2.6 - Added option to remove search button
26
+ 2.5 - Added DVD quality support (httpvq)
27
+ 2.4.1 - Small fixes in embed and rss links
28
+ 2.4 - Added support for extra parameters like &start=50 to start the video at 50th second of play
29
+ 2.2 - Full xHTML validaiton
30
+ 2.1 - Made the application iPhone compatible and allowed full screen
31
+ 2.0 - Support for playback high quality YouTube videos
32
+ 1.9 - Added video autoplay option
33
+ 1.8 - Solved Problem with HTML validation, enabled full video preview in RSS
34
+ 1.6 - Solving a problem with wordpress handling special characters
35
+ 1.5 - Added new admin interface and more options to control the video
36
+
37
+ To-Do:
38
+ - marinas javascript suggestion for hq videos
39
+ - add editor button
40
+ - The plugin places a preview image in the RSS feed which is great, but it links to the video on http://www.youtube.com. I would like to change it so the image links to the blog post so I can generate some traffic on my blog.
41
+ - localization
42
+ - the images appear under the embedded Smart Youtube videos. Is there any way to edit the z-index for Smart Youtube CSS? I
43
+ */
44
+
45
+
46
+
47
+ if (isset($smart_youtube)) return false;
48
+
49
+ require_once(dirname(__FILE__) . '/smartyoutube.class.php');
50
+
51
+ $smart_youtube = new SmartYouTube();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
style.css ADDED
@@ -0,0 +1,213 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #watch-embed-div,
2
+ #watch-url-div{
3
+ border-top:1px solid #CCC;
4
+ font-size:11px;
5
+ }
6
+ #watch-url-div{
7
+ margin:5px 0;
8
+ }
9
+ #watch-url-field{
10
+ font-size:10px;
11
+ width:340px;
12
+ margin-top:2px;
13
+ }
14
+ #watch-embed-div label,
15
+ #watch-url-div label{
16
+ color:#999;
17
+ line-height:18px;
18
+ font-size:12px;
19
+ }
20
+ #watch-embed-div input{
21
+ font-size:10px;
22
+ width:339px;
23
+ margin-top:2px;
24
+ }
25
+ #watch-embed-div #watch-embed-customize{
26
+ font-weight:normal;
27
+ color:#03c;
28
+ }
29
+ #watch-customize-embed-div{
30
+ display:none;
31
+ background-color:white;
32
+ border-top:1px solid #CCC;
33
+ margin-top:5px;
34
+ padding:5px;
35
+ }
36
+ #watch-customize-embed-form{
37
+ display:block;
38
+
39
+ }
40
+ #watch-customize-embed-desc{
41
+ display:block;
42
+ padding:6px;
43
+ }
44
+ #watch-customize-embed-theme{
45
+ display:block;
46
+ clear:both;
47
+ }
48
+ #watch-customize-embed-theme-swatches{
49
+ padding:5px;
50
+ display:block;
51
+ margin-top:5px;
52
+ width:310px;
53
+ height:80px;
54
+ }
55
+ #watch-customize-embed-theme-preview{
56
+ display:block;
57
+ float:right;
58
+ margin:4px 140px;
59
+ background:transparent url('img/embed_selection-vfl29294.png') no-repeat scroll 0px -23px;
60
+ width:100px;
61
+ height:86px;
62
+ }
63
+ .watch-image-radio-link{
64
+ border:0;
65
+ display:inline-block;
66
+ float:left;
67
+ margin:3px;
68
+ }
69
+ .watch-image-radio-link:hover{
70
+ background-color:#ADD8E6;
71
+ }
72
+ .watch-image-radio-link.radio_selected{
73
+ border:1px solid #000;
74
+ margin:2px;
75
+ }
76
+ .watch-image-radio-link img{
77
+ border:1px solid #fff;
78
+ background-color:#fff;
79
+ padding:0px;
80
+ margin:4px;
81
+ }
82
+ .watch-embed-select{
83
+ width:46px;
84
+ height:23px;
85
+ }
86
+ .watch-embed-iceberg{
87
+ background:transparent url('img/embed_selection-vfl29294.png') no-repeat scroll 0px 0px;
88
+ }
89
+ .watch-embed-blank{
90
+ background:transparent url('img/embed_selection-vfl29294.png') no-repeat scroll -46px 0px;
91
+ }
92
+ .watch-embed-acid{
93
+ background:transparent url('img/embed_selection-vfl29294.png') no-repeat scroll -92px 0px;
94
+ }
95
+ .watch-embed-storm{
96
+ background:transparent url('img/embed_selection-vfl29294.png') no-repeat scroll -138px 0px;
97
+ }
98
+ .watch-embed-green{
99
+ background:transparent url('img/embed_selection-vfl29294.png') no-repeat scroll -184px 0px;
100
+ }
101
+ .watch-embed-orange{
102
+ background:transparent url('img/embed_selection-vfl29294.png') no-repeat scroll -230px 0px;
103
+ }
104
+ .watch-embed-pink{
105
+ background:transparent url('img/embed_selection-vfl29294.png') no-repeat scroll -276px 0px;
106
+ }
107
+ .watch-embed-purple{
108
+ background:transparent url('img/embed_selection-vfl29294.png') no-repeat scroll -322px 0px;
109
+ }
110
+ .watch-embed-rubyred{
111
+ background:transparent url('img/embed_selection-vfl29294.png') no-repeat scroll -368px 0px;
112
+ }
113
+ div#dbx-content a{
114
+ text-decoration:none;
115
+ }
116
+
117
+ .smartyoutube h3
118
+ {
119
+ margin: 25px 0 10px !important;
120
+ padding: 0 !important;
121
+ font-size: 14px !important;
122
+ }
123
+
124
+ .smartyoutube p.instruct
125
+ {
126
+ color: #555;
127
+ font-size: 11px;
128
+ }
129
+
130
+ #sideblock
131
+ {
132
+ padding: 10px 0 10px 10px;
133
+ background: #fdffee;
134
+ border: 1px solid #ddd;
135
+ }
136
+
137
+ #sideblock h2
138
+ {
139
+ margin: 0 0 5px 0 !important;
140
+ }
141
+
142
+ h5.author
143
+ {
144
+ background: #eee;
145
+ border-top: 1px solid #ddd;
146
+ height: 28px !important;
147
+ line-height: 28px !important;
148
+ padding-left: 12px !important;
149
+ margin: 20px 0 -5px !important;
150
+ }
151
+
152
+ .size-chooser
153
+ {
154
+ border: 1px solid #ddd;
155
+ padding: 5px;
156
+ margin: 3px 0 10px;
157
+ width: 400px;
158
+ }
159
+
160
+ .size-chooser a
161
+ {
162
+ display: block;
163
+ padding: 2px;
164
+ float: left;
165
+ margin-right: 5px;
166
+ color: #888;
167
+ border: 2px solid transparent;
168
+ text-decoration: none;
169
+ }
170
+
171
+ .size-chooser a:hover
172
+ {
173
+ border-color: #add8e6;
174
+ }
175
+
176
+ .size-chooser a.chosen .outer
177
+ {
178
+ border-color: #a0b3d9;
179
+ background: #d8e6fb;
180
+ }
181
+
182
+ .size-chooser a span
183
+ {
184
+ display: block;
185
+ color: #999;
186
+ font-size: 11px;
187
+ text-align: center;
188
+ }
189
+
190
+ .size-chooser a.chosen span
191
+ {
192
+ color: #000;
193
+ }
194
+
195
+ .size-chooser a .outer
196
+ {
197
+ background: #ddd;
198
+ border: 1px solid #999;
199
+ margin: 0 auto;
200
+ }
201
+
202
+ .size-chooser a .outer div
203
+ {
204
+ border-left: 1px solid #fff;
205
+ border-top: 1px solid #fff;
206
+ height: 99%;
207
+ }
208
+
209
+ #usageHeader a
210
+ {
211
+ font-size: 10px;
212
+ font-style: normal;
213
+ }
yt.js CHANGED
@@ -99,4 +99,31 @@ onChangeColor(embedColor.value);
99
  previewImage.src=prevUrl.value+'preview_embed_'+selectedThemeColor+'_sm'+border+'.gif';
100
 
101
  }
102
- window.onload = loaded;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
  previewImage.src=prevUrl.value+'preview_embed_'+selectedThemeColor+'_sm'+border+'.gif';
100
 
101
  }
102
+ window.onload = loaded;
103
+
104
+
105
+
106
+ jQuery(function($){
107
+ $(".size-chooser a").click(function(e){
108
+ e.preventDefault();
109
+ vwidth = $(this).attr('v-width');
110
+ vheight = $(this).attr('v-height');
111
+ $(this).addClass("chosen").siblings().removeClass("chosen");
112
+ target = "#" + $(this).parent("div").attr("forDiv");
113
+ $(target).find("input.width").val(vwidth);
114
+ $(target).find("input.height").val(vheight);
115
+ }).each(function(){
116
+ vwidth = $(this).attr('v-width');
117
+ vheight = $(this).attr('v-height');
118
+ thumb_width = Math.round(vwidth/8);
119
+ thumb_height = Math.round(vheight/8);
120
+
121
+ $(this).find(".outer").css("width", thumb_width + "px").css("height", thumb_height + "px");
122
+ $(this).find("span").text(vwidth + "x" + vheight);
123
+ });
124
+
125
+ $("#usageHeader a").click(function(e){
126
+ e.preventDefault();
127
+ $("#usage").slideToggle("fast");
128
+ });
129
+ });