Version Description
Download this release
Release Info
Developer | embedplus |
Plugin | YouTube |
Version | 3.2 |
Comparing to | |
See all releases |
Version 3.2
- 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/erase.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 +124 -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 +849 -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/erase.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,124 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
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.2
|
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 Visual YouTube Wizard
|
74 |
+
|
75 |
+
== Changelog ==
|
76 |
+
|
77 |
+
= YouTube Embed 3.2 =
|
78 |
+
Ensures video-specific height overrides defaults properly
|
79 |
+
|
80 |
+
= YouTube Embed 3.1 =
|
81 |
+
Fixed obscure height problem
|
82 |
+
|
83 |
+
= YouTube Embed 3.0 =
|
84 |
+
Added Visual YouTube Wizard for PRO users
|
85 |
+
Added autologin to analytics for PRO users
|
86 |
+
Added priority support form for PRO users
|
87 |
+
|
88 |
+
= YouTube Embed 2.6 =
|
89 |
+
Compatible with WP 3.6
|
90 |
+
|
91 |
+
= YouTube Embed 2.4 =
|
92 |
+
Added auto HD support
|
93 |
+
Support for shorthand (i.e. `http://www.youtu.be`)
|
94 |
+
Fixed editor issue
|
95 |
+
|
96 |
+
= YouTube Embed 2.3 =
|
97 |
+
Start/end time shortcut bug fix
|
98 |
+
|
99 |
+
= YouTube Embed 2.2 =
|
100 |
+
Minor changes
|
101 |
+
|
102 |
+
= YouTube Embed 2.1 =
|
103 |
+
By request from several users, we've added easier access to the video analytics dashboard
|
104 |
+
|
105 |
+
= YouTube Embed 2.0 =
|
106 |
+
|
107 |
+
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:
|
108 |
+
|
109 |
+
* How much are your visitors actually watching the videos you post?
|
110 |
+
* How does the view activity on your site compare to other sites like it?
|
111 |
+
* What and when are your best and worst performers?
|
112 |
+
* How much do the producers of the YouTube videos you embed rely on **your site** for views?
|
113 |
+
|
114 |
+
We think these are all interesting questions; however, note that there's no need to upgrade if you don't.
|
115 |
+
|
116 |
+
= YouTube Embed 1.1 =
|
117 |
+
Fixed minor bug.
|
118 |
+
|
119 |
+
= YouTube Embed 1.0 =
|
120 |
+
First release uploaded to the plugin repository.
|
121 |
+
|
122 |
+
== Other Notes ==
|
123 |
+
|
124 |
+
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 : 'Visual 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 : "Visual 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 : "Visual 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,849 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
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
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: YouTube
|
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: 3.2
|
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.2';
|
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 = $urlkvp['height'] ? $urlkvp['height'] + 30 : self::get_aspect_height($url, $urlkvp);
|
281 |
+
}
|
282 |
+
}
|
283 |
+
|
284 |
+
public static function get_aspect_height($url, $urlkvp)
|
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::$defaultwidth; //square to get biggest height from width // 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: 0px 20px 20px 20px; margin-top: 15px; border: 3px solid #dddddd; width: 670px;}
|
450 |
+
.pronon {font-weight: bold; color: #f85d00;}
|
451 |
+
ul.reglist li {margin-left: 30px; list-style: disc outside none;}
|
452 |
+
.procol {width: 400px; float: left;}
|
453 |
+
</style>
|
454 |
+
|
455 |
+
<div class="ytindent">
|
456 |
+
|
457 |
+
<div id="goprobox">
|
458 |
+
|
459 |
+
<?php
|
460 |
+
$haspro = ($all[self::$opt_pro] && strlen(trim($all[self::$opt_pro])) > 0);
|
461 |
+
|
462 |
+
if ($haspro)
|
463 |
+
{
|
464 |
+
echo "<h3>" . __('Thank you for going PRO.');
|
465 |
+
echo ' <input type="submit" name="showkey" class="button-primary" style="vertical-align: 15%;" id="showprokey" value="Show my PRO key" />';
|
466 |
+
echo "</h3>";
|
467 |
+
?>
|
468 |
+
<?php
|
469 |
+
}
|
470 |
+
else
|
471 |
+
{
|
472 |
+
?>
|
473 |
+
|
474 |
+
<h3>
|
475 |
+
Go PRO
|
476 |
+
</h3>
|
477 |
+
|
478 |
+
<div class="procol">
|
479 |
+
<ul class="gopro">
|
480 |
+
<li>
|
481 |
+
<img src="<?php echo plugins_url('images/youtubewizard.png', __FILE__) ?>">
|
482 |
+
Visual YouTube Wizard - Easily embed without memorizing codes
|
483 |
+
</li>
|
484 |
+
<li>
|
485 |
+
<img src="<?php echo plugins_url('images/prioritysupport.png', __FILE__) ?>">
|
486 |
+
Priority support (Puts your request in front)
|
487 |
+
</li>
|
488 |
+
<li>
|
489 |
+
<img src="<?php echo plugins_url('images/bulletgraph45.png', __FILE__) ?>">
|
490 |
+
Your own video analytics dashboard
|
491 |
+
</li>
|
492 |
+
</ul>
|
493 |
+
</div>
|
494 |
+
<div class="procol" style="width: 260px;">
|
495 |
+
<ul class="gopro">
|
496 |
+
<li>
|
497 |
+
<img src="<?php echo plugins_url('images/infinity.png', __FILE__) ?>">
|
498 |
+
Unlimited PRO upgrades and downloads
|
499 |
+
</li>
|
500 |
+
<li>
|
501 |
+
<img src="<?php echo plugins_url('images/questionsale.png', __FILE__) ?>">
|
502 |
+
What else? You tell us!
|
503 |
+
</li>
|
504 |
+
<li>
|
505 |
+
<a href="<?php echo self::$epbase ?>/dashboard/pro-easy-video-analytics.aspx" class="button-primary" target="_blank">Click here to go PRO »</a>
|
506 |
+
</li>
|
507 |
+
</ul>
|
508 |
+
</div>
|
509 |
+
<br>
|
510 |
+
<br>
|
511 |
+
<div style="clear: both;"></div>
|
512 |
+
<h3>Enter and save your PRO key (emailed to you):</h3>
|
513 |
+
<?php } ?>
|
514 |
+
<form name="form2" method="post" action="" id="epform2" class="submitpro" <?php if ($haspro) echo 'style="display: none;"' ?>>
|
515 |
+
<input type="hidden" name="<?php echo $pro_submitted; ?>" value="Y">
|
516 |
+
|
517 |
+
<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">
|
518 |
+
<input type="submit" name="Submit" class="button-primary" id="prokeysubmit" value="<?php _e('Save Key') ?>" />
|
519 |
+
<br>
|
520 |
+
<span style="display: none;" id="prokeyloading" class="orange bold">Verifying...</span>
|
521 |
+
<span class="orange bold" style="display: none;" id="prokeysuccess">Success! Please refresh this page.</span>
|
522 |
+
<span class="orange bold" style="display: none;" id="prokeyfailed">Sorry, that seems to be an invalid key.</span>
|
523 |
+
|
524 |
+
</form>
|
525 |
+
|
526 |
+
</div>
|
527 |
+
<br>
|
528 |
+
<form name="form1" method="post" action="" id="ytform">
|
529 |
+
<input type="hidden" name="<?php echo $ytprefs_submitted; ?>" value="Y">
|
530 |
+
<h3>
|
531 |
+
<?php _e("How to Insert a YouTube Video") ?> <span class="pronon">(For all users - PRO/Free)</span>
|
532 |
+
</h3>
|
533 |
+
<p>
|
534 |
+
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?
|
535 |
+
</p>
|
536 |
+
<ul class="reglist">
|
537 |
+
<li>Make sure the url is really on its own line by itself</li>
|
538 |
+
<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>
|
539 |
+
<li>Make sure you did <strong>not</strong> format or align the url in any way. If your url still appears in your actual post instead of a video, highlight it and click the "remove formatting" button (formatting can be invisible sometimes): <img src="<?php echo plugins_url('images/erase.png', __FILE__) ?>"/></li>
|
540 |
+
</ul>
|
541 |
+
<p>
|
542 |
+
<img class="shadow" src="<?php echo plugins_url('images/ownline.jpg', __FILE__) ?>" />
|
543 |
+
</p>
|
544 |
+
<br>
|
545 |
+
|
546 |
+
|
547 |
+
|
548 |
+
<h3>Visual YouTube Wizard - Easily embed without memorizing special codes <span class="pronon">(PRO Only)</span></h3>
|
549 |
+
<p>
|
550 |
+
Whenever you want to embed a YouTube video with more than the default settings, simply click the PRO editor button <img style="width: 16px;height:16px;" src="<?php echo plugins_url('images/youtubewizard.png', __FILE__) ?>"> 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.
|
551 |
+
</p>
|
552 |
+
<img src="<?php echo plugins_url('images/ssprowizard.jpg', __FILE__) ?>" >
|
553 |
+
|
554 |
+
<br>
|
555 |
+
|
556 |
+
|
557 |
+
<h3>
|
558 |
+
<?php _e("Default Options") ?> <span class="pronon">(For all users - PRO/Free)</span>
|
559 |
+
</h3>
|
560 |
+
<p>
|
561 |
+
<?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.") ?>
|
562 |
+
</p>
|
563 |
+
|
564 |
+
<div class="ytindent">
|
565 |
+
<p>
|
566 |
+
<input name="<?php echo self::$opt_center; ?>" id="<?php echo self::$opt_center; ?>" <?php checked($all[self::$opt_center], 1); ?> type="checkbox" class="checkbox">
|
567 |
+
<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>
|
568 |
+
</p>
|
569 |
+
<p>
|
570 |
+
<input name="<?php echo self::$opt_autoplay; ?>" id="<?php echo self::$opt_autoplay; ?>" <?php checked($all[self::$opt_autoplay], 1); ?> type="checkbox" class="checkbox">
|
571 |
+
<label for="<?php echo self::$opt_autoplay; ?>"><?php _e('Automatically start playing your videos') ?></label>
|
572 |
+
</p>
|
573 |
+
<p>
|
574 |
+
<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">
|
575 |
+
<label for="<?php echo self::$opt_cc_load_policy; ?>"><?php _e('Turn on closed captions by default') ?></label>
|
576 |
+
</p>
|
577 |
+
<p>
|
578 |
+
<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">
|
579 |
+
<label for="<?php echo self::$opt_iv_load_policy; ?>"><?php _e('Show annotations by default') ?></label>
|
580 |
+
</p>
|
581 |
+
<p>
|
582 |
+
<input name="<?php echo self::$opt_loop; ?>" id="<?php echo self::$opt_loop; ?>" <?php checked($all[self::$opt_loop], 1); ?> type="checkbox" class="checkbox">
|
583 |
+
<label for="<?php echo self::$opt_loop; ?>"><?php _e('Loop all your videos') ?></label>
|
584 |
+
</p>
|
585 |
+
<p>
|
586 |
+
<input name="<?php echo self::$opt_modestbranding; ?>" id="<?php echo self::$opt_modestbranding; ?>" <?php checked($all[self::$opt_modestbranding], 1); ?> type="checkbox" class="checkbox">
|
587 |
+
<label for="<?php echo self::$opt_modestbranding; ?>"><?php _e('Modest branding - hide YouTube logo while playing') ?></label>
|
588 |
+
</p>
|
589 |
+
<p>
|
590 |
+
<input name="<?php echo self::$opt_rel; ?>" id="<?php echo self::$opt_rel; ?>" <?php checked($all[self::$opt_rel], 1); ?> type="checkbox" class="checkbox">
|
591 |
+
<label for="<?php echo self::$opt_rel; ?>"><?php _e('Show related videos at the end') ?></label>
|
592 |
+
</p>
|
593 |
+
<p>
|
594 |
+
<input name="<?php echo self::$opt_showinfo; ?>" id="<?php echo self::$opt_showinfo; ?>" <?php checked($all[self::$opt_showinfo], 1); ?> type="checkbox" class="checkbox">
|
595 |
+
<label for="<?php echo self::$opt_showinfo; ?>"><?php _e('Show the video title and other info') ?></label>
|
596 |
+
</p>
|
597 |
+
<p>
|
598 |
+
<input name="<?php echo self::$opt_theme; ?>" id="<?php echo self::$opt_theme; ?>" <?php checked($all[self::$opt_theme], 'dark'); ?> type="checkbox" class="checkbox">
|
599 |
+
<label for="<?php echo self::$opt_theme; ?>"><?php _e('Use the dark theme (uncheck to use light theme)') ?></label>
|
600 |
+
</p>
|
601 |
+
<p>
|
602 |
+
<input name="<?php echo self::$opt_vq; ?>" id="<?php echo self::$opt_vq; ?>" <?php checked($all[self::$opt_vq], 'hd720'); ?> type="checkbox" class="checkbox">
|
603 |
+
<label for="<?php echo self::$opt_vq; ?>"><?php _e('Force HD quality when available') ?></label>
|
604 |
+
</p>
|
605 |
+
<p class="submit">
|
606 |
+
<input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
|
607 |
+
</p>
|
608 |
+
</div>
|
609 |
+
|
610 |
+
<h3>
|
611 |
+
<?php _e("How To Override Defaults / Other Options") ?> <span class="pronon">(For all users - PRO/Free)</span>
|
612 |
+
</h3>
|
613 |
+
<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 '&'.
|
614 |
+
<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>
|
615 |
+
<?php
|
616 |
+
_e('<ul>');
|
617 |
+
_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>");
|
618 |
+
_e("<li><strong>height</strong> - Sets the height of your player. We do not recommend setting height because best-height will be calculated for you automatically, based on the above height. <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA&width=500<strong>&height=350</strong></em> </li>");
|
619 |
+
_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>");
|
620 |
+
_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>");
|
621 |
+
_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>");
|
622 |
+
_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>");
|
623 |
+
_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>");
|
624 |
+
_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>");
|
625 |
+
_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>");
|
626 |
+
_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>");
|
627 |
+
_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>");
|
628 |
+
_e('</ul>');
|
629 |
+
|
630 |
+
_e("<p>You can also start and end each individual video at particular times. Like the above, each option should begin with '&'</p>");
|
631 |
+
_e('<ul>');
|
632 |
+
_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>");
|
633 |
+
_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>");
|
634 |
+
_e('</ul>');
|
635 |
+
?>
|
636 |
+
|
637 |
+
</form>
|
638 |
+
<br>
|
639 |
+
<h3>
|
640 |
+
Priority Support <span class="pronon">(PRO Only)</span>
|
641 |
+
</h3>
|
642 |
+
<p>
|
643 |
+
<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.
|
644 |
+
</p>
|
645 |
+
<p>
|
646 |
+
<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:
|
647 |
+
<ul class="reglist">
|
648 |
+
<li>Make sure the url is really on its own line by itself</li>
|
649 |
+
<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>
|
650 |
+
<li>Make sure you did <strong>not</strong> format or align the url in any way. If your url still appears in your actual post instead of a video, highlight it and click the "remove formatting" button (formatting can be invisible sometimes): <img src="<?php echo plugins_url('images/erase.png', __FILE__) ?>"/></li>
|
651 |
+
</ul>
|
652 |
+
</p>
|
653 |
+
<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>
|
654 |
+
|
655 |
+
</div>
|
656 |
+
<script type="text/javascript">
|
657 |
+
var prokeyval;
|
658 |
+
jQuery(document).ready(function($) {
|
659 |
+
|
660 |
+
jQuery('#showprokey').click(function(){
|
661 |
+
jQuery('.submitpro').show(500);
|
662 |
+
return false;
|
663 |
+
});
|
664 |
+
|
665 |
+
jQuery('#prokeysubmit').click(function(){
|
666 |
+
jQuery(this).attr('disabled', 'disabled');
|
667 |
+
jQuery('#prokeyfailed').hide();
|
668 |
+
jQuery('#prokeysuccess').hide();
|
669 |
+
jQuery('#prokeyloading').show();
|
670 |
+
prokeyval = jQuery('#opt_pro').val();
|
671 |
+
|
672 |
+
var tempscript=document.createElement("script");
|
673 |
+
tempscript.src="//www.embedplus.com/dashboard/wordpress-pro-validatejp.aspx?simple=1&prokey=" + prokeyval;
|
674 |
+
var n=document.getElementsByTagName("head")[0].appendChild(tempscript);
|
675 |
+
setTimeout(function(){
|
676 |
+
n.parentNode.removeChild(n)
|
677 |
+
},500);
|
678 |
+
return false;
|
679 |
+
});
|
680 |
+
|
681 |
+
window.embedplus_record_prokey = function(good){
|
682 |
+
|
683 |
+
jQuery.ajax({
|
684 |
+
type : "post",
|
685 |
+
dataType : "json",
|
686 |
+
timeout: 30000,
|
687 |
+
url : "<?php echo admin_url('admin-ajax.php') ?>",
|
688 |
+
data : { action: 'my_embedplus_pro_record', <?php echo self::$opt_pro; ?>: (good? prokeyval : "")},
|
689 |
+
success: function(response) {
|
690 |
+
if(response.type == "success") {
|
691 |
+
jQuery("#prokeysuccess").show();
|
692 |
+
}
|
693 |
+
else {
|
694 |
+
jQuery("#prokeyfailed").show();
|
695 |
+
}
|
696 |
+
},
|
697 |
+
error: function(xhr, ajaxOptions, thrownError){
|
698 |
+
jQuery('#prokeyfailed').show();
|
699 |
+
},
|
700 |
+
complete: function() {
|
701 |
+
jQuery('#prokeyloading').hide();
|
702 |
+
jQuery('#prokeysubmit').removeAttr('disabled');
|
703 |
+
}
|
704 |
+
|
705 |
+
});
|
706 |
+
|
707 |
+
};
|
708 |
+
|
709 |
+
});
|
710 |
+
</script>
|
711 |
+
|
712 |
+
|
713 |
+
<?php
|
714 |
+
}
|
715 |
+
|
716 |
+
public static function ytprefsscript()
|
717 |
+
{
|
718 |
+
wp_enqueue_script('__ytprefs__', plugins_url('scripts/ytprefs.min.js', __FILE__));
|
719 |
+
}
|
720 |
+
|
721 |
+
}
|
722 |
+
|
723 |
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
724 |
+
//class start
|
725 |
+
class Add_new_tinymce_btn_Youtubeprefs
|
726 |
+
{
|
727 |
+
|
728 |
+
public $btn_arr;
|
729 |
+
public $js_file;
|
730 |
+
|
731 |
+
/*
|
732 |
+
* call the constructor and set class variables
|
733 |
+
* From the constructor call the functions via wordpress action/filter
|
734 |
+
*/
|
735 |
+
|
736 |
+
function __construct($seperator, $btn_name, $javascrip_location)
|
737 |
+
{
|
738 |
+
$this->btn_arr = array("Seperator" => $seperator, "Name" => $btn_name);
|
739 |
+
$this->js_file = $javascrip_location;
|
740 |
+
add_action('init', array($this, 'add_tinymce_button'));
|
741 |
+
add_filter('tiny_mce_version', array($this, 'refresh_mce_version'));
|
742 |
+
}
|
743 |
+
|
744 |
+
/*
|
745 |
+
* create the buttons only if the user has editing privs.
|
746 |
+
* If so we create the button and add it to the tinymce button array
|
747 |
+
*/
|
748 |
+
|
749 |
+
function add_tinymce_button()
|
750 |
+
{
|
751 |
+
if (!current_user_can('edit_posts') && !current_user_can('edit_pages'))
|
752 |
+
return;
|
753 |
+
if (get_user_option('rich_editing') == 'true')
|
754 |
+
{
|
755 |
+
//the function that adds the javascript
|
756 |
+
add_filter('mce_external_plugins', array($this, 'add_new_tinymce_plugin'));
|
757 |
+
//adds the button to the tinymce button array
|
758 |
+
add_filter('mce_buttons', array($this, 'register_new_button'));
|
759 |
+
}
|
760 |
+
}
|
761 |
+
|
762 |
+
/*
|
763 |
+
* add the new button to the tinymce array
|
764 |
+
*/
|
765 |
+
|
766 |
+
function register_new_button($buttons)
|
767 |
+
{
|
768 |
+
array_push($buttons, $this->btn_arr["Seperator"], $this->btn_arr["Name"]);
|
769 |
+
return $buttons;
|
770 |
+
}
|
771 |
+
|
772 |
+
/*
|
773 |
+
* Call the javascript file that loads the
|
774 |
+
* instructions for the new button
|
775 |
+
*/
|
776 |
+
|
777 |
+
function add_new_tinymce_plugin($plugin_array)
|
778 |
+
{
|
779 |
+
$plugin_array[$this->btn_arr['Name']] = $this->js_file;
|
780 |
+
return $plugin_array;
|
781 |
+
}
|
782 |
+
|
783 |
+
/*
|
784 |
+
* This function tricks tinymce in thinking
|
785 |
+
* it needs to refresh the buttons
|
786 |
+
*/
|
787 |
+
|
788 |
+
function refresh_mce_version($ver)
|
789 |
+
{
|
790 |
+
$ver += 3;
|
791 |
+
return $ver;
|
792 |
+
}
|
793 |
+
|
794 |
+
}
|
795 |
+
|
796 |
+
//class end
|
797 |
+
|
798 |
+
|
799 |
+
register_activation_hook(__FILE__, array('YouTubePrefs', 'initoptions'));
|
800 |
+
add_action('wp_enqueue_scripts', array('YouTubePrefs', 'ytprefsscript'));
|
801 |
+
add_action("wp_ajax_my_embedplus_pro_record", array('YouTubePrefs', 'my_embedplus_pro_record'));
|
802 |
+
|
803 |
+
|
804 |
+
$youtubeplg = new YouTubePrefs();
|
805 |
+
|
806 |
+
$embedplusmce_youtubeprefs = new Add_new_tinymce_btn_Youtubeprefs('|', 'embedpluswiz_youtubeprefs', plugins_url() . '/youtube-embed-plus/scripts/embedplus_mce.js');
|
807 |
+
//$epstatsmce_youtubeprefs = new Add_new_tinymce_btn_Youtubeprefs('|', 'embedplusstats_youtubeprefs', plugins_url() . '/youtube-embed-plus/scripts/embedplusstats_mce.js');
|
808 |
+
|
809 |
+
add_action('admin_enqueue_scripts', 'youtubeprefs_admin_enqueue_scripts');
|
810 |
+
|
811 |
+
function youtubeprefs_admin_enqueue_scripts()
|
812 |
+
{
|
813 |
+
add_action('wp_print_scripts', 'youtubeprefs_output_scriptvars');
|
814 |
+
wp_enqueue_style('embedplusyoutube', plugins_url() . '/youtube-embed-plus/scripts/embedplus_mce.css');
|
815 |
+
}
|
816 |
+
|
817 |
+
function youtubeprefs_output_scriptvars()
|
818 |
+
{
|
819 |
+
$blogwidth = null;
|
820 |
+
try
|
821 |
+
{
|
822 |
+
$embed_size_w = intval(get_option('embed_size_w'));
|
823 |
+
|
824 |
+
global $content_width;
|
825 |
+
if (empty($content_width))
|
826 |
+
$content_width = $GLOBALS['content_width'];
|
827 |
+
if (empty($content_width))
|
828 |
+
$content_width = $_GLOBALS['content_width'];
|
829 |
+
|
830 |
+
$blogwidth = $embed_size_w ? $embed_size_w : ($content_width ? $content_width : 450);
|
831 |
+
}
|
832 |
+
catch (Exception $ex)
|
833 |
+
{
|
834 |
+
|
835 |
+
}
|
836 |
+
|
837 |
+
$epprokey = YouTubePrefs::$alloptions[YouTubePrefs::$opt_pro];
|
838 |
+
|
839 |
+
$myytdefaults = http_build_query(YouTubePrefs::$alloptions);
|
840 |
+
?>
|
841 |
+
<script type="text/javascript">
|
842 |
+
var epblogwidth = <?php echo $blogwidth; ?>;
|
843 |
+
var epprokey = '<?php echo $epprokey; ?>';
|
844 |
+
var epbasesite = '<?php echo YouTubePrefs::$epbase; ?>';
|
845 |
+
var epversion = '<?php echo YouTubePrefs::$version; ?>';
|
846 |
+
var myytdefaults = '<?php echo $myytdefaults; ?>';
|
847 |
+
</script>
|
848 |
+
<?php
|
849 |
+
}
|