YouTube Channel - Version 1.5.1

Version Description

  • Fix issue in widget settings when no apache_get_version() support on server
  • Fix validation errors for widget settings
  • Fix broken sidebar issue introduced in 1.5.0 release
Download this release

Release Info

Developer urkekg
Plugin Icon YouTube Channel
Version 1.5.1
Comparing to
See all releases

Code changes from version 1.5.0 to 1.5.1

Files changed (2) hide show
  1. readme.txt +6 -1
  2. youtube-channel.php +40 -27
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.4.0
6
  Tested up to: 3.5.1
7
- Stable tag: 1.5.0
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -109,6 +109,11 @@ Value for `Fetch latest` says how many items will containt set of videos for cho
109
  value for `Show ... videos` says how many videos will be displayed in widget.
110
 
111
  == Changelog ==
 
 
 
 
 
112
  = 1.5.0 =
113
  * Add inline debug tracker
114
  * Fix deprecated functions - changed rss.php by feed.php and split() by extract()
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.4.0
6
  Tested up to: 3.5.1
7
+ Stable tag: 1.5.1
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
109
  value for `Show ... videos` says how many videos will be displayed in widget.
110
 
111
  == Changelog ==
112
+ = 1.5.1 =
113
+ * Fix issue in widget settings when no apache_get_version() support on server
114
+ * Fix validation errors for widget settings
115
+ * Fix broken sidebar issue introduced in 1.5.0 release
116
+
117
  = 1.5.0 =
118
  * Add inline debug tracker
119
  * Fix deprecated functions - changed rss.php by feed.php and split() by extract()
youtube-channel.php CHANGED
@@ -4,11 +4,11 @@ Plugin Name: YouTube Channel
4
  Plugin URI: http://blog.urosevic.net/wordpress/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: 1.5.0
8
  Author URI: http://urosevic.net/
9
  */
10
  error_reporting(E_DEPRECATED);
11
- define( 'YTCVER', '1.5.0' );
12
  define( 'YOUTUBE_CHANNEL_URL', plugin_dir_url(__FILE__) );
13
  define( 'YTCPLID', 'PLEC850BE962234400' );
14
  define( 'YTCUID', 'urkekg' );
