Version Description
- Change: add back old iframe functionality, second iframe option is async loading
Download this release
Release Info
Developer | urkekg |
Plugin | YouTube Channel |
Version | 2.1.0.1 |
Comparing to | |
See all releases |
Code changes from version 2.1.0 to 2.1.0.1
- readme.txt +4 -1
- youtube-channel.php +45 -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
|
5 |
Requires at least: 3.7.0
|
6 |
Tested up to: 3.8.1
|
7 |
-
Stable tag: 2.1.0
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -112,6 +112,9 @@ Video feed for YTC has been retreived with standard youtube feed [uploads by spe
|
|
112 |
If you does not see your latest video in your uplaods feed (which you can access at https://gdata.youtube.com/feeds/api/users/YOUR_YT_USERID/uploads by replacing YOUR_YT_USERID with your real youtube user ID), then YTC will not see it too.
|
113 |
|
114 |
== Changelog ==
|
|
|
|
|
|
|
115 |
= 2.1.0 =
|
116 |
* Change: iframe/HTML5 player inject with IFrame Player API https://developers.google.com/youtube/player_parameters#IFrame_Player_API
|
117 |
* Change: use native WP remote file download function wp_remote_get to fetch feeds (prevent some permission errors on some hosts)
|
4 |
Tags: youtube, channel, playlist, single, widget, widgets, youtube player, flash player, rss, feed, video, thumbnail, embed, sidebar, chromeless, iframe, html5
|
5 |
Requires at least: 3.7.0
|
6 |
Tested up to: 3.8.1
|
7 |
+
Stable tag: 2.1.0.1
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
112 |
If you does not see your latest video in your uplaods feed (which you can access at https://gdata.youtube.com/feeds/api/users/YOUR_YT_USERID/uploads by replacing YOUR_YT_USERID with your real youtube user ID), then YTC will not see it too.
|
113 |
|
114 |
== Changelog ==
|
115 |
+
= 2.1.0.1 =
|
116 |
+
* Change: add back old iframe functionality, second iframe option is async loading
|
117 |
+
|
118 |
= 2.1.0 =
|
119 |
* Change: iframe/HTML5 player inject with IFrame Player API https://developers.google.com/youtube/player_parameters#IFrame_Player_API
|
120 |
* Change: use native WP remote file download function wp_remote_get to fetch feeds (prevent some permission errors on some hosts)
|
youtube-channel.php
CHANGED
@@ -4,10 +4,10 @@ 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.1.0
|
8 |
Author URI: http://urosevic.net/
|
9 |
*/
|
10 |
-
define( 'YTCVER', '2.1.0' );
|
11 |
define( 'YOUTUBE_CHANNEL_URL', plugin_dir_url(__FILE__) );
|
12 |
define( 'YTCPLID', 'PLEC850BE962234400' );
|
13 |
define( 'YTCUID', 'urkekg' );
|
@@ -24,7 +24,6 @@ class YouTube_Channel_Widget extends WP_Widget {
|
|
24 |
);
|
25 |
}
|
26 |
|
27 |
-
|
28 |
/**
|
29 |
* Activate the plugin
|
30 |
*/
|
@@ -296,6 +295,7 @@ class YouTube_Channel_Widget extends WP_Widget {
|
|
296 |
<option value="thumbnail"<?php selected( $to_show, 'thumbnail' ); ?>><?php _e('Thumbnail', YTCTDOM); ?></option>
|
297 |
<option value="object"<?php selected( $to_show, 'object' ); ?>><?php _e('Flash (object)', YTCTDOM); ?></option>
|
298 |
<option value="iframe"<?php selected( $to_show, 'iframe' ); ?>><?php _e('HTML5 (iframe)', YTCTDOM); ?></option>
|
|
|
299 |
<option value="chromeless"<?php selected( $to_show, 'chromeless' ); ?>><?php _e('Chromeless', YTCTDOM); ?></option>
|
300 |
</select>
|
301 |
<input class="checkbox" type="checkbox" <?php checked( (bool) $themelight, true ); ?> id="<?php echo $this->get_field_id( 'themelight' ); ?>" name="<?php echo $this->get_field_name( 'themelight' ); ?>" /> <label for="<?php echo $this->get_field_id( 'themelight' ); ?>"><?php _e('Use light theme (default is dark)', YTCTDOM); ?></label><br />
|
@@ -368,34 +368,34 @@ if ( $debugon == 'on' ) {
|
|
368 |
$instance['playlist'] = strip_tags($new_instance['playlist']);
|
369 |
$instance['use_res'] = $new_instance['use_res'];
|
370 |
$instance['cache_time'] = $new_instance['cache_time'];
|
371 |
-
$instance['only_pl'] = $new_instance['only_pl'];
|
372 |
-
$instance['getrnd'] = $new_instance['getrnd'];
|
373 |
$instance['maxrnd'] = $new_instance['maxrnd'];
|
374 |
|
375 |
$instance['goto_txt'] = strip_tags($new_instance['goto_txt']);
|
376 |
-
$instance['showgoto'] = $new_instance['showgoto'];
|
377 |
$instance['popup_goto'] = $new_instance['popup_goto'];
|
378 |
|
379 |
-
$instance['showtitle'] = $new_instance['showtitle'];
|
380 |
-
$instance['showvidesc'] = $new_instance['showvidesc'];
|
381 |
$instance['descappend'] = strip_tags($new_instance['descappend']);
|
382 |
$instance['videsclen'] = strip_tags($new_instance['videsclen']);
|
383 |
$instance['width'] = strip_tags($new_instance['width']);
|
384 |
// $instance['height'] = strip_tags($new_instance['height']);
|
385 |
$instance['to_show'] = strip_tags($new_instance['to_show']);
|
386 |
-
$instance['autoplay'] = $new_instance['autoplay'];
|
387 |
-
$instance['autoplay_mute'] = $new_instance['autoplay_mute'];
|
388 |
|
389 |
-
$instance['controls'] = $new_instance['controls'];
|
390 |
-
$instance['fixnoitem'] = $new_instance['fixnoitem'];
|
391 |
$instance['ratio'] = strip_tags($new_instance['ratio']);
|
392 |
-
$instance['fixyt'] = $new_instance['fixyt'];
|
393 |
-
$instance['hideinfo'] = $new_instance['hideinfo'];
|
394 |
-
$instance['hideanno'] = $new_instance['hideanno'];
|
395 |
-
$instance['themelight'] = $new_instance['themelight'];
|
396 |
-
$instance['debugon'] = $new_instance['debugon'];
|
397 |
-
$instance['userchan'] = $new_instance['userchan'];
|
398 |
-
$instance['enhprivacy'] = $new_instance['enhprivacy'];
|
399 |
|
400 |
return $instance;
|
401 |
}
|
@@ -562,15 +562,23 @@ if( class_exists('YouTube_Channel_Widget'))
|
|
562 |
}
|
563 |
|
564 |
/* Load YTC player script */
|
565 |
-
function ytc_enqueue_scripts() {
|
566 |
-
wp_enqueue_script( 'ytc', 'https://www.youtube.com/player_api', array(), '3.0.0', true );
|
567 |
-
}
|
568 |
-
add_action( 'wp_enqueue_scripts', 'ytc_enqueue_scripts' );
|
569 |
|
570 |
function ytc_footer_js() {
|
|
|
|
|
|
|
571 |
?>
|
|
|
572 |
<script type="text/javascript">
|
573 |
-
|
|
|
|
|
|
|
|
|
574 |
<?php echo $_SESSION['ytc_html5_js']; ?>
|
575 |
}
|
576 |
function ytc_mute(event){
|
@@ -578,9 +586,9 @@ if( class_exists('YouTube_Channel_Widget'))
|
|
578 |
}
|
579 |
</script>
|
580 |
<?php
|
|
|
581 |
}
|
582 |
add_action( 'wp_footer', 'ytc_footer_js' );
|
583 |
-
|
584 |
}
|
585 |
|
586 |
/* function to print standard playlist embed code */
|
@@ -700,6 +708,18 @@ function ytc_print_video($item, $instance, $y) {
|
|
700 |
} else if ( $to_show == "iframe" ) {
|
701 |
if ( empty($usepl) ) $yt_url = $yt_id;
|
702 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
703 |
$js_controls = ( $controls ) ? "controls: 0," : '';
|
704 |
$js_showinfo = ( $hideinfo ) ? "showinfo: 0," : '';
|
705 |
$js_autoplay = ( $autoplay ) ? "autoplay: 1," : '';
|
@@ -808,20 +828,6 @@ function height_ratio($width=220, $ratio) {
|
|
808 |
default:
|
809 |
$height = round(($width / 16 ) * 9);
|
810 |
}
|
811 |
-
|
812 |
-
/*
|
813 |
-
if ( $ratio == 1 ) { // 4:3
|
814 |
-
$height = round(($width / 4 ) * 3);
|
815 |
-
} elseif ( $ratio == 2 ) { // 16:10
|
816 |
-
$height = round(($width / 16 ) * 10);
|
817 |
-
} elseif ( $ratio == 3 ) { // 16:9
|
818 |
-
$height = round(($width / 16 ) * 9);
|
819 |
-
} else { // set default if 0 or ratio not set
|
820 |
-
// $height = $instance['height'];
|
821 |
-
if ( $height == "" || $height == 0 )
|
822 |
-
$height = 165;
|
823 |
-
}
|
824 |
-
*/
|
825 |
return $height;
|
826 |
}
|
827 |
|
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.1.0.1
|
8 |
Author URI: http://urosevic.net/
|
9 |
*/
|
10 |
+
define( 'YTCVER', '2.1.0.1' );
|
11 |
define( 'YOUTUBE_CHANNEL_URL', plugin_dir_url(__FILE__) );
|
12 |
define( 'YTCPLID', 'PLEC850BE962234400' );
|
13 |
define( 'YTCUID', 'urkekg' );
|
24 |
);
|
25 |
}
|
26 |
|
|
|
27 |
/**
|
28 |
* Activate the plugin
|
29 |
*/
|
295 |
<option value="thumbnail"<?php selected( $to_show, 'thumbnail' ); ?>><?php _e('Thumbnail', YTCTDOM); ?></option>
|
296 |
<option value="object"<?php selected( $to_show, 'object' ); ?>><?php _e('Flash (object)', YTCTDOM); ?></option>
|
297 |
<option value="iframe"<?php selected( $to_show, 'iframe' ); ?>><?php _e('HTML5 (iframe)', YTCTDOM); ?></option>
|
298 |
+
<option value="iframe2"<?php selected( $to_show, 'iframe2' ); ?>><?php _e('HTML5 (iframe) Async', YTCTDOM); ?></option>
|
299 |
<option value="chromeless"<?php selected( $to_show, 'chromeless' ); ?>><?php _e('Chromeless', YTCTDOM); ?></option>
|
300 |
</select>
|
301 |
<input class="checkbox" type="checkbox" <?php checked( (bool) $themelight, true ); ?> id="<?php echo $this->get_field_id( 'themelight' ); ?>" name="<?php echo $this->get_field_name( 'themelight' ); ?>" /> <label for="<?php echo $this->get_field_id( 'themelight' ); ?>"><?php _e('Use light theme (default is dark)', YTCTDOM); ?></label><br />
|
368 |
$instance['playlist'] = strip_tags($new_instance['playlist']);
|
369 |
$instance['use_res'] = $new_instance['use_res'];
|
370 |
$instance['cache_time'] = $new_instance['cache_time'];
|
371 |
+
$instance['only_pl'] = (isset($new_instance['only_pl'])) ? $new_instance['only_pl'] : false;
|
372 |
+
$instance['getrnd'] = (isset($new_instance['getrnd'])) ? $new_instance['getrnd'] : false;
|
373 |
$instance['maxrnd'] = $new_instance['maxrnd'];
|
374 |
|
375 |
$instance['goto_txt'] = strip_tags($new_instance['goto_txt']);
|
376 |
+
$instance['showgoto'] = (isset($new_instance['showgoto'])) ? $new_instance['showgoto'] : false;
|
377 |
$instance['popup_goto'] = $new_instance['popup_goto'];
|
378 |
|
379 |
+
$instance['showtitle'] = (isset($new_instance['showtitle'])) ? $new_instance['showtitle'] : false;
|
380 |
+
$instance['showvidesc'] = (isset($new_instance['showvidesc'])) ? $new_instance['showvidesc'] : false;
|
381 |
$instance['descappend'] = strip_tags($new_instance['descappend']);
|
382 |
$instance['videsclen'] = strip_tags($new_instance['videsclen']);
|
383 |
$instance['width'] = strip_tags($new_instance['width']);
|
384 |
// $instance['height'] = strip_tags($new_instance['height']);
|
385 |
$instance['to_show'] = strip_tags($new_instance['to_show']);
|
386 |
+
$instance['autoplay'] = (isset($new_instance['autoplay'])) ? $new_instance['autoplay'] : false;
|
387 |
+
$instance['autoplay_mute'] = (isset($new_instance['autoplay_mute'])) ? $new_instance['autoplay_mute'] : false;
|
388 |
|
389 |
+
$instance['controls'] = (isset($new_instance['controls'])) ? $new_instance['controls'] : false;
|
390 |
+
$instance['fixnoitem'] = (isset($new_instance['fixnoitem'])) ? $new_instance['fixnoitem'] : false;
|
391 |
$instance['ratio'] = strip_tags($new_instance['ratio']);
|
392 |
+
$instance['fixyt'] = (isset($new_instance['fixyt'])) ? $new_instance['fixyt'] : '';
|
393 |
+
$instance['hideinfo'] = (isset($new_instance['hideinfo'])) ? $new_instance['hideinfo'] : '';
|
394 |
+
$instance['hideanno'] = (isset($new_instance['hideanno'])) ? $new_instance['hideanno'] : '';
|
395 |
+
$instance['themelight'] = (isset($new_instance['themelight'])) ? $new_instance['themelight'] : '';
|
396 |
+
$instance['debugon'] = (isset($new_instance['debugon'])) ? $new_instance['debugon'] : '';
|
397 |
+
$instance['userchan'] = (isset($new_instance['userchan'])) ? $new_instance['userchan'] : '';
|
398 |
+
$instance['enhprivacy'] = (isset($new_instance['enhprivacy'])) ? $new_instance['enhprivacy'] : '';
|
399 |
|
400 |
return $instance;
|
401 |
}
|
562 |
}
|
563 |
|
564 |
/* Load YTC player script */
|
565 |
+
// function ytc_enqueue_scripts() {
|
566 |
+
// wp_enqueue_script( 'ytc', 'https://www.youtube.com/player_api', array(), '3.0.0', true );
|
567 |
+
// }
|
568 |
+
// add_action( 'wp_enqueue_scripts', 'ytc_enqueue_scripts' );
|
569 |
|
570 |
function ytc_footer_js() {
|
571 |
+
// Print JS only if we have set YTC array
|
572 |
+
if ( !empty($_SESSION['ytc_html5_js']) )
|
573 |
+
{
|
574 |
?>
|
575 |
+
<!-- YouTube Channel v<?php echo YTCVER; ?> -->
|
576 |
<script type="text/javascript">
|
577 |
+
var tag = document.createElement('script');
|
578 |
+
tag.src = "https://www.youtube.com/iframe_api";
|
579 |
+
var firstScriptTag = document.getElementsByTagName('script')[0];
|
580 |
+
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
|
581 |
+
function onYouTubeIframeAPIReady() {
|
582 |
<?php echo $_SESSION['ytc_html5_js']; ?>
|
583 |
}
|
584 |
function ytc_mute(event){
|
586 |
}
|
587 |
</script>
|
588 |
<?php
|
589 |
+
}
|
590 |
}
|
591 |
add_action( 'wp_footer', 'ytc_footer_js' );
|
|
|
592 |
}
|
593 |
|
594 |
/* function to print standard playlist embed code */
|
708 |
} else if ( $to_show == "iframe" ) {
|
709 |
if ( empty($usepl) ) $yt_url = $yt_id;
|
710 |
|
711 |
+
$output[] = '<iframe title="YouTube video player" width="'.$width.'" height="'.$height.'" src="//'.$yt_domain.'/embed/'.$yt_url.'?wmode=opaque'; //&enablejsapi=1';
|
712 |
+
if ( $controls ) $output[] = "&controls=0";
|
713 |
+
if ( $hideinfo ) $output[] = "&showinfo=0";
|
714 |
+
if ( $autoplay ) $output[] = "&autoplay=1";
|
715 |
+
if ( $hideanno ) $output[] = "&iv_load_policy=3";
|
716 |
+
if ( $themelight ) $output[] = "&theme=light";
|
717 |
+
|
718 |
+
$output[] = '" style="border: 0;" allowfullscreen id="'.$ytc_vid.'"></iframe>';
|
719 |
+
} if ( $to_show == "iframe2" ) {
|
720 |
+
// youtube API async
|
721 |
+
if ( empty($usepl) ) $yt_url = $yt_id;
|
722 |
+
|
723 |
$js_controls = ( $controls ) ? "controls: 0," : '';
|
724 |
$js_showinfo = ( $hideinfo ) ? "showinfo: 0," : '';
|
725 |
$js_autoplay = ( $autoplay ) ? "autoplay: 1," : '';
|
828 |
default:
|
829 |
$height = round(($width / 16 ) * 9);
|
830 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
831 |
return $height;
|
832 |
}
|
833 |
|