Version Description
(20170114) = * Add opt-in option Freemage Video Downloader * Code cleanup: delete unused admin.js file * UI cleanup: enhance checkbox control in settings * UI cleanup: update option names like 'What to show' is now 'Embed as', 'Hide related videos' to 'No related videos' , etc
Download this release
Release Info
Developer | urkekg |
Plugin | YouTube Channel |
Version | 3.0.10.3 |
Comparing to | |
See all releases |
Code changes from version 3.0.10.1 to 3.0.10.3
- assets/css/youtube-channel.css +1 -1
- assets/css/youtube-channel.css.map +1 -1
- assets/css/youtube-channel.less +4 -0
- assets/img/fmvd-icon.png +0 -0
- assets/img/fmvd.png +0 -0
- inc/settings-template.php +1 -1
- inc/settings.php +119 -45
- inc/tinymce/plugin.js +24 -14
- inc/tinymce/plugin.min.js +1 -1
- inc/widget.php +7 -0
- readme.txt +13 -3
- update.php +19 -0
- youtube-channel.php +62 -17
assets/css/youtube-channel.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.youtube_channel{float:left;clear:both;position:relative;box-sizing:border-box}.youtube_channel .ytc_video_container{float:left;position:relative}.youtube_channel .ytc_video_container iframe{margin-bottom:0}.youtube_channel .ytc_video_container a{border:none}.youtube_channel.responsive{width:100%}.youtube_channel.responsive .ytc_video_container{width:100% !important}.youtube_channel.responsive .ytc_video_container.ar16_9 .fluid-width-video-wrapper{position:relative;padding-bottom:56.25%;height:0}.youtube_channel.responsive .ytc_video_container.ar4_3 .fluid-width-video-wrapper{position:relative;padding-bottom:75%;height:0}.youtube_channel.responsive .ytc_video_container .fluid-width-video-wrapper iframe{position:absolute;top:0;left:0;width:100%;height:100%}.youtube_channel .ytc_thumb{display:block;overflow:hidden;position:relative;height:0;width:100%;top:0;right:0;bottom:0;left:0;cursor:pointer}.youtube_channel .ytc_thumb>span{height:0;width:100%;display:block;-webkit-background-size:cover;background-size:cover;background-position:center center;background-repeat:no-repeat}.youtube_channel .ytc_thumb>span:before{content:" ";display:block;width:84px;height:59px;background-image:url(../img/yt_play.png);background-position:top center;background-repeat:no-repeat;background-color:transparent;opacity:.9;position:absolute;top:50%;left:50%;padding:0 !important;margin-left:-42px;margin-top:-30px;cursor:pointer;transform:scale(.85)}.youtube_channel .ytc_thumb:hover>span:before{background-position:bottom center}.youtube_channel .ytc_thumb.ar16_9,.youtube_channel .ytc_thumb.ar16_9>span{padding-bottom:56.26%}.youtube_channel .ytc_thumb.ar4_3,.youtube_channel .ytc_thumb.ar4_3>span{padding-bottom:75%}.youtube_channel .ytc_link{position:relative;clear:both;float:left;width:100%}.youtube_channel .ytc_link>p{padding:0;margin:0}.youtube_channel p.ytc_error{color:#d00}.clearfix:after,.widget_youtube-channel:after,.youtube_channel:after{content:" ";visibility:hidden;display:block;height:0;clear:both}/*# sourceMappingURL=youtube-channel.css.map */
|
1 |
+
.youtube_channel{float:left;clear:both;position:relative;box-sizing:border-box}.youtube_channel .ytc_video_container{float:left;position:relative}.youtube_channel .ytc_video_container iframe{margin-bottom:0}.youtube_channel .ytc_video_container a{border:none}.youtube_channel.responsive{width:100%}.youtube_channel.responsive .ytc_video_container{width:100% !important}.youtube_channel.responsive .ytc_video_container.ar16_9 .fluid-width-video-wrapper{position:relative;padding-bottom:56.25%;height:0}.youtube_channel.responsive .ytc_video_container.ar4_3 .fluid-width-video-wrapper{position:relative;padding-bottom:75%;height:0}.youtube_channel.responsive .ytc_video_container .fluid-width-video-wrapper iframe{position:absolute;top:0;left:0;width:100%;height:100%}.youtube_channel .ytc_thumb{display:block;overflow:hidden;position:relative;height:0;width:100%;top:0;right:0;bottom:0;left:0;cursor:pointer}.youtube_channel .ytc_thumb>span{height:0;width:100%;display:block;-webkit-background-size:cover;background-size:cover;background-position:center center;background-repeat:no-repeat}.youtube_channel .ytc_thumb>span:before{content:" ";display:block;width:84px;height:59px;background-image:url(../img/yt_play.png);background-position:top center;background-repeat:no-repeat;background-color:transparent;opacity:.9;position:absolute;top:50%;left:50%;padding:0 !important;margin-left:-42px;margin-top:-30px;cursor:pointer;transform:scale(.85)}.youtube_channel .ytc_thumb:hover>span:before{background-position:bottom center}.youtube_channel .ytc_thumb.ar16_9,.youtube_channel .ytc_thumb.ar16_9>span{padding-bottom:56.26%}.youtube_channel .ytc_thumb.ar4_3,.youtube_channel .ytc_thumb.ar4_3>span{padding-bottom:75%}.youtube_channel .ytc_link{position:relative;clear:both;float:left;width:100%}.youtube_channel .ytc_link>p{padding:0;margin:0}.youtube_channel .ytc_link>p .fmvd{float:right}.youtube_channel p.ytc_error{color:#d00}.clearfix:after,.widget_youtube-channel:after,.youtube_channel:after{content:" ";visibility:hidden;display:block;height:0;clear:both}/*# sourceMappingURL=youtube-channel.css.map */
|
assets/css/youtube-channel.css.map
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"file":"youtube-channel.css","sources":["youtube-channel.less"],"names":[],"mappings":"AAAA,iBACC,UAAA,CACA,UAAA,CACA,iBAAA,CACA,sBAEA,gBAAE,sBACD,UAAA,CACA,kBAEA,gBAJC,qBAIC,QACD,gBAGD,gBARC,qBAQC,GACD,YAIF,gBAAC,YACA,WACA,gBAFA,WAEE,sBACD,UAAA,YAGA,gBAND,WAEE,qBAIA,OAAQ,4BACR,iBAAA,CACA,qBAAA,CACA,SAED,gBAXD,WAEE,qBASA,MAAO,4BACP,iBAAA,CACA,kBAAA,CACA,SAED,gBAhBD,WAEE,qBAcC,2BAA2B,QAC5B,iBAAA,CACA,KAAA,CACA,MAAA,CACA,UAAA,CACA,YAMH,gBAAE,YACD,aAAA,CACA,eAAA,CACA,iBAAA,CACA,QAAA,CACA,UAAA,CACA,KAAA,CACA,OAAA,CACA,QAAA,CACA,MAAA,CACA,eAEA,gBAZC,WAYA,MACA,QAAA,CACA,UAAA,CACA,aAAA,CACA,6BAAA,CACA,qBAAA,CACA,iCAAA,CACA,4BAEA,gBArBA,WAYA,KASC,QACA,QAAS,GAAT,CACA,aAAA,CAGA,UAAA,CACA,WAAA,CACA,wCAAA,CACA,8BAAA,CACA,2BAAA,CACA,4BAAA,CAEA,UAAA,CAEA,iBAAA,CACA,OAAA,CACA,QAAA,CACA,SAAA,YAGA,iBAAA,CACA,gBAAA,CACA,cAAA,CACA,UAAW,WAIb,gBAhDC,WAgDA,MAAM,KAAK,QAEX,kCAID,gBAtDC,WAsDA,QACD,gBAvDC,WAuDA,OAAO,MAEP,sBAED,gBA3DC,WA2DA,OACD,gBA5DC,WA4DA,MAAM,MAEN,mBAKF,gBAAE,WACD,iBAAA,CACA,UAAA,CACA,UAAA,CACA,WAEA,gBANC,UAMA,GACA,SAAA,CACA,
|
1 |
+
{"version":3,"file":"youtube-channel.css","sources":["youtube-channel.less"],"names":[],"mappings":"AAAA,iBACC,UAAA,CACA,UAAA,CACA,iBAAA,CACA,sBAEA,gBAAE,sBACD,UAAA,CACA,kBAEA,gBAJC,qBAIC,QACD,gBAGD,gBARC,qBAQC,GACD,YAIF,gBAAC,YACA,WACA,gBAFA,WAEE,sBACD,UAAA,YAGA,gBAND,WAEE,qBAIA,OAAQ,4BACR,iBAAA,CACA,qBAAA,CACA,SAED,gBAXD,WAEE,qBASA,MAAO,4BACP,iBAAA,CACA,kBAAA,CACA,SAED,gBAhBD,WAEE,qBAcC,2BAA2B,QAC5B,iBAAA,CACA,KAAA,CACA,MAAA,CACA,UAAA,CACA,YAMH,gBAAE,YACD,aAAA,CACA,eAAA,CACA,iBAAA,CACA,QAAA,CACA,UAAA,CACA,KAAA,CACA,OAAA,CACA,QAAA,CACA,MAAA,CACA,eAEA,gBAZC,WAYA,MACA,QAAA,CACA,UAAA,CACA,aAAA,CACA,6BAAA,CACA,qBAAA,CACA,iCAAA,CACA,4BAEA,gBArBA,WAYA,KASC,QACA,QAAS,GAAT,CACA,aAAA,CAGA,UAAA,CACA,WAAA,CACA,wCAAA,CACA,8BAAA,CACA,2BAAA,CACA,4BAAA,CAEA,UAAA,CAEA,iBAAA,CACA,OAAA,CACA,QAAA,CACA,SAAA,YAGA,iBAAA,CACA,gBAAA,CACA,cAAA,CACA,UAAW,WAIb,gBAhDC,WAgDA,MAAM,KAAK,QAEX,kCAID,gBAtDC,WAsDA,QACD,gBAvDC,WAuDA,OAAO,MAEP,sBAED,gBA3DC,WA2DA,OACD,gBA5DC,WA4DA,MAAM,MAEN,mBAKF,gBAAE,WACD,iBAAA,CACA,UAAA,CACA,UAAA,CACA,WAEA,gBANC,UAMA,GACA,SAAA,CACA,SAFD,gBANC,UAMA,EAIA,OACC,YAMH,gBAAE,EAAC,WACF,WAKF,SAAS,OACT,uBAAuB,OACvB,gBAAgB,OACf,QAAS,GAAT,CACA,iBAAA,CACA,aAAA,CACA,QAAA,CACA","sourceRoot":""}
|
assets/css/youtube-channel.less
CHANGED
@@ -120,6 +120,10 @@
|
|
120 |
&>p {
|
121 |
padding: 0;
|
122 |
margin: 0;
|
|
|
|
|
|
|
|
|
123 |
}
|
124 |
}
|
125 |
|
120 |
&>p {
|
121 |
padding: 0;
|
122 |
margin: 0;
|
123 |
+
|
124 |
+
.fmvd {
|
125 |
+
float: right;
|
126 |
+
}
|
127 |
}
|
128 |
}
|
129 |
|
assets/img/fmvd-icon.png
ADDED
Binary file
|
assets/img/fmvd.png
ADDED
Binary file
|
inc/settings-template.php
CHANGED
@@ -7,7 +7,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
7 |
global $wpau_youtube_channel;
|
8 |
?>
|
9 |
<div class="wrap" id="youtube_channel_settings">
|
10 |
-
<p style="float:right;text-align:center;"><small>Support
|
11 |
<h2><?php echo $wpau_youtube_channel->plugin_name . __( ' Settings', 'youtube-channel' ); ?></h2>
|
12 |
<?php
|
13 |
$active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'general';
|
7 |
global $wpau_youtube_channel;
|
8 |
?>
|
9 |
<div class="wrap" id="youtube_channel_settings">
|
10 |
+
<p style="float:right;text-align:center;"><small>Support YouTube Channel</small> <a href="https://urosevic.net/wordpress/donate/?donate_for=youtube-channel" target="_blank">Donate via PayPal</a></p>
|
11 |
<h2><?php echo $wpau_youtube_channel->plugin_name . __( ' Settings', 'youtube-channel' ); ?></h2>
|
12 |
<?php
|
13 |
$active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'general';
|
inc/settings.php
CHANGED
@@ -56,8 +56,9 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL_SETTINGS' ) ) {
|
|
56 |
array(
|
57 |
'field' => $this->option_name . '[apikey]',
|
58 |
'description' => sprintf(
|
59 |
-
'
|
60 |
-
|
|
|
61 |
sprintf(
|
62 |
wp_kses(
|
63 |
__(
|
@@ -89,8 +90,8 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL_SETTINGS' ) ) {
|
|
89 |
array(
|
90 |
'field' => $this->option_name . '[channel]',
|
91 |
'description' => sprintf(
|
92 |
-
'
|
93 |
-
|
94 |
sprintf(
|
95 |
wp_kses(
|
96 |
__(
|
@@ -122,8 +123,8 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL_SETTINGS' ) ) {
|
|
122 |
array(
|
123 |
'field' => $this->option_name . '[vanity]',
|
124 |
'description' => sprintf(
|
125 |
-
'
|
126 |
-
|
127 |
sprintf(
|
128 |
wp_kses(
|
129 |
__(
|
@@ -156,8 +157,8 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL_SETTINGS' ) ) {
|
|
156 |
array(
|
157 |
'field' => $this->option_name . '[username]',
|
158 |
'description' => sprintf(
|
159 |
-
'
|
160 |
-
|
161 |
__( 'Your YouTube legacy username', 'youtube-channel' )
|
162 |
),
|
163 |
'class' => 'regular-text',
|
@@ -174,8 +175,8 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL_SETTINGS' ) ) {
|
|
174 |
array(
|
175 |
'field' => $this->option_name . '[playlist]',
|
176 |
'description' => sprintf(
|
177 |
-
'
|
178 |
-
|
179 |
__( 'Enter default playlist ID (not playlist name)', 'youtube-channel' )
|
180 |
),
|
181 |
'class' => 'regular-text',
|
@@ -227,7 +228,7 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL_SETTINGS' ) ) {
|
|
227 |
'ytc_general', // section
|
228 |
array(
|
229 |
'field' => $this->option_name . '[fetch]',
|
230 |
-
'description' => __( 'Number of videos that will be used for random pick (min 2, max 50, default 25)', 'youtube-channel' ),
|
231 |
'class' => 'num',
|
232 |
'value' => isset( $this->defaults['fetch'] ) ? $this->defaults['fetch'] : '25',
|
233 |
'min' => 1,
|
@@ -255,12 +256,13 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL_SETTINGS' ) ) {
|
|
255 |
// Enhanced privacy
|
256 |
add_settings_field(
|
257 |
$this->option_name . 'privacy', // id
|
258 |
-
__( '
|
259 |
array( &$this, 'settings_field_checkbox' ), // Callback
|
260 |
$this->slug . '_general', // Page
|
261 |
'ytc_general', // section
|
262 |
array(
|
263 |
'field' => $this->option_name . '[privacy]',
|
|
|
264 |
'description' => sprintf(
|
265 |
wp_kses(
|
266 |
__(
|
@@ -284,12 +286,13 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL_SETTINGS' ) ) {
|
|
284 |
// TinyMCE icon
|
285 |
add_settings_field(
|
286 |
$this->option_name . 'tinymce', // id
|
287 |
-
__( '
|
288 |
array( &$this, 'settings_field_checkbox' ), // Callback
|
289 |
$this->slug . '_general', // Page
|
290 |
'ytc_general', // section
|
291 |
array(
|
292 |
'field' => $this->option_name . '[tinymce]',
|
|
|
293 |
'description' => sprintf(
|
294 |
__( 'Disable this option to hide %s button from TinyMCE toolbar on post and page editor.', 'youtube-channel' ),
|
295 |
__( 'YouTube Channel', 'youtube-channel' )
|
@@ -298,6 +301,26 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL_SETTINGS' ) ) {
|
|
298 |
'value' => isset( $this->defaults['tinymce'] ) ? $this->defaults['tinymce'] : '0',
|
299 |
) // args
|
300 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
301 |
// --- Register setting General so $_POST handling is done ---
|
302 |
register_setting(
|
303 |
'ytc_general', // Setting group
|
@@ -323,7 +346,7 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL_SETTINGS' ) ) {
|
|
323 |
'ytc_video', // section
|
324 |
array(
|
325 |
'field' => $this->option_name . '[width]',
|
326 |
-
'description' => __( 'Set default width for displayed video, in pixels', 'youtube-channel' ),
|
327 |
'class' => 'num',
|
328 |
'value' => isset( $this->defaults['width'] ) ? $this->defaults['width'] : '306',
|
329 |
'min' => 120,
|
@@ -352,7 +375,7 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL_SETTINGS' ) ) {
|
|
352 |
// Display
|
353 |
add_settings_field(
|
354 |
$this->option_name . 'display', // id
|
355 |
-
__( '
|
356 |
array( &$this, 'settings_field_select' ), // Callback
|
357 |
$this->slug . '_video', // Page
|
358 |
'ytc_video', // section
|
@@ -373,12 +396,13 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL_SETTINGS' ) ) {
|
|
373 |
// Responsive
|
374 |
add_settings_field(
|
375 |
$this->option_name . 'responsive', // id
|
376 |
-
__( '
|
377 |
array( &$this, 'settings_field_checkbox' ), // Callback
|
378 |
$this->slug . '_video', // Page
|
379 |
'ytc_video', // section
|
380 |
array(
|
381 |
'field' => $this->option_name . '[responsive]',
|
|
|
382 |
'description' => __( 'Enable this option to make YTC videos and thumbnails responsive by default. Please note, this option will set videos and thumbnail to full width relative to parent container, and disable more than one video per row.', 'youtube-channel' ),
|
383 |
'class' => 'checkbox',
|
384 |
'value' => isset( $this->defaults['responsive'] ) ? $this->defaults['responsive'] : '0',
|
@@ -431,12 +455,13 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL_SETTINGS' ) ) {
|
|
431 |
// Full Screen
|
432 |
add_settings_field(
|
433 |
$this->option_name . 'fullscreen', // id
|
434 |
-
__( '
|
435 |
array( &$this, 'settings_field_checkbox' ), // Callback
|
436 |
$this->slug . '_video', // Page
|
437 |
'ytc_video', // section
|
438 |
array(
|
439 |
'field' => $this->option_name . '[fullscreen]',
|
|
|
440 |
'description' => __( 'Enable this option to make available Full Screen button for embedded playlists.', 'youtube-channel' ),
|
441 |
'class' => 'checkbox',
|
442 |
'value' => isset( $this->defaults['fullscreen'] ) ? $this->defaults['fullscreen'] : '0',
|
@@ -503,7 +528,7 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL_SETTINGS' ) ) {
|
|
503 |
// No related videos
|
504 |
add_settings_field(
|
505 |
$this->option_name . 'norel', // id
|
506 |
-
__( '
|
507 |
array( &$this, 'settings_field_checkbox' ), // Callback
|
508 |
$this->slug . '_video', // Page
|
509 |
'ytc_video', // section
|
@@ -514,24 +539,10 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL_SETTINGS' ) ) {
|
|
514 |
'value' => isset( $this->defaults['norel'] ) ? $this->defaults['norel'] : '0',
|
515 |
) // args
|
516 |
);
|
517 |
-
// Hide YT logo
|
518 |
-
add_settings_field(
|
519 |
-
$this->option_name . 'modestbranding', // id
|
520 |
-
__( 'Hide YT logo', 'youtube-channel' ), // Title
|
521 |
-
array( &$this, 'settings_field_checkbox' ), // Callback
|
522 |
-
$this->slug . '_video', // Page
|
523 |
-
'ytc_video', // section
|
524 |
-
array(
|
525 |
-
'field' => $this->option_name . '[modestbranding]',
|
526 |
-
'description' => __( 'Enable this option to hide YouTube logo from playback control bar. Does not work for all videos.', 'youtube-channel' ),
|
527 |
-
'class' => 'checkbox',
|
528 |
-
'value' => isset( $this->defaults['modestbranding'] ) ? $this->defaults['modestbranding'] : '0',
|
529 |
-
) // args
|
530 |
-
);
|
531 |
// Hide Annotations
|
532 |
add_settings_field(
|
533 |
$this->option_name . 'hideanno', // id
|
534 |
-
__( '
|
535 |
array( &$this, 'settings_field_checkbox' ), // Callback
|
536 |
$this->slug . '_video', // Page
|
537 |
'ytc_video', // section
|
@@ -545,7 +556,7 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL_SETTINGS' ) ) {
|
|
545 |
// Hide Video Info
|
546 |
add_settings_field(
|
547 |
$this->option_name . 'hideinfo', // id
|
548 |
-
__( '
|
549 |
array( &$this, 'settings_field_checkbox' ), // Callback
|
550 |
$this->slug . '_video', // Page
|
551 |
'ytc_video', // section
|
@@ -556,6 +567,21 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL_SETTINGS' ) ) {
|
|
556 |
'value' => isset( $this->defaults['hideinfo'] ) ? $this->defaults['hideinfo'] : '0',
|
557 |
) // args
|
558 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
559 |
// --- Register setting Video so $_POST handling is done ---
|
560 |
register_setting(
|
561 |
'ytc_video', // Setting group
|
@@ -575,13 +601,13 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL_SETTINGS' ) ) {
|
|
575 |
// Video Title
|
576 |
add_settings_field(
|
577 |
$this->option_name . 'showtitle', // id
|
578 |
-
__( '
|
579 |
array( &$this, 'settings_field_select' ), // Callback
|
580 |
$this->slug . '_content', // Page
|
581 |
'ytc_content', // section
|
582 |
array(
|
583 |
'field' => $this->option_name . '[showtitle]',
|
584 |
-
'description' => __( 'Select should we and where display title of video', 'youtube-channel' ),
|
585 |
'class' => 'regular-text',
|
586 |
'value' => isset( $this->defaults['showtitle'] ) ? $this->defaults['showtitle'] : 'none',
|
587 |
'items' => array(
|
@@ -591,16 +617,41 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL_SETTINGS' ) ) {
|
|
591 |
),
|
592 |
) // args
|
593 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
594 |
// Video Description
|
595 |
add_settings_field(
|
596 |
$this->option_name . 'showdesc', // id
|
597 |
-
__( '
|
598 |
array( &$this, 'settings_field_checkbox' ), // Callback
|
599 |
$this->slug . '_content', // Page
|
600 |
'ytc_content', // section
|
601 |
array(
|
602 |
'field' => $this->option_name . '[showdesc]',
|
603 |
-
'description' => __( 'Enable this option to
|
604 |
'class' => 'checkbox',
|
605 |
'value' => isset( $this->defaults['showdesc'] ) ? $this->defaults['showdesc'] : '0',
|
606 |
) // args
|
@@ -614,7 +665,7 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL_SETTINGS' ) ) {
|
|
614 |
'ytc_content', // section
|
615 |
array(
|
616 |
'field' => $this->option_name . '[desclen]',
|
617 |
-
'description' => __( 'Enter length for video description in characters (0 for full length)', 'youtube-channel' ),
|
618 |
'class' => 'num',
|
619 |
'value' => isset( $this->defaults['desclen'] ) ? $this->defaults['desclen'] : '0',
|
620 |
'min' => 0,
|
@@ -648,7 +699,6 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL_SETTINGS' ) ) {
|
|
648 |
'ytc_link', // section
|
649 |
array(
|
650 |
'field' => $this->option_name . '[link_to]',
|
651 |
-
// 'label' => __('Ratio:', 'youtube-channel' ),
|
652 |
'description' => __( 'Set where link will lead visitors', 'youtube-channel' ),
|
653 |
'class' => 'regular-text',
|
654 |
'value' => isset( $this->defaults['link_to'] ) ? $this->defaults['link_to'] : 'none',
|
@@ -669,8 +719,7 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL_SETTINGS' ) ) {
|
|
669 |
'ytc_link', // section
|
670 |
array(
|
671 |
'field' => $this->option_name . '[popup_goto]',
|
672 |
-
|
673 |
-
'description' => __( 'Set where link will be opened', 'youtube-channel' ),
|
674 |
'class' => 'regular-text',
|
675 |
'value' => isset( $this->defaults['popup_goto'] ) ? $this->defaults['popup_goto'] : '0',
|
676 |
'items' => array(
|
@@ -722,6 +771,27 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL_SETTINGS' ) ) {
|
|
722 |
|
723 |
// ===================== HELPERS ==========================
|
724 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
725 |
// --- Section desciptions ---
|
726 |
public function settings_general_section_description() {
|
727 |
|
@@ -847,18 +917,20 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL_SETTINGS' ) ) {
|
|
847 |
} // END public function settings_field_select()
|
848 |
|
849 |
/**
|
850 |
-
* This function provides checkbox for settings fields
|
851 |
*/
|
852 |
public function settings_field_checkbox( $args ) {
|
853 |
|
854 |
$checked = ! empty( $args['value'] ) ? 'checked="checked"' : '';
|
855 |
-
|
856 |
'<label for="%1$s"><input type="checkbox" name="%1$s" id="%1$s" value="1" class="%2$s" %3$s />%4$s</label>',
|
857 |
$args['field'],
|
858 |
$args['class'],
|
859 |
$checked,
|
860 |
-
$args['
|
861 |
);
|
|
|
|
|
862 |
|
863 |
} // END public function settings_field_checkbox()
|
864 |
|
@@ -966,6 +1038,7 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL_SETTINGS' ) ) {
|
|
966 |
$sanitized['num'] = ( ! empty( $options['num'] ) ) ? intval( $options['num'] ) : $this->defaults['num'];
|
967 |
$sanitized['privacy'] = ( ! empty( $options['privacy'] ) && $options['privacy'] ) ? 1 : 0;
|
968 |
$sanitized['tinymce'] = ( ! empty( $options['tinymce'] ) && $options['tinymce'] ) ? 1 : 0;
|
|
|
969 |
break; // General
|
970 |
|
971 |
// --- Video ---
|
@@ -990,6 +1063,7 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL_SETTINGS' ) ) {
|
|
990 |
// --- Content ---
|
991 |
case 'ytc_content':
|
992 |
$sanitized['showtitle'] = ( ! empty( $options['showtitle'] ) ) ? $options['showtitle'] : $this->defaults['showtitle'];
|
|
|
993 |
$sanitized['showdesc'] = ( ! empty( $options['showdesc'] ) && $options['showdesc'] ) ? 1 : 0;
|
994 |
$sanitized['desclen'] = ( ! empty( $options['desclen'] ) ) ? intval( $options['desclen'] ) : $this->defaults['desclen'];
|
995 |
break; // Content
|
56 |
array(
|
57 |
'field' => $this->option_name . '[apikey]',
|
58 |
'description' => sprintf(
|
59 |
+
'%1$s %2$s %3$s',
|
60 |
+
$this->settings_description_required(),
|
61 |
+
$this->settings_description_global(),
|
62 |
sprintf(
|
63 |
wp_kses(
|
64 |
__(
|
90 |
array(
|
91 |
'field' => $this->option_name . '[channel]',
|
92 |
'description' => sprintf(
|
93 |
+
'%1$s %2$s',
|
94 |
+
$this->settings_description_required(),
|
95 |
sprintf(
|
96 |
wp_kses(
|
97 |
__(
|
123 |
array(
|
124 |
'field' => $this->option_name . '[vanity]',
|
125 |
'description' => sprintf(
|
126 |
+
'%s %s',
|
127 |
+
$this->settings_description_optional(),
|
128 |
sprintf(
|
129 |
wp_kses(
|
130 |
__(
|
157 |
array(
|
158 |
'field' => $this->option_name . '[username]',
|
159 |
'description' => sprintf(
|
160 |
+
'%s %s',
|
161 |
+
$this->settings_description_optional(),
|
162 |
__( 'Your YouTube legacy username', 'youtube-channel' )
|
163 |
),
|
164 |
'class' => 'regular-text',
|
175 |
array(
|
176 |
'field' => $this->option_name . '[playlist]',
|
177 |
'description' => sprintf(
|
178 |
+
'%s %s',
|
179 |
+
$this->settings_description_optional(),
|
180 |
__( 'Enter default playlist ID (not playlist name)', 'youtube-channel' )
|
181 |
),
|
182 |
'class' => 'regular-text',
|
228 |
'ytc_general', // section
|
229 |
array(
|
230 |
'field' => $this->option_name . '[fetch]',
|
231 |
+
'description' => __( 'Number of videos that will be fetched from YouTube and used for random pick (min 2, max 50, default 25)', 'youtube-channel' ),
|
232 |
'class' => 'num',
|
233 |
'value' => isset( $this->defaults['fetch'] ) ? $this->defaults['fetch'] : '25',
|
234 |
'min' => 1,
|
256 |
// Enhanced privacy
|
257 |
add_settings_field(
|
258 |
$this->option_name . 'privacy', // id
|
259 |
+
__( 'Enhanced Privacy', 'youtube-channel' ), // Title
|
260 |
array( &$this, 'settings_field_checkbox' ), // Callback
|
261 |
$this->slug . '_general', // Page
|
262 |
'ytc_general', // section
|
263 |
array(
|
264 |
'field' => $this->option_name . '[privacy]',
|
265 |
+
'label' => __( 'Enable', 'youtube-channel' ),
|
266 |
'description' => sprintf(
|
267 |
wp_kses(
|
268 |
__(
|
286 |
// TinyMCE icon
|
287 |
add_settings_field(
|
288 |
$this->option_name . 'tinymce', // id
|
289 |
+
__( 'TinyMCE button', 'youtube-channel' ), // Title
|
290 |
array( &$this, 'settings_field_checkbox' ), // Callback
|
291 |
$this->slug . '_general', // Page
|
292 |
'ytc_general', // section
|
293 |
array(
|
294 |
'field' => $this->option_name . '[tinymce]',
|
295 |
+
'label' => __( 'Enable', 'youtube-channel' ),
|
296 |
'description' => sprintf(
|
297 |
__( 'Disable this option to hide %s button from TinyMCE toolbar on post and page editor.', 'youtube-channel' ),
|
298 |
__( 'YouTube Channel', 'youtube-channel' )
|
301 |
'value' => isset( $this->defaults['tinymce'] ) ? $this->defaults['tinymce'] : '0',
|
302 |
) // args
|
303 |
);
|
304 |
+
|
305 |
+
// Freemake Video Downloader
|
306 |
+
add_settings_field(
|
307 |
+
$this->option_name . 'fmvd', // id
|
308 |
+
'Video Download <img src="' . $wpau_youtube_channel->plugin_url . 'assets/img/fmvd.png" class="fmvd-icon">', // Title
|
309 |
+
array( &$this, 'settings_field_checkbox' ), // Callback
|
310 |
+
$this->slug . '_general', // Page
|
311 |
+
'ytc_general', // section
|
312 |
+
array(
|
313 |
+
'field' => $this->option_name . '[fmvd]',
|
314 |
+
'label' => __( 'Show download option under videos', 'youtube-channel' ),
|
315 |
+
'description' => sprintf(
|
316 |
+
__( 'Let your site visitors save YouTube videos for offline watching with #1 YouTube downloader app %s', 'youtube-channel' ),
|
317 |
+
'<a href="http://www.freemake.com/free_video_downloader/" target="_blank">Freemake Video Downloader</a>'
|
318 |
+
),
|
319 |
+
'class' => 'checkbox',
|
320 |
+
'value' => isset( $this->defaults['fmvd'] ) ? $this->defaults['fmvd'] : '0',
|
321 |
+
) // args
|
322 |
+
);
|
323 |
+
|
324 |
// --- Register setting General so $_POST handling is done ---
|
325 |
register_setting(
|
326 |
'ytc_general', // Setting group
|
346 |
'ytc_video', // section
|
347 |
array(
|
348 |
'field' => $this->option_name . '[width]',
|
349 |
+
'description' => __( 'Set default width for displayed video, in pixels. This value have effect only if Responsive Video option is disabled!', 'youtube-channel' ),
|
350 |
'class' => 'num',
|
351 |
'value' => isset( $this->defaults['width'] ) ? $this->defaults['width'] : '306',
|
352 |
'min' => 120,
|
375 |
// Display
|
376 |
add_settings_field(
|
377 |
$this->option_name . 'display', // id
|
378 |
+
__( 'Embed as', 'youtube-channel' ), // Title
|
379 |
array( &$this, 'settings_field_select' ), // Callback
|
380 |
$this->slug . '_video', // Page
|
381 |
'ytc_video', // section
|
396 |
// Responsive
|
397 |
add_settings_field(
|
398 |
$this->option_name . 'responsive', // id
|
399 |
+
__( 'Responsive Video', 'youtube-channel' ), // Title
|
400 |
array( &$this, 'settings_field_checkbox' ), // Callback
|
401 |
$this->slug . '_video', // Page
|
402 |
'ytc_video', // section
|
403 |
array(
|
404 |
'field' => $this->option_name . '[responsive]',
|
405 |
+
'label' => __( 'Enable', '<outube-channel' ),
|
406 |
'description' => __( 'Enable this option to make YTC videos and thumbnails responsive by default. Please note, this option will set videos and thumbnail to full width relative to parent container, and disable more than one video per row.', 'youtube-channel' ),
|
407 |
'class' => 'checkbox',
|
408 |
'value' => isset( $this->defaults['responsive'] ) ? $this->defaults['responsive'] : '0',
|
455 |
// Full Screen
|
456 |
add_settings_field(
|
457 |
$this->option_name . 'fullscreen', // id
|
458 |
+
__( 'Full Screen', 'youtube-channel' ), // Title
|
459 |
array( &$this, 'settings_field_checkbox' ), // Callback
|
460 |
$this->slug . '_video', // Page
|
461 |
'ytc_video', // section
|
462 |
array(
|
463 |
'field' => $this->option_name . '[fullscreen]',
|
464 |
+
'label' => __( 'Enable', 'youtube-channel' ),
|
465 |
'description' => __( 'Enable this option to make available Full Screen button for embedded playlists.', 'youtube-channel' ),
|
466 |
'class' => 'checkbox',
|
467 |
'value' => isset( $this->defaults['fullscreen'] ) ? $this->defaults['fullscreen'] : '0',
|
528 |
// No related videos
|
529 |
add_settings_field(
|
530 |
$this->option_name . 'norel', // id
|
531 |
+
__( 'No related videos', 'youtube-channel' ), // Title
|
532 |
array( &$this, 'settings_field_checkbox' ), // Callback
|
533 |
$this->slug . '_video', // Page
|
534 |
'ytc_video', // section
|
539 |
'value' => isset( $this->defaults['norel'] ) ? $this->defaults['norel'] : '0',
|
540 |
) // args
|
541 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
542 |
// Hide Annotations
|
543 |
add_settings_field(
|
544 |
$this->option_name . 'hideanno', // id
|
545 |
+
__( 'No video annotations', 'youtube-channel' ), // Title
|
546 |
array( &$this, 'settings_field_checkbox' ), // Callback
|
547 |
$this->slug . '_video', // Page
|
548 |
'ytc_video', // section
|
556 |
// Hide Video Info
|
557 |
add_settings_field(
|
558 |
$this->option_name . 'hideinfo', // id
|
559 |
+
__( 'No video info', 'youtube-channel' ), // Title
|
560 |
array( &$this, 'settings_field_checkbox' ), // Callback
|
561 |
$this->slug . '_video', // Page
|
562 |
'ytc_video', // section
|
567 |
'value' => isset( $this->defaults['hideinfo'] ) ? $this->defaults['hideinfo'] : '0',
|
568 |
) // args
|
569 |
);
|
570 |
+
// Hide YT logo
|
571 |
+
add_settings_field(
|
572 |
+
$this->option_name . 'modestbranding', // id
|
573 |
+
__( 'No YouTube logo', 'youtube-channel' ), // Title
|
574 |
+
array( &$this, 'settings_field_checkbox' ), // Callback
|
575 |
+
$this->slug . '_video', // Page
|
576 |
+
'ytc_video', // section
|
577 |
+
array(
|
578 |
+
'field' => $this->option_name . '[modestbranding]',
|
579 |
+
'description' => __( 'Enable this option to hide YouTube logo from playback control bar. Does not work for all videos.', 'youtube-channel' ),
|
580 |
+
'class' => 'checkbox',
|
581 |
+
'value' => isset( $this->defaults['modestbranding'] ) ? $this->defaults['modestbranding'] : '0',
|
582 |
+
) // args
|
583 |
+
);
|
584 |
+
|
585 |
// --- Register setting Video so $_POST handling is done ---
|
586 |
register_setting(
|
587 |
'ytc_video', // Setting group
|
601 |
// Video Title
|
602 |
add_settings_field(
|
603 |
$this->option_name . 'showtitle', // id
|
604 |
+
__( 'Video title', 'youtube-channel' ), // Title
|
605 |
array( &$this, 'settings_field_select' ), // Callback
|
606 |
$this->slug . '_content', // Page
|
607 |
'ytc_content', // section
|
608 |
array(
|
609 |
'field' => $this->option_name . '[showtitle]',
|
610 |
+
'description' => __( 'Select should we and where to display title of video.', 'youtube-channel' ),
|
611 |
'class' => 'regular-text',
|
612 |
'value' => isset( $this->defaults['showtitle'] ) ? $this->defaults['showtitle'] : 'none',
|
613 |
'items' => array(
|
617 |
),
|
618 |
) // args
|
619 |
);
|
620 |
+
// Video Title HTML Tag
|
621 |
+
add_settings_field(
|
622 |
+
$this->option_name . 'titletag', // id
|
623 |
+
__( 'Title HTML tag', 'youtube-channel' ), // Title
|
624 |
+
array( &$this, 'settings_field_select' ), // Callback
|
625 |
+
$this->slug . '_content', // Page
|
626 |
+
'ytc_content', // section
|
627 |
+
array(
|
628 |
+
'field' => $this->option_name . '[titletag]',
|
629 |
+
'description' => sprintf(
|
630 |
+
'%1$s %2$s',
|
631 |
+
$this->settings_description_global(),
|
632 |
+
__( 'Select which HTML tag to use for title wrapper.', 'youtube-channel' )
|
633 |
+
),
|
634 |
+
'class' => 'regular-text',
|
635 |
+
'value' => isset( $this->defaults['titletag'] ) ? $this->defaults['titletag'] : 'h3',
|
636 |
+
'items' => array(
|
637 |
+
'h3' => 'H3',
|
638 |
+
'h4' => 'H4',
|
639 |
+
'h5' => 'H5',
|
640 |
+
'span' => 'span',
|
641 |
+
'div' => 'div',
|
642 |
+
),
|
643 |
+
) // args
|
644 |
+
);
|
645 |
// Video Description
|
646 |
add_settings_field(
|
647 |
$this->option_name . 'showdesc', // id
|
648 |
+
__( 'Video description', 'youtube-channel' ), // Title
|
649 |
array( &$this, 'settings_field_checkbox' ), // Callback
|
650 |
$this->slug . '_content', // Page
|
651 |
'ytc_content', // section
|
652 |
array(
|
653 |
'field' => $this->option_name . '[showdesc]',
|
654 |
+
'description' => __( 'Enable this option to show video description.', 'youtube-channel' ),
|
655 |
'class' => 'checkbox',
|
656 |
'value' => isset( $this->defaults['showdesc'] ) ? $this->defaults['showdesc'] : '0',
|
657 |
) // args
|
665 |
'ytc_content', // section
|
666 |
array(
|
667 |
'field' => $this->option_name . '[desclen]',
|
668 |
+
'description' => __( 'Enter length for video description in characters (0 for full length).', 'youtube-channel' ),
|
669 |
'class' => 'num',
|
670 |
'value' => isset( $this->defaults['desclen'] ) ? $this->defaults['desclen'] : '0',
|
671 |
'min' => 0,
|
699 |
'ytc_link', // section
|
700 |
array(
|
701 |
'field' => $this->option_name . '[link_to]',
|
|
|
702 |
'description' => __( 'Set where link will lead visitors', 'youtube-channel' ),
|
703 |
'class' => 'regular-text',
|
704 |
'value' => isset( $this->defaults['link_to'] ) ? $this->defaults['link_to'] : 'none',
|
719 |
'ytc_link', // section
|
720 |
array(
|
721 |
'field' => $this->option_name . '[popup_goto]',
|
722 |
+
'description' => __( 'Set how link will be opened', 'youtube-channel' ),
|
|
|
723 |
'class' => 'regular-text',
|
724 |
'value' => isset( $this->defaults['popup_goto'] ) ? $this->defaults['popup_goto'] : '0',
|
725 |
'items' => array(
|
771 |
|
772 |
// ===================== HELPERS ==========================
|
773 |
|
774 |
+
public function settings_description_required() {
|
775 |
+
return sprintf(
|
776 |
+
'<strong>[%s]</strong>',
|
777 |
+
__( 'Required', 'youtube-channel' )
|
778 |
+
);
|
779 |
+
}
|
780 |
+
public function settings_description_global() {
|
781 |
+
return sprintf(
|
782 |
+
'<strong title="%1$s" style="cursor:help;">[%2$s]</strong>',
|
783 |
+
__( 'This option is global only and can`t be changed per widget/shortcode', 'youtube-channel' ),
|
784 |
+
__( 'Global', 'youtube-channel' )
|
785 |
+
);
|
786 |
+
}
|
787 |
+
public function settings_description_optional() {
|
788 |
+
return sprintf(
|
789 |
+
'<strong title="%1$s" style="cursor:help;">[%2$s]</strong>',
|
790 |
+
__( 'You can leave this option empty and set it per widget/shortcode.', 'youtube-channel' ),
|
791 |
+
__( 'Optional', 'youtube-channel' )
|
792 |
+
);
|
793 |
+
}
|
794 |
+
|
795 |
// --- Section desciptions ---
|
796 |
public function settings_general_section_description() {
|
797 |
|
917 |
} // END public function settings_field_select()
|
918 |
|
919 |
/**
|
920 |
+
* This function provides checkbox v2 for settings fields
|
921 |
*/
|
922 |
public function settings_field_checkbox( $args ) {
|
923 |
|
924 |
$checked = ! empty( $args['value'] ) ? 'checked="checked"' : '';
|
925 |
+
$html = sprintf(
|
926 |
'<label for="%1$s"><input type="checkbox" name="%1$s" id="%1$s" value="1" class="%2$s" %3$s />%4$s</label>',
|
927 |
$args['field'],
|
928 |
$args['class'],
|
929 |
$checked,
|
930 |
+
isset( $args['label'] ) ? $args['label'] : ''
|
931 |
);
|
932 |
+
$html .= sprintf( '<p class="description">%s</p>', $args['description'] );
|
933 |
+
echo $html;
|
934 |
|
935 |
} // END public function settings_field_checkbox()
|
936 |
|
1038 |
$sanitized['num'] = ( ! empty( $options['num'] ) ) ? intval( $options['num'] ) : $this->defaults['num'];
|
1039 |
$sanitized['privacy'] = ( ! empty( $options['privacy'] ) && $options['privacy'] ) ? 1 : 0;
|
1040 |
$sanitized['tinymce'] = ( ! empty( $options['tinymce'] ) && $options['tinymce'] ) ? 1 : 0;
|
1041 |
+
$sanitized['fmvd'] = ! empty( $options['fmvd'] ) ? 1 : 0;
|
1042 |
break; // General
|
1043 |
|
1044 |
// --- Video ---
|
1063 |
// --- Content ---
|
1064 |
case 'ytc_content':
|
1065 |
$sanitized['showtitle'] = ( ! empty( $options['showtitle'] ) ) ? $options['showtitle'] : $this->defaults['showtitle'];
|
1066 |
+
$sanitized['titletag'] = ( ! empty( $options['titletag'] ) ) ? $options['titletag'] : $this->defaults['titletag'];
|
1067 |
$sanitized['showdesc'] = ( ! empty( $options['showdesc'] ) && $options['showdesc'] ) ? 1 : 0;
|
1068 |
$sanitized['desclen'] = ( ! empty( $options['desclen'] ) ) ? intval( $options['desclen'] ) : $this->defaults['desclen'];
|
1069 |
break; // Content
|
inc/tinymce/plugin.js
CHANGED
@@ -118,6 +118,20 @@
|
|
118 |
checked: false
|
119 |
},
|
120 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
{
|
122 |
type: 'checkbox',
|
123 |
name: 'privacy',
|
@@ -129,22 +143,15 @@
|
|
129 |
type: 'checkbox',
|
130 |
name: 'random',
|
131 |
label: 'Random video',
|
132 |
-
tooltip: 'Show random video from resource (Have no effect if \"
|
133 |
checked: false
|
134 |
},
|
135 |
{
|
136 |
-
type: '
|
137 |
-
name: '
|
138 |
-
label: '
|
139 |
-
|
140 |
-
|
141 |
-
},
|
142 |
-
{
|
143 |
-
type: 'textbox',
|
144 |
-
name: 'num',
|
145 |
-
label: 'Show',
|
146 |
-
value: '1',
|
147 |
-
tooltip: 'Number of videos to display'
|
148 |
},
|
149 |
]
|
150 |
},
|
@@ -180,7 +187,7 @@
|
|
180 |
{
|
181 |
type: 'listbox',
|
182 |
name: 'display',
|
183 |
-
label: '
|
184 |
tooltip: '',
|
185 |
values : [
|
186 |
{text: 'Thumbnail', value: 'thumbnail'},
|
@@ -361,6 +368,9 @@
|
|
361 |
// Global
|
362 |
if ( e.data.class ) shortcode += ' class=' + e.data.class + '';
|
363 |
|
|
|
|
|
|
|
364 |
// Close shortcode
|
365 |
shortcode += ']';
|
366 |
|
118 |
checked: false
|
119 |
},
|
120 |
*/
|
121 |
+
{
|
122 |
+
type: 'textbox',
|
123 |
+
name: 'fetch',
|
124 |
+
label: 'Fetch',
|
125 |
+
value: '10',
|
126 |
+
tooltip: 'Number of videos that will be used for random pick (min 2, max 50, default 25)'
|
127 |
+
},
|
128 |
+
{
|
129 |
+
type: 'textbox',
|
130 |
+
name: 'num',
|
131 |
+
label: 'Show',
|
132 |
+
value: '1',
|
133 |
+
tooltip: 'Number of videos to display'
|
134 |
+
},
|
135 |
{
|
136 |
type: 'checkbox',
|
137 |
name: 'privacy',
|
143 |
type: 'checkbox',
|
144 |
name: 'random',
|
145 |
label: 'Random video',
|
146 |
+
tooltip: 'Show random video from resource (Have no effect if \"Embed as\" has been set to \"Embedded Playlist\")',
|
147 |
checked: false
|
148 |
},
|
149 |
{
|
150 |
+
type: 'checkbox',
|
151 |
+
name: 'fmvd',
|
152 |
+
label: 'Download video',
|
153 |
+
tooltip: 'Show download option under videos. Let your site visitor save YouTube videos for offline watcing with #1 YouTube downloader app Freemake Video Downloader',
|
154 |
+
checked: false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
},
|
156 |
]
|
157 |
},
|
187 |
{
|
188 |
type: 'listbox',
|
189 |
name: 'display',
|
190 |
+
label: 'Embed as',
|
191 |
tooltip: '',
|
192 |
values : [
|
193 |
{text: 'Thumbnail', value: 'thumbnail'},
|
368 |
// Global
|
369 |
if ( e.data.class ) shortcode += ' class=' + e.data.class + '';
|
370 |
|
371 |
+
// FMVD
|
372 |
+
if ( e.data.fmvd ) shortcode += ' fmvd=1';
|
373 |
+
|
374 |
// Close shortcode
|
375 |
shortcode += ']';
|
376 |
|
inc/tinymce/plugin.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(){tinymce.PluginManager.add("youtube_channel",function(e
|
1 |
+
!function(){tinymce.PluginManager.add("youtube_channel",function(e){e.addButton("youtube_channel_shortcode",{tooltip:"YouTube Channel",icon:"ytc",onclick:function(){e.windowManager.open({title:"YouTube Channel",bodyType:"tabpanel",buttons:[{text:"Insert Shortcode",onclick:"submit",classes:"widget btn primary",minWidth:130},{text:"Cancel",onclick:"close"}],body:[{title:"General Settings",type:"form",items:[{type:"textbox",name:"class",label:"Custom CSS Class",value:"",tooltip:"Enter custom class for YTC block, if you wish to target block styling"},{type:"textbox",name:"vanity",label:"Vanity/Custom ID",value:""},{type:"textbox",name:"channel",label:"YouTube Channel ID",value:""},{type:"textbox",name:"legacy",label:"Legacy Username",value:""},{type:"textbox",name:"playlist",label:"Playlist ID",value:""},{type:"listbox",name:"resource",label:"Resource to use",tooltip:"",values:[{text:"Channel (User Uploads)",value:"0",selected:!0},{text:"Favourited videos",value:"1"},{text:"Liked videos",value:"3"},{text:"Playlist",value:"2"}]},{type:"listbox",name:"cache",label:"Cache feed",tooltip:"",values:[{text:"Do not cache",value:"0"},{text:"1 minute",value:"60"},{text:"5 minutes",value:"300",selected:!0},{text:"15 minutes",value:"900"},{text:"30 minutes",value:"1800"},{text:"1 hour",value:"3600"},{text:"2 hours",value:"7200"},{text:"5 hours",value:"18000"},{text:"10 hours",value:"36000"},{text:"12 hours",value:"43200"},{text:"18 hours",value:"64800"},{text:"1 day",value:"86400"},{text:"2 days",value:"172800"},{text:"3 days",value:"259200"},{text:"4 days",value:"345600"},{text:"5 days",value:"432000"},{text:"6 days",value:"518400"},{text:"1 week",value:"604800"},{text:"2 weeks",value:"1209600"},{text:"3 weeks",value:"1814400"},{text:"1 month",value:"2419200"}]},{type:"textbox",name:"fetch",label:"Fetch",value:"10",tooltip:"Number of videos that will be used for random pick (min 2, max 50, default 25)"},{type:"textbox",name:"num",label:"Show",value:"1",tooltip:"Number of videos to display"},{type:"checkbox",name:"privacy",label:"Use Enhanced Privacy",tooltip:"Enable this option to protect your visitors privacy",checked:!1},{type:"checkbox",name:"random",label:"Random video",tooltip:'Show random video from resource (Have no effect if "Embed as" has been set to "Embedded Playlist")',checked:!1},{type:"checkbox",name:"fmvd",label:"Download video",tooltip:"Show download option under videos. Let your site visitor save YouTube videos for offline watcing with #1 YouTube downloader app Freemake Video Downloader",checked:!1}]},{title:"Video Settings",type:"form",items:[{type:"listbox",name:"ratio",label:"Aspect Ratio",values:[{text:"Widescreen (16:9)",value:"3",selected:!0},{text:"Standard TV (4:3)",value:"1"}]},{type:"checkbox",name:"responsive",label:"Responsive video",tooltip:"Make video responsive (distribute one full width video per row)",checked:!0},{type:"textbox",name:"width",label:"Initial width (px)",value:"306",tooltip:"Set initial width for video or thumbnail (in pixels)"},{type:"listbox",name:"display",label:"Embed as",tooltip:"",values:[{text:"Thumbnail",value:"thumbnail"},{text:"HTML5 (iframe)",value:"iframe"},{text:"HTML5 (iframe) Asynchronous",value:"iframe2"},{text:"Embedded Playlist",value:"playlist"}]},{type:"checkbox",name:"no_thumb_title",label:"Hide thumbnail tooltip",checked:!1},{type:"checkbox",name:"themelight",label:"Use light theme",tooltip:"Default theme is dark",checked:!1},{type:"checkbox",name:"controls",label:"Hide player controls",checked:!1},{type:"checkbox",name:"autoplay",label:"Autoplay video/playlist",checked:!1},{type:"checkbox",name:"mute",label:"Mute video on autoplay",checked:!1},{type:"checkbox",name:"norel",label:"Hide related videos",checked:!0},{type:"checkbox",name:"nobrand",label:"Hide YT Logo",tooltip:"Does not work for all videos",checked:!0}]},{title:"Content Layout",type:"form",items:[{type:"listbox",name:"showtitle",label:"Show video title",tooltip:"",values:[{text:"Hide title",value:"none",selected:!0},{text:"Above video/thumbnail",value:"above"},{text:"Below video/thumbnail",value:"below"}]},{type:"checkbox",name:"showdesc",label:"Show video description",checked:!1},{type:"textbox",name:"desclen",label:"Description length",value:"0",tooltip:"Set number of characters to cut down video description to (0 means full length)"},{type:"checkbox",name:"noanno",label:"Hide annotations",checked:!0},{type:"checkbox",name:"noinfo",label:"Hide video info",checked:!0}]},{title:"Link to Channel",type:"form",items:[{type:"listbox",name:"link_to",label:"Link to",values:[{text:"Hide link",value:"none",selected:!0},{text:"Vanity/Custom URL",value:"vanity"},{text:"Channel page URL",value:"channel"},{text:"Legacy username URL",value:"legacy"}]},{type:"textbox",name:"goto_txt",label:"Title for link",value:"Visit our YouTube channel"}]}],onsubmit:function(t){var a="[youtube_channel";t.data.vanity&&(a+=" vanity="+t.data.vanity),t.data.channel&&(a+=" channel="+t.data.channel),t.data.legacy&&(a+=" legacy="+t.data.legacy),t.data.playlist&&(a+=" playlist="+t.data.playlist),t.data.resource&&(a+=" resource="+t.data.resource),t.data.cache&&(a+=" cache="+t.data.cache),t.data.privacy&&(a+=" privacy=1"),t.data.random&&(a+=" random=1"),t.data.fetch&&(a+=" fetch="+t.data.fetch.replace(/[^0-9.]/g,"")),t.data.num&&(a+=" num="+t.data.num.replace(/[^0-9.]/g,"")),t.data.ratio&&(a+=" ratio="+t.data.ratio),t.data.responsive&&(a+=" responsive=1"),t.data.width&&(a+=" width="+t.data.width.replace(/[^0-9.]/g,"")),t.data.display&&(a+=" display="+t.data.display),t.data.no_thumb_title&&(a+=" no_thumb_title=1"),t.data.themelight&&(a+=" themelight=1"),t.data.controls&&(a+=" controls=1"),t.data.autoplay&&(a+=" autoplay=1"),t.data.mute&&(a+=" mute=1"),t.data.norel&&(a+=" norel=1"),t.data.nobrand&&(a+=" nobrand=1"),t.data.showtitle&&(a+=" showtitle="+t.data.showtitle),t.data.showdesc&&(a+=" showdesc=1"),t.data.desclen&&(a+=" desclen="+t.data.desclen.replace(/[^0-9.]/g,"")),t.data.noanno&&(a+=" noanno=1"),t.data.noinfo&&(a+=" noinfo=1"),t.data.link_to&&(a+=" link_to="+t.data.link_to),t.data.goto_txt&&(a+=' goto_txt="'+t.data.goto_txt+'"'),t.data.class&&(a+=" class="+t.data.class),t.data.fmvd&&(a+=" fmvd=1"),a+="]",e.insertContent(a)}})}})})}();
|
inc/widget.php
CHANGED
@@ -96,6 +96,7 @@ class WPAU_YOUTUBE_CHANNEL_Widget extends WP_Widget {
|
|
96 |
$link_to = ! empty( $instance['link_to'] ) ? esc_attr( $instance['link_to'] ) : 'none';
|
97 |
$goto_txt = ! empty( $instance['goto_txt'] ) ? esc_attr( $instance['goto_txt'] ) : '';
|
98 |
$popup_goto = isset( $instance['popup_goto'] ) ? intval( $instance['popup_goto'] ) : $defaults['popup_goto'];
|
|
|
99 |
?>
|
100 |
|
101 |
<p>
|
@@ -247,6 +248,11 @@ class WPAU_YOUTUBE_CHANNEL_Widget extends WP_Widget {
|
|
247 |
<option value="2"<?php selected( $popup_goto, 2 ); ?>><?php _e( 'Open link in new window (target="blank")', 'youtube-channel' ); ?></option>
|
248 |
</select>
|
249 |
</p>
|
|
|
|
|
|
|
|
|
|
|
250 |
|
251 |
<h4><?php _e( 'Does not work?', 'youtube-channel' ); ?></h4>
|
252 |
<p>
|
@@ -311,6 +317,7 @@ class WPAU_YOUTUBE_CHANNEL_Widget extends WP_Widget {
|
|
311 |
$instance['hideanno'] = isset( $new_instance['hideanno'] ) ? $new_instance['hideanno'] : '';
|
312 |
$instance['themelight'] = isset( $new_instance['themelight'] ) ? $new_instance['themelight'] : '';
|
313 |
$instance['privacy'] = isset( $new_instance['privacy'] ) ? $new_instance['privacy'] : '';
|
|
|
314 |
|
315 |
return $instance;
|
316 |
|
96 |
$link_to = ! empty( $instance['link_to'] ) ? esc_attr( $instance['link_to'] ) : 'none';
|
97 |
$goto_txt = ! empty( $instance['goto_txt'] ) ? esc_attr( $instance['goto_txt'] ) : '';
|
98 |
$popup_goto = isset( $instance['popup_goto'] ) ? intval( $instance['popup_goto'] ) : $defaults['popup_goto'];
|
99 |
+
$fmvd = isset( $instance['fmvd'] ) ? $instance['fmvd'] : false;
|
100 |
?>
|
101 |
|
102 |
<p>
|
248 |
<option value="2"<?php selected( $popup_goto, 2 ); ?>><?php _e( 'Open link in new window (target="blank")', 'youtube-channel' ); ?></option>
|
249 |
</select>
|
250 |
</p>
|
251 |
+
<p>
|
252 |
+
<label for="<?php echo $this->get_field_id( 'fmvd' ); ?>" title="<?php _e( 'Let your site visitors save YouTube videos for offline watching' ); ?>">
|
253 |
+
<input class="checkbox" type="checkbox" <?php checked( (bool) $fmvd, true ); ?> id="<?php echo $this->get_field_id( 'fmvd' ); ?>" name="<?php echo $this->get_field_name( 'fmvd' ); ?>" /> <?php _e( 'Show download option under videos', 'youtube-channel' ); ?>
|
254 |
+
</label>
|
255 |
+
</p>
|
256 |
|
257 |
<h4><?php _e( 'Does not work?', 'youtube-channel' ); ?></h4>
|
258 |
<p>
|
317 |
$instance['hideanno'] = isset( $new_instance['hideanno'] ) ? $new_instance['hideanno'] : '';
|
318 |
$instance['themelight'] = isset( $new_instance['themelight'] ) ? $new_instance['themelight'] : '';
|
319 |
$instance['privacy'] = isset( $new_instance['privacy'] ) ? $new_instance['privacy'] : '';
|
320 |
+
$instance['fmvd'] = isset( $new_instance['fmvd'] ) ? $new_instance['fmvd'] : false;
|
321 |
|
322 |
return $instance;
|
323 |
|
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
|
7 |
-
Stable tag: 3.0.10.
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -29,6 +29,7 @@ For manual set of videos from YouTube check out [Easy YouTube Gallery](https://w
|
|
29 |
* Enhanced Privacy
|
30 |
* Choose to display video as thumbnail (default), HTML5 (iframe) or HTML5 Asynchronous (iframe2)
|
31 |
* Thumbnail mode opens video in lightbox
|
|
|
32 |
* Custom feed caching timeout
|
33 |
* Optional video autoplay with optional muted audio
|
34 |
* Optional TinyMCE button on post/page edit (can be disabled on General plugin settings page)
|
@@ -49,7 +50,7 @@ You can use `style.css` from theme or other custom location to additionaly style
|
|
49 |
* `.youtube_channel` – YTC block wrapper class. Additional classes are available:
|
50 |
* `.default` – for non-responsive block
|
51 |
* `.responsive` – when you have enabled responsive option
|
52 |
-
* `.ytc_title` – class
|
53 |
* `.ytc_title_above` - additional class for video title above video/thumbnail
|
54 |
* `.ytc_title_below` - additional class for video title below video/thumbnail
|
55 |
* `.ytc_video_container` – class of container for single item, plus:
|
@@ -353,6 +354,15 @@ If you really need that missing feature ASAP, feel free to [contact me](urosevic
|
|
353 |
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] ...**
|
354 |
|
355 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
356 |
= 3.0.10.1 (20170110) =
|
357 |
* Fix Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM, expecting ')' in /plugins/youtube-channel/inc/settings.php on line 218
|
358 |
|
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.1
|
7 |
+
Stable tag: 3.0.10.3
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
29 |
* Enhanced Privacy
|
30 |
* Choose to display video as thumbnail (default), HTML5 (iframe) or HTML5 Asynchronous (iframe2)
|
31 |
* Thumbnail mode opens video in lightbox
|
32 |
+
* Hide or show video title above/below video wrapped to HTML tag by your choice (h3, h4, h5, span or div)
|
33 |
* Custom feed caching timeout
|
34 |
* Optional video autoplay with optional muted audio
|
35 |
* Optional TinyMCE button on post/page edit (can be disabled on General plugin settings page)
|
50 |
* `.youtube_channel` – YTC block wrapper class. Additional classes are available:
|
51 |
* `.default` – for non-responsive block
|
52 |
* `.responsive` – when you have enabled responsive option
|
53 |
+
* `.ytc_title` – class for video title container above thumbnail/video object
|
54 |
* `.ytc_title_above` - additional class for video title above video/thumbnail
|
55 |
* `.ytc_title_below` - additional class for video title below video/thumbnail
|
56 |
* `.ytc_video_container` – class of container for single item, plus:
|
354 |
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] ...**
|
355 |
|
356 |
== Changelog ==
|
357 |
+
= 3.0.10.3 (20170114) =
|
358 |
+
* Add opt-in option Freemage Video Downloader
|
359 |
+
* Code cleanup: delete unused admin.js file
|
360 |
+
* UI cleanup: enhance checkbox control in settings
|
361 |
+
* UI cleanup: update option names like 'What to show' is now 'Embed as', 'Hide related videos' to 'No related videos' , etc
|
362 |
+
|
363 |
+
= 3.0.10.2 (20170110) =
|
364 |
+
* Add option to select Title HTML tag (default to H3)
|
365 |
+
|
366 |
= 3.0.10.1 (20170110) =
|
367 |
* Fix Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM, expecting ')' in /plugins/youtube-channel/inc/settings.php on line 218
|
368 |
|
update.php
CHANGED
@@ -421,3 +421,22 @@ function au_youtube_channel_update_routine_14() {
|
|
421 |
}
|
422 |
|
423 |
} // END function au_youtube_channel_update_routine_14()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
421 |
}
|
422 |
|
423 |
} // END function au_youtube_channel_update_routine_14()
|
424 |
+
|
425 |
+
/**
|
426 |
+
* Add default value for new global option titletag
|
427 |
+
*/
|
428 |
+
function au_youtube_channel_update_routine_16() {
|
429 |
+
|
430 |
+
// get options from DB
|
431 |
+
$defaults = get_option( 'youtube_channel_defaults' );
|
432 |
+
|
433 |
+
if ( ! isset( $defaults['titletag'] ) ) {
|
434 |
+
$defaults['titletag'] = 'h3';
|
435 |
+
}
|
436 |
+
|
437 |
+
if ( isset( $defaults ) ) {
|
438 |
+
update_option( 'youtube_channel_defaults', $defaults );
|
439 |
+
unset( $defaults );
|
440 |
+
}
|
441 |
+
|
442 |
+
} // END function au_youtube_channel_update_routine_16()
|
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.10.
|
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.10.
|
22 |
|
23 |
public $plugin_name = 'YouTube Channel';
|
24 |
public $plugin_slug = 'youtube-channel';
|
@@ -124,6 +124,7 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
|
124 |
'norel' => 0,
|
125 |
'playsinline' => 0, // play video on mobile devices inline instead in native device player
|
126 |
'showtitle' => 'none',
|
|
|
127 |
'showdesc' => 0,
|
128 |
'desclen' => 0,
|
129 |
'modestbranding' => 0,
|
@@ -267,6 +268,10 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
|
267 |
$dismissed_notices['changed_shortcode_308'] = 1;
|
268 |
update_option( 'youtube_channel_dismissed_notices', $dismissed_notices );
|
269 |
}
|
|
|
|
|
|
|
|
|
270 |
|
271 |
// Prepare vars for notices
|
272 |
$settings_page = 'options-general.php?page=youtube-channel';
|
@@ -351,6 +356,17 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
|
351 |
}
|
352 |
}
|
353 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
354 |
} // END function admin_notices()
|
355 |
|
356 |
/**
|
@@ -523,6 +539,7 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
|
523 |
'link_to' => $instance['link_to'], // none, vanity, channel, legacy
|
524 |
|
525 |
'class' => ! empty( $instance['class'] ) ? $instance['class'] : '',
|
|
|
526 |
),
|
527 |
$atts
|
528 |
);
|
@@ -581,6 +598,7 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
|
581 |
|
582 |
// Customization
|
583 |
$instance['class'] = $atts['class']; // custom additional class for container
|
|
|
584 |
|
585 |
// return implode( array_values( $this->output( $instance ) ) );
|
586 |
return $this->output( $instance );
|
@@ -876,9 +894,7 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
|
876 |
} // single playlist or ytc way
|
877 |
|
878 |
// Append link to channel on bootom of the widget
|
879 |
-
|
880 |
-
$output .= $this->ytc_channel_link( $instance );
|
881 |
-
}
|
882 |
|
883 |
$output .= '</div><!-- .youtube_channel -->';
|
884 |
|
@@ -976,6 +992,41 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
|
976 |
return $height;
|
977 |
} // END function height_ratio($width=306, $ratio)
|
978 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
979 |
/**
|
980 |
* Generate link to YouTube channel/user
|
981 |
* @param array $instance widget or shortcode settings
|
@@ -983,13 +1034,11 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
|
983 |
*/
|
984 |
function ytc_channel_link( $instance ) {
|
985 |
|
986 |
-
// initialize array
|
987 |
-
// $output = array();
|
988 |
// Initialize output string
|
989 |
$output = '';
|
990 |
|
991 |
// do we need to show goto link?
|
992 |
-
if ( 'none' != $instance['link_to'] ) {
|
993 |
|
994 |
$goto_url = 'https://www.youtube.com/';
|
995 |
|
@@ -1040,9 +1089,6 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
|
1040 |
|
1041 |
$newtab = __( 'in new window/tab', 'youtube-channel' );
|
1042 |
|
1043 |
-
$output .= '<div class="clearfix"></div>';
|
1044 |
-
$output .= '<div class="ytc_link">';
|
1045 |
-
$output .= '<p>';
|
1046 |
switch ( $instance['popup_goto'] ) {
|
1047 |
case 1:
|
1048 |
$output .= "<a href=\"javascript: window.open('{$goto_url}'); void 0;\" title=\"{$goto_txt} {$newtab}\">{$goto_txt}</a>";
|
@@ -1053,13 +1099,11 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
|
1053 |
default:
|
1054 |
$output .= "<a href=\"{$goto_url}\" title=\"{$goto_txt}\">$goto_txt</a>";
|
1055 |
} // switch popup_goto
|
1056 |
-
$output .= '</p>';
|
1057 |
-
$output .= '</div>';
|
1058 |
|
1059 |
-
} //
|
1060 |
|
1061 |
return $output;
|
1062 |
-
} //
|
1063 |
|
1064 |
|
1065 |
/**
|
@@ -1118,7 +1162,8 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
|
|
1118 |
|
1119 |
// Show video title above video?
|
1120 |
if ( ! empty( $instance['showtitle'] ) && 'above' == $instance['showtitle'] ) {
|
1121 |
-
$
|
|
|
1122 |
}
|
1123 |
|
1124 |
// Print out video
|
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.10.3
|
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 = 16;
|
21 |
+
const VER = '3.0.10.3';
|
22 |
|
23 |
public $plugin_name = 'YouTube Channel';
|
24 |
public $plugin_slug = 'youtube-channel';
|
124 |
'norel' => 0,
|
125 |
'playsinline' => 0, // play video on mobile devices inline instead in native device player
|
126 |
'showtitle' => 'none',
|
127 |
+
'titletag' => 'h3',
|
128 |
'showdesc' => 0,
|
129 |
'desclen' => 0,
|
130 |
'modestbranding' => 0,
|
268 |
$dismissed_notices['changed_shortcode_308'] = 1;
|
269 |
update_option( 'youtube_channel_dismissed_notices', $dismissed_notices );
|
270 |
}
|
271 |
+
if ( ! empty( $_GET['ytc_dismiss_notice_fmvd'] ) ) {
|
272 |
+
$dismissed_notices['fmvd'] = 1;
|
273 |
+
update_option( 'youtube_channel_dismissed_notices', $dismissed_notices );
|
274 |
+
}
|
275 |
|
276 |
// Prepare vars for notices
|
277 |
$settings_page = 'options-general.php?page=youtube-channel';
|
356 |
}
|
357 |
}
|
358 |
|
359 |
+
// FMVD
|
360 |
+
if ( ! empty( $dismissed_notices ) && self::DB_VER > 15 && empty( $dismissed_notices['fmvd'] ) ) {
|
361 |
+
printf(
|
362 |
+
__( '<div id="ytc_fmvd" class="notice notice-success is-dismissible"><p><strong>Attention!</strong><br /><br />%3$sTurn on Video Download option in %1$s <a href="%2$s">settings</a>.</p></div>', 'youtube-channel' ),
|
363 |
+
$this->plugin_name,
|
364 |
+
$settings_page,
|
365 |
+
'<img src="'.$this->plugin_url.'assets/img/fmvd-icon.png" style="margin-bottom:-0.4em" /> '
|
366 |
+
);
|
367 |
+
echo '<script>jQuery(\'#ytc_fmvd.notice.is-dismissible\').on(\'click\', \'.notice-dismiss\',function(event){window.location.search += (window.location.search ? "&" : "?") + \'ytc_dismiss_notice_fmvd=1\'; });</script>';
|
368 |
+
}
|
369 |
+
|
370 |
} // END function admin_notices()
|
371 |
|
372 |
/**
|
539 |
'link_to' => $instance['link_to'], // none, vanity, channel, legacy
|
540 |
|
541 |
'class' => ! empty( $instance['class'] ) ? $instance['class'] : '',
|
542 |
+
'fmvd' => ! empty( $instance['fmvd'] ) ? $instance['fmvd'] : '',
|
543 |
),
|
544 |
$atts
|
545 |
);
|
598 |
|
599 |
// Customization
|
600 |
$instance['class'] = $atts['class']; // custom additional class for container
|
601 |
+
$instance['fmvd'] = $atts['fmvd']; // fmvd toggler
|
602 |
|
603 |
// return implode( array_values( $this->output( $instance ) ) );
|
604 |
return $this->output( $instance );
|
894 |
} // single playlist or ytc way
|
895 |
|
896 |
// Append link to channel on bootom of the widget
|
897 |
+
$output .= $this->ytc_footer( $instance );
|
|
|
|
|
898 |
|
899 |
$output .= '</div><!-- .youtube_channel -->';
|
900 |
|
992 |
return $height;
|
993 |
} // END function height_ratio($width=306, $ratio)
|
994 |
|
995 |
+
/**
|
996 |
+
* Generate link to YouTube channel/user
|
997 |
+
* @param array $instance widget or shortcode settings
|
998 |
+
* @return array components prepared for output
|
999 |
+
*/
|
1000 |
+
function ytc_footer( $instance ) {
|
1001 |
+
|
1002 |
+
// Initialize output string
|
1003 |
+
$output = '';
|
1004 |
+
|
1005 |
+
// Get link to channel part
|
1006 |
+
$output .= $this->ytc_channel_link( $instance );
|
1007 |
+
|
1008 |
+
// Get FMVD part
|
1009 |
+
// override item defined fmvd and also look for global
|
1010 |
+
if ( ! empty( $instance['fmvd'] ) || ! empty( $this->defaults['fmvd'] ) ) {
|
1011 |
+
$output .= sprintf(
|
1012 |
+
'<a href="%1$s" target="_blank" title="%2$s" class="fmvd">%3$s</a>',
|
1013 |
+
'http://www.freemake.com/free_video_downloader/',
|
1014 |
+
__( 'Get #1 YouTube downloader app Freemake Video Downloader and download any YouTube content free to watch online', 'youtube-channel' ),
|
1015 |
+
__( 'Download YouTube Video', 'youtube-channel' )
|
1016 |
+
);
|
1017 |
+
}
|
1018 |
+
|
1019 |
+
// Wrap content, if we have it
|
1020 |
+
if ( ! empty( $output ) ) {
|
1021 |
+
$output = $this->clearfix() . '<div class="ytc_link"><p>' . $output . '</p></div>';
|
1022 |
+
}
|
1023 |
+
|
1024 |
+
return $output;
|
1025 |
+
} // end function ytc_footer
|
1026 |
+
|
1027 |
+
function clearfix() {
|
1028 |
+
return '<div class="clearfix"></div>';
|
1029 |
+
}
|
1030 |
/**
|
1031 |
* Generate link to YouTube channel/user
|
1032 |
* @param array $instance widget or shortcode settings
|
1034 |
*/
|
1035 |
function ytc_channel_link( $instance ) {
|
1036 |
|
|
|
|
|
1037 |
// Initialize output string
|
1038 |
$output = '';
|
1039 |
|
1040 |
// do we need to show goto link?
|
1041 |
+
if ( ! empty( $instance['link_to'] ) && 'none' != $instance['link_to'] ) {
|
1042 |
|
1043 |
$goto_url = 'https://www.youtube.com/';
|
1044 |
|
1089 |
|
1090 |
$newtab = __( 'in new window/tab', 'youtube-channel' );
|
1091 |
|
|
|
|
|
|
|
1092 |
switch ( $instance['popup_goto'] ) {
|
1093 |
case 1:
|
1094 |
$output .= "<a href=\"javascript: window.open('{$goto_url}'); void 0;\" title=\"{$goto_txt} {$newtab}\">{$goto_txt}</a>";
|
1099 |
default:
|
1100 |
$output .= "<a href=\"{$goto_url}\" title=\"{$goto_txt}\">$goto_txt</a>";
|
1101 |
} // switch popup_goto
|
|
|
|
|
1102 |
|
1103 |
+
} // END if ( ! empty( $instance['link_to'] ) && 'none' != $instance['link_to'] )
|
1104 |
|
1105 |
return $output;
|
1106 |
+
} // END function ytc_channel_link
|
1107 |
|
1108 |
|
1109 |
/**
|
1162 |
|
1163 |
// Show video title above video?
|
1164 |
if ( ! empty( $instance['showtitle'] ) && 'above' == $instance['showtitle'] ) {
|
1165 |
+
$title_tag = isset( $instance['titletag'] ) ? $instance['titletag'] : $this->defaults['titletag'];
|
1166 |
+
$output .= "<{$title_tag} class=\"ytc_title ytc_title_above\">{$yt_title}</{$title_tag}>";
|
1167 |
}
|
1168 |
|
1169 |
// Print out video
|