Version Description
(20171001) =
* (20171001) Fix: Undefined index: option_page in youtube-channel/inc/settings.php on line 1006
* Add: Support for custom thumbnail quality
* (20170716) Add: native error message from Google for cases not covered by common errors (like accessNotConfigured
)
Download this release
Release Info
Developer | urkekg |
Plugin | YouTube Channel |
Version | 3.0.11.2 |
Comparing to | |
See all releases |
Code changes from version 3.0.11.1 to 3.0.11.2
- inc/settings-template.php +3 -3
- inc/settings-usage-shortcode.php +8 -0
- inc/settings.php +28 -0
- inc/widget.php +15 -0
- readme.txt +14 -2
- update.php +21 -2
- youtube-channel.php +34 -11
inc/settings-template.php
CHANGED
@@ -46,12 +46,12 @@ global $wpau_youtube_channel;
|
|
46 |
|
47 |
echo '</form>';
|
48 |
|
49 |
-
}
|
50 |
include_once( 'settings-tools.php' );
|
51 |
-
}
|
52 |
include_once( 'settings-usage.php' );
|
53 |
include_once( 'settings-usage-shortcode.php' );
|
54 |
-
}
|
55 |
include_once( 'settings-support.php' );
|
56 |
} // $active_tab != 'tools|help|support'
|
57 |
|
46 |
|
47 |
echo '</form>';
|
48 |
|
49 |
+
} elseif ( 'tools' == $active_tab ) {
|
50 |
include_once( 'settings-tools.php' );
|
51 |
+
} elseif ( 'help' == $active_tab ) {
|
52 |
include_once( 'settings-usage.php' );
|
53 |
include_once( 'settings-usage-shortcode.php' );
|
54 |
+
} elseif ( 'support' == $active_tab ) {
|
55 |
include_once( 'settings-support.php' );
|
56 |
} // $active_tab != 'tools|help|support'
|
57 |
|
inc/settings-usage-shortcode.php
CHANGED
@@ -53,6 +53,14 @@ printf(
|
|
53 |
<li>• <code>iframe2</code> HTML5 (iframe) with asynchronous loading - recommended</li>
|
54 |
<li>• <code>playlist</code> Embedded playlist</li>
|
55 |
</ul></li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
|
57 |
<li><code>no_thumb_title</code> <em>(bool)</em> By default YouTube thumbnail will have tooltip with info about video title and date of publishing. By setting this option to <code>1</code> or <code>true</code> you can hide tooltip</li>
|
58 |
<li><code>themelight</code> <em>(bool)</em> By default YouTube have dark play controls theme. By setting this option to <code>1</code> or <code>true</code> you can get light theme in player (HTML5 and Flash)</li>
|
53 |
<li>• <code>iframe2</code> HTML5 (iframe) with asynchronous loading - recommended</li>
|
54 |
<li>• <code>playlist</code> Embedded playlist</li>
|
55 |
</ul></li>
|
56 |
+
<li><code>thumb_quality</code> <em>(string)</em> Define image quality for thumbnail display mode. Default is <code>hqdefault</code>, available:
|
57 |
+
<ul>
|
58 |
+
<li>• <code>default</code> Default Quality (120x90px)</li>
|
59 |
+
<li>• <code>mqdefault</code> Medium Quality (320x180px)</li>
|
60 |
+
<li>• <code>hqdefault</code> High Quality (480x360px)</li>
|
61 |
+
<li>• <code>sddefault</code> Standard Definition (640x480px)</li>
|
62 |
+
<li>• <code>maxresdefault</code> Maximum Resolution (1280x720px)</li>
|
63 |
+
</ul></li>
|
64 |
|
65 |
<li><code>no_thumb_title</code> <em>(bool)</em> By default YouTube thumbnail will have tooltip with info about video title and date of publishing. By setting this option to <code>1</code> or <code>true</code> you can hide tooltip</li>
|
66 |
<li><code>themelight</code> <em>(bool)</em> By default YouTube have dark play controls theme. By setting this option to <code>1</code> or <code>true</code> you can get light theme in player (HTML5 and Flash)</li>
|
inc/settings.php
CHANGED
@@ -374,6 +374,28 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL_SETTINGS' ) ) {
|
|
374 |
),
|
375 |
) // args
|
376 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
377 |
// Responsive
|
378 |
add_settings_field(
|
379 |
$this->option_name . 'responsive', // id
|
@@ -1003,6 +1025,11 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL_SETTINGS' ) ) {
|
|
1003 |
|
1004 |
$sanitized = get_option( $this->option_name );
|
1005 |
|
|
|
|
|
|
|
|
|
|
|
1006 |
switch ( $_POST['option_page'] ) {
|
1007 |
|
1008 |
// --- General ---
|
@@ -1026,6 +1053,7 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL_SETTINGS' ) ) {
|
|
1026 |
$sanitized['width'] = ( ! empty( $options['width'] ) ) ? intval( $options['width'] ) : $this->defaults['width'];
|
1027 |
$sanitized['ratio'] = ( isset( $options['ratio'] ) ) ? intval( $options['ratio'] ) : $this->defaults['ratio'];
|
1028 |
$sanitized['display'] = ( ! empty( $options['display'] ) ) ? trim( $options['display'] ) : $this->defaults['display'];
|
|
|
1029 |
$sanitized['responsive'] = ( ! empty( $options['responsive'] ) && $options['responsive'] ) ? 1 : 0;
|
1030 |
$sanitized['playsinline'] = ( ! empty( $options['playsinline'] ) && $options['playsinline'] ) ? 1 : 0;
|
1031 |
$sanitized['nolightbox'] = ( ! empty( $options['nolightbox'] ) && $options['nolightbox'] ) ? 1 : 0;
|
374 |
),
|
375 |
) // args
|
376 |
);
|
377 |
+
// Thumbnail Quality
|
378 |
+
add_settings_field(
|
379 |
+
$this->option_name . 'thumb_quality', // id
|
380 |
+
__( 'Thumbnail Quality', 'youtube-channel' ), // Title
|
381 |
+
array( &$this, 'settings_field_select' ), // Callback
|
382 |
+
$this->slug . '_video', // Page
|
383 |
+
'ytc_video', // section
|
384 |
+
array(
|
385 |
+
'field' => $this->option_name . '[thumb_quality]',
|
386 |
+
'description' => __( 'Choose preferred thumbnail quality. Please be aware, if you select Maximum Resolution but video does not have that thumbnail, you will get broken thumbnail on page!', 'youtube-channel' ),
|
387 |
+
'class' => 'regular-text',
|
388 |
+
'value' => isset( $this->defaults['thumb_quality'] ) ? $this->defaults['thumb_quality'] : '0',
|
389 |
+
'items' => array(
|
390 |
+
'default' => __( 'Default Quality (120x90px)', 'youtube-channel' ),
|
391 |
+
'mqdefault' => __( 'Medium Quality (320x180px)', 'youtube-channel' ),
|
392 |
+
'hqdefault' => __( 'High Quality (480x360px)', 'youtube-channel' ),
|
393 |
+
'sddefault' => __( 'Standard Definition (640x480px)', 'youtube-channel' ),
|
394 |
+
'maxresdefault' => __( 'Maximum Resolution (1280x720px)', 'youtube-channel' ),
|
395 |
+
),
|
396 |
+
) // args
|
397 |
+
);
|
398 |
+
|
399 |
// Responsive
|
400 |
add_settings_field(
|
401 |
$this->option_name . 'responsive', // id
|
1025 |
|
1026 |
$sanitized = get_option( $this->option_name );
|
1027 |
|
1028 |
+
// If there is no POST option_page keyword, return initial plugin options
|
1029 |
+
if ( empty( $_POST['option_page'] ) ) {
|
1030 |
+
return $sanitized;
|
1031 |
+
}
|
1032 |
+
|
1033 |
switch ( $_POST['option_page'] ) {
|
1034 |
|
1035 |
// --- General ---
|
1053 |
$sanitized['width'] = ( ! empty( $options['width'] ) ) ? intval( $options['width'] ) : $this->defaults['width'];
|
1054 |
$sanitized['ratio'] = ( isset( $options['ratio'] ) ) ? intval( $options['ratio'] ) : $this->defaults['ratio'];
|
1055 |
$sanitized['display'] = ( ! empty( $options['display'] ) ) ? trim( $options['display'] ) : $this->defaults['display'];
|
1056 |
+
$sanitized['thumb_quality'] = ( ! empty( $options['thumb_quality'] ) ) ? trim( $options['thumb_quality'] ) : $this->defaults['thumb_quality'];
|
1057 |
$sanitized['responsive'] = ( ! empty( $options['responsive'] ) && $options['responsive'] ) ? 1 : 0;
|
1058 |
$sanitized['playsinline'] = ( ! empty( $options['playsinline'] ) && $options['playsinline'] ) ? 1 : 0;
|
1059 |
$sanitized['nolightbox'] = ( ! empty( $options['nolightbox'] ) && $options['nolightbox'] ) ? 1 : 0;
|
inc/widget.php
CHANGED
@@ -75,6 +75,7 @@ class WPAU_YOUTUBE_CHANNEL_Widget extends WP_Widget {
|
|
75 |
$responsive = isset( $instance['responsive'] ) ? esc_attr( $instance['responsive'] ) : 1;
|
76 |
|
77 |
$display = ! empty( $instance['display'] ) ? esc_attr( $instance['display'] ) : trim( $defaults['display'] );
|
|
|
78 |
$no_thumb_title = ! empty( $instance['no_thumb_title'] ) ? esc_attr( $instance['no_thumb_title'] ) : 0;
|
79 |
|
80 |
$themelight = ! empty( $instance['themelight'] ) ? esc_attr( $instance['themelight'] ) : '';
|
@@ -195,6 +196,19 @@ class WPAU_YOUTUBE_CHANNEL_Widget extends WP_Widget {
|
|
195 |
<option value="iframe2"<?php selected( $display, 'iframe2' ); ?>><?php _e( 'HTML5 (iframe) Asynchronous', 'youtube-channel' ); ?></option>
|
196 |
<option value="playlist"<?php selected( $display, 'playlist' ); ?>><?php _e( 'Embedded Playlist', 'youtube-channel' ); ?></option>
|
197 |
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
<input class="checkbox" type="checkbox" <?php checked( (bool) $no_thumb_title, true ); ?> id="<?php echo $this->get_field_id( 'no_thumb_title' ); ?>" name="<?php echo $this->get_field_name( 'no_thumb_title' ); ?>" /> <label for="<?php echo $this->get_field_id( 'no_thumb_title' ); ?>"><?php _e( 'Hide thumbnail tooltip', 'youtube-channel' ); ?></label><br />
|
199 |
<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)', 'youtube-channel' ); ?></label><br />
|
200 |
<input class="checkbox" type="checkbox" <?php checked( (bool) $controls, true ); ?> id="<?php echo $this->get_field_id( 'controls' ); ?>" name="<?php echo $this->get_field_name( 'controls' ); ?>" /> <label for="<?php echo $this->get_field_id( 'controls' ); ?>"><?php _e( 'Hide player controls', 'youtube-channel' ); ?></label><br />
|
@@ -299,6 +313,7 @@ class WPAU_YOUTUBE_CHANNEL_Widget extends WP_Widget {
|
|
299 |
$instance['responsive'] = isset( $new_instance['responsive'] ) ? $new_instance['responsive'] : '';
|
300 |
|
301 |
$instance['display'] = strip_tags( $new_instance['display'] );
|
|
|
302 |
$instance['no_thumb_title'] = isset( $new_instance['no_thumb_title'] ) ? $new_instance['no_thumb_title'] : false;
|
303 |
$instance['autoplay'] = isset( $new_instance['autoplay'] ) ? $new_instance['autoplay'] : false;
|
304 |
$instance['autoplay_mute'] = isset( $new_instance['autoplay_mute'] ) ? $new_instance['autoplay_mute'] : false;
|
75 |
$responsive = isset( $instance['responsive'] ) ? esc_attr( $instance['responsive'] ) : 1;
|
76 |
|
77 |
$display = ! empty( $instance['display'] ) ? esc_attr( $instance['display'] ) : trim( $defaults['display'] );
|
78 |
+
$thumb_quality = ! empty( $instance['thumb_quality'] ) ? esc_attr( $instance['thumb_quality'] ) : trim( $defaults['thumb_quality'] );
|
79 |
$no_thumb_title = ! empty( $instance['no_thumb_title'] ) ? esc_attr( $instance['no_thumb_title'] ) : 0;
|
80 |
|
81 |
$themelight = ! empty( $instance['themelight'] ) ? esc_attr( $instance['themelight'] ) : '';
|
196 |
<option value="iframe2"<?php selected( $display, 'iframe2' ); ?>><?php _e( 'HTML5 (iframe) Asynchronous', 'youtube-channel' ); ?></option>
|
197 |
<option value="playlist"<?php selected( $display, 'playlist' ); ?>><?php _e( 'Embedded Playlist', 'youtube-channel' ); ?></option>
|
198 |
</select>
|
199 |
+
|
200 |
+
<label for="<?php echo $this->get_field_id( 'thumb_quality' ); ?>">
|
201 |
+
<?php _e( 'Thumbnail Quality', 'youtube-channel' ); ?>
|
202 |
+
</label>
|
203 |
+
<select class="widefat" id="<?php echo $this->get_field_id( 'thumb_quality' ); ?>" name="<?php echo $this->get_field_name( 'thumb_quality' ); ?>">
|
204 |
+
<option value="default"<?php selected( $thumb_quality, 'default' ); ?>><?php _e( 'Default Quality (120x90px)', 'youtube-channel' ); ?></option>
|
205 |
+
<option value="mqdefault"<?php selected( $thumb_quality, 'mqdefault' ); ?>><?php _e( 'Medium Quality (320x180px)', 'youtube-channel' ); ?></option>
|
206 |
+
<option value="hqdefault"<?php selected( $thumb_quality, 'hqdefault' ); ?>><?php _e( 'High Quality (480x360px)', 'youtube-channel' ); ?></option>
|
207 |
+
<option value="sddefault"<?php selected( $thumb_quality, 'sddefault' ); ?>><?php _e( 'Standard Definition (640x480px)', 'youtube-channel' ); ?></option>
|
208 |
+
<option value="maxresdefault"<?php selected( $thumb_quality, 'maxresdefault' ); ?>><?php _e( 'Maximum Resolution (1280x720px)', 'youtube-channel' ); ?></option>
|
209 |
+
</select>
|
210 |
+
|
211 |
+
|
212 |
<input class="checkbox" type="checkbox" <?php checked( (bool) $no_thumb_title, true ); ?> id="<?php echo $this->get_field_id( 'no_thumb_title' ); ?>" name="<?php echo $this->get_field_name( 'no_thumb_title' ); ?>" /> <label for="<?php echo $this->get_field_id( 'no_thumb_title' ); ?>"><?php _e( 'Hide thumbnail tooltip', 'youtube-channel' ); ?></label><br />
|
213 |
<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)', 'youtube-channel' ); ?></label><br />
|
214 |
<input class="checkbox" type="checkbox" <?php checked( (bool) $controls, true ); ?> id="<?php echo $this->get_field_id( 'controls' ); ?>" name="<?php echo $this->get_field_name( 'controls' ); ?>" /> <label for="<?php echo $this->get_field_id( 'controls' ); ?>"><?php _e( 'Hide player controls', 'youtube-channel' ); ?></label><br />
|
313 |
$instance['responsive'] = isset( $new_instance['responsive'] ) ? $new_instance['responsive'] : '';
|
314 |
|
315 |
$instance['display'] = strip_tags( $new_instance['display'] );
|
316 |
+
$instance['thumb_quality'] = strip_tags( $new_instance['thumb_quality'] );
|
317 |
$instance['no_thumb_title'] = isset( $new_instance['no_thumb_title'] ) ? $new_instance['no_thumb_title'] : false;
|
318 |
$instance['autoplay'] = isset( $new_instance['autoplay'] ) ? $new_instance['autoplay'] : false;
|
319 |
$instance['autoplay_mute'] = isset( $new_instance['autoplay_mute'] ) ? $new_instance['autoplay_mute'] : false;
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: urkekg
|
|
3 |
Donate link: https://urosevic.net/wordpress/donate/?donate_for=youtube-channel
|
4 |
Tags: youtube, channel, playlist, single, widget, widgets, youtube player, feed, video, thumbnail, embed, sidebar, iframe, html5, responsive
|
5 |
Requires at least: 4.0
|
6 |
-
Tested up to: 4.
|
7 |
-
Stable tag: 3.0.11.
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -115,6 +115,12 @@ Along to Widget, you can add YouTube Channel block inline by using shortcode `[y
|
|
115 |
* `iframe` HTML5 (iframe)
|
116 |
* `iframe2` HTML5 (iframe) with asynchronous loading - recommended
|
117 |
* `playlist` Embedded playlist (same behaviour as old function `only_pl`)
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
* `no_thumb_title` (bool) By default YouTube thumbnail will have tooltip with info about video title and date of publishing. By setting this option to 1 or true you can hide tooltip
|
119 |
* `themelight` (bool) By default YouTube have dark play controls theme. By setting this option to 1 or true you can get light theme in player (HTML5 and Flash)
|
120 |
* `controls` (bool) Set this option to 1 or true to hide playback controls.
|
@@ -359,6 +365,12 @@ If you really need that missing feature ASAP, feel free to [contact me](urosevic
|
|
359 |
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] ...**
|
360 |
|
361 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
362 |
= 3.0.11.1 (20170530) =
|
363 |
* Fix: cut description in the middle of multy-byte characters (reported by @funfrog)
|
364 |
* (20170509) Fix: undefined variable `nolightbox`
|
3 |
Donate link: https://urosevic.net/wordpress/donate/?donate_for=youtube-channel
|
4 |
Tags: youtube, channel, playlist, single, widget, widgets, youtube player, feed, video, thumbnail, embed, sidebar, iframe, html5, responsive
|
5 |
Requires at least: 4.0
|
6 |
+
Tested up to: 4.9
|
7 |
+
Stable tag: 3.0.11.2
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
115 |
* `iframe` HTML5 (iframe)
|
116 |
* `iframe2` HTML5 (iframe) with asynchronous loading - recommended
|
117 |
* `playlist` Embedded playlist (same behaviour as old function `only_pl`)
|
118 |
+
* `thumb_quality` (string) Define image quality for thumbnail display mode. Default is `hqdefault`, available:
|
119 |
+
* `default` Default Quality (120x90px)
|
120 |
+
* `mqdefault` Medium Quality (320x180px)
|
121 |
+
* `hqdefault` High Quality (480x360px)
|
122 |
+
* `sddefault` Standard Definition (640x480px)
|
123 |
+
* `maxresdefault` Maximum Resolution (1280x720px)
|
124 |
* `no_thumb_title` (bool) By default YouTube thumbnail will have tooltip with info about video title and date of publishing. By setting this option to 1 or true you can hide tooltip
|
125 |
* `themelight` (bool) By default YouTube have dark play controls theme. By setting this option to 1 or true you can get light theme in player (HTML5 and Flash)
|
126 |
* `controls` (bool) Set this option to 1 or true to hide playback controls.
|
365 |
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] ...**
|
366 |
|
367 |
== Changelog ==
|
368 |
+
|
369 |
+
= 3.0.11.2 (20171001) =
|
370 |
+
* (20171001) Fix: Undefined index: option_page in youtube-channel/inc/settings.php on line 1006
|
371 |
+
* Add: Support for custom thumbnail quality
|
372 |
+
* (20170716) Add: native error message from Google for cases not covered by common errors (like `accessNotConfigured`)
|
373 |
+
|
374 |
= 3.0.11.1 (20170530) =
|
375 |
* Fix: cut description in the middle of multy-byte characters (reported by @funfrog)
|
376 |
* (20170509) Fix: undefined variable `nolightbox`
|
update.php
CHANGED
@@ -68,7 +68,7 @@ function au_youtube_channel_update_routine_2() {
|
|
68 |
$v['popup_goto'] = 0;
|
69 |
if ( 'on' == $v['popupgoto'] ) {
|
70 |
$v['popup_goto'] = 1;
|
71 |
-
}
|
72 |
$v['popup_goto'] = 2;
|
73 |
}
|
74 |
unset( $v['usepl'], $v['popupgoto'], $v['target'] );
|
@@ -169,7 +169,7 @@ function au_youtube_channel_update_routine_3() {
|
|
169 |
if ( isset( $defaults[ $old_option ] ) ) {
|
170 |
$defaults[ $new_option ] = $defaults[ $old_option ];
|
171 |
unset( $defaults[ $old_option ] );
|
172 |
-
}
|
173 |
$defaults[ $new_option ] = $init[ $new_option ];
|
174 |
}
|
175 |
}
|
@@ -474,3 +474,22 @@ function au_youtube_channel_update_routine_19() {
|
|
474 |
}
|
475 |
|
476 |
} // END function au_youtube_channel_update_routine_19()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
$v['popup_goto'] = 0;
|
69 |
if ( 'on' == $v['popupgoto'] ) {
|
70 |
$v['popup_goto'] = 1;
|
71 |
+
} elseif ( 'on' == $v['target'] ) {
|
72 |
$v['popup_goto'] = 2;
|
73 |
}
|
74 |
unset( $v['usepl'], $v['popupgoto'], $v['target'] );
|
169 |
if ( isset( $defaults[ $old_option ] ) ) {
|
170 |
$defaults[ $new_option ] = $defaults[ $old_option ];
|
171 |
unset( $defaults[ $old_option ] );
|
172 |
+
} elseif ( empty( $defaults[ $new_option ] ) ) {
|
173 |
$defaults[ $new_option ] = $init[ $new_option ];
|
174 |
}
|
175 |
}
|
474 |
}
|
475 |
|
476 |
} // END function au_youtube_channel_update_routine_19()
|
477 |
+
|
478 |
+
/**
|
479 |
+
* Add default value for new global option thumb_quality
|
480 |
+
*/
|
481 |
+
function au_youtube_channel_update_routine_20() {
|
482 |
+
|
483 |
+
// get options from DB
|
484 |
+
$defaults = get_option( 'youtube_channel_defaults' );
|
485 |
+
|
486 |
+
if ( ! isset( $defaults['thumb_quality'] ) ) {
|
487 |
+
$defaults['thumb_quality'] = 'hqdefault';
|
488 |
+
}
|
489 |
+
|
490 |
+
if ( isset( $defaults ) ) {
|
491 |
+
update_option( 'youtube_channel_defaults', $defaults );
|
492 |
+
unset( $defaults );
|
493 |
+
}
|
494 |
+
|
495 |
+
} // END function au_youtube_channel_update_routine_20()
|
youtube-channel.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: YouTube Channel
|
4 |
Plugin URI: https://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 |
-
Version: 3.0.11.
|
7 |
Author: Aleksandar Urošević
|
8 |
Author URI: https://urosevic.net/
|
9 |
Text Domain: youtube-channel
|
@@ -17,8 +17,8 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
17 |
if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
18 |
class WPAU_YOUTUBE_CHANNEL {
|
19 |
|
20 |
-
const DB_VER =
|
21 |
-
const VER = '3.0.11.
|
22 |
|
23 |
public $plugin_name = 'YouTube Channel';
|
24 |
public $plugin_slug = 'youtube-channel';
|
@@ -115,6 +115,7 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
|
115 |
'width' => 306,
|
116 |
'responsive' => 1,
|
117 |
'display' => 'thumbnail', // thumbnail, iframe, iframe2, playlist (deprecated: chromeless, object)
|
|
|
118 |
'themelight' => 0,
|
119 |
'fullscreen' => 0,
|
120 |
'controls' => 0,
|
@@ -340,7 +341,7 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
|
340 |
'Help: How to use shortcode',
|
341 |
'?ytc_dismiss_notice_changed_shortcode_308=1'
|
342 |
);
|
343 |
-
}
|
344 |
// First time install? auto dismiss this notice
|
345 |
$dismissed_notices['changed_shortcode_308'] = 1;
|
346 |
update_option( 'youtube_channel_dismissed_notices', $dismissed_notices );
|
@@ -504,6 +505,7 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
|
504 |
|
505 |
'show' => $instance['display'], // (deprecated, but keep for back compatibility) ex to_show
|
506 |
'display' => $instance['display'],
|
|
|
507 |
'no_thumb_title' => 0,
|
508 |
'themelight' => $instance['themelight'],
|
509 |
'controls' => $instance['controls'],
|
@@ -538,7 +540,7 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
|
538 |
// backward compatibility for use_res -> resource shortcode parameter
|
539 |
if ( ! empty( $atts['use_res'] ) ) {
|
540 |
$atts['resource'] = $atts['use_res'];
|
541 |
-
}
|
542 |
$atts['resource'] = $atts['res'];
|
543 |
}
|
544 |
|
@@ -561,6 +563,7 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
|
561 |
$instance['width'] = (int) $atts['width']; // 306
|
562 |
$instance['responsive'] = $atts['responsive']; // enable responsivenes?
|
563 |
$instance['display'] = $atts['display']; // thumbnail, iframe, iframe2, playlist
|
|
|
564 |
$instance['no_thumb_title'] = $atts['no_thumb_title']; // hide tooltip for thumbnails
|
565 |
|
566 |
$instance['themelight'] = $atts['themelight']; // use light theme, dark by default
|
@@ -807,6 +810,9 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
|
807 |
|
808 |
if ( 0 == $max_items ) {
|
809 |
|
|
|
|
|
|
|
810 |
// Append YouTube DATA API error reason as comment
|
811 |
if ( ! empty( $json_output ) && is_object( $json_output ) && ! empty( $json_output->error->errors ) ) {
|
812 |
|
@@ -832,11 +838,14 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
|
832 |
} elseif ( 'playlistItemsNotAccessible' == $json_output->error->errors[0]->reason ) {
|
833 |
// Forbidden access to resource
|
834 |
$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 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
835 |
}
|
836 |
-
} else { // ELSE ! empty($json_output->error->errors)
|
837 |
-
|
838 |
-
$error_msg = 'Unrecognized error experienced.';
|
839 |
-
|
840 |
} // END ! empty($json_output->error->errors)
|
841 |
|
842 |
$output .= $this->front_debug( $error_msg );
|
@@ -1114,7 +1123,6 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
|
1114 |
$yt_id = $item->snippet->resourceId->videoId;
|
1115 |
$yt_title = $item->snippet->title;
|
1116 |
$yt_date = $item->snippet->publishedAt;
|
1117 |
-
$yt_thumb = "//img.youtube.com/vi/$yt_id/0.jpg"; // zero for HD thumb
|
1118 |
|
1119 |
// Enhanced privacy?
|
1120 |
$youtube_domain = $this->youtube_domain( $instance );
|
@@ -1169,7 +1177,7 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
|
1169 |
if ( $instance['responsive'] ) {
|
1170 |
$output .= '</div>';
|
1171 |
}
|
1172 |
-
}
|
1173 |
|
1174 |
// youtube API async
|
1175 |
$js_vars = '';
|
@@ -1237,6 +1245,21 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
|
1237 |
|
1238 |
// Do we need thumbnail w/ or w/o tooltip
|
1239 |
$tag_title = ( empty( $instance['no_thumb_title'] ) ) ? $tag_title = "title=\"{$yt_title}\"" : '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1240 |
$output .= "<a href=\"//www.youtube.com/watch?v=${yt_id}${p}\" ${tag_title} class=\"ytc_thumb ${lightbox_class} ${arclass}\" ${target}><span style=\"background-image: url(${yt_thumb});\" ${tag_title} id=\"ytc_{$yt_id}\"></span></a>";
|
1241 |
|
1242 |
} // what to show conditions
|
3 |
Plugin Name: YouTube Channel
|
4 |
Plugin URI: https://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 |
+
Version: 3.0.11.2
|
7 |
Author: Aleksandar Urošević
|
8 |
Author URI: https://urosevic.net/
|
9 |
Text Domain: youtube-channel
|
17 |
if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
18 |
class WPAU_YOUTUBE_CHANNEL {
|
19 |
|
20 |
+
const DB_VER = 20;
|
21 |
+
const VER = '3.0.11.2';
|
22 |
|
23 |
public $plugin_name = 'YouTube Channel';
|
24 |
public $plugin_slug = 'youtube-channel';
|
115 |
'width' => 306,
|
116 |
'responsive' => 1,
|
117 |
'display' => 'thumbnail', // thumbnail, iframe, iframe2, playlist (deprecated: chromeless, object)
|
118 |
+
'thumb_quality' => 'hqdefault', // default, mqdefault, hqdefault, sddefault, maxresdefault
|
119 |
'themelight' => 0,
|
120 |
'fullscreen' => 0,
|
121 |
'controls' => 0,
|
341 |
'Help: How to use shortcode',
|
342 |
'?ytc_dismiss_notice_changed_shortcode_308=1'
|
343 |
);
|
344 |
+
} elseif ( empty( $dismissed_notices ) ) {
|
345 |
// First time install? auto dismiss this notice
|
346 |
$dismissed_notices['changed_shortcode_308'] = 1;
|
347 |
update_option( 'youtube_channel_dismissed_notices', $dismissed_notices );
|
505 |
|
506 |
'show' => $instance['display'], // (deprecated, but keep for back compatibility) ex to_show
|
507 |
'display' => $instance['display'],
|
508 |
+
'thumb_quality' => $instance['thumb_quality'],
|
509 |
'no_thumb_title' => 0,
|
510 |
'themelight' => $instance['themelight'],
|
511 |
'controls' => $instance['controls'],
|
540 |
// backward compatibility for use_res -> resource shortcode parameter
|
541 |
if ( ! empty( $atts['use_res'] ) ) {
|
542 |
$atts['resource'] = $atts['use_res'];
|
543 |
+
} elseif ( ! empty( $atts['res'] ) ) {
|
544 |
$atts['resource'] = $atts['res'];
|
545 |
}
|
546 |
|
563 |
$instance['width'] = (int) $atts['width']; // 306
|
564 |
$instance['responsive'] = $atts['responsive']; // enable responsivenes?
|
565 |
$instance['display'] = $atts['display']; // thumbnail, iframe, iframe2, playlist
|
566 |
+
$instance['thumb_quality'] = $atts['thumb_quality']; // default, mqdefault, hqdefault, sddefault, maxresdefault
|
567 |
$instance['no_thumb_title'] = $atts['no_thumb_title']; // hide tooltip for thumbnails
|
568 |
|
569 |
$instance['themelight'] = $atts['themelight']; // use light theme, dark by default
|
810 |
|
811 |
if ( 0 == $max_items ) {
|
812 |
|
813 |
+
// Set default error message
|
814 |
+
$error_msg = 'Unrecognized error experienced.';
|
815 |
+
|
816 |
// Append YouTube DATA API error reason as comment
|
817 |
if ( ! empty( $json_output ) && is_object( $json_output ) && ! empty( $json_output->error->errors ) ) {
|
818 |
|
838 |
} elseif ( 'playlistItemsNotAccessible' == $json_output->error->errors[0]->reason ) {
|
839 |
// Forbidden access to resource
|
840 |
$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 );
|
841 |
+
} else {
|
842 |
+
$error_msg = sprintf(
|
843 |
+
'Reason: %1$s; Domain: %2$s; Message: %3$s',
|
844 |
+
$json_output->error->errors[0]->reason,
|
845 |
+
$json_output->error->errors[0]->domain,
|
846 |
+
$json_output->error->errors[0]->message
|
847 |
+
);
|
848 |
}
|
|
|
|
|
|
|
|
|
849 |
} // END ! empty($json_output->error->errors)
|
850 |
|
851 |
$output .= $this->front_debug( $error_msg );
|
1123 |
$yt_id = $item->snippet->resourceId->videoId;
|
1124 |
$yt_title = $item->snippet->title;
|
1125 |
$yt_date = $item->snippet->publishedAt;
|
|
|
1126 |
|
1127 |
// Enhanced privacy?
|
1128 |
$youtube_domain = $this->youtube_domain( $instance );
|
1177 |
if ( $instance['responsive'] ) {
|
1178 |
$output .= '</div>';
|
1179 |
}
|
1180 |
+
} elseif ( 'iframe2' == $instance['display'] ) {
|
1181 |
|
1182 |
// youtube API async
|
1183 |
$js_vars = '';
|
1245 |
|
1246 |
// Do we need thumbnail w/ or w/o tooltip
|
1247 |
$tag_title = ( empty( $instance['no_thumb_title'] ) ) ? $tag_title = "title=\"{$yt_title}\"" : '';
|
1248 |
+
|
1249 |
+
// Define video thumbnail
|
1250 |
+
switch ( $instance['thumb_quality'] ) {
|
1251 |
+
case 'default':
|
1252 |
+
case 'mqdefault':
|
1253 |
+
case 'hqdefault':
|
1254 |
+
case 'sddefault':
|
1255 |
+
case 'maxresdefault':
|
1256 |
+
$thumb_quality = $instance['thumb_quality'];
|
1257 |
+
break;
|
1258 |
+
default:
|
1259 |
+
$thumb_quality = 'hqdefault';
|
1260 |
+
}
|
1261 |
+
$yt_thumb = "//img.youtube.com/vi/${yt_id}/${thumb_quality}.jpg"; // zero for HD thumb
|
1262 |
+
|
1263 |
$output .= "<a href=\"//www.youtube.com/watch?v=${yt_id}${p}\" ${tag_title} class=\"ytc_thumb ${lightbox_class} ${arclass}\" ${target}><span style=\"background-image: url(${yt_thumb});\" ${tag_title} id=\"ytc_{$yt_id}\"></span></a>";
|
1264 |
|
1265 |
} // what to show conditions
|