YouTube Channel - Version 2.4.1.4

Version Description

(2015-04-09) = * (2015-04-09) Add: Notification about old PHP if lower than 5.3.29 * Change: Run admin functions only in dashboard * (2015-02-09) Fix: strip whitespace from the beginngine/end of channel and playlist ID * (2014-12-30) Fix: prevent Undefined Offset notice when on resource we get less items than user requested in shortcode/widget

Download this release

Release Info

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

Code changes from version 2.4.1.3 to 2.4.1.4

Files changed (2) hide show
  1. readme.txt +13 -2
  2. youtube-channel.php +32 -16
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: urkekg
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Q6Q762MQ97XJ6
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.3
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -32,7 +32,12 @@ If you like this extension and you find it useful, please rate it on the right s
32
  * Optional video autoplay with optional muted audio
33
  * Show customized link to channel below videos
34
 
 
 
 
 
35
  = Styling =
 
36
  You can use `style.css` from theme to style `YouTube Video` widget content.
37
 
38
  * `.youtube_channel` - main widget wrapper class (non-responsive block have additional class `default`, responsive block have additional class `responsive`)
@@ -128,6 +133,12 @@ Also, even when hidding logo works for your video, on hover or when video is pau
128
 
129
  == Changelog ==
130
 
 
 
 
 
 
 
131
  = 2.4.1.3 (2014-12-10) =
132
  * Fix: previous release broke opening lightbox for thumbnails and load YouTube website.
133
 
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Q6Q762MQ97XJ6
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.1.4
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
32
  * Optional video autoplay with optional muted audio
33
  * Show customized link to channel below videos
34
 
35
+ = Notice =
36
+
37
+ For fully functional plugin you need to have PHP 5.3.29 or newer! If you experience issues on older PHP, we can't help you as we don't have access to such old development platform.
38
+
39
  = Styling =
40
+
41
  You can use `style.css` from theme to style `YouTube Video` widget content.
42
 
43
  * `.youtube_channel` - main widget wrapper class (non-responsive block have additional class `default`, responsive block have additional class `responsive`)
133
 
134
  == Changelog ==
135
 
136
+ = 2.4.1.4 (2015-04-09) =
137
+ * (2015-04-09) Add: Notification about old PHP if lower than 5.3.29
138
+ * Change: Run admin functions only in dashboard
139
+ * (2015-02-09) Fix: strip whitespace from the beginngine/end of channel and playlist ID
140
+ * (2014-12-30) Fix: prevent Undefined Offset notice when on resource we get less items than user requested in shortcode/widget
141
+
142
  = 2.4.1.3 (2014-12-10) =
143
  * Fix: previous release broke opening lightbox for thumbnails and load YouTube website.
144
 
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.3
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.3";
21
  public $plugin_name = "YouTube Channel";
22
  public $plugin_slug = "youtube-channel";
23
  public $plugin_option = "youtube_channel_defaults";
@@ -49,19 +49,26 @@ if ( !class_exists('WPAU_YOUTUBE_CHANNEL') )
49
  add_shortcode( 'youtube_channel', array($this, 'shortcode') );
50
  add_shortcode( 'ytc', array($this, 'shortcode') );
51
 
52
- // Update YTC version in database on request
53
- if ( !empty($_GET['ytc_dismiss_update_notice']) )
54
- update_option( 'ytc_version', $this->plugin_version );
 
55
 
56
- // Update Redux notice
57
- if ( !empty($_GET['ytc_ignore_redux']) )
58
- update_option( 'ytc_no_redux_notice', true);
59
 
60
- // add dashboard notice if version changed
61
- $version = get_option('ytc_version','0');
62
- if ( version_compare($version, $this->plugin_version, "<") )
63
- add_action( 'admin_notices', array($this, 'admin_notices') );
64
 
 
 
 
 
 
 
65
  add_action( 'wp_enqueue_scripts', array($this, 'enqueue_scripts') );
66
  add_action( 'wp_footer', array($this, 'footer_scripts') );
67
 
@@ -117,6 +124,11 @@ if ( !class_exists('WPAU_YOUTUBE_CHANNEL') )
117
  $this->plugin_version);
118
  } // end admin_notices
