WP YouTube Lyte - Version 0.6.2

Version Description

  • bugfix: the javascript in widgets.php caused a wp youtube lyte widget not to be shown in the sidebar if no wp youtube lyte was present in the main content
  • load jquery plugins in admin screen using wp_enqueue_script rather then adding them "manually"
  • store the selected feed on the admin-page in a cookie to show the same feed next time
Download this release

Release Info

Developer futtta
Plugin Icon 128x128 WP YouTube Lyte
Version 0.6.2
Comparing to
See all releases

Code changes from version 0.6.1 to 0.6.2

Files changed (5) hide show
  1. external/jquery.cookie.min.js +0 -2
  2. options.php +27 -10
  3. readme.txt +7 -2
  4. widget.php +3 -1
  5. wp-youtube-lyte.php +2 -2
external/jquery.cookie.min.js CHANGED
@@ -1,3 +1 @@
1
- alert("cookie loaded");
2
-
3
  jQuery.cookie=function(key,value,options){if(arguments.length>1&&(value===null||typeof value!=="object")){options=jQuery.extend({},options);if(value===null){options.expires=-1;}if(typeof options.expires==='number'){var days=options.expires,t=options.expires=new Date();t.setDate(t.getDate()+days);}return(document.cookie=[encodeURIComponent(key),'=',options.raw?String(value):encodeURIComponent(String(value)),options.expires?'; expires='+options.expires.toUTCString():'',options.path?'; path='+options.path:'',options.domain?'; domain='+options.domain:'',options.secure?'; secure':''].join(''));}options=value||{};var result,decode=options.raw?function(s){return s;}:decodeURIComponent;return(result=new RegExp('(?:^|; )'+encodeURIComponent(key)+'=([^;]*)').exec(document.cookie))?decode(result[1]):null;};
 
 
1
  jQuery.cookie=function(key,value,options){if(arguments.length>1&&(value===null||typeof value!=="object")){options=jQuery.extend({},options);if(value===null){options.expires=-1;}if(typeof options.expires==='number'){var days=options.expires,t=options.expires=new Date();t.setDate(t.getDate()+days);}return(document.cookie=[encodeURIComponent(key),'=',options.raw?String(value):encodeURIComponent(String(value)),options.expires?'; expires='+options.expires.toUTCString():'',options.path?'; path='+options.path:'',options.domain?'; domain='+options.domain:'',options.secure?'; secure':''].join(''));}options=value||{};var result,decode=options.raw?function(s){return s;}:decodeURIComponent;return(result=new RegExp('(?:^|; )'+encodeURIComponent(key)+'=([^;]*)').exec(document.cookie))?decode(result[1]):null;};
options.php CHANGED
@@ -1,9 +1,13 @@
1
  <?php
 
 
2
  add_action('admin_menu', 'lyte_create_menu');
3
 
4
  function lyte_create_menu() {
5
  add_options_page( 'WP YouTube Lyte settings', 'WP YouTube Lyte', 'manage_options', __FILE__, 'lyte_settings_page');
6
  add_action( 'admin_init', 'register_lyte_settings' );
 
 
7
  }
8
 
