YouTube Channel - Version 3.0.11.5

Version Description

(20180721) = * Add: Missing titletag parameter for shortcode, shortcode TinyMCE wizard and widget * Fix: Missing video title for thubmbnail display with above or below positioning (thanks @nimeldk)

Download this release

Release Info

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

Code changes from version 3.0.11.4 to 3.0.11.5

inc/settings.php CHANGED
@@ -631,19 +631,16 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL_SETTINGS' ) ) {
631
  'ytc_content', // section
632
  array(
633
  'field' => $this->option_name . '[titletag]',
634
- 'description' => sprintf(
635
- '%1$s %2$s',
636
- $this->settings_description_global(),
637
- __( 'Select which HTML tag to use for title wrapper.', 'youtube-channel' )
638
- ),
639
  'class' => 'regular-text',
640
  'value' => isset( $this->defaults['titletag'] ) ? $this->defaults['titletag'] : 'h3',
641
  'items' => array(
642
- 'h3' => 'H3',
643
- 'h4' => 'H4',
644
- 'h5' => 'H5',
645
- 'span' => 'span',
646
- 'div' => 'div',
 
647
  ),
648
  ) // args
649
  );
@@ -1073,7 +1070,7 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL_SETTINGS' ) ) {
1073
  // --- Content ---
1074
  case 'ytc_content':
1075
  $sanitized['showtitle'] = ( ! empty( $options['showtitle'] ) ) ? $options['showtitle'] : $this->defaults['showtitle'];
1076
- $sanitized['titletag'] = ( ! empty( $options['titletag'] ) ) ? $options['titletag'] : $this->defaults['titletag'];
1077
  $sanitized['showdesc'] = ( ! empty( $options['showdesc'] ) && $options['showdesc'] ) ? 1 : 0;
1078
  $sanitized['desclen'] = ( ! empty( $options['desclen'] ) ) ? intval( $options['desclen'] ) : $this->defaults['desclen'];
1079
  break; // Content
631
  'ytc_content', // section
632
  array(
633
  'field' => $this->option_name . '[titletag]',
634
+ 'description' => __( 'Select which HTML tag to use for title wrapper. Fallback if not set in shortcode.', 'youtube-channel' ),
 
 
 
 
635
  'class' => 'regular-text',
636
  'value' => isset( $this->defaults['titletag'] ) ? $this->defaults['titletag'] : 'h3',
637
  'items' => array(
638
+ 'h3' => 'h3',
639
+ 'h4' => 'h4',
640
+ 'h5' => 'h5',
641
+ 'div' => 'div',
642
+ 'span' => 'span',
643
+ 'strong' => 'strong',
644
  ),
645
  ) // args
646
  );
1070
  // --- Content ---
1071
  case 'ytc_content':
1072
  $sanitized['showtitle'] = ( ! empty( $options['showtitle'] ) ) ? $options['showtitle'] : $this->defaults['showtitle'];
1073
+ $sanitized['titletag'] = ( ! empty( $options['titletag'] ) ) ? strtolower( $options['titletag'] ) : strtolower( $this->defaults['titletag'] );
1074
  $sanitized['showdesc'] = ( ! empty( $options['showdesc'] ) && $options['showdesc'] ) ? 1 : 0;
1075
  $sanitized['desclen'] = ( ! empty( $options['desclen'] ) ) ? intval( $options['desclen'] ) : $this->defaults['desclen'];
1076
  break; // Content
inc/tinymce/plugin.js CHANGED
@@ -300,6 +300,21 @@
300
  ],
301
  value : 'none'
302
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
303
  {
304
  type: 'checkbox',
305
  name: 'showdesc',
@@ -391,6 +406,7 @@
391
 
392
  // Content Layout
393
  if ( e.data.showtitle ) shortcode += ' showtitle=' + e.data.showtitle + '';
 
394
  if ( e.data.showdesc ) shortcode += ' showdesc=1';
395
  if ( e.data.desclen ) shortcode += ' desclen=' + e.data.desclen.replace(/[^0-9.]/g, '') + '';
396
  if ( e.data.noanno ) shortcode += ' noanno=1';
300
  ],