119
 
 
 
 
 
 
120
  function admin_notice_redux()
121
  {
122
  $ignoreredux = ' <a href="?ytc_ignore_redux=1" class="button primary">'.__("Dismiss this notice", 'youtube-channel') . '</a>';
@@ -396,12 +408,12 @@ function ytc_mute(event){
396
  {
397
 
398
  // set default channel if nothing predefined
399
- $channel = $instance['channel'];
400
- if ( $channel == "" ) $channel = $this->channel_id;
401
 
402
  // set playlist id
403
- $playlist = $instance['playlist'];
404
- if ( $playlist == "" ) $playlist = $this->playlist_id;
405
 
406
  // trim PL in front of playlist ID
407
  $playlist = preg_replace('/^PL/', '', $playlist);
@@ -506,6 +518,10 @@ function ytc_mute(event){
506
 
507
  if ( $getrnd ) $rnd_used = array(); // set array for unique random item
508
 
 
 
 
 
509
  for ($y = 1; $y <= $vidqty; $y++) {
510
  if ( $getrnd ) {
511
  $rnd_item = mt_rand(0, (count($items)-1));
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.4
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.4";
21
  public $plugin_name = "YouTube Channel";
22
  public $plugin_slug = "youtube-channel";
23
  public $plugin_option = "youtube_channel_defaults";
49
  add_shortcode( 'youtube_channel', array($this, 'shortcode') );
50
  add_shortcode( 'ytc', array($this, 'shortcode') );
51
 
52
+ if ( is_admin() ) {
53
+ // Update YTC version in database on request
54
+ if ( !empty($_GET['ytc_dismiss_update_notice']) )
55
+ update_option( 'ytc_version', $this->plugin_version );
56
 
57
+ // Update Redux notice
58
+ if ( !empty($_GET['ytc_ignore_redux']) )
59
+ update_option( 'ytc_no_redux_notice', true);
60
 
61
+ // add dashboard notice if version changed
62
+ $version = get_option('ytc_version','0');
63
+ if ( version_compare($version, $this->plugin_version, "<") )
64
+ add_action( 'admin_notices', array($this, 'admin_notices') );
65
 
66
+ // add dashboard notice if old PHP
67
+ if ( version_compare(PHP_VERSION, "5.3.29", "<") )
68
+ add_action( 'admin_notices', array($this, 'admin_notices_old_php') );
69
+ }
70
+
71
+ // enqueue scripts
72
  add_action( 'wp_enqueue_scripts', array($this, 'enqueue_scripts') );
73
  add_action( 'wp_footer', array($this, 'footer_scripts') );
74
 
124
  $this->plugin_version);
125
  } // end admin_notices
126
 
127
+ function admin_notices_old_php()
128
+ {
129
+ echo '<div class="error"><p>Your WordPress running on server with PHP version '.PHP_VERSION.'. YouTube Channel plugin requires at least PHP 5.3.29 so if you experience any issue, we can`t help.</p></div>';
130
+ } // END admin_notices_old_php()
131
+
132
  function admin_notice_redux()
133
  {
134
  $ignoreredux = ' <a href="?ytc_ignore_redux=1" class="button primary">'.__("Dismiss this notice", 'youtube-channel') . '</a>';
408
  {
409
 
410
  // set default channel if nothing predefined
411
+ $channel = trim($instance['channel']);
412
+ if ( $channel == "" ) $channel = trim($this->channel_id);
413
 
414
  // set playlist id
415
+ $playlist = trim($instance['playlist']);
416
+ if ( $playlist == "" ) $playlist = trim($this->playlist_id);
417
 
418
  // trim PL in front of playlist ID
419
  $playlist = preg_replace('/^PL/', '', $playlist);
518
 
519
  if ( $getrnd ) $rnd_used = array(); // set array for unique random item
520
 
521
+ /* AU:20141230 reduce number of videos if requested i greater than available */
522
+ if ( $vidqty > sizeof($items) )
523
+ $vidqty = sizeof($items);
524
+
525
  for ($y = 1; $y <= $vidqty; $y++) {
526
  if ( $getrnd ) {
527
  $rnd_item = mt_rand(0, (count($items)-1));