9
  function register_lyte_settings() {
@@ -12,6 +16,17 @@ function register_lyte_settings() {
12
  register_setting( 'lyte-settings-group', 'size' );
13
  }
14
 
 
 
 
 
 
 
 
 
 
 
 
15
  function lyte_settings_page() {
16
  ?>
17
  <div class="wrap">
@@ -84,27 +99,29 @@ function lyte_settings_page() {
84
  </div>
85
  </div>
86
 
87
- <?php $wp_lyte_plugin_url = defined('WP_PLUGIN_URL') ? trailingslashit(WP_PLUGIN_URL . '/' . dirname(plugin_basename(__FILE__))) : trailingslashit(get_bloginfo('wpurl')) . PLUGINDIR . '/' . dirname(plugin_basename(__FILE__)); ?>
88
- <script src="<?php echo $wp_lyte_plugin_url; ?>external/jquery.zrssfeed.min.js" type="text/javascript"></script>
89
- <link rel="stylesheet" href="<?php echo $wp_lyte_plugin_url; ?>external/jquery.zrssfeed.css" />
90
-
91
  <script type="text/javascript">
92
- $feed = new Array;
93
- $feed[1]="http://feeds.feedburner.com/futtta_wp-youtube-lyte";
94
- $feed[2]="http://feeds.feedburner.com/futtta_wordpress";
95
- $feed[3]="http://feeds.feedburner.com/futtta_webtech";
 
96
 
97
  jQuery(document).ready(function() {
98
- show_feed(1);
 
 
99
  jQuery("#feed_dropdown").change(function() { show_feed(jQuery("#feed_dropdown").val()) });
100
  })
101
 
102
  function show_feed(id) {
103
- jQuery('#futtta_feed').rssfeed($feed[id], {
104
  limit: 4,
105
  date: true,
106
  header: false
107
  });
 
 
 
108
  }
109
  </script>
110
 
1
  <?php
2
+ $wp_lyte_plugin_url = defined('WP_PLUGIN_URL') ? trailingslashit(WP_PLUGIN_URL . '/' . dirname(plugin_basename(__FILE__))) : trailingslashit(get_bloginfo('wpurl')) . PLUGINDIR . '/' . dirname(plugin_basename(__FILE__));
3
+
4
  add_action('admin_menu', 'lyte_create_menu');
5
 
6
  function lyte_create_menu() {
7
  add_options_page( 'WP YouTube Lyte settings', 'WP YouTube Lyte', 'manage_options', __FILE__, 'lyte_settings_page');
8
  add_action( 'admin_init', 'register_lyte_settings' );
9
+ add_action( 'admin_print_scripts', 'lyte_admin_scripts' );
10
+ add_action( 'admin_print_styles', 'lyte_admin_styles' );
11
  }
12
 
13
  function register_lyte_settings() {
16
  register_setting( 'lyte-settings-group', 'size' );
17
  }
18
 
19
+ function lyte_admin_scripts() {
20
+ global $wp_lyte_plugin_url;
21
+ wp_enqueue_script('zrssfeed',$wp_lyte_plugin_url.'external/jquery.zrssfeed.min.js',array(jquery),null,true);
22
+ wp_enqueue_script('cookie',$wp_lyte_plugin_url.'external/jquery.cookie.min.js',array(jquery),null,true);
23
+ }
24
+
25
+ function lyte_admin_styles() {
26
+ global $wp_lyte_plugin_url;
27
+ wp_enqueue_style('zrssfeed',$wp_lyte_plugin_url.'external/jquery.zrssfeed.css');
28
+ }
29
+
30
  function lyte_settings_page() {
31
  ?>
32
  <div class="wrap">
99
  </div>
100
  </div>
101
 
 
 
 
 
102
  <script type="text/javascript">
103
+ var feed = new Array;
104
+ feed[1]="http://feeds.feedburner.com/futtta_wp-youtube-lyte";
105
+ feed[2]="http://feeds.feedburner.com/futtta_wordpress";
106
+ feed[3]="http://feeds.feedburner.com/futtta_webtech";
107
+ cookie="wp-youtube-lyte_feed";
108
 
109
  jQuery(document).ready(function() {
110
+ feedid=jQuery.cookie(cookie);
111
+ if(typeof(feedid) !== "string") feedid=1;
112
+ show_feed(feedid);
113
  jQuery("#feed_dropdown").change(function() { show_feed(jQuery("#feed_dropdown").val()) });
114
  })
115
 
116
  function show_feed(id) {
117
+ jQuery('#futtta_feed').rssfeed(feed[id], {
118
  limit: 4,
119
  date: true,
120
  header: false
121
  });
122
+ jQuery.cookie(cookie,id,{ expires: 365 });
123
+ jQuery("#feed_dropdown").val(id);
124
+ //alert(jQuery.cookie(cookie));
125
  }
126
  </script>
127
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: futtta
3
  Tags: youtube, video, lyte, lite youtube embeds, html5 video, html5
4
  Requires at least: 2.9
5
  Tested up to: 3.0.1
6
- Stable tag: 0.6.1
7
 
8
  "Lite YouTube Embeds" look like normal YouTube embeds but don't use Flash, thus reducing download size & page rendering time.
9
 
@@ -49,10 +49,15 @@ HTML5 video will not be visible for everyone (see requirements), some visitors w
49
  * [Rate my plugin on wordpress.org](http://wordpress.org/extend/plugins/wp-youtube-lyte/), even if you think it stinks ;-)
50
 
51
  == Changelog ==
 
 
 
 
 
52
  = 0.6.1 =
53
  * widget size can now be set (3 sizes available, to be specified for each widget individually)
54
  * admin-page now contains links to most recent info (blogposts) on WP YouTube Lyte (and optionally WordPress and Web Technology in general) using [the excellent jQuery-plugin zrssfeed](http://www.zazar.net/developers/zrssfeed/)
55
- * bugfix: removed CDATA-wrapper from javascript as WordPress turned ]]> into ]]&lt; which broke the html (which in turn broke syndication in planets)
56
 
57
  = 0.6.0 =
58
  * There now is a WP-YouTube-Lyte widget which you can add to your sidebar (see under "Appearance"->"Widgets"), as requested by the fabulous [fruityoaty](http://fruityoaty.com/)
3
  Tags: youtube, video, lyte, lite youtube embeds, html5 video, html5
4
  Requires at least: 2.9
5
  Tested up to: 3.0.1
6
+ Stable tag: 0.6.2
7
 
8
  "Lite YouTube Embeds" look like normal YouTube embeds but don't use Flash, thus reducing download size & page rendering time.
9
 
49
  * [Rate my plugin on wordpress.org](http://wordpress.org/extend/plugins/wp-youtube-lyte/), even if you think it stinks ;-)
50
 
51
  == Changelog ==
52
+ = 0.6.2 =
53
+ * bugfix: the javascript in widgets.php caused a wp youtube lyte widget not to be shown in the sidebar if no wp youtube lyte was present in the main content
54
+ * load jquery plugins in admin screen using wp_enqueue_script rather then adding them "manually"
55
+ * store the selected feed on the admin-page in a cookie to show the same feed next time
56
+
57
  = 0.6.1 =
58
  * widget size can now be set (3 sizes available, to be specified for each widget individually)
59
  * admin-page now contains links to most recent info (blogposts) on WP YouTube Lyte (and optionally WordPress and Web Technology in general) using [the excellent jQuery-plugin zrssfeed](http://www.zazar.net/developers/zrssfeed/)
60
+ * bugfix: removed CDATA-wrapper from javascript as WordPress turned ]]> into ]]&amp;gt; which broke the html (which in turn broke syndication in e.g. planets)
61
 
62
  = 0.6.0 =
63
  * There now is a WP-YouTube-Lyte widget which you can add to your sidebar (see under "Appearance"->"Widgets"), as requested by the fabulous [fruityoaty](http://fruityoaty.com/)
widget.php CHANGED
@@ -29,7 +29,9 @@ class WYLWidget extends WP_Widget {
29
  ?>
30
  <?php echo $before_widget; ?>
31
  <?php if ( $WYLtitle ) echo $before_title . $WYLtitle . $after_title; ?>
32
- <div class="lyte widget" id="<?php echo $WYLid; ?>" style="width:<?php echo $wSize[$WYLsize]['w']; ?>px;height:<?php echo $wSize[$WYLsize]['h']; ?>px;"><noscript><a href="http://youtu.be/<?php echo $WYLid;?>"><img src="http://img.youtube.com/vi/<?php echo $WYLid; ?>/default.jpg"></a></noscript><script type="text/javascript"><!--\n var bU='<?php echo $lyteSettings[0];?>';var d=document;if(d.addEventListener){d.addEventListener('DOMContentLoaded', insert, false)}else{window.onload=insert} function insert(){if(!d.getElementById('lytescr')){lytescr=d.createElement('script');lytescr.async=true;lytescr.id='lytescr';lytescr.src='<?php echo $lyteSettings[0].$lyteSettings[1];?>';h=d.getElementsByTagName('script')[0];h.parentNode.insertBefore(lytescr, h)}};/n--></script></div>
 
 
33
  <div><?php echo $WYLtext ?></div>
34
  <?php echo $after_widget; ?>
35
  <?php
29
  ?>
30
  <?php echo $before_widget; ?>
31
  <?php if ( $WYLtitle ) echo $before_title . $WYLtitle . $after_title; ?>
32
+ <div class="lyte widget" id="<?php echo $WYLid; ?>" style="width:<?php echo $wSize[$WYLsize]['w']; ?>px;height:<?php echo $wSize[$WYLsize]['h']; ?>px;"><noscript><a href="http://youtu.be/<?php echo $WYLid;?>"><img src="http://img.youtube.com/vi/<?php echo $WYLid; ?>/default.jpg"></a></noscript><script type="text/javascript"><!--
33
+ var bU='<?php echo $lyteSettings[0];?>';var d=document;if(d.addEventListener){d.addEventListener('DOMContentLoaded', insert, false)}else{window.onload=insert} function insert(){if(!d.getElementById('lytescr')){lytescr=d.createElement('script');lytescr.async=true;lytescr.id='lytescr';lytescr.src='<?php echo $lyteSettings[0].$lyteSettings[1];?>';h=d.getElementsByTagName('script')[0];h.parentNode.insertBefore(lytescr, h)}};
34
+ --></script></div>
35
  <div><?php echo $WYLtext ?></div>
36
  <?php echo $after_widget; ?>
37
  <?php
wp-youtube-lyte.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: WP YouTube Lyte
4
  Plugin URI: http://blog.futtta.be/tag/lyte
5
  Description: WordPress Lite YouTube Embeds (with optional HTML5 video) in posts.
6
  Author: Frank Goossens (futtta)
7
- Version: 0.6.1
8
  Author URI: http://blog.futtta.be/
9
  */
10
 
@@ -51,7 +51,7 @@ function lyte_parse($the_content) {
51
  $noscript_post="";
52
  $lytelinks_txt="<div class=\"lL\">Watch this video <a href=\"http://youtu.be/".$match[3]."\">on YouTube</a>.</div>";
53
  }
54
- $lytetemplate = "<div class=\"lyte\" id=\"".$match[3]."\" style=\"width:".$lyteSettings[2]."px;height:".$lyteSettings[3]."px;\"><noscript><a href=\"http://youtu.be/".$match[3]."\"><img src=\"http://img.youtube.com/vi/".$match[3]."/0.jpg\">".$noscript_post."</a></noscript><script type=\"text/javascript\"><!--\n var bU='".$lyteSettings[0]."';var d=document;if(d.addEventListener){d.addEventListener('DOMContentLoaded', insert, false)}else{window.onload=insert} function insert(){if(!d.getElementById('lytescr')){lytescr=d.createElement('script');lytescr.async=true;lytescr.id='lytescr';lytescr.src='".$lyteSettings[0].$lyteSettings[1]."';h=d.getElementsByTagName('script')[0];h.parentNode.insertBefore(lytescr, h)}};\n--></script></div>".$lytelinks_txt;
55
  $the_content = preg_replace("/httpv:\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/)([a-zA-Z0-9\-\_]{11})([^\s<]*)/", $lytetemplate, $the_content, 1);
56
  }
57
  }
4
  Plugin URI: http://blog.futtta.be/tag/lyte
5
  Description: WordPress Lite YouTube Embeds (with optional HTML5 video) in posts.
6
  Author: Frank Goossens (futtta)
7
+ Version: 0.6.2
8
  Author URI: http://blog.futtta.be/
9
  */
10
 
51
  $noscript_post="";
52
  $lytelinks_txt="<div class=\"lL\">Watch this video <a href=\"http://youtu.be/".$match[3]."\">on YouTube</a>.</div>";
53
  }
54
+ $lytetemplate = "<div class=\"lyte\" id=\"".$match[3]."\" style=\"width:".$lyteSettings[2]."px;height:".$lyteSettings[3]."px;\"><noscript><a href=\"http://youtu.be/".$match[3]."\"><img src=\"http://img.youtube.com/vi/".$match[3]."/0.jpg\">".$noscript_post."</a></noscript><script type=\"text/javascript\"><!-- \n var bU='".$lyteSettings[0]."';var d=document;if(d.addEventListener){d.addEventListener('DOMContentLoaded', insert, false)}else{window.onload=insert} function insert(){if(!d.getElementById('lytescr')){lytescr=d.createElement('script');lytescr.async=true;lytescr.id='lytescr';lytescr.src='".$lyteSettings[0].$lyteSettings[1]."';h=d.getElementsByTagName('script')[0];h.parentNode.insertBefore(lytescr, h)}}; \n --></script></div>".$lytelinks_txt;
55
  $the_content = preg_replace("/httpv:\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/)([a-zA-Z0-9\-\_]{11})([^\s<]*)/", $lytetemplate, $the_content, 1);
56
  }
57
  }