301
  value : 'none'
302
  },
303
+ {
304
+ type: 'listbox',
305
+ name: 'titletag',
306
+ label: 'Title HTML tag',
307
+ tooltip: 'Select which HTML tag to use for title wrapper.',
308
+ values : [
309
+ {text: 'h3', value: 'h3'},
310
+ {text: 'h4', value: 'h4'},
311
+ {text: 'h5', value: 'h5'},
312
+ {text: 'div', value: 'div'},
313
+ {text: 'span', value: 'span'},
314
+ {text: 'strong', value: 'strong'},
315
+ ],
316
+ value : 'none'
317
+ },
318
  {
319
  type: 'checkbox',
320
  name: 'showdesc',
406
 
407
  // Content Layout
408
  if ( e.data.showtitle ) shortcode += ' showtitle=' + e.data.showtitle + '';
409
+ if ( e.data.titletag ) shortcode += ' titletag=' + e.data.titletag + '';
410
  if ( e.data.showdesc ) shortcode += ' showdesc=1';
411
  if ( e.data.desclen ) shortcode += ' desclen=' + e.data.desclen.replace(/[^0-9.]/g, '') + '';
412
  if ( e.data.noanno ) shortcode += ' noanno=1';
inc/tinymce/plugin.min.js CHANGED
@@ -1 +1 @@
1
- tinymce.PluginManager.add("youtube_channel",function(e,t){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"},{text:"Favourited videos",value:"1"},{text:"Liked videos",value:"3"},{text:"Playlist",value:"2"}],value:"0"},{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"},{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"}],value:"300"},{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}]},{title:"Video Settings",type:"form",items:[{type:"listbox",name:"ratio",label:"Aspect Ratio",values:[{text:"Widescreen (16:9)",value:"3"},{text:"Standard TV (4:3)",value:"1"}],value:"3"},{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"}],value:"thumbnail"},{type:"listbox",name:"thumb_quality",label:"Thumbnail Quality",tooltip:"",values:[{text:"Default Quality (120x90px)",value:"default"},{text:"Medium Quality (320x180px)",value:"mqdefault"},{text:"High Quality (480x360px)",value:"hqdefault"},{text:"Standard Definition (640x480px)",value:"sddefault"},{text:"Maximum Resolution (1280x720px)",value:"maxresdefault"}],value:"hqdefault"},{type:"checkbox",name:"nolightbox",label:"Disable YTC lightbox",tooltip:"This will work only for Thumbnail",checked:!1},{type:"listbox",name:"target",label:"Open thumbnail anchor",tooltip:"If you select Thumbnail and enable Disable lightbox, you can open thumbnail anchor in new window/tab",values:[{text:"Default",value:""},{text:"New window/tab",value:"_blank"}]},{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"},{text:"Above video/thumbnail",value:"above"},{text:"Below video/thumbnail",value:"below"},{text:"Inside thumbnail, top aligned",value:"inside"},{text:"Inside thumbnail, bottom aligned",value:"inside_b"}],value:"none"},{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"},{text:"Vanity/Custom URL",value:"vanity"},{text:"Channel page URL",value:"channel"},{text:"Legacy username URL",value:"legacy"}],value:"none"},{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.thumb_quality&&(a+=" thumb_quality="+t.data.thumb_quality),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.nolightbox&&(a+=" nolightbox=1"),t.data.target&&(a+=" target="+t.data.target),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),a+="]",e.insertContent(a)}})}})});
1
+ tinymce.PluginManager.add("youtube_channel",function(e,t){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"},{text:"Favourited videos",value:"1"},{text:"Liked videos",value:"3"},{text:"Playlist",value:"2"}],value:"0"},{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"},{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"}],value:"300"},{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}]},{title:"Video Settings",type:"form",items:[{type:"listbox",name:"ratio",label:"Aspect Ratio",values:[{text:"Widescreen (16:9)",value:"3"},{text:"Standard TV (4:3)",value:"1"}],value:"3"},{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"}],value:"thumbnail"},{type:"listbox",name:"thumb_quality",label:"Thumbnail Quality",tooltip:"",values:[{text:"Default Quality (120x90px)",value:"default"},{text:"Medium Quality (320x180px)",value:"mqdefault"},{text:"High Quality (480x360px)",value:"hqdefault"},{text:"Standard Definition (640x480px)",value:"sddefault"},{text:"Maximum Resolution (1280x720px)",value:"maxresdefault"}],value:"hqdefault"},{type:"checkbox",name:"nolightbox",label:"Disable YTC lightbox",tooltip:"This will work only for Thumbnail",checked:!1},{type:"listbox",name:"target",label:"Open thumbnail anchor",tooltip:"If you select Thumbnail and enable Disable lightbox, you can open thumbnail anchor in new window/tab",values:[{text:"Default",value:""},{text:"New window/tab",value:"_blank"}]},{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"},{text:"Above video/thumbnail",value:"above"},{text:"Below video/thumbnail",value:"below"},{text:"Inside thumbnail, top aligned",value:"inside"},{text:"Inside thumbnail, bottom aligned",value:"inside_b"}],value:"none"},{type:"listbox",name:"titletag",label:"Title HTML tag",tooltip:"Select which HTML tag to use for title wrapper.",values:[{text:"h3",value:"h3"},{text:"h4",value:"h4"},{text:"h5",value:"h5"},{text:"div",value:"div"},{text:"span",value:"span"},{text:"strong",value:"strong"}],value:"none"},{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"},{text:"Vanity/Custom URL",value:"vanity"},{text:"Channel page URL",value:"channel"},{text:"Legacy username URL",value:"legacy"}],value:"none"},{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.thumb_quality&&(a+=" thumb_quality="+t.data.thumb_quality),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.nolightbox&&(a+=" nolightbox=1"),t.data.target&&(a+=" target="+t.data.target),t.data.showtitle&&(a+=" showtitle="+t.data.showtitle),t.data.titletag&&(a+=" titletag="+t.data.titletag),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),a+="]",e.insertContent(a)}})}})});
inc/widget.php CHANGED
@@ -86,6 +86,7 @@ class WPAU_YOUTUBE_CHANNEL_Widget extends WP_Widget {
86
 
87
  // Content Layout
88
  $showtitle = ! empty( $instance['showtitle'] ) ? esc_attr( $instance['showtitle'] ) : 'none';
 
89
  $showdesc = ! empty( $instance['showdesc'] ) ? esc_attr( $instance['showdesc'] ) : '';
90
  $modestbranding = ! empty( $instance['modestbranding'] ) ? esc_attr( $instance['modestbranding'] ) : '';
91
  $desclen = ! empty( $instance['desclen'] ) ? esc_attr( $instance['desclen'] ) : 0;
@@ -230,6 +231,20 @@ class WPAU_YOUTUBE_CHANNEL_Widget extends WP_Widget {
230
  <option value="inside"<?php selected( $showtitle, 'inside' ); ?>><?php _e( 'Inside thumbnail, top aligned', 'youtube-channel' ); ?></option>
231
  <option value="inside_b"<?php selected( $showtitle, 'inside_b' ); ?>><?php _e( 'Inside thumbnail, bototm aligned', 'youtube-channel' ); ?></option>
232
  </select><br />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
233
  <label for="<?php echo $this->get_field_id( 'showdesc' ); ?>">
234
  <input class="checkbox" type="checkbox" <?php checked( (bool) $showdesc, true ); ?> id="<?php echo $this->get_field_id( 'showdesc' ); ?>" name="<?php echo $this->get_field_name( 'showdesc' ); ?>" /> <?php _e( 'Show video description', 'youtube-channel' ); ?>
235
  </label><br />
@@ -309,6 +324,7 @@ class WPAU_YOUTUBE_CHANNEL_Widget extends WP_Widget {
309
  $instance['link_to'] = $new_instance['link_to'];
310
 
311
  $instance['showtitle'] = isset( $new_instance['showtitle'] ) ? $new_instance['showtitle'] : 'none';
 
312
  $instance['showdesc'] = isset( $new_instance['showdesc'] ) ? $new_instance['showdesc'] : false;
313
  $instance['desclen'] = strip_tags( $new_instance['desclen'] );
314
  $instance['width'] = strip_tags( $new_instance['width'] );
86
 
87
  // Content Layout
88
  $showtitle = ! empty( $instance['showtitle'] ) ? esc_attr( $instance['showtitle'] ) : 'none';
89
+ $titletag = ! empty( $instance['titletag'] ) ? strtolower( esc_attr( $instance['titletag'] ) ) : 'h3';
90
  $showdesc = ! empty( $instance['showdesc'] ) ? esc_attr( $instance['showdesc'] ) : '';
91
  $modestbranding = ! empty( $instance['modestbranding'] ) ? esc_attr( $instance['modestbranding'] ) : '';
92
  $desclen = ! empty( $instance['desclen'] ) ? esc_attr( $instance['desclen'] ) : 0;
231
  <option value="inside"<?php selected( $showtitle, 'inside' ); ?>><?php _e( 'Inside thumbnail, top aligned', 'youtube-channel' ); ?></option>
232
  <option value="inside_b"<?php selected( $showtitle, 'inside_b' ); ?>><?php _e( 'Inside thumbnail, bototm aligned', 'youtube-channel' ); ?></option>
233
  </select><br />
234
+ <label for="<?php echo $this->get_field_id( 'titletag' ); ?>">
235
+ <?php _e( 'Title HTML tag', 'youtube-channel' ); ?>
236
+ </label>
237
+ <select class="widefat" id="<?php echo $this->get_field_id( 'titletag' ); ?>" name="<?php echo $this->get_field_name( 'titletag' ); ?>">
238
+ <?php
239
+ foreach ( array( 'h3', 'h4', 'h5', 'div', 'span', 'strong' ) as $tag ) {
240
+ printf(
241
+ '<option value="%1$s" %2$s>%1$s</option>',
242
+ $tag,
243
+ selected( $titletag, $tag )
244
+ );
245
+ }
246
+ ?>
247
+ </select><br />
248
  <label for="<?php echo $this->get_field_id( 'showdesc' ); ?>">
249
  <input class="checkbox" type="checkbox" <?php checked( (bool) $showdesc, true ); ?> id="<?php echo $this->get_field_id( 'showdesc' ); ?>" name="<?php echo $this->get_field_name( 'showdesc' ); ?>" /> <?php _e( 'Show video description', 'youtube-channel' ); ?>
250
  </label><br />
324
  $instance['link_to'] = $new_instance['link_to'];
325
 
326
  $instance['showtitle'] = isset( $new_instance['showtitle'] ) ? $new_instance['showtitle'] : 'none';
327
+ $instance['titletag'] = isset( $new_instance['titletag'] ) ? $new_instance['titletag'] : 'h3';
328
  $instance['showdesc'] = isset( $new_instance['showdesc'] ) ? $new_instance['showdesc'] : false;
329
  $instance['desclen'] = strip_tags( $new_instance['desclen'] );
330
  $instance['width'] = strip_tags( $new_instance['width'] );
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.9.6
7
- Stable tag: 3.0.11.4
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -142,6 +142,7 @@ Along to Widget, you can add YouTube Channel block inline by using shortcode `[y
142
  * `below` - Display title below video/thumbnail
143
  * `inside` - Display top aligned title inside thumbnail; if `display` is not `thumbnail` then treat as `above`
144
  * `inside_b` - Display bottom aligned title inside thumbnail; if `display` is not `thumbnail` then treat as `below`
 
145
  * `showdesc` (bool) Set to 1 or true to show video description.
146
  * `desclen` (int) Set number of characters to cut down length of video description. Set to 0 to use full length description.
147
  * `noinfo` (bool) Set to 1 or true to hide overlay video infos (from embedded player)
@@ -371,6 +372,10 @@ If you don't wish to pay for enhancements (then you don't care would that be imp
371
 
372
  == Changelog ==
373
 
 
 
 
 
374
  = 3.0.11.4 (20180622) =
375
  * Improvement: add `showtitle` options `inside` and `inside_b`.
376
  * (20180213) Update: section descriptions on plugin settings.
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.8
7
+ Stable tag: 3.0.11.5
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
142
  * `below` - Display title below video/thumbnail
143
  * `inside` - Display top aligned title inside thumbnail; if `display` is not `thumbnail` then treat as `above`
144
  * `inside_b` - Display bottom aligned title inside thumbnail; if `display` is not `thumbnail` then treat as `below`
145
+ * `titletag` - Video title HTML tag to wrap title (H3, H4, H5, div, span, strong, etc)
146
  * `showdesc` (bool) Set to 1 or true to show video description.
147
  * `desclen` (int) Set number of characters to cut down length of video description. Set to 0 to use full length description.
148
  * `noinfo` (bool) Set to 1 or true to hide overlay video infos (from embedded player)
372
 
373
  == Changelog ==
374
 
375
+ = 3.0.11.5 (20180721) =
376
+ * Add: Missing `titletag` parameter for shortcode, shortcode TinyMCE wizard and widget
377
+ * Fix: Missing video title for `thubmbnail` display with `above` or `below` positioning (thanks @nimeldk)
378
+
379
  = 3.0.11.4 (20180622) =
380
  * Improvement: add `showtitle` options `inside` and `inside_b`.
381
  * (20180213) Update: section descriptions on plugin settings.
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.4
7
  Author: Aleksandar Urošević
8
  Author URI: https://urosevic.net/
9
  Text Domain: youtube-channel
@@ -18,7 +18,7 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
18
  class WPAU_YOUTUBE_CHANNEL {
19
 
20
  const DB_VER = 20;
21
- const VER = '3.0.11.4';
22
 
23
  public $plugin_name = 'YouTube Channel';
24
  public $plugin_slug = 'youtube-channel';
@@ -515,6 +515,7 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
515
  'playsinline' => $instance['playsinline'], // play video on mobile devices inline instead in native device player
516
 
517
  'showtitle' => $instance['showtitle'], // none, above, below, inside, inside_b
 
518
  'showdesc' => $instance['showdesc'], // ex showvidesc
519
  'nobrand' => ! empty( $instance['modestbranding'] ) ? $instance['modestbranding'] : '0',
520
  'desclen' => $instance['desclen'], // ex videsclen
@@ -575,6 +576,7 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
575
 
576
  // Content Layout
577
  $instance['showtitle'] = $atts['showtitle']; // show video title, disabled by default
 
578
  $instance['showdesc'] = $atts['showdesc']; // show video description, disabled by default
579
  $instance['modestbranding'] = $atts['nobrand']; // hide YT logo
580
  $instance['desclen'] = (int) $atts['desclen']; // cut video description, number of characters
@@ -1150,12 +1152,19 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
1150
  $output .= "<div class=\"ytc_video_container ytc_video_{$y} ytc_video_{$vnumclass} ${arclass}\" style=\"width:{$instance['width']}px\">";
1151
 
1152
  // Show video title above video?
1153
- if ( ! empty( $instance['showtitle'] ) && 'thumbnail' != $instance['display'] && ( in_array( $instance['showtitle'], array( 'above', 'inside' ) ) ) ) {
1154
- $output .= sprintf(
1155
- '<%1$s class="ytc_title ytc_title_above">%2$s</%1$s>',
1156
- $title_tag,
1157
- $yt_title
1158
- );
 
 
 
 
 
 
 
1159
  }
1160
 
1161
  // Print out video
@@ -1282,12 +1291,19 @@ if ( ! class_exists( 'WPAU_YOUTUBE_CHANNEL' ) ) {
1282
  } // what to show conditions
1283
 
1284
  // Show video title below video?
1285
- if ( ! empty( $instance['showtitle'] ) && 'thumbnail' != $instance['display'] && in_array( $instance['showtitle'], array( 'below', 'inside_b' ) ) ) {
1286
- $output .= sprintf(
1287
- '<%1$s class="ytc_title ytc_title_below">%2$s</%1$s>',
1288
- $title_tag,
1289
- $yt_title
1290
- );
 
 
 
 
 
 
 
1291
  }
1292
 
1293
  // do we need to show video description?
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.5
7
  Author: Aleksandar Urošević
8
  Author URI: https://urosevic.net/
9
  Text Domain: youtube-channel
18
  class WPAU_YOUTUBE_CHANNEL {
19
 
20
  const DB_VER = 20;
21
+ const VER = '3.0.11.5';
22
 
23
  public $plugin_name = 'YouTube Channel';
24
  public $plugin_slug = 'youtube-channel';
515
  'playsinline' => $instance['playsinline'], // play video on mobile devices inline instead in native device player
516
 
517
  'showtitle' => $instance['showtitle'], // none, above, below, inside, inside_b
518
+ 'titletag' => $instance['titletag'], // h3, h4, h5, div, span, strong
519
  'showdesc' => $instance['showdesc'], // ex showvidesc
520
  'nobrand' => ! empty( $instance['modestbranding'] ) ? $instance['modestbranding'] : '0',
521
  'desclen' => $instance['desclen'], // ex videsclen
576
 
577
  // Content Layout
578
  $instance['showtitle'] = $atts['showtitle']; // show video title, disabled by default
579
+ $instance['titletag'] = $atts['titletag']; // title HTML tag wrapper, h3 by default
580
  $instance['showdesc'] = $atts['showdesc']; // show video description, disabled by default
581
  $instance['modestbranding'] = $atts['nobrand']; // hide YT logo
582
  $instance['desclen'] = (int) $atts['desclen']; // cut video description, number of characters
1152
  $output .= "<div class=\"ytc_video_container ytc_video_{$y} ytc_video_{$vnumclass} ${arclass}\" style=\"width:{$instance['width']}px\">";
1153
 
1154
  // Show video title above video?
1155
+ if ( ! empty( $instance['showtitle'] ) ) {
1156
+ if (
1157
+ // for non-thumbnail for `above` and `inside`
1158
+ ( 'thumbnail' != $instance['display'] && in_array( $instance['showtitle'], array( 'above', 'inside' ) ) ) ||
1159
+ // for thubmanil only if it's `below`
1160
+ ( 'thumbnail' == $instance['display'] && 'above' == $instance['showtitle'] )
1161
+ ) {
1162
+ $output .= sprintf(
1163
+ '<%1$s class="ytc_title ytc_title_above">%2$s</%1$s>',
1164
+ $title_tag,
1165
+ $yt_title
1166
+ );
1167
+ }
1168
  }
1169
 
1170
  // Print out video
1291
  } // what to show conditions
1292
 
1293
  // Show video title below video?
1294
+ if ( ! empty( $instance['showtitle'] ) ) {
1295
+ if (
1296
+ // for non-thumbnail for `below` and `inside_b`
1297
+ ( 'thumbnail' != $instance['display'] && in_array( $instance['showtitle'], array( 'below', 'inside_b' ) ) ) ||
1298
+ // for thubmanil only if it's `below`
1299
+ ( 'thumbnail' == $instance['display'] && 'below' == $instance['showtitle'] )
1300
+ ) {
1301
+ $output .= sprintf(
1302
+ '<%1$s class="ytc_title ytc_title_below">%2$s</%1$s>',
1303
+ $title_tag,
1304
+ $yt_title
1305
+ );
1306
+ }
1307
  }
1308
 
1309
  // do we need to show video description?