Version Description
Download this release
Release Info
| Developer | freediver |
| Plugin | |
| Version | 3.0 |
| Comparing to | |
| See all releases | |
Code changes from version 2.8.1 to 3.0
- readme.txt +3 -0
- smartyoutube.php +55 -20
readme.txt
CHANGED
|
@@ -34,6 +34,9 @@ Main Features:
|
|
| 34 |
|
| 35 |
Change Log:
|
| 36 |
|
|
|
|
|
|
|
|
|
|
| 37 |
v2.8.1
|
| 38 |
- Added option to remove Annotations
|
| 39 |
|
| 34 |
|
| 35 |
Change Log:
|
| 36 |
|
| 37 |
+
v3.0
|
| 38 |
+
- Added video template, option to set sidebar video size, fixed sidebar widget code, fixed video syntax issue
|
| 39 |
+
|
| 40 |
v2.8.1
|
| 41 |
- Added option to remove Annotations
|
| 42 |
|
smartyoutube.php
CHANGED
|
@@ -4,10 +4,11 @@ Plugin Name: Smart Youtube
|
|
| 4 |
Plugin URI: http://www.prelovac.com/vladimir/wordpress-plugins/smart-youtube
|
| 5 |
Description: Insert YouTube videos in posts, comments and RSS feeds with ease and full customization.
|
| 6 |
Author: Vladimir Prelovac
|
| 7 |
-
Version:
|
| 8 |
Author URI: http://www.prelovac.com/vladimir/
|
| 9 |
|
| 10 |
Updates:
|
|
|
|
| 11 |
2.8.1 - Display Annotioans added as option
|
| 12 |
2.8 - Support for playlists
|
| 13 |
2.7.5 - Plugin url updated to use WP_PLUGIN_URL
|
|
@@ -83,8 +84,7 @@ function yte_options_page()
|
|
| 83 |
// If form was submitted
|
| 84 |
if (isset($_POST['submitted']))
|
| 85 |
{
|
| 86 |
-
check_admin_referer('smart-youtube');
|
| 87 |
-
|
| 88 |
$disp_img = !isset($_POST['disp_img'])? 'off': 'on';
|
| 89 |
$disp_link = !isset($_POST['disp_link'])? 'off': 'on';
|
| 90 |
$disp_search = !isset($_POST['disp_search'])? 'off': 'on';
|
|
@@ -110,6 +110,12 @@ function yte_options_page()
|
|
| 110 |
|
| 111 |
update_option('smart_yt_widthhq', $disp_widthhq);
|
| 112 |
update_option('smart_yt_heighthq', $disp_heighthq);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
|
| 114 |
$disp_rel = !isset($_POST['embedRel'])? '1': $_POST['embedRel'];
|
| 115 |
|
|
@@ -133,6 +139,8 @@ function yte_options_page()
|
|
| 133 |
update_option('smart_yt_posts', $disp_posts);
|
| 134 |
update_option('smart_yt_comments', $disp_comments);
|
| 135 |
|
|
|
|
|
|
|
| 136 |
|
| 137 |
|
| 138 |
|
|
@@ -159,6 +167,9 @@ function yte_options_page()
|
|
| 159 |
$disp_widthhq = get_option('smart_yt_widthhq');
|
| 160 |
$disp_heighthq = get_option('smart_yt_heighthq');
|
| 161 |
|
|
|
|
|
|
|
|
|
|
| 162 |
$disp_autoplay = (get_option('smart_yt_autoplay')=='1') ? 'checked':'';
|
| 163 |
|
| 164 |
|
|
@@ -172,7 +183,7 @@ function yte_options_page()
|
|
| 172 |
$disp_posts = (get_option('smart_yt_posts')=='on') ? 'checked' :'' ;
|
| 173 |
$disp_comments = (get_option('smart_yt_comments')=='on') ? 'checked':'';
|
| 174 |
|
| 175 |
-
|
| 176 |
|
| 177 |
|
| 178 |
if ($disp_width=="")
|
|
@@ -310,6 +321,7 @@ text-decoration:none;
|
|
| 310 |
$imgpath=$wp_yte_plugin_url.'/i';
|
| 311 |
$actionurl=$_SERVER['REQUEST_URI'];
|
| 312 |
$nonce=wp_create_nonce( 'smart-youtube');
|
|
|
|
| 313 |
// Configuration Page
|
| 314 |
|
| 315 |
|
|
@@ -327,7 +339,7 @@ text-decoration:none;
|
|
| 327 |
<img src="$imgpath/rate.png"><a style="text-decoration:none;" href="http://wordpress.org/extend/plugins/smart-youtube/"> Rate this plugin</a><br /><br />
|
| 328 |
<img src="$imgpath/help.png"><a style="text-decoration:none;" href="http://www.prelovac.com/vladimir/forum"> Support and Help</a><br />
|
| 329 |
<p >
|
| 330 |
-
<a style="text-decoration:none;" href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2567254"><img src="$imgpath/paypal.gif"></a>
|
| 331 |
</p><br />
|
| 332 |
<img src="$imgpath/more.png"><a style="text-decoration:none;" href="http://www.prelovac.com/vladimir/wordpress-plugins"> Cool WordPress Plugins</a><br /><br />
|
| 333 |
<img src="$imgpath/twit.png"><a style="text-decoration:none;" href="http://twitter.com/vprelovac"> Follow updates on Twitter</a><br /><br />
|
|
@@ -340,8 +352,8 @@ text-decoration:none;
|
|
| 340 |
<div class="dbx-content">
|
| 341 |
<form name="yteform" action="$action_url" method="post">
|
| 342 |
<input type="hidden" name="submitted" value="1" />
|
| 343 |
-
<input type="hidden" id="_wpnonce" name="_wpnonce" value="$nonce" />
|
| 344 |
-
|
| 345 |
|
| 346 |
<p>To use the video in your posts, paste YouTube video URL with <strong>httpv://</strong> (notice the 'v'). </p>
|
| 347 |
<p><strong>Important:</strong> The URL should just be copied into your post normally and the letter 'v' added, do not create a clickable link!</p>
|
|
@@ -367,14 +379,20 @@ text-decoration:none;
|
|
| 367 |
|
| 368 |
|
| 369 |
<br><br><strong>Video Appearence</strong><br><br>
|
|
|
|
|
|
|
|
|
|
| 370 |
|
| 371 |
<p>Video width and height in normal mode. Default is 425x344.</p>
|
| 372 |
<input id="disp_width" name="disp_width" value="$disp_width" size="7"/>x<input id="disp_height" name="disp_height" value="$disp_height" size="7" /><br>
|
| 373 |
|
| 374 |
-
|
| 375 |
<p>Video width and height in <strong>high quality</strong> mode. Default is 480x360.</p>
|
| 376 |
<input id="disp_widthhq" name="disp_widthhq" value="$disp_widthhq" size="7" />x<input id="disp_heighthq" name="disp_heighthq" value="$disp_heighthq" size="7" /><br><br>
|
| 377 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 378 |
<br />
|
| 379 |
<div id="watch-customize-embed-form">
|
| 380 |
<input type="radio" $disp_rel id="embedCustomization1" name="embedRel" value="1"/>
|
|
@@ -444,9 +462,10 @@ add_action('admin_menu', 'yte_add_pages');
|
|
| 444 |
|
| 445 |
|
| 446 |
|
| 447 |
-
function yte_tag($file, $high='v', $time = "") {
|
| 448 |
global $CustomColors;
|
| 449 |
|
|
|
|
| 450 |
$playlist=0;
|
| 451 |
|
| 452 |
$disp_rel = get_option('smart_yt_rel');
|
|
@@ -456,6 +475,7 @@ global $CustomColors;
|
|
| 456 |
$disp_search=(get_option('smart_yt_search')=='on') ? "1":"0";
|
| 457 |
$disp_info=(get_option('smart_yt_info')=='on') ? "&showinfo=0":"";
|
| 458 |
$disp_ann=(get_option('smart_yt_ann')=='on') ? "&iv_load_policy=3":"";
|
|
|
|
| 459 |
|
| 460 |
|
| 461 |
$valid=get_option('smart_yt_valid');
|
|
@@ -470,8 +490,10 @@ global $CustomColors;
|
|
| 470 |
default : $high=""; break;
|
| 471 |
}
|
| 472 |
|
| 473 |
-
$width=$high ? get_option('smart_yt_widthhq') : get_option('smart_yt_width');
|
| 474 |
-
$height=$high ? get_option('smart_yt_heighthq') : get_option('smart_yt_height');
|
|
|
|
|
|
|
| 475 |
|
| 476 |
if ($width=="")
|
| 477 |
$width=$high!="" ? "480" : "425" ;
|
|
@@ -507,26 +529,27 @@ if (is_feed())
|
|
| 507 |
// if ( (get_option('smart_yt_link')=='off') && (get_option('smart_yt_img')=='off') )
|
| 508 |
// $yte_tag='http://www.youtube.com/watch?v='.$file;
|
| 509 |
}
|
|
|
|
| 510 |
|
| 511 |
-
return $
|
| 512 |
}
|
| 513 |
|
| 514 |
-
function yte_check($the_content) {
|
| 515 |
if(strpos($the_content, "httpv")!==FALSE ) {
|
| 516 |
|
| 517 |
-
$char_codes = array('×');
|
| 518 |
-
$replacements = array("x");
|
| 519 |
-
|
| 520 |
|
| 521 |
preg_match_all("/http(v|vh|vhd):\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/)([a-zA-Z0-9\-\_]{11})([^<\s]*)/", $the_content, $matches, PREG_SET_ORDER);
|
| 522 |
foreach($matches as $match) {
|
| 523 |
|
| 524 |
-
$the_content = preg_replace("/http".$match[1].":\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/)([a-zA-Z0-9\-\_]{11})([^\s<]*)/", yte_tag($match[4], $match[1], $match[5]), $the_content, 1);
|
| 525 |
}
|
| 526 |
|
| 527 |
preg_match_all("/http(vp):\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/view_play_list(\?p\=|\/v\/)([a-zA-Z0-9\-\_]{16})([^<\s]*)/", $the_content, $matches, PREG_SET_ORDER);
|
| 528 |
foreach($matches as $match) {
|
| 529 |
-
$the_content = preg_replace("/http".$match[1].":\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/view_play_list(\?p\=|\/v\/)([a-zA-Z0-9\-\_]{16})([^\s<]*)/", yte_tag($match[4], $match[1], $match[5]), $the_content, 1);
|
| 530 |
}
|
| 531 |
|
| 532 |
|
|
@@ -555,6 +578,13 @@ function yte_install(){
|
|
| 555 |
add_option('smart_yt_heighthq', '360');
|
| 556 |
}
|
| 557 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 558 |
if(get_option('smart_yt_rel' == '') || !get_option('smart_yt_rel')){
|
| 559 |
add_option('smart_yt_rel', '1');
|
| 560 |
}
|
|
@@ -582,6 +612,11 @@ function yte_install(){
|
|
| 582 |
add_option('smart_yt_ann', 'on');
|
| 583 |
}
|
| 584 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 585 |
// register widget
|
| 586 |
if (function_exists('register_sidebar_widget'))
|
| 587 |
register_sidebar_widget('Smart YouTube', 'yte_widget');
|
|
@@ -607,8 +642,8 @@ function yte_widgetcontrol()
|
|
| 607 |
|
| 608 |
function yte_widget($args = array() )
|
| 609 |
{
|
| 610 |
-
|
| 611 |
-
$text = yte_check(stripslashes(get_option('smart_yt_wtext')));
|
| 612 |
echo $before_widget;
|
| 613 |
echo $text;
|
| 614 |
echo $after_widget;
|
| 4 |
Plugin URI: http://www.prelovac.com/vladimir/wordpress-plugins/smart-youtube
|
| 5 |
Description: Insert YouTube videos in posts, comments and RSS feeds with ease and full customization.
|
| 6 |
Author: Vladimir Prelovac
|
| 7 |
+
Version: 3.0
|
| 8 |
Author URI: http://www.prelovac.com/vladimir/
|
| 9 |
|
| 10 |
Updates:
|
| 11 |
+
3.0 - Added video template, option to set sidebar video size, fixed sidebar widget code, fixed video syntax issue
|
| 12 |
2.8.1 - Display Annotioans added as option
|
| 13 |
2.8 - Support for playlists
|
| 14 |
2.7.5 - Plugin url updated to use WP_PLUGIN_URL
|
| 84 |
// If form was submitted
|
| 85 |
if (isset($_POST['submitted']))
|
| 86 |
{
|
| 87 |
+
check_admin_referer('smart-youtube');
|
|
|
|
| 88 |
$disp_img = !isset($_POST['disp_img'])? 'off': 'on';
|
| 89 |
$disp_link = !isset($_POST['disp_link'])? 'off': 'on';
|
| 90 |
$disp_search = !isset($_POST['disp_search'])? 'off': 'on';
|
| 110 |
|
| 111 |
update_option('smart_yt_widthhq', $disp_widthhq);
|
| 112 |
update_option('smart_yt_heighthq', $disp_heighthq);
|
| 113 |
+
|
| 114 |
+
$disp_widthside = (int) ($_POST['disp_widthside']=="")? '150': $_POST['disp_widthside'];
|
| 115 |
+
$disp_heightside = (int) ($_POST['disp_heightside']=="")? '125': $_POST['disp_heightside'];
|
| 116 |
+
|
| 117 |
+
update_option('smart_yt_widthside', $disp_widthside);
|
| 118 |
+
update_option('smart_yt_heightside', $disp_heightside);
|
| 119 |
|
| 120 |
$disp_rel = !isset($_POST['embedRel'])? '1': $_POST['embedRel'];
|
| 121 |
|
| 139 |
update_option('smart_yt_posts', $disp_posts);
|
| 140 |
update_option('smart_yt_comments', $disp_comments);
|
| 141 |
|
| 142 |
+
$disp_template = !isset($_POST['disp_template'])? '{video}': stripslashes(htmlspecialchars($_POST['disp_template']));
|
| 143 |
+
update_option('smart_yt_template', $disp_template);
|
| 144 |
|
| 145 |
|
| 146 |
|
| 167 |
$disp_widthhq = get_option('smart_yt_widthhq');
|
| 168 |
$disp_heighthq = get_option('smart_yt_heighthq');
|
| 169 |
|
| 170 |
+
$disp_widthside = get_option('smart_yt_widthside');
|
| 171 |
+
$disp_heightside = get_option('smart_yt_heightside');
|
| 172 |
+
|
| 173 |
$disp_autoplay = (get_option('smart_yt_autoplay')=='1') ? 'checked':'';
|
| 174 |
|
| 175 |
|
| 183 |
$disp_posts = (get_option('smart_yt_posts')=='on') ? 'checked' :'' ;
|
| 184 |
$disp_comments = (get_option('smart_yt_comments')=='on') ? 'checked':'';
|
| 185 |
|
| 186 |
+
$disp_template = wp_specialchars(get_option('smart_yt_template'));
|
| 187 |
|
| 188 |
|
| 189 |
if ($disp_width=="")
|
| 321 |
$imgpath=$wp_yte_plugin_url.'/i';
|
| 322 |
$actionurl=$_SERVER['REQUEST_URI'];
|
| 323 |
$nonce=wp_create_nonce( 'smart-youtube');
|
| 324 |
+
$example=htmlentities('<div style="float:left;margin-right: 10px;">{video}</div>');
|
| 325 |
// Configuration Page
|
| 326 |
|
| 327 |
|
| 339 |
<img src="$imgpath/rate.png"><a style="text-decoration:none;" href="http://wordpress.org/extend/plugins/smart-youtube/"> Rate this plugin</a><br /><br />
|
| 340 |
<img src="$imgpath/help.png"><a style="text-decoration:none;" href="http://www.prelovac.com/vladimir/forum"> Support and Help</a><br />
|
| 341 |
<p >
|
| 342 |
+
<a style="text-decoration:none;" href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2567254&lc=US"><img src="$imgpath/paypal.gif"></a>
|
| 343 |
</p><br />
|
| 344 |
<img src="$imgpath/more.png"><a style="text-decoration:none;" href="http://www.prelovac.com/vladimir/wordpress-plugins"> Cool WordPress Plugins</a><br /><br />
|
| 345 |
<img src="$imgpath/twit.png"><a style="text-decoration:none;" href="http://twitter.com/vprelovac"> Follow updates on Twitter</a><br /><br />
|
| 352 |
<div class="dbx-content">
|
| 353 |
<form name="yteform" action="$action_url" method="post">
|
| 354 |
<input type="hidden" name="submitted" value="1" />
|
| 355 |
+
<input type="hidden" id="_wpnonce" name="_wpnonce" value="$nonce" />
|
| 356 |
+
<h2>Usage</h2>
|
| 357 |
|
| 358 |
<p>To use the video in your posts, paste YouTube video URL with <strong>httpv://</strong> (notice the 'v'). </p>
|
| 359 |
<p><strong>Important:</strong> The URL should just be copied into your post normally and the letter 'v' added, do not create a clickable link!</p>
|
| 379 |
|
| 380 |
|
| 381 |
<br><br><strong>Video Appearence</strong><br><br>
|
| 382 |
+
<p>Video template. Default is just {video}. <br />
|
| 383 |
+
You can try $example if you want the text to wrap around video.</p>
|
| 384 |
+
<textarea cols="50" id="disp_template" name="disp_template">$disp_template</textarea>
|
| 385 |
|
| 386 |
<p>Video width and height in normal mode. Default is 425x344.</p>
|
| 387 |
<input id="disp_width" name="disp_width" value="$disp_width" size="7"/>x<input id="disp_height" name="disp_height" value="$disp_height" size="7" /><br>
|
| 388 |
|
|
|
|
| 389 |
<p>Video width and height in <strong>high quality</strong> mode. Default is 480x360.</p>
|
| 390 |
<input id="disp_widthhq" name="disp_widthhq" value="$disp_widthhq" size="7" />x<input id="disp_heighthq" name="disp_heighthq" value="$disp_heighthq" size="7" /><br><br>
|
| 391 |
|
| 392 |
+
<p>Video width and height in <strong>sidebar</strong> mode (regardless of quality). Default is 150x125.</p>
|
| 393 |
+
<input id="disp_widthside" name="disp_widthside" value="$disp_widthside" size="7" />x<input id="disp_heightside" name="disp_heightside" value="$disp_heightside" size="7" /><br><br>
|
| 394 |
+
|
| 395 |
+
|
| 396 |
<br />
|
| 397 |
<div id="watch-customize-embed-form">
|
| 398 |
<input type="radio" $disp_rel id="embedCustomization1" name="embedRel" value="1"/>
|
| 462 |
|
| 463 |
|
| 464 |
|
| 465 |
+
function yte_tag($file, $high='v', $time = "", $side = 0) {
|
| 466 |
global $CustomColors;
|
| 467 |
|
| 468 |
+
|
| 469 |
$playlist=0;
|
| 470 |
|
| 471 |
$disp_rel = get_option('smart_yt_rel');
|
| 475 |
$disp_search=(get_option('smart_yt_search')=='on') ? "1":"0";
|
| 476 |
$disp_info=(get_option('smart_yt_info')=='on') ? "&showinfo=0":"";
|
| 477 |
$disp_ann=(get_option('smart_yt_ann')=='on') ? "&iv_load_policy=3":"";
|
| 478 |
+
$template=get_option('smart_yt_template');
|
| 479 |
|
| 480 |
|
| 481 |
$valid=get_option('smart_yt_valid');
|
| 490 |
default : $high=""; break;
|
| 491 |
}
|
| 492 |
|
| 493 |
+
$width=$side ? get_option('smart_yt_widthside') : ($high ? get_option('smart_yt_widthhq') : get_option('smart_yt_width'));
|
| 494 |
+
$height=$side ? get_option('smart_yt_heightside') : ($high ? get_option('smart_yt_heighthq') : get_option('smart_yt_height'));
|
| 495 |
+
|
| 496 |
+
|
| 497 |
|
| 498 |
if ($width=="")
|
| 499 |
$width=$high!="" ? "480" : "425" ;
|
| 529 |
// if ( (get_option('smart_yt_link')=='off') && (get_option('smart_yt_img')=='off') )
|
| 530 |
// $yte_tag='http://www.youtube.com/watch?v='.$file;
|
| 531 |
}
|
| 532 |
+
$result= str_replace('{video}', $yte_tag, html_entity_decode($template));
|
| 533 |
|
| 534 |
+
return $result;
|
| 535 |
}
|
| 536 |
|
| 537 |
+
function yte_check($the_content, $side=0) {
|
| 538 |
if(strpos($the_content, "httpv")!==FALSE ) {
|
| 539 |
|
| 540 |
+
$char_codes = array('×','–');
|
| 541 |
+
$replacements = array("x", "--");
|
| 542 |
+
$the_content=str_replace($char_codes, $replacements, $the_content);
|
| 543 |
|
| 544 |
preg_match_all("/http(v|vh|vhd):\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/)([a-zA-Z0-9\-\_]{11})([^<\s]*)/", $the_content, $matches, PREG_SET_ORDER);
|
| 545 |
foreach($matches as $match) {
|
| 546 |
|
| 547 |
+
$the_content = preg_replace("/http".$match[1].":\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/)([a-zA-Z0-9\-\_]{11})([^\s<]*)/", yte_tag($match[4], $match[1], $match[5], $side), $the_content, 1);
|
| 548 |
}
|
| 549 |
|
| 550 |
preg_match_all("/http(vp):\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/view_play_list(\?p\=|\/v\/)([a-zA-Z0-9\-\_]{16})([^<\s]*)/", $the_content, $matches, PREG_SET_ORDER);
|
| 551 |
foreach($matches as $match) {
|
| 552 |
+
$the_content = preg_replace("/http".$match[1].":\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/view_play_list(\?p\=|\/v\/)([a-zA-Z0-9\-\_]{16})([^\s<]*)/", yte_tag($match[4], $match[1], $match[5], $side), $the_content, 1);
|
| 553 |
}
|
| 554 |
|
| 555 |
|
| 578 |
add_option('smart_yt_heighthq', '360');
|
| 579 |
}
|
| 580 |
|
| 581 |
+
if(get_option('smart_yt_widthside' == '') || !get_option('smart_yt_widthside')){
|
| 582 |
+
add_option('smart_yt_widthside', '150');
|
| 583 |
+
}
|
| 584 |
+
if(get_option('smart_yt_heightside' == '') || !get_option('smart_yt_heightside')){
|
| 585 |
+
add_option('smart_yt_heightside', '125');
|
| 586 |
+
}
|
| 587 |
+
|
| 588 |
if(get_option('smart_yt_rel' == '') || !get_option('smart_yt_rel')){
|
| 589 |
add_option('smart_yt_rel', '1');
|
| 590 |
}
|
| 612 |
add_option('smart_yt_ann', 'on');
|
| 613 |
}
|
| 614 |
|
| 615 |
+
if(get_option('smart_yt_template' == '') || !get_option('smart_yt_template')){
|
| 616 |
+
add_option('smart_yt_template', '{video}');
|
| 617 |
+
}
|
| 618 |
+
|
| 619 |
+
|
| 620 |
// register widget
|
| 621 |
if (function_exists('register_sidebar_widget'))
|
| 622 |
register_sidebar_widget('Smart YouTube', 'yte_widget');
|
| 642 |
|
| 643 |
function yte_widget($args = array() )
|
| 644 |
{
|
| 645 |
+
extract ($args);
|
| 646 |
+
$text = yte_check(stripslashes(get_option('smart_yt_wtext')), 1);
|
| 647 |
echo $before_widget;
|
| 648 |
echo $text;
|
| 649 |
echo $after_widget;
|