@@ -71,7 +71,7 @@ class YouTube_Channel_Widget extends WP_Widget {
71
  <h4><?php _e('Video property', 'youtube-channel'); ?></h4>
72
  <p><label for="<?php echo $this->get_field_id('width'); ?>"><?php _e('Width', 'youtube-channel'); ?> (<?php _e('default', 'youtube-channel'); ?> 220):</label> <input class="small-text" id="<?php echo $this->get_field_id('width'); ?>" name="<?php echo $this->get_field_name('width'); ?>" type="number" min="32" value="<?php echo $width; ?>" /> px</p>
73
  <p><label for="<?php echo $this->get_field_id('height'); ?>"><?php _e('Height', 'youtube-channel'); ?> (<?php _e('default', 'youtube-channel'); ?> 165):</label> <input class="small-text" id="<?php echo $this->get_field_id('height'); ?>" name="<?php echo $this->get_field_name('height'); ?>" type="number" min="32" value="<?php echo $height; ?>" /> px</p>
74
- <p><label for="<?php echo $this->get_field_id('to_show'); ?>"><?php _e('Aspect ratio (relative to width):', 'youtube-channel'); ?>
75
  <select class="widefat" id="<?php echo $this->get_field_id( 'ratio' ); ?>" name="<?php echo $this->get_field_name( 'ratio' ); ?>">
76
  <option value="0"<?php selected( $instance['ratio'], 0 ); ?>><?php _e('custom', 'youtube-channel'); ?></option>
77
  <option value="1"<?php selected( $instance['ratio'], 1 ); ?>>4:3</option>
@@ -79,7 +79,7 @@ class YouTube_Channel_Widget extends WP_Widget {
79
  <option value="3"<?php selected( $instance['ratio'], 3 ); ?>>16:9</option>
80
  </select>
81
  </p>
82
- <p><label for="<?php echo $this->get_field_id('to_show'); ?>"><?php _e('What to show?', 'youtube-channel'); ?>
83
  <select class="widefat" id="<?php echo $this->get_field_id( 'to_show' ); ?>" name="<?php echo $this->get_field_name( 'to_show' ); ?>">
84
  <option value="thumbnail"<?php selected( $instance['to_show'], 'thumbnail' ); ?>><?php _e('thumbnail', 'youtube-channel'); ?></option>
85
  <option value="object"<?php selected( $instance['to_show'], 'object' ); ?>><?php _e('object (flash player)', 'youtube-channel'); ?></option>
@@ -93,33 +93,42 @@ class YouTube_Channel_Widget extends WP_Widget {
93
  <?php /*if ( $instance['to_show'] == 'thumbnail' && $instance['lightbox'] && !is_plugin_active('wp-video-lightbox/wp-video-lightbox.php') ){ echo '<p>To load videos in lightbox please install and activate <a href="http://wordpress.org/extend/plugins/wp-video-lightbox/">WP Video Lightbox</a> plugin by Ruhul Amin.</p>'; } */?>
94
  <input class="checkbox" type="checkbox" <?php checked( (bool) $instance['autoplay'], true ); ?> id="<?php echo $this->get_field_id( 'autoplay' ); ?>" name="<?php echo $this->get_field_name( 'autoplay' ); ?>" /> <label for="<?php echo $this->get_field_id( 'autoplay' ); ?>"><?php _e('Autoplay video or playlist', 'youtube-channel'); ?></label></p>
95
  <h4><?php _e('Layout behaviour', 'youtube-channel'); ?></h4>
96
- <p><input class="checkbox" type="checkbox" <?php checked( (bool) $instance['showtitle'], true ); ?> id="<?php echo $this->get_field_id( 'showtitle' ); ?>" name="<?php echo $this->get_field_name( 'showtitle' ); ?>" /> <label for="<?php echo $this->get_field_id( 'showtitle' ); ?>"><?php _e('Show video title', 'youtube-channel'); ?></label><br />
97
- <input class="checkbox" type="checkbox" <?php checked( (bool) $instance['showvidesc'], true ); ?> id="<?php echo $this->get_field_id( 'showvidesc' ); ?>" name="<?php echo $this->get_field_name( 'showvidesc' ); ?>" /> <label for="<?php echo $this->get_field_id( 'showvidesc' ); ?>"><?php _e('Show video description', 'youtube-channel'); ?></label><br />
98
- <label for="<?php echo $this->get_field_id('videsclen'); ?>"><?php _e('Description length', 'youtube-channel'); ?>: <input class="small-text" id="<?php echo $this->get_field_id('videsclen'); ?>" name="<?php echo $this->get_field_name('videsclen'); ?>" type="number" value="<?php echo $videsclen; ?>" /> (0 = full)</label><br />
99
- <label for="descappend">Et cetera string <input class="small-text" id="<?php echo $this->get_field_id('descappend'); ?>" name="<?php echo $this->get_field_name('descappend'); ?>" type="text" value="<?php echo $descappend; ?>" /> default &amp;hellip;</label><br />
100
- <input class="checkbox" type="checkbox" <?php checked( (bool) $instance['hideanno'], true ); ?> id="<?php echo $this->get_field_id( 'hideanno' ); ?>" name="<?php echo $this->get_field_name( 'hideanno' ); ?>" /> <label for="<?php echo $this->get_field_id( 'hideanno' ); ?>"><?php _e('Hide annotations from video', 'youtube-channel'); ?></label><br />
101
- <input class="checkbox" type="checkbox" <?php checked( (bool) $instance['hideinfo'], true ); ?> id="<?php echo $this->get_field_id( 'hideinfo' ); ?>" name="<?php echo $this->get_field_name( 'hideinfo' ); ?>" /> <label for="<?php echo $this->get_field_id( 'hideinfo' ); ?>"><?php _e('Hide video info', 'youtube-channel'); ?></label></p>
102
- </p>
 
103
  <h4><?php _e('Link to channel', 'youtube-channel'); ?></h4>
104
- <p><label for="<?php echo $this->get_field_id('goto_txt'); ?>"><?php _e('Visit YouTube Channel text:', 'youtube-channel'); ?> <input class="widefat" id="<?php echo $this->get_field_id('goto_txt'); ?>" name="<?php echo $this->get_field_name('goto_txt'); ?>" type="text" value="<?php echo $goto_txt; ?>" /></label>
105
- <input class="checkbox" type="checkbox" <?php checked( (bool) $instance['showgoto'], true ); ?> id="<?php echo $this->get_field_id( 'showgoto' ); ?>" name="<?php echo $this->get_field_name( 'showgoto' ); ?>" /> <label for="<?php echo $this->get_field_id( 'showgoto' ); ?>"><?php _e('Show link to channel', 'youtube-channel'); ?></label><br />
106
- <input class="checkbox" type="checkbox" <?php checked( (bool) $instance['popupgoto'], true ); ?> id="<?php echo $this->get_field_id( 'popupgoto' ); ?>" name="<?php echo $this->get_field_name( 'popupgoto' ); ?>" /> <label for="<?php echo $this->get_field_id( 'popupgoto' ); ?>"><?php _e('Open channel in new window/tab', 'youtube-channel'); ?></label><br />
107
- <input class="checkbox" type="checkbox" <?php checked( (bool) $instance['target'], true ); ?> id="<?php echo $this->get_field_id( 'target' ); ?>" name="<?php echo $this->get_field_name( 'target' ); ?>" /> <label for="<?php echo $this->get_field_id( 'target' ); ?>"><?php _e('Use target="_blank" (invalid XHTML)', 'youtube-channel'); ?></label></p>
 
 
108
 
109
  <h4><?php _e('Debug YTC', 'youtube-channel'); ?></h4>
110
- <p><input class="checkbox" type="checkbox" <?php checked( (bool) $instance['debugon'], true ); ?> id="<?php echo $this->get_field_id( 'debugon' ); ?>" name="<?php echo $this->get_field_name( 'debugon' ); ?>" /><label for="debugon">Enable debugging</label><br />
111
- <?php if ( $instance['debugon'] ) {
 
 
 
112
  $debug_arr = array_merge(
113
  array(
114
- 'apache ver' => apache_get_version(),
115
- 'php ver' => phpversion(),
116
- 'wp ver' => get_bloginfo('version'),
117
- 'ytc ver' => YTCVER
118
  ),
119
- $instance); ?>
120
- <textarea name="debug" class="widefat" style="height: 100px;"><?php var_export($debug_arr); ?></textarea><br />
121
- Insert debug data to <a href="http://wordpress.org/support/plugin/youtube-channel" target="_support">support forum</a>.
122
- <?php } ?></p>
 
 
 
123
 
124
  <p><input type="button" value="Support YTC / Donate via PayPal" onclick="window.location='https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Q6Q762MQ97XJ6'" class="button-secondary"></p>
125
 
@@ -200,7 +209,7 @@ Insert debug data to <a href="http://wordpress.org/support/plugin/youtube-channe
200
  $rss_settings = '?alt=rss&v=2';
201
  if ( !$instance['fixnoitem'] )
202
  $rss_settings .= '&orderby=published';
203
-
204
  #$vidqty = $instance['vidqty'];
205
  #if ( $maxrnd > $vidqty ) {}
206
  $rss_settings .= '&rel=0&max-results='.$maxrnd;
@@ -215,7 +224,9 @@ Insert debug data to <a href="http://wordpress.org/support/plugin/youtube-channe
215
 
216
  //include_once(ABSPATH . WPINC . '/rss.php');
217
  include_once(ABSPATH . WPINC . '/feed.php');
 
218
  $rss = fetch_feed($rss_url);
 
219
  if ( !is_wp_error($rss) ) {
220
  $getrnd = $instance['getrnd'];
221
  $vidqty = $instance['vidqty'];
@@ -466,7 +477,8 @@ function height_ratio($width, $ratio) {
466
 
467
  // function to insert link to channel
468
  function ytc_channel_link($instance) {
469
- //$output = '';
 
470
  // do we need to show goto link?
471
  if ( $instance['showgoto'] ) {
472
  $channel = $instance['channel'];
@@ -490,6 +502,7 @@ function ytc_channel_link($instance) {
490
  $output[] = '</div>';
491
 
492
  } // showgoto
 
493
  return $output;
494
  }
495
 
4
  Plugin URI: http://blog.urosevic.net/wordpress/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: 1.5.1
8
  Author URI: http://urosevic.net/
9
  */
10
  error_reporting(E_DEPRECATED);
11
+ define( 'YTCVER', '1.5.1' );
12
  define( 'YOUTUBE_CHANNEL_URL', plugin_dir_url(__FILE__) );
13
  define( 'YTCPLID', 'PLEC850BE962234400' );
14
  define( 'YTCUID', 'urkekg' );
71
  <h4><?php _e('Video property', 'youtube-channel'); ?></h4>
72
  <p><label for="<?php echo $this->get_field_id('width'); ?>"><?php _e('Width', 'youtube-channel'); ?> (<?php _e('default', 'youtube-channel'); ?> 220):</label> <input class="small-text" id="<?php echo $this->get_field_id('width'); ?>" name="<?php echo $this->get_field_name('width'); ?>" type="number" min="32" value="<?php echo $width; ?>" /> px</p>
73
  <p><label for="<?php echo $this->get_field_id('height'); ?>"><?php _e('Height', 'youtube-channel'); ?> (<?php _e('default', 'youtube-channel'); ?> 165):</label> <input class="small-text" id="<?php echo $this->get_field_id('height'); ?>" name="<?php echo $this->get_field_name('height'); ?>" type="number" min="32" value="<?php echo $height; ?>" /> px</p>
74
+ <p><label for="<?php echo $this->get_field_id('ratio'); ?>"><?php _e('Aspect ratio (relative to width):', 'youtube-channel'); ?></label>
75
  <select class="widefat" id="<?php echo $this->get_field_id( 'ratio' ); ?>" name="<?php echo $this->get_field_name( 'ratio' ); ?>">
76
  <option value="0"<?php selected( $instance['ratio'], 0 ); ?>><?php _e('custom', 'youtube-channel'); ?></option>
77
  <option value="1"<?php selected( $instance['ratio'], 1 ); ?>>4:3</option>
79
  <option value="3"<?php selected( $instance['ratio'], 3 ); ?>>16:9</option>
80
  </select>
81
  </p>
82
+ <p><label for="<?php echo $this->get_field_id('to_show'); ?>"><?php _e('What to show?', 'youtube-channel'); ?></label>
83
  <select class="widefat" id="<?php echo $this->get_field_id( 'to_show' ); ?>" name="<?php echo $this->get_field_name( 'to_show' ); ?>">
84
  <option value="thumbnail"<?php selected( $instance['to_show'], 'thumbnail' ); ?>><?php _e('thumbnail', 'youtube-channel'); ?></option>
85
  <option value="object"<?php selected( $instance['to_show'], 'object' ); ?>><?php _e('object (flash player)', 'youtube-channel'); ?></option>
93
  <?php /*if ( $instance['to_show'] == 'thumbnail' && $instance['lightbox'] && !is_plugin_active('wp-video-lightbox/wp-video-lightbox.php') ){ echo '<p>To load videos in lightbox please install and activate <a href="http://wordpress.org/extend/plugins/wp-video-lightbox/">WP Video Lightbox</a> plugin by Ruhul Amin.</p>'; } */?>
94
  <input class="checkbox" type="checkbox" <?php checked( (bool) $instance['autoplay'], true ); ?> id="<?php echo $this->get_field_id( 'autoplay' ); ?>" name="<?php echo $this->get_field_name( 'autoplay' ); ?>" /> <label for="<?php echo $this->get_field_id( 'autoplay' ); ?>"><?php _e('Autoplay video or playlist', 'youtube-channel'); ?></label></p>
95
  <h4><?php _e('Layout behaviour', 'youtube-channel'); ?></h4>
96
+ <p>
97
+ <input class="checkbox" type="checkbox" <?php checked( (bool) $instance['showtitle'], true ); ?> id="<?php echo $this->get_field_id( 'showtitle' ); ?>" name="<?php echo $this->get_field_name( 'showtitle' ); ?>" /> <label for="<?php echo $this->get_field_id( 'showtitle' ); ?>"><?php _e('Show video title', 'youtube-channel'); ?></label><br />
98
+ <input class="checkbox" type="checkbox" <?php checked( (bool) $instance['showvidesc'], true ); ?> id="<?php echo $this->get_field_id( 'showvidesc' ); ?>" name="<?php echo $this->get_field_name( 'showvidesc' ); ?>" /> <label for="<?php echo $this->get_field_id( 'showvidesc' ); ?>"><?php _e('Show video description', 'youtube-channel'); ?></label><br />
99
+ <label for="<?php echo $this->get_field_id('videsclen'); ?>"><?php _e('Description length', 'youtube-channel'); ?>: <input class="small-text" id="<?php echo $this->get_field_id('videsclen'); ?>" name="<?php echo $this->get_field_name('videsclen'); ?>" type="number" value="<?php echo $videsclen; ?>" /> (0 = full)</label><br />
100
+ <label for="<?php echo $this->get_field_id('descappend'); ?>"><?php _e('Et cetera string', 'youtube-channel'); ?> <input class="small-text" id="<?php echo $this->get_field_id('descappend'); ?>" name="<?php echo $this->get_field_name('descappend'); ?>" type="text" value="<?php echo $descappend; ?>" /> default &amp;hellip;</label><br />
101
+ <input class="checkbox" type="checkbox" <?php checked( (bool) $instance['hideanno'], true ); ?> id="<?php echo $this->get_field_id( 'hideanno' ); ?>" name="<?php echo $this->get_field_name( 'hideanno' ); ?>" /> <label for="<?php echo $this->get_field_id( 'hideanno' ); ?>"><?php _e('Hide annotations from video', 'youtube-channel'); ?></label><br />
102
+ <input class="checkbox" type="checkbox" <?php checked( (bool) $instance['hideinfo'], true ); ?> id="<?php echo $this->get_field_id( 'hideinfo' ); ?>" name="<?php echo $this->get_field_name( 'hideinfo' ); ?>" /> <label for="<?php echo $this->get_field_id( 'hideinfo' ); ?>"><?php _e('Hide video info', 'youtube-channel'); ?></label>
103
+ </p>
104
  <h4><?php _e('Link to channel', 'youtube-channel'); ?></h4>
105
+ <p>
106
+ <label for="<?php echo $this->get_field_id('goto_txt'); ?>"><?php _e('Visit YouTube Channel text:', 'youtube-channel'); ?> <input class="widefat" id="<?php echo $this->get_field_id('goto_txt'); ?>" name="<?php echo $this->get_field_name('goto_txt'); ?>" type="text" value="<?php echo $goto_txt; ?>" /></label>
107
+ <input class="checkbox" type="checkbox" <?php checked( (bool) $instance['showgoto'], true ); ?> id="<?php echo $this->get_field_id( 'showgoto' ); ?>" name="<?php echo $this->get_field_name( 'showgoto' ); ?>" /> <label for="<?php echo $this->get_field_id( 'showgoto' ); ?>"><?php _e('Show link to channel', 'youtube-channel'); ?></label><br />
108
+ <input class="checkbox" type="checkbox" <?php checked( (bool) $instance['popupgoto'], true ); ?> id="<?php echo $this->get_field_id( 'popupgoto' ); ?>" name="<?php echo $this->get_field_name( 'popupgoto' ); ?>" /> <label for="<?php echo $this->get_field_id( 'popupgoto' ); ?>"><?php _e('Open channel in new window/tab', 'youtube-channel'); ?></label><br />
109
+ <input class="checkbox" type="checkbox" <?php checked( (bool) $instance['target'], true ); ?> id="<?php echo $this->get_field_id( 'target' ); ?>" name="<?php echo $this->get_field_name( 'target' ); ?>" /> <label for="<?php echo $this->get_field_id( 'target' ); ?>"><?php _e('Use target="_blank" (invalid XHTML)', 'youtube-channel'); ?></label>
110
+ </p>
111
 
112
  <h4><?php _e('Debug YTC', 'youtube-channel'); ?></h4>
113
+ <p>
114
+ <input class="checkbox" type="checkbox" <?php checked( (bool) $instance['debugon'], true ); ?> id="<?php echo $this->get_field_id( 'debugon' ); ?>" name="<?php echo $this->get_field_name( 'debugon' ); ?>" /> <label for="<?php echo $this->get_field_id( 'debugon' ); ?>">Enable debugging</label><br />
115
+
116
+ <?php
117
+ if ( $instance['debugon'] == 'on' ) {
118
  $debug_arr = array_merge(
119
  array(
120
+ 'server' => $_SERVER["SERVER_SOFTWARE"],
121
+ 'php' => phpversion(),
122
+ 'wp' => get_bloginfo('version'),
123
+ 'ytc' => YTCVER
124
  ),
125
+ $instance);
126
+ ?>
127
+
128
+ <textarea name="debug" class="widefat" style="height: 100px;"><?php var_export($debug_arr); ?></textarea><br />
129
+ Insert debug data to <a href="http://wordpress.org/support/plugin/youtube-channel" target="_support">support forum</a>.
130
+ <?php } ?>
131
+ </p>
132
 
133
  <p><input type="button" value="Support YTC / Donate via PayPal" onclick="window.location='https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Q6Q762MQ97XJ6'" class="button-secondary"></p>
134
 
209
  $rss_settings = '?alt=rss&v=2';
210
  if ( !$instance['fixnoitem'] )
211
  $rss_settings .= '&orderby=published';
212
+
213
  #$vidqty = $instance['vidqty'];
214
  #if ( $maxrnd > $vidqty ) {}
215
  $rss_settings .= '&rel=0&max-results='.$maxrnd;
224
 
225
  //include_once(ABSPATH . WPINC . '/rss.php');
226
  include_once(ABSPATH . WPINC . '/feed.php');
227
+
228
  $rss = fetch_feed($rss_url);
229
+
230
  if ( !is_wp_error($rss) ) {
231
  $getrnd = $instance['getrnd'];
232
  $vidqty = $instance['vidqty'];
477
 
478
  // function to insert link to channel
479
  function ytc_channel_link($instance) {
480
+ // initialize array
481
+ $output = array();
482
  // do we need to show goto link?
483
  if ( $instance['showgoto'] ) {
484
  $channel = $instance['channel'];
502
  $output[] = '</div>';
503
 
504
  } // showgoto
505
+
506
  return $output;
507
  }
508