Version Description
- Fixed HTML validation
- Colorbox now displayed on archive pages as well
Download this release
Release Info
Developer | freediver |
Plugin | Smart YouTube PRO |
Version | 4.1.9 |
Comparing to | |
See all releases |
Code changes from version 4.1.8 to 4.1.9
- readme.txt +5 -1
- smartyoutube.php +1564 -1566
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: freediver
|
|
3 |
Donate link: https://www.networkforgood.org/donation/MakeDonation.aspx?ORGID2=520781390
|
4 |
Tags: youtube, video, play, media, Post, posts, admin, metacafe, liveleak, vimeo, facebook, thumbnails
|
5 |
Requires at least: 2.0
|
6 |
-
Tested up to: 3.5
|
7 |
Stable tag: trunk
|
8 |
|
9 |
Smart Youtube is a professional WordPress Video plugin that allows you to easily insert videos/playlists into your post, comments and in your RSS feed. The plugin is designed to be small and fast and not use any external resources.
|
@@ -49,6 +49,10 @@ For updates, you can check out [my blog](http://www.prelovac.com/vladimir/) or f
|
|
49 |
|
50 |
== Changelog ==
|
51 |
|
|
|
|
|
|
|
|
|
52 |
= 4.1.8 =
|
53 |
* 3.5 compatiblity
|
54 |
|
3 |
Donate link: https://www.networkforgood.org/donation/MakeDonation.aspx?ORGID2=520781390
|
4 |
Tags: youtube, video, play, media, Post, posts, admin, metacafe, liveleak, vimeo, facebook, thumbnails
|
5 |
Requires at least: 2.0
|
6 |
+
Tested up to: 3.5.1
|
7 |
Stable tag: trunk
|
8 |
|
9 |
Smart Youtube is a professional WordPress Video plugin that allows you to easily insert videos/playlists into your post, comments and in your RSS feed. The plugin is designed to be small and fast and not use any external resources.
|
49 |
|
50 |
== Changelog ==
|
51 |
|
52 |
+
= 4.1.9 =
|
53 |
+
* Fixed HTML validation
|
54 |
+
* Colorbox now displayed on archive pages as well
|
55 |
+
|
56 |
= 4.1.8 =
|
57 |
* 3.5 compatiblity
|
58 |
|
smartyoutube.php
CHANGED
@@ -1,1566 +1,1564 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Plugin Name: Smart Youtube PRO
|
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: 4.1.
|
8 |
-
Author URI: http://www.prelovac.com/vladimir/
|
9 |
-
|
10 |
-
|
11 |
-
To-Do:
|
12 |
-
|
13 |
-
- Is there a way to have smart youtube display multiple thumbnails of youtube videos in this fashion:
|
14 |
-
http://wordpress.org/extend/plugins/my-youtube-playlist/
|
15 |
-
|
16 |
-
The author of this plugin has done a good job in birthing the concept, but is unable to really do much by way of support or add features, e.g. highlight thumbnail currently playing, flexible grouping styles of thumbnails (horizontal, vertical listing) etc.
|
17 |
-
|
18 |
-
- Wondering if there's a way to have smartyoutube generate a thumbnail of the youtube video that shows up as one of the thumbnail options for the article when someone shares the blog post?
|
19 |
-
|
20 |
-
- Would it be possible to overwrite the global autoplay param in a post, something like httpv://www.youtube.com/watch?v=00000000&autoplay=true; I tried to add autoplay=1 but unfortunately in the resuling html it adds autoplay=0 (the global option) and also autoplay=1
|
21 |
-
The result is no autoplay :(
|
22 |
-
|
23 |
-
- Instead of editing the shortcut, we have copied from youtube.
|
24 |
-
I would love to have a button,
|
25 |
-
like insert Smart YouTube Video
|
26 |
-
A dialogue box would pop up,
|
27 |
-
and allow me to just simply paste the link.
|
28 |
-
Then having check boxes on the side,
|
29 |
-
which allow me to choose whether you would like HD or not.
|
30 |
-
thus editing the link correctly.
|
31 |
-
|
32 |
-
I find this would greatly help, especiall when I help create video blogs for community provider who have very little computer background.
|
33 |
-
|
34 |
-
- Please add support for it on the BuddyPress Acitivity page, currently it just shows the url (which won't work because of the httpv and httpvh)
|
35 |
-
|
36 |
-
- Was wondering if it was possible for you to have the plugin take the URL for the Youtube thumbnail for the video and place it into a user defined custom field. The plugin "YoutubeThumb2CustomField" but no longer works in WP 3.0 (network).
|
37 |
-
|
38 |
-
- love to see vimeo support! i have video intensive site...love Vimeo
|
39 |
-
|
40 |
-
Only issue is I would LOVE to add the widget into another sidebar and I do not see this possibility. Can you have multiple Smart YouTubes?
|
41 |
-
|
42 |
-
- 1. Adding few possibilities for posting videos into post � I have great production of videos but before end of 2009 all was in 320 x 240 and after end of 2009 I start publishing video in 640 x 480 resolution. I have adjusted player video for 640 x 480 but now 320 x 240 videos are stretched across all of player window.
|
43 |
-
|
44 |
-
For changes to be easy implemented � I suggest adding 2 or even 3 possibilities for playing videos � like this:
|
45 |
-
Your original code httpv://www.youtube.com/********************
|
46 |
-
Another version of httpv#1://www.youtube.com/********************
|
47 |
-
Another version of httpv#2://www.youtube.com/********************
|
48 |
-
Another version of httpv#3://www.youtube.com/********************
|
49 |
-
|
50 |
-
Adding #1 after v will allow us to predefine what will be size of player for #1 or number #2 or number #3 � I think it is good idea
|
51 |
-
|
52 |
-
If you don�t put #1, #2, #3 player will be those which is default (without number) � in my case that is 640 x 480.
|
53 |
-
|
54 |
-
2. If some video is for �personal use� which mean somebody must be log into you tube to see it, than I suggest making possibility for login for authors of those videos � If I put all my materials to be private (up to 25 people can see it) � than I cant publish them trough this way � and allowing authors to write theirs username and password will allow that those vides can be seen on my posts. That way I can protect all my archive of video on youtube, but allow those video can be visible on my blog � which can increase hits, visits and others possibility � that possibility is visible on this plug in http://tubepress.org/ where people can use its username and password for publishing all vides from if they have account on youtube
|
55 |
-
|
56 |
-
|
57 |
-
- marinas javascript suggestion for hq videos
|
58 |
-
- add editor button
|
59 |
-
- 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.
|
60 |
-
- localization
|
61 |
-
- the images appear under the embedded Smart Youtube videos. Is there any way to edit the z-index for Smart Youtube CSS? I
|
62 |
-
- would like to use multiple instances of the Smart YouTube plugin. I saw the reply that said to simply use multiple calls in one instance of the widget, but that doesn't let me choose different videos for different pages.
|
63 |
-
- was wondering if it's possible to get a vid and playlist in a custom page template?? Is it possible to add a preview image to search results?
|
64 |
-
- I wondered if there were a way to bring the video to the forefront layer (perhaps z-index)? I know this actually breaks good design practice in my intended use, but have a look here:
|
65 |
-
- However, on one page I have two videos and therefore I want to add a a parameter to the second video embed URL to _not_ start automatically. Something like httpv://www.youtube.com/watch?v=xyz123&autostart=off
|
66 |
-
- Single videos work well from wordpress on the Iphone/ipod. Is there a way to make the playlists work, just getting the ? cube instead of image.
|
67 |
-
- I would like to "inject" automatically this preview image url in a custom field, in each post, to auto-generate the thumb on my homepage with this image.
|
68 |
-
*/
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
if (isset($smart_youtube_pro)) return false;
|
73 |
-
|
74 |
-
$smart_youtube_pro = new SmartYouTube_PRO();
|
75 |
-
|
76 |
-
class SmartYouTube_PRO {
|
77 |
-
var $local_version;
|
78 |
-
var $plugin_url;
|
79 |
-
var $options;
|
80 |
-
var $key;
|
81 |
-
var $first;
|
82 |
-
var $first_post_on_archive;
|
83 |
-
|
84 |
-
function SmartYouTube() {
|
85 |
-
$this->__construct();
|
86 |
-
}
|
87 |
-
|
88 |
-
function __construct() {
|
89 |
-
$this->local_version = '1.0'; // TODO: Change this number???
|
90 |
-
|
91 |
-
$this->plugin_url = trailingslashit(plugins_url(null,__FILE__));
|
92 |
-
|
93 |
-
|
94 |
-
$this->key = 'smart_youtube_pro';
|
95 |
-
$this->first_post_on_archive = false;
|
96 |
-
|
97 |
-
$script_path = $this->plugin_url . '/javascripts/jquery.colorbox-min.js';
|
98 |
-
wp_register_script( 'colorbox', $script_path );
|
99 |
-
|
100 |
-
$this->options = $this->get_options();
|
101 |
-
|
102 |
-
$this->add_filters_and_hooks();
|
103 |
-
}
|
104 |
-
|
105 |
-
function add_filters_and_hooks() {
|
106 |
-
if ( $this->options['posts'] == 'on' ) {
|
107 |
-
add_filter( 'the_content', array( $this, 'check' ), 5 );
|
108 |
-
add_filter( 'the_excerpt', array( $this, 'check_excerpt' ), 5 );
|
109 |
-
}
|
110 |
-
|
111 |
-
if ( $this->options['comments'] == 'on' ) {
|
112 |
-
add_filter( 'comment_text', array( $this, 'check' ), 100 );
|
113 |
-
}
|
114 |
-
|
115 |
-
add_action( 'plugins_loaded', array( $this, 'install' ) );
|
116 |
-
add_action( 'admin_menu', array( $this, 'add_menu_items' ) );
|
117 |
-
add_action( 'admin_head', array( $this, 'plugin_header' ) );
|
118 |
-
add_action( 'wp_head', array( $this, 'post_header' ) );
|
119 |
-
add_action( 'wp_print_scripts', array( $this, 'load_scripts' ) );
|
120 |
-
add_action( 'wp_print_styles', array( $this, 'load_styles' ) );
|
121 |
-
add_action( 'template_redirect', array( $this, 'mark_first_post_on_archive' ) );
|
122 |
-
|
123 |
-
register_activation_hook(__FILE__, array($this, 'install' ) );
|
124 |
-
}
|
125 |
-
|
126 |
-
function post_header() {
|
127 |
-
|
128 |
-
|
129 |
-
$
|
130 |
-
$
|
131 |
-
$
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
$page =
|
171 |
-
|
172 |
-
|
173 |
-
?>
|
174 |
-
|
175 |
-
<?php
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
($)('#disp_excerpt_align_div').
|
184 |
-
|
185 |
-
($)(
|
186 |
-
|
187 |
-
|
188 |
-
($)('#disp_excerpt_align_div').
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
<?php
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
$this->options['
|
235 |
-
$this->options['
|
236 |
-
$this->options['
|
237 |
-
|
238 |
-
$this->options['
|
239 |
-
|
240 |
-
$this->options['
|
241 |
-
|
242 |
-
|
243 |
-
$this->options['
|
244 |
-
|
245 |
-
|
246 |
-
$this->options['
|
247 |
-
|
248 |
-
|
249 |
-
$this->options['
|
250 |
-
|
251 |
-
$this->options['
|
252 |
-
$this->options['
|
253 |
-
|
254 |
-
$this->options['
|
255 |
-
|
256 |
-
$this->options['
|
257 |
-
$this->options['
|
258 |
-
$this->options['
|
259 |
-
|
260 |
-
$this->options['
|
261 |
-
|
262 |
-
$this->options['
|
263 |
-
$this->options['
|
264 |
-
$this->options['
|
265 |
-
$this->options['
|
266 |
-
$this->options['
|
267 |
-
$this->options['
|
268 |
-
$this->options['
|
269 |
-
$this->options['
|
270 |
-
|
271 |
-
$this->
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
$
|
280 |
-
$
|
281 |
-
$
|
282 |
-
|
283 |
-
$
|
284 |
-
|
285 |
-
$
|
286 |
-
|
287 |
-
|
288 |
-
$
|
289 |
-
|
290 |
-
|
291 |
-
$
|
292 |
-
|
293 |
-
|
294 |
-
$
|
295 |
-
|
296 |
-
$
|
297 |
-
$
|
298 |
-
$
|
299 |
-
$
|
300 |
-
|
301 |
-
$
|
302 |
-
|
303 |
-
$
|
304 |
-
$
|
305 |
-
$
|
306 |
-
$
|
307 |
-
$
|
308 |
-
$
|
309 |
-
$
|
310 |
-
|
311 |
-
$
|
312 |
-
|
313 |
-
$
|
314 |
-
$
|
315 |
-
$
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
$
|
335 |
-
$
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
?>
|
342 |
-
<
|
343 |
-
|
344 |
-
<
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
<p><?php _e( '
|
355 |
-
<p><?php _e( '
|
356 |
-
<p><?php _e( 'Example: httpv://
|
357 |
-
<p><?php _e( '
|
358 |
-
<p><?php _e( '
|
359 |
-
<p><?php _e( '
|
360 |
-
<p><?php _e( '
|
361 |
-
<
|
362 |
-
|
363 |
-
|
364 |
-
<li><?php _e( '
|
365 |
-
<li><?php _e( '
|
366 |
-
<li><?php _e( '
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
<
|
373 |
-
<
|
374 |
-
|
375 |
-
<p><?php _e( '
|
376 |
-
|
377 |
-
<
|
378 |
-
<
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
<
|
399 |
-
<
|
400 |
-
<
|
401 |
-
<
|
402 |
-
<
|
403 |
-
<
|
404 |
-
<
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
<
|
480 |
-
|
481 |
-
|
482 |
-
<
|
483 |
-
<
|
484 |
-
<
|
485 |
-
<
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
<input type="checkbox" id="
|
492 |
-
<input type="checkbox" id="
|
493 |
-
<input type="checkbox" id="
|
494 |
-
<input type="checkbox" id="
|
495 |
-
<input type="checkbox" id="
|
496 |
-
<input type="checkbox" id="
|
497 |
-
<input type="checkbox" id="
|
498 |
-
<
|
499 |
-
<
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
<option value="
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
<
|
523 |
-
<
|
524 |
-
<
|
525 |
-
|
526 |
-
<
|
527 |
-
|
528 |
-
<
|
529 |
-
<
|
530 |
-
<
|
531 |
-
<
|
532 |
-
<
|
533 |
-
<
|
534 |
-
<
|
535 |
-
<
|
536 |
-
<
|
537 |
-
<
|
538 |
-
<
|
539 |
-
<input id="
|
540 |
-
<label for="
|
541 |
-
<
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
$this->
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
$
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
<
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
<
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
<?php
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
$
|
614 |
-
|
615 |
-
|
616 |
-
$
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
<
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
<
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
*
|
655 |
-
*
|
656 |
-
*
|
657 |
-
* @
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
$
|
663 |
-
$
|
664 |
-
|
665 |
-
$
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
$videos
|
675 |
-
$
|
676 |
-
|
677 |
-
$
|
678 |
-
|
679 |
-
$the_content = str_replace( $match[1], $
|
680 |
-
} else if (
|
681 |
-
$the_content = str_replace( $match[1], $this->tag_youtube( $context, $match[6],
|
682 |
-
}
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
$videos
|
688 |
-
$
|
689 |
-
|
690 |
-
$
|
691 |
-
|
692 |
-
$the_content = str_replace( $match[
|
693 |
-
} else if (
|
694 |
-
$the_content = str_replace( $match[8], $this->tag_youtube( $context, $match[12],
|
695 |
-
}
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
$videos
|
701 |
-
$
|
702 |
-
|
703 |
-
$
|
704 |
-
|
705 |
-
$the_content = str_replace( $match[
|
706 |
-
} else if (
|
707 |
-
$the_content = str_replace( $match[13], $this->tag_metacafe( $context, $match[17],
|
708 |
-
}
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
$videos
|
714 |
-
$
|
715 |
-
|
716 |
-
$
|
717 |
-
|
718 |
-
$the_content = str_replace( $match[
|
719 |
-
} else if (
|
720 |
-
$the_content = str_replace( $match[20], $this->tag_vimeo( $context, $match[24],
|
721 |
-
}
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
$videos
|
727 |
-
$
|
728 |
-
|
729 |
-
$
|
730 |
-
|
731 |
-
$the_content = str_replace( $match[
|
732 |
-
} else if (
|
733 |
-
$the_content = str_replace( $match[26], $this->tag_liveleak( $context, $match[31],
|
734 |
-
}
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
$videos
|
740 |
-
$
|
741 |
-
|
742 |
-
$
|
743 |
-
|
744 |
-
$the_content = str_replace( $match[
|
745 |
-
} else if (
|
746 |
-
$the_content = str_replace( $match[32], $this->tag_facebook( $context, $match[36],
|
747 |
-
}
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
$videos
|
754 |
-
$
|
755 |
-
|
756 |
-
$
|
757 |
-
|
758 |
-
$the_content = str_replace( $match[
|
759 |
-
} else if (
|
760 |
-
$the_content = str_replace( $match[37], $this->tag_youtube( $context, $match[42],
|
761 |
-
}
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
}
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
if (
|
770 |
-
$the_content = str_replace( $match[0], $this->tag_youtube( $context, $match[4],
|
771 |
-
}
|
772 |
-
|
773 |
-
|
774 |
-
}
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
if (
|
779 |
-
$the_content = str_replace( $match[0], $this->tag_metacafe( $context, $match[4],
|
780 |
-
}
|
781 |
-
|
782 |
-
|
783 |
-
}
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
if (
|
788 |
-
$the_content = str_replace( $match[0], $this->tag_vimeo( $context, $match[4],
|
789 |
-
}
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
if (
|
797 |
-
$the_content = str_replace( $match[0], $this->tag_liveleak( $context, $match[5],
|
798 |
-
}
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
if (
|
806 |
-
$the_content = str_replace( $match[0], $this->tag_facebook( $context, $match[4],
|
807 |
-
}
|
808 |
-
|
809 |
-
|
810 |
-
}
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
if (
|
815 |
-
$the_content = str_replace( $match[0], $this->tag_youtube( $context, $match[5],
|
816 |
-
}
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
$tag
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
$content
|
851 |
-
|
852 |
-
preg_match_all( "/(http(v|vh|vhd)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?
|
853 |
-
preg_match_all( "/(http(v|vh|vhd)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?
|
854 |
-
preg_match_all( "/(http(v|vh|vhd)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?
|
855 |
-
preg_match_all( "/(http(v|vh|vhd)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
if (
|
861 |
-
$matches['youtube.com'][0][0] = str_replace( $matches['youtube.com'][0][0], $this->tag_youtube( 'excerpt', $matches['youtube.com'][0][5], '
|
862 |
-
}
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
if (
|
868 |
-
$matches['youtu.be'][0][0] = str_replace( $matches['youtu.be'][0][0], $this->tag_youtube( 'excerpt', $matches['youtu.be'][0][4], '
|
869 |
-
}
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
if (
|
875 |
-
$matches['metacafe.com'][0][0] = str_replace( $matches['metacafe.com'][0][0], $this->tag_metacafe( 'excerpt', $matches['metacafe.com'][0][4], '
|
876 |
-
}
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
if (
|
890 |
-
$matches['liveleak.com'][0][0] = str_replace( $matches['liveleak.com'][0][0], $this->
|
891 |
-
}
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
if (
|
897 |
-
$matches['facebook.com'][0][0] = str_replace( $matches['facebook.com'][0][0], $this->tag_facebook( 'excerpt', $matches['facebook.com'][0][4], '
|
898 |
-
}
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
$
|
905 |
-
|
906 |
-
$
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
$
|
931 |
-
$
|
932 |
-
$
|
933 |
-
$
|
934 |
-
$
|
935 |
-
$
|
936 |
-
$
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
$
|
943 |
-
$
|
944 |
-
$
|
945 |
-
|
946 |
-
$
|
947 |
-
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
$
|
992 |
-
} else
|
993 |
-
$ap = '
|
994 |
-
}
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
$
|
1001 |
-
} else
|
1002 |
-
$ap = '
|
1003 |
-
}
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
$
|
1011 |
-
}
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
$
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
EOT
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
$video_url = htmlspecialchars( "$root_url/
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
EOT
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
EOT
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
EOT
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
EOT
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
$url = 'http://www.youtube.com/
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
}
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
-
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
1124 |
-
}
|
1125 |
-
|
1126 |
-
$
|
1127 |
-
$
|
1128 |
-
$
|
1129 |
-
$
|
1130 |
-
|
1131 |
-
$
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
$
|
1138 |
-
} else
|
1139 |
-
$ap = '
|
1140 |
-
}
|
1141 |
-
|
1142 |
-
|
1143 |
-
|
1144 |
-
|
1145 |
-
|
1146 |
-
$
|
1147 |
-
} else
|
1148 |
-
$ap = '
|
1149 |
-
}
|
1150 |
-
|
1151 |
-
|
1152 |
-
|
1153 |
-
|
1154 |
-
$
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
EOT
|
1164 |
-
|
1165 |
-
|
1166 |
-
|
1167 |
-
|
1168 |
-
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
1172 |
-
|
1173 |
-
EOT
|
1174 |
-
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
1178 |
-
}
|
1179 |
-
|
1180 |
-
|
1181 |
-
|
1182 |
-
|
1183 |
-
|
1184 |
-
|
1185 |
-
|
1186 |
-
|
1187 |
-
|
1188 |
-
|
1189 |
-
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
|
1195 |
-
|
1196 |
-
|
1197 |
-
|
1198 |
-
}
|
1199 |
-
|
1200 |
-
$
|
1201 |
-
$
|
1202 |
-
$
|
1203 |
-
$
|
1204 |
-
$
|
1205 |
-
|
1206 |
-
$
|
1207 |
-
|
1208 |
-
$
|
1209 |
-
|
1210 |
-
|
1211 |
-
|
1212 |
-
$video_url .= "?autoplay=1";
|
1213 |
-
}
|
1214 |
-
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
|
1220 |
-
|
1221 |
-
|
1222 |
-
$video_url .= "?autoplay=1";
|
1223 |
-
}
|
1224 |
-
|
1225 |
-
|
1226 |
-
|
1227 |
-
|
1228 |
-
|
1229 |
-
|
1230 |
-
|
1231 |
-
|
1232 |
-
|
1233 |
-
|
1234 |
-
|
1235 |
-
|
1236 |
-
$
|
1237 |
-
|
1238 |
-
|
1239 |
-
|
1240 |
-
|
1241 |
-
|
1242 |
-
|
1243 |
-
EOT
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
1248 |
-
|
1249 |
-
|
1250 |
-
|
1251 |
-
$
|
1252 |
-
|
1253 |
-
|
1254 |
-
|
1255 |
-
EOT
|
1256 |
-
|
1257 |
-
|
1258 |
-
|
1259 |
-
|
1260 |
-
}
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
-
|
1265 |
-
|
1266 |
-
|
1267 |
-
|
1268 |
-
|
1269 |
-
|
1270 |
-
|
1271 |
-
|
1272 |
-
|
1273 |
-
|
1274 |
-
|
1275 |
-
|
1276 |
-
|
1277 |
-
|
1278 |
-
|
1279 |
-
|
1280 |
-
}
|
1281 |
-
|
1282 |
-
$
|
1283 |
-
$
|
1284 |
-
|
1285 |
-
$
|
1286 |
-
|
1287 |
-
|
1288 |
-
|
1289 |
-
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
-
|
1294 |
-
EOT
|
1295 |
-
|
1296 |
-
|
1297 |
-
|
1298 |
-
|
1299 |
-
|
1300 |
-
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
1304 |
-
EOT
|
1305 |
-
|
1306 |
-
|
1307 |
-
|
1308 |
-
|
1309 |
-
}
|
1310 |
-
|
1311 |
-
|
1312 |
-
|
1313 |
-
|
1314 |
-
|
1315 |
-
|
1316 |
-
|
1317 |
-
|
1318 |
-
|
1319 |
-
|
1320 |
-
|
1321 |
-
|
1322 |
-
|
1323 |
-
|
1324 |
-
|
1325 |
-
|
1326 |
-
|
1327 |
-
|
1328 |
-
|
1329 |
-
}
|
1330 |
-
|
1331 |
-
$
|
1332 |
-
$
|
1333 |
-
|
1334 |
-
$
|
1335 |
-
|
1336 |
-
|
1337 |
-
|
1338 |
-
|
1339 |
-
|
1340 |
-
|
1341 |
-
|
1342 |
-
|
1343 |
-
EOT
|
1344 |
-
|
1345 |
-
|
1346 |
-
|
1347 |
-
|
1348 |
-
|
1349 |
-
|
1350 |
-
|
1351 |
-
|
1352 |
-
|
1353 |
-
EOT
|
1354 |
-
|
1355 |
-
|
1356 |
-
|
1357 |
-
|
1358 |
-
|
1359 |
-
}
|
1360 |
-
|
1361 |
-
|
1362 |
-
|
1363 |
-
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
1367 |
-
|
1368 |
-
|
1369 |
-
|
1370 |
-
|
1371 |
-
|
1372 |
-
|
1373 |
-
|
1374 |
-
|
1375 |
-
'
|
1376 |
-
'
|
1377 |
-
'
|
1378 |
-
'
|
1379 |
-
'
|
1380 |
-
'
|
1381 |
-
'
|
1382 |
-
'
|
1383 |
-
'
|
1384 |
-
'
|
1385 |
-
'
|
1386 |
-
'
|
1387 |
-
'
|
1388 |
-
'
|
1389 |
-
'
|
1390 |
-
'
|
1391 |
-
'
|
1392 |
-
'
|
1393 |
-
'
|
1394 |
-
'
|
1395 |
-
'
|
1396 |
-
'
|
1397 |
-
'
|
1398 |
-
'
|
1399 |
-
'
|
1400 |
-
'
|
1401 |
-
'
|
1402 |
-
'
|
1403 |
-
'
|
1404 |
-
'
|
1405 |
-
'
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
1412 |
-
|
1413 |
-
|
1414 |
-
|
1415 |
-
|
1416 |
-
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
|
1421 |
-
|
1422 |
-
|
1423 |
-
|
1424 |
-
|
1425 |
-
|
1426 |
-
|
1427 |
-
|
1428 |
-
|
1429 |
-
|
1430 |
-
|
1431 |
-
|
1432 |
-
|
1433 |
-
$
|
1434 |
-
|
1435 |
-
$status
|
1436 |
-
|
1437 |
-
|
1438 |
-
|
1439 |
-
|
1440 |
-
|
1441 |
-
|
1442 |
-
$
|
1443 |
-
|
1444 |
-
|
1445 |
-
|
1446 |
-
|
1447 |
-
|
1448 |
-
|
1449 |
-
|
1450 |
-
|
1451 |
-
|
1452 |
-
$
|
1453 |
-
|
1454 |
-
|
1455 |
-
|
1456 |
-
|
1457 |
-
|
1458 |
-
|
1459 |
-
|
1460 |
-
|
1461 |
-
|
1462 |
-
|
1463 |
-
$
|
1464 |
-
$
|
1465 |
-
|
1466 |
-
|
1467 |
-
|
1468 |
-
|
1469 |
-
|
1470 |
-
$instance = $
|
1471 |
-
|
1472 |
-
$instance
|
1473 |
-
|
1474 |
-
|
1475 |
-
|
1476 |
-
|
1477 |
-
|
1478 |
-
|
1479 |
-
|
1480 |
-
|
1481 |
-
|
1482 |
-
<?php
|
1483 |
-
|
1484 |
-
|
1485 |
-
|
1486 |
-
|
1487 |
-
|
1488 |
-
|
1489 |
-
|
1490 |
-
|
1491 |
-
|
1492 |
-
|
1493 |
-
|
1494 |
-
|
1495 |
-
$content
|
1496 |
-
|
1497 |
-
preg_match_all( "/(http(v|vh|vhd)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?
|
1498 |
-
preg_match_all( "/(http(v|vh|vhd)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?
|
1499 |
-
preg_match_all( "/(http(v|vh|vhd)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?
|
1500 |
-
preg_match_all( "/(http(v|vh|vhd)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?
|
1501 |
-
|
1502 |
-
|
1503 |
-
|
1504 |
-
|
1505 |
-
|
1506 |
-
|
1507 |
-
if (
|
1508 |
-
$matches['youtube.com'][0][0] = str_replace( $matches['youtube.com'][0][0], $smart_youtube_pro->tag_youtube( 'excerpt', $matches['youtube.com'][0][5], '
|
1509 |
-
}
|
1510 |
-
|
1511 |
-
|
1512 |
-
|
1513 |
-
|
1514 |
-
if (
|
1515 |
-
$matches['youtu.be'][0][0] = str_replace( $matches['youtu.be'][0][0], $smart_youtube_pro->tag_youtube( 'excerpt', $matches['youtu.be'][0][4], '
|
1516 |
-
}
|
1517 |
-
|
1518 |
-
|
1519 |
-
|
1520 |
-
|
1521 |
-
if (
|
1522 |
-
$matches['metacafe.com'][0][0] = str_replace( $matches['metacafe.com'][0][0], $smart_youtube_pro->tag_metacafe( 'excerpt', $matches['metacafe.com'][0][4], '
|
1523 |
-
}
|
1524 |
-
|
1525 |
-
|
1526 |
-
|
1527 |
-
|
1528 |
-
|
1529 |
-
|
1530 |
-
|
1531 |
-
|
1532 |
-
|
1533 |
-
|
1534 |
-
|
1535 |
-
|
1536 |
-
if (
|
1537 |
-
$matches['liveleak.com'][0][0] = str_replace( $matches['liveleak.com'][0][0], $smart_youtube_pro->
|
1538 |
-
}
|
1539 |
-
|
1540 |
-
|
1541 |
-
|
1542 |
-
|
1543 |
-
if (
|
1544 |
-
$matches['facebook.com'][0][0] = str_replace( $matches['facebook.com'][0][0], $smart_youtube_pro->tag_facebook( 'excerpt', $matches['facebook.com'][0][4], '
|
1545 |
-
}
|
1546 |
-
|
1547 |
-
|
1548 |
-
$
|
1549 |
-
|
1550 |
-
|
1551 |
-
$
|
1552 |
-
|
1553 |
-
$
|
1554 |
-
|
1555 |
-
|
1556 |
-
|
1557 |
-
|
1558 |
-
|
1559 |
-
|
1560 |
-
|
1561 |
-
|
1562 |
-
|
1563 |
-
|
1564 |
-
|
1565 |
-
}
|
1566 |
-
?>
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Smart Youtube PRO
|
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: 4.1.9
|
8 |
+
Author URI: http://www.prelovac.com/vladimir/
|
9 |
+
|
10 |
+
|
11 |
+
To-Do:
|
12 |
+
|
13 |
+
- Is there a way to have smart youtube display multiple thumbnails of youtube videos in this fashion:
|
14 |
+
http://wordpress.org/extend/plugins/my-youtube-playlist/
|
15 |
+
|
16 |
+
The author of this plugin has done a good job in birthing the concept, but is unable to really do much by way of support or add features, e.g. highlight thumbnail currently playing, flexible grouping styles of thumbnails (horizontal, vertical listing) etc.
|
17 |
+
|
18 |
+
- Wondering if there's a way to have smartyoutube generate a thumbnail of the youtube video that shows up as one of the thumbnail options for the article when someone shares the blog post?
|
19 |
+
|
20 |
+
- Would it be possible to overwrite the global autoplay param in a post, something like httpv://www.youtube.com/watch?v=00000000&autoplay=true; I tried to add autoplay=1 but unfortunately in the resuling html it adds autoplay=0 (the global option) and also autoplay=1
|
21 |
+
The result is no autoplay :(
|
22 |
+
|
23 |
+
- Instead of editing the shortcut, we have copied from youtube.
|
24 |
+
I would love to have a button,
|
25 |
+
like insert Smart YouTube Video
|
26 |
+
A dialogue box would pop up,
|
27 |
+
and allow me to just simply paste the link.
|
28 |
+
Then having check boxes on the side,
|
29 |
+
which allow me to choose whether you would like HD or not.
|
30 |
+
thus editing the link correctly.
|
31 |
+
|
32 |
+
I find this would greatly help, especiall when I help create video blogs for community provider who have very little computer background.
|
33 |
+
|
34 |
+
- Please add support for it on the BuddyPress Acitivity page, currently it just shows the url (which won't work because of the httpv and httpvh)
|
35 |
+
|
36 |
+
- Was wondering if it was possible for you to have the plugin take the URL for the Youtube thumbnail for the video and place it into a user defined custom field. The plugin "YoutubeThumb2CustomField" but no longer works in WP 3.0 (network).
|
37 |
+
|
38 |
+
- love to see vimeo support! i have video intensive site...love Vimeo
|
39 |
+
|
40 |
+
Only issue is I would LOVE to add the widget into another sidebar and I do not see this possibility. Can you have multiple Smart YouTubes?
|
41 |
+
|
42 |
+
- 1. Adding few possibilities for posting videos into post � I have great production of videos but before end of 2009 all was in 320 x 240 and after end of 2009 I start publishing video in 640 x 480 resolution. I have adjusted player video for 640 x 480 but now 320 x 240 videos are stretched across all of player window.
|
43 |
+
|
44 |
+
For changes to be easy implemented � I suggest adding 2 or even 3 possibilities for playing videos � like this:
|
45 |
+
Your original code httpv://www.youtube.com/********************
|
46 |
+
Another version of httpv#1://www.youtube.com/********************
|
47 |
+
Another version of httpv#2://www.youtube.com/********************
|
48 |
+
Another version of httpv#3://www.youtube.com/********************
|
49 |
+
|
50 |
+
Adding #1 after v will allow us to predefine what will be size of player for #1 or number #2 or number #3 � I think it is good idea
|
51 |
+
|
52 |
+
If you don�t put #1, #2, #3 player will be those which is default (without number) � in my case that is 640 x 480.
|
53 |
+
|
54 |
+
2. If some video is for �personal use� which mean somebody must be log into you tube to see it, than I suggest making possibility for login for authors of those videos � If I put all my materials to be private (up to 25 people can see it) � than I cant publish them trough this way � and allowing authors to write theirs username and password will allow that those vides can be seen on my posts. That way I can protect all my archive of video on youtube, but allow those video can be visible on my blog � which can increase hits, visits and others possibility � that possibility is visible on this plug in http://tubepress.org/ where people can use its username and password for publishing all vides from if they have account on youtube
|
55 |
+
|
56 |
+
|
57 |
+
- marinas javascript suggestion for hq videos
|
58 |
+
- add editor button
|
59 |
+
- 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.
|
60 |
+
- localization
|
61 |
+
- the images appear under the embedded Smart Youtube videos. Is there any way to edit the z-index for Smart Youtube CSS? I
|
62 |
+
- would like to use multiple instances of the Smart YouTube plugin. I saw the reply that said to simply use multiple calls in one instance of the widget, but that doesn't let me choose different videos for different pages.
|
63 |
+
- was wondering if it's possible to get a vid and playlist in a custom page template?? Is it possible to add a preview image to search results?
|
64 |
+
- I wondered if there were a way to bring the video to the forefront layer (perhaps z-index)? I know this actually breaks good design practice in my intended use, but have a look here:
|
65 |
+
- However, on one page I have two videos and therefore I want to add a a parameter to the second video embed URL to _not_ start automatically. Something like httpv://www.youtube.com/watch?v=xyz123&autostart=off
|
66 |
+
- Single videos work well from wordpress on the Iphone/ipod. Is there a way to make the playlists work, just getting the ? cube instead of image.
|
67 |
+
- I would like to "inject" automatically this preview image url in a custom field, in each post, to auto-generate the thumb on my homepage with this image.
|
68 |
+
*/
|
69 |
+
|
70 |
+
|
71 |
+
|
72 |
+
if (isset($smart_youtube_pro)) return false;
|
73 |
+
|
74 |
+
$smart_youtube_pro = new SmartYouTube_PRO();
|
75 |
+
|
76 |
+
class SmartYouTube_PRO {
|
77 |
+
var $local_version;
|
78 |
+
var $plugin_url;
|
79 |
+
var $options;
|
80 |
+
var $key;
|
81 |
+
var $first;
|
82 |
+
var $first_post_on_archive;
|
83 |
+
|
84 |
+
function SmartYouTube() {
|
85 |
+
$this->__construct();
|
86 |
+
}
|
87 |
+
|
88 |
+
function __construct() {
|
89 |
+
$this->local_version = '1.0'; // TODO: Change this number???
|
90 |
+
|
91 |
+
$this->plugin_url = trailingslashit(plugins_url(null,__FILE__));
|
92 |
+
|
93 |
+
|
94 |
+
$this->key = 'smart_youtube_pro';
|
95 |
+
$this->first_post_on_archive = false;
|
96 |
+
|
97 |
+
$script_path = $this->plugin_url . '/javascripts/jquery.colorbox-min.js';
|
98 |
+
wp_register_script( 'colorbox', $script_path );
|
99 |
+
|
100 |
+
$this->options = $this->get_options();
|
101 |
+
|
102 |
+
$this->add_filters_and_hooks();
|
103 |
+
}
|
104 |
+
|
105 |
+
function add_filters_and_hooks() {
|
106 |
+
if ( $this->options['posts'] == 'on' ) {
|
107 |
+
add_filter( 'the_content', array( $this, 'check' ), 5 );
|
108 |
+
add_filter( 'the_excerpt', array( $this, 'check_excerpt' ), 5 );
|
109 |
+
}
|
110 |
+
|
111 |
+
if ( $this->options['comments'] == 'on' ) {
|
112 |
+
add_filter( 'comment_text', array( $this, 'check' ), 100 );
|
113 |
+
}
|
114 |
+
|
115 |
+
add_action( 'plugins_loaded', array( $this, 'install' ) );
|
116 |
+
add_action( 'admin_menu', array( $this, 'add_menu_items' ) );
|
117 |
+
add_action( 'admin_head', array( $this, 'plugin_header' ) );
|
118 |
+
add_action( 'wp_head', array( $this, 'post_header' ) );
|
119 |
+
add_action( 'wp_print_scripts', array( $this, 'load_scripts' ) );
|
120 |
+
add_action( 'wp_print_styles', array( $this, 'load_styles' ) );
|
121 |
+
add_action( 'template_redirect', array( $this, 'mark_first_post_on_archive' ) );
|
122 |
+
|
123 |
+
register_activation_hook(__FILE__, array($this, 'install' ) );
|
124 |
+
}
|
125 |
+
|
126 |
+
function post_header() {
|
127 |
+
global $wp_query;
|
128 |
+
$the_content = $wp_query->post->post_content;
|
129 |
+
$char_codes = array( '×', '–' );
|
130 |
+
$replacements = array( "x", "--" );
|
131 |
+
$the_content = str_replace( $char_codes, $replacements, $the_content );
|
132 |
+
|
133 |
+
preg_match_all( "/(http(v|vh|vhd)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?youtube\.com\/watch(\?v\=|\/v\/|#!v=)([a-zA-Z0-9\-\_]{11})([^<\s]*)/", $the_content, $matches, PREG_SET_ORDER );
|
134 |
+
|
135 |
+
if ( isset( $matches[0][5] ) )
|
136 |
+
if ( $matches[0][5] != '' )
|
137 |
+
echo '<meta property="og:image" content="http://i.ytimg.com/vi/' . $matches[0][5] . '/default.jpg" />';
|
138 |
+
|
139 |
+
if ( $this->options['colorbox'] == 'on' ) {
|
140 |
+
?>
|
141 |
+
<script>
|
142 |
+
jQuery(document).ready(function($){
|
143 |
+
$(".colorbox_video").colorbox({iframe:true, innerWidth:<?php echo $this->options['width']; ?>, innerHeight:<?php echo $this->options['height']; ?>});
|
144 |
+
});
|
145 |
+
</script>
|
146 |
+
<?php
|
147 |
+
}
|
148 |
+
}
|
149 |
+
|
150 |
+
function load_scripts() {
|
151 |
+
if ( $this->options["colorbox"] == 'on' ) {
|
152 |
+
wp_enqueue_script( 'jquery' );
|
153 |
+
wp_enqueue_script( 'colorbox' );
|
154 |
+
}
|
155 |
+
}
|
156 |
+
|
157 |
+
function load_styles() {
|
158 |
+
$style_path = $this->plugin_url . '/themes/theme' . $this->options['colorbox_theme'] . '/colorbox.css';
|
159 |
+
wp_register_style( 'colorbox', $style_path );
|
160 |
+
|
161 |
+
if ( $this->options["colorbox"] == 'on' ) {
|
162 |
+
wp_enqueue_style( 'colorbox' );
|
163 |
+
}
|
164 |
+
}
|
165 |
+
|
166 |
+
function plugin_header() {
|
167 |
+
if ( ! empty( $_REQUEST['page'] ) )
|
168 |
+
$page = $_REQUEST['page'];
|
169 |
+
else
|
170 |
+
$page = '';
|
171 |
+
?>
|
172 |
+
<style>
|
173 |
+
<?php if ( ( $page == 'syt_settings' ) || ( $page == 'syt_colorbox_options' ) || ( $page == 'syt_about' ) ) : ?>
|
174 |
+
#icon-syt_settings { background:transparent url('<?php echo $this->plugin_url .'i/logo.png';?>') no-repeat; }
|
175 |
+
<?php endif; ?>
|
176 |
+
</style>
|
177 |
+
<script>
|
178 |
+
<?php if ( $page == 'syt_settings' ) : ?>
|
179 |
+
jQuery(document).ready(function($){
|
180 |
+
if (($)('#disp_excerpt').val() == 'not')
|
181 |
+
($)('#disp_excerpt_align_div').hide();
|
182 |
+
else
|
183 |
+
($)('#disp_excerpt_align_div').show();
|
184 |
+
($)('#disp_excerpt').change(function(){
|
185 |
+
if (($)(this).val() == 'not')
|
186 |
+
($)('#disp_excerpt_align_div').hide();
|
187 |
+
else
|
188 |
+
($)('#disp_excerpt_align_div').show();
|
189 |
+
});
|
190 |
+
});
|
191 |
+
<?php endif; ?>
|
192 |
+
<?php if ( $page == 'syt_colorbox_options' ) : ?>
|
193 |
+
jQuery(document).ready(function($){
|
194 |
+
$("#colorbox_theme").change(function() {
|
195 |
+
var src = $("option:selected", this).val();
|
196 |
+
if ( src != "" ){
|
197 |
+
var $imgTag = "<img src=\"" + "<?php echo $this->plugin_url; echo '/screenshots/screenshot-'; ?>" + src + ".jpg\" />";
|
198 |
+
$("#screenshot_image").empty().html($imgTag).fadeIn();
|
199 |
+
}
|
200 |
+
});
|
201 |
+
});
|
202 |
+
<?php endif; ?>
|
203 |
+
</script>
|
204 |
+
<?php
|
205 |
+
}
|
206 |
+
|
207 |
+
function add_menu_items() {
|
208 |
+
$image = $this->plugin_url . '/i/icon.png';
|
209 |
+
add_menu_page( __( 'Smart Youtube', 'smart-youtube' ), __( 'Smart Youtube', 'smart-youtube' ), 'manage_options', 'syt_settings', array(
|
210 |
+
&$this,
|
211 |
+
'options_page'
|
212 |
+
), $image);
|
213 |
+
$page_settings = add_submenu_page( 'syt_settings', __( 'Smart Youtube', 'smart-youtube' ) . __( ' Settings', 'smart-youtube' ), __( 'Settings', 'smart-youtube' ), 'manage_options', 'syt_settings', array(
|
214 |
+
&$this,
|
215 |
+
'options_page'
|
216 |
+
) );
|
217 |
+
$page_colorbox = add_submenu_page( 'syt_settings', __( 'Smart Youtube', 'smart-youtube' ) . __( ' Colorbox Options', 'smart-youtube' ), __( 'Colorbox Options', 'smart-youtube' ), 'manage_options', 'syt_colorbox_options', array(
|
218 |
+
&$this,
|
219 |
+
'handle_colorbox_options'
|
220 |
+
) );
|
221 |
+
$page_about = add_submenu_page( 'syt_settings', __( 'Smart Youtube', 'smart-youtube' ) . __( ' About', 'smart-youtube' ), __( 'About', 'smart-youtube' ), 'manage_options', 'syt_about', array(
|
222 |
+
&$this,
|
223 |
+
'handle_about'
|
224 |
+
) );
|
225 |
+
}
|
226 |
+
|
227 |
+
function options_page() {
|
228 |
+
// If form was submitted
|
229 |
+
if ( isset( $_POST['submitted'] ) ) {
|
230 |
+
check_admin_referer( 'smart-youtube' );
|
231 |
+
|
232 |
+
$this->options['img'] = ! isset( $_POST['disp_img'] ) ? 'off' : 'on';
|
233 |
+
$this->options['link'] = ! isset( $_POST['disp_link'] ) ? 'off' : 'on';
|
234 |
+
$this->options['valid'] = ! isset( $_POST['valid'] ) ? 'off' : 'on';
|
235 |
+
$this->options['search'] = ! isset( $_POST['disp_search'] ) ? 'off' : 'on';
|
236 |
+
$this->options['ann'] = ! isset( $_POST['disp_ann'] ) ? 'off' : 'on';
|
237 |
+
|
238 |
+
$this->options['info'] = ! isset( $_POST['disp_info'] ) ? 'off' : 'on';
|
239 |
+
|
240 |
+
$this->options['width'] = ! isset( $_POST['disp_width'] ) ? 425 : intval( $_POST['disp_width'] );
|
241 |
+
$this->options['height'] = ! isset( $_POST['disp_height'] ) ? 344 : intval( $_POST['disp_height'] );
|
242 |
+
|
243 |
+
$this->options['widthhq'] = ! isset( $_POST['disp_widthhq'] ) ? 480 : intval( $_POST['disp_widthhq'] );
|
244 |
+
$this->options['heighthq'] = ! isset( $_POST['disp_heighthq'] ) ? 295 : intval( $_POST['disp_heighthq'] );
|
245 |
+
|
246 |
+
$this->options['widthside'] = ! isset( $_POST['disp_widthside'] ) ? 150 : intval( $_POST['disp_widthside'] );
|
247 |
+
$this->options['heightside'] = ! isset( $_POST['disp_heightside'] ) ? 125 : intval( $_POST['disp_heightside'] );
|
248 |
+
|
249 |
+
$this->options['rel'] = ! isset( $_POST['embedRel'] ) ? 1 : $_POST['embedRel'];
|
250 |
+
$this->options['autoplay'] = ! isset( $_POST['autoplay'] ) ? 0 : 1;
|
251 |
+
$this->options['autoplay_first'] = ! isset( $_POST['autoplay_first'] ) ? 0 : 1;
|
252 |
+
$this->options['privacy'] = ! isset( $_POST['disp_privacy'] ) ? 0 : 1;
|
253 |
+
|
254 |
+
$this->options['posts'] = ! isset( $_POST['disp_posts'] ) ? 'off' : 'on';
|
255 |
+
$this->options['comments'] = ! isset( $_POST['disp_comments'] ) ? 'off' : 'on';
|
256 |
+
$this->options['iframe'] = ! isset( $_POST['iframe'] ) ? 'off' : 'on';
|
257 |
+
$this->options['www'] = ! isset( $_POST['www'] ) ? 'off' : 'on';
|
258 |
+
$this->options['http'] = ! isset( $_POST['http'] ) ? 'off' : 'on';
|
259 |
+
|
260 |
+
$this->options['template'] = ! isset( $_POST['disp_template'] ) ? '{video}' : stripslashes( htmlspecialchars( $_POST['disp_template'] ) );
|
261 |
+
$this->options['tag'] = ! isset( $_POST['tag'] ) ? '' : $_POST['tag'];
|
262 |
+
$this->options['wiziapp'] = ! isset( $_POST['wiziapp'] ) ? 'off' : 'on';
|
263 |
+
$this->options['loop'] = ! isset( $_POST['loop'] ) ? 0 : 1;
|
264 |
+
$this->options['thumb'] = ! isset( $_POST['thumb'] ) ? 'off' : 'on';
|
265 |
+
$this->options['colorbox'] = ! isset( $_POST['colorbox'] ) ? 'off' : 'on';
|
266 |
+
$this->options['excerpt'] = ! isset( $_POST['excerpt'] ) ? '' : $_POST['excerpt'];
|
267 |
+
$this->options['excerpt_align'] = ! isset( $_POST['excerpt_align'] ) ? '' : $_POST['excerpt_align'];
|
268 |
+
$this->options['logoless'] = ! isset( $_POST['logoless'] ) ? 'off' : 'on';
|
269 |
+
$this->options['theme'] = ! isset( $_POST['theme'] ) ? '' : $_POST['theme'];
|
270 |
+
|
271 |
+
update_option( $this->key, $this->options );
|
272 |
+
|
273 |
+
// Show message
|
274 |
+
echo '<div id="message" class="updated fade"><p>' . __( 'Smart Youtube options saved.', 'smart-youtube' ) . '</p></div>';
|
275 |
+
}
|
276 |
+
|
277 |
+
$disp_img = $this->options['img'] == 'on' ? 'checked="checked"' : '';
|
278 |
+
$disp_link = $this->options['link'] == 'on' ? 'checked="checked"' : '';
|
279 |
+
$disp_search = $this->options['search'] == 'on' ? 'checked="checked"' : '';
|
280 |
+
$disp_ann = $this->options['ann'] == 'on' ? 'checked="checked"' : '';
|
281 |
+
$disp_info = $this->options['info'] == 'on' ? 'checked="checked"' : '';
|
282 |
+
|
283 |
+
$valid = $this->options['valid'] == 'on' ? 'checked="checked"' : '';
|
284 |
+
|
285 |
+
$disp_width = $this->options['width'];
|
286 |
+
$disp_height = $this->options['height'];
|
287 |
+
|
288 |
+
$disp_widthhq = $this->options['widthhq'];
|
289 |
+
$disp_heighthq = $this->options['heighthq'];
|
290 |
+
|
291 |
+
$disp_widthside = $this->options['widthside'];
|
292 |
+
$disp_heightside = $this->options['heightside'];
|
293 |
+
|
294 |
+
$disp_autoplay = $this->options['autoplay'] ? 'checked="checked"' : '';
|
295 |
+
$disp_autoplay_first = $this->options['autoplay_first'] ? 'checked="checked"' : '';
|
296 |
+
$disp_rel = $this->options['rel'] ? 'checked="checked"' : '';
|
297 |
+
$disp_rel2 = $this->options['rel'] ? '' : 'checked="checked"';
|
298 |
+
$disp_posts = $this->options['posts'] == 'on' ? 'checked="checked"' : '' ;
|
299 |
+
$disp_comments = $this->options['comments'] == 'on' ? 'checked="checked"' : '';
|
300 |
+
|
301 |
+
$disp_privacy = $this->options['privacy'] ? 'checked="checked"' : '';
|
302 |
+
$iframe = $this->options['iframe'] =='on' ? 'checked="checked"' : '';
|
303 |
+
$www = $this->options['www'] =='on' ? 'checked="checked"' : '';
|
304 |
+
$http = $this->options['http'] =='on' ? 'checked="checked"' : '';
|
305 |
+
$disp_loop = $this->options['loop'] ? 'checked="checked"' : '';
|
306 |
+
$thumb = $this->options['thumb'] == 'on' ? 'checked="checked"' : '';
|
307 |
+
$colorbox = $this->options['colorbox'] == 'on' ? 'checked="checked"' : '';
|
308 |
+
$excerpt = isset( $this->options['excerpt'] ) ? $this->options['excerpt'] : 'not';
|
309 |
+
$excerpt_align = isset( $this->options['excerpt_align'] ) ? $this->options['excerpt_align'] : 'left';
|
310 |
+
|
311 |
+
$disp_template = esc_html( $this->options['template'] );
|
312 |
+
$tag = $this->options['tag'];
|
313 |
+
$wiziapp = $this->options['wiziapp'] == 'on' ? 'checked="checked"' : '';
|
314 |
+
$logoless = $this->options['logoless'] == 'on' ? 'checked="checked"' : '';
|
315 |
+
$theme = isset( $this->options['theme'] ) ? $this->options['theme'] : '';
|
316 |
+
|
317 |
+
if ( ! $disp_width ) {
|
318 |
+
$disp_width = 425;
|
319 |
+
}
|
320 |
+
|
321 |
+
if ( ! $disp_height ) {
|
322 |
+
$disp_height = 344;
|
323 |
+
}
|
324 |
+
|
325 |
+
global $wp_version;
|
326 |
+
|
327 |
+
$embed_img = $this->plugin_url . '/img/embed_selection-vfl29294.png';
|
328 |
+
|
329 |
+
echo '<script src="' . $this->plugin_url . '/yt.js" type="text/javascript"></script>
|
330 |
+
<link rel="stylesheet" type="text/css" href="' . $this->plugin_url . '/styleyt.css" />';
|
331 |
+
|
332 |
+
$imgpath = $this->plugin_url.'/i';
|
333 |
+
$actionurl = stripslashes(htmlentities(strip_tags($_SERVER['REQUEST_URI'])));
|
334 |
+
$nonce = wp_create_nonce( 'smart-youtube' );
|
335 |
+
$example = htmlentities( '<div style="float:left;margin-right: 10px;">{video}</div>' );
|
336 |
+
|
337 |
+
// Configuration Page
|
338 |
+
|
339 |
+
?>
|
340 |
+
<div class="wrap smartyoutube" >
|
341 |
+
<?php screen_icon(); ?>
|
342 |
+
<h2><?php _e( 'Smart YouTube PRO', 'smart-youtube' ); ?></h2>
|
343 |
+
<a href="admin.php?page=syt_settings"><?php _e( 'Settings', 'smart-youtube' ); ?></a> | <a href="admin.php?page=syt_colorbox_options"><?php _e( 'Colorbox Options', 'smart-youtube' ); ?></a> | <a href="admin.php?page=syt_about"><?php _e( 'About', 'smart-youtube' ); ?></a>
|
344 |
+
<div id="poststuff" style="margin-top:10px;">
|
345 |
+
<div id="sideblock" style="float:right;width:270px;margin-left:10px;">
|
346 |
+
<iframe width=270 height=800 frameborder="0" src="http://www.prelovac.com/plugin/news.php?id=0&utm_source=plugin&utm_medium=plugin&utm_campaign=Smart%2BYoutube"></iframe>
|
347 |
+
</div>
|
348 |
+
<div id="mainblock" style="width:710px">
|
349 |
+
<div class="dbx-content">
|
350 |
+
<h2 id="usageHeader"><?php _e( 'Usage <span style="font-size:small">[<a href="#">view instructions</a>]</span>', 'smart-youtube' ); ?></h2>
|
351 |
+
<div id="usage" style="display:none">
|
352 |
+
<p><?php _e( 'To use the video in your posts, paste YouTube video URL with <strong>httpv://</strong> (notice the \'v\').', 'smart-youtube' ); ?> </p>
|
353 |
+
<p><?php _e( '<strong>Important:</strong> The URL should just be copied into your post normally and the letter \'v\' added, do not create a clickable link!', 'smart-youtube' ); ?></p>
|
354 |
+
<p><?php _e( 'Example: httpv://www.youtube.com/watch?v=OWfksMD4PAg', 'smart-youtube' ); ?></p>
|
355 |
+
<p><?php _e( 'If you want to embed High/HD Quality video use <strong>httpvh://</strong> instead (Video High Defintion).', 'smart-youtube' ); ?></p>
|
356 |
+
<p><?php _e( 'Vimeo Example: httpv://vimeo.com/27287078', 'smart-youtube' ); ?></p>
|
357 |
+
<p><?php _e( 'Metacafe Example: httpvh://vww.metacafe.com/watch/7815470/harry_potter_and_the_deathly_hallows_dvd_interview/', 'smart-youtube' ); ?></p>
|
358 |
+
<p><?php _e( 'Live Leak Example: httpv://www.liveleak.com/view?i=cad_1322822486', 'smart-youtube' ); ?></p>
|
359 |
+
<p><?php _e( 'To embed playlists use httpvp:// (eg. httpvp://www.youtube.com/playlist?list=PL050E43A49BC5E5E5)', 'smart-youtube' ); ?></p>
|
360 |
+
<p><?php _e( 'Smart Youtube also supports migrated blogs from Wordpress.com using [youtube=youtubeadresss]', 'smart-youtube' ); ?></p>
|
361 |
+
<ul>
|
362 |
+
<li><?php _e( 'httpv:// - regular video', 'smart-youtube' ); ?></li>
|
363 |
+
<li><?php _e( 'httpvh:// - high/HD quality', 'smart-youtube' ); ?></li>
|
364 |
+
<li><?php _e( 'httpvp:// - playlist', 'smart-youtube' ); ?></li>
|
365 |
+
<li><?php _e( 'httpvhp:// - HD playlist', 'smart-youtube' ); ?></li>
|
366 |
+
<li><?php _e( '[youtube=youtubeadresss] - supported for blogs migrated from wordpress.com', 'smart-youtube' ); ?></li>
|
367 |
+
</ul>
|
368 |
+
</div>
|
369 |
+
<form name="yteform" action="<?php echo $actionurl; ?>" method="post">
|
370 |
+
<input type="hidden" name="submitted" value="1" />
|
371 |
+
<input type="hidden" id="_wpnonce" name="_wpnonce" value="<?php echo $nonce; ?>" />
|
372 |
+
<h2><?php _e( 'Options', 'smart-youtube' ); ?></h2>
|
373 |
+
<p><?php _e( 'Smart Youtube is powerful and free WordPress plugin for embeding videos into your blog. ', 'smart-youtube' ); ?></p>
|
374 |
+
|
375 |
+
<p><?php _e( 'From the same author: <a href="http://managewp.com" target="_blank">ManageWP.com</a> - Wordpress service that helps you manage all your WordPress sites from one location.', 'smart-youtube' ); ?></p>
|
376 |
+
<p><?php _e( 'You can adjust the way your embeded youtube videos behave in the options below.', 'smart-youtube' ); ?></p>
|
377 |
+
<h3><?php _e( 'Video settings', 'smart-youtube' ); ?></h3>
|
378 |
+
<div>
|
379 |
+
<input id="check3" type="checkbox" name="disp_posts" <?php echo $disp_posts; ?> />
|
380 |
+
<label for="check3"><?php _e( 'Display videos in posts', 'smart-youtube' ); ?></label>
|
381 |
+
</div>
|
382 |
+
<div>
|
383 |
+
<input id="check4" type="checkbox" name="disp_comments" <?php echo $disp_comments; ?> />
|
384 |
+
<label for="check4"><?php _e( 'Display videos in comments', 'smart-youtube' ); ?></label>
|
385 |
+
</div>
|
386 |
+
<br />
|
387 |
+
<div>
|
388 |
+
<input id="iframe" type="checkbox" name="iframe" <?php echo $iframe; ?> />
|
389 |
+
<label for="iframe"><?php _e( 'Use IFRAME embed code', 'smart-youtube' ); ?></label> [<a target="_blank" href="http://apiblog.youtube.com/2010/07/new-way-to-embed-youtube-videos.html">?</a>]
|
390 |
+
</div>
|
391 |
+
<h3><?php _e( 'Video Appearence', 'smart-youtube' ); ?></h3>
|
392 |
+
<p class="instruct">
|
393 |
+
<?php _e( 'Video template. Default is just {video}.', 'smart-youtube' ); ?><br />
|
394 |
+
<?php echo __( 'You can try <code>', 'smart-youtube' ) . $example . __( '</code> if you want the text to wrap around video.', 'smart-youtube' ); ?>
|
395 |
+
</p>
|
396 |
+
<textarea cols="50" id="disp_template" name="disp_template"><?php echo $disp_template; ?></textarea>
|
397 |
+
<br />
|
398 |
+
<input id="http" type="checkbox" name="http" <?php echo $http; ?> />
|
399 |
+
<label for="http"><?php _e( 'Parse links with http:// prefix same as httpv://', 'smart-youtube' ); ?></label>
|
400 |
+
<br />
|
401 |
+
<input id="www" type="checkbox" name="www" <?php echo $www; ?> />
|
402 |
+
<label for="www"><?php _e( 'Parse links without http:// prefix', 'smart-youtube' ); ?></label>
|
403 |
+
<p class="instruct"><?php _e( 'Video width and height in normal mode (httpv://). Default is 425x344.', 'smart-youtube' ); ?></p>
|
404 |
+
<div id="inputSizeNormal">
|
405 |
+
<input class="width" name="disp_width" value="<?php echo $disp_width; ?>" size="7"/>x<input class="height" name="disp_height" value="<?php echo $disp_height; ?>" size="7" />
|
406 |
+
</div>
|
407 |
+
<div class="size-chooser" forDiv="inputSizeNormal">
|
408 |
+
<a v-width="320" v-height="265" href="#">
|
409 |
+
<span></span>
|
410 |
+
<div class="outer">
|
411 |
+
<div></div>
|
412 |
+
</div>
|
413 |
+
</a>
|
414 |
+
<a v-width="425" v-height="344" href="#">
|
415 |
+
<span></span>
|
416 |
+
<div class="outer">
|
417 |
+
<div></div>
|
418 |
+
</div>
|
419 |
+
</a>
|
420 |
+
<a v-width="480" v-height="385" href="#">
|
421 |
+
<span></span>
|
422 |
+
<div class="outer">
|
423 |
+
<div></div>
|
424 |
+
</div>
|
425 |
+
</a>
|
426 |
+
<a v-width="640" v-height="505" href="#">
|
427 |
+
<span></span>
|
428 |
+
<div class="outer">
|
429 |
+
<div></div>
|
430 |
+
</div>
|
431 |
+
</a>
|
432 |
+
<a v-width="960" v-height="745" href="#">
|
433 |
+
<span></span>
|
434 |
+
<div class="outer">
|
435 |
+
<div></div>
|
436 |
+
</div>
|
437 |
+
</a>
|
438 |
+
<br clear="both" />
|
439 |
+
</div>
|
440 |
+
<p class="instruct"><?php _e( 'Video width and height in <strong>high quality</strong> mode (httpvh://). Default is 480x295.', 'smart-youtube' ); ?></p>
|
441 |
+
<div id="inputSizeHQ">
|
442 |
+
<input class="width" name="disp_widthhq" value="<?php echo $disp_widthhq; ?>" size="7" />x<input class="height" name="disp_heighthq" value="<?php echo $disp_heighthq; ?>" size="7" />
|
443 |
+
</div>
|
444 |
+
<div class="size-chooser" forDiv="inputSizeHQ">
|
445 |
+
<a v-width="480" v-height="295" href="#">
|
446 |
+
<span></span>
|
447 |
+
<div class="outer">
|
448 |
+
<div></div>
|
449 |
+
</div>
|
450 |
+
</a>
|
451 |
+
<a v-width="560" v-height="340" href="#">
|
452 |
+
<span></span>
|
453 |
+
<div class="outer">
|
454 |
+
<div></div>
|
455 |
+
</div>
|
456 |
+
</a>
|
457 |
+
<a v-width="640" v-height="385" href="#">
|
458 |
+
<span></span>
|
459 |
+
<div class="outer">
|
460 |
+
<div></div>
|
461 |
+
</div>
|
462 |
+
</a>
|
463 |
+
<a v-width="853" v-height="505" href="#">
|
464 |
+
<span></span>
|
465 |
+
<div class="outer">
|
466 |
+
<div></div>
|
467 |
+
</div>
|
468 |
+
</a>
|
469 |
+
<a v-width="1280" v-height="745" href="#">
|
470 |
+
<span></span>
|
471 |
+
<div class="outer">
|
472 |
+
<div></div>
|
473 |
+
</div>
|
474 |
+
</a>
|
475 |
+
<br clear="both" />
|
476 |
+
</div>
|
477 |
+
<p class="instruct"><?php _e( 'Video width and height in <strong>sidebar</strong> mode (regardless of quality). Default is 150x125.', 'smart-youtube' ); ?></p>
|
478 |
+
<input id="disp_widthside" name="disp_widthside" value="<?php echo $disp_widthside; ?>" size="7" />x<input id="disp_heightside" name="disp_heightside" value="<?php echo $disp_heightside; ?>" size="7" /><br /><br />
|
479 |
+
<div id="watch-customize-embed-form">
|
480 |
+
<input type="radio" <?php echo $disp_rel; ?> id="embedCustomization1" name="embedRel" value="1"/>
|
481 |
+
<label for="embedCustomization1"><?php _e( 'Include related videos', 'smart-youtube' ); ?></label>
|
482 |
+
<br/>
|
483 |
+
<input type="radio" <?php echo $disp_rel2; ?> id="embedCustomization0" name="embedRel" value="0"/>
|
484 |
+
<label for="embedCustomization0"><?php _e( 'Do not include related videos', 'smart-youtube' ); ?></label>
|
485 |
+
<br/>
|
486 |
+
</div>
|
487 |
+
<br/>
|
488 |
+
<div style="margin: 0 0 0 4px; clear: both;">
|
489 |
+
<input type="checkbox" id="autoplay_checkbox" name="autoplay" <?php echo $disp_autoplay; ?> /><label for="autoplay_checkbox"><?php _e( 'Autoplay videos', 'smart-youtube' ); ?></label><br />
|
490 |
+
<input type="checkbox" id="autoplay_first_checkbox" name="autoplay_first" <?php echo $disp_autoplay_first; ?> /><label for="autoplay_first_checkbox"><?php _e( 'Autoplay only first video on page', 'smart-youtube' ); ?></label><br />
|
491 |
+
<input type="checkbox" id="loop_checkbox" name="loop" <?php echo $disp_loop; ?> /><label for="loop_checkbox"><?php _e( 'Loop videos', 'smart-youtube' ); ?></label><br />
|
492 |
+
<input type="checkbox" id="disp_search" name="disp_search" <?php echo $disp_search; ?> /><label for="disp_search"><?php _e( 'Display search box', 'smart-youtube' ); ?></label><br />
|
493 |
+
<input type="checkbox" id="thumb_checkbox" name="thumb" <?php echo $thumb; ?> /><label for="thumb_checkbox"><?php _e( 'Display thumbnails on home/archive pages', 'smart-youtube' ); ?></label><br />
|
494 |
+
<input type="checkbox" id="cbox_checkbox" name="colorbox" <?php echo $colorbox; ?> /><label for="cbox_checkbox"><?php _e( 'Show video in colorbox', 'smart-youtube' ); ?></label><br />
|
495 |
+
<input type="checkbox" id="disp_info" name="disp_info" <?php echo $disp_info; ?> /><label for="disp_info"><?php _e( 'Remove Titles & Ratings', 'smart-youtube' ); ?></label><br />
|
496 |
+
<input type="checkbox" id="disp_ann" name="disp_ann" <?php echo $disp_ann; ?> /><label for="disp_ann"><?php _e( 'Remove Annotations', 'smart-youtube' ); ?></label><br />
|
497 |
+
<input type="checkbox" id="logoless" name="logoless" <?php echo $logoless; ?> /><label for="logoless"><?php _e( 'Hide YouTube Logo', 'smart-youtube' ); ?></label><br />
|
498 |
+
<label for="theme"><?php _e( 'Theme (YouTube only):', 'smart-youtube' ); ?></label>
|
499 |
+
<select id="theme" name="theme" />
|
500 |
+
<option value="dark" <?php echo ( ( $theme == 'dark' ) ? 'selected="yes"' : '' ); ?>><?php _e( 'Dark', 'smart-youtube' ); ?></option>
|
501 |
+
<option value="light" <?php echo ( ( $theme == 'light' ) ? 'selected="yes"' : '' ); ?>><?php _e( 'Light', 'smart-youtube' ); ?></option>
|
502 |
+
</select><br />
|
503 |
+
<input type="checkbox" id="privacy" name="disp_privacy" <?php echo $disp_privacy; ?> /><label for="privacy"><?php _e( 'Enable privacy-enhanced mode', 'smart-youtube' ); ?> [<a target="_blank" href="http://www.google.com/support/youtube/bin/answer.py?answer=141046">?</a>] <?php _e( 'videos may not work for Iphone users)', 'smart-youtube' ); ?></label><br />
|
504 |
+
<div id="disp_excerpt_div">
|
505 |
+
<label for="disp_excerpt"><?php _e( 'Show embeds in post excerpts as', 'smart-youtube' ); ?></label>
|
506 |
+
<select id="disp_excerpt" name="excerpt">
|
507 |
+
<option value="vid" <?php echo ( ( $excerpt == 'vid' ) ? 'selected="yes"' : '' ); ?>><?php _e( 'Video', 'smart-youtube' ); ?></option>
|
508 |
+
<option value="thm" <?php echo ( ( $excerpt == 'thm' ) ? 'selected="yes"' : '' ); ?>><?php _e( 'Thumbnail', 'smart-youtube' ); ?></option>
|
509 |
+
<option value="not" <?php echo ( ( $excerpt == 'not' ) ? 'selected="yes"' : '' ); ?>><?php _e( 'Nothing', 'smart-youtube' ); ?></option>
|
510 |
+
</select>
|
511 |
+
</div>
|
512 |
+
<div id="disp_excerpt_align_div">
|
513 |
+
<label for="disp_excerpt_align"><?php _e( 'Align embeds in post excerpts to', 'smart-youtube' ); ?></label>
|
514 |
+
<select id="disp_excerpt_align" name="excerpt_align">
|
515 |
+
<option value="left" <?php echo ( ( $excerpt_align == 'left' ) ? 'selected="yes"' : '' ); ?>><?php _e( 'Left', 'smart-youtube' ); ?></option>
|
516 |
+
<option value="right" <?php echo ( ( $excerpt_align == 'right' ) ? 'selected="yes"' : '' ); ?>><?php _e( 'Right', 'smart-youtube' ); ?></option>
|
517 |
+
</select>
|
518 |
+
</div>
|
519 |
+
</div>
|
520 |
+
<h3><?php _e( 'Custom code compatibility', 'smart-youtube' ); ?></h3>
|
521 |
+
<p><?php _e( 'Use this option if you have used another youtube plugin and switched over to Smart Youtube.', 'smart-youtube' ); ?><p>
|
522 |
+
<p><?php _e( 'For example if you used [yt]qYWWBwf2wHE[/yt] type of code, you would type yt in the box below.', 'smart-youtube' ); ?></p>
|
523 |
+
<input id="tag" type="text" name="tag" value="<?php echo $tag; ?>" />
|
524 |
+
<label for="tag"><?php _e( 'Custom code', 'smart-youtube' ); ?></label>
|
525 |
+
|
526 |
+
<h3><?php _e( 'WiziApp support', 'smart-youtube' ); ?></h3>
|
527 |
+
<p><?php _e( 'This will integrate your video seamlessly with WiziApp', 'smart-youtube' ); ?></p>
|
528 |
+
<input id="wiziapp" type="checkbox" name="wiziapp" <?php echo $wiziapp; ?> />
|
529 |
+
<label for="wiziapp"><?php _e( 'Enable WiziApp support', 'smart-youtube' ); ?></label>
|
530 |
+
<h3><?php _e( 'xHTML validation', 'smart-youtube' ); ?></h3>
|
531 |
+
<p class="instruct"><?php _e( 'Enabling the option below will change default YouTube code to be xHTML valid. (videos may not work for Iphone users)', 'smart-youtube' ); ?></p>
|
532 |
+
<input id="valid" type="checkbox" name="valid" <?php echo $valid; ?> />
|
533 |
+
<label for="valid"><?php _e( 'Enable xHTML Validation', 'smart-youtube' ); ?></label>
|
534 |
+
<h3><?php _e( 'RSS feed options', 'smart-youtube' ); ?></h3>
|
535 |
+
<p class="instruct"><?php _e( '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.', 'smart-youtube' ); ?></p>
|
536 |
+
<p class="instruct"><?php _e( '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.', 'smart-youtube' ); ?></p>
|
537 |
+
<input id="check2" type="checkbox" name="disp_link" <?php echo $disp_link; ?> />
|
538 |
+
<label for="check2"><?php _e( 'Display video link in RSS feed', 'smart-youtube' ); ?></label><br />
|
539 |
+
<input id="check1" type="checkbox" name="disp_img" <?php echo $disp_img; ?> />
|
540 |
+
<label for="check1"><?php _e( 'Display video preview image in RSS feed', 'smart-youtube' ); ?></label>
|
541 |
+
<div class="submit"><input type="submit" name="Submit" value="<?php _e( 'Update options', 'smart-youtube' ); ?>" /></div>
|
542 |
+
</form>
|
543 |
+
</div>
|
544 |
+
</div>
|
545 |
+
</div>
|
546 |
+
</div>
|
547 |
+
<h5 class="author"><?php _e( 'Another fine WordPress plugin by <a href="http://www.prelovac.com/vladimir/">Vladimir Prelovac', 'smart-youtube' ); ?></a></h5>
|
548 |
+
<?php
|
549 |
+
}
|
550 |
+
|
551 |
+
function handle_colorbox_options() {
|
552 |
+
if ( isset( $_POST['submitted'] ) ) {
|
553 |
+
$this->options['colorbox_theme'] = ( ! isset( $_POST['colorbox_theme'] ) ? '1' : $_POST['colorbox_theme'] );
|
554 |
+
|
555 |
+
update_option( $this->key, $this->options );
|
556 |
+
|
557 |
+
$msg_status = __( 'SEO Friendly Images PRO colorbox options saved.', 'smart-youtube' );
|
558 |
+
|
559 |
+
// Show message
|
560 |
+
echo '<div id="message" class="updated fade"><p>' . $msg_status . '</p></div>';
|
561 |
+
}
|
562 |
+
|
563 |
+
$imgpath = $this->plugin_url . '/i';
|
564 |
+
$actionurl = stripslashes(htmlentities(strip_tags($_SERVER['REQUEST_URI'])));
|
565 |
+
|
566 |
+
$this->options = $this->get_options();
|
567 |
+
?>
|
568 |
+
<div class="wrap">
|
569 |
+
<?php screen_icon(); ?>
|
570 |
+
<h2><?php _e( 'Smart YouTube PRO', 'smart-youtube' ); echo ' ' . $this->local_version; ?></h2>
|
571 |
+
<a href="admin.php?page=syt_settings"><?php _e( 'Settings', 'smart-youtube' ); ?></a> | <a href="admin.php?page=syt_colorbox_options"><?php _e( 'Colorbox Options', 'smart-youtube' ); ?></a> | <a href="admin.php?page=syt_about"><?php _e( 'About', 'smart-youtube' ); ?></a>
|
572 |
+
<div id="poststuff" style="margin-top:10px;">
|
573 |
+
<div id="sideblock" style="float:right;width:270px;margin-left:10px;">
|
574 |
+
<iframe width=270 height=800 frameborder="0" src="http://www.prelovac.com/plugin/news.php?id=2&utm_source=plugin&utm_medium=plugin&utm_campaign=SEO%2BFriendly%2BImages%2BPRO"></iframe>
|
575 |
+
</div>
|
576 |
+
</div>
|
577 |
+
<div id="mainblock" class="submit">
|
578 |
+
<div class="dbx-content">
|
579 |
+
<h2><?php _e( 'Colorbox Options', 'smart-youtube' ); ?></h2>
|
580 |
+
<br />
|
581 |
+
<form name="sytform" action="<?php echo $actionurl; ?>" method="post">
|
582 |
+
<input type="hidden" name="submitted" value="1" />
|
583 |
+
<div>
|
584 |
+
<label for="colorbox_theme"><?php _e( 'Choose ColorBox theme:', 'smart-youtube' ); ?></label>
|
585 |
+
<select id="colorbox_theme" name="colorbox_theme">
|
586 |
+
<?php for($i = 1; $i <= 11; $i++): ?>
|
587 |
+
<option value="<?php echo $i; ?>" <?php echo ( $this->options['colorbox_theme'] == $i ) ? 'selected="yes"' : ''; ?>><?php echo __( 'Theme ', 'smart-youtube' ) . $i; ?></option>
|
588 |
+
<?php endfor; ?>
|
589 |
+
</select>
|
590 |
+
</div>
|
591 |
+
<div>
|
592 |
+
<label for="screenshot_image"><?php _e( 'Theme screenshot:', 'smart-youtube' ); ?></label>
|
593 |
+
<div id="screenshot_image">
|
594 |
+
<img src="<?php echo $this->plugin_url . '/screenshots/screenshot-' . $this->options['colorbox_theme'] . '.jpg'; ?>" />
|
595 |
+
</div>
|
596 |
+
</div>
|
597 |
+
<div style="padding: 1.5em 0;margin: 5px 0;">
|
598 |
+
<input type="submit" name="Submit" value="<?php _e( 'Update options', 'smart-youtube' ); ?>" />
|
599 |
+
</div>
|
600 |
+
</form>
|
601 |
+
</div>
|
602 |
+
</div>
|
603 |
+
<h5><?php _e( 'Another fine WordPress plugin by', 'smart-youtube' ); ?> <a href="http://www.prelovac.com/vladimir/">Vladimir Prelovac</a></h5>
|
604 |
+
</div>
|
605 |
+
<?php
|
606 |
+
}
|
607 |
+
|
608 |
+
function handle_about() {
|
609 |
+
global $wp_version;
|
610 |
+
|
611 |
+
$upd_msg = "";
|
612 |
+
|
613 |
+
$actionurl = stripslashes(htmlentities(strip_tags($_SERVER['REQUEST_URI'])));
|
614 |
+
$nonce = wp_create_nonce( 'smart-youtube' );
|
615 |
+
|
616 |
+
$lic_msg = '<p>Welcome to ' . __( 'Smart YouTube PRO', 'smart-youtube' ) . '.</p>';
|
617 |
+
?>
|
618 |
+
<div class="wrap">
|
619 |
+
<?php screen_icon(); ?>
|
620 |
+
<h2><?php _e( 'Smart YouTube PRO', 'smart-youtube' ); echo ' ' . $this->local_version; ?></h2>
|
621 |
+
<a href="admin.php?page=syt_settings"><?php _e( 'Settings', 'smart-youtube' ); ?></a> | <a href="admin.php?page=syt_colorbox_options"><?php _e( 'Colorbox Options', 'smart-youtube' ); ?></a> | <a href="admin.php?page=syt_about"><?php _e( 'About', 'smart-youtube' ); ?></a>
|
622 |
+
<div id="poststuff" style="margin-top:10px;">
|
623 |
+
|
624 |
+
<div id="sideblock" style="float:right;width:270px;margin-left:10px;">
|
625 |
+
<iframe width=270 height=800 frameborder="0" src="http://www.prelovac.com/plugin/news.php?id=2&utm_source=plugin&utm_medium=plugin&utm_campaign=SEO%2BFriendly%2BImages%2BPRO"></iframe>
|
626 |
+
</div>
|
627 |
+
</div>
|
628 |
+
<div id="mainblock" class="submit">
|
629 |
+
<div class="dbx-content">
|
630 |
+
<h2><?php _e( 'About', 'smart-youtube' ); ?></h2>
|
631 |
+
<br />
|
632 |
+
<form name="STY_about" action="$actionurl" method="post">
|
633 |
+
<input type="hidden" id="_wpnonce" name="_wpnonce" value="$nonce" />
|
634 |
+
<input type="hidden" name="submitted" value="1" />
|
635 |
+
<?php echo $lic_msg; ?>
|
636 |
+
<?php echo __( 'Version:', 'smart-youtube' ) . $this->local_version; ?> <?php echo $upd_msg; ?>
|
637 |
+
</form>
|
638 |
+
</div>
|
639 |
+
</div>
|
640 |
+
<h5><?php _e( 'Another fine WordPress plugin by', 'smart-youtube' ); ?> <a href="http://www.prelovac.com/vladimir/">Vladimir Prelovac</a></h5>
|
641 |
+
</div>
|
642 |
+
<?php
|
643 |
+
}
|
644 |
+
|
645 |
+
function mark_first_post_on_archive() {
|
646 |
+
if ( is_archive() || is_home() || is_front_page() ) {
|
647 |
+
$this->first_post_on_archive = true;
|
648 |
+
}
|
649 |
+
}
|
650 |
+
|
651 |
+
/**
|
652 |
+
* Looks for Smart Youtube URL(s) in the post content
|
653 |
+
* and replace them with proper HTML tags
|
654 |
+
*
|
655 |
+
* @param mixed $the_content
|
656 |
+
* @param mixed $side
|
657 |
+
* @return mixed
|
658 |
+
*/
|
659 |
+
function check( $the_content, $side = 0 ) {
|
660 |
+
$char_codes = array( '×', '–' );
|
661 |
+
$replacements = array( "x", "--" );
|
662 |
+
$the_content = str_replace( $char_codes, $replacements, $the_content );
|
663 |
+
$this->first = false;
|
664 |
+
|
665 |
+
$context = $side ? 'side' : 'post';
|
666 |
+
|
667 |
+
preg_match_all( "/((http(v|vh|vhd)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?youtube\.com\/watch(\?v\=|\/v\/|#!v=)([a-zA-Z0-9\-\_]{11})([^<\s]*))|((http(v|vh|vhd)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?youtu\.be\/([a-zA-Z0-9\-\_]{11}))|((http(v|vh|vhd)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?metacafe\.com\/watch\/([a-zA-Z0-9\-\_]{7})\/([^<^\/\s]*)([\/])?)|((http(v|vh|vhd)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?vimeo\.com\/([a-zA-Z0-9\-\_]{8})([\/])?)|((http(v|vh|vhd)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?liveleak\.com\/view(\?i\=)([a-zA-Z0-9\-\_]*))|((http(v|vh|vhd)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?facebook\.com\/video\/video.php\?v\=([a-zA-Z0-9\-\_]*))|((http(vp|vhp)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?youtube\.com\/(view_play_list\?p\=|playlist\?list\=)([a-zA-Z0-9\-\_]{18,34})([^<\s]*))/", $the_content, $matches, PREG_SET_ORDER );
|
668 |
+
|
669 |
+
foreach ( $matches as $match ) {
|
670 |
+
if ( $match[1] != '' ) {
|
671 |
+
if ( 'on' == $this->options['wiziapp'] ) {
|
672 |
+
$videos = array();
|
673 |
+
$video_info['src'] = "http://www.youtube.com/watch?v={$match[6]}";
|
674 |
+
array_push( $videos, $video_info );
|
675 |
+
$replace_text = '';
|
676 |
+
$replace_text = apply_filters( 'wiziapp_3rd_party_plugin', $replace_text, 'video', $videos );
|
677 |
+
$the_content = str_replace( $match[1], $replace_text, $the_content );
|
678 |
+
} else if ( ( $match[2] == 'http://' && $this->options['http'] == 'on' ) || ( $match[2] == '' && $this->options['www'] == 'on' ) ) {
|
679 |
+
$the_content = str_replace( $match[1], $this->tag_youtube( $context, $match[6], 'v', $match[7] ), $the_content );
|
680 |
+
} else if ( $match[3] == 'v' || $match[3] == 'vh' || $match[3] == 'vhd' ) {
|
681 |
+
$the_content = str_replace( $match[1], $this->tag_youtube( $context, $match[6], $match[3], $match[7] ), $the_content );
|
682 |
+
}
|
683 |
+
} elseif ( $match[8] != '' ) {
|
684 |
+
if ( 'on' == $this->options['wiziapp'] ) {
|
685 |
+
$videos = array();
|
686 |
+
$video_info['src'] = "http://www.youtube.com/watch?v={$match[12]}";
|
687 |
+
array_push( $videos, $video_info );
|
688 |
+
$replace_text = '';
|
689 |
+
$replace_text = apply_filters( 'wiziapp_3rd_party_plugin', $replace_text, 'video', $videos );
|
690 |
+
$the_content = str_replace( $match[1], $replace_text, $the_content );
|
691 |
+
} else if ( ( $match[9] == 'http://' && $this->options['http'] == 'on' ) || ( $match[9] == '' && $this->options['www'] == 'on' ) ) {
|
692 |
+
$the_content = str_replace( $match[8], $this->tag_youtube( $context, $match[12], 'v' ), $the_content );
|
693 |
+
} else if ( $match[10] == 'v' || $match[10] == 'vh' || $match[10] == 'vhd' ) {
|
694 |
+
$the_content = str_replace( $match[8], $this->tag_youtube( $context, $match[12], $match[10] ), $the_content );
|
695 |
+
}
|
696 |
+
} elseif ( $match[13] != '' ) {
|
697 |
+
if ( 'on' == $this->options['wiziapp'] ) {
|
698 |
+
$videos = array();
|
699 |
+
$video_info['src'] = "http://www.metacafe.com/watch/{$match[17]}/{$match[18]}/";
|
700 |
+
array_push( $videos, $video_info );
|
701 |
+
$replace_text = '';
|
702 |
+
$replace_text = apply_filters( 'wiziapp_3rd_party_plugin', $replace_text, 'video', $videos );
|
703 |
+
$the_content = str_replace( $match[1], $replace_text, $the_content );
|
704 |
+
} else if ( ( $match[14] == 'http://' && $this->options['http'] == 'on' ) || ( $match[14] == '' && $this->options['www'] == 'on' ) ) {
|
705 |
+
$the_content = str_replace( $match[13], $this->tag_metacafe( $context, $match[17], 'v', $match[18] ), $the_content );
|
706 |
+
} else if ( $match[15] == 'v' || $match[15] == 'vh' || $match[15] == 'vhd' ) {
|
707 |
+
$the_content = str_replace( $match[13], $this->tag_metacafe( $context, $match[17], $match[15], $match[18] ), $the_content );
|
708 |
+
}
|
709 |
+
} elseif ( $match[20] != '' ) {
|
710 |
+
if ( 'on' == $this->options['wiziapp'] ) {
|
711 |
+
$videos = array();
|
712 |
+
$video_info['src'] = "http://www.vimeo.com/{$match[24]}";
|
713 |
+
array_push( $videos, $video_info );
|
714 |
+
$replace_text = '';
|
715 |
+
$replace_text = apply_filters( 'wiziapp_3rd_party_plugin', $replace_text, 'video', $videos );
|
716 |
+
$the_content = str_replace( $match[1], $replace_text, $the_content );
|
717 |
+
} else if ( ( $match[21] == 'http://' && $this->options['http'] == 'on' ) || ( $match[21] == '' && $this->options['www'] == 'on' ) ) {
|
718 |
+
$the_content = str_replace( $match[20], $this->tag_vimeo( $context, $match[24], 'v' ), $the_content );
|
719 |
+
} else if ( $match[22] == 'v' || $match[22] == 'vh' || $match[22] == 'vhd' ) {
|
720 |
+
$the_content = str_replace( $match[20], $this->tag_vimeo( $context, $match[24], $match[22] ), $the_content );
|
721 |
+
}
|
722 |
+
} elseif ( $match[26] != '' ) {
|
723 |
+
if ( 'on' == $this->options['wiziapp'] ) {
|
724 |
+
$videos = array();
|
725 |
+
$video_info['src'] = "http://www.liveleak.com/view?i={$match[31]}";
|
726 |
+
array_push( $videos, $video_info );
|
727 |
+
$replace_text = '';
|
728 |
+
$replace_text = apply_filters( 'wiziapp_3rd_party_plugin', $replace_text, 'video', $videos );
|
729 |
+
$the_content = str_replace( $match[1], $replace_text, $the_content );
|
730 |
+
} else if ( ( $match[27] == 'http://' && $this->options['http'] == 'on' ) || ( $match[27] == '' && $this->options['www'] == 'on' ) ) {
|
731 |
+
$the_content = str_replace( $match[26], $this->tag_liveleak( $context, $match[31], 'v' ), $the_content );
|
732 |
+
} else if ( $match[28] == 'v' || $match[28] == 'vh' || $match[28] == 'vhd' ) {
|
733 |
+
$the_content = str_replace( $match[26], $this->tag_liveleak( $context, $match[31], $match[28] ), $the_content );
|
734 |
+
}
|
735 |
+
} elseif ( $match[32] != '' ) {
|
736 |
+
if ( 'on' == $this->options['wiziapp'] ) {
|
737 |
+
$videos = array();
|
738 |
+
$video_info['src'] = "http://www.facebook.com/video/video.php?v={$match[36]}";
|
739 |
+
array_push( $videos, $video_info );
|
740 |
+
$replace_text = '';
|
741 |
+
$replace_text = apply_filters( 'wiziapp_3rd_party_plugin', $replace_text, 'video', $videos );
|
742 |
+
$the_content = str_replace( $match[1], $replace_text, $the_content );
|
743 |
+
} else if ( ( $match[33] == 'http://' && $this->options['http'] == 'on' ) || ( $match[33] == '' && $this->options['www'] == 'on' ) ) {
|
744 |
+
$the_content = str_replace( $match[32], $this->tag_facebook( $context, $match[36], 'v' ), $the_content );
|
745 |
+
} else if ( $match[34] == 'v' || $match[34] == 'vh' || $match[34] == 'vhd' ) {
|
746 |
+
$the_content = str_replace( $match[32], $this->tag_facebook( $context, $match[36], $match[34] ), $the_content );
|
747 |
+
}
|
748 |
+
} elseif ( $match[37] != '' ) {
|
749 |
+
|
750 |
+
if ( 'on' == $this->options['wiziapp'] ) {
|
751 |
+
$videos = array();
|
752 |
+
$video_info['src'] = "http://www.youtube.com/playlist?list={$match[42]}";
|
753 |
+
array_push( $videos, $video_info );
|
754 |
+
$replace_text = '';
|
755 |
+
$replace_text = apply_filters( 'wiziapp_3rd_party_plugin', $replace_text, 'video', $videos );
|
756 |
+
$the_content = str_replace( $match[1], $replace_text, $the_content );
|
757 |
+
} else if ( ( $match[38] == 'http://' && $this->options['http'] == 'on' ) || ( $match[38] == '' && $this->options['www'] == 'on' ) ) {
|
758 |
+
$the_content = str_replace( $match[37], $this->tag_youtube( $context, $match[42], 'vp', $match[43] ), $the_content );
|
759 |
+
} else if ( $match[39] == 'vp' || $match[39] == 'vhp' ) {
|
760 |
+
$the_content = str_replace( $match[37], $this->tag_youtube( $context, $match[42], $match[39], $match[43] ), $the_content );
|
761 |
+
}
|
762 |
+
}
|
763 |
+
}
|
764 |
+
|
765 |
+
/*preg_match_all( "/(http(v|vh|vhd)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?youtu\.be\/([a-zA-Z0-9\-\_]{11})/", $the_content, $matches, PREG_SET_ORDER );
|
766 |
+
foreach ( $matches as $match ) {
|
767 |
+
if (( $match[1] == 'http://' && $this->options['http'] == 'on' ) || ( $match[1] == '' && $this->options['www'] == 'on' ) ) {
|
768 |
+
$the_content = str_replace( $match[0], $this->tag_youtube( $context, $match[4], 'v' ), $the_content );
|
769 |
+
} else if ( $match[2] == 'v' || $match[2] == 'vh' || $match[2] == 'vhd' ) {
|
770 |
+
$the_content = str_replace( $match[0], $this->tag_youtube( $context, $match[4], $match[2] ), $the_content );
|
771 |
+
}
|
772 |
+
}
|
773 |
+
|
774 |
+
preg_match_all( "/(http(v|vh|vhd)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?metacafe\.com\/watch\/([a-zA-Z0-9\-\_]{7})\/([^<^\/\s]*)([\/])?/", $the_content, $matches, PREG_SET_ORDER );
|
775 |
+
foreach ( $matches as $match ) {
|
776 |
+
if ( ( $match[1] == 'http://' && $this->options['http'] == 'on' ) || ( $match[1] == '' && $this->options['www'] == 'on' ) ) {
|
777 |
+
$the_content = str_replace( $match[0], $this->tag_metacafe( $context, $match[4], 'v', $match[5] ), $the_content );
|
778 |
+
} else if ( $match[2] == 'v' || $match[2] == 'vh' || $match[2] == 'vhd' ) {
|
779 |
+
$the_content = str_replace( $match[0], $this->tag_metacafe( $context, $match[4], $match[2], $match[5] ), $the_content );
|
780 |
+
}
|
781 |
+
}
|
782 |
+
|
783 |
+
preg_match_all( "/(http(v|vh|vhd)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?vimeo\.com\/([a-zA-Z0-9\-\_]{8})([\/])?/", $the_content, $matches, PREG_SET_ORDER );
|
784 |
+
foreach ( $matches as $match ) {
|
785 |
+
if ( ( $match[1] == 'http://' && $this->options['http'] == 'on' ) || ( $match[1] == '' && $this->options['www'] == 'on' ) ) {
|
786 |
+
$the_content = str_replace( $match[0], $this->tag_vimeo( $context, $match[4], 'v' ), $the_content );
|
787 |
+
} else if ( $match[2] == 'v' || $match[2] == 'vh' || $match[2] == 'vhd' ) {
|
788 |
+
$the_content = str_replace( $match[0], $this->tag_vimeo( $context, $match[4], $match[2] ), $the_content );
|
789 |
+
}
|
790 |
+
}
|
791 |
+
|
792 |
+
preg_match_all( "/(http(v|vh|vhd)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?liveleak\.com\/view(\?i\=)([a-zA-Z0-9\-\_]*)/", $the_content, $matches, PREG_SET_ORDER );
|
793 |
+
foreach ( $matches as $match ) {
|
794 |
+
if ( ( $match[1] == 'http://' && $this->options['http'] == 'on' ) || ( $match[1] == '' && $this->options['www'] == 'on' ) ) {
|
795 |
+
$the_content = str_replace( $match[0], $this->tag_liveleak( $context, $match[5], 'v' ), $the_content );
|
796 |
+
} else if ( $match[2] == 'v' || $match[2] == 'vh' || $match[2] == 'vhd' ) {
|
797 |
+
$the_content = str_replace( $match[0], $this->tag_liveleak( $context, $match[5], $match[2] ), $the_content );
|
798 |
+
}
|
799 |
+
}
|
800 |
+
|
801 |
+
preg_match_all( "/(http(v|vh|vhd)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?facebook\.com\/video\/video.php\?v\=([a-zA-Z0-9\-\_]*)/", $the_content, $matches, PREG_SET_ORDER );
|
802 |
+
foreach ( $matches as $match ) {
|
803 |
+
if ( ( $match[1] == 'http://' && $this->options['http'] == 'on' ) || ( $match[1] == '' && $this->options['www'] == 'on' ) ) {
|
804 |
+
$the_content = str_replace( $match[0], $this->tag_facebook( $context, $match[4], 'v' ), $the_content );
|
805 |
+
} else if ( $match[2] == 'v' || $match[2] == 'vh' || $match[2] == 'vhd' ) {
|
806 |
+
$the_content = str_replace( $match[0], $this->tag_facebook( $context, $match[4], $match[2] ), $the_content );
|
807 |
+
}
|
808 |
+
}
|
809 |
+
|
810 |
+
preg_match_all( "/(http(vp|vhp)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?youtube\.com\/view_play_list(\?p\=|\/v\/|#!v=)([a-zA-Z0-9\-\_]{16})([^<\s]*)/", $the_content, $matches, PREG_SET_ORDER );
|
811 |
+
foreach ( $matches as $match ) {
|
812 |
+
if ( ( $match[1] == 'http://' && $this->options['http'] == 'on' ) || ( $match[1] == '' && $this->options['www'] == 'on' ) ) {
|
813 |
+
$the_content = str_replace( $match[0], $this->tag_youtube( $context, $match[5], 'vp', $match[6] ), $the_content );
|
814 |
+
} else if ( $match[2] == 'vp' || $match[2] == 'vhp' ) {
|
815 |
+
$the_content = str_replace( $match[0], $this->tag_youtube( $context, $match[5], $match[2], $match[6] ), $the_content );
|
816 |
+
}
|
817 |
+
}*/
|
818 |
+
|
819 |
+
// to work with migrated blogs from Wordpress.com replacing [youtube=youtubeadresss]
|
820 |
+
if ( strpos($the_content, "[youtube") !== false ) {
|
821 |
+
preg_match_all( "/\[youtube\=http:\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/|#!v=)([a-zA-Z0-9\-\_]{11})([^<\s]*)\]/", $the_content, $matches, PREG_SET_ORDER );
|
822 |
+
foreach ( $matches as $match ) {
|
823 |
+
$the_content = preg_replace( "/\[youtube\=http:\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/|#!v=)([a-zA-Z0-9\-\_]{11})([^\s<]*)\]/", $this->tag_youtube( $context, $match[3], '', $match[4] ), $the_content, 1 );
|
824 |
+
}
|
825 |
+
}
|
826 |
+
$tag = $this->options['tag'];
|
827 |
+
|
828 |
+
if ( $tag != '' && strpos( $the_content, "[".$tag."]" ) !== false ) {
|
829 |
+
preg_match_all( "/\[$tag\]([a-zA-Z0-9\-\_]{11})([^<\s]*)\[\/$tag\]/", $the_content, $matches, PREG_SET_ORDER );
|
830 |
+
foreach ( $matches as $match ) {
|
831 |
+
$the_content = preg_replace( "/\[$tag\]([a-zA-Z0-9\-\_]{11})([^<\s]*)\[\/$tag\]/", $this->tag_youtube( $context, $match[1], '', '' ), $the_content, 1 );
|
832 |
+
}
|
833 |
+
}
|
834 |
+
|
835 |
+
if ( $this->first_post_on_archive ) {
|
836 |
+
$this->first_post_on_archive = false;
|
837 |
+
}
|
838 |
+
|
839 |
+
return $the_content;
|
840 |
+
}
|
841 |
+
|
842 |
+
function check_excerpt( $the_content ) {
|
843 |
+
$excerpt = $this->options['excerpt'];
|
844 |
+
$template = trim($this->options['template']) == '' ? '{video}' : $this->options['template'];
|
845 |
+
|
846 |
+
if ( $excerpt != 'not' ) {
|
847 |
+
global $post;
|
848 |
+
$content = $post->post_content;
|
849 |
+
|
850 |
+
preg_match_all( "/(http(v|vh|vhd)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?youtube\.com\/watch(\?v\=|\/v\/|#!v=)([a-zA-Z0-9\-\_]{11})([^<\s]*)/", $content, $matches['youtube.com'], PREG_SET_ORDER );
|
851 |
+
preg_match_all( "/(http(v|vh|vhd)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?youtu\.be\/([a-zA-Z0-9\-\_]{11})/", $content, $matches['youtu.be'], PREG_SET_ORDER );
|
852 |
+
preg_match_all( "/(http(v|vh|vhd)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?metacafe\.com\/watch\/([a-zA-Z0-9\-\_]{7})\/([^<^\/\s]*)([\/])?/", $content, $matches['metacafe.com'], PREG_SET_ORDER );
|
853 |
+
preg_match_all( "/(http(v|vh|vhd)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?vimeo\.com\/([a-zA-Z0-9\-\_]{8})([\/])?/", $content, $matches['vimeo.com'], PREG_SET_ORDER );
|
854 |
+
preg_match_all( "/(http(v|vh|vhd)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?liveleak\.com\/view(\?i\=)([a-zA-Z0-9\-\_]*)/", $content, $matches['liveleak.com'], PREG_SET_ORDER );
|
855 |
+
preg_match_all( "/(http(v|vh|vhd)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?facebook\.com\/video\/video.php\?v\=([a-zA-Z0-9\-\_]*)/", $content, $matches['facebook.com'], PREG_SET_ORDER );
|
856 |
+
|
857 |
+
if ( isset( $matches['youtube.com'][0] ) ) {
|
858 |
+
if ( ( $matches['youtube.com'][0][1] == 'http://' && $this->options['http'] == 'on' ) || ( $matches['youtube.com'][0][1] == '' && $this->options['www'] == 'on' ) ) {
|
859 |
+
$matches['youtube.com'][0][0] = str_replace( $matches['youtube.com'][0][0], $this->tag_youtube( 'excerpt', $matches['youtube.com'][0][5], 'v', $matches['youtube.com'][0][6] ), $matches['youtube.com'][0][0] );
|
860 |
+
} else if ( $matches['youtube.com'][0][2] == 'v' || $matches['youtube.com'][0][2] == 'vh' || $matches['youtube.com'][0][2] == 'vhd' ) {
|
861 |
+
$matches['youtube.com'][0][0] = str_replace( $matches['youtube.com'][0][0], $this->tag_youtube( 'excerpt', $matches['youtube.com'][0][5], $matches['youtube.com'][0][2], $matches['youtube.com'][0][6] ), $matches['youtube.com'][0][0] );
|
862 |
+
}
|
863 |
+
$result = $matches['youtube.com'][0][0];
|
864 |
+
} else if ( isset( $matches['youtu.be'][0] ) ) {
|
865 |
+
if ( ( $matches['youtu.be'][0][1] == 'http://' && $this->options['http'] == 'on' ) || ( $matches['youtu.be'][0][1] == '' && $this->options['www'] == 'on' ) ) {
|
866 |
+
$matches['youtu.be'][0][0] = str_replace( $matches['youtu.be'][0][0], $this->tag_youtube( 'excerpt', $matches['youtu.be'][0][4], 'v' ), $matches['youtu.be'][0][0] );
|
867 |
+
} else if ( $matches['youtu.be'][0][2] == 'v' || $matches['youtu.be'][0][2] == 'vh' || $matches['youtu.be'][0][2] == 'vhd' ) {
|
868 |
+
$matches['youtu.be'][0][0] = str_replace( $matches['youtu.be'][0][0], $this->tag_youtube( 'excerpt', $matches['youtu.be'][0][4], $matches['youtu.be'][0][2]), $matches['youtu.be'][0][0] );
|
869 |
+
}
|
870 |
+
$result = $matches['youtu.be'][0][0];
|
871 |
+
} else if ( isset( $matches['metacafe.com'][0] ) ) {
|
872 |
+
if ( ( $matches['metacafe.com'][0][1] == 'http://' && $this->options['http'] == 'on' ) || ( $matches['metacafe.com'][0][1] == '' && $this->options['www'] == 'on' ) ) {
|
873 |
+
$matches['metacafe.com'][0][0] = str_replace( $matches['metacafe.com'][0][0], $this->tag_metacafe( 'excerpt', $matches['metacafe.com'][0][4], 'v', $matches['metacafe.com'][0][5] ), $matches['metacafe.com'][0][0] );
|
874 |
+
} else if ( $matches['metacafe.com'][0][2] == 'v' || $matches['metacafe.com'][0][2] == 'vh' || $matches['metacafe.com'][0][2] == 'vhd' ) {
|
875 |
+
$matches['metacafe.com'][0][0] = str_replace( $matches['metacafe.com'][0][0], $this->tag_metacafe( 'excerpt', $matches['metacafe.com'][0][4], $matches['metacafe.com'][0][2], $matches['metacafe.com'][0][5] ), $matches['metacafe.com'][0][0] );
|
876 |
+
}
|
877 |
+
$result = $matches['metacafe.com'][0][0];
|
878 |
+
} else if ( isset($matches['vimeo.com'][0] ) ) {
|
879 |
+
if ( ( $matches['vimeo.com'][0][1] == 'http://' && $this->options['http'] == 'on' ) || ( $matches['vimeo.com'][0][1] == '' && $this->options['www'] == 'on' ) ) {
|
880 |
+
$matches['vimeo.com'][0][0] = str_replace( $matches['vimeo.com'][0][0], $this->tag_vimeo( 'excerpt', $matches['vimeo.com'][0][4], 'v' ), $matches['vimeo.com'][0][0] );
|
881 |
+
}
|
882 |
+
else if ( $matches['vimeo.com'][0][2] == 'v' || $matches['vimeo.com'][0][2] == 'vh' || $matches['vimeo.com'][0][2] == 'vhd' ) {
|
883 |
+
$matches['vimeo.com'][0][0] = str_replace( $matches['vimeo.com'][0][0], $this->tag_vimeo( 'excerpt', $matches['vimeo.com'][0][4], $matches['vimeo.com'][0][2] ), $matches['vimeo.com'][0][0] );
|
884 |
+
}
|
885 |
+
$result = $matches['vimeo.com'][0][0];
|
886 |
+
} else if ( isset( $matches['liveleak.com'][0] ) ) {
|
887 |
+
if ( ( $matches['liveleak.com'][0][1] == 'http://' && $this->options['http'] == 'on' ) || ( $matches['liveleak.com'][0][1] == '' && $this->options['www'] == 'on' ) ) {
|
888 |
+
$matches['liveleak.com'][0][0] = str_replace( $matches['liveleak.com'][0][0], $this->tag_liveleak( 'excerpt', $matches['liveleak.com'][0][4], 'v' ), $matches['liveleak.com'][0][0] );
|
889 |
+
} else if ( $matches['liveleak.com'][0][2] == 'v' || $matches['liveleak.com'][0][2] == 'vh' || $matches['liveleak.com'][0][2] == 'vhd' ) {
|
890 |
+
$matches['liveleak.com'][0][0] = str_replace( $matches['liveleak.com'][0][0], $this->tag__liveleak( 'excerpt', $matches['liveleak.com'][0][4], $matches['liveleak.com'][0][2] ), $matches['liveleak.com'][0][0] );
|
891 |
+
}
|
892 |
+
$result = $matches['liveleak.com'][0][0];
|
893 |
+
} else if ( isset( $matches['facebook.com'][0] ) ) {
|
894 |
+
if ( ( $matches['facebook.com'][0][1] == 'http://' && $this->options['http'] == 'on' ) || ( $matches['facebook.com'][0][1] == '' && $this->options['www'] == 'on' ) ) {
|
895 |
+
$matches['facebook.com'][0][0] = str_replace( $matches['facebook.com'][0][0], $this->tag_facebook( 'excerpt', $matches['facebook.com'][0][4], 'v' ), $matches['facebook.com'][0][0] );
|
896 |
+
} else if ( $matches['facebook.com'][0][2] == 'v' || $matches['facebook.com'][0][2] == 'vh' || $matches['facebook.com'][0][2] == 'vhd' ) {
|
897 |
+
$matches['facebook.com'][0][0] = str_replace( $matches['facebook.com'][0][0], $this->tag_facebook( 'excerpt', $matches['facebook.com'][0][4], $matches['facebook.com'][0][2] ), $matches['facebook.com'][0][0] );
|
898 |
+
}
|
899 |
+
$result = $matches['facebook.com'][0][0];
|
900 |
+
} else {
|
901 |
+
/*$width = $this->options['widthside'];
|
902 |
+
$height = $this->options['heightside'];
|
903 |
+
|
904 |
+
$img_url = htmlspecialchars( $this->plugin_url . '/img/default.jpg' );
|
905 |
+
$post_url = get_permalink( $post->ID );
|
906 |
+
$yte_tag = <<<EOT
|
907 |
+
<a href="$post_url">
|
908 |
+
<img src="$img_url" height="$height" width="$width" />
|
909 |
+
</a>
|
910 |
+
EOT;
|
911 |
+
$result = str_replace( '{video}', $yte_tag, html_entity_decode( $template ) );*/
|
912 |
+
|
913 |
+
return $the_content;
|
914 |
+
}
|
915 |
+
if ( isset( $result ) ) {
|
916 |
+
$the_content = '<div style="float:' . $this->options["excerpt_align"] . ';padding-' . ( $this->options["excerpt_aign"] == 'left' ? 'right' : 'left' ) . ':10px;">' . $result . '</div>' . $the_content . '<div style="clear:both"></div>';
|
917 |
+
}
|
918 |
+
}
|
919 |
+
|
920 |
+
if ( $this->first_post_on_archive ) {
|
921 |
+
$this->first_post_on_archive = false;
|
922 |
+
}
|
923 |
+
|
924 |
+
return $the_content;
|
925 |
+
}
|
926 |
+
|
927 |
+
function tag_youtube( $context, $file, $high = 'v', $time = '' ) {
|
928 |
+
$playlist = 0;
|
929 |
+
$disp_rel = $this->options['rel'];
|
930 |
+
$autoplay = $this->options['autoplay'];
|
931 |
+
$autoplay_first = $this->options['autoplay_first'];
|
932 |
+
$disp_search = $this->options['search'] == 'on' ? 1 : 0;
|
933 |
+
$disp_info = $this->options['info'] == 'on' ? '&showinfo=0' : '';
|
934 |
+
$disp_ann = $this->options['ann'] == 'on' ? '&iv_load_policy=3' : '';
|
935 |
+
$template = trim( $this->options['template'] ) == '' ? '{video}' : $this->options['template'];
|
936 |
+
$valid = $this->options['valid'];
|
937 |
+
if ($this->options['loop'])
|
938 |
+
$loop="&loop=1&playlist=$file";
|
939 |
+
else $loop='';
|
940 |
+
$thumb = $this->options['thumb'];
|
941 |
+
$colorbox = $this->options['colorbox'];
|
942 |
+
$logoless = $this->options['logoless'];
|
943 |
+
$theme = $this->options['theme'];
|
944 |
+
$excerpt = $this->options['excerpt'];
|
945 |
+
|
946 |
+
switch ( $high ) {
|
947 |
+
case 'v':
|
948 |
+
$high = '';
|
949 |
+
break;
|
950 |
+
case 'vh':
|
951 |
+
$high = '&hd=1';
|
952 |
+
break;
|
953 |
+
case 'vhd':
|
954 |
+
$high = '&hd=1';
|
955 |
+
break;
|
956 |
+
case 'vp':
|
957 |
+
$high = '';
|
958 |
+
$playlist = 1;
|
959 |
+
break;
|
960 |
+
case 'vhp':
|
961 |
+
$high = '&hd=1';
|
962 |
+
$playlist = 1;
|
963 |
+
break;
|
964 |
+
default:
|
965 |
+
$high = '';
|
966 |
+
break;
|
967 |
+
}
|
968 |
+
|
969 |
+
$width = ( $context == 'excerpt' || $context == 'side' ) ?
|
970 |
+
$this->options['widthside'] :
|
971 |
+
( $high ? $this->options['widthhq'] : $this->options['width'] );
|
972 |
+
|
973 |
+
$height = ( $context == 'excerpt' || $context == 'side' ) ?
|
974 |
+
$this->options['heightside'] :
|
975 |
+
( $high ? $this->options['heighthq'] : $this->options['height'] );
|
976 |
+
|
977 |
+
if ( ! $width ) {
|
978 |
+
$width = ! $high ? 480 : 425 ;
|
979 |
+
}
|
980 |
+
|
981 |
+
if ( ! $height ) {
|
982 |
+
$height = ! $high ? 360 : 344;
|
983 |
+
}
|
984 |
+
|
985 |
+
$ap = '';
|
986 |
+
if ( is_single() ) {
|
987 |
+
if ( $context == 'post' && $autoplay_first && ! $this->first ) {
|
988 |
+
$ap = '&autoplay=1';
|
989 |
+
$this->first = true;
|
990 |
+
} else if ( ( $context == 'post' && $autoplay && ! $autoplay_first ) || ( $context == 'excerpt' && $autoplay ) ) {
|
991 |
+
$ap = '&autoplay=1';
|
992 |
+
} else {
|
993 |
+
$ap = '';
|
994 |
+
}
|
995 |
+
} elseif ( $this->first_post_on_archive ) {
|
996 |
+
if ( $context == 'post' && $autoplay_first && ! $this->first ) {
|
997 |
+
$ap = '&autoplay=1';
|
998 |
+
$this->first = true;
|
999 |
+
} else if ( ( $context == 'post' && $autoplay && ! $autoplay_first ) || ( $context == 'excerpt' && $autoplay ) ) {
|
1000 |
+
$ap = '&autoplay=1';
|
1001 |
+
} else {
|
1002 |
+
$ap = '';
|
1003 |
+
}
|
1004 |
+
}
|
1005 |
+
|
1006 |
+
if ( $logoless == 'on' ) {
|
1007 |
+
$ll = '&modestbranding=1';
|
1008 |
+
$disp_info = '';
|
1009 |
+
} else {
|
1010 |
+
$ll = '';
|
1011 |
+
}
|
1012 |
+
|
1013 |
+
$root_url = $this->options['privacy'] ? 'http://www.youtube-nocookie.com' : 'http://www.youtube.com';
|
1014 |
+
|
1015 |
+
if ( $excerpt == 'thm' ) {
|
1016 |
+
$img_url = htmlspecialchars( "http://img.youtube.com/vi/$file/0.jpg" );
|
1017 |
+
global $post;
|
1018 |
+
$post_url = get_permalink( $post->ID );
|
1019 |
+
$yte_tag = <<<EOT
|
1020 |
+
<a href="$post_url"><img src="$img_url" height="$height" width="$width" /></a>
|
1021 |
+
EOT;
|
1022 |
+
}
|
1023 |
+
|
1024 |
+
if ( ( ( is_home() || is_front_page() || is_archive() ) && $context == 'post' && $thumb == 'on' ) || ( $context == 'thumb' ) || ( $context == 'excerpt' && $excerpt == 'thm' ) ) {
|
1025 |
+
$img_url = htmlspecialchars( "http://img.youtube.com/vi/$file/0.jpg" );
|
1026 |
+
if ( $context == 'excerpt' && $excerpt == 'thm' ) {
|
1027 |
+
global $post;
|
1028 |
+
$post_url = get_permalink( $post->ID );
|
1029 |
+
$yte_tag = <<<EOT
|
1030 |
+
<a href="$post_url"><img src="$img_url" height="$height" width="$width" /></a>
|
1031 |
+
EOT;
|
1032 |
+
} else {
|
1033 |
+
$yte_tag = <<<EOT
|
1034 |
+
<img src="$img_url" height="$height" width="$width" />
|
1035 |
+
EOT;
|
1036 |
+
}
|
1037 |
+
} else {
|
1038 |
+
if ( $this->options['iframe'] == 'on' )
|
1039 |
+
$video_url = htmlspecialchars( "$root_url/embed/$file?wmode=transparent&fs=1&hl=en$ap$ll$loop{$disp_info}$disp_ann&showsearch=$disp_search&rel=$disp_rel&theme=$theme", ENT_QUOTES ) . $high . $time;
|
1040 |
+
else
|
1041 |
+
$video_url = htmlspecialchars( "$root_url/v/$file?wmode=transparent&fs=1&hl=en&$ap$ll$loop{$disp_info}$disp_ann&showsearch=$disp_search&rel=$disp_rel&theme=$theme", ENT_QUOTES ) . $high . $time;
|
1042 |
+
|
1043 |
+
if ( $playlist ) {
|
1044 |
+
$video_url = htmlspecialchars( "$root_url/embed/videoseries?list=$file&fs=1&hl=en$ap$ll$loop{$disp_info}$disp_ann&showsearch=$disp_search&rel=$disp_rel&theme=$theme", ENT_QUOTES ) . $high . $time;
|
1045 |
+
$yte_tag = <<<EOT
|
1046 |
+
<span class="youtube"><iframe class="youtube-player" src="$video_url" width="$width" height="$height" frameborder="0" allowfullscreen></iframe></span>
|
1047 |
+
EOT;
|
1048 |
+
} elseif ( $valid == 'off' || strpos( $_SERVER['HTTP_USER_AGENT'], 'iPhone' ) === TRUE || strpos( $_SERVER['HTTP_USER_AGENT'], 'iPod' ) === TRUE || strpos( $_SERVER['HTTP_USER_AGENT'], 'iPad' ) === TRUE ) {
|
1049 |
+
if ( $context == 'post' && $colorbox == 'on' ) {
|
1050 |
+
$img_url = htmlspecialchars( "http://img.youtube.com/vi/$file/0.jpg" );
|
1051 |
+
$yte_tag = <<<EOT
|
1052 |
+
<a class="colorbox_video" href="$video_url"><img width="$width" height="$height" src="$img_url" /></a></span>
|
1053 |
+
EOT;
|
1054 |
+
} else if ( $this->options['iframe'] == 'on' )
|
1055 |
+
$yte_tag = <<<EOT
|
1056 |
+
<span class="youtube"><iframe title="YouTube video player" class="youtube-player" type="text/html" width="$width" height="$height" src="$video_url" frameborder="0" allowfullscreen></iframe></span>
|
1057 |
+
EOT;
|
1058 |
+
else
|
1059 |
+
$yte_tag = <<<EOT
|
1060 |
+
<span class="youtube"><object width="$width" height="$height"><param name="movie" value="$video_url" />
|
1061 |
+
<param name="allowFullScreen" value="true" /><embed wmode="opaque" src="$video_url" type="application/x-shockwave-flash" allowfullscreen="true" width="$width" height="$height"></embed><param name="wmode" value="opaque" /></object></span>
|
1062 |
+
EOT;
|
1063 |
+
} else {
|
1064 |
+
if ( $context == 'post' && $colorbox == 'on' ) {
|
1065 |
+
$img_url = htmlspecialchars( "http://img.youtube.com/vi/$file/0.jpg" );
|
1066 |
+
$yte_tag = <<<EOT
|
1067 |
+
<a class="colorbox_video" href="$video_url"><img width="$width" height="$height" src="$img_url" /></a></span>
|
1068 |
+
EOT;
|
1069 |
+
} else if ( $this->options['iframe'] == 'on' ) {
|
1070 |
+
$yte_tag = <<<EOT
|
1071 |
+
<span class="youtube"><iframe title="YouTube video player" class="youtube-player" type="text/html" width="$width" height="$height" src="$video_url" frameborder="0" allowfullscreen></iframe></span>
|
1072 |
+
EOT;
|
1073 |
+
} else {
|
1074 |
+
$yte_tag = <<<EOT
|
1075 |
+
<span class="youtube"><object type="application/x-shockwave-flash" width="$width" height="$height" data="$video_url"><param name="movie" value="$video_url" />
|
1076 |
+
<param name="allowFullScreen" value="true" /><param name="wmode" value="transparent" /></object></span>
|
1077 |
+
EOT;
|
1078 |
+
}
|
1079 |
+
}
|
1080 |
+
}
|
1081 |
+
|
1082 |
+
if ( is_feed() && ( $context == 'post' || $context = 'excerpt' ) ) {
|
1083 |
+
if ( $high ) {
|
1084 |
+
$high = '&fmt=18';
|
1085 |
+
}
|
1086 |
+
if ( $playlist )
|
1087 |
+
$url = 'http://www.youtube.com/playlist?list=';
|
1088 |
+
else
|
1089 |
+
$url = 'http://www.youtube.com/watch?v=';
|
1090 |
+
|
1091 |
+
$yte_tag = '';
|
1092 |
+
if ( $this->options['link'] == 'on' ) {
|
1093 |
+
$yte_tag .= '<p><a href="' . $url . $file . $high . '">'.$url. $file . '</a></p>';
|
1094 |
+
}
|
1095 |
+
|
1096 |
+
if ( $this->options['img'] == 'on' ) {
|
1097 |
+
$yte_tag .= '<p><a href="' . $url . $file . $high. '"><img src="http://img.youtube.com/vi/' . $file . '/default.jpg" width="130" height="97" border=0></a></p>';
|
1098 |
+
}
|
1099 |
+
|
1100 |
+
if ($this->options['link'] == 'off' && $this->options['img'] == 'off')
|
1101 |
+
$yte_tag=$url.$file;
|
1102 |
+
}
|
1103 |
+
|
1104 |
+
return str_replace( '{video}', $yte_tag, html_entity_decode( $template ) );
|
1105 |
+
}
|
1106 |
+
|
1107 |
+
function tag_metacafe( $context, $file, $high = 'v', $name = '' ) {
|
1108 |
+
$width = ( $context == 'excerpt' || $context == 'side' ) ?
|
1109 |
+
$this->options['widthside'] :
|
1110 |
+
( $high ? $this->options['widthhq'] : $this->options['width'] );
|
1111 |
+
|
1112 |
+
$height = ( $context == 'excerpt' || $context == 'side' ) ?
|
1113 |
+
$this->options['heightside'] :
|
1114 |
+
( $high ? $this->options['heighthq'] : $this->options['height'] );
|
1115 |
+
|
1116 |
+
if ( ! $width ) {
|
1117 |
+
$width = ! ( $high == 'v' ) ? 480 : 425 ;
|
1118 |
+
}
|
1119 |
+
|
1120 |
+
if ( ! $height ) {
|
1121 |
+
$height = ! ( $high == 'v' ) ? 360 : 344;
|
1122 |
+
}
|
1123 |
+
|
1124 |
+
$template = trim( $this->options['template'] ) == '' ? '{video}' : $this->options['template'];
|
1125 |
+
$excerpt = $this->options['excerpt'];
|
1126 |
+
$thumb = $this->options['thumb'];
|
1127 |
+
$colorbox = $this->options['colorbox'];
|
1128 |
+
$autoplay = $this->options['autoplay'];
|
1129 |
+
$autoplay_first = $this->options['autoplay_first'];
|
1130 |
+
|
1131 |
+
$ap = 'no';
|
1132 |
+
if ( is_single() ) {
|
1133 |
+
if ( $context == 'post' && $autoplay_first && ! $this->first ) {
|
1134 |
+
$ap = 'yes';
|
1135 |
+
$this->first = true;
|
1136 |
+
} else if ( ( $context == 'post' && $autoplay && ! $autoplay_first ) || ( $context == 'excerpt' && $autoplay ) ) {
|
1137 |
+
$ap = 'yes';
|
1138 |
+
} else {
|
1139 |
+
$ap = 'no';
|
1140 |
+
}
|
1141 |
+
} elseif ( $this->first_post_on_archive ) {
|
1142 |
+
if ( $context == 'post' && $autoplay_first && ! $this->first ) {
|
1143 |
+
$ap = 'yes';
|
1144 |
+
$this->first = true;
|
1145 |
+
} else if ( ( $context == 'post' && $autoplay && ! $autoplay_first ) || ( $context == 'excerpt' && $autoplay ) ) {
|
1146 |
+
$ap = 'yes';
|
1147 |
+
} else {
|
1148 |
+
$ap = 'no';
|
1149 |
+
}
|
1150 |
+
}
|
1151 |
+
|
1152 |
+
$flash_vars = "playerVars=showStats=no|autoPlay=$ap|";
|
1153 |
+
|
1154 |
+
if ( ( ( is_home() || is_front_page() || is_archive() ) && $context == 'post' && $thumb == 'on' ) || ( $context == 'thumb' ) || ( $context == 'excerpt' && $excerpt == 'thm' ) ) {
|
1155 |
+
$img_url = htmlspecialchars( "http://www.metacafe.com/thumb/$file.jpg" );
|
1156 |
+
if ( $context == 'excerpt' && $excerpt == 'thm' ) {
|
1157 |
+
global $post;
|
1158 |
+
$post_url = get_permalink( $post->ID );
|
1159 |
+
$yte_tag = <<<EOT
|
1160 |
+
<a href="$post_url"><img src="$img_url" height="$height" width="$width" /></a>
|
1161 |
+
EOT;
|
1162 |
+
} else {
|
1163 |
+
$yte_tag = <<<EOT
|
1164 |
+
<img src="$img_url" height="$height" width="$width" />
|
1165 |
+
EOT;
|
1166 |
+
}
|
1167 |
+
} else if ( $context == 'post' && $colorbox == 'on' ) {
|
1168 |
+
$img_url = htmlspecialchars( "http://www.metacafe.com/thumb/$file.jpg" );
|
1169 |
+
$yte_tag = <<<EOT
|
1170 |
+
<a class="colorbox_video" href="http://www.metacafe.com/fplayer/$file/$name.swf"><img width="$width" height="$height" src="$img_url" /></a></span>
|
1171 |
+
EOT;
|
1172 |
+
} else {
|
1173 |
+
$yte_tag = <<<EOT
|
1174 |
+
<embed flashVars="$flash_vars" src="http://www.metacafe.com/fplayer/$file/$name.swf" width="$width" height="$height" wmode="transparent" allowFullScreen="true" allowScriptAccess="always" name="Metacafe_6261286" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>
|
1175 |
+
EOT;
|
1176 |
+
}
|
1177 |
+
|
1178 |
+
return str_replace( '{video}', $yte_tag, html_entity_decode( $template ) );
|
1179 |
+
}
|
1180 |
+
|
1181 |
+
function tag_vimeo( $context, $file, $high = 'v', $side = 0 ) {
|
1182 |
+
$width = ( $context == 'excerpt' || $context == 'side' ) ?
|
1183 |
+
$this->options['widthside'] :
|
1184 |
+
( $high ? $this->options['widthhq'] : $this->options['width'] );
|
1185 |
+
|
1186 |
+
$height = ( $context == 'excerpt' || $context == 'side' ) ?
|
1187 |
+
$this->options['heightside'] :
|
1188 |
+
( $high ? $this->options['heighthq'] : $this->options['height'] );
|
1189 |
+
|
1190 |
+
if ( ! $width ) {
|
1191 |
+
$width = ! ( $high == 'v' ) ? 480 : 425 ;
|
1192 |
+
}
|
1193 |
+
|
1194 |
+
if ( ! $height ) {
|
1195 |
+
$height = ! ( $high == 'v' ) ? 360 : 344;
|
1196 |
+
}
|
1197 |
+
|
1198 |
+
$template = trim( $this->options['template'] ) == '' ? '{video}' : $this->options['template'];
|
1199 |
+
$excerpt = $this->options['excerpt'];
|
1200 |
+
$thumb = $this->options['thumb'];
|
1201 |
+
$colorbox = $this->options['colorbox'];
|
1202 |
+
$autoplay = $this->options['autoplay'];
|
1203 |
+
$autoplay_first = $this->options['autoplay_first'];
|
1204 |
+
$loop = $this->options['loop'];
|
1205 |
+
|
1206 |
+
$video_url = "http://player.vimeo.com/video/$file";
|
1207 |
+
|
1208 |
+
if ( $context == 'post' && $autoplay_first && ! $this->first ) {
|
1209 |
+
if ( is_single() ) {
|
1210 |
+
$video_url .= "?autoplay=1";
|
1211 |
+
} elseif ( $this->first_post_on_archive ) {
|
1212 |
+
$video_url .= "?autoplay=1";
|
1213 |
+
}
|
1214 |
+
if ( $loop ) {
|
1215 |
+
$video_url .= "&loop=1";
|
1216 |
+
}
|
1217 |
+
$this->first = true;
|
1218 |
+
} else if ( ( $context == 'post' && $autoplay && ! $autoplay_first ) || ( $context == 'excerpt' && $autoplay ) ) {
|
1219 |
+
if ( is_single() ) {
|
1220 |
+
$video_url .= "?autoplay=1";
|
1221 |
+
} elseif ( $this->first_post_on_archive ) {
|
1222 |
+
$video_url .= "?autoplay=1";
|
1223 |
+
}
|
1224 |
+
if ( $loop ) {
|
1225 |
+
$video_url .= "&loop=1";
|
1226 |
+
}
|
1227 |
+
} else {
|
1228 |
+
if ( $loop ) {
|
1229 |
+
$video_url .= "?loop=1";
|
1230 |
+
}
|
1231 |
+
}
|
1232 |
+
|
1233 |
+
if ( ( ( is_home() || is_front_page() || is_archive() ) && $context == 'post' && $thumb == 'on' ) || ( $context == 'thumb' ) || ( $context == 'excerpt' && $excerpt == 'thm' ) ) {
|
1234 |
+
$thumbs = unserialize(file_get_contents("http://vimeo.com/api/v2/video/$file.php"));
|
1235 |
+
$img_url = htmlspecialchars($thumbs[0]['thumbnail_large']);
|
1236 |
+
if ( $context == 'excerpt' && $excerpt == 'thm' ) {
|
1237 |
+
global $post;
|
1238 |
+
$post_url = get_permalink( $post->ID );
|
1239 |
+
$yte_tag = <<<EOT
|
1240 |
+
<a href="$post_url"><img src="$img_url" height="$height" width="$width" /></a>
|
1241 |
+
EOT;
|
1242 |
+
} else {
|
1243 |
+
$yte_tag = <<<EOT
|
1244 |
+
<img src="$img_url" height="$height" width="$width" />
|
1245 |
+
EOT;
|
1246 |
+
}
|
1247 |
+
}
|
1248 |
+
else if ( $context == 'post' && $colorbox == 'on' ) {
|
1249 |
+
$thumbs = unserialize( file_get_contents( "http://vimeo.com/api/v2/video/$file.php" ) );
|
1250 |
+
$img_url = htmlspecialchars( $thumbs[0]['thumbnail_large'] );
|
1251 |
+
$yte_tag = <<<EOT
|
1252 |
+
<a class="colorbox_video" href="$video_url"><img width="$width" height="$height" src="$img_url" /></a>
|
1253 |
+
EOT;
|
1254 |
+
} else {
|
1255 |
+
$yte_tag = <<<EOT
|
1256 |
+
<iframe src="$video_url" width="$width" height="$height" frameborder="0"></iframe>
|
1257 |
+
EOT;
|
1258 |
+
}
|
1259 |
+
|
1260 |
+
return str_replace( '{video}', $yte_tag, html_entity_decode( $template ) );
|
1261 |
+
}
|
1262 |
+
|
1263 |
+
function tag_liveleak( $context, $file, $high = 'v', $side = 0 ) {
|
1264 |
+
$width = ( $context == 'excerpt' || $context == 'side' ) ?
|
1265 |
+
$this->options['widthside'] :
|
1266 |
+
( $high ? $this->options['widthhq'] : $this->options['width'] );
|
1267 |
+
|
1268 |
+
$height = ( $context == 'excerpt' || $context == 'side' ) ?
|
1269 |
+
$this->options['heightside'] :
|
1270 |
+
( $high ? $this->options['heighthq'] : $this->options['height'] );
|
1271 |
+
|
1272 |
+
if ( ! $width ) {
|
1273 |
+
$width = ! ( $high == 'v' ) ? 480 : 425 ;
|
1274 |
+
}
|
1275 |
+
|
1276 |
+
if ( ! $height ) {
|
1277 |
+
$height = ! ( $high == 'v' ) ? 360 : 344;
|
1278 |
+
}
|
1279 |
+
|
1280 |
+
$template = trim($this->options['template']) == '' ? '{video}' : $this->options['template'];
|
1281 |
+
$thumb = $this->options['thumb'];
|
1282 |
+
$colorbox = $this->options['colorbox'];
|
1283 |
+
$excerpt = $this->options['excerpt'];
|
1284 |
+
|
1285 |
+
if ( ( ( is_home() || is_front_page() || is_archive() ) && $context == 'post' && $thumb == 'on' ) || ( $context == 'thumb' ) || ( $context == 'excerpt' && $excerpt == 'thm' ) ) {
|
1286 |
+
$img_url = htmlspecialchars( $this->plugin_url . '/img/default.jpg' );
|
1287 |
+
if ( $context == 'excerpt' && $excerpt == 'thm' ) {
|
1288 |
+
global $post;
|
1289 |
+
$post_url = get_permalink( $post->ID );
|
1290 |
+
$yte_tag = <<<EOT
|
1291 |
+
<a href="$post_url"><img src="$img_url" height="$height" width="$width" /></a>
|
1292 |
+
EOT;
|
1293 |
+
} else {
|
1294 |
+
$yte_tag = <<<EOT
|
1295 |
+
<img src="$img_url" height="$height" width="$width" />
|
1296 |
+
EOT;
|
1297 |
+
}
|
1298 |
+
} else if ( $context == 'post' && $colorbox == 'on' ) {
|
1299 |
+
$img_url = htmlspecialchars( $this->plugin_url . '/img/default.jpg' );
|
1300 |
+
$yte_tag = <<<EOT
|
1301 |
+
<a class="colorbox_video" href="http://www.liveleak.com/e/$file"><img width="$width" height="$height" src="$img_url" /></a></span>
|
1302 |
+
EOT;
|
1303 |
+
} else {
|
1304 |
+
$yte_tag = <<<EOT
|
1305 |
+
<object width="$width" height="$height"><param name="movie" value="http://www.liveleak.com/e/$file"></param><param name="wmode" value="transparent"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.liveleak.com/e/$file" type="application/x-shockwave-flash" wmode="transparent" allowscriptaccess="always" width="$width" height="$height"></embed></object>
|
1306 |
+
EOT;
|
1307 |
+
}
|
1308 |
+
|
1309 |
+
return str_replace( '{video}', $yte_tag, html_entity_decode( $template ) );
|
1310 |
+
}
|
1311 |
+
|
1312 |
+
function tag_facebook( $context, $file, $high = 'v', $side = 0 ) {
|
1313 |
+
$width = ( $context == 'excerpt' || $context == 'side' ) ?
|
1314 |
+
$this->options['widthside'] :
|
1315 |
+
( $high ? $this->options['widthhq'] : $this->options['width'] );
|
1316 |
+
|
1317 |
+
$height = ( $context == 'excerpt' || $context == 'side' ) ?
|
1318 |
+
$this->options['heightside'] :
|
1319 |
+
( $high ? $this->options['heighthq'] : $this->options['height'] );
|
1320 |
+
|
1321 |
+
if ( ! $width ) {
|
1322 |
+
$width = ! ( $high == 'v' ) ? 480 : 425 ;
|
1323 |
+
}
|
1324 |
+
|
1325 |
+
if ( ! $height ) {
|
1326 |
+
$height = ! ( $high == 'v' ) ? 360 : 344;
|
1327 |
+
}
|
1328 |
+
|
1329 |
+
$template = trim($this->options['template']) == '' ? '{video}' : $this->options['template'];
|
1330 |
+
$thumb = $this->options['thumb'];
|
1331 |
+
$colorbox = $this->options['colorbox'];
|
1332 |
+
$excerpt = $this->options['excerpt'];
|
1333 |
+
|
1334 |
+
if ( ( ( is_home() || is_front_page() || is_archive() ) && $context == 'post' && $thumb == 'on' ) || ( $context == 'thumb' ) || ( $context == 'excerpt' && $excerpt == 'thm' ) ) {
|
1335 |
+
$img_url = htmlspecialchars( $this->plugin_url . '/img/default.jpg' );
|
1336 |
+
if ( $context == 'excerpt' && $excerpt == 'thm' ) {
|
1337 |
+
global $post;
|
1338 |
+
$post_url = get_permalink( $post->ID );
|
1339 |
+
$yte_tag = <<<EOT
|
1340 |
+
<a href="$post_url"><img src="$img_url" height="$height" width="$width" /></a>
|
1341 |
+
EOT;
|
1342 |
+
} else {
|
1343 |
+
$yte_tag = <<<EOT
|
1344 |
+
<img src="$img_url" height="$height" width="$width" />
|
1345 |
+
EOT;
|
1346 |
+
}
|
1347 |
+
} else if ( $context == 'post' && $colorbox == 'on' ) {
|
1348 |
+
$img_url = htmlspecialchars( $this->plugin_url . '/img/default.jpg' );
|
1349 |
+
$yte_tag = <<<EOT
|
1350 |
+
<a class="colorbox_video" href="http://www.facebook.com/v/$file"><img width="$width" height="$height" src="$img_url" /></a></span>
|
1351 |
+
EOT;
|
1352 |
+
} else {
|
1353 |
+
$yte_tag = <<<EOT
|
1354 |
+
<object width="$width" height="$height"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" />
|
1355 |
+
<param name="movie" value="http://www.facebook.com/v/$file" /><embed src="http://www.facebook.com/v/$file" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="$width" height="$height"></embed></object>
|
1356 |
+
EOT;
|
1357 |
+
}
|
1358 |
+
|
1359 |
+
return str_replace( '{video}', $yte_tag, html_entity_decode( $template ) );
|
1360 |
+
}
|
1361 |
+
|
1362 |
+
function install() {
|
1363 |
+
add_action( 'widgets_init', array( $this, 'load_widgets' ) );
|
1364 |
+
|
1365 |
+
if ( get_option( $this->key ) ) {
|
1366 |
+
$this->options = $this->get_options();
|
1367 |
+
}
|
1368 |
+
}
|
1369 |
+
|
1370 |
+
// Handle our options
|
1371 |
+
function get_options() {
|
1372 |
+
$options = array(
|
1373 |
+
'posts' => 'on',
|
1374 |
+
'comments' => 'off',
|
1375 |
+
'img' => 'off',
|
1376 |
+
'width' => 425,
|
1377 |
+
'height' => 344,
|
1378 |
+
'widthhq' => 480,
|
1379 |
+
'heighthq' => 295,
|
1380 |
+
'widthside' => 200,
|
1381 |
+
'heightside' => 167,
|
1382 |
+
'rel' => 1,
|
1383 |
+
'link' => 'on',
|
1384 |
+
'valid' => 'off',
|
1385 |
+
'search' => 'off',
|
1386 |
+
'info' => 'on',
|
1387 |
+
'ann' => 'on',
|
1388 |
+
'template' => '{video}',
|
1389 |
+
'autoplay' => 0,
|
1390 |
+
'autoplay_first' => 0,
|
1391 |
+
'privacy' => 0,
|
1392 |
+
'wtext' => '',
|
1393 |
+
'wtitle' => '',
|
1394 |
+
'tag' => '',
|
1395 |
+
'iframe' => 'on',
|
1396 |
+
'http' => 'off',
|
1397 |
+
'www' => 'off',
|
1398 |
+
'loop' => 0,
|
1399 |
+
'thumb' => 'off',
|
1400 |
+
'colorbox' => 'off',
|
1401 |
+
'colorbox_theme' => 1,
|
1402 |
+
'excerpt' => 'not',
|
1403 |
+
'logoless' => 'on',
|
1404 |
+
'wiziapp' => 'off',
|
1405 |
+
'theme' => 'dark'
|
1406 |
+
);
|
1407 |
+
$saved = get_option( $this->key );
|
1408 |
+
|
1409 |
+
if ( ! empty( $saved ) ) {
|
1410 |
+
foreach ( $saved as $key => $option ) {
|
1411 |
+
$options[$key] = $option;
|
1412 |
+
}
|
1413 |
+
}
|
1414 |
+
|
1415 |
+
if ( $saved != $options ) {
|
1416 |
+
update_option( $this->key, $options );
|
1417 |
+
}
|
1418 |
+
|
1419 |
+
return $options;
|
1420 |
+
}
|
1421 |
+
|
1422 |
+
function load_widgets() {
|
1423 |
+
register_widget( 'SmartYouTube_Widget' );
|
1424 |
+
}
|
1425 |
+
|
1426 |
+
/**
|
1427 |
+
* Gets plugin info from WordPress Codex repo
|
1428 |
+
* @return mixed
|
1429 |
+
*/
|
1430 |
+
function get_info() {
|
1431 |
+
$checkfile = 'http://svn.wp-plugins.org/smart-youtube/trunk/smartyoutube.chk';
|
1432 |
+
|
1433 |
+
$status = array();
|
1434 |
+
|
1435 |
+
return $status; //???
|
1436 |
+
|
1437 |
+
$vcheck = wp_remote_fopen( $checkfile );
|
1438 |
+
|
1439 |
+
if ( $vcheck ) {
|
1440 |
+
$version = $this->local_version;
|
1441 |
+
|
1442 |
+
$status = explode( '@', $vcheck );
|
1443 |
+
return $status;
|
1444 |
+
}
|
1445 |
+
}
|
1446 |
+
}
|
1447 |
+
|
1448 |
+
class SmartYouTube_Widget extends WP_Widget {
|
1449 |
+
function SmartYouTube_Widget() {
|
1450 |
+
$widget_ops = array( 'classname' => 'smart-youtube', 'description' => 'A widget which dispalys some video from Youtube.' );
|
1451 |
+
$control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'smart-youtube' );
|
1452 |
+
$this->WP_Widget( 'smart-youtube', 'Smart Youtube', $widget_ops, $control_ops );
|
1453 |
+
}
|
1454 |
+
|
1455 |
+
function widget( $args, $instance ) {
|
1456 |
+
extract( $args );
|
1457 |
+
$text = smart_youtube_check( $instance['text'], 1 );
|
1458 |
+
$title = $instance['title'];
|
1459 |
+
|
1460 |
+
echo
|
1461 |
+
$before_widget,
|
1462 |
+
$before_title, $title, $after_title,
|
1463 |
+
$text,
|
1464 |
+
$after_widget;
|
1465 |
+
}
|
1466 |
+
|
1467 |
+
function update( $new_instance, $old_instance ) {
|
1468 |
+
$instance = $old_instance;
|
1469 |
+
|
1470 |
+
$instance['text'] = strip_tags( $new_instance['text'] );
|
1471 |
+
$instance['title'] = strip_tags( $new_instance['title'] );
|
1472 |
+
return $instance;
|
1473 |
+
}
|
1474 |
+
|
1475 |
+
function form( $instance ) {
|
1476 |
+
$defaults = array( 'title' => 'Smart Youtube Widget', 'text' => '' );
|
1477 |
+
$instance = wp_parse_args( ( array )$instance, $defaults );
|
1478 |
+
?>
|
1479 |
+
<?php _e('Title:', 'smart-youtube'); ?><br /><input type="text" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" /><br />
|
1480 |
+
<?php _e('Insert HTML code below. In addition to normal text you may use httpv, httpvh and httpvhd links just like in your posts.'); ?><br />
|
1481 |
+
<textarea id="<?php echo $this->get_field_id( 'text' ); ?>" name="<?php echo $this->get_field_name( 'text' ); ?>" rows="10" cols="16" class="widefat"><?php echo $instance['text']; ?></textarea>
|
1482 |
+
<?php
|
1483 |
+
}
|
1484 |
+
}
|
1485 |
+
|
1486 |
+
function smart_youtube_check( $the_content, $side = 0 ) {
|
1487 |
+
global $smart_youtube_pro;
|
1488 |
+
return $smart_youtube_pro->check( $the_content, $side );
|
1489 |
+
}
|
1490 |
+
|
1491 |
+
function syt_show_thumb( $post_id ) {
|
1492 |
+
$p = get_post( $post_id );
|
1493 |
+
$content = $p->post_content;
|
1494 |
+
|
1495 |
+
preg_match_all( "/(http(v|vh|vhd)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?youtube\.com\/watch(\?v\=|\/v\/|#!v=)([a-zA-Z0-9\-\_]{11})([^<\s]*)/", $content, $matches['youtube.com'], PREG_SET_ORDER );
|
1496 |
+
preg_match_all( "/(http(v|vh|vhd)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?youtu\.be\/([a-zA-Z0-9\-\_]{11})/", $content, $matches['youtu.be'], PREG_SET_ORDER );
|
1497 |
+
preg_match_all( "/(http(v|vh|vhd)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?metacafe\.com\/watch\/([a-zA-Z0-9\-\_]{7})\/([^<^\/\s]*)([\/])?/", $content, $matches['metacafe.com'], PREG_SET_ORDER );
|
1498 |
+
preg_match_all( "/(http(v|vh|vhd)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?vimeo\.com\/([a-zA-Z0-9\-\_]{8})([\/])?/", $content, $matches['vimeo.com'], PREG_SET_ORDER );
|
1499 |
+
preg_match_all( "/(http(v|vh|vhd)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?liveleak\.com\/view(\?i\=)([a-zA-Z0-9\-\_]*)/", $content, $matches['liveleak.com'], PREG_SET_ORDER );
|
1500 |
+
preg_match_all( "/(http(v|vh|vhd)?:\/\/)?([a-zA-Z0-9\-\_]+\.|)?facebook\.com\/video\/video.php\?v\=([a-zA-Z0-9\-\_]*)/", $content, $matches['facebook.com'], PREG_SET_ORDER );
|
1501 |
+
|
1502 |
+
global $smart_youtube_pro;
|
1503 |
+
|
1504 |
+
if ( isset( $matches['youtube.com'][0] ) ) {
|
1505 |
+
if ( ( $matches['youtube.com'][0][1] == 'http://' && $smart_youtube_pro->options['http'] == 'on' ) || ( $matches['youtube.com'][0][1] == '' && $smart_youtube_pro->options['www'] == 'on' ) ) {
|
1506 |
+
$matches['youtube.com'][0][0] = str_replace( $matches['youtube.com'][0][0], $smart_youtube_pro->tag_youtube( 'excerpt', $matches['youtube.com'][0][5], 'v', $matches['youtube.com'][0][6] ), $matches['youtube.com'][0][0] );
|
1507 |
+
} else if ( $matches['youtube.com'][0][2] == 'v' || $matches['youtube.com'][0][2] == 'vh' || $matches['youtube.com'][0][2] == 'vhd' ) {
|
1508 |
+
$matches['youtube.com'][0][0] = str_replace( $matches['youtube.com'][0][0], $smart_youtube_pro->tag_youtube( 'excerpt', $matches['youtube.com'][0][5], $matches['youtube.com'][0][2], $matches['youtube.com'][0][6] ), $matches['youtube.com'][0][0] );
|
1509 |
+
}
|
1510 |
+
$result = $matches['youtube.com'][0][0];
|
1511 |
+
} else if ( isset( $matches['youtu.be'][0] ) ) {
|
1512 |
+
if ( ( $matches['youtu.be'][0][1] == 'http://' && $smart_youtube_pro->options['http'] == 'on' ) || ( $matches['youtu.be'][0][1] == '' && $smart_youtube_pro->options['www'] == 'on' ) ) {
|
1513 |
+
$matches['youtu.be'][0][0] = str_replace( $matches['youtu.be'][0][0], $smart_youtube_pro->tag_youtube( 'excerpt', $matches['youtu.be'][0][4], 'v' ), $matches['youtu.be'][0][0] );
|
1514 |
+
} else if ( $matches['youtu.be'][0][2] == 'v' || $matches['youtu.be'][0][2] == 'vh' || $matches['youtu.be'][0][2] == 'vhd' ) {
|
1515 |
+
$matches['youtu.be'][0][0] = str_replace( $matches['youtu.be'][0][0], $smart_youtube_pro->tag_youtube( 'excerpt', $matches['youtu.be'][0][4], $matches['youtu.be'][0][2]), $matches['youtu.be'][0][0] );
|
1516 |
+
}
|
1517 |
+
$result = $matches['youtu.be'][0][0];
|
1518 |
+
} else if ( isset( $matches['metacafe.com'][0] ) ) {
|
1519 |
+
if ( ( $matches['metacafe.com'][0][1] == 'http://' && $smart_youtube_pro->options['http'] == 'on' ) || ( $matches['metacafe.com'][0][1] == '' && $smart_youtube_pro->options['www'] == 'on' ) ) {
|
1520 |
+
$matches['metacafe.com'][0][0] = str_replace( $matches['metacafe.com'][0][0], $smart_youtube_pro->tag_metacafe( 'excerpt', $matches['metacafe.com'][0][4], 'v', $matches['metacafe.com'][0][5] ), $matches['metacafe.com'][0][0] );
|
1521 |
+
} else if ( $matches['metacafe.com'][0][2] == 'v' || $matches['metacafe.com'][0][2] == 'vh' || $matches['metacafe.com'][0][2] == 'vhd' ) {
|
1522 |
+
$matches['metacafe.com'][0][0] = str_replace( $matches['metacafe.com'][0][0], $smart_youtube_pro->tag_metacafe( 'excerpt', $matches['metacafe.com'][0][4], $matches['metacafe.com'][0][2], $matches['metacafe.com'][0][5] ), $matches['metacafe.com'][0][0] );
|
1523 |
+
}
|
1524 |
+
$result = $matches['metacafe.com'][0][0];
|
1525 |
+
} else if ( isset($matches['vimeo.com'][0] ) ) {
|
1526 |
+
if ( ( $matches['vimeo.com'][0][1] == 'http://' && $smart_youtube_pro->options['http'] == 'on' ) || ( $matches['vimeo.com'][0][1] == '' && $smart_youtube_pro->options['www'] == 'on' ) ) {
|
1527 |
+
$matches['vimeo.com'][0][0] = str_replace( $matches['vimeo.com'][0][0], $smart_youtube_pro->tag_vimeo( 'excerpt', $matches['vimeo.com'][0][4], 'v' ), $matches['vimeo.com'][0][0] );
|
1528 |
+
}
|
1529 |
+
else if ( $matches['vimeo.com'][0][2] == 'v' || $matches['vimeo.com'][0][2] == 'vh' || $matches['vimeo.com'][0][2] == 'vhd' ) {
|
1530 |
+
$matches['vimeo.com'][0][0] = str_replace( $matches['vimeo.com'][0][0], $smart_youtube_pro->tag_vimeo( 'excerpt', $matches['vimeo.com'][0][4], $matches['vimeo.com'][0][2] ), $matches['vimeo.com'][0][0] );
|
1531 |
+
}
|
1532 |
+
$result = $matches['vimeo.com'][0][0];
|
1533 |
+
} else if ( isset( $matches['liveleak.com'][0] ) ) {
|
1534 |
+
if ( ( $matches['liveleak.com'][0][1] == 'http://' && $smart_youtube_pro->options['http'] == 'on' ) || ( $matches['liveleak.com'][0][1] == '' && $smart_youtube_pro->options['www'] == 'on' ) ) {
|
1535 |
+
$matches['liveleak.com'][0][0] = str_replace( $matches['liveleak.com'][0][0], $smart_youtube_pro->tag_liveleak( 'excerpt', $matches['liveleak.com'][0][4], 'v' ), $matches['liveleak.com'][0][0] );
|
1536 |
+
} else if ( $matches['liveleak.com'][0][2] == 'v' || $matches['liveleak.com'][0][2] == 'vh' || $matches['liveleak.com'][0][2] == 'vhd' ) {
|
1537 |
+
$matches['liveleak.com'][0][0] = str_replace( $matches['liveleak.com'][0][0], $smart_youtube_pro->tag__liveleak( 'excerpt', $matches['liveleak.com'][0][4], $matches['liveleak.com'][0][2] ), $matches['liveleak.com'][0][0] );
|
1538 |
+
}
|
1539 |
+
$result = $matches['liveleak.com'][0][0];
|
1540 |
+
} else if ( isset( $matches['facebook.com'][0] ) ) {
|
1541 |
+
if ( ( $matches['facebook.com'][0][1] == 'http://' && $smart_youtube_pro->options['http'] == 'on' ) || ( $matches['facebook.com'][0][1] == '' && $smart_youtube_pro->options['www'] == 'on' ) ) {
|
1542 |
+
$matches['facebook.com'][0][0] = str_replace( $matches['facebook.com'][0][0], $smart_youtube_pro->tag_facebook( 'excerpt', $matches['facebook.com'][0][4], 'v' ), $matches['facebook.com'][0][0] );
|
1543 |
+
} else if ( $matches['facebook.com'][0][2] == 'v' || $matches['facebook.com'][0][2] == 'vh' || $matches['facebook.com'][0][2] == 'vhd' ) {
|
1544 |
+
$matches['facebook.com'][0][0] = str_replace( $matches['facebook.com'][0][0], $smart_youtube_pro->tag_facebook( 'excerpt', $matches['facebook.com'][0][4], $matches['facebook.com'][0][2] ), $matches['facebook.com'][0][0] );
|
1545 |
+
}
|
1546 |
+
$result = $matches['facebook.com'][0][0];
|
1547 |
+
} else {
|
1548 |
+
$width = $smart_youtube_pro->options['width'];
|
1549 |
+
$height = $smart_youtube_pro->options['height'];
|
1550 |
+
|
1551 |
+
$img_url = htmlspecialchars( $smart_youtube_pro->plugin_url . '/img/default.jpg' );
|
1552 |
+
$post_url = get_permalink( $post->ID );
|
1553 |
+
$yte_tag = <<<EOT
|
1554 |
+
<a href="$post_url">
|
1555 |
+
<img src="$img_url" height="$height" width="$width" />
|
1556 |
+
</a>
|
1557 |
+
EOT;
|
1558 |
+
$result = str_replace( '{video}', $yte_tag, html_entity_decode( $template ) );
|
1559 |
+
}
|
1560 |
+
if ( isset( $result ) ) {
|
1561 |
+
return $result;
|
1562 |
+
}
|
1563 |
+
}
|
1564 |
+
?>
|
|
|
|