YouTube Channel - Version 2.4.1

Version Description

(2014-11-15) = * Fix: Typo in widget Do not chache [2014-10-03] * Fix: do not show global settings notice with link to settings page if not Redux Framerowk is active [2014-11-15] * Fix: Plugin name on Support tab in global plugin settings. [2014-11-15] * Change: Remove protocol from links and leave browser to decide should get resource from HTTP or HTTPS (depends on website protocol) [2014-10-03] * Change: Add height addition for Fix height taken by controls for embedded playlist and count control above video [2014-10-03] * Change: Move debug log from widget to downloadable dynamic JSON [2014-11-15] * Add: ModestBranding (remove YouTube logo from player control bar) [2014-10-03] * Add: Responsive (make video optionally responsive) [2014-10-04]

Download this release

Release Info

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

Code changes from version 2.4.0.2 to 2.4.1

assets/css/youtube-channel.css CHANGED
@@ -3,6 +3,9 @@
3
  float: left;
4
  clear: both;
5
  }
 
 
 
6
  .widget_youtube-channel:after,
7
  .youtube_channel:after {
8
  visibility: hidden;
@@ -15,6 +18,9 @@
15
  .youtube_channel .ytc_video_container {
16
  float: left;
17
  }
 
 
 
18
  .ytc_thumb {
19
  display: block;
20
  overflow: hidden;
3
  float: left;
4
  clear: both;
5
  }
6
+ .youtube_channel.responsive {
7
+ width:100%;
8
+ }
9
  .widget_youtube-channel:after,
10
  .youtube_channel:after {
11
  visibility: hidden;
18
  .youtube_channel .ytc_video_container {
19
  float: left;
20
  }
21
+ .youtube_channel.responsive .ytc_video_container {
22
+ width:100%!important;
23
+ }
24
  .ytc_thumb {
25
  display: block;
26
  overflow: hidden;
assets/css/youtube-channel.min.css CHANGED
@@ -1,3 +1,4 @@
1
- .youtube_channel{float:left;clear:both}.widget_youtube-channel:after,.youtube_channel:after{visibility:hidden;display:block;font-size:0;content:" ";clear:both;height:0}.youtube_channel .ytc_video_container{float:left}.ytc_thumb{display:block;overflow:hidden;position:relative;height:0;width:100%;top:0;right:0;bottom:0;left:0}
2
- .ytc_thumb>span{height:0;width:100%;display:block;-webkit-background-size:cover;background-size:cover;background-position:center center;background-repeat:no-repeat}.ytc_thumb>span:before{content:"";display:block;width:100%;height:0;background-image:url(../img/play.png);background-position:center center;background-repeat:no-repeat;background-color:transparent;opacity:.6;transition:.4s}
 
3
  .ytc_thumb:hover>span:before{opacity:1}.ytc_thumb.ar16_9,.ytc_thumb.ar16_9>span,.ytc_thumb.ar16_9>span:before{padding-bottom:56.26%}.ytc_thumb.ar16_10,.ytc_thumb.ar16_10>span,.ytc_thumb.ar16_10>span:before{padding-bottom:62.5%}.ytc_thumb.ar4_3,.ytc_thumb.ar4_3>span,.ytc_thumb.ar4_3>span:before{padding-bottom:75%}
1
+ .youtube_channel{float:left;clear:both}.youtube_channel.responsive{width:100%}.widget_youtube-channel:after,.youtube_channel:after{visibility:hidden;display:block;font-size:0;content:" ";clear:both;height:0}.youtube_channel .ytc_video_container{float:left}
2
+ .youtube_channel.responsive .ytc_video_container{width:100%!important}.ytc_thumb{display:block;overflow:hidden;position:relative;height:0;width:100%;top:0;right:0;bottom:0;left:0}.ytc_thumb>span{height:0;width:100%;display:block;-webkit-background-size:cover;background-size:cover;background-position:center center;background-repeat:no-repeat}
3
+ .ytc_thumb>span:before{content:"";display:block;width:100%;height:0;background-image:url(../img/play.png);background-position:center center;background-repeat:no-repeat;background-color:transparent;opacity:.6;transition:.4s}
4
  .ytc_thumb:hover>span:before{opacity:1}.ytc_thumb.ar16_9,.ytc_thumb.ar16_9>span,.ytc_thumb.ar16_9>span:before{padding-bottom:56.26%}.ytc_thumb.ar16_10,.ytc_thumb.ar16_10>span,.ytc_thumb.ar16_10>span:before{padding-bottom:62.5%}.ytc_thumb.ar4_3,.ytc_thumb.ar4_3>span,.ytc_thumb.ar4_3>span:before{padding-bottom:75%}
assets/js/youtube-channel.js CHANGED
@@ -8,4 +8,7 @@ jQuery(document).ready(function($) {
8
  preloader: false,
9
  fixedContentPos: false
10
  });
11
- });
 
 
 
8
  preloader: false,
9
  fixedContentPos: false
10
  });
11
+ $(window).on('load', function() {
12
+ $(".youtube_channel.responsive .ytc_video_container").fitVids();
13
+ });
14
+ });
assets/js/youtube-channel.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(e){e(".ytc-lightbox").magnificPopup({disableOn:700,type:"iframe",mainClass:"mfp-fade",removalDelay:160,preloader:!1,fixedContentPos:!1})});
1
+ jQuery(document).ready(function(e){e(".ytc-lightbox").magnificPopup({disableOn:700,type:"iframe",mainClass:"mfp-fade",removalDelay:160,preloader:!1,fixedContentPos:!1}),e(window).on("load",function(){e(".youtube_channel.responsive .ytc_video_container").fitVids()})});
chromeless.swf → inc/chromeless.swf RENAMED
File without changes
inc/config.php CHANGED
@@ -181,6 +181,13 @@ if ( !class_exists( "Redux_Framework_YouTube_Channel" ) ) {
181
  ),
182
  'default' => '3'
183
  ),
 
 
 
 
 
 
 
184
  array(
185
  'id' => 'width',
186
  'type' => 'spinner',
@@ -248,6 +255,13 @@ if ( !class_exists( "Redux_Framework_YouTube_Channel" ) ) {
248
  'desc' => __('Enable this option to hide related videos after finished playback', 'youtube-channel'),
249
  'default' => 0
250
  ),
 
 
 
 
 
 
 
251
 
252
  )
253
  );
181
  ),
182
  'default' => '3'
183
  ),
184
+ array(
185
+ 'id' => 'responsive',
186
+ 'type' => 'checkbox',
187
+ 'title' => __('Make responsive', 'youtube-channel'),
188
+ 'desc' => __('Enable this option to make all YTC videos responsive. Please note, this option will set all videos full width relative to parent container, and disable more than one video per row.', 'youtube-channel'),
189
+ 'default' => 0
190
+ ),
191
  array(
192
  'id' => 'width',
193
  'type' => 'spinner',
255
  'desc' => __('Enable this option to hide related videos after finished playback', 'youtube-channel'),
256
  'default' => 0
257
  ),
258
+ array(
259
+ 'id' => 'modestbranding',
260
+ 'type' => 'checkbox',
261
+ 'title' => __('Hide YT Logo', 'youtube-channel'),
262
+ 'desc' => __('Enable this option to hide YouTube logo from playback control bar. Does not work for all videos.', 'youtube-channel'),
263
+ 'default' => 0
264
+ ),
265
 
266
  )
267
  );
inc/settings_support.php CHANGED
@@ -1,3 +1,3 @@
1
  <p>For all questions, feature request and communication with author and users of this plugin, use our <a href="http://wordpress.org/support/plugin/youtube-channel">support forum</a>.</p>
2
 
3
- <p>If you like <a href="http://wordpress.org/plugins/youtube-channel/">Posts per Cat</a> and my other <a href="http://urosevic.net/wordpress/plugins/">WordPress extensions</a>, feel free to support my work with <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Q6Q762MQ97XJ6">donation</a>.</p>
1
  <p>For all questions, feature request and communication with author and users of this plugin, use our <a href="http://wordpress.org/support/plugin/youtube-channel">support forum</a>.</p>
