Version Description
(2015-04-24) = * Fix: devicesupport workaround strip 1st video from playlist and favourites and apply only for channel
Download this release
Release Info
Developer | urkekg |
Plugin | YouTube Channel |
Version | 2.4.2.1 |
Comparing to | |
See all releases |
Code changes from version 2.4.2 to 2.4.2.1
- readme.txt +5 -1
- youtube-channel.php +24 -20
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
|
4 |
Tags: youtube, channel, playlist, single, widget, widgets, youtube player, flash player, rss, feed, video, thumbnail, embed, sidebar, chromeless, iframe, html5, responsive
|
5 |
Requires at least: 3.9.0
|
6 |
Tested up to: 4.2
|
7 |
-
Stable tag: 2.4.2
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -191,6 +191,10 @@ Modestbranding option does not work for all videos, so a lot of videos will stil
|
|
191 |
Also, even when hidding logo works for your video, on hover or when video is paused in upper right corner will be displayed YouTube link/logo. [Read more here](https://developers.google.com/youtube/player_parameters#modestbranding)
|
192 |
|
193 |
== Changelog ==
|
|
|
|
|
|
|
|
|
194 |
= 2.4.2 (2015-04-22) =
|
195 |
* Fix: Broken layout introduced by missing responsive for embedded playlist, iframe and iframe2
|
196 |
* Fix: Replace amp's with HTML entity in thumbnail link
|
4 |
Tags: youtube, channel, playlist, single, widget, widgets, youtube player, flash player, rss, feed, video, thumbnail, embed, sidebar, chromeless, iframe, html5, responsive
|
5 |
Requires at least: 3.9.0
|
6 |
Tested up to: 4.2
|
7 |
+
Stable tag: 2.4.2.1
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
191 |
Also, even when hidding logo works for your video, on hover or when video is paused in upper right corner will be displayed YouTube link/logo. [Read more here](https://developers.google.com/youtube/player_parameters#modestbranding)
|
192 |
|
193 |
== Changelog ==
|
194 |
+
|
195 |
+
= 2.4.2.1 (2015-04-24) =
|
196 |
+
* Fix: devicesupport workaround strip 1st video from playlist and favourites and apply only for channel
|
197 |
+
|
198 |
= 2.4.2 (2015-04-22) =
|
199 |
* Fix: Broken layout introduced by missing responsive for embedded playlist, iframe and iframe2
|
200 |
* Fix: Replace amp's with HTML entity in thumbnail link
|
youtube-channel.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: YouTube Channel
|
|
4 |
Plugin URI: http://urosevic.net/wordpress/plugins/youtube-channel/
|
5 |
Description: <a href="widgets.php">Widget</a> that display latest video thumbnail, iframe (HTML5 video), object (Flash video) or chromeless video from YouTube Channel or Playlist.
|
6 |
Author: Aleksandar Urošević
|
7 |
-
Version: 2.4.2
|
8 |
Author URI: http://urosevic.net/
|
9 |
*/
|
10 |
// @TODO make FitViedo optional
|
@@ -17,7 +17,7 @@ if ( !class_exists('WPAU_YOUTUBE_CHANNEL') )
|
|
17 |
class WPAU_YOUTUBE_CHANNEL
|
18 |
{
|
19 |
|
20 |
-
public $plugin_version = "2.4.2";
|
21 |
public $plugin_name = "YouTube Channel";
|
22 |
public $plugin_slug = "youtube-channel";
|
23 |
public $plugin_option = "youtube_channel_defaults";
|
@@ -434,7 +434,7 @@ function ytc_mute(event){
|
|
434 |
|
435 |
$output = array();
|
436 |
|
437 |
-
$output[] =
|
438 |
|
439 |
if ( $instance['only_pl'] && $use_res == 2 ) { // print standard playlist
|
440 |
$output = array_merge($output, self::ytc_only_pl($instance));
|
@@ -446,34 +446,35 @@ function ytc_mute(event){
|
|
446 |
elseif ( $maxrnd > 50 ) { $maxrnd = 50; } // max 50
|
447 |
|
448 |
$feed_attr = '?alt=json';
|
449 |
-
$feed_attr .= '&v=2
|
450 |
|
451 |
// select fields
|
452 |
-
$feed_attr .=
|
453 |
|
454 |
if ( !$instance['fixnoitem'] && $use_res != 1 )
|
455 |
$feed_attr .= '&orderby=published';
|
456 |
|
457 |
$getrnd = $instance['getrnd'];
|
458 |
-
if ( $getrnd ) $feed_attr .=
|
459 |
|
460 |
$feed_attr .= '&rel=0';
|
461 |
switch ($use_res) {
|
462 |
case 1: // favorites
|
463 |
-
$feed_url =
|
464 |
break;
|
465 |
case 2: // playlist
|
466 |
$playlist = $this->clean_playlist_id($playlist);
|
467 |
-
$feed_url =
|
468 |
break;
|
469 |
default:
|
470 |
-
$feed_url =
|
471 |
}
|
472 |
|
473 |
// do we need cache?
|
474 |
if ($instance['cache_time'] > 0 ) {
|
475 |
// generate feed cache key for caching time
|
476 |
-
$
|
|
|
477 |
|
478 |
if (!empty($_GET['ytc_force_recache']))
|
479 |
delete_transient($cache_key);
|
@@ -524,7 +525,10 @@ function ytc_mute(event){
|
|
524 |
}
|
525 |
|
526 |
if ($maxitems == 0) {
|
527 |
-
$output[] = __("No items", $this->plugin_slug)
|
|
|
|
|
|
|
528 |
} else {
|
529 |
|
530 |
if ( $getrnd ) $rnd_used = array(); // set array for unique random item
|
@@ -540,9 +544,9 @@ function ytc_mute(event){
|
|
540 |
$rnd_item = mt_rand(0, (count($items)-1));
|
541 |
}
|
542 |
$rnd_used[] = $rnd_item;
|
543 |
-
$item = $items[$rnd_item];
|
544 |
} else {
|
545 |
-
$item = $items[$y-1];
|
546 |
}
|
547 |
|
548 |
// print single video block
|
@@ -595,18 +599,18 @@ function ytc_mute(event){
|
|
595 |
|
596 |
$output[] = '<div class="ytc_link">';
|
597 |
$userchan = ( $instance['userchan'] ) ? 'channel' : 'user';
|
598 |
-
$goto_url =
|
599 |
$newtab = __("in new window/tab", 'youtube-channel');
|
600 |
$output[] = '<p>';
|
601 |
switch ( $instance['popup_goto'] ) {
|
602 |
case 1:
|
603 |
-
$output[] =
|
604 |
break;
|
605 |
case 2:
|
606 |
-
$output[] =
|
607 |
break;
|
608 |
default:
|
609 |
-
$output[] =
|
610 |
} // switch popup_goto
|
611 |
$output[] = '</p>';
|
612 |
$output[] = '</div>';
|
@@ -651,7 +655,7 @@ function ytc_mute(event){
|
|
651 |
$yt_id = preg_replace('/^.*=(.*)&.*$/', '${1}', $yt_id);
|
652 |
$yt_url = "v/$yt_id";
|
653 |
|
654 |
-
$yt_thumb = "//img.youtube.com/vi/$yt_id/0.jpg"; // zero for HD thumb
|
655 |
$yt_video = $item->link[0]->href;
|
656 |
$yt_video = preg_replace('/\&.*$/','',$yt_video);
|
657 |
|
@@ -979,7 +983,7 @@ JS;
|
|
979 |
foreach ($timeset as $n => $s)
|
980 |
{
|
981 |
$sec = $sc * $n;
|
982 |
-
$out .='<option value="'
|
983 |
unset($sec);
|
984 |
}
|
985 |
}
|
@@ -1037,7 +1041,7 @@ JS;
|
|
1037 |
);
|
1038 |
|
1039 |
// return JSON file
|
1040 |
-
header(
|
1041 |
header('Content-Type: application/json');
|
1042 |
echo json_encode($data);
|
1043 |
|
4 |
Plugin URI: http://urosevic.net/wordpress/plugins/youtube-channel/
|
5 |
Description: <a href="widgets.php">Widget</a> that display latest video thumbnail, iframe (HTML5 video), object (Flash video) or chromeless video from YouTube Channel or Playlist.
|
6 |
Author: Aleksandar Urošević
|
7 |
+
Version: 2.4.2.1
|
8 |
Author URI: http://urosevic.net/
|
9 |
*/
|
10 |
// @TODO make FitViedo optional
|
17 |
class WPAU_YOUTUBE_CHANNEL
|
18 |
{
|
19 |
|
20 |
+
public $plugin_version = "2.4.2.1";
|
21 |
public $plugin_name = "YouTube Channel";
|
22 |
public $plugin_slug = "youtube-channel";
|
23 |
public $plugin_option = "youtube_channel_defaults";
|
434 |
|
435 |
$output = array();
|
436 |
|
437 |
+
$output[] = "<div class=\"youtube_channel ${class}\">";
|
438 |
|
439 |
if ( $instance['only_pl'] && $use_res == 2 ) { // print standard playlist
|
440 |
$output = array_merge($output, self::ytc_only_pl($instance));
|
446 |
elseif ( $maxrnd > 50 ) { $maxrnd = 50; } // max 50
|
447 |
|
448 |
$feed_attr = '?alt=json';
|
449 |
+
$feed_attr .= '&v=2';
|
450 |
|
451 |
// select fields
|
452 |
+
$feed_attr .= '&fields=entry(published,title,link,content)';
|
453 |
|
454 |
if ( !$instance['fixnoitem'] && $use_res != 1 )
|
455 |
$feed_attr .= '&orderby=published';
|
456 |
|
457 |
$getrnd = $instance['getrnd'];
|
458 |
+
if ( $getrnd ) $feed_attr .= "&max-results=${maxrnd}";
|
459 |
|
460 |
$feed_attr .= '&rel=0';
|
461 |
switch ($use_res) {
|
462 |
case 1: // favorites
|
463 |
+
$feed_url = "http://gdata.youtube.com/feeds/base/users/${channel}/favorites${feed_attr}";
|
464 |
break;
|
465 |
case 2: // playlist
|
466 |
$playlist = $this->clean_playlist_id($playlist);
|
467 |
+
$feed_url = "http://gdata.youtube.com/feeds/api/playlists/${playlist}${feed_attr}";
|
468 |
break;
|
469 |
default:
|
470 |
+
$feed_url = "http://gdata.youtube.com/feeds/base/users/${channel}/uploads${feed_attr}&start-index=2";
|
471 |
}
|
472 |
|
473 |
// do we need cache?
|
474 |
if ($instance['cache_time'] > 0 ) {
|
475 |
// generate feed cache key for caching time
|
476 |
+
$md5_feed_url = md5($feed_url);
|
477 |
+
$cache_key = "ytc_${md5_feed_url}_${instance['cache_time']}";
|
478 |
|
479 |
if (!empty($_GET['ytc_force_recache']))
|
480 |
delete_transient($cache_key);
|
525 |
}
|
526 |
|
527 |
if ($maxitems == 0) {
|
528 |
+
$output[] = __("No items", $this->plugin_slug);
|
529 |
+
$output[] = " [<a href=\"${feed_url}\" target=\"_blank\">";
|
530 |
+
$output[] = __("Check here why", $this->plugin_slug);
|
531 |
+
$output[] = '</a>]';
|
532 |
} else {
|
533 |
|
534 |
if ( $getrnd ) $rnd_used = array(); // set array for unique random item
|
544 |
$rnd_item = mt_rand(0, (count($items)-1));
|
545 |
}
|
546 |
$rnd_used[] = $rnd_item;
|
547 |
+
$item = $items[ $rnd_item ];
|
548 |
} else {
|
549 |
+
$item = $items[ $y-1 ];
|
550 |
}
|
551 |
|
552 |
// print single video block
|
599 |
|
600 |
$output[] = '<div class="ytc_link">';
|
601 |
$userchan = ( $instance['userchan'] ) ? 'channel' : 'user';
|
602 |
+
$goto_url = "//www.youtube.com/${userchan}/${channel}/";
|
603 |
$newtab = __("in new window/tab", 'youtube-channel');
|
604 |
$output[] = '<p>';
|
605 |
switch ( $instance['popup_goto'] ) {
|
606 |
case 1:
|
607 |
+
$output[] = "<a href=\"javascript: window.open('${goto_url}'); void 0;\" title=\"${goto_txt} ${newtab}\">${goto_txt}</a>";
|
608 |
break;
|
609 |
case 2:
|
610 |
+
$output[] = "<a href=\"${goto_url}\" target=\"_blank\" title=\"${goto_txt} ${newtab}\">${goto_txt}</a>";
|
611 |
break;
|
612 |
default:
|
613 |
+
$output[] = "<a href=\"${goto_url}\" title=\"${goto_txt}\">${goto_txt}</a>";
|
614 |
} // switch popup_goto
|
615 |
$output[] = '</p>';
|
616 |
$output[] = '</div>';
|
655 |
$yt_id = preg_replace('/^.*=(.*)&.*$/', '${1}', $yt_id);
|
656 |
$yt_url = "v/$yt_id";
|
657 |
|
658 |
+
$yt_thumb = "//img.youtube.com/vi/${yt_id}/0.jpg"; // zero for HD thumb
|
659 |
$yt_video = $item->link[0]->href;
|
660 |
$yt_video = preg_replace('/\&.*$/','',$yt_video);
|
661 |
|
983 |
foreach ($timeset as $n => $s)
|
984 |
{
|
985 |
$sec = $sc * $n;
|
986 |
+
$out .= '<option value="' . $sec . '" ' . selected( $cache_time, $sec, 0 ) . '>' . __($s, $this->plugin_slug) . '</option>';
|
987 |
unset($sec);
|
988 |
}
|
989 |
}
|
1041 |
);
|
1042 |
|
1043 |
// return JSON file
|
1044 |
+
header("Content-disposition: attachment; filename=${for}.json");
|
1045 |
header('Content-Type: application/json');
|
1046 |
echo json_encode($data);
|
1047 |
|