YouTube Channel - Version 3.0.8.1

Version Description

(2015-06-07) = * Fix: Migrate deprecated widget options * Add: Notice about changed shortcode parameters * Add: Message if access to resource is forbidden (private Liked or Favourited videos)

Download this release

Release Info

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

Code changes from version 3.0.8 to 3.0.8.1

Files changed (3) hide show
  1. readme.txt +6 -1
  2. update.php +68 -0
  3. youtube-channel.php +21 -3
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, feed, video, thumbnail, embed, sidebar, iframe, html5, responsive
5
  Requires at least: 3.9.0
6
  Tested up to: 4.2.2
7
- Stable tag: 3.0.8
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -279,6 +279,11 @@ If you really need that missing feature ASAP, feel free to [contact me](urosevic
279
  If you don't wish to pay for enhancements (then you don't care would that be implemented in a week, month, year or so), then send new [Support topic](https://wordpress.org/support/plugin/youtube-channel) with *Topic title* in format **[Feature Request] ...**
280
 
281
  == Changelog ==
 
 
 
 
 
282
  = 3.0.8 (2015-06-07) =
283
  * Fix: Undefined and deprecated global options
284
  * Add: Global option to disable builtin Lightbox (Video tab)
4
  Tags: youtube, channel, playlist, single, widget, widgets, youtube player, feed, video, thumbnail, embed, sidebar, iframe, html5, responsive
5
  Requires at least: 3.9.0
6
  Tested up to: 4.2.2
7
+ Stable tag: 3.0.8.1
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
279
  If you don't wish to pay for enhancements (then you don't care would that be implemented in a week, month, year or so), then send new [Support topic](https://wordpress.org/support/plugin/youtube-channel) with *Topic title* in format **[Feature Request] ...**
280
 
281
  == Changelog ==
282
+ = 3.0.8.1 (2015-06-07) =
283
+ * Fix: Migrate deprecated widget options
284
+ * Add: Notice about changed shortcode parameters
285
+ * Add: Message if access to resource is forbidden (private Liked or Favourited videos)
286
+
287
  = 3.0.8 (2015-06-07) =
288
  * Fix: Undefined and deprecated global options
289
  * Add: Global option to disable builtin Lightbox (Video tab)
update.php CHANGED
@@ -318,3 +318,71 @@ function au_youtube_channel_update_routine_10() {
318
  }
319
 
320
  } //END function au_youtube_channel_update_routine_10()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
318
  }
319
 
320
  } //END function au_youtube_channel_update_routine_10()
321
+
322
+
323
+ /**
324
+ * Migrate widget settings to 3.0.8
325
+ */
326
+ function au_youtube_channel_update_routine_11() {
327
+
328
+ $deprecated_widget_options = array(
329
+ 'only_pl',
330
+ 'showgoto',
331
+ 'titlebelow',
332
+ 'descappend'
333
+ );
334
+ // get YTC widgets
335
+ $ytc_widgets = get_option('widget_youtube-channel');
336
+ foreach ( $ytc_widgets as $widget_id => $widget_data ) {
337
+ // Process widget arrays, not _multiwidget bool
338
+ if ( $widget_id != '_multiwidget' ) {
339
+
340
+ // migrate only_pl to display
341
+ if ( isset($widget_data['only_pl']) ) {
342
+ $ytc_widgets[ $widget_id ]['display'] = 'playlist';
343
+ }
344
+
345
+ // migrate showbelow and showtitle
346
+ if ( isset($widget_data['showtitle']) && $widget_data['showtitle'] ) {
347
+ if ( isset($widget_data['titlebelow']) ) {
348
+ $ytc_widgets[ $widget_id ]['showtitle'] = 'above';
349
+ } else {
350
+ $ytc_widgets[ $widget_id ]['showtitle'] = 'below';
351
+ }
352
+ } else {
353
+ $ytc_widgets[ $widget_id ]['showtitle'] = 'none';
354
+ }
355
+
356
+ // migrate link_to
357
+ if ( isset($widget_data['showgoto']) ) {
358
+
359
+ if ( isset($widget_data['link_to']) ) {
360
+ if ( $widget_data['link_to'] == 0 ) {
361
+ $ytc_widgets[ $widget_id ]['link_to'] = 'legacy';
362
+ }
363
+ elseif ( $widget_data['link_to'] == 1 ) {
364
+ $ytc_widgets[ $widget_id ]['link_to'] = 'channel';
365
+ }
366
+ elseif ( $widget_data['link_to'] == 2 ) {
367
+ $ytc_widgets[ $widget_id ]['link_to'] = 'vanity';
368
+ }
369
+ } else {
370
+ $ytc_widgets[ $widget_id ]['link_to'] = 'none';
371
+ }
372
+ } else {
373
+ $ytc_widgets[ $widget_id ]['link_to'] = 'none';
374
+ }
375
+
376
+ // Delete deprecated option
377
+ foreach ( $deprecated_widget_options as $deprecated_option_key ) {
378
+ if ( isset($widget_data[ $deprecated_option_key ]) ) {
379
+ unset ($ytc_widgets[ $widget_id ][ $deprecated_option_key ]);
380
+ }
381
+ }
382
+
383
+ } // END if ( $widget_id != '_multiwidget' )
384
+
385
+ } // END foreach ( $ytc_widgets as $widget_id => $widget_data )
386
+
387
+ update_option('widget_youtube-channel', $ytc_widgets);
388
+ } //END function au_youtube_channel_update_routine_11()
youtube-channel.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: YouTube Channel
4
  Plugin URI: http://urosevic.net/wordpress/plugins/youtube-channel/