2
 
3
+ <p>If you like <a href="http://wordpress.org/plugins/youtube-channel/">YouTube Channel</a> and my other <a href="http://urosevic.net/wordpress/plugins/">WordPress extensions</a>, feel free to support my work with <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Q6Q762MQ97XJ6">donation</a>.</p>
inc/settings_usage_shortcode.php CHANGED
@@ -26,6 +26,7 @@
26
  <li>&bullet; <code>2</code> 16:10 (computer screen)</li>
27
  <li>&bullet; <code>1</code> 4:3</li>
28
  </ul></li>
 
29
  <li><code>width</code> <em>(int)</em> Width of thumbnail and video in pixels.</li>
30
  <li><code>show</code> <em>(string)</em> Object that will be used to represent video. We have couple predefined options:
31
  <ul>
@@ -42,6 +43,7 @@
42
  <li><code>autoplay</code> <em>(bool)</em> Enable autoplay of first video in YTC video stack by setting this option to <code>1</code> or <code>true</code></li>
43
  <li><code>mute</code> <em>(bool)</em> Set this option to <code>1</code> or <code>true</code> to mute videos set to autoplay on load</li>
44
  <li><code>norel</code> <em>(bool)</em> Set this option to <code>1</code> or <code>true</code> to hire related videos after finished playbak</li>
 
45
  </ul>
46
  <h3>Content Layout</h3>
47
  <ul>
26
  <li>&bullet; <code>2</code> 16:10 (computer screen)</li>
27
  <li>&bullet; <code>1</code> 4:3</li>
28
  </ul></li>
29
+ <li><code>responsive</code> <em>(bool)</em> Distribute one full width video per row.</li>
30
  <li><code>width</code> <em>(int)</em> Width of thumbnail and video in pixels.</li>
31
  <li><code>show</code> <em>(string)</em> Object that will be used to represent video. We have couple predefined options:
32
  <ul>
43
  <li><code>autoplay</code> <em>(bool)</em> Enable autoplay of first video in YTC video stack by setting this option to <code>1</code> or <code>true</code></li>
44
  <li><code>mute</code> <em>(bool)</em> Set this option to <code>1</code> or <code>true</code> to mute videos set to autoplay on load</li>
45
  <li><code>norel</code> <em>(bool)</em> Set this option to <code>1</code> or <code>true</code> to hire related videos after finished playbak</li>
46
+ <li><code>nobrand</code> <em>(bool)</em> Set this option to <code>1</code> or <code>true</code> to hire YouTube logo from playback control bar</li>
47
  </ul>
48
  <h3>Content Layout</h3>
49
  <ul>
