Version Description
Download this release
Release Info
Developer | futtta |
Plugin | WP YouTube Lyte |
Version | 0.2 |
Comparing to | |
See all releases |
Code changes from version 0.1.4 to 0.2
- options.php +39 -0
- readme.txt +17 -16
- wp-youtube-lyte.php +18 -7
options.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_mysettings' );
|
7 |
+
}
|
8 |
+
|
9 |
+
function register_mysettings() {
|
10 |
+
register_setting( 'lyte-settings-group', 'show_links' );
|
11 |
+
}
|
12 |
+
|
13 |
+
function lyte_settings_page() {
|
14 |
+
?>
|
15 |
+
<div class="wrap">
|
16 |
+
<h2>WP YouTube Lyte Settings</h2>
|
17 |
+
|
18 |
+
<form method="post" action="options.php">
|
19 |
+
<?php settings_fields( 'lyte-settings-group' ); ?>
|
20 |
+
<table class="form-table">
|
21 |
+
<tr valign="top">
|
22 |
+
<th scope="row">Show links below the embedded videos?</th>
|
23 |
+
<td>
|
24 |
+
<input type="radio" name="show_links" value="1" <?php if (get_option('show_links')==="1") echo "checked" ?> /> Add YouTube-link.
|
25 |
+
<br />
|
26 |
+
<input type="radio" name="show_links" value="2" <?php if (get_option('show_links')==="2") echo "checked" ?> /> Add both a YouTube and a <a href="http://icant.co.uk/easy-youtube/docs/index.html" target="_blank">Easy YouTube</a>-link.
|
27 |
+
<br />
|
28 |
+
<input type="radio" name="show_links" value="0" <?php if ((get_option('show_links')!=="1") && (get_option('show_links')!=="2")) echo "checked" ?> /> Don't add any links.
|
29 |
+
</td>
|
30 |
+
</tr>
|
31 |
+
</table>
|
32 |
+
|
33 |
+
<p class="submit">
|
34 |
+
<input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
|
35 |
+
</p>
|
36 |
+
|
37 |
+
</form>
|
38 |
+
</div>
|
39 |
+
<?php } ?>
|
readme.txt
CHANGED
@@ -3,9 +3,9 @@ Contributors: futtta
|
|
3 |
Tags: youtube, video, lyte, lite youtube embeds
|
4 |
Requires at least: 2.9
|
5 |
Tested up to: 2.9.2
|
6 |
-
Stable tag: 0.
|
7 |
|
8 |
-
|
9 |
|
10 |
== Description ==
|
11 |
|
@@ -24,23 +24,24 @@ Installation is very straightforward:
|
|
24 |
3. Place a link to a YouTube clip like this; httpv://www.youtube.com/watch?v=_SQkWbRublY
|
25 |
|
26 |
== Frequently Asked Questions ==
|
27 |
-
= What features
|
28 |
-
|
29 |
-
|
30 |
-
* the default size of your video (now: 480X385)
|
31 |
-
* wheither or not to show link to the YouTube and/or Accessible YouTube video (both are shown now)
|
32 |
|
33 |
= But I would like yet other features to be added! =
|
34 |
-
|
35 |
Just ask, I'll see what I can do.
|
36 |
|
37 |
== Changelog ==
|
38 |
|
39 |
-
= 0.
|
40 |
-
*
|
|
|
41 |
|
42 |
-
= 0.1.
|
43 |
-
*
|
|
|
|
|
|
|
44 |
|
45 |
= 0.1.2 =
|
46 |
Accessibility enhancements (hat tip: Ricky Buchanan):
|
@@ -49,8 +50,8 @@ Accessibility enhancements (hat tip: Ricky Buchanan):
|
|
49 |
* moved youtube link from noscript to div
|
50 |
* added link to easy youtube
|
51 |
|
52 |
-
= 0.1.
|
53 |
-
*
|
54 |
|
55 |
-
= 0.1
|
56 |
-
*
|
3 |
Tags: youtube, video, lyte, lite youtube embeds
|
4 |
Requires at least: 2.9
|
5 |
Tested up to: 2.9.2
|
6 |
+
Stable tag: 0.2.0
|
7 |
|
8 |
+
"Lite YouTube Embeds" look like normal YouTube embeds but don't use Flash unless clicked, thus reducing download size & page rendering time.
|
9 |
|
10 |
== Description ==
|
11 |
|
24 |
3. Place a link to a YouTube clip like this; httpv://www.youtube.com/watch?v=_SQkWbRublY
|
25 |
|
26 |
== Frequently Asked Questions ==
|
27 |
+
= What features might be added at a later stage? =
|
28 |
+
* Extra options in the admin-page, e.g. the default size of your video (now: 480X385)
|
29 |
+
* Having the video title link to the YouTube-page
|
|
|
|
|
30 |
|
31 |
= But I would like yet other features to be added! =
|
|
|
32 |
Just ask, I'll see what I can do.
|
33 |
|
34 |
== Changelog ==
|
35 |
|
36 |
+
= 0.2.0 =
|
37 |
+
* Added a simple admin-page to allow administrators to choose if links to YouTube and Easy YouTube are added or not
|
38 |
+
* Added some bottom-margin to the lytelinks div
|
39 |
|
40 |
+
= 0.1.4 =
|
41 |
+
* forgot to update version in the php-file for 0.1.3, causing the update not being fully propageted
|
42 |
+
|
43 |
+
= 0.1.3 =
|
44 |
+
* small bugfix release (opacity of the play-button in Chrome/Safari)
|
45 |
|
46 |
= 0.1.2 =
|
47 |
Accessibility enhancements (hat tip: Ricky Buchanan):
|
50 |
* moved youtube link from noscript to div
|
51 |
* added link to easy youtube
|
52 |
|
53 |
+
= 0.1.1 =
|
54 |
+
* Changed meta-info in readme and php-file
|
55 |
|
56 |
+
= 0.1 =
|
57 |
+
* Initial version
|
wp-youtube-lyte.php
CHANGED
@@ -1,28 +1,39 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: WP YouTube Lyte
|
4 |
-
Plugin URI: http://blog.futtta.be/
|
5 |
Description: WordPress Lite YouTube Embeds (look ma, even faster!) in posts.
|
6 |
Author: Frank (futtta) Goossens
|
7 |
-
Version: 0.
|
8 |
Author URI: http://blog.futtta.be/
|
9 |
*/
|
|
|
10 |
|
11 |
$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__));
|
|
|
12 |
$lyteUrl=$wp_lyte_plugin_url."lyte/";
|
13 |
|
14 |
-
|
15 |
-
|
|
|
|
|
16 |
if(strpos($the_content, "httpv")!==FALSE ) {
|
17 |
$char_codes = array('×','–');
|
18 |
$replacements = array("x", "--");
|
19 |
$the_content=str_replace($char_codes, $replacements, $the_content);
|
20 |
|
21 |
preg_match_all("/httpv:\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/)([a-zA-Z0-9\-\_]{11})([^<\s]*)/", $the_content, $matches, PREG_SET_ORDER);
|
22 |
-
foreach($matches as $match) {
|
23 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
}
|
25 |
-
|
26 |
}
|
27 |
return $the_content;
|
28 |
}
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: WP YouTube Lyte
|
4 |
+
Plugin URI: http://blog.futtta.be/tag/lyte
|
5 |
Description: WordPress Lite YouTube Embeds (look ma, even faster!) in posts.
|
6 |
Author: Frank (futtta) Goossens
|
7 |
+
Version: 0.2.0
|
8 |
Author URI: http://blog.futtta.be/
|
9 |
*/
|
10 |
+
require(dirname(__FILE__).'/options.php');
|
11 |
|
12 |
$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__));
|
13 |
+
|
14 |
$lyteUrl=$wp_lyte_plugin_url."lyte/";
|
15 |
|
16 |
+
$show_links=get_option('show_links');
|
17 |
+
|
18 |
+
function lyte_parse($the_content) {
|
19 |
+
global $lyteUrl, $show_links;
|
20 |
if(strpos($the_content, "httpv")!==FALSE ) {
|
21 |
$char_codes = array('×','–');
|
22 |
$replacements = array("x", "--");
|
23 |
$the_content=str_replace($char_codes, $replacements, $the_content);
|
24 |
|
25 |
preg_match_all("/httpv:\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/)([a-zA-Z0-9\-\_]{11})([^<\s]*)/", $the_content, $matches, PREG_SET_ORDER);
|
26 |
+
foreach($matches as $match) {
|
27 |
+
$lytetemplate="<div class=\"lyte\" id=\"".$match[3]."\" style=\"width:480;height:385;\"><noscript><a href=\"http://youtu.be/".$match[3]."\">Watch on YouTube</a> or on <a href=\"http://icant.co.uk/easy-youtube/?http://www.youtube.com/watch?v=".$match[3]."\">Easy Youtube</a></noscript><script>var bU='".$lyteUrl."';(function(){d=document;if(!document.getElementById('lytescr')){lyte=d.createElement('script');lyte.async=true;lyte.id='lytescr';lyte.src='".$lyteUrl."lyte-min.js';d.getElementsByTagName('head')[0].appendChild(lyte)}})();</script></div>";
|
28 |
+
switch ($show_links) {
|
29 |
+
case "1":
|
30 |
+
$lytetemplate .= "<div id=\"lytelinks\" style=\"margin:0px 0px 10px 0px;\">Or watch this video <a href=\"http://youtu.be/".$match[3]."\">on YouTube</a>.</div>";
|
31 |
+
break;
|
32 |
+
case "2":
|
33 |
+
$lytetemplate .= "<div id=\"lytelinks\" style=\"margin:0px 0px 10px 0px;\">Or watch this video <a href=\"http://youtu.be/".$match[3]."\">on YouTube</a> or on <a href=\"http://icant.co.uk/easy-youtube/?http://www.youtube.com/watch?v=".$match[3]."\">Easy Youtube</a>.</div>";
|
34 |
+
}
|
35 |
+
$the_content = preg_replace("/httpv:\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/)([a-zA-Z0-9\-\_]{11})([^\s<]*)/", $lytetemplate, $the_content, 1);
|
36 |
}
|
|
|
37 |
}
|
38 |
return $the_content;
|
39 |
}
|