Version Description
Download this release
Release Info
Developer | embedplus |
Plugin | YouTube |
Version | 2.0 |
Comparing to | |
See all releases |
Version 2.0
- images/clickdashboard.png +0 -0
- images/epstats16.png +0 -0
- images/ownline.jpg +0 -0
- images/youtubeicon.png +0 -0
- images/youtubeicon16.png +0 -0
- images/youtubeicon16off.png +0 -0
- readme.txt +87 -0
- screenshot-1.jpg +0 -0
- screenshot-2.jpg +0 -0
- scripts/ytprefs.min.js +1 -0
- youtube.php +570 -0
images/clickdashboard.png
ADDED
Binary file
|
images/epstats16.png
ADDED
Binary file
|
images/ownline.jpg
ADDED
Binary file
|
images/youtubeicon.png
ADDED
Binary file
|
images/youtubeicon16.png
ADDED
Binary file
|
images/youtubeicon16off.png
ADDED
Binary file
|
readme.txt
ADDED
@@ -0,0 +1,87 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
=== YouTube ===
|
2 |
+
Contributors: embedplus
|
3 |
+
Plugin Name: YouTube Embed
|
4 |
+
Tags: seo, video analytics, basic analytics, google, google analytics, view count, vlog, vlogging, web videos, youtube analytics, youtube, youtube, youtube plugin, youtube shortcode, embed youtube, plugin, video, video shortcode, embed videos, plugin, youtube player, shortcode, simple, simple youtube, smart youtube playback, youtube embed, wordpress youtube embed, embedding youtube, youtube embedding, video plugin
|
5 |
+
Requires at least: 2.9
|
6 |
+
Tested up to: 3.5.1
|
7 |
+
Stable tag: 2.0
|
8 |
+
License: GPLv3 or later
|
9 |
+
|
10 |
+
YouTube embed plugin with basic features and convenient defaults. Upgrade now to add view tracking and access to your very own analytics dashboard.
|
11 |
+
|
12 |
+
== Description ==
|
13 |
+
|
14 |
+
This YouTube embed plugin for WordPress is very simple. It provides the basic features of the YouTube embedded player, and will have you posting videos in seconds after installing it. Version 2.0 and after adds view tracking to each embed so that you can gain access to your very own YouTube analytics dashboard. Upgrade if you'd like the feature and get answers to questions like:
|
15 |
+
|
16 |
+
* How much are your visitors actually watching the videos you post?
|
17 |
+
* How does the view activity on your site compare to other sites like it?
|
18 |
+
* What and when are your best and worst performers?
|
19 |
+
* How much do the producers of the YouTube videos you embed rely on **your site** for views?
|
20 |
+
|
21 |
+
If you want to explore a more advanced plugin, we suggest looking at another one like: [Advanced YouTube Embed](http://wordpress.org/extend/plugins/embedplus-for-wordpress/) by [EmbedPlus](http://www.embedplus.com).
|
22 |
+
|
23 |
+
To start using this plugin, simply paste a YouTube link on its own line. You can also make default settings for all your YouTube videos under the YouTube admin menu. You can make additional YouTube embed customizations by adding more to the link as shown below:
|
24 |
+
|
25 |
+
* width - Sets the width of your player. If omitted, the default width will be the width of your theme's content. Example: `http://www.youtube.com/watch?v=quwebVjAEJA&width=500&height=350`
|
26 |
+
* height - Sets the height of your player. If omitted, this will be calculated for you automatically. Example: `http://www.youtube.com/watch?v=quwebVjAEJA&width=500&height=350`
|
27 |
+
* autoplay - Set this to 1 to autoplay the video (or 0 to play the video once). Example: `http://www.youtube.com/watch?v=quwebVjAEJA&autoplay=1`
|
28 |
+
* cc_load_policy - Set this to 1 to turn on closed captioning (or 0 to leave them off). Example: `http://www.youtube.com/watch?v=quwebVjAEJA&cc_load_policy=1`
|
29 |
+
* iv_load_policy - Set this to 3 to turn off annotations (or 1 to show them). Example: `http://www.youtube.com/watch?v=quwebVjAEJA&iv_load_policy=3`
|
30 |
+
* loop - Set this to 1 to loop the video (or 0 to not loop). Example: `http://www.youtube.com/watch?v=quwebVjAEJA&loop=1`
|
31 |
+
* modestbranding - Set this to 1 to remove the YouTube logo while playing (or 0 to show the logo). Example: `http://www.youtube.com/watch?v=quwebVjAEJA&modestbranding=1`
|
32 |
+
* rel - Set this to 0 to not show related videos at the end of playing (or 1 to show them). Example: `http://www.youtube.com/watch?v=quwebVjAEJA&rel=0`
|
33 |
+
* showinfo - Set this to 0 to hide the video title and other info (or 1 to show it). Example: `http://www.youtube.com/watch?v=quwebVjAEJA&showinfo=0`
|
34 |
+
* theme - Set this to 'light' to make the player have the light-colored theme (or 'dark' for the dark theme). Example: `http://www.youtube.com/watch?v=quwebVjAEJA&theme=light`
|
35 |
+
|
36 |
+
== Installation ==
|
37 |
+
|
38 |
+
1. Use the WordPress plugin installer to install the plugin. Alternatively, you can just extract the folder in our download package and upload it to your plugin directory.
|
39 |
+
1. Access the Plugins admin menu to activate the YouTube embed plugin.
|
40 |
+
1. Make your default settings after clicking the new YouTube menu item that shows up in your admin panel.
|
41 |
+
1. In your editor, start pasting the links with any desired additional codes needed for your YouTube embed. Make sure the link is on its own line.
|
42 |
+
1. To get an analytics dashboard, [sign up for one of the options here >>](https://www.embedplus.com/dashboard/wordpress-video-analytics-seo.aspx)
|
43 |
+
|
44 |
+
Additional codes (adding these will override the default settings in the admin):
|
45 |
+
|
46 |
+
* width - Sets the width of your player. If omitted, the default width will be the width of your theme's content. Example: `http://www.youtube.com/watch?v=quwebVjAEJA&width=500&height=350`
|
47 |
+
* height - Sets the height of your player. If omitted, this will be calculated for you automatically. Example: `http://www.youtube.com/watch?v=quwebVjAEJA&width=500&height=350`
|
48 |
+
* autoplay - Set this to 1 to autoplay the video (or 0 to play the video once). Example: `http://www.youtube.com/watch?v=quwebVjAEJA&autoplay=1`
|
49 |
+
* cc_load_policy - Set this to 1 to turn on closed captioning (or 0 to leave them off). Example: `http://www.youtube.com/watch?v=quwebVjAEJA&cc_load_policy=1`
|
50 |
+
* iv_load_policy - Set this to 3 to turn off annotations (or 1 to show them). Example: `http://www.youtube.com/watch?v=quwebVjAEJA&iv_load_policy=3`
|
51 |
+
* loop - Set this to 1 to loop the video (or 0 to not loop). Example: `http://www.youtube.com/watch?v=quwebVjAEJA&loop=1`
|
52 |
+
* modestbranding - Set this to 1 to remove the YouTube logo while playing (or 0 to show the logo). Example: `http://www.youtube.com/watch?v=quwebVjAEJA&modestbranding=1`
|
53 |
+
* rel - Set this to 0 to not show related videos at the end of playing (or 1 to show them). Example: `http://www.youtube.com/watch?v=quwebVjAEJA&rel=0`
|
54 |
+
* showinfo - Set this to 0 to hide the video title and other info (or 1 to show it). Example: `http://www.youtube.com/watch?v=quwebVjAEJA&showinfo=0`
|
55 |
+
* theme - Set this to 'light' to make the player have the light-colored theme (or 'dark' for the dark theme). Example: `http://www.youtube.com/watch?v=quwebVjAEJA&theme=light`
|
56 |
+
|
57 |
+
= Contact =
|
58 |
+
|
59 |
+
Please use the Support forum until we put up a site for this plugin.
|
60 |
+
|
61 |
+
== Screenshots ==
|
62 |
+
|
63 |
+
1. YouTube Embed Screenshot 1: Paste a YouTube link on its own line and it will become a YouTube embed on your website.
|
64 |
+
2. YouTube Embed Screenshot 2: YouTube's admin settings.
|
65 |
+
|
66 |
+
== Changelog ==
|
67 |
+
|
68 |
+
= YouTube Embed 2.0 =
|
69 |
+
|
70 |
+
This upgrade specifically integrates a user-friendly YouTube Analytics Dashboard to this plugin so you can learn a lot more about the videos you post. Download it if you would like it to use your site's YouTube-related activity to help answer questions like:
|
71 |
+
|
72 |
+
* How much are your visitors actually watching the videos you post?
|
73 |
+
* How does the view activity on your site compare to other sites like it?
|
74 |
+
* What and when are your best and worst performers?
|
75 |
+
* How much do the producers of the YouTube videos you embed rely on **your site** for views?
|
76 |
+
|
77 |
+
We think these are all interesting questions; however, note that there's no need to upgrade if you don't.
|
78 |
+
|
79 |
+
= YouTube Embed 1.1 =
|
80 |
+
Fixed minor bug.
|
81 |
+
|
82 |
+
= YouTube Embed 1.0 =
|
83 |
+
First release uploaded to the plugin repository.
|
84 |
+
|
85 |
+
== Other Notes ==
|
86 |
+
|
87 |
+
Again, note that this is a no-frills plugin. We're just supporting the basic functions that people typically want when embedding YouTube videos. This includes [YouTube embed analytics](https://www.embedplus.com/dashboard/wordpress-video-analytics-seo.aspx) to help you learn a lot about the videos you post. If you want more, take a look at a more powerful plugin here: [Advanced YouTube Embed]( http://wordpress.org/extend/plugins/embedplus-for-wordpress/) by [EmbedPlus](http://www.embedplus.com).
|
screenshot-1.jpg
ADDED
Binary file
|
screenshot-2.jpg
ADDED
Binary file
|
scripts/ytprefs.min.js
ADDED
@@ -0,0 +1 @@
|
|
Â
|
1 |
+
function onYouTubeIframeAPIReady(){var e=document.querySelectorAll("iframe.__youtube_prefs__");for(var t=0;t<e.length;t++){new YT.Player(e[t].id,{events:{onReady:onPlayerReady,onStateChange:onPlayerStateChange}})}}function onPlayerReady(e){setTimeout(function(){var t=epytgetjustid(e.target.getVideoUrl());epytjp("ytid="+t)},4e3)}function onPlayerStateChange(e){var t=e.target.getIframe();if(e.data==1&&e.target.ponce!==true&&t.src.indexOf("autoplay=1")==-1){e.target.ponce=true;var n=epytgetjustid(e.target.getVideoUrl());epytjp("ytid="+n+"&p=1")}}function epytgetjustid(e){return(new RegExp("[\\?&]v=([^&#]*)")).exec(e)[1]}function epytjp(e){var t=document.createElement("script");t.src="//www.embedplus.com/test-page.aspx?es=w&u="+encodeURIComponent(window.location.href.split("#")[0])+e+(navigator.userAgent.toLowerCase().indexOf("chrome")>-1?"&b=c&":"&b=&");var n=document.getElementsByTagName("head")[0].appendChild(t);setTimeout(function(){n.parentNode.removeChild(n)},500)}(function(){var e=document.createElement("script");e.src="//www.youtube.com/iframe_api";e.type="text/javascript";document.getElementsByTagName("head")[0].appendChild(e)})();if(!document.querySelectorAll){document.querySelectorAll=function(e){var t=document,n=t.documentElement.firstChild,r=t.createElement("STYLE");n.appendChild(r);t.__qsaels=[];r.styleSheet.cssText=e+"{x:expression(document.__qsaels.push(this))}";window.scrollBy(0,0);return t.__qsaels}}
|
youtube.php
ADDED
@@ -0,0 +1,570 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
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
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: YouTube Embed
|
4 |
+
Plugin URI: http://www.embedplus.com
|
5 |
+
Description: YouTube embed plugin with basic features and convenient defaults. Upgrade now to add view tracking and access to your very own analytics dashboard.
|
6 |
+
Version: 2.0
|
7 |
+
Author: EmbedPlus Team
|
8 |
+
Author URI: http://www.embedplus.com
|
9 |
+
*/
|
10 |
+
|
11 |
+
/*
|
12 |
+
YouTube Embed
|
13 |
+
Copyright (C) 2013 EmbedPlus.com
|
14 |
+
|
15 |
+
This program is free software: you can redistribute it and/or modify
|
16 |
+
it under the terms of the GNU General Public License as published by
|
17 |
+
the Free Software Foundation, either version 3 of the License, or
|
18 |
+
(at your option) any later version.
|
19 |
+
|
20 |
+
This program is distributed in the hope that it will be useful,
|
21 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
22 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
23 |
+
GNU General Public License for more details.
|
24 |
+
|
25 |
+
You should have received a copy of the GNU General Public License
|
26 |
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
27 |
+
|
28 |
+
*/
|
29 |
+
|
30 |
+
//define('WP_DEBUG', true);
|
31 |
+
|
32 |
+
class YouTubePrefs
|
33 |
+
{
|
34 |
+
public static $version = '2.0';
|
35 |
+
public static $opt_version = 'version';
|
36 |
+
public static $optembedwidth = null;
|
37 |
+
public static $optembedheight = null;
|
38 |
+
public static $defaultheight = null;
|
39 |
+
public static $defaultwidth = null;
|
40 |
+
public static $opt_center = 'centervid';
|
41 |
+
public static $opt_auto_hd = 'auto_hd';
|
42 |
+
public static $opt_autoplay = 'autoplay';
|
43 |
+
public static $opt_cc_load_policy = 'cc_load_policy';
|
44 |
+
public static $opt_iv_load_policy = 'iv_load_policy';
|
45 |
+
public static $opt_loop = 'loop';
|
46 |
+
public static $opt_modestbranding = 'modestbranding';
|
47 |
+
public static $opt_rel = 'rel';
|
48 |
+
public static $opt_showinfo = 'showinfo';
|
49 |
+
public static $opt_theme = 'theme';
|
50 |
+
public static $opt_alloptions = 'youtubeprefs_alloptions';
|
51 |
+
public static $alloptions = null;
|
52 |
+
public static $yt_options = array();
|
53 |
+
|
54 |
+
/*
|
55 |
+
color
|
56 |
+
controls
|
57 |
+
disablekb
|
58 |
+
enablejsapi
|
59 |
+
list
|
60 |
+
listType
|
61 |
+
playlist
|
62 |
+
*
|
63 |
+
*/
|
64 |
+
public static $ytregex = '@^\s*https?://(?:www\.)?(?:youtube.com/watch\?|youtu.be/)([^\s"]+)\s*$@im';
|
65 |
+
|
66 |
+
public function __construct()
|
67 |
+
{
|
68 |
+
$do_autoembeds = get_option('embed_autourls');
|
69 |
+
if ($do_autoembeds == 0)
|
70 |
+
{
|
71 |
+
update_option('embed_autourls', 1);
|
72 |
+
}
|
73 |
+
|
74 |
+
self::$alloptions = get_option(self::$opt_alloptions);
|
75 |
+
if (self::$alloptions == false || version_compare(self::$alloptions[self::$opt_version], self::$version, '<'))
|
76 |
+
{
|
77 |
+
self::initoptions();
|
78 |
+
}
|
79 |
+
self::$optembedwidth = intval(get_option('embed_size_w'));
|
80 |
+
self::$optembedheight = intval(get_option('embed_size_h'));
|
81 |
+
|
82 |
+
self::$yt_options = array(
|
83 |
+
self::$opt_autoplay,
|
84 |
+
self::$opt_cc_load_policy,
|
85 |
+
self::$opt_iv_load_policy,
|
86 |
+
self::$opt_loop,
|
87 |
+
self::$opt_modestbranding,
|
88 |
+
self::$opt_rel,
|
89 |
+
self::$opt_showinfo,
|
90 |
+
self::$opt_theme
|
91 |
+
);
|
92 |
+
|
93 |
+
self::do_ytprefs();
|
94 |
+
|
95 |
+
if (self::wp_above_version('2.9'))
|
96 |
+
{
|
97 |
+
add_action('admin_menu', 'YouTubePrefs::ytprefs_plugin_menu');
|
98 |
+
}
|
99 |
+
// if (!is_admin())
|
100 |
+
// {
|
101 |
+
// // allow shortcode in widgets
|
102 |
+
// //add_filter('widget_text', 'do_shortcode', 11);
|
103 |
+
// }
|
104 |
+
}
|
105 |
+
|
106 |
+
static function initoptions()
|
107 |
+
{
|
108 |
+
if (self::wp_above_version('2.9'))
|
109 |
+
{
|
110 |
+
if (get_option(self::$opt_alloptions) === false)
|
111 |
+
{
|
112 |
+
$_auto_hd = get_option('youtubeprefs_auto_hd', 0);
|
113 |
+
$_autoplay = get_option('youtubeprefs_autoplay', 0);
|
114 |
+
$_cc_load_policy = get_option('youtubeprefs_cc_load_policy', 0);
|
115 |
+
$_iv_load_policy = get_option('youtubeprefs_iv_load_policy', 1);
|
116 |
+
$_loop = get_option('youtubeprefs_loop', 0);
|
117 |
+
$_modestbranding = get_option('youtubeprefs_modestbranding', 0);
|
118 |
+
$_rel = get_option('youtubeprefs_rel', 1);
|
119 |
+
$_showinfo = get_option('youtubeprefs_showinfo', 1);
|
120 |
+
$_theme = get_option('youtubeprefs_theme', 'dark');
|
121 |
+
|
122 |
+
$all = array(
|
123 |
+
self::$opt_version => self::$version,
|
124 |
+
self::$opt_center => 0,
|
125 |
+
self::$opt_auto_hd => $_auto_hd,
|
126 |
+
self::$opt_autoplay => $_autoplay,
|
127 |
+
self::$opt_cc_load_policy => $_cc_load_policy,
|
128 |
+
self::$opt_iv_load_policy => $_iv_load_policy,
|
129 |
+
self::$opt_loop => $_loop,
|
130 |
+
self::$opt_modestbranding => $_modestbranding,
|
131 |
+
self::$opt_rel => $_rel,
|
132 |
+
self::$opt_showinfo => $_showinfo,
|
133 |
+
self::$opt_theme => $_theme
|
134 |
+
);
|
135 |
+
|
136 |
+
add_option(self::$opt_alloptions, $all);
|
137 |
+
|
138 |
+
// add_option(self::$opt_auto_hd, 0);
|
139 |
+
// add_option(self::$opt_autoplay, 0);
|
140 |
+
// add_option(self::$opt_cc_load_policy, 0);
|
141 |
+
// add_option(self::$opt_iv_load_policy, 1);
|
142 |
+
// add_option(self::$opt_loop, 0);
|
143 |
+
// add_option(self::$opt_modestbranding, 0);
|
144 |
+
// add_option(self::$opt_rel, 1);
|
145 |
+
// add_option(self::$opt_showinfo, 1);
|
146 |
+
// add_option(self::$opt_theme, 'dark');
|
147 |
+
|
148 |
+
update_option('embed_autourls', 1);
|
149 |
+
}
|
150 |
+
self::$alloptions = get_option(self::$opt_alloptions);
|
151 |
+
}
|
152 |
+
}
|
153 |
+
|
154 |
+
public static function wp_above_version($ver)
|
155 |
+
{
|
156 |
+
global $wp_version;
|
157 |
+
if (version_compare($wp_version, $ver, '>='))
|
158 |
+
{
|
159 |
+
return true;
|
160 |
+
}
|
161 |
+
return false;
|
162 |
+
}
|
163 |
+
|
164 |
+
public static function do_ytprefs()
|
165 |
+
{
|
166 |
+
if (self::wp_above_version('2.9') && !is_admin())
|
167 |
+
{
|
168 |
+
add_filter('the_content', 'YouTubePrefs::apply_prefs', 1);
|
169 |
+
}
|
170 |
+
}
|
171 |
+
|
172 |
+
public static function apply_prefs($content)
|
173 |
+
{
|
174 |
+
$content = preg_replace_callback(self::$ytregex, "YouTubePrefs::get_html", $content);
|
175 |
+
return $content;
|
176 |
+
}
|
177 |
+
|
178 |
+
public static function get_html($m)
|
179 |
+
{
|
180 |
+
$link = trim(preg_replace('/&/i', '&', $m[0]));
|
181 |
+
$link = preg_replace('/\s/', '', $link);
|
182 |
+
$linkparams = explode('?', $link);
|
183 |
+
$linkparams = self::keyvalue($linkparams[1], true);
|
184 |
+
self::init_dimensions($link, $linkparams);
|
185 |
+
|
186 |
+
$linkscheme = parse_url($link, PHP_URL_SCHEME);
|
187 |
+
|
188 |
+
$code1 = '<iframe id="_ytid_' . rand(10000, 99999) . '" width="' . self::$defaultwidth . '" height="' . self::$defaultheight .
|
189 |
+
'" src="' . $linkscheme . '://www.youtube.com/embed/' . $linkparams['v'] . '?';
|
190 |
+
$code2 = '" frameborder="0" allowfullscreen type="text/html" class="__youtube_prefs__"></iframe>';
|
191 |
+
|
192 |
+
/*
|
193 |
+
$prefparams = array();
|
194 |
+
|
195 |
+
//get_option(self::$opt_auto_hd, 0);
|
196 |
+
$autoplay = get_option(self::$opt_autoplay, 0);
|
197 |
+
$cc_load_policy = get_option(self::$opt_cc_load_policy, 0) == 1 ? 1 : '';
|
198 |
+
$iv_load_policy = get_option(self::$opt_iv_load_policy, 1);
|
199 |
+
$loop = get_option(self::$opt_loop, 0);
|
200 |
+
$modestbranding = get_option(self::$opt_modestbranding, 0) == 1 ? 1 : '';
|
201 |
+
$rel = get_option(self::$opt_rel, 1);
|
202 |
+
$showinfo = get_option(self::$opt_showinfo, 1);
|
203 |
+
$theme = get_option(self::$opt_theme, 'dark');
|
204 |
+
|
205 |
+
if ($autoplay == 1)
|
206 |
+
$prefparams['autoplay'] = 1;
|
207 |
+
if ($cc_load_policy == 1)
|
208 |
+
$prefparams['cc_load_policy'] = 1;
|
209 |
+
if ($iv_load_policy == 3)
|
210 |
+
$prefparams['iv_load_policy'] = 3;
|
211 |
+
if ($loop == 1)
|
212 |
+
$prefparams['loop'] = 1;
|
213 |
+
if ($modestbranding == 1)
|
214 |
+
$prefparams['modestbranding'] = 1;
|
215 |
+
if ($rel == 0)
|
216 |
+
$prefparams['rel'] = 0;
|
217 |
+
if ($showinfo == 0)
|
218 |
+
$prefparams['showinfo'] = 0;
|
219 |
+
if ($theme == 'light')
|
220 |
+
$prefparams['theme'] = 'light';
|
221 |
+
*/
|
222 |
+
|
223 |
+
$finalparams = $linkparams + self::$alloptions;
|
224 |
+
$origin = '';
|
225 |
+
|
226 |
+
try
|
227 |
+
{
|
228 |
+
if (!empty($_SERVER["HTTP_HOST"]))
|
229 |
+
{
|
230 |
+
$origin = 'origin=' .
|
231 |
+
((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? 'https://' : 'http://') . $_SERVER["HTTP_HOST"] . '&';
|
232 |
+
}
|
233 |
+
}
|
234 |
+
catch (Exception $e)
|
235 |
+
{
|
236 |
+
|
237 |
+
}
|
238 |
+
$finalsrc = 'enablejsapi=1&' . $origin;
|
239 |
+
|
240 |
+
if (count($finalparams) > 1)
|
241 |
+
{
|
242 |
+
foreach ($finalparams as $key => $value)
|
243 |
+
{
|
244 |
+
if (in_array($key, self::$yt_options))
|
245 |
+
{
|
246 |
+
$finalsrc .= htmlspecialchars($key) . '=' . htmlspecialchars($value) . '&';
|
247 |
+
if ($key == 'loop' && $value == 1)
|
248 |
+
$finalsrc .= 'playlist=' . $finalparams['v'] . '&';
|
249 |
+
}
|
250 |
+
}
|
251 |
+
}
|
252 |
+
|
253 |
+
$code = $code1 . $finalsrc . $code2;
|
254 |
+
|
255 |
+
if (self::$alloptions[self::$opt_center] == 1)
|
256 |
+
{
|
257 |
+
$code = '<div style="text-align: center; display: block;">' . $code . '</div>';
|
258 |
+
}
|
259 |
+
|
260 |
+
// reset static vals for next embed
|
261 |
+
self::$defaultheight = null;
|
262 |
+
self::$defaultwidth = null;
|
263 |
+
|
264 |
+
return $code;
|
265 |
+
}
|
266 |
+
|
267 |
+
public static function keyvalue($qry, $includev)
|
268 |
+
{
|
269 |
+
$ytvars = explode('&', $qry);
|
270 |
+
$ytkvp = array();
|
271 |
+
foreach ($ytvars as $k => $v)
|
272 |
+
{
|
273 |
+
$kvp = explode('=', $v);
|
274 |
+
if (count($kvp) == 2 && ($includev || strtolower($kvp[0]) != 'v'))
|
275 |
+
{
|
276 |
+
$ytkvp[$kvp[0]] = $kvp[1];
|
277 |
+
}
|
278 |
+
}
|
279 |
+
|
280 |
+
return $ytkvp;
|
281 |
+
}
|
282 |
+
|
283 |
+
public static function init_dimensions($url, $urlkvp)
|
284 |
+
{
|
285 |
+
// get default dimensions; try embed size in settings, then try theme's content width, then just 480px
|
286 |
+
if (self::$defaultwidth == null)
|
287 |
+
{
|
288 |
+
global $content_width;
|
289 |
+
if (empty($content_width))
|
290 |
+
$content_width = $GLOBALS['content_width'];
|
291 |
+
|
292 |
+
self::$defaultwidth = $urlkvp['width'] ? $urlkvp['width'] : (self::$optembedwidth ? self::$optembedwidth : ($content_width ? $content_width : 480));
|
293 |
+
self::$defaultheight = self::get_aspect_height($url);
|
294 |
+
}
|
295 |
+
}
|
296 |
+
|
297 |
+
public static function get_aspect_height($url)
|
298 |
+
{
|
299 |
+
|
300 |
+
// attempt to get aspect ratio correct height from oEmbed
|
301 |
+
$aspectheight = round((self::$defaultwidth * 9) / 16, 0);
|
302 |
+
if ($url)
|
303 |
+
{
|
304 |
+
require_once( ABSPATH . WPINC . '/class-oembed.php' );
|
305 |
+
$oembed = _wp_oembed_get_object();
|
306 |
+
$args = array();
|
307 |
+
$args['width'] = self::$defaultwidth;
|
308 |
+
$args['height'] = self::$optembedheight;
|
309 |
+
$args['discover'] = false;
|
310 |
+
$odata = $oembed->fetch('http://www.youtube.com/oembed', $url, $args);
|
311 |
+
|
312 |
+
if ($odata)
|
313 |
+
{
|
314 |
+
$aspectheight = $odata->height;
|
315 |
+
}
|
316 |
+
}
|
317 |
+
|
318 |
+
//add 30 for YouTube's own bar
|
319 |
+
return $aspectheight + 30;
|
320 |
+
}
|
321 |
+
|
322 |
+
public static function ytprefs_plugin_menu()
|
323 |
+
{
|
324 |
+
add_menu_page('YouTube Settings', 'YouTube', 'manage_options', 'youtube-my-preferences', 'YouTubePrefs::ytprefs_show_options', plugins_url('images/youtubeicon16.png', __FILE__), '10.00392854349');
|
325 |
+
add_menu_page('YouTube Analytics Dashboard', 'My YouTube Performance', 'manage_options', 'youtube-ep-analytics-dashboard', 'YouTubePrefs::epstats_show_options', plugins_url('images/epstats16.png', __FILE__), '10.00492884349');
|
326 |
+
}
|
327 |
+
|
328 |
+
public static function epstats_show_options()
|
329 |
+
{
|
330 |
+
|
331 |
+
if (!current_user_can('manage_options'))
|
332 |
+
{
|
333 |
+
wp_die(__('You do not have sufficient permissions to access this page.'));
|
334 |
+
}
|
335 |
+
|
336 |
+
// Now display the settings editing screen
|
337 |
+
?>
|
338 |
+
<div class="wrap">
|
339 |
+
<?php
|
340 |
+
// header
|
341 |
+
|
342 |
+
echo "<h2>" . '<img src="' . plugins_url('images/epstats16.png', __FILE__) . '" /> ' . __('YouTube Analytics Dashboard') . "</h2>";
|
343 |
+
|
344 |
+
// settings form
|
345 |
+
?>
|
346 |
+
<style type="text/css">
|
347 |
+
.epicon { width: 20px; height: 20px; vertical-align: middle; padding-right: 5px;}
|
348 |
+
.epindent {padding-left: 25px;}
|
349 |
+
</style>
|
350 |
+
<br>
|
351 |
+
<iframe style="-webkit-box-shadow: 0px 0px 20px 0px #000000; box-shadow: 0px 0px 20px 0px #000000;" src="https://www.embedplus.com/dashboard/wordpress-video-analytics-seo.aspx?domain=<?php echo (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ""); ?>" width="1030" height="1600" scrolling="auto"/>
|
352 |
+
</div>
|
353 |
+
<?php
|
354 |
+
}
|
355 |
+
|
356 |
+
public static function ytprefs_show_options()
|
357 |
+
{
|
358 |
+
|
359 |
+
if (!current_user_can('manage_options'))
|
360 |
+
{
|
361 |
+
wp_die(__('You do not have sufficient permissions to access this page.'));
|
362 |
+
}
|
363 |
+
|
364 |
+
// variables for the field and option names
|
365 |
+
$ytprefs_submitted = 'ytprefs_submitted';
|
366 |
+
|
367 |
+
// Read in existing option values from database
|
368 |
+
/*
|
369 |
+
$auto_hd = get_option(self::$opt_auto_hd);
|
370 |
+
$autoplay = get_option(self::$opt_autoplay, 0);
|
371 |
+
$cc_load_policy = get_option(self::$opt_cc_load_policy, 0);
|
372 |
+
$iv_load_policy = get_option(self::$opt_iv_load_policy, 1);
|
373 |
+
$loop = get_option(self::$opt_loop, 0);
|
374 |
+
$modestbranding = get_option(self::$opt_modestbranding, 0);
|
375 |
+
$rel = get_option(self::$opt_rel, 1);
|
376 |
+
$showinfo = get_option(self::$opt_showinfo, 1);
|
377 |
+
$theme = get_option(self::$opt_theme, 'dark');
|
378 |
+
*/
|
379 |
+
|
380 |
+
$all = get_option(self::$opt_alloptions);
|
381 |
+
|
382 |
+
// See if the user has posted us some information
|
383 |
+
// If they did, this hidden field will be set to 'Y'
|
384 |
+
if (isset($_POST[$ytprefs_submitted]) && $_POST[$ytprefs_submitted] == 'Y')
|
385 |
+
{
|
386 |
+
// Read their posted values
|
387 |
+
// $auto_hd = $_POST[self::$opt_auto_hd] == (true || 'on') ? 1 : 0;
|
388 |
+
// $autoplay = $_POST[self::$opt_autoplay] == (true || 'on') ? 1 : 0;
|
389 |
+
// $cc_load_policy = $_POST[self::$opt_cc_load_policy] == (true || 'on') ? 1 : 0;
|
390 |
+
// $iv_load_policy = $_POST[self::$opt_iv_load_policy] == (true || 'on') ? 1 : 3;
|
391 |
+
// $loop = $_POST[self::$opt_loop] == (true || 'on') ? 1 : 0;
|
392 |
+
// $modestbranding = $_POST[self::$opt_modestbranding] == (true || 'on') ? 1 : 0;
|
393 |
+
// $rel = $_POST[self::$opt_rel] == (true || 'on') ? 1 : 0;
|
394 |
+
// $showinfo = $_POST[self::$opt_showinfo] == (true || 'on') ? 1 : 0;
|
395 |
+
// $theme = $_POST[self::$opt_theme] == (true || 'on') ? 'dark' : 'light';
|
396 |
+
|
397 |
+
$new_options = array();
|
398 |
+
$new_options[self::$opt_center] = $_POST[self::$opt_center] == (true || 'on') ? 1 : 0;
|
399 |
+
$new_options[self::$opt_auto_hd] = $_POST[self::$opt_auto_hd] == (true || 'on') ? 1 : 0;
|
400 |
+
$new_options[self::$opt_autoplay] = $_POST[self::$opt_autoplay] == (true || 'on') ? 1 : 0;
|
401 |
+
$new_options[self::$opt_cc_load_policy] = $_POST[self::$opt_cc_load_policy] == (true || 'on') ? 1 : 0;
|
402 |
+
$new_options[self::$opt_iv_load_policy] = $_POST[self::$opt_iv_load_policy] == (true || 'on') ? 1 : 3;
|
403 |
+
$new_options[self::$opt_loop] = $_POST[self::$opt_loop] == (true || 'on') ? 1 : 0;
|
404 |
+
$new_options[self::$opt_modestbranding] = $_POST[self::$opt_modestbranding] == (true || 'on') ? 1 : 0;
|
405 |
+
$new_options[self::$opt_rel] = $_POST[self::$opt_rel] == (true || 'on') ? 1 : 0;
|
406 |
+
$new_options[self::$opt_showinfo] = $_POST[self::$opt_showinfo] == (true || 'on') ? 1 : 0;
|
407 |
+
$new_options[self::$opt_theme] = $_POST[self::$opt_theme] == (true || 'on') ? 'dark' : 'light';
|
408 |
+
|
409 |
+
$all = $new_options + $all;
|
410 |
+
|
411 |
+
// Save the posted value in the database
|
412 |
+
// update_option(self::$opt_auto_hd, $auto_hd);
|
413 |
+
// update_option(self::$opt_autoplay, $autoplay);
|
414 |
+
// update_option(self::$opt_cc_load_policy, $cc_load_policy);
|
415 |
+
// update_option(self::$opt_iv_load_policy, $iv_load_policy);
|
416 |
+
// update_option(self::$opt_loop, $loop);
|
417 |
+
// update_option(self::$opt_modestbranding, $modestbranding);
|
418 |
+
// update_option(self::$opt_rel, $rel);
|
419 |
+
// update_option(self::$opt_showinfo, $showinfo);
|
420 |
+
// update_option(self::$opt_theme, $theme);
|
421 |
+
|
422 |
+
update_option(self::$opt_alloptions, $all);
|
423 |
+
// Put a settings updated message on the screen
|
424 |
+
?>
|
425 |
+
<div class="updated"><p><strong><?php _e('Settings saved.'); ?></strong></p></div>
|
426 |
+
<?php
|
427 |
+
}
|
428 |
+
|
429 |
+
// Now display the settings editing screen
|
430 |
+
|
431 |
+
echo '<div class="wrap">';
|
432 |
+
|
433 |
+
// header
|
434 |
+
|
435 |
+
echo "<h2>" . '<img src="' . plugins_url('images/youtubeicon16.png', __FILE__) . '" /> ' . __('YouTube Preferences') . "</h2>";
|
436 |
+
|
437 |
+
echo '<em>Hear about major upcoming announcements and feature updates by <a target="_blank" href="http://eepurl.com/tpof9">signing up here</a>.</em>';
|
438 |
+
|
439 |
+
echo '<a style="display: block; padding-top: 10px; text-decoration: none;" target="_blank" href="http://www.embedplus.com/dashboard/wordpress-video-analytics-seo.aspx"><img src="' . plugins_url('images/clickdashboard.png', __FILE__) . '" /></a>';
|
440 |
+
|
441 |
+
// settings form
|
442 |
+
?>
|
443 |
+
|
444 |
+
<style type="text/css">
|
445 |
+
#ytform p { line-height: 20px; }
|
446 |
+
#ytform ul li {margin-left: 30px; list-style: disc outside none;}
|
447 |
+
.ytindent {padding: 0px 0px 0px 20px;}
|
448 |
+
.shadow {-webkit-box-shadow: 0px 0px 20px 0px #000000; box-shadow: 0px 0px 20px 0px #000000;}
|
449 |
+
</style>
|
450 |
+
|
451 |
+
<div class="ytindent">
|
452 |
+
<form name="form1" method="post" action="" id="ytform">
|
453 |
+
<input type="hidden" name="<?php echo $ytprefs_submitted; ?>" value="Y">
|
454 |
+
<h3>
|
455 |
+
<?php _e("How to Insert a YouTube Video") ?>
|
456 |
+
</h3>
|
457 |
+
<p>
|
458 |
+
All you have to do is paste the link to the YouTube video on its own line, as shown below (including the http:// part). Easy, eh?
|
459 |
+
</p>
|
460 |
+
<p>
|
461 |
+
<img class="shadow" src="<?php echo plugins_url('images/ownline.jpg', __FILE__) ?>" />
|
462 |
+
</p>
|
463 |
+
|
464 |
+
<p>
|
465 |
+
Note: Make sure the link is in plain text (not hyperlinked/blue).
|
466 |
+
</p>
|
467 |
+
|
468 |
+
<h3>
|
469 |
+
<?php _e("Default Options") ?>
|
470 |
+
</h3>
|
471 |
+
<p>
|
472 |
+
<?php _e("Below you can set the default options for all your videos. However, you can override them (and more) on a per-video basis. Directions on how to do that are in the next section.") ?>
|
473 |
+
</p>
|
474 |
+
|
475 |
+
<div class="ytindent">
|
476 |
+
<p>
|
477 |
+
<input name="<?php echo self::$opt_center; ?>" id="<?php echo self::$opt_center; ?>" <?php checked($all[self::$opt_center], 1); ?> type="checkbox" class="checkbox">
|
478 |
+
<label for="<?php echo self::$opt_center; ?>"><?php _e('Automatically center all your videos (not necessary if all you\'re videos span the whole width of your blog)') ?></label>
|
479 |
+
</p>
|
480 |
+
<p>
|
481 |
+
<input name="<?php echo self::$opt_autoplay; ?>" id="<?php echo self::$opt_autoplay; ?>" <?php checked($all[self::$opt_autoplay], 1); ?> type="checkbox" class="checkbox">
|
482 |
+
<label for="<?php echo self::$opt_autoplay; ?>"><?php _e('Automatically start playing your videos') ?></label>
|
483 |
+
</p>
|
484 |
+
<p>
|
485 |
+
<input name="<?php echo self::$opt_cc_load_policy; ?>" id="<?php echo self::$opt_cc_load_policy; ?>" <?php checked($all[self::$opt_cc_load_policy], 1); ?> type="checkbox" class="checkbox">
|
486 |
+
<label for="<?php echo self::$opt_cc_load_policy; ?>"><?php _e('Turn on closed captions by default') ?></label>
|
487 |
+
</p>
|
488 |
+
<p>
|
489 |
+
<input name="<?php echo self::$opt_iv_load_policy; ?>" id="<?php echo self::$opt_iv_load_policy; ?>" <?php checked($all[self::$opt_iv_load_policy], 1); ?> type="checkbox" class="checkbox">
|
490 |
+
<label for="<?php echo self::$opt_iv_load_policy; ?>"><?php _e('Show annotations by default') ?></label>
|
491 |
+
</p>
|
492 |
+
<p>
|
493 |
+
<input name="<?php echo self::$opt_loop; ?>" id="<?php echo self::$opt_loop; ?>" <?php checked($all[self::$opt_loop], 1); ?> type="checkbox" class="checkbox">
|
494 |
+
<label for="<?php echo self::$opt_loop; ?>"><?php _e('Loop all your videos') ?></label>
|
495 |
+
</p>
|
496 |
+
<p>
|
497 |
+
<input name="<?php echo self::$opt_modestbranding; ?>" id="<?php echo self::$opt_modestbranding; ?>" <?php checked($all[self::$opt_modestbranding], 1); ?> type="checkbox" class="checkbox">
|
498 |
+
<label for="<?php echo self::$opt_modestbranding; ?>"><?php _e('Modest branding - hide YouTube logo while playing') ?></label>
|
499 |
+
</p>
|
500 |
+
<p>
|
501 |
+
<input name="<?php echo self::$opt_rel; ?>" id="<?php echo self::$opt_rel; ?>" <?php checked($all[self::$opt_rel], 1); ?> type="checkbox" class="checkbox">
|
502 |
+
<label for="<?php echo self::$opt_rel; ?>"><?php _e('Show related videos at the end') ?></label>
|
503 |
+
</p>
|
504 |
+
<p>
|
505 |
+
<input name="<?php echo self::$opt_showinfo; ?>" id="<?php echo self::$opt_showinfo; ?>" <?php checked($all[self::$opt_showinfo], 1); ?> type="checkbox" class="checkbox">
|
506 |
+
<label for="<?php echo self::$opt_showinfo; ?>"><?php _e('Show the video title and other info') ?></label>
|
507 |
+
</p>
|
508 |
+
<p>
|
509 |
+
<input name="<?php echo self::$opt_theme; ?>" id="<?php echo self::$opt_theme; ?>" <?php checked($all[self::$opt_theme], 'dark'); ?> type="checkbox" class="checkbox">
|
510 |
+
<label for="<?php echo self::$opt_theme; ?>"><?php _e('Use the dark theme (uncheck to use light theme)') ?></label>
|
511 |
+
</p>
|
512 |
+
<p class="submit">
|
513 |
+
<input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
|
514 |
+
</p>
|
515 |
+
</div>
|
516 |
+
|
517 |
+
<h3>
|
518 |
+
<?php _e("How To Override Defaults / Other Options") ?>
|
519 |
+
</h3>
|
520 |
+
<?php
|
521 |
+
_e("<p>Suppose you have a few videos that need to be different from the above defaults. You can add options to the end of a link as displayed below to override the above defaults. Each option should begin with '&'. </p>");
|
522 |
+
_e('<ul>');
|
523 |
+
_e("<li><strong>width</strong> - Sets the width of your player. If omitted, the default width will be the width of your theme's content.<em> Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&width=500</strong>&height=350</em></li>");
|
524 |
+
_e("<li><strong>height</strong> - Sets the height of your player. If omitted, this will be calculated for you automatically. <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA&width=500<strong>&height=350</strong></em> </li>");
|
525 |
+
_e("<li><strong>autoplay</strong> - Set this to 1 to autoplay the video (or 0 to play the video once). <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&autoplay=1</strong></em> </li>");
|
526 |
+
_e("<li><strong>cc_load_policy</strong> - Set this to 1 to turn on closed captioning (or 0 to leave them off). <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&cc_load_policy=1</strong></em> </li>");
|
527 |
+
_e("<li><strong>iv_load_policy</strong> - Set this to 3 to turn off annotations (or 1 to show them). <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&iv_load_policy=3</strong></em> </li>");
|
528 |
+
_e("<li><strong>loop</strong> - Set this to 1 to loop the video (or 0 to not loop). <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&loop=1</strong></em> </li>");
|
529 |
+
_e("<li><strong>modestbranding</strong> - Set this to 1 to remove the YouTube logo while playing (or 0 to show the logo). <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&modestbranding=1</strong></em> </li>");
|
530 |
+
_e("<li><strong>rel</strong> - Set this to 0 to not show related videos at the end of playing (or 1 to show them). <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&rel=0</strong></em> </li>");
|
531 |
+
_e("<li><strong>showinfo</strong> - Set this to 0 to hide the video title and other info (or 1 to show it). <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&showinfo=0</strong></em> </li>");
|
532 |
+
_e("<li><strong>theme</strong> - Set this to 'light' to make the player have the light-colored theme (or 'dark' for the dark theme). <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&theme=light</strong></em> </li>");
|
533 |
+
_e('</ul>');
|
534 |
+
|
535 |
+
_e("<p>You can also start and end each individual video at particular times. Like the above, each option should begin with '&'</p>");
|
536 |
+
_e('<ul>');
|
537 |
+
_e("<li><strong>start</strong> - Sets the time (in seconds) to start the video. <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA&width=500&height=350<strong>&start=20</strong></em> </li>");
|
538 |
+
_e("<li><strong>end</strong> - Sets the time (in seconds) to stop the video. <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA&width=500&height=350<strong>&end=100</strong></em> </li>");
|
539 |
+
_e('</ul>');
|
540 |
+
?>
|
541 |
+
|
542 |
+
</form>
|
543 |
+
|
544 |
+
<h3><?php _e('Other Notes') ?></h3>
|
545 |
+
<P>
|
546 |
+
<?php _e("Note that this is a no-frills plugin. We're just supporting the basic functions that people typically want when embedding YouTube videos, and providing an easy way to make defaults. If you want more, take a look at a more powerful one here: <a target=\"_blank\" href=\"http://wordpress.org/extend/plugins/embedplus-for-wordpress/\">Advanced YouTube Embed</a> by <a target=\"_blank\" href=\"http://www.embedplus.com\">EmbedPlus</a>."); ?>
|
547 |
+
</p>
|
548 |
+
<p>
|
549 |
+
<?php echo '<em>Hear about major upcoming announcements and feature updates by <a target="_blank" href="http://eepurl.com/tpof9">signing up here</a>.</em>'; ?>
|
550 |
+
</p>
|
551 |
+
|
552 |
+
</div>
|
553 |
+
<?php
|
554 |
+
}
|
555 |
+
|
556 |
+
public static function ytprefsscript()
|
557 |
+
{
|
558 |
+
wp_enqueue_script('__ytprefs__', plugins_url('scripts/ytprefs.min.js', __FILE__));
|
559 |
+
}
|
560 |
+
|
561 |
+
}
|
562 |
+
|
563 |
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
564 |
+
|
565 |
+
register_activation_hook(__FILE__, array('YouTubePrefs', 'initoptions'));
|
566 |
+
add_action('wp_enqueue_scripts', array('YouTubePrefs', 'ytprefsscript'));
|
567 |
+
|
568 |
+
$youtubeplg = new YouTubePrefs();
|
569 |
+
|
570 |
+
|