inc/widget.php CHANGED
@@ -53,6 +53,7 @@ class WPAU_YOUTUBE_CHANNEL_Widget extends WP_Widget {
53
  // Video Settings
54
  $ratio = (!empty($instance['ratio'])) ? esc_attr($instance['ratio']) : 3;
55
  $width = (!empty($instance['width'])) ? esc_attr($instance['width']) : 306;
 
56
 
57
  $to_show = (!empty($instance['to_show'])) ? esc_attr($instance['to_show']) : '';
58
  $themelight = (!empty($instance['themelight'])) ? esc_attr($instance['themelight']) : '';
@@ -65,6 +66,7 @@ class WPAU_YOUTUBE_CHANNEL_Widget extends WP_Widget {
65
  // Content Layout
66
  $showtitle = (!empty($instance['showtitle'])) ? esc_attr($instance['showtitle']) : '';
67
  $showvidesc = (!empty($instance['showvidesc'])) ? esc_attr($instance['showvidesc']) : '';
 
68
  $videsclen = (!empty($instance['videsclen'])) ? esc_attr($instance['videsclen']) : 0;
69
  $descappend = (!empty($instance['descappend'])) ? esc_attr($instance['descappend']) : '&hellip;';
70
 
@@ -122,7 +124,7 @@ class WPAU_YOUTUBE_CHANNEL_Widget extends WP_Widget {
122
  <p>
123
  <label for="<?php echo $this->get_field_id('cache_time'); ?>"><?php _e('Cache feed', 'youtube-channel'); ?>:</label>
124
  <select class="widefat" id="<?php echo $this->get_field_id( 'cache_time' ); ?>" name="<?php echo $this->get_field_name( 'cache_time' ); ?>">
125
- <option value="0"<?php selected( $cache_time, 0 ); ?>><?php _e('Do not chache', 'youtube-channel'); ?></option>
126
  <?php echo $WPAU_YOUTUBE_CHANNEL->cache_time($cache_time); ?>
127
  </select>
128
  </p>
@@ -145,7 +147,8 @@ class WPAU_YOUTUBE_CHANNEL_Widget extends WP_Widget {
145
  <option value="3"<?php selected( $ratio, 3 ); ?>>16:9</option>
146
  <option value="2"<?php selected( $ratio, 2 ); ?>>16:10</option>
147
  <option value="1"<?php selected( $ratio, 1 ); ?>>4:3</option>
148
- </select>
 
149
  </p>
150
  <p>
151
  <label for="<?php echo $this->get_field_id('width'); ?>"><?php _e('Width', 'youtube-channel'); ?>:</label> <input class="small-text" id="<?php echo $this->get_field_id('width'); ?>" name="<?php echo $this->get_field_name('width'); ?>" type="number" min="32" value="<?php echo $width; ?>" title="<?php _e('Set video width in pixels', 'youtube-channel'); ?>" /> px (<?php _e('default', 'youtube-channel'); ?> 306)
@@ -164,7 +167,8 @@ class WPAU_YOUTUBE_CHANNEL_Widget extends WP_Widget {
164
  <input class="checkbox" type="checkbox" <?php checked( (bool) $fixyt, true ); ?> id="<?php echo $this->get_field_id( 'fixyt' ); ?>" name="<?php echo $this->get_field_name( 'fixyt' ); ?>" /> <label for="<?php echo $this->get_field_id( 'fixyt' ); ?>"><?php _e('Fix height taken by controls', 'youtube-channel'); ?></label><br />
165
  <input class="checkbox" type="checkbox" <?php checked( (bool) $autoplay, true ); ?> id="<?php echo $this->get_field_id( 'autoplay' ); ?>" name="<?php echo $this->get_field_name( 'autoplay' ); ?>" /> <label for="<?php echo $this->get_field_id( 'autoplay' ); ?>"><?php _e('Autoplay video or playlist', 'youtube-channel'); ?></label><br />
166
  <input class="checkbox" type="checkbox" <?php checked( (bool) $autoplay_mute, true ); ?> id="<?php echo $this->get_field_id( 'autoplay_mute' ); ?>" name="<?php echo $this->get_field_name( 'autoplay_mute' ); ?>" /> <label for="<?php echo $this->get_field_id( 'autoplay_mute' ); ?>"><?php _e('Mute video on autoplay', 'youtube-channel'); ?></label><br />
167
- <input class="checkbox" type="checkbox" <?php checked( (bool) $norel, true ); ?> id="<?php echo $this->get_field_id( 'norel' ); ?>" name="<?php echo $this->get_field_name( 'norel' ); ?>" /> <label for="<?php echo $this->get_field_id( 'norel' ); ?>"><?php _e('Hide related videos', 'youtube-channel'); ?></label>
 
168
  </p>
169
 
170
  <h4><?php _e('Content Layout', 'youtube-channel'); ?></h4>
@@ -191,26 +195,8 @@ class WPAU_YOUTUBE_CHANNEL_Widget extends WP_Widget {
191
  <input class="checkbox" type="checkbox" <?php checked( (bool) $userchan, true ); ?> id="<?php echo $this->get_field_id( 'userchan' ); ?>" name="<?php echo $this->get_field_name( 'userchan' ); ?>" /> <label for="<?php echo $this->get_field_id( 'userchan' ); ?>"><?php _e('Link to channel instead to user', 'youtube-channel'); ?></label><br />
192
  </p>
193
 
194
- <h4><?php _e('Debug YTC', 'youtube-channel'); ?></h4>
195
- <p>
196
- <input class="checkbox" type="checkbox" <?php checked( (bool) $debugon, true ); ?> id="<?php echo $this->get_field_id( 'debugon' ); ?>" name="<?php echo $this->get_field_name( 'debugon' ); ?>" /> <label for="<?php echo $this->get_field_id( 'debugon' ); ?>"><?php _e('Enable debugging', 'youtube-channel'); ?></label><br />
197
-
198
- <?php
199
- if ( $debugon == 'on' ) {
200
- global $wp_version;
201
- $debug_arr = array_merge(
202
- array(
203
- 'server' => $_SERVER["SERVER_SOFTWARE"],
204
- 'php' => PHP_VERSION,
205
- 'wp' => $wp_version,
206
- 'ytc' => $WPAU_YOUTUBE_CHANNEL->plugin_version,
207
- 'url' => get_site_url()
208
- ),
209
- $instance);
210
- ?>
211
- <textarea name="debug" class="widefat" style="height: 100px;"><?php echo $this->debug_string($debug_arr); ?></textarea><br />
212
- <small><?php printf(__('Insert debug data to <a href="%s" target="_support">support forum</a>.<br />Please do not remove channel and playlist ID`s. If you are concerned about privacy, send this debug log to email %s', 'youtube-channel'), 'http://wordpress.org/support/plugin/youtube-channel', '<a href="mailto:urke.kg@gmail.com?subject=YTC%20debug%20log">urke.kg@gmail.com</a>'); ?></small>
213
- <?php } ?>
214
  </p>
215
 
216
  <?php
@@ -239,11 +225,13 @@ if ( $debugon == 'on' ) {
239
  $instance['descappend'] = strip_tags($new_instance['descappend']);
240
  $instance['videsclen'] = strip_tags($new_instance['videsclen']);
241
  $instance['width'] = strip_tags($new_instance['width']);
 
242
 
243
  $instance['to_show'] = strip_tags($new_instance['to_show']);
244
  $instance['autoplay'] = (isset($new_instance['autoplay'])) ? $new_instance['autoplay'] : false;
245
  $instance['autoplay_mute'] = (isset($new_instance['autoplay_mute'])) ? $new_instance['autoplay_mute'] : false;
246
  $instance['norel'] = (isset($new_instance['norel'])) ? $new_instance['norel'] : false;
 
247
 
248
  $instance['controls'] = (isset($new_instance['controls'])) ? $new_instance['controls'] : false;
249
  $instance['fixnoitem'] = (isset($new_instance['fixnoitem'])) ? $new_instance['fixnoitem'] : false;
53
  // Video Settings
54
  $ratio = (!empty($instance['ratio'])) ? esc_attr($instance['ratio']) : 3;
55
  $width = (!empty($instance['width'])) ? esc_attr($instance['width']) : 306;
56
+ $responsive = (!empty($instance['responsive'])) ? esc_attr($instance['responsive']) : 0;
57
 
58
  $to_show = (!empty($instance['to_show'])) ? esc_attr($instance['to_show']) : '';
59
  $themelight = (!empty($instance['themelight'])) ? esc_attr($instance['themelight']) : '';
66
  // Content Layout
67
  $showtitle = (!empty($instance['showtitle'])) ? esc_attr($instance['showtitle']) : '';
68
  $showvidesc = (!empty($instance['showvidesc'])) ? esc_attr($instance['showvidesc']) : '';
69
+ $modestbranding = (!empty($instance['modestbranding'])) ? esc_attr($instance['modestbranding']) : '';
70
  $videsclen = (!empty($instance['videsclen'])) ? esc_attr($instance['videsclen']) : 0;
71
  $descappend = (!empty($instance['descappend'])) ? esc_attr($instance['descappend']) : '&hellip;';
72
 
124
  <p>
125
  <label for="<?php echo $this->get_field_id('cache_time'); ?>"><?php _e('Cache feed', 'youtube-channel'); ?>:</label>
126
  <select class="widefat" id="<?php echo $this->get_field_id( 'cache_time' ); ?>" name="<?php echo $this->get_field_name( 'cache_time' ); ?>">
127
+ <option value="0"<?php selected( $cache_time, 0 ); ?>><?php _e('Do not cache', 'youtube-channel'); ?></option>
128
  <?php echo $WPAU_YOUTUBE_CHANNEL->cache_time($cache_time); ?>
129
  </select>
130
  </p>
147
  <option value="3"<?php selected( $ratio, 3 ); ?>>16:9</option>
148
  <option value="2"<?php selected( $ratio, 2 ); ?>>16:10</option>
149
  <option value="1"<?php selected( $ratio, 1 ); ?>>4:3</option>
150
+ </select><br />
151
+ <input class="checkbox" type="checkbox" <?php checked( (bool) $responsive, true ); ?> id="<?php echo $this->get_field_id( 'responsive' ); ?>" name="<?php echo $this->get_field_name( 'responsive' ); ?>" /> <label for="<?php echo $this->get_field_id( 'responsive' ); ?>"><?php _e('Responsive video (distribute one full width video per row)', 'youtube-channel'); ?></label>
152
  </p>
153
  <p>
154
  <label for="<?php echo $this->get_field_id('width'); ?>"><?php _e('Width', 'youtube-channel'); ?>:</label> <input class="small-text" id="<?php echo $this->get_field_id('width'); ?>" name="<?php echo $this->get_field_name('width'); ?>" type="number" min="32" value="<?php echo $width; ?>" title="<?php _e('Set video width in pixels', 'youtube-channel'); ?>" /> px (<?php _e('default', 'youtube-channel'); ?> 306)
167
  <input class="checkbox" type="checkbox" <?php checked( (bool) $fixyt, true ); ?> id="<?php echo $this->get_field_id( 'fixyt' ); ?>" name="<?php echo $this->get_field_name( 'fixyt' ); ?>" /> <label for="<?php echo $this->get_field_id( 'fixyt' ); ?>"><?php _e('Fix height taken by controls', 'youtube-channel'); ?></label><br />
168
  <input class="checkbox" type="checkbox" <?php checked( (bool) $autoplay, true ); ?> id="<?php echo $this->get_field_id( 'autoplay' ); ?>" name="<?php echo $this->get_field_name( 'autoplay' ); ?>" /> <label for="<?php echo $this->get_field_id( 'autoplay' ); ?>"><?php _e('Autoplay video or playlist', 'youtube-channel'); ?></label><br />
169
  <input class="checkbox" type="checkbox" <?php checked( (bool) $autoplay_mute, true ); ?> id="<?php echo $this->get_field_id( 'autoplay_mute' ); ?>" name="<?php echo $this->get_field_name( 'autoplay_mute' ); ?>" /> <label for="<?php echo $this->get_field_id( 'autoplay_mute' ); ?>"><?php _e('Mute video on autoplay', 'youtube-channel'); ?></label><br />
170
+ <input class="checkbox" type="checkbox" <?php checked( (bool) $norel, true ); ?> id="<?php echo $this->get_field_id( 'norel' ); ?>" name="<?php echo $this->get_field_name( 'norel' ); ?>" /> <label for="<?php echo $this->get_field_id( 'norel' ); ?>"><?php _e('Hide related videos', 'youtube-channel'); ?></label><br />
171
+ <input class="checkbox" type="checkbox" <?php checked( (bool) $modestbranding, true ); ?> id="<?php echo $this->get_field_id( 'modestbranding' ); ?>" name="<?php echo $this->get_field_name( 'modestbranding' ); ?>" /> <label for="<?php echo $this->get_field_id( 'modestbranding' ); ?>"><?php _e('Hide YT Logo (does not work for all videos)', 'youtube-channel'); ?></label><br />
172
  </p>
173
 
174
  <h4><?php _e('Content Layout', 'youtube-channel'); ?></h4>
195
  <input class="checkbox" type="checkbox" <?php checked( (bool) $userchan, true ); ?> id="<?php echo $this->get_field_id( 'userchan' ); ?>" name="<?php echo $this->get_field_name( 'userchan' ); ?>" /> <label for="<?php echo $this->get_field_id( 'userchan' ); ?>"><?php _e('Link to channel instead to user', 'youtube-channel'); ?></label><br />
196
  </p>
197
 
198
+ <h4><?php _e('Does not work? Contact support!', 'youtube-channel'); ?></h4>
199
+ <p><small><a href="?ytc_debug_json_for=<?php echo $this->id; ?>" target="_blank"><?php _e('Get JSON file', 'youtube-channel'); ?></a> <?php printf(__('and send it to %s or to <a href="%s" target="_support">support forum</a>.', 'youtube-channel'), '<a href="mailto:urke.kg@gmail.com?subject=YTC%20debug%20log%20for%20'.get_home_url().'">urke.kg@gmail.com</a>', 'http://wordpress.org/support/plugin/youtube-channel'); ?></small>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
200
  </p>
201
 
202
  <?php
225
  $instance['descappend'] = strip_tags($new_instance['descappend']);
226
  $instance['videsclen'] = strip_tags($new_instance['videsclen']);
227
  $instance['width'] = strip_tags($new_instance['width']);
228
+ $instance['responsive'] = (isset($new_instance['responsive'])) ? $new_instance['responsive'] : '';
229
 
230
  $instance['to_show'] = strip_tags($new_instance['to_show']);
231
  $instance['autoplay'] = (isset($new_instance['autoplay'])) ? $new_instance['autoplay'] : false;
232
  $instance['autoplay_mute'] = (isset($new_instance['autoplay_mute'])) ? $new_instance['autoplay_mute'] : false;
233
  $instance['norel'] = (isset($new_instance['norel'])) ? $new_instance['norel'] : false;
234
+ $instance['modestbranding']= (isset($new_instance['modestbranding'])) ? $new_instance['modestbranding'] : false;
235
 
236
  $instance['controls'] = (isset($new_instance['controls'])) ? $new_instance['controls'] : false;
237
  $instance['fixnoitem'] = (isset($new_instance['fixnoitem'])) ? $new_instance['fixnoitem'] : false;
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === YouTube Channel ===
2
  Contributors: urkekg
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Q6Q762MQ97XJ6
4
- Tags: youtube, channel, playlist, single, widget, widgets, youtube player, flash player, rss, feed, video, thumbnail, embed, sidebar, chromeless, iframe, html5
5
  Requires at least: 3.9.0
6
- Tested up to: 4.0
7
- Stable tag: 2.4.0.2
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -19,31 +19,23 @@ Simply insert widget to sidebar, set channel name and if you wish leave all othe
19
  If you like this extension and you find it useful, please rate it on the right side.
20
 
21
  = Features =
22
- * Display latest video from YouTube channel, favorites or playlist
23
  * Option to get random video from resources mentioned above
24
- * Set custom widget title
25
- * Enhanced Privacy
26
  * Preferred aspect ratio relative to width (16:9, 16:10 and 4:3)
27
- * Custom width for video embeded object (default is 220px)
28
- * Choose to display video as thumbnail, HTML5 (iframe), HTML5 Asynchronous (iframe2), Flash (object) or chromeless video
29
- * Thumbnail mode is responsive and opens video in lightbox
 
30
  * Custom caching timeout
31
  * Optimized gdata feeds
32
- * Option to enable autoplay video
33
- * Option to hide video controls
34
- * Option to hide video info
35
- * Option to show video title on top of the video
36
- * Option to show video description below video
37
- * Option to hide annotations from video
38
- * Option to use light controls theme
39
- * Set custom text for link to channel
40
- * Option to show link to channel
41
- * Option to use target="_blank" instead of javascript window.open() for chanel link in new tab/window
42
 
43
  = Styling =
44
  You can use `style.css` from theme to style `YouTube Video` widget content.
45
 
46
- * `.youtube_channel` - widget wrapper class
47
  * `.ytc_title` - class of video title abowe thumbnail/video object
48
  * `.ytc_video_container` - class of container for single item
49
  * `.ytc_video_1`, `.ytc_video_2`, ... - class of container for single item with ordering number of item in widget
@@ -53,9 +45,13 @@ You can use `style.css` from theme to style `YouTube Video` widget content.
53
  * `.ytc_description` - class for video description text
54
  * `.ytc_link` - class of container for link to channel
55
 
56
- = Issues =
57
- Controls light theme and hidden annotations does not work for chromeless object.
58
- Video description for videos from playlist does nt work.
 
 
 
 
59
 
60
  If WordFence or other malware scan tool detect YouTube Channel fule youtube-channel.php as potential risk because `base64_encode()` and `base64_decode()` functions, remember that we use this two functions to store and restore JSON feeds to transient cache, so potential detection is false positive.
61
 
@@ -75,9 +71,6 @@ If WordFence or other malware scan tool detect YouTube Channel fule youtube-chan
75
  **Use Playlist**
76
  [youtube http://www.youtube.com/watch?v=y9zoi_Pk2kY]
77
 
78
- **How To Get Debug Info**
79
- [youtube http://www.youtube.com/watch?v=6jIu2OeKB24]
80
-
81
  == Installation ==
82
 
83
  You can use the built in installer and upgrader, or you can install the plugin manually.
@@ -116,13 +109,29 @@ By default, YTC sort videos by publishing date/time, not by uploaded date/time.
116
 
117
  If you have enabled option `Fix No items error/Respect playlist order`, then videos are not sorted by publishing date, but by YouTube default order.
118
 
119
- = When I upload a new video at youtube, it is not in the list at my site =
120
 
121
  Video feed for YTC has been retreived with standard youtube feed [uploads by specified user](https://developers.google.com/youtube/2.0/developers_guide_protocol?hl=en#User_Uploaded_Videos "User Uploaded Videos"), and as Google say: [uploaded videos will be included in a user's public uploaded videos feed a few minutes after the upload completes and YouTube finishes processing the video](https://developers.google.com/youtube/2.0/reference#Latency_Information).
122
 
123
  If you does not see your latest video in your uplaods feed (which you can access at https://gdata.youtube.com/feeds/api/users/YOUR_YT_USERID/uploads by replacing YOUR_YT_USERID with your real youtube user ID), then YTC will not see it too.
124
 
 
 
 
 
 
 
125
  == Changelog ==
 
 
 
 
 
 
 
 
 
 
126
  = 2.4.0.2 (2014-10-02) =
127
  * Fix: light theme not applicable to embedded playlist [2014-10-01]
128
  * Fix: add clearfix after YTC widget to prevent jumping out of widget block on bad styled themes [2014-10-02]
@@ -282,7 +291,7 @@ If you does not see your latest video in your uplaods feed (which you can access
282
 
283
  == Upgrade Notice ==
284
 
285
- Better handling of cached UNICODE content, ReCache tool to force reloading cached feeds.
286
 
287
  == Screenshots ==
288
 
1
  === YouTube Channel ===
2
  Contributors: urkekg
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Q6Q762MQ97XJ6
4
+ Tags: youtube, channel, playlist, single, widget, widgets, youtube player, flash player, rss, feed, video, thumbnail, embed, sidebar, chromeless, iframe, html5, responsive
5
  Requires at least: 3.9.0
6
+ Tested up to: 4.1
7
+ Stable tag: 2.4.1
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
19
  If you like this extension and you find it useful, please rate it on the right side.
20
 
21
  = Features =
22
+ * Display latest videos from YouTube channel, favorites or playlist
23
  * Option to get random video from resources mentioned above
24
+ * Responsive (one full width video per row) or non responsive (video wall)
 
25
  * Preferred aspect ratio relative to width (16:9, 16:10 and 4:3)
26
+ * Custom width for video embeded object (default is 306px)
27
+ * Enhanced Privacy
28
+ * Choose to display video as thumbnail, HTML5 (iframe), HTML5 Asynchronous (iframe2), Flash (object) or Chromeless video
29
+ * Thumbnail mode opens video in lightbox
30
  * Custom caching timeout
31
  * Optimized gdata feeds
32
+ * Optional video autoplay with optional muted audio
33
+ * Show customized link to channel below videos
 
 
 
 
 
 
 
 
34
 
35
  = Styling =
36
  You can use `style.css` from theme to style `YouTube Video` widget content.
37
 
38
+ * `.youtube_channel` - main widget wrapper class (non-responsive block have additional class `default`, responsive block have additional class `responsive`)
39
  * `.ytc_title` - class of video title abowe thumbnail/video object
40
  * `.ytc_video_container` - class of container for single item
41
  * `.ytc_video_1`, `.ytc_video_2`, ... - class of container for single item with ordering number of item in widget
45
  * `.ytc_description` - class for video description text
46
  * `.ytc_link` - class of container for link to channel
47
 
48
+ = Known Issues =
49
+
50
+ * Controls light theme and hidden annotations does not work for chromeless object.
51
+ * Video description for videos from playlist does not work.
52
+ * Removing YouTube logo from playback control bar does not work for all videos
53
+ * Async HTML5 video does not work for 2nd same video on same page (two YTC blocks set to Async HTML5)
54
+ * Chromeless video could not be used as responsive player
55
 
56
  If WordFence or other malware scan tool detect YouTube Channel fule youtube-channel.php as potential risk because `base64_encode()` and `base64_decode()` functions, remember that we use this two functions to store and restore JSON feeds to transient cache, so potential detection is false positive.
57
 
71
  **Use Playlist**
72
  [youtube http://www.youtube.com/watch?v=y9zoi_Pk2kY]
73
 
 
 
 
74
  == Installation ==
75
 
76
  You can use the built in installer and upgrader, or you can install the plugin manually.
109
 
110
  If you have enabled option `Fix No items error/Respect playlist order`, then videos are not sorted by publishing date, but by YouTube default order.
111
 
112
+ = When I upload a new video to youtube, it is not in the list at my site =
113
 
114
  Video feed for YTC has been retreived with standard youtube feed [uploads by specified user](https://developers.google.com/youtube/2.0/developers_guide_protocol?hl=en#User_Uploaded_Videos "User Uploaded Videos"), and as Google say: [uploaded videos will be included in a user's public uploaded videos feed a few minutes after the upload completes and YouTube finishes processing the video](https://developers.google.com/youtube/2.0/reference#Latency_Information).
115
 
116
  If you does not see your latest video in your uplaods feed (which you can access at https://gdata.youtube.com/feeds/api/users/YOUR_YT_USERID/uploads by replacing YOUR_YT_USERID with your real youtube user ID), then YTC will not see it too.
117
 
118
+ = I enabled option `Hide YT Logo` but YouTube logo is still visible =
119
+
120
+ Modestbranding option does not work for all videos, so a lot of videos will still have YouTube logo in control bar. I recommend to enable option `Hide player controls` instead.
121
+
122
+ Also, even when hidding logo works for your video, on hover or when video is paused in upper right corner will be displayed YouTube link/logo. [Read more here](https://developers.google.com/youtube/player_parameters#modestbranding)
123
+
124
  == Changelog ==
125
+ = 2.4.1 (2014-11-15) =
126
+ * Fix: Typo in widget `Do not chache` [2014-10-03]
127
+ * Fix: do not show global settings notice with link to settings page if not Redux Framerowk is active [2014-11-15]
128
+ * Fix: Plugin name on Support tab in global plugin settings. [2014-11-15]
129
+ * Change: Remove protocol from links and leave browser to decide should get resource from HTTP or HTTPS (depends on website protocol) [2014-10-03]
130
+ * Change: Add height addition for `Fix height taken by controls` for embedded playlist and count control above video [2014-10-03]
131
+ * Change: Move debug log from widget to downloadable dynamic JSON [2014-11-15]
132
+ * Add: ModestBranding (remove YouTube logo from player control bar) [2014-10-03]
133
+ * Add: Responsive (make video optionally responsive) [2014-10-04]
134
+
135
  = 2.4.0.2 (2014-10-02) =
136
  * Fix: light theme not applicable to embedded playlist [2014-10-01]
137
  * Fix: add clearfix after YTC widget to prevent jumping out of widget block on bad styled themes [2014-10-02]
291
 
292
  == Upgrade Notice ==
293
 
294
+ Responsive, bug fixes, support for WordPress 4.1
295
 
296
  == Screenshots ==
297
 
youtube-channel.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: YouTube Channel
4
  Plugin URI: http://urosevic.net/wordpress/plugins/youtube-channel/
5
  Description: <a href="widgets.php">Widget</a> that display latest video thumbnail, iframe (HTML5 video), object (Flash video) or chromeless video from YouTube Channel or Playlist.
6
  Author: Aleksandar Urošević
7
- Version: 2.4.0.2
8
  Author URI: http://urosevic.net/
9
  */
10
  // @TODO make FitViedo optional
@@ -17,7 +17,7 @@ if ( !class_exists('WPAU_YOUTUBE_CHANNEL') )
17
  class WPAU_YOUTUBE_CHANNEL
18
  {
19
 
20
- public $plugin_version = "2.4.0.2";
21
  public $plugin_name = "YouTube Channel";
22
  public $plugin_slug = "youtube-channel";
23
  public $plugin_option = "youtube_channel_defaults";
@@ -27,6 +27,11 @@ if ( !class_exists('WPAU_YOUTUBE_CHANNEL') )
27
 
28
  function __construct()
29
  {
 
 
 
 
 
30
  $this->plugin_url = plugin_dir_url(__FILE__);
31
  load_plugin_textdomain( $this->plugin_slug, false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
32
 
@@ -98,10 +103,14 @@ if ( !class_exists('WPAU_YOUTUBE_CHANNEL') )
98
  $msg = sprintf(__('If you use caching for any YTC widget or shortcode, please <strong>ReCache</strong> feeds in <strong>Tools</strong> section of <a href="%s">plugin settings</a> page.', 'youtube-channel'), $settings_page);
99
  break;
100
  case "2.2.3":
101
- $msg = sprintf(__('We switched to <em>Redux Framework</em> so please review global plugin <a href="%s">settings page</a>.', 'youtube-channel'), $settings_page);
 
 
 
 
102
  break;
103
  }
104
- if ( !empty($msg) )
105
  printf(
106
  '<div class="update-nag"><p><strong>%s</strong> ' . __("updated to version", 'youtube-channel') . ' <strong>%s</strong>. '.$msg.'&nbsp;&nbsp;<a href="?ytc_dismiss_update_notice=1" class="button button-secondary">' . __("I did this already, dismiss notice!", 'youtube-channel') . '</a></p></div>',
107
  $this->plugin_name,
@@ -125,37 +134,39 @@ if ( !class_exists('WPAU_YOUTUBE_CHANNEL') )
125
  {
126
 
127
  $init = array(
128
- 'channel' => $this->channel_id,
129
- 'playlist' => $this->playlist_id,
130
- 'use_res' => false,
131
- 'only_pl' => false,
132
- 'cache_time' => 300, // 5 minutes
133
- 'maxrnd' => 25,
134
- 'vidqty' => 1,
135
- 'enhprivacy' => false,
136
- 'fixnoitem' => false,
137
- 'getrnd' => false,
138
- 'ratio' => 3, // 3 - 16:9, 2 - 16:10, 1 - 4:3
139
- 'width' => 306,
140
- 'to_show' => 'thumbnail', // thumbnail, iframe, iframe2, chromeless, object
141
- 'themelight' => false,
142
- 'controls' => false,
143
- 'fixyt' => false,
144
- 'autoplay' => false,
145
- 'autoplay_mute' => false,
146
- 'norel' => false,
 
147
 
148
- 'showtitle' => false,
149
- 'showvidesc' => false,
150
- 'videsclen' => 0,
151
- 'descappend' => '&hellip;',
152
- 'hideanno' => false,
153
- 'hideinfo' => false,
 
154
 
155
- 'goto_txt' => 'Visit our channel',
156
- 'showgoto' => false,
157
- 'popup_goto' => 3, // 3 same window, 2 new window JS, 1 new window target
158
- 'userchan' => false
159
  );
160
  $defaults = get_option($this->plugin_option, $init);
161
 
@@ -250,8 +261,8 @@ if ( !class_exists('WPAU_YOUTUBE_CHANNEL') )
250
  function enqueue_scripts() {
251
  wp_enqueue_style( 'youtube-channel', plugins_url('assets/css/youtube-channel.min.css', __FILE__), array(), $this->plugin_version );
252
 
253
- // enqueue fitVid
254
- // wp_enqueue_script( 'fitvid', plugins_url('assets/js/jquery.fitvids.min.js', __FILE__), array('jquery'), $this->plugin_version, true );
255
 
256
  // enqueue magnific-popup
257
  wp_enqueue_script( 'magnific-popup', plugins_url('assets/lib/magnific-popup/jquery.magnific-popup.min.js', __FILE__), array('jquery'), $this->plugin_version, true );
@@ -263,33 +274,24 @@ if ( !class_exists('WPAU_YOUTUBE_CHANNEL') )
263
  // Print JS only if we have set YTC array
264
  if ( !empty($_SESSION['ytc_html5_js']) )
265
  {
266
- ?>
267
- <!-- YouTube Channel v<?php echo $this->plugin_version; ?> -->
268
- <script type="text/javascript">
269
- var tag = document.createElement('script');
270
- tag.src = "https://www.youtube.com/iframe_api";
271
- var firstScriptTag = document.getElementsByTagName('script')[0];
272
- firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
273
- function onYouTubeIframeAPIReady() {
274
- <?php echo $_SESSION['ytc_html5_js']; ?>
275
- }
276
- function ytc_mute(event){
277
- event.target.mute();
278
- }
279
- </script>
280
- <?php
281
- }
282
- /*
283
- // @TODO sort out fitVid and Async
284
- ?>
285
- <script>
286
- jQuery(document).ready(function($){
287
- $(window).on('load', function() { $(".ytc_video_container").fitVids(); });
288
- });
289
  </script>
290
- <?php
291
- */
292
- } // end fucntion footer_scripts
 
293
 
294
  public function shortcode($atts)
295
  {
@@ -314,6 +316,8 @@ jQuery(document).ready(function($){
314
 
315
  'ratio' => $instance['ratio'],
316
  'width' => $instance['width'],
 
 
317
  'show' => $instance['to_show'],
318
 
319
  'themelight' => $instance['themelight'],
@@ -325,6 +329,7 @@ jQuery(document).ready(function($){
325
 
326
  'showtitle' => $instance['showtitle'],
327
  'showdesc' => $instance['showvidesc'],
 
328
  'desclen' => $instance['videsclen'],
329
  'noinfo' => $instance['hideinfo'],
330
  'noanno' => $instance['hideanno'],
@@ -356,6 +361,7 @@ jQuery(document).ready(function($){
356
  // Video Settings
357
  $instance['ratio'] = $ratio; // aspect ratio: 3 - 16:9, 2 - 16:10, 1 - 4:3
358
  $instance['width'] = $width; // 306
 
359
  $instance['to_show'] = $show; // thumbnail, iframe, iframe2, object, chromeless
360
 
361
  $instance['themelight'] = $themelight; // use light theme, dark by default
@@ -368,6 +374,7 @@ jQuery(document).ready(function($){
368
  // Content Layout
369
  $instance['showtitle'] = $showtitle; // show video title, disabled by default
370
  $instance['showvidesc'] = $showdesc; // show video description, disabled by default
 
371
  $instance['videsclen'] = $desclen; // cut video description, number of characters
372
  $instance['hideinfo'] = $noinfo; // hide info by default
373
  $instance['hideanno'] = $noanno; // hide annotations, false by default
@@ -402,6 +409,8 @@ jQuery(document).ready(function($){
402
 
403
  $class = $instance['class'] ? $instance['class'] : 'default';
404
 
 
 
405
  $output = array();
406
 
407
  $output[] = '<div class="youtube_channel '.$class.'">';
@@ -559,7 +568,7 @@ jQuery(document).ready(function($){
559
 
560
  $output[] = '<div class="ytc_link">';
561
  $userchan = ( $instance['userchan'] ) ? 'channel' : 'user';
562
- $goto_url = 'http://www.youtube.com/'.$userchan.'/'.$channel.'/';
563
  $newtab = __("in new window/tab", 'youtube-channel');
564
  $output[] = '<p>';
565
  switch ( $instance['popup_goto'] ) {
@@ -591,6 +600,7 @@ jQuery(document).ready(function($){
591
  $controls = $instance['controls'];
592
  $norel = $instance['norel'];
593
  $class = $instance['class'];
 
594
 
595
  // set width and height
596
  $width = ( empty($instance['width']) ) ? 306 : $instance['width'];
@@ -614,7 +624,7 @@ jQuery(document).ready(function($){
614
  $yt_id = preg_replace('/^.*=(.*)&.*$/', '${1}', $yt_id);
615
  $yt_url = "v/$yt_id";
616
 
617
- $yt_thumb = "http://img.youtube.com/vi/$yt_id/0.jpg"; // zero for HD thumb
618
  $yt_video = $item->link[0]->href;
619
  $yt_video = preg_replace('/\&.*$/','',$yt_video);
620
 
@@ -663,8 +673,16 @@ jQuery(document).ready(function($){
663
  } else if ( $to_show == "chromeless" ) {
664
  ob_start();
665
  ?>
666
- <object type="application/x-shockwave-flash" data="<?php echo $this->plugin_url . 'chromeless.swf'; ?>" width="<?php echo $width; ?>" height="<?php echo $height; ?>" id="<?php echo $ytc_vid; ?>">
667
- <param name="flashVars" value="video_source=<?php echo $yt_id; ?>&video_width=<?php echo $width; ?>&video_height=<?php echo $height; ?><?php if ( $autoplay ) echo "&autoplay=Yes"; if ( !$controls ) echo "&youtube_controls=Yes"; if ( $hideanno ) echo "&iv_load_policy=3"; if ( $themelight ) echo "&theme=light"; if ( $norel ) echo "&rel=0"; ?>" />
 
 
 
 
 
 
 
 
668
  <param name="quality" value="high" />
669
  <param name="wmode" value="opaque" />
670
  <param name="swfversion" value="6.0.65.0" />
@@ -682,6 +700,7 @@ jQuery(document).ready(function($){
682
  if ( $autoplay ) $output[] = "&amp;autoplay=1";
683
  if ( $hideanno ) $output[] = "&amp;iv_load_policy=3";
684
  if ( $themelight ) $output[] = "&amp;theme=light";
 
685
  // disable related videos
686
  if ( $norel ) $output[] = "&amp;rel=0";
687
 
@@ -696,6 +715,7 @@ jQuery(document).ready(function($){
696
  $js_iv_load_policy = ( $hideanno ) ? "iv_load_policy: 3," : '';
697
  $js_theme = ( $themelight ) ? "theme: 'light'," : '';
698
  $js_autoplay = ( $autoplay ) ? "autoplay: 1," : '';
 
699
  $js_autoplay_mute = ( $autoplay && $autoplay_mute ) ? "events: {'onReady': ytc_mute}" : '';
700
  $js_player_id = str_replace('-', '_', $yt_url);
701
 
@@ -709,7 +729,7 @@ jQuery(document).ready(function($){
709
  videoId: '$yt_url',
710
  enablejsapi: 1,
711
  playerVars: {
712
- $js_autoplay $js_showinfo $js_controls $js_theme $js_rel wmmode: 'opaque'
713
  },
714
  origin: '$site_domain',
715
  $js_iv_load_policy $js_autoplay_mute
@@ -729,6 +749,7 @@ JS;
729
  $obj_url .= ( $autoplay ) ? '&amp;autoplay=1' : '';
730
  $obj_url .= ( $hideanno ) ? '&amp;iv_load_policy=3' : '';
731
  $obj_url .= ( $themelight ) ? '&amp;theme=light' : '';
 
732
  $obj_url .= ( $norel ) ? '&amp;rel=0' : '';
733
  ob_start();
734
  ?>
@@ -795,20 +816,22 @@ JS;
795
 
796
  $height = self::height_ratio($width, $instance['ratio']);
797
 
798
- $height += ($instance['fixyt']) ? 25 : 0;
799
 
800
  $playlist = $this->clean_playlist_id($playlist);
801
 
802
  $autoplay = (empty($instance['autoplay'])) ? '' : '&autoplay=1';
803
 
804
- $theme = (empty($instance['themelight'])) ? '' : '&theme=light' ;
 
 
805
 
806
  $rel = (empty($instance['norel'])) ? '' : '&rel=0';
807
 
808
  // enhanced privacy
809
  $youtube_domain = $this->youtube_domain($instance);
810
  $output[] = '<div class="ytc_video_container ytc_video_1 ytc_video_single">
811
- <iframe src="http://'.$youtube_domain.'/embed/videoseries?list=PL'.$playlist.$autoplay.$theme.$rel.'"
812
  width="'.$width.'" height="'.$height.'" frameborder="0"></iframe></div>';
813
  return $output;
814
  } // end function ytc_only_pl
@@ -891,6 +914,52 @@ JS;
891
  return $playlist;
892
  } // end function clean_playlist_id
893
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
894
  } // end class
895
  } // end class check
896
 
4
  Plugin URI: http://urosevic.net/wordpress/plugins/youtube-channel/
5
  Description: <a href="widgets.php">Widget</a> that display latest video thumbnail, iframe (HTML5 video), object (Flash video) or chromeless video from YouTube Channel or Playlist.
6
  Author: Aleksandar Urošević
7
+ Version: 2.4.1
8
  Author URI: http://urosevic.net/
9
  */
10
  // @TODO make FitViedo optional
17
  class WPAU_YOUTUBE_CHANNEL
18
  {
19
 
20
+ public $plugin_version = "2.4.1";
21
  public $plugin_name = "YouTube Channel";
22
  public $plugin_slug = "youtube-channel";
23
  public $plugin_option = "youtube_channel_defaults";
27
 
28
  function __construct()
29
  {
30
+
31
+ // debug JSON
32
+ if (!empty($_GET['ytc_debug_json_for']))
33
+ $this->generate_debug_json();
34
+
35
  $this->plugin_url = plugin_dir_url(__FILE__);
36
  load_plugin_textdomain( $this->plugin_slug, false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
37
 
103
  $msg = sprintf(__('If you use caching for any YTC widget or shortcode, please <strong>ReCache</strong> feeds in <strong>Tools</strong> section of <a href="%s">plugin settings</a> page.', 'youtube-channel'), $settings_page);
104
  break;
105
  case "2.2.3":
106
+ if (class_exists( "ReduxFramework" )){
107
+ $msg = sprintf(__('We switched to <em>Redux Framework</em> so please review global plugin <a href="%s">settings page</a>.', 'youtube-channel'), $settings_page);
108
+ } else {
109
+ $msg = __('We switched to <em>Redux Framework</em> so please install and activate dependency and then review global YouTube Channel plugin settings.', 'youtube-channel');
110
+ }
111
  break;
112
  }
113
+ if ( !empty($msg) && class_exists( "ReduxFramework" ) )
114
  printf(
115
  '<div class="update-nag"><p><strong>%s</strong> ' . __("updated to version", 'youtube-channel') . ' <strong>%s</strong>. '.$msg.'&nbsp;&nbsp;<a href="?ytc_dismiss_update_notice=1" class="button button-secondary">' . __("I did this already, dismiss notice!", 'youtube-channel') . '</a></p></div>',
116
  $this->plugin_name,
134
  {
135
 
136
  $init = array(
137
+ 'channel' => $this->channel_id,
138
+ 'playlist' => $this->playlist_id,
139
+ 'use_res' => false,
140
+ 'only_pl' => false,
141
+ 'cache_time' => 300, // 5 minutes
142
+ 'maxrnd' => 25,
143
+ 'vidqty' => 1,
144
+ 'enhprivacy' => false,
145
+ 'fixnoitem' => false,
146
+ 'getrnd' => false,
147
+ 'ratio' => 3, // 3 - 16:9, 2 - 16:10, 1 - 4:3
148
+ 'width' => 306,
149
+ 'responsive' => true,
150
+ 'to_show' => 'thumbnail', // thumbnail, iframe, iframe2, chromeless, object
151
+ 'themelight' => false,
152
+ 'controls' => false,
153
+ 'fixyt' => false,
154
+ 'autoplay' => false,
155
+ 'autoplay_mute' => false,
156
+ 'norel' => false,
157
 
158
+ 'showtitle' => false,
159
+ 'showvidesc' => false,
160
+ 'videsclen' => 0,
161
+ 'descappend' => '&hellip;',
162
+ 'modestbranding' => false,
163
+ 'hideanno' => false,
164
+ 'hideinfo' => false,
165
 
166
+ 'goto_txt' => 'Visit our channel',
167
+ 'showgoto' => false,
168
+ 'popup_goto' => 3, // 3 same window, 2 new window JS, 1 new window target
169
+ 'userchan' => false
170
  );
171
  $defaults = get_option($this->plugin_option, $init);
172
 
261
  function enqueue_scripts() {
262
  wp_enqueue_style( 'youtube-channel', plugins_url('assets/css/youtube-channel.min.css', __FILE__), array(), $this->plugin_version );
263
 
264
+ // enqueue fitVids
265
+ wp_enqueue_script( 'fitvids', plugins_url('assets/js/jquery.fitvids.min.js', __FILE__), array('jquery'), $this->plugin_version, true );
266
 
267
  // enqueue magnific-popup
268
  wp_enqueue_script( 'magnific-popup', plugins_url('assets/lib/magnific-popup/jquery.magnific-popup.min.js', __FILE__), array('jquery'), $this->plugin_version, true );
274
  // Print JS only if we have set YTC array
275
  if ( !empty($_SESSION['ytc_html5_js']) )
276
  {
277
+ ?>
278
+ <!-- YouTube Channel v<?php echo $this->plugin_version; ?> -->
279
+ <script type="text/javascript">
280
+ var tag = document.createElement('script');
281
+ tag.src = "//www.youtube.com/iframe_api";
282
+ var firstScriptTag = document.getElementsByTagName('script')[0];
283
+ firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
284
+ function onYouTubeIframeAPIReady() {
285
+ <?php echo $_SESSION['ytc_html5_js']; ?>
286
+ }
287
+ function ytc_mute(event){
288
+ event.target.mute();
289
+ }
 
 
 
 
 
 
 
 
 
 
290
  </script>
291
+ <?php
292
+ }
293
+
294
+ } // eof footer_scripts
295
 
296
  public function shortcode($atts)
297
  {
316
 
317
  'ratio' => $instance['ratio'],
318
  'width' => $instance['width'],
319
+ 'responsive' => (!empty($instance['responsive'])) ? $instance['responsive'] : '0',
320
+
321
  'show' => $instance['to_show'],
322
 
323
  'themelight' => $instance['themelight'],
329
 
330
  'showtitle' => $instance['showtitle'],
331
  'showdesc' => $instance['showvidesc'],
332
+ 'nobrand' => (!empty($instance['modestbranding'])) ? $instance['modestbranding'] : '0',
333
  'desclen' => $instance['videsclen'],
334
  'noinfo' => $instance['hideinfo'],
335
  'noanno' => $instance['hideanno'],
361
  // Video Settings
362
  $instance['ratio'] = $ratio; // aspect ratio: 3 - 16:9, 2 - 16:10, 1 - 4:3
363
  $instance['width'] = $width; // 306
364
+ $instance['responsive'] = $responsive; // enable responsivenes?
365
  $instance['to_show'] = $show; // thumbnail, iframe, iframe2, object, chromeless
366
 
367
  $instance['themelight'] = $themelight; // use light theme, dark by default
374
  // Content Layout
375
  $instance['showtitle'] = $showtitle; // show video title, disabled by default
376
  $instance['showvidesc'] = $showdesc; // show video description, disabled by default
377
+ $instance['modestbranding']= $nobrand; // hide YT logo
378
  $instance['videsclen'] = $desclen; // cut video description, number of characters
379
  $instance['hideinfo'] = $noinfo; // hide info by default
380
  $instance['hideanno'] = $noanno; // hide annotations, false by default
409
 
410
  $class = $instance['class'] ? $instance['class'] : 'default';
411
 
412
+ if ( !empty($instance['responsive']) ) $class .= ' responsive';
413
+
414
  $output = array();
415
 
416
  $output[] = '<div class="youtube_channel '.$class.'">';
568
 
569
  $output[] = '<div class="ytc_link">';
570
  $userchan = ( $instance['userchan'] ) ? 'channel' : 'user';
571
+ $goto_url = '//www.youtube.com/'.$userchan.'/'.$channel.'/';
572
  $newtab = __("in new window/tab", 'youtube-channel');
573
  $output[] = '<p>';
574
  switch ( $instance['popup_goto'] ) {
600
  $controls = $instance['controls'];
601
  $norel = $instance['norel'];
602
  $class = $instance['class'];
603
+ $modestbranding = $instance['modestbranding'];
604
 
605
  // set width and height
606
  $width = ( empty($instance['width']) ) ? 306 : $instance['width'];
624
  $yt_id = preg_replace('/^.*=(.*)&.*$/', '${1}', $yt_id);
625
  $yt_url = "v/$yt_id";
626
 
627
+ $yt_thumb = "//img.youtube.com/vi/$yt_id/0.jpg"; // zero for HD thumb
628
  $yt_video = $item->link[0]->href;
629
  $yt_video = preg_replace('/\&.*$/','',$yt_video);
630
 
673
  } else if ( $to_show == "chromeless" ) {
674
  ob_start();
675
  ?>
676
+ <object type="application/x-shockwave-flash" data="<?php echo $this->plugin_url . 'inc/chromeless.swf'; ?>" width="<?php echo $width; ?>" height="<?php echo $height; ?>" id="<?php echo $ytc_vid; ?>">
677
+ <param name="flashVars" value="video_source=<?php echo $yt_id; ?>&video_width=<?php echo $width; ?>&video_height=<?php
678
+ echo $height;
679
+ if ( $autoplay ) echo "&autoplay=Yes";
680
+ if ( !$controls ) echo "&youtube_controls=Yes";
681
+ if ( $hideanno ) echo "&iv_load_policy=3";
682
+ if ( $themelight ) echo "&theme=light";
683
+ if ( $modestbranding ) echo "&modestbranding=1";
684
+ if ( $norel ) echo "&rel=0";
685
+ ?>" />
686
  <param name="quality" value="high" />
687
  <param name="wmode" value="opaque" />
688
  <param name="swfversion" value="6.0.65.0" />
700
  if ( $autoplay ) $output[] = "&amp;autoplay=1";
701
  if ( $hideanno ) $output[] = "&amp;iv_load_policy=3";
702
  if ( $themelight ) $output[] = "&amp;theme=light";
703
+ if ( $modestbranding ) $output[] = "&amp;modestbranding=1";
704
  // disable related videos
705
  if ( $norel ) $output[] = "&amp;rel=0";
706
 
715
  $js_iv_load_policy = ( $hideanno ) ? "iv_load_policy: 3," : '';
716
  $js_theme = ( $themelight ) ? "theme: 'light'," : '';
717
  $js_autoplay = ( $autoplay ) ? "autoplay: 1," : '';
718
+ $js_modestbranding = ( $modestbranding ) ? "modestbranding: 1," : '';
719
  $js_autoplay_mute = ( $autoplay && $autoplay_mute ) ? "events: {'onReady': ytc_mute}" : '';
720
  $js_player_id = str_replace('-', '_', $yt_url);
721
 
729
  videoId: '$yt_url',
730
  enablejsapi: 1,
731
  playerVars: {
732
+ $js_autoplay $js_showinfo $js_controls $js_theme $js_rel $js_modestbranding wmmode: 'opaque'
733
  },
734
  origin: '$site_domain',
735
  $js_iv_load_policy $js_autoplay_mute
749
  $obj_url .= ( $autoplay ) ? '&amp;autoplay=1' : '';
750
  $obj_url .= ( $hideanno ) ? '&amp;iv_load_policy=3' : '';
751
  $obj_url .= ( $themelight ) ? '&amp;theme=light' : '';
752
+ $obj_url .= ( $modestbranding ) ? '&amp;modestbranding=1' : '';
753
  $obj_url .= ( $norel ) ? '&amp;rel=0' : '';
754
  ob_start();
755
  ?>
816
 
817
  $height = self::height_ratio($width, $instance['ratio']);
818
 
819
+ $height += ($instance['fixyt']) ? 54 : 0;
820
 
821
  $playlist = $this->clean_playlist_id($playlist);
822
 
823
  $autoplay = (empty($instance['autoplay'])) ? '' : '&autoplay=1';
824
 
825
+ $theme = (empty($instance['themelight'])) ? '' : '&theme=light';
826
+
827
+ $modestbranding = (empty($instance['modestbranding'])) ? '' : '&modestbranding=1';
828
 
829
  $rel = (empty($instance['norel'])) ? '' : '&rel=0';
830
 
831
  // enhanced privacy
832
  $youtube_domain = $this->youtube_domain($instance);
833
  $output[] = '<div class="ytc_video_container ytc_video_1 ytc_video_single">
834
+ <iframe src="//'.$youtube_domain.'/embed/videoseries?list=PL'.$playlist.$autoplay.$theme.$modestbranding.$rel.'"
835
  width="'.$width.'" height="'.$height.'" frameborder="0"></iframe></div>';
836
  return $output;
837
  } // end function ytc_only_pl
914
  return $playlist;
915
  } // end function clean_playlist_id
916
 
917
+ function generate_debug_json()
918
+ {
919
+ global $wp_version;
920
+
921
+ // get Redux Framework version (if active)
922
+ $redux = ( class_exists( "ReduxFramework" ) ) ? ReduxFramework::$_version : 'N/A';
923
+
924
+ // get widget ID from parameter
925
+ $for = $_GET['ytc_debug_json_for'];
926
+
927
+ // prepare option name and widget ID
928
+ $option_name = "widget_".substr($for,0,strrpos($for,"-"));
929
+ $widget_id = substr($for,strrpos($for,"-")+1);
930
+
931
+ // get YTC widgets options
932
+ $widget_options = get_option($option_name);
933
+
934
+ if (!is_array($widget_options[$widget_id]))
935
+ return;
936
+
937
+ // prepare debug data with settings of current widget
938
+ $data = array_merge(
939
+ array(
940
+ 'date' => date("r"),
941
+ 'server' => $_SERVER["SERVER_SOFTWARE"],
942
+ 'php' => PHP_VERSION,
943
+ 'wp' => $wp_version,
944
+ 'ytc' => $this->plugin_version,
945
+ 'redux' => $redux,
946
+ 'url' => get_site_url(),
947
+ 'widget_id' => $for
948
+ ),
949
+ $widget_options[$widget_id]
950
+ );
951
+
952
+ // return JSON file
953
+ header('Content-disposition: attachment; filename='.$for.'.json');
954
+ header('Content-Type: application/json');
955
+ echo json_encode($data);
956
+
957
+ // destroy vars
958
+ unset($data,$widget_options,$widget_id,$option_name,$for,$redux);
959
+
960
+ // exit now, because we need only debug data in JSON file, not settings or any other page
961
+ exit;
962
+ }
963
  } // end class
964
  } // end class check
965