Version Description
(2014-12-07) =
* Change: Remove parameter &rel=1
from thumbnail link because that is a default value and can prevent some lightboxes to load video.
Download this release
Release Info
Developer | urkekg |
Plugin | YouTube Channel |
Version | 2.4.1.1 |
Comparing to | |
See all releases |
Code changes from version 2.4.1 to 2.4.1.1
- readme.txt +11 -1
- youtube-channel.php +39 -39
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.1
|
7 |
-
Stable tag: 2.4.1
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -52,6 +52,8 @@ You can use `style.css` from theme to style `YouTube Video` widget content.
|
|
52 |
* Removing YouTube logo from playback control bar does not work for all videos
|
53 |
* Async HTML5 video does not work for 2nd same video on same page (two YTC blocks set to Async HTML5)
|
54 |
* Chromeless video could not be used as responsive player
|
|
|
|
|
55 |
|
56 |
If WordFence or other malware scan tool detect YouTube Channel fule youtube-channel.php as potential risk because `base64_encode()` and `base64_decode()` functions, remember that we use this two functions to store and restore JSON feeds to transient cache, so potential detection is false positive.
|
57 |
|
@@ -94,6 +96,10 @@ Playlist ID can be manualy extracted from YouTube playlist URL. Part of strings
|
|
94 |
|
95 |
Since version 1.3.1 you can also paste full YouTube playlist URL and ID will be automaticaly extracted.
|
96 |
|
|
|
|
|
|
|
|
|
97 |
= How to force embeding 320p video with better audio quality? =
|
98 |
|
99 |
YouTube provide 320p videos if height of embeded video is set to 320 or more. If you use small YTC video size, 240p will be loaded instead. So, you could not force 720p in tiny YTC.
|
@@ -122,6 +128,9 @@ Modestbranding option does not work for all videos, so a lot of videos will stil
|
|
122 |
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)
|
123 |
|
124 |
== Changelog ==
|
|
|
|
|
|
|
125 |
= 2.4.1 (2014-11-15) =
|
126 |
* Fix: Typo in widget `Do not chache` [2014-10-03]
|
127 |
* Fix: do not show global settings notice with link to settings page if not Redux Framerowk is active [2014-11-15]
|
@@ -131,6 +140,7 @@ Also, even when hidding logo works for your video, on hover or when video is pau
|
|
131 |
* Change: Move debug log from widget to downloadable dynamic JSON [2014-11-15]
|
132 |
* Add: ModestBranding (remove YouTube logo from player control bar) [2014-10-03]
|
133 |
* Add: Responsive (make video optionally responsive) [2014-10-04]
|
|
|
134 |
|
135 |
= 2.4.0.2 (2014-10-02) =
|
136 |
* Fix: light theme not applicable to embedded playlist [2014-10-01]
|
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.1
|
7 |
+
Stable tag: 2.4.1.1
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
52 |
* Removing YouTube logo from playback control bar does not work for all videos
|
53 |
* Async HTML5 video does not work for 2nd same video on same page (two YTC blocks set to Async HTML5)
|
54 |
* Chromeless video could not be used as responsive player
|
55 |
+
* Thumbnail and opening video in lightbox does not work with `Responz` theme by `Thenify.me` if you wish to hide related videos, because this theme uses original `Magnific Popup` library that does not support `rel` parameter.
|
56 |
+
* Thumbnail mode does not support hidden playback controls and hidden YouTube logo.
|
57 |
|
58 |
If WordFence or other malware scan tool detect YouTube Channel fule youtube-channel.php as potential risk because `base64_encode()` and `base64_decode()` functions, remember that we use this two functions to store and restore JSON feeds to transient cache, so potential detection is false positive.
|
59 |
|
96 |
|
97 |
Since version 1.3.1 you can also paste full YouTube playlist URL and ID will be automaticaly extracted.
|
98 |
|
99 |
+
= How to fix error `Invalid value for parameter: username` =
|
100 |
+
|
101 |
+
Double check YouTube Channel ID which you set in widget/settings. Channel ID (username) should not contain spaces.
|
102 |
+
|
103 |
= How to force embeding 320p video with better audio quality? =
|
104 |
|
105 |
YouTube provide 320p videos if height of embeded video is set to 320 or more. If you use small YTC video size, 240p will be loaded instead. So, you could not force 720p in tiny YTC.
|
128 |
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)
|
129 |
|
130 |
== Changelog ==
|
131 |
+
= 2.4.1.1 (2014-12-07) =
|
132 |
+
* Change: Remove parameter `&rel=1` from thumbnail link because that is a default value and can prevent some lightboxes to load video.
|
133 |
+
|
134 |
= 2.4.1 (2014-11-15) =
|
135 |
* Fix: Typo in widget `Do not chache` [2014-10-03]
|
136 |
* Fix: do not show global settings notice with link to settings page if not Redux Framerowk is active [2014-11-15]
|
140 |
* Change: Move debug log from widget to downloadable dynamic JSON [2014-11-15]
|
141 |
* Add: ModestBranding (remove YouTube logo from player control bar) [2014-10-03]
|
142 |
* Add: Responsive (make video optionally responsive) [2014-10-04]
|
143 |
+
* Add: Support for WordPress 4.1 [2014-11-15]
|
144 |
|
145 |
= 2.4.0.2 (2014-10-02) =
|
146 |
* Fix: light theme not applicable to embedded playlist [2014-10-01]
|
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.1
|
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.1";
|
21 |
public $plugin_name = "YouTube Channel";
|
22 |
public $plugin_slug = "youtube-channel";
|
23 |
public $plugin_option = "youtube_channel_defaults";
|
@@ -122,12 +122,12 @@ if ( !class_exists('WPAU_YOUTUBE_CHANNEL') )
|
|
122 |
$ignoreredux = ' <a href="?ytc_ignore_redux=1" class="button primary">'.__("Dismiss this notice", 'youtube-channel') . '</a>';
|
123 |
echo '<div class="error"><p>'.sprintf(__("To configure global <strong>%s</strong> options, you need to install and activate <strong>%s</strong>.", 'youtube-channel'), $this->plugin_name, "Redux Framework Plugin") . $ignoreredux . '</p></div>';
|
124 |
} // admin_notice()
|
125 |
-
|
126 |
function add_settings_link($links)
|
127 |
{
|
128 |
-
$settings_link = '<a href="options-general.php?page='.$this->plugin_slug.'">'.__('Settings').'</a>';
|
129 |
-
array_unshift( $links, $settings_link );
|
130 |
-
return $links;
|
131 |
} // add_settings_link()
|
132 |
|
133 |
public function defaults()
|
@@ -154,7 +154,7 @@ if ( !class_exists('WPAU_YOUTUBE_CHANNEL') )
|
|
154 |
'autoplay' => false,
|
155 |
'autoplay_mute' => false,
|
156 |
'norel' => false,
|
157 |
-
|
158 |
'showtitle' => false,
|
159 |
'showvidesc' => false,
|
160 |
'videsclen' => 0,
|
@@ -162,14 +162,14 @@ if ( !class_exists('WPAU_YOUTUBE_CHANNEL') )
|
|
162 |
'modestbranding' => false,
|
163 |
'hideanno' => false,
|
164 |
'hideinfo' => false,
|
165 |
-
|
166 |
'goto_txt' => 'Visit our channel',
|
167 |
'showgoto' => false,
|
168 |
'popup_goto' => 3, // 3 same window, 2 new window JS, 1 new window target
|
169 |
'userchan' => false
|
170 |
);
|
171 |
$defaults = get_option($this->plugin_option, $init);
|
172 |
-
|
173 |
// $options = wp_parse_args(get_option('youtube_channel_defaults'), $defaults);
|
174 |
// return $options;
|
175 |
return $defaults;
|
@@ -183,14 +183,14 @@ if ( !class_exists('WPAU_YOUTUBE_CHANNEL') )
|
|
183 |
// Transit old settings to new format
|
184 |
// get pre-2.0.0 YTC widgets, and if exist, convert to 2.0.0+ version
|
185 |
if ( $old = get_option('widget_youtube_channel_widget') ) {
|
186 |
-
// if we have pre-2.0.0 YTC widgets, merge them to new version
|
187 |
-
|
188 |
// get new YTC widgets
|
189 |
$new = get_option('widget_youtube-channel');
|
190 |
-
|
191 |
// get all widget areas
|
192 |
$widget_areas = get_option('sidebars_widgets');
|
193 |
-
|
194 |
// update options to 2.0.0+ version
|
195 |
foreach ($old as $k=>$v) {
|
196 |
|
@@ -223,7 +223,7 @@ if ( !class_exists('WPAU_YOUTUBE_CHANNEL') )
|
|
223 |
$ytc_widget_id = "youtube-channel-".end(array_keys($new));
|
224 |
} else {
|
225 |
// set as current widget ID
|
226 |
-
$new[$k] = $v;
|
227 |
$ytc_widget_id = "youtube-channel-$k";
|
228 |
}
|
229 |
|
@@ -241,16 +241,16 @@ if ( !class_exists('WPAU_YOUTUBE_CHANNEL') )
|
|
241 |
// add to inactive widgets if don't belong to any widget area
|
242 |
|
243 |
} // foreach widget option
|
244 |
-
|
245 |
// update widget areas set
|
246 |
update_option('sidebars_widgets',$widget_areas);
|
247 |
-
|
248 |
// update new YTC widgets
|
249 |
update_option('widget_youtube-channel',$new);
|
250 |
-
|
251 |
// remove old YTC widgets entry
|
252 |
delete_option('widget_youtube_channel_widget');
|
253 |
-
|
254 |
// clear temporary vars
|
255 |
unset ($old,$new);
|
256 |
|
@@ -307,33 +307,33 @@ function ytc_mute(event){
|
|
307 |
'res' => $instance['use_res'],
|
308 |
'only_pl' => $instance['only_pl'],
|
309 |
'cache' => $instance['cache_time'],
|
310 |
-
|
311 |
'fetch' => $instance['maxrnd'],
|
312 |
'num' => $instance['vidqty'],
|
313 |
-
|
314 |
'fix' => $instance['fixnoitem'],
|
315 |
'random' => $instance['getrnd'],
|
316 |
-
|
317 |
'ratio' => $instance['ratio'],
|
318 |
'width' => $instance['width'],
|
319 |
'responsive' => (!empty($instance['responsive'])) ? $instance['responsive'] : '0',
|
320 |
|
321 |
'show' => $instance['to_show'],
|
322 |
-
|
323 |
'themelight' => $instance['themelight'],
|
324 |
'controls' => $instance['controls'],
|
325 |
'fix_h' => $instance['fixyt'],
|
326 |
'autoplay' => $instance['autoplay'],
|
327 |
'mute' => $instance['autoplay_mute'],
|
328 |
'norel' => $instance['norel'],
|
329 |
-
|
330 |
'showtitle' => $instance['showtitle'],
|
331 |
'showdesc' => $instance['showvidesc'],
|
332 |
'nobrand' => (!empty($instance['modestbranding'])) ? $instance['modestbranding'] : '0',
|
333 |
'desclen' => $instance['videsclen'],
|
334 |
'noinfo' => $instance['hideinfo'],
|
335 |
'noanno' => $instance['hideanno'],
|
336 |
-
|
337 |
'goto' => $instance['showgoto'],
|
338 |
'goto_txt' => $instance['goto_txt'],
|
339 |
'popup' => $instance['popup_goto'],
|
@@ -363,7 +363,7 @@ function ytc_mute(event){
|
|
363 |
$instance['width'] = $width; // 306
|
364 |
$instance['responsive'] = $responsive; // enable responsivenes?
|
365 |
$instance['to_show'] = $show; // thumbnail, iframe, iframe2, object, chromeless
|
366 |
-
|
367 |
$instance['themelight'] = $themelight; // use light theme, dark by default
|
368 |
$instance['controls'] = $controls; // hide controls, false by default
|
369 |
$instance['fixyt'] = $fix_h; // fix youtube height, disabled by default
|
@@ -418,7 +418,7 @@ function ytc_mute(event){
|
|
418 |
if ( $instance['only_pl'] && $use_res == 2 ) { // print standard playlist
|
419 |
$output = array_merge($output, self::ytc_only_pl($instance));
|
420 |
} else { // channel or playlist single videos
|
421 |
-
|
422 |
// get max items for random video
|
423 |
$maxrnd = $instance['maxrnd'];
|
424 |
if ( $maxrnd < 1 ) { $maxrnd = 10; } // default 10
|
@@ -430,7 +430,7 @@ function ytc_mute(event){
|
|
430 |
|
431 |
if ( !$instance['fixnoitem'] && $use_res != 1 )
|
432 |
$feed_attr .= '&orderby=published';
|
433 |
-
|
434 |
$getrnd = $instance['getrnd'];
|
435 |
if ( $getrnd ) $feed_attr .= '&max-results='.$maxrnd;
|
436 |
|
@@ -517,7 +517,7 @@ function ytc_mute(event){
|
|
517 |
} else {
|
518 |
$item = $items[$y-1];
|
519 |
}
|
520 |
-
|
521 |
// print single video block
|
522 |
$output = array_merge( $output, $this->ytc_print_video($item, $instance, $y) );
|
523 |
}
|
@@ -533,7 +533,7 @@ function ytc_mute(event){
|
|
533 |
}
|
534 |
|
535 |
// --- HELPER FUNCTIONS ---
|
536 |
-
|
537 |
// function to calculate height by width and ratio
|
538 |
function height_ratio($width=306, $ratio) {
|
539 |
switch ($ratio)
|
@@ -623,7 +623,7 @@ function ytc_mute(event){
|
|
623 |
$yt_id = $item->link[0]->href;
|
624 |
$yt_id = preg_replace('/^.*=(.*)&.*$/', '${1}', $yt_id);
|
625 |
$yt_url = "v/$yt_id";
|
626 |
-
|
627 |
$yt_thumb = "//img.youtube.com/vi/$yt_id/0.jpg"; // zero for HD thumb
|
628 |
$yt_video = $item->link[0]->href;
|
629 |
$yt_video = preg_replace('/\&.*$/','',$yt_video);
|
@@ -631,7 +631,7 @@ function ytc_mute(event){
|
|
631 |
$yt_title = $item->title->{'$t'};
|
632 |
$yt_date = $item->published->{'$t'};
|
633 |
//$yt_date = $item->get_date('j F Y | g:i a');
|
634 |
-
|
635 |
switch ($y) {
|
636 |
case 1:
|
637 |
$vnumclass = 'first';
|
@@ -651,7 +651,7 @@ function ytc_mute(event){
|
|
651 |
// show video title?
|
652 |
if ( $instance['showtitle'] )
|
653 |
$output[] = '<h3 class="ytc_title">'.$yt_title.'</h3>';
|
654 |
-
|
655 |
// define object ID
|
656 |
$ytc_vid = 'ytc_' . $yt_id;
|
657 |
|
@@ -668,8 +668,8 @@ function ytc_mute(event){
|
|
668 |
default: $arclass = 'ar16_9';
|
669 |
}
|
670 |
$title = sprintf( __('Watch video %1$s published on %2$s', 'youtube-channel' ), $yt_title, $yt_date );
|
671 |
-
$rel = ( $norel ) ?
|
672 |
-
$output[] = '<a href="'.$yt_video
|
673 |
} else if ( $to_show == "chromeless" ) {
|
674 |
ob_start();
|
675 |
?>
|
@@ -687,7 +687,7 @@ function ytc_mute(event){
|
|
687 |
<param name="wmode" value="opaque" />
|
688 |
<param name="swfversion" value="6.0.65.0" />
|
689 |
<param name="movie" value="<?php echo $this->plugin_url . 'chromeless.swf'; ?>" />
|
690 |
-
</object>
|
691 |
<?php
|
692 |
$output[] = ob_get_contents();
|
693 |
ob_end_clean();
|
@@ -791,7 +791,7 @@ JS;
|
|
791 |
$etcetera = $instance['descappend'];
|
792 |
} else {
|
793 |
$etcetera = '…';
|
794 |
-
}
|
795 |
}
|
796 |
} else {
|
797 |
$video_description = $videsc[1];
|
@@ -831,7 +831,7 @@ JS;
|
|
831 |
// enhanced privacy
|
832 |
$youtube_domain = $this->youtube_domain($instance);
|
833 |
$output[] = '<div class="ytc_video_container ytc_video_1 ytc_video_single">
|
834 |
-
<iframe src="//'.$youtube_domain.'/embed/videoseries?list=PL'.$playlist.$autoplay.$theme.$modestbranding.$rel.'"
|
835 |
width="'.$width.'" height="'.$height.'" frameborder="0"></iframe></div>';
|
836 |
return $output;
|
837 |
} // end function ytc_only_pl
|
@@ -920,7 +920,7 @@ JS;
|
|
920 |
|
921 |
// get Redux Framework version (if active)
|
922 |
$redux = ( class_exists( "ReduxFramework" ) ) ? ReduxFramework::$_version : 'N/A';
|
923 |
-
|
924 |
// get widget ID from parameter
|
925 |
$for = $_GET['ytc_debug_json_for'];
|
926 |
|
@@ -933,7 +933,7 @@ JS;
|
|
933 |
|
934 |
if (!is_array($widget_options[$widget_id]))
|
935 |
return;
|
936 |
-
|
937 |
// prepare debug data with settings of current widget
|
938 |
$data = array_merge(
|
939 |
array(
|
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.1.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.1.1";
|
21 |
public $plugin_name = "YouTube Channel";
|
22 |
public $plugin_slug = "youtube-channel";
|
23 |
public $plugin_option = "youtube_channel_defaults";
|
122 |
$ignoreredux = ' <a href="?ytc_ignore_redux=1" class="button primary">'.__("Dismiss this notice", 'youtube-channel') . '</a>';
|
123 |
echo '<div class="error"><p>'.sprintf(__("To configure global <strong>%s</strong> options, you need to install and activate <strong>%s</strong>.", 'youtube-channel'), $this->plugin_name, "Redux Framework Plugin") . $ignoreredux . '</p></div>';
|
124 |
} // admin_notice()
|
125 |
+
|
126 |
function add_settings_link($links)
|
127 |
{
|
128 |
+
$settings_link = '<a href="options-general.php?page='.$this->plugin_slug.'">'.__('Settings').'</a>';
|
129 |
+
array_unshift( $links, $settings_link );
|
130 |
+
return $links;
|
131 |
} // add_settings_link()
|
132 |
|
133 |
public function defaults()
|
154 |
'autoplay' => false,
|
155 |
'autoplay_mute' => false,
|
156 |
'norel' => false,
|
157 |
+
|
158 |
'showtitle' => false,
|
159 |
'showvidesc' => false,
|
160 |
'videsclen' => 0,
|
162 |
'modestbranding' => false,
|
163 |
'hideanno' => false,
|
164 |
'hideinfo' => false,
|
165 |
+
|
166 |
'goto_txt' => 'Visit our channel',
|
167 |
'showgoto' => false,
|
168 |
'popup_goto' => 3, // 3 same window, 2 new window JS, 1 new window target
|
169 |
'userchan' => false
|
170 |
);
|
171 |
$defaults = get_option($this->plugin_option, $init);
|
172 |
+
|
173 |
// $options = wp_parse_args(get_option('youtube_channel_defaults'), $defaults);
|
174 |
// return $options;
|
175 |
return $defaults;
|
183 |
// Transit old settings to new format
|
184 |
// get pre-2.0.0 YTC widgets, and if exist, convert to 2.0.0+ version
|
185 |
if ( $old = get_option('widget_youtube_channel_widget') ) {
|
186 |
+
// if we have pre-2.0.0 YTC widgets, merge them to new version
|
187 |
+
|
188 |
// get new YTC widgets
|
189 |
$new = get_option('widget_youtube-channel');
|
190 |
+
|
191 |
// get all widget areas
|
192 |
$widget_areas = get_option('sidebars_widgets');
|
193 |
+
|
194 |
// update options to 2.0.0+ version
|
195 |
foreach ($old as $k=>$v) {
|
196 |
|
223 |
$ytc_widget_id = "youtube-channel-".end(array_keys($new));
|
224 |
} else {
|
225 |
// set as current widget ID
|
226 |
+
$new[$k] = $v;
|
227 |
$ytc_widget_id = "youtube-channel-$k";
|
228 |
}
|
229 |
|
241 |
// add to inactive widgets if don't belong to any widget area
|
242 |
|
243 |
} // foreach widget option
|
244 |
+
|
245 |
// update widget areas set
|
246 |
update_option('sidebars_widgets',$widget_areas);
|
247 |
+
|
248 |
// update new YTC widgets
|
249 |
update_option('widget_youtube-channel',$new);
|
250 |
+
|
251 |
// remove old YTC widgets entry
|
252 |
delete_option('widget_youtube_channel_widget');
|
253 |
+
|
254 |
// clear temporary vars
|
255 |
unset ($old,$new);
|
256 |
|
307 |
'res' => $instance['use_res'],
|
308 |
'only_pl' => $instance['only_pl'],
|
309 |
'cache' => $instance['cache_time'],
|
310 |
+
|
311 |
'fetch' => $instance['maxrnd'],
|
312 |
'num' => $instance['vidqty'],
|
313 |
+
|
314 |
'fix' => $instance['fixnoitem'],
|
315 |
'random' => $instance['getrnd'],
|
316 |
+
|
317 |
'ratio' => $instance['ratio'],
|
318 |
'width' => $instance['width'],
|
319 |
'responsive' => (!empty($instance['responsive'])) ? $instance['responsive'] : '0',
|
320 |
|
321 |
'show' => $instance['to_show'],
|
322 |
+
|
323 |
'themelight' => $instance['themelight'],
|
324 |
'controls' => $instance['controls'],
|
325 |
'fix_h' => $instance['fixyt'],
|
326 |
'autoplay' => $instance['autoplay'],
|
327 |
'mute' => $instance['autoplay_mute'],
|
328 |
'norel' => $instance['norel'],
|
329 |
+
|
330 |
'showtitle' => $instance['showtitle'],
|
331 |
'showdesc' => $instance['showvidesc'],
|
332 |
'nobrand' => (!empty($instance['modestbranding'])) ? $instance['modestbranding'] : '0',
|
333 |
'desclen' => $instance['videsclen'],
|
334 |
'noinfo' => $instance['hideinfo'],
|
335 |
'noanno' => $instance['hideanno'],
|
336 |
+
|
337 |
'goto' => $instance['showgoto'],
|
338 |
'goto_txt' => $instance['goto_txt'],
|
339 |
'popup' => $instance['popup_goto'],
|
363 |
$instance['width'] = $width; // 306
|
364 |
$instance['responsive'] = $responsive; // enable responsivenes?
|
365 |
$instance['to_show'] = $show; // thumbnail, iframe, iframe2, object, chromeless
|
366 |
+
|
367 |
$instance['themelight'] = $themelight; // use light theme, dark by default
|
368 |
$instance['controls'] = $controls; // hide controls, false by default
|
369 |
$instance['fixyt'] = $fix_h; // fix youtube height, disabled by default
|
418 |
if ( $instance['only_pl'] && $use_res == 2 ) { // print standard playlist
|
419 |
$output = array_merge($output, self::ytc_only_pl($instance));
|
420 |
} else { // channel or playlist single videos
|
421 |
+
|
422 |
// get max items for random video
|
423 |
$maxrnd = $instance['maxrnd'];
|
424 |
if ( $maxrnd < 1 ) { $maxrnd = 10; } // default 10
|
430 |
|
431 |
if ( !$instance['fixnoitem'] && $use_res != 1 )
|
432 |
$feed_attr .= '&orderby=published';
|
433 |
+
|
434 |
$getrnd = $instance['getrnd'];
|
435 |
if ( $getrnd ) $feed_attr .= '&max-results='.$maxrnd;
|
436 |
|
517 |
} else {
|
518 |
$item = $items[$y-1];
|
519 |
}
|
520 |
+
|
521 |
// print single video block
|
522 |
$output = array_merge( $output, $this->ytc_print_video($item, $instance, $y) );
|
523 |
}
|
533 |
}
|
534 |
|
535 |
// --- HELPER FUNCTIONS ---
|
536 |
+
|
537 |
// function to calculate height by width and ratio
|
538 |
function height_ratio($width=306, $ratio) {
|
539 |
switch ($ratio)
|
623 |
$yt_id = $item->link[0]->href;
|
624 |
$yt_id = preg_replace('/^.*=(.*)&.*$/', '${1}', $yt_id);
|
625 |
$yt_url = "v/$yt_id";
|
626 |
+
|
627 |
$yt_thumb = "//img.youtube.com/vi/$yt_id/0.jpg"; // zero for HD thumb
|
628 |
$yt_video = $item->link[0]->href;
|
629 |
$yt_video = preg_replace('/\&.*$/','',$yt_video);
|
631 |
$yt_title = $item->title->{'$t'};
|
632 |
$yt_date = $item->published->{'$t'};
|
633 |
//$yt_date = $item->get_date('j F Y | g:i a');
|
634 |
+
|
635 |
switch ($y) {
|
636 |
case 1:
|
637 |
$vnumclass = 'first';
|
651 |
// show video title?
|
652 |
if ( $instance['showtitle'] )
|
653 |
$output[] = '<h3 class="ytc_title">'.$yt_title.'</h3>';
|
654 |
+
|
655 |
// define object ID
|
656 |
$ytc_vid = 'ytc_' . $yt_id;
|
657 |
|
668 |
default: $arclass = 'ar16_9';
|
669 |
}
|
670 |
$title = sprintf( __('Watch video %1$s published on %2$s', 'youtube-channel' ), $yt_title, $yt_date );
|
671 |
+
$rel = ( $norel ) ? '&rel=0' : '';
|
672 |
+
$output[] = '<a href="'.$yt_video.$rel.'" title="'.$yt_title.'" class="ytc_thumb ytc-lightbox '.$arclass.'"><span style="background-image: url('.$yt_thumb.');" title="'.$title.'" id="'.$ytc_vid.'"></span></a>';
|
673 |
} else if ( $to_show == "chromeless" ) {
|
674 |
ob_start();
|
675 |
?>
|
687 |
<param name="wmode" value="opaque" />
|
688 |
<param name="swfversion" value="6.0.65.0" />
|
689 |
<param name="movie" value="<?php echo $this->plugin_url . 'chromeless.swf'; ?>" />
|
690 |
+
</object>
|
691 |
<?php
|
692 |
$output[] = ob_get_contents();
|
693 |
ob_end_clean();
|
791 |
$etcetera = $instance['descappend'];
|
792 |
} else {
|
793 |
$etcetera = '…';
|
794 |
+
}
|
795 |
}
|
796 |
} else {
|
797 |
$video_description = $videsc[1];
|
831 |
// enhanced privacy
|
832 |
$youtube_domain = $this->youtube_domain($instance);
|
833 |
$output[] = '<div class="ytc_video_container ytc_video_1 ytc_video_single">
|
834 |
+
<iframe src="//'.$youtube_domain.'/embed/videoseries?list=PL'.$playlist.$autoplay.$theme.$modestbranding.$rel.'"
|
835 |
width="'.$width.'" height="'.$height.'" frameborder="0"></iframe></div>';
|
836 |
return $output;
|
837 |
} // end function ytc_only_pl
|
920 |
|
921 |
// get Redux Framework version (if active)
|
922 |
$redux = ( class_exists( "ReduxFramework" ) ) ? ReduxFramework::$_version : 'N/A';
|
923 |
+
|
924 |
// get widget ID from parameter
|
925 |
$for = $_GET['ytc_debug_json_for'];
|
926 |
|
933 |
|
934 |
if (!is_array($widget_options[$widget_id]))
|
935 |
return;
|
936 |
+
|
937 |
// prepare debug data with settings of current widget
|
938 |
$data = array_merge(
|
939 |
array(
|