5
  Description: Quick and easy embed latest or random videos from YouTube channel (user uploads, liked or favourited videos) or playlist. Use <a href="widgets.php">widget</a> for sidebar or shortcode for content. Works with <em>YouTube Data API v3</em>.
6
  Author: Aleksandar Urošević
7
- Version: 3.0.8
8
  Author URI: http://urosevic.net/
9
  */
10
 
@@ -16,8 +16,8 @@ if ( ! class_exists('WPAU_YOUTUBE_CHANNEL') )
16
  class WPAU_YOUTUBE_CHANNEL
17
  {
18
 
19
- const DB_VER = 10;
20
- const VER = '3.0.8';
21
 
22
  public $plugin_name = "YouTube Channel";
23
  public $plugin_slug = "youtube-channel";
@@ -251,6 +251,10 @@ if ( ! class_exists('WPAU_YOUTUBE_CHANNEL') )
251
  $dismissed_notices['vanity_option'] = 1;
252
  update_option('youtube_channel_dismissed_notices', $dismissed_notices);
253
  }
 
 
 
 
254
 
255
  // Prepare vars for notices
256
  $settings_page = 'options-general.php?page=youtube-channel';
@@ -301,6 +305,16 @@ if ( ! class_exists('WPAU_YOUTUBE_CHANNEL') )
301
  );
302
  }
303
 
 
 
 
 
 
 
 
 
 
 
304
  foreach ( $notice as $type => $message ) {
305
  if ( ! empty($message) ) {
306
  echo "<div class=\"notice notice-{$type}\">{$message}</div>";
@@ -758,6 +772,10 @@ if ( ! class_exists('WPAU_YOUTUBE_CHANNEL') )
758
  elseif ( $json_output->error->errors[0]->reason == 'invalidChannelId' ) {
759
  $error_msg = sprintf(__("You have set wrong Channel ID. Fix that in General plugin settings, Widget and/or shortcode. Read <a href=\"%s\" target=\"_blank\">FAQ</a> document."), 'https://wordpress.org/plugins/youtube-channel/faq/');
760
  }
 
 
 
 
761
 
762
  } else { // ELSE ! empty($json_output->error->errors)
763
 
4
  Plugin URI: http://urosevic.net/wordpress/plugins/youtube-channel/
5
  Description: Quick and easy embed latest or random videos from YouTube channel (user uploads, liked or favourited videos) or playlist. Use <a href="widgets.php">widget</a> for sidebar or shortcode for content. Works with <em>YouTube Data API v3</em>.
6
  Author: Aleksandar Urošević
7
+ Version: 3.0.8.1
8
  Author URI: http://urosevic.net/
9
  */
10
 
16
  class WPAU_YOUTUBE_CHANNEL
17
  {
18
 
19
+ const DB_VER = 11;
20
+ const VER = '3.0.8.1';
21
 
22
  public $plugin_name = "YouTube Channel";
23
  public $plugin_slug = "youtube-channel";
251
  $dismissed_notices['vanity_option'] = 1;
252
  update_option('youtube_channel_dismissed_notices', $dismissed_notices);
253
  }
254
+ if ( ! empty($_GET['ytc_dismiss_notice_changed_shortcode_308']) ) {
255
+ $dismissed_notices['changed_shortcode_308'] = 1;
256
+ update_option('youtube_channel_dismissed_notices', $dismissed_notices);
257
+ }
258
 
259
  // Prepare vars for notices
260
  $settings_page = 'options-general.php?page=youtube-channel';
305
  );
306
  }
307
 
308
+ // v3.0.8.1 shortcode changes from v3.0.8
309
+ if ( empty($dismissed_notices) || ( ! empty($dismissed_notices) && empty($dismissed_notices['changed_shortcode_308']) ) ) {
310
+ $notice['warning'] .= sprintf(
311
+ __('<p><strong>%s</strong> changed shortcode parameters by removing <code>only_pl</code> and <code>showgoto</code>, and combining with parameters <code>display</code> and <code>link_to</code> respectively. Please check out <a href="%s&tab=help">%s</a> and update your shortcodes. <a href="%s" class="dismiss">Dismiss</a>', 'youtube-channel'),
312
+ $this->plugin_name,
313
+ $settings_page,
314
+ 'Help: How to use shortcode',
315
+ '?ytc_dismiss_notice_changed_shortcode_308=1'
316
+ );
317
+ }
318
  foreach ( $notice as $type => $message ) {
319
  if ( ! empty($message) ) {
320
  echo "<div class=\"notice notice-{$type}\">{$message}</div>";
772
  elseif ( $json_output->error->errors[0]->reason == 'invalidChannelId' ) {
773
  $error_msg = sprintf(__("You have set wrong Channel ID. Fix that in General plugin settings, Widget and/or shortcode. Read <a href=\"%s\" target=\"_blank\">FAQ</a> document."), 'https://wordpress.org/plugins/youtube-channel/faq/');
774
  }
775
+ // Forbidden access to resource
776
+ elseif ( $json_output->error->errors[0]->reason == 'playlistItemsNotAccessible' ) {
777
+ $error_msg = sprintf(__("You do not have permission to access ressource <strong>%s</strong> (it's maybe set to private or even does not exists!)"), $resource_id);
778
+ }
779
 
780
  } else { // ELSE ! empty($json_output->error->errors)
781