Version Description
Download this release
Release Info
Developer | embedplus |
Plugin | YouTube |
Version | 3.0 |
Comparing to | |
See all releases |
Version 3.0
- images/btn_embedplusstats.png +0 -0
- images/btn_embedplusstatsoff.png +0 -0
- images/btn_embedpluswiz.png +0 -0
- images/btn_embedpluswizoff.png +0 -0
- images/bulletgraph45.png +0 -0
- images/clickdashboard.png +0 -0
- images/epstats16.png +0 -0
- images/hideget.jpg +0 -0
- images/infinity.png +0 -0
- images/ownline.jpg +0 -0
- images/prioritysupport.png +0 -0
- images/questionsale.png +0 -0
- images/ssprowizard.jpg +0 -0
- images/unlink.png +0 -0
- images/wizbutton.png +0 -0
- images/wizbuttonoff.png +0 -0
- images/youtubeicon.png +0 -0
- images/youtubeicon16.png +0 -0
- images/youtubeicon16off.png +0 -0
- images/youtubewizard.png +0 -0
- readme.txt +118 -0
- screenshot-1.jpg +0 -0
- screenshot-2.jpg +0 -0
- screenshot-3.jpg +0 -0
- scripts/btn_embedplusstats.png +0 -0
- scripts/btn_embedplusstatsoff.png +0 -0
- scripts/embedplus_mce.css +23 -0
- scripts/embedplus_mce.js +42 -0
- scripts/embedplusstats_mce.js +29 -0
- scripts/ytprefs.min.js +1 -0
- youtube.php +835 -0
images/btn_embedplusstats.png
ADDED
Binary file
|
images/btn_embedplusstatsoff.png
ADDED
Binary file
|
images/btn_embedpluswiz.png
ADDED
Binary file
|
images/btn_embedpluswizoff.png
ADDED
Binary file
|
images/bulletgraph45.png
ADDED
Binary file
|
images/clickdashboard.png
ADDED
Binary file
|
images/epstats16.png
ADDED
Binary file
|
images/hideget.jpg
ADDED
Binary file
|
images/infinity.png
ADDED
Binary file
|
images/ownline.jpg
ADDED
Binary file
|
images/prioritysupport.png
ADDED
Binary file
|
images/questionsale.png
ADDED
Binary file
|
images/ssprowizard.jpg
ADDED
Binary file
|
images/unlink.png
ADDED
Binary file
|
images/wizbutton.png
ADDED
Binary file
|
images/wizbuttonoff.png
ADDED
Binary file
|
images/youtubeicon.png
ADDED
Binary file
|
images/youtubeicon16.png
ADDED
Binary file
|
images/youtubeicon16off.png
ADDED
Binary file
|
images/youtubewizard.png
ADDED
Binary file
|
readme.txt
ADDED
@@ -0,0 +1,118 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
=== YouTube ===
|
2 |
+
Contributors: embedplus
|
3 |
+
Plugin Name: YouTube Embed
|
4 |
+
Tags: hd, autohd, auto hd, 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.6
|
7 |
+
Stable tag: 3.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 |
+
* vq - Set this to `hd720` or `hd1080` to force the video to play in HD quality. Example: `http://www.youtube.com/watch?v=quwebVjAEJA&vq=hd720`
|
28 |
+
* 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`
|
29 |
+
* 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`
|
30 |
+
* 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`
|
31 |
+
* loop - Set this to 1 to loop the video (or 0 to not loop). Example: `http://www.youtube.com/watch?v=quwebVjAEJA&loop=1`
|
32 |
+
* 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`
|
33 |
+
* 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`
|
34 |
+
* 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`
|
35 |
+
* 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`
|
36 |
+
|
37 |
+
You can also start and end each individual video at particular times. Like the above, each option should begin with '&'
|
38 |
+
|
39 |
+
* start - Sets the time (in seconds) to start the video. Example: `http://www.youtube.com/watch?v=quwebVjAEJA&width=500&height=350&start=20`
|
40 |
+
* end - Sets the time (in seconds) to stop the video. Example: `http://www.youtube.com/watch?v=quwebVjAEJA&width=500&height=350&end=100`
|
41 |
+
|
42 |
+
== Installation ==
|
43 |
+
|
44 |
+
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.
|
45 |
+
1. Access the Plugins admin menu to activate the YouTube embed plugin.
|
46 |
+
1. Make your default settings after clicking the new YouTube menu item that shows up in your admin panel.
|
47 |
+
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.
|
48 |
+
1. To get an analytics dashboard, [sign up for one of the options here >>](https://www.embedplus.com/dashboard/wordpress-video-analytics-seo.aspx)
|
49 |
+
|
50 |
+
Additional codes (adding these will override the default settings in the admin):
|
51 |
+
|
52 |
+
* 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`
|
53 |
+
* 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`
|
54 |
+
* vq - Set this to `hd720` or `hd1080` to force the video to play in HD quality. Example: `http://www.youtube.com/watch?v=quwebVjAEJA&vq=hd720`
|
55 |
+
* 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`
|
56 |
+
* 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`
|
57 |
+
* 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`
|
58 |
+
* loop - Set this to 1 to loop the video (or 0 to not loop). Example: `http://www.youtube.com/watch?v=quwebVjAEJA&loop=1`
|
59 |
+
* 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`
|
60 |
+
* 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`
|
61 |
+
* 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`
|
62 |
+
* 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`
|
63 |
+
|
64 |
+
You can also start and end each individual video at particular times. Like the above, each option should begin with '&'
|
65 |
+
|
66 |
+
* start - Sets the time (in seconds) to start the video. Example: `http://www.youtube.com/watch?v=quwebVjAEJA&width=500&height=350&start=20`
|
67 |
+
* end - Sets the time (in seconds) to stop the video. Example: `http://www.youtube.com/watch?v=quwebVjAEJA&width=500&height=350&end=100`
|
68 |
+
|
69 |
+
== Screenshots ==
|
70 |
+
|
71 |
+
1. YouTube Embed Screenshot 1: Paste a YouTube link on its own line and it will become a YouTube embed on your website.
|
72 |
+
2. YouTube Embed Screenshot 2: YouTube's admin settings.
|
73 |
+
3. YouTube Embed Screenshot 3: PRO YouTube Wizard
|
74 |
+
|
75 |
+
== Changelog ==
|
76 |
+
|
77 |
+
= YouTube Embed 3.0 =
|
78 |
+
Added YouTube wizard for PRO users
|
79 |
+
Added autologin to analytics for PRO users
|
80 |
+
Added priority support form for PRO users
|
81 |
+
|
82 |
+
= YouTube Embed 2.6 =
|
83 |
+
Compatible with WP 3.6
|
84 |
+
|
85 |
+
= YouTube Embed 2.4 =
|
86 |
+
Added auto HD support
|
87 |
+
Support for shorthand (i.e. `http://www.youtu.be`)
|
88 |
+
Fixed editor issue
|
89 |
+
|
90 |
+
= YouTube Embed 2.3 =
|
91 |
+
Start/end time shortcut bug fix
|
92 |
+
|
93 |
+
= YouTube Embed 2.2 =
|
94 |
+
Minor changes
|
95 |
+
|
96 |
+
= YouTube Embed 2.1 =
|
97 |
+
By request from several users, we've added easier access to the video analytics dashboard
|
98 |
+
|
99 |
+
= YouTube Embed 2.0 =
|
100 |
+
|
101 |
+
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:
|
102 |
+
|
103 |
+
* How much are your visitors actually watching the videos you post?
|
104 |
+
* How does the view activity on your site compare to other sites like it?
|
105 |
+
* What and when are your best and worst performers?
|
106 |
+
* How much do the producers of the YouTube videos you embed rely on **your site** for views?
|
107 |
+
|
108 |
+
We think these are all interesting questions; however, note that there's no need to upgrade if you don't.
|
109 |
+
|
110 |
+
= YouTube Embed 1.1 =
|
111 |
+
Fixed minor bug.
|
112 |
+
|
113 |
+
= YouTube Embed 1.0 =
|
114 |
+
First release uploaded to the plugin repository.
|
115 |
+
|
116 |
+
== Other Notes ==
|
117 |
+
|
118 |
+
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
|
screenshot-3.jpg
ADDED
Binary file
|
scripts/btn_embedplusstats.png
ADDED
Binary file
|
scripts/btn_embedplusstatsoff.png
ADDED
Binary file
|
scripts/embedplus_mce.css
ADDED
@@ -0,0 +1,23 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
.wp_themeSkin span.mce_embedpluswiz_youtubeprefs, span.mce_embedpluswiz_youtubeprefs
|
2 |
+
{
|
3 |
+
background: transparent url("../images/wizbuttonoff.png") no-repeat scroll center center !important;
|
4 |
+
}
|
5 |
+
|
6 |
+
.wp_themeSkin span.mce_embedpluswiz_youtubeprefs:hover, span.mce_embedpluswiz_youtubeprefs:hover
|
7 |
+
{
|
8 |
+
background-image: url("../images/wizbutton.png") !important;
|
9 |
+
}
|
10 |
+
|
11 |
+
.wp_themeSkin span.mce_embedplusstats, span.mce_embedplusstats,
|
12 |
+
.wp_themeSkin span.mce_embedplusstats_youtubeprefs, span.mce_embedplusstats_youtubeprefs
|
13 |
+
|
14 |
+
{
|
15 |
+
background: transparent url("../images/btn_embedplusstatsoff.png") no-repeat scroll center center !important;
|
16 |
+
}
|
17 |
+
|
18 |
+
.wp_themeSkin span.mce_embedplusstats:hover, span.mce_embedplusstats:hover,
|
19 |
+
.wp_themeSkin span.mce_embedplusstats_youtubeprefs:hover, span.mce_embedplusstats_youtubeprefs:hover
|
20 |
+
{
|
21 |
+
background-image: url("../images/btn_embedplusstats.png") !important;
|
22 |
+
}
|
23 |
+
|
scripts/embedplus_mce.js
ADDED
@@ -0,0 +1,42 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
(function() {
|
2 |
+
tinymce.create('tinymce.plugins.Embedpluswiz_youtubeprefs', {
|
3 |
+
init : function(ed, url) {
|
4 |
+
var plep = new Image();
|
5 |
+
plep.src = url+'/../images/wizbutton.png';
|
6 |
+
ed.addButton('embedpluswiz_youtubeprefs', {
|
7 |
+
title : 'YouTube Wizard - An easier embedding option',
|
8 |
+
onclick : function(ev) {
|
9 |
+
modalw = Math.round(jQuery(window).width() *.9);
|
10 |
+
modalh = Math.round(jQuery(window).height() *.8);
|
11 |
+
ed.windowManager.open({
|
12 |
+
title : "YouTube Wizard - An easier embedding option",
|
13 |
+
file : epbasesite + '/wpembedcode-simple.aspx?blogwidth=' + epblogwidth + '&domain=' + escape(window.location.toString()) + '&prokey=' + escape(epprokey) + '&myytdefaults=' + escape(myytdefaults),
|
14 |
+
width : 950,
|
15 |
+
height : modalh,
|
16 |
+
inline : true,
|
17 |
+
resizable: true,
|
18 |
+
scrollbars: true
|
19 |
+
}, {
|
20 |
+
plugin_url : url, // Plugin absolute URL
|
21 |
+
some_custom_arg : '' // Custom argument
|
22 |
+
});
|
23 |
+
}
|
24 |
+
});
|
25 |
+
},
|
26 |
+
createControl : function(n, cm) {
|
27 |
+
return null;
|
28 |
+
},
|
29 |
+
getInfo : function() {
|
30 |
+
return {
|
31 |
+
longname : "YouTube Wizard - An easier embedding option",
|
32 |
+
author : 'EmbedPlus',
|
33 |
+
authorurl : 'http://www.embedplus.com/',
|
34 |
+
infourl : 'http://www.embedplus.com/',
|
35 |
+
version : epversion
|
36 |
+
};
|
37 |
+
}
|
38 |
+
});
|
39 |
+
tinymce.PluginManager.add('embedpluswiz_youtubeprefs', tinymce.plugins.Embedpluswiz_youtubeprefs);
|
40 |
+
|
41 |
+
|
42 |
+
})();
|
scripts/embedplusstats_mce.js
ADDED
@@ -0,0 +1,29 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
(function() {
|
2 |
+
tinymce.create('tinymce.plugins.Embedplusstats_youtubeprefs', {
|
3 |
+
init : function(ed, url) {
|
4 |
+
var plep = new Image();
|
5 |
+
plep.src = url+'/../btn_embedplusstats.png';
|
6 |
+
ed.addButton('embedplusstats_youtubeprefs', {
|
7 |
+
title : 'How much are your visitors actually watching the videos you post? Click here to start using this popular feature from EmbedPlus Labs »',
|
8 |
+
onclick : function(ev) {
|
9 |
+
window.open(epbasesite + '/dashboard/pro-easy-video-analytics.aspx?ref=wysiwygbutton&prokey=' + epprokey + '&domain=' + escape(window.location.toString()), '_blank');
|
10 |
+
}
|
11 |
+
});
|
12 |
+
|
13 |
+
},
|
14 |
+
createControl : function(n, cm) {
|
15 |
+
return null;
|
16 |
+
},
|
17 |
+
getInfo : function() {
|
18 |
+
return {
|
19 |
+
longname : "Embedplus Video Analytics Dashboard",
|
20 |
+
author : 'EmbedPlus',
|
21 |
+
authorurl : 'http://www.embedplus.com/',
|
22 |
+
infourl : 'http://www.embedplus.com/',
|
23 |
+
version : epversion
|
24 |
+
};
|
25 |
+
}
|
26 |
+
});
|
27 |
+
tinymce.PluginManager.add('embedplusstats_youtubeprefs', tinymce.plugins.Embedplusstats_youtubeprefs);
|
28 |
+
|
29 |
+
})();
|
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++){_EPADashboard_.setupevents(e[t].id)}}(function(){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}}if(typeof window._EPADashboard_=="undefined"){window._EPADashboard_={onPlayerReady:function(e){setTimeout(function(){var t=_EPADashboard_.justid(e.target.getVideoUrl());_EPADashboard_.jp("ytid="+t)},4e3)},onPlayerStateChange:function(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=_EPADashboard_.justid(e.target.getVideoUrl());_EPADashboard_.jp("ytid="+n+"&p=1")}},justid:function(e){return(new RegExp("[\\?&]v=([^&#]*)")).exec(e)[1]},setupevents:function(e){new YT.Player(e,{events:{onReady:_EPADashboard_.onPlayerReady,onStateChange:_EPADashboard_.onPlayerStateChange}})},jp:function(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)}}}if(typeof window.YT=="undefined"){var e=document.createElement("script");e.src="//www.youtube.com/iframe_api";e.type="text/javascript";document.getElementsByTagName("head")[0].appendChild(e)}})()
|
youtube.php
ADDED
@@ -0,0 +1,835 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|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view tracking and access to your very own analytics dashboard.
|
6 |
+
Version: 3.0
|
7 |
+
Author: EmbedPlus Team
|
8 |
+
Author URI: http://www.embedplus.com
|
9 |
+
*/
|
10 |
+
|
11 |
+
/*
|
12 |
+
YouTube
|
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 |
+
|
35 |
+
public static $version = '3.0';
|
36 |
+
public static $opt_version = 'version';
|
37 |
+
public static $optembedwidth = null;
|
38 |
+
public static $optembedheight = null;
|
39 |
+
public static $defaultheight = null;
|
40 |
+
public static $defaultwidth = null;
|
41 |
+
public static $opt_center = 'centervid';
|
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_vq = 'vq';
|
51 |
+
public static $opt_pro = 'pro';
|
52 |
+
public static $opt_alloptions = 'youtubeprefs_alloptions';
|
53 |
+
public static $alloptions = null;
|
54 |
+
public static $yt_options = array();
|
55 |
+
//public static $epbase = 'http://localhost:2346';
|
56 |
+
public static $epbase = 'http://www.embedplus.com';
|
57 |
+
/*
|
58 |
+
color
|
59 |
+
controls
|
60 |
+
autohide
|
61 |
+
disablekb
|
62 |
+
list
|
63 |
+
listType
|
64 |
+
playlist
|
65 |
+
*/
|
66 |
+
//TEST REGEX
|
67 |
+
///////////////////////////////////////////////////////////////////////////////////////////////////
|
68 |
+
///////////////////////////////////////////////////////////////////////////////////////////////////
|
69 |
+
///////////////////////////////////////////////////////////////////////////////////////////////////
|
70 |
+
///////////////////////////////////////////////////////////////////////////////////////////////////
|
71 |
+
///////////////////////////////////////////////////////////////////////////////////////////////////
|
72 |
+
public static $ytregex = '@^\s*https?://(?:www\.)?(?:(?:youtube.com/watch\?)|(?:youtu.be/))([^\s"]+)\s*$@im';
|
73 |
+
|
74 |
+
///////////////////////////////////////////////////////////////////////////////////////////////////
|
75 |
+
///////////////////////////////////////////////////////////////////////////////////////////////////
|
76 |
+
///////////////////////////////////////////////////////////////////////////////////////////////////
|
77 |
+
///////////////////////////////////////////////////////////////////////////////////////////////////
|
78 |
+
///////////////////////////////////////////////////////////////////////////////////////////////////
|
79 |
+
///////////////////////////////////////////////////////////////////////////////////////////////////
|
80 |
+
|
81 |
+
public function __construct()
|
82 |
+
{
|
83 |
+
self::$alloptions = get_option(self::$opt_alloptions);
|
84 |
+
if (self::$alloptions == false || version_compare(self::$alloptions[self::$opt_version], self::$version, '<'))
|
85 |
+
{
|
86 |
+
self::initoptions();
|
87 |
+
}
|
88 |
+
self::$optembedwidth = intval(get_option('embed_size_w'));
|
89 |
+
self::$optembedheight = intval(get_option('embed_size_h'));
|
90 |
+
|
91 |
+
self::$yt_options = array(
|
92 |
+
self::$opt_autoplay,
|
93 |
+
self::$opt_cc_load_policy,
|
94 |
+
self::$opt_iv_load_policy,
|
95 |
+
self::$opt_loop,
|
96 |
+
self::$opt_modestbranding,
|
97 |
+
self::$opt_rel,
|
98 |
+
self::$opt_showinfo,
|
99 |
+
self::$opt_theme,
|
100 |
+
self::$opt_vq,
|
101 |
+
'start',
|
102 |
+
'end'
|
103 |
+
);
|
104 |
+
|
105 |
+
self::do_ytprefs();
|
106 |
+
add_action('admin_menu', 'YouTubePrefs::ytprefs_plugin_menu');
|
107 |
+
}
|
108 |
+
|
109 |
+
static function initoptions()
|
110 |
+
{
|
111 |
+
$_center = 0;
|
112 |
+
$_autoplay = get_option('youtubeprefs_autoplay', 0);
|
113 |
+
$_cc_load_policy = get_option('youtubeprefs_cc_load_policy', 0);
|
114 |
+
$_iv_load_policy = get_option('youtubeprefs_iv_load_policy', 1);
|
115 |
+
$_loop = get_option('youtubeprefs_loop', 0);
|
116 |
+
$_modestbranding = get_option('youtubeprefs_modestbranding', 0);
|
117 |
+
$_rel = get_option('youtubeprefs_rel', 1);
|
118 |
+
$_showinfo = get_option('youtubeprefs_showinfo', 1);
|
119 |
+
$_theme = get_option('youtubeprefs_theme', 'dark');
|
120 |
+
$_vq = get_option('youtubeprefs_vq', '');
|
121 |
+
$_pro = '';
|
122 |
+
|
123 |
+
$arroptions = get_option(self::$opt_alloptions);
|
124 |
+
|
125 |
+
if ($arroptions !== false)
|
126 |
+
{
|
127 |
+
$_center = self::tryget($arroptions, self::$opt_center, 0);
|
128 |
+
$_autoplay = self::tryget($arroptions, self::$opt_autoplay, 0);
|
129 |
+
$_cc_load_policy = self::tryget($arroptions, self::$opt_cc_load_policy, 0);
|
130 |
+
$_iv_load_policy = self::tryget($arroptions, self::$opt_iv_load_policy, 1);
|
131 |
+
$_loop = self::tryget($arroptions, self::$opt_loop, 0);
|
132 |
+
$_modestbranding = self::tryget($arroptions, self::$opt_modestbranding, 0);
|
133 |
+
$_rel = self::tryget($arroptions, self::$opt_rel, 1);
|
134 |
+
$_showinfo = self::tryget($arroptions, self::$opt_showinfo, 1);
|
135 |
+
$_theme = self::tryget($arroptions, self::$opt_theme, 'dark');
|
136 |
+
$_vq = self::tryget($arroptions, self::$opt_vq, '');
|
137 |
+
$_pro = self::tryget($arroptions, self::$opt_pro, '');
|
138 |
+
}
|
139 |
+
|
140 |
+
$all = array(
|
141 |
+
self::$opt_version => self::$version,
|
142 |
+
self::$opt_center => $_center,
|
143 |
+
self::$opt_autoplay => $_autoplay,
|
144 |
+
self::$opt_cc_load_policy => $_cc_load_policy,
|
145 |
+
self::$opt_iv_load_policy => $_iv_load_policy,
|
146 |
+
self::$opt_loop => $_loop,
|
147 |
+
self::$opt_modestbranding => $_modestbranding,
|
148 |
+
self::$opt_rel => $_rel,
|
149 |
+
self::$opt_showinfo => $_showinfo,
|
150 |
+
self::$opt_theme => $_theme,
|
151 |
+
self::$opt_vq => $_vq,
|
152 |
+
self::$opt_pro => $_pro
|
153 |
+
);
|
154 |
+
|
155 |
+
update_option(self::$opt_alloptions, $all);
|
156 |
+
update_option('embed_autourls', 1);
|
157 |
+
self::$alloptions = get_option(self::$opt_alloptions);
|
158 |
+
}
|
159 |
+
|
160 |
+
public static function tryget($array, $key, $default = null)
|
161 |
+
{
|
162 |
+
return isset($array[$key]) ? $array[$key] : $default;
|
163 |
+
}
|
164 |
+
|
165 |
+
public static function wp_above_version($ver)
|
166 |
+
{
|
167 |
+
global $wp_version;
|
168 |
+
if (version_compare($wp_version, $ver, '>='))
|
169 |
+
{
|
170 |
+
return true;
|
171 |
+
}
|
172 |
+
return false;
|
173 |
+
}
|
174 |
+
|
175 |
+
public static function do_ytprefs()
|
176 |
+
{
|
177 |
+
if (!is_admin())
|
178 |
+
{
|
179 |
+
add_filter('the_content', 'YouTubePrefs::apply_prefs', 1);
|
180 |
+
}
|
181 |
+
}
|
182 |
+
|
183 |
+
public static function apply_prefs($content)
|
184 |
+
{
|
185 |
+
$content = preg_replace_callback(self::$ytregex, "YouTubePrefs::get_html", $content);
|
186 |
+
return $content;
|
187 |
+
}
|
188 |
+
|
189 |
+
public static function get_html($m)
|
190 |
+
{
|
191 |
+
$link = trim(preg_replace('/&/i', '&', $m[0]));
|
192 |
+
$link = preg_replace('/\s/', '', $link);
|
193 |
+
$linkparamstemp = explode('?', $link);
|
194 |
+
$linkparams = self::keyvalue($linkparamstemp[1], true);
|
195 |
+
if (strpos($linkparamstemp[0], 'youtu.be') !== false && !$linkparams['v'])
|
196 |
+
{
|
197 |
+
$vtemp = explode('/', $linkparamstemp[0]);
|
198 |
+
$linkparams['v'] = array_pop($vtemp);
|
199 |
+
}
|
200 |
+
|
201 |
+
self::init_dimensions($link, $linkparams);
|
202 |
+
|
203 |
+
$linkscheme = parse_url($link, PHP_URL_SCHEME);
|
204 |
+
|
205 |
+
$code1 = '<iframe id="_ytid_' . rand(10000, 99999) . '" width="' . self::$defaultwidth . '" height="' . self::$defaultheight .
|
206 |
+
'" src="' . $linkscheme . '://www.youtube.com/embed/' . $linkparams['v'] . '?';
|
207 |
+
$code2 = '" frameborder="0" allowfullscreen type="text/html" class="__youtube_prefs__"></iframe>';
|
208 |
+
|
209 |
+
|
210 |
+
$finalparams = $linkparams + self::$alloptions;
|
211 |
+
$origin = '';
|
212 |
+
|
213 |
+
try
|
214 |
+
{
|
215 |
+
if (!empty($_SERVER["HTTP_HOST"]))
|
216 |
+
{
|
217 |
+
$origin = 'origin=' .
|
218 |
+
((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? 'https://' : 'http://') . $_SERVER["HTTP_HOST"] . '&';
|
219 |
+
}
|
220 |
+
}
|
221 |
+
catch (Exception $e)
|
222 |
+
{
|
223 |
+
|
224 |
+
}
|
225 |
+
$finalsrc = 'enablejsapi=1&'; // . $origin;
|
226 |
+
|
227 |
+
if (count($finalparams) > 1)
|
228 |
+
{
|
229 |
+
foreach ($finalparams as $key => $value)
|
230 |
+
{
|
231 |
+
if (in_array($key, self::$yt_options))
|
232 |
+
{
|
233 |
+
$finalsrc .= htmlspecialchars($key) . '=' . htmlspecialchars($value) . '&';
|
234 |
+
if ($key == 'loop' && $value == 1)
|
235 |
+
$finalsrc .= 'playlist=' . $finalparams['v'] . '&';
|
236 |
+
}
|
237 |
+
}
|
238 |
+
}
|
239 |
+
|
240 |
+
$code = $code1 . $finalsrc . $code2;
|
241 |
+
|
242 |
+
if ($finalparams[self::$opt_center] == 1)
|
243 |
+
{
|
244 |
+
$code = '<div style="text-align: center; display: block;">' . $code . '</div>';
|
245 |
+
}
|
246 |
+
|
247 |
+
// reset static vals for next embed
|
248 |
+
self::$defaultheight = null;
|
249 |
+
self::$defaultwidth = null;
|
250 |
+
|
251 |
+
return $code;
|
252 |
+
}
|
253 |
+
|
254 |
+
public static function keyvalue($qry, $includev)
|
255 |
+
{
|
256 |
+
$ytvars = explode('&', $qry);
|
257 |
+
$ytkvp = array();
|
258 |
+
foreach ($ytvars as $k => $v)
|
259 |
+
{
|
260 |
+
$kvp = explode('=', $v);
|
261 |
+
if (count($kvp) == 2 && ($includev || strtolower($kvp[0]) != 'v'))
|
262 |
+
{
|
263 |
+
$ytkvp[$kvp[0]] = $kvp[1];
|
264 |
+
}
|
265 |
+
}
|
266 |
+
|
267 |
+
return $ytkvp;
|
268 |
+
}
|
269 |
+
|
270 |
+
public static function init_dimensions($url, $urlkvp)
|
271 |
+
{
|
272 |
+
// get default dimensions; try embed size in settings, then try theme's content width, then just 480px
|
273 |
+
if (self::$defaultwidth == null)
|
274 |
+
{
|
275 |
+
global $content_width;
|
276 |
+
if (empty($content_width))
|
277 |
+
$content_width = $GLOBALS['content_width'];
|
278 |
+
|
279 |
+
self::$defaultwidth = $urlkvp['width'] ? $urlkvp['width'] : (self::$optembedwidth ? self::$optembedwidth : ($content_width ? $content_width : 480));
|
280 |
+
self::$defaultheight = self::get_aspect_height($url);
|
281 |
+
}
|
282 |
+
}
|
283 |
+
|
284 |
+
public static function get_aspect_height($url)
|
285 |
+
{
|
286 |
+
|
287 |
+
// attempt to get aspect ratio correct height from oEmbed
|
288 |
+
$aspectheight = round((self::$defaultwidth * 9) / 16, 0);
|
289 |
+
if ($url)
|
290 |
+
{
|
291 |
+
require_once( ABSPATH . WPINC . '/class-oembed.php' );
|
292 |
+
$oembed = _wp_oembed_get_object();
|
293 |
+
$args = array();
|
294 |
+
$args['width'] = self::$defaultwidth;
|
295 |
+
$args['height'] = self::$optembedheight;
|
296 |
+
$args['discover'] = false;
|
297 |
+
$odata = $oembed->fetch('http://www.youtube.com/oembed', $url, $args);
|
298 |
+
|
299 |
+
if ($odata)
|
300 |
+
{
|
301 |
+
$aspectheight = $odata->height;
|
302 |
+
}
|
303 |
+
}
|
304 |
+
|
305 |
+
//add 30 for YouTube's own bar
|
306 |
+
return $aspectheight + 30;
|
307 |
+
}
|
308 |
+
|
309 |
+
public static function ytprefs_plugin_menu()
|
310 |
+
{
|
311 |
+
add_menu_page('YouTube Settings', 'YouTube', 'manage_options', 'youtube-my-preferences', 'YouTubePrefs::ytprefs_show_options', plugins_url('images/youtubeicon16.png', __FILE__), '10.00392854349');
|
312 |
+
add_menu_page('YouTube Analytics Dashboard', 'YouTube Pro', 'manage_options', 'youtube-ep-analytics-dashboard', 'YouTubePrefs::epstats_show_options', plugins_url('images/epstats16.png', __FILE__), '10.00492884349');
|
313 |
+
}
|
314 |
+
|
315 |
+
public static function epstats_show_options()
|
316 |
+
{
|
317 |
+
|
318 |
+
if (!current_user_can('manage_options'))
|
319 |
+
{
|
320 |
+
wp_die(__('You do not have sufficient permissions to access this page.'));
|
321 |
+
}
|
322 |
+
|
323 |
+
// Now display the settings editing screen
|
324 |
+
?>
|
325 |
+
<div class="wrap">
|
326 |
+
<?php
|
327 |
+
// header
|
328 |
+
|
329 |
+
echo "<h2>" . '<img src="' . plugins_url('images/epstats16.png', __FILE__) . '" /> ' . __('YouTube Analytics Dashboard') . "</h2>";
|
330 |
+
|
331 |
+
// settings form
|
332 |
+
?>
|
333 |
+
<style type="text/css">
|
334 |
+
.epicon { width: 20px; height: 20px; vertical-align: middle; padding-right: 5px;}
|
335 |
+
.epindent {padding-left: 25px;}
|
336 |
+
iframe.shadow {-webkit-box-shadow: 0px 0px 20px 0px #000000; box-shadow: 0px 0px 20px 0px #000000;}
|
337 |
+
</style>
|
338 |
+
<br>
|
339 |
+
<?php
|
340 |
+
$thishost = (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : "");
|
341 |
+
$thiskey = self::$alloptions[self::$opt_pro];
|
342 |
+
if (self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0)
|
343 |
+
{
|
344 |
+
echo '<p><i>Logging you in...</i></p>';
|
345 |
+
}
|
346 |
+
?>
|
347 |
+
<iframe class="shadow" src="<?php echo self::$epbase ?>/dashboard/pro-easy-video-analytics.aspx?ref=protab&domain=<?php echo $thishost; ?>&prokey=<?php echo $thiskey; ?>" width="1030" height="2000" scrolling="auto"/>
|
348 |
+
</div>
|
349 |
+
<?php
|
350 |
+
}
|
351 |
+
|
352 |
+
public static function my_embedplus_pro_record()
|
353 |
+
{
|
354 |
+
$result = array();
|
355 |
+
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
|
356 |
+
{
|
357 |
+
$tmppro = preg_replace('/[^A-Za-z0-9-]/i', '', $_REQUEST[self::$opt_pro]);
|
358 |
+
$new_options = array();
|
359 |
+
$new_options[self::$opt_pro] = $tmppro;
|
360 |
+
$all = get_option(self::$opt_alloptions);
|
361 |
+
$all = $new_options + $all;
|
362 |
+
update_option(self::$opt_alloptions, $all);
|
363 |
+
|
364 |
+
if (strlen($tmppro) > 0)
|
365 |
+
{
|
366 |
+
$result['type'] = 'success';
|
367 |
+
}
|
368 |
+
else
|
369 |
+
{
|
370 |
+
$result['type'] = 'error';
|
371 |
+
}
|
372 |
+
echo json_encode($result);
|
373 |
+
}
|
374 |
+
else
|
375 |
+
{
|
376 |
+
$result['type'] = 'error';
|
377 |
+
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
378 |
+
}
|
379 |
+
die();
|
380 |
+
}
|
381 |
+
|
382 |
+
public static function ytprefs_show_options()
|
383 |
+
{
|
384 |
+
|
385 |
+
if (!current_user_can('manage_options'))
|
386 |
+
{
|
387 |
+
wp_die(__('You do not have sufficient permissions to access this page.'));
|
388 |
+
}
|
389 |
+
|
390 |
+
// variables for the field and option names
|
391 |
+
$ytprefs_submitted = 'ytprefs_submitted';
|
392 |
+
|
393 |
+
// Read in existing option values from database
|
394 |
+
|
395 |
+
$all = get_option(self::$opt_alloptions);
|
396 |
+
|
397 |
+
// See if the user has posted us some information
|
398 |
+
// If they did, this hidden field will be set to 'Y'
|
399 |
+
if (isset($_POST[$ytprefs_submitted]) && $_POST[$ytprefs_submitted] == 'Y')
|
400 |
+
{
|
401 |
+
// Read their posted values
|
402 |
+
|
403 |
+
$new_options = array();
|
404 |
+
$new_options[self::$opt_center] = $_POST[self::$opt_center] == (true || 'on') ? 1 : 0;
|
405 |
+
$new_options[self::$opt_autoplay] = $_POST[self::$opt_autoplay] == (true || 'on') ? 1 : 0;
|
406 |
+
$new_options[self::$opt_cc_load_policy] = $_POST[self::$opt_cc_load_policy] == (true || 'on') ? 1 : 0;
|
407 |
+
$new_options[self::$opt_iv_load_policy] = $_POST[self::$opt_iv_load_policy] == (true || 'on') ? 1 : 3;
|
408 |
+
$new_options[self::$opt_loop] = $_POST[self::$opt_loop] == (true || 'on') ? 1 : 0;
|
409 |
+
$new_options[self::$opt_modestbranding] = $_POST[self::$opt_modestbranding] == (true || 'on') ? 1 : 0;
|
410 |
+
$new_options[self::$opt_rel] = $_POST[self::$opt_rel] == (true || 'on') ? 1 : 0;
|
411 |
+
$new_options[self::$opt_showinfo] = $_POST[self::$opt_showinfo] == (true || 'on') ? 1 : 0;
|
412 |
+
$new_options[self::$opt_theme] = $_POST[self::$opt_theme] == (true || 'on') ? 'dark' : 'light';
|
413 |
+
$new_options[self::$opt_vq] = $_POST[self::$opt_vq] == (true || 'on') ? 'hd720' : '';
|
414 |
+
|
415 |
+
$all = $new_options + $all;
|
416 |
+
|
417 |
+
// Save the posted value in the database
|
418 |
+
|
419 |
+
update_option(self::$opt_alloptions, $all);
|
420 |
+
// Put a settings updated message on the screen
|
421 |
+
?>
|
422 |
+
<div class="updated"><p><strong><?php _e('Settings saved.'); ?></strong></p></div>
|
423 |
+
<?php
|
424 |
+
}
|
425 |
+
|
426 |
+
// Now display the settings editing screen
|
427 |
+
|
428 |
+
echo '<div class="wrap">';
|
429 |
+
|
430 |
+
// header
|
431 |
+
|
432 |
+
echo "<h2>" . '<img src="' . plugins_url('images/youtubeicon16.png', __FILE__) . '" /> ' . __('YouTube Preferences') . "</h2>";
|
433 |
+
|
434 |
+
// settings form
|
435 |
+
?>
|
436 |
+
|
437 |
+
<style type="text/css">
|
438 |
+
#ytform p { line-height: 20px; }
|
439 |
+
#ytform ul li {margin-left: 30px; list-style: disc outside none;}
|
440 |
+
.ytindent {padding: 0px 0px 0px 20px;}
|
441 |
+
.shadow {-webkit-box-shadow: 0px 0px 20px 0px #000000; box-shadow: 0px 0px 20px 0px #000000;}
|
442 |
+
.gopro img {vertical-align: middle;
|
443 |
+
width: 20px;
|
444 |
+
height: 20px;
|
445 |
+
padding-bottom: 4px;}
|
446 |
+
.orange {color: #f85d00;}
|
447 |
+
.bold {font-weight: bold;}
|
448 |
+
.grey{color: #888888;}
|
449 |
+
#goprobox {border-radius: 15px; padding: 5px 20px 20px 20px; margin: 15px; border: 3px solid #dddddd; width: 470px;}
|
450 |
+
.pronon {font-weight: bold; color: #f85d00;}
|
451 |
+
ul.reglist li {margin-left: 30px; list-style: disc outside none;}
|
452 |
+
</style>
|
453 |
+
|
454 |
+
<div class="ytindent">
|
455 |
+
|
456 |
+
<div id="goprobox">
|
457 |
+
|
458 |
+
<?php
|
459 |
+
$haspro = ($all[self::$opt_pro] && strlen(trim($all[self::$opt_pro])) > 0);
|
460 |
+
|
461 |
+
if ($haspro)
|
462 |
+
{
|
463 |
+
echo "<h3>" . __('Thank you for going PRO.');
|
464 |
+
echo ' <input type="submit" name="showkey" class="button-primary" style="vertical-align: 15%;" id="showprokey" value="Show my PRO key" />';
|
465 |
+
echo "</h3>";
|
466 |
+
?>
|
467 |
+
<?php
|
468 |
+
}
|
469 |
+
else
|
470 |
+
{
|
471 |
+
?>
|
472 |
+
|
473 |
+
<h3>
|
474 |
+
Go PRO
|
475 |
+
</h3>
|
476 |
+
<ul class="gopro">
|
477 |
+
<li>
|
478 |
+
<img src="<?php echo plugins_url('images/youtubewizard.png', __FILE__) ?>">
|
479 |
+
YouTube Wizard - Easily embed without memorizing codes
|
480 |
+
</li>
|
481 |
+
<li>
|
482 |
+
<img src="<?php echo plugins_url('images/prioritysupport.png', __FILE__) ?>">
|
483 |
+
Priority support (Puts your request in front)
|
484 |
+
</li>
|
485 |
+
<li>
|
486 |
+
<img src="<?php echo plugins_url('images/bulletgraph45.png', __FILE__) ?>">
|
487 |
+
Your own video analytics dashboard
|
488 |
+
</li>
|
489 |
+
<li>
|
490 |
+
<img src="<?php echo plugins_url('images/infinity.png', __FILE__) ?>">
|
491 |
+
Unlimited PRO upgrades and downloads
|
492 |
+
</li>
|
493 |
+
<li>
|
494 |
+
<img src="<?php echo plugins_url('images/questionsale.png', __FILE__) ?>">
|
495 |
+
What else? You tell us!
|
496 |
+
</li>
|
497 |
+
</ul>
|
498 |
+
<a href="<?php echo self::$epbase ?>/dashboard/pro-easy-video-analytics.aspx" class="button-primary" target="_blank">Click here to go PRO »</a> Your PRO key will then be immediately emailed to you.
|
499 |
+
|
500 |
+
<br>
|
501 |
+
<br>
|
502 |
+
<h3>Have your PRO key? Save it below:</h3>
|
503 |
+
|
504 |
+
<?php } ?>
|
505 |
+
<form name="form2" method="post" action="" id="epform2" class="submitpro" <?php if ($haspro) echo 'style="display: none;"' ?>>
|
506 |
+
<input type="hidden" name="<?php echo $pro_submitted; ?>" value="Y">
|
507 |
+
|
508 |
+
<input style="box-shadow: 0px 0px 5px 0px #1870D5; width: 270px;" name="<?php echo self::$opt_pro; ?>" id="opt_pro" value="<?php echo $all[self::$opt_pro]; ?>" type="text">
|
509 |
+
<input type="submit" name="Submit" class="button-primary" id="prokeysubmit" value="<?php _e('Save Key') ?>" />
|
510 |
+
<br>
|
511 |
+
<span style="display: none;" id="prokeyloading" class="orange bold">Verifying...</span>
|
512 |
+
<span class="orange bold" style="display: none;" id="prokeysuccess">Success! Please refresh this page.</span>
|
513 |
+
<span class="orange bold" style="display: none;" id="prokeyfailed">Sorry, that seems to be an invalid key.</span>
|
514 |
+
|
515 |
+
</form>
|
516 |
+
|
517 |
+
</div>
|
518 |
+
<br>
|
519 |
+
<form name="form1" method="post" action="" id="ytform">
|
520 |
+
<input type="hidden" name="<?php echo $ytprefs_submitted; ?>" value="Y">
|
521 |
+
<h3>
|
522 |
+
<?php _e("How to Insert a YouTube Video") ?> <span class="pronon">(PRO/Non-PRO)</span>
|
523 |
+
</h3>
|
524 |
+
<p>
|
525 |
+
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?
|
526 |
+
</p>
|
527 |
+
<ul class="reglist">
|
528 |
+
<li>Make sure the url is really on its own line by itself</li>
|
529 |
+
<li>Make sure the url is <strong>not</strong> an active hyperlink (i.e., it should just be plain text). Otherwise, highlight the url and click the "unlink" button in your editor: <img src="<?php echo plugins_url('images/unlink.png', __FILE__) ?>"/>.</li>
|
530 |
+
</ul>
|
531 |
+
<p>
|
532 |
+
<img class="shadow" src="<?php echo plugins_url('images/ownline.jpg', __FILE__) ?>" />
|
533 |
+
</p>
|
534 |
+
<br>
|
535 |
+
<h3>YouTube Wizard - Easily embed without memorizing codes <span class="pronon">(PRO Only)</span></h3>
|
536 |
+
<p>
|
537 |
+
Whenever you want to embed a YouTube video, simply click the PRO editor button to launch the wizard. There, you'll just paste the link to the video, click on options to personalize it, and then get the code to paste in your editor. No memorization needed.
|
538 |
+
</p>
|
539 |
+
<img src="<?php echo plugins_url('images/ssprowizard.jpg', __FILE__) ?>" >
|
540 |
+
|
541 |
+
<br>
|
542 |
+
|
543 |
+
|
544 |
+
<h3>
|
545 |
+
<?php _e("Default Options") ?> <span class="pronon">(PRO/Non-PRO)</span>
|
546 |
+
</h3>
|
547 |
+
<p>
|
548 |
+
<?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.") ?>
|
549 |
+
</p>
|
550 |
+
|
551 |
+
<div class="ytindent">
|
552 |
+
<p>
|
553 |
+
<input name="<?php echo self::$opt_center; ?>" id="<?php echo self::$opt_center; ?>" <?php checked($all[self::$opt_center], 1); ?> type="checkbox" class="checkbox">
|
554 |
+
<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>
|
555 |
+
</p>
|
556 |
+
<p>
|
557 |
+
<input name="<?php echo self::$opt_autoplay; ?>" id="<?php echo self::$opt_autoplay; ?>" <?php checked($all[self::$opt_autoplay], 1); ?> type="checkbox" class="checkbox">
|
558 |
+
<label for="<?php echo self::$opt_autoplay; ?>"><?php _e('Automatically start playing your videos') ?></label>
|
559 |
+
</p>
|
560 |
+
<p>
|
561 |
+
<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">
|
562 |
+
<label for="<?php echo self::$opt_cc_load_policy; ?>"><?php _e('Turn on closed captions by default') ?></label>
|
563 |
+
</p>
|
564 |
+
<p>
|
565 |
+
<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">
|
566 |
+
<label for="<?php echo self::$opt_iv_load_policy; ?>"><?php _e('Show annotations by default') ?></label>
|
567 |
+
</p>
|
568 |
+
<p>
|
569 |
+
<input name="<?php echo self::$opt_loop; ?>" id="<?php echo self::$opt_loop; ?>" <?php checked($all[self::$opt_loop], 1); ?> type="checkbox" class="checkbox">
|
570 |
+
<label for="<?php echo self::$opt_loop; ?>"><?php _e('Loop all your videos') ?></label>
|
571 |
+
</p>
|
572 |
+
<p>
|
573 |
+
<input name="<?php echo self::$opt_modestbranding; ?>" id="<?php echo self::$opt_modestbranding; ?>" <?php checked($all[self::$opt_modestbranding], 1); ?> type="checkbox" class="checkbox">
|
574 |
+
<label for="<?php echo self::$opt_modestbranding; ?>"><?php _e('Modest branding - hide YouTube logo while playing') ?></label>
|
575 |
+
</p>
|
576 |
+
<p>
|
577 |
+
<input name="<?php echo self::$opt_rel; ?>" id="<?php echo self::$opt_rel; ?>" <?php checked($all[self::$opt_rel], 1); ?> type="checkbox" class="checkbox">
|
578 |
+
<label for="<?php echo self::$opt_rel; ?>"><?php _e('Show related videos at the end') ?></label>
|
579 |
+
</p>
|
580 |
+
<p>
|
581 |
+
<input name="<?php echo self::$opt_showinfo; ?>" id="<?php echo self::$opt_showinfo; ?>" <?php checked($all[self::$opt_showinfo], 1); ?> type="checkbox" class="checkbox">
|
582 |
+
<label for="<?php echo self::$opt_showinfo; ?>"><?php _e('Show the video title and other info') ?></label>
|
583 |
+
</p>
|
584 |
+
<p>
|
585 |
+
<input name="<?php echo self::$opt_theme; ?>" id="<?php echo self::$opt_theme; ?>" <?php checked($all[self::$opt_theme], 'dark'); ?> type="checkbox" class="checkbox">
|
586 |
+
<label for="<?php echo self::$opt_theme; ?>"><?php _e('Use the dark theme (uncheck to use light theme)') ?></label>
|
587 |
+
</p>
|
588 |
+
<p>
|
589 |
+
<input name="<?php echo self::$opt_vq; ?>" id="<?php echo self::$opt_vq; ?>" <?php checked($all[self::$opt_vq], 'hd720'); ?> type="checkbox" class="checkbox">
|
590 |
+
<label for="<?php echo self::$opt_vq; ?>"><?php _e('Force HD quality when available') ?></label>
|
591 |
+
</p>
|
592 |
+
<p class="submit">
|
593 |
+
<input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
|
594 |
+
</p>
|
595 |
+
</div>
|
596 |
+
|
597 |
+
<h3>
|
598 |
+
<?php _e("How To Override Defaults / Other Options") ?> <span class="pronon">(PRO/Non-PRO)</span>
|
599 |
+
</h3>
|
600 |
+
<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 '&'.
|
601 |
+
<br><span class="pronon">PRO users: You can use the easier wizard instead by clicking on the <img style="width: 16px;height:16px;" src="<?php echo plugins_url('images/youtubewizard.png', __FILE__) ?>"> button in the editor.</span>
|
602 |
+
<?php
|
603 |
+
_e('<ul>');
|
604 |
+
_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>");
|
605 |
+
_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>");
|
606 |
+
_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>");
|
607 |
+
_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>");
|
608 |
+
_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>");
|
609 |
+
_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>");
|
610 |
+
_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>");
|
611 |
+
_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>");
|
612 |
+
_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>");
|
613 |
+
_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>");
|
614 |
+
_e("<li><strong>vq</strong> - Set this to 'hd720' or 'hd1080' to force the video to have HD quality. Leave blank to let YouTube decide. <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&vq=hd720</strong></em> </li>");
|
615 |
+
_e('</ul>');
|
616 |
+
|
617 |
+
_e("<p>You can also start and end each individual video at particular times. Like the above, each option should begin with '&'</p>");
|
618 |
+
_e('<ul>');
|
619 |
+
_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>");
|
620 |
+
_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>");
|
621 |
+
_e('</ul>');
|
622 |
+
?>
|
623 |
+
|
624 |
+
</form>
|
625 |
+
<br>
|
626 |
+
<h3>
|
627 |
+
Priority Support <span class="pronon">(PRO Only)</span>
|
628 |
+
</h3>
|
629 |
+
<p>
|
630 |
+
<strong>PRO users:</strong> Below, We've enabled the ability to have priority support with our team. Use this to get one-on-one help with any issues you might have or to send us suggestions for future features. We typically respond within minutes during normal work hours.
|
631 |
+
</p>
|
632 |
+
<p>
|
633 |
+
<strong>Tip for non-PRO users:</strong> We've found that a common support request has been from users that are pasting video links on single lines, as required, but are not seeing the video embed show up. One of these two suggestions is usually the fix:
|
634 |
+
<ul class="reglist">
|
635 |
+
<li>Make sure the url is really on its own line by itself</li>
|
636 |
+
<li>Make sure the url is not an active hyperlink (i.e., it should just be plain text). Otherwise, highlight the url and click the "unlink" button in your editor: <img src="<?php echo plugins_url('images/unlink.png', __FILE__) ?>"/>.</li>
|
637 |
+
</ul>
|
638 |
+
</p>
|
639 |
+
<iframe src="<?php echo self::$epbase ?>/dashboard/prosupport.aspx?simple=1&prokey=<?php echo $all[self::$opt_pro]; ?>&domain=<?php echo site_url(); ?>" width="500" height="600"></iframe>
|
640 |
+
|
641 |
+
</div>
|
642 |
+
<script type="text/javascript">
|
643 |
+
var prokeyval;
|
644 |
+
jQuery(document).ready(function($) {
|
645 |
+
|
646 |
+
jQuery('#showprokey').click(function(){
|
647 |
+
jQuery('.submitpro').show(500);
|
648 |
+
return false;
|
649 |
+
});
|
650 |
+
|
651 |
+
jQuery('#prokeysubmit').click(function(){
|
652 |
+
jQuery(this).attr('disabled', 'disabled');
|
653 |
+
jQuery('#prokeyfailed').hide();
|
654 |
+
jQuery('#prokeysuccess').hide();
|
655 |
+
jQuery('#prokeyloading').show();
|
656 |
+
prokeyval = jQuery('#opt_pro').val();
|
657 |
+
|
658 |
+
var tempscript=document.createElement("script");
|
659 |
+
tempscript.src="//www.embedplus.com/dashboard/wordpress-pro-validatejp.aspx?simple=1&prokey=" + prokeyval;
|
660 |
+
var n=document.getElementsByTagName("head")[0].appendChild(tempscript);
|
661 |
+
setTimeout(function(){
|
662 |
+
n.parentNode.removeChild(n)
|
663 |
+
},500);
|
664 |
+
return false;
|
665 |
+
});
|
666 |
+
|
667 |
+
window.embedplus_record_prokey = function(good){
|
668 |
+
|
669 |
+
jQuery.ajax({
|
670 |
+
type : "post",
|
671 |
+
dataType : "json",
|
672 |
+
timeout: 30000,
|
673 |
+
url : "<?php echo admin_url('admin-ajax.php') ?>",
|
674 |
+
data : { action: 'my_embedplus_pro_record', <?php echo self::$opt_pro; ?>: (good? prokeyval : "")},
|
675 |
+
success: function(response) {
|
676 |
+
if(response.type == "success") {
|
677 |
+
jQuery("#prokeysuccess").show();
|
678 |
+
}
|
679 |
+
else {
|
680 |
+
jQuery("#prokeyfailed").show();
|
681 |
+
}
|
682 |
+
},
|
683 |
+
error: function(xhr, ajaxOptions, thrownError){
|
684 |
+
jQuery('#prokeyfailed').show();
|
685 |
+
},
|
686 |
+
complete: function() {
|
687 |
+
jQuery('#prokeyloading').hide();
|
688 |
+
jQuery('#prokeysubmit').removeAttr('disabled');
|
689 |
+
}
|
690 |
+
|
691 |
+
});
|
692 |
+
|
693 |
+
};
|
694 |
+
|
695 |
+
});
|
696 |
+
</script>
|
697 |
+
|
698 |
+
|
699 |
+
<?php
|
700 |
+
}
|
701 |
+
|
702 |
+
public static function ytprefsscript()
|
703 |
+
{
|
704 |
+
wp_enqueue_script('__ytprefs__', plugins_url('scripts/ytprefs.min.js', __FILE__));
|
705 |
+
}
|
706 |
+
|
707 |
+
}
|
708 |
+
|
709 |
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
710 |
+
//class start
|
711 |
+
class Add_new_tinymce_btn_Youtubeprefs
|
712 |
+
{
|
713 |
+
|
714 |
+
public $btn_arr;
|
715 |
+
public $js_file;
|
716 |
+
|
717 |
+
/*
|
718 |
+
* call the constructor and set class variables
|
719 |
+
* From the constructor call the functions via wordpress action/filter
|
720 |
+
*/
|
721 |
+
|
722 |
+
function __construct($seperator, $btn_name, $javascrip_location)
|
723 |
+
{
|
724 |
+
$this->btn_arr = array("Seperator" => $seperator, "Name" => $btn_name);
|
725 |
+
$this->js_file = $javascrip_location;
|
726 |
+
add_action('init', array($this, 'add_tinymce_button'));
|
727 |
+
add_filter('tiny_mce_version', array($this, 'refresh_mce_version'));
|
728 |
+
}
|
729 |
+
|
730 |
+
/*
|
731 |
+
* create the buttons only if the user has editing privs.
|
732 |
+
* If so we create the button and add it to the tinymce button array
|
733 |
+
*/
|
734 |
+
|
735 |
+
function add_tinymce_button()
|
736 |
+
{
|
737 |
+
if (!current_user_can('edit_posts') && !current_user_can('edit_pages'))
|
738 |
+
return;
|
739 |
+
if (get_user_option('rich_editing') == 'true')
|
740 |
+
{
|
741 |
+
//the function that adds the javascript
|
742 |
+
add_filter('mce_external_plugins', array($this, 'add_new_tinymce_plugin'));
|
743 |
+
//adds the button to the tinymce button array
|
744 |
+
add_filter('mce_buttons', array($this, 'register_new_button'));
|
745 |
+
}
|
746 |
+
}
|
747 |
+
|
748 |
+
/*
|
749 |
+
* add the new button to the tinymce array
|
750 |
+
*/
|
751 |
+
|
752 |
+
function register_new_button($buttons)
|
753 |
+
{
|
754 |
+
array_push($buttons, $this->btn_arr["Seperator"], $this->btn_arr["Name"]);
|
755 |
+
return $buttons;
|
756 |
+
}
|
757 |
+
|
758 |
+
/*
|
759 |
+
* Call the javascript file that loads the
|
760 |
+
* instructions for the new button
|
761 |
+
*/
|
762 |
+
|
763 |
+
function add_new_tinymce_plugin($plugin_array)
|
764 |
+
{
|
765 |
+
$plugin_array[$this->btn_arr['Name']] = $this->js_file;
|
766 |
+
return $plugin_array;
|
767 |
+
}
|
768 |
+
|
769 |
+
/*
|
770 |
+
* This function tricks tinymce in thinking
|
771 |
+
* it needs to refresh the buttons
|
772 |
+
*/
|
773 |
+
|
774 |
+
function refresh_mce_version($ver)
|
775 |
+
{
|
776 |
+
$ver += 3;
|
777 |
+
return $ver;
|
778 |
+
}
|
779 |
+
|
780 |
+
}
|
781 |
+
|
782 |
+
//class end
|
783 |
+
|
784 |
+
|
785 |
+
register_activation_hook(__FILE__, array('YouTubePrefs', 'initoptions'));
|
786 |
+
add_action('wp_enqueue_scripts', array('YouTubePrefs', 'ytprefsscript'));
|
787 |
+
add_action("wp_ajax_my_embedplus_pro_record", array('YouTubePrefs', 'my_embedplus_pro_record'));
|
788 |
+
|
789 |
+
|
790 |
+
$youtubeplg = new YouTubePrefs();
|
791 |
+
|
792 |
+
$embedplusmce_youtubeprefs = new Add_new_tinymce_btn_Youtubeprefs('|', 'embedpluswiz_youtubeprefs', plugins_url() . '/youtube-embed-plus/scripts/embedplus_mce.js');
|
793 |
+
//$epstatsmce_youtubeprefs = new Add_new_tinymce_btn_Youtubeprefs('|', 'embedplusstats_youtubeprefs', plugins_url() . '/youtube-embed-plus/scripts/embedplusstats_mce.js');
|
794 |
+
|
795 |
+
add_action('admin_enqueue_scripts', 'youtubeprefs_admin_enqueue_scripts');
|
796 |
+
|
797 |
+
function youtubeprefs_admin_enqueue_scripts()
|
798 |
+
{
|
799 |
+
add_action('wp_print_scripts', 'youtubeprefs_output_scriptvars');
|
800 |
+
wp_enqueue_style('embedplusyoutube', plugins_url() . '/youtube-embed-plus/scripts/embedplus_mce.css');
|
801 |
+
}
|
802 |
+
|
803 |
+
function youtubeprefs_output_scriptvars()
|
804 |
+
{
|
805 |
+
$blogwidth = null;
|
806 |
+
try
|
807 |
+
{
|
808 |
+
$embed_size_w = intval(get_option('embed_size_w'));
|
809 |
+
|
810 |
+
global $content_width;
|
811 |
+
if (empty($content_width))
|
812 |
+
$content_width = $GLOBALS['content_width'];
|
813 |
+
if (empty($content_width))
|
814 |
+
$content_width = $_GLOBALS['content_width'];
|
815 |
+
|
816 |
+
$blogwidth = $embed_size_w ? $embed_size_w : ($content_width ? $content_width : 450);
|
817 |
+
}
|
818 |
+
catch (Exception $ex)
|
819 |
+
{
|
820 |
+
|
821 |
+
}
|
822 |
+
|
823 |
+
$epprokey = YouTubePrefs::$alloptions[YouTubePrefs::$opt_pro];
|
824 |
+
|
825 |
+
$myytdefaults = http_build_query(YouTubePrefs::$alloptions);
|
826 |
+
?>
|
827 |
+
<script type="text/javascript">
|
828 |
+
var epblogwidth = <?php echo $blogwidth; ?>;
|
829 |
+
var epprokey = '<?php echo $epprokey; ?>';
|
830 |
+
var epbasesite = '<?php echo YouTubePrefs::$epbase; ?>';
|
831 |
+
var epversion = '<?php echo YouTubePrefs::$version; ?>';
|
832 |
+
var myytdefaults = '<?php echo $myytdefaults; ?>';
|
833 |
+
</script>
|
834 |
+
<?php
|
835 |
+
}
|