YouTube - Version 4.1

Version Description

Download this release

Release Info

Developer embedplus
Plugin Icon 128x128 YouTube
Version 4.1
Comparing to
See all releases

Version 4.1

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/deletechecker.png ADDED
Binary file
images/epstats16.png ADDED
Binary file
images/erase.png ADDED
Binary file
images/hideget.jpg ADDED
Binary file
images/html5.png ADDED
Binary file
images/infinity.png ADDED
Binary file
images/lock.png ADDED
Binary file
images/ownline.jpg ADDED
Binary file
images/prioritysupport.png ADDED
Binary file
images/questionsale.png ADDED
Binary file
images/ssprowizard-th.jpg 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,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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, https, ssl, secure, no-cookie, cookie, html5, youtube html5
5
+ Requires at least: 2.9
6
+ Tested up to: 3.6.1
7
+ Stable tag: 4.1
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 keeps things simple, but it can be upgraded for enhanced performance, privacy and security for you and your visitors. It provides the basic features of the YouTube embedded player and will have you posting videos in seconds after installing it. **All you have to do is simply paste an unformatted YouTube link on its own line.** Your YouTube embed will then show up when you preview or publish the post. The settings page has plenty of default options that you can automatically apply to all your embedded YouTube videos. Customizations can be also made to each YouTube embed by adding more to the link as shown below:
15
+
16
+ * 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`
17
+ * 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`
18
+ * 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`
19
+ * 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`
20
+ * 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`
21
+ * 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`
22
+ * loop - Set this to 1 to loop the video (or 0 to not loop). Example: `http://www.youtube.com/watch?v=quwebVjAEJA&loop=1`
23
+ * 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`
24
+ * 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`
25
+ * 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`
26
+ * 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`
27
+
28
+ You can also start and end each individual video at particular times. Like the above, each option should begin with '&'
29
+
30
+ * start - Sets the time (in seconds) to start the video. Example: `http://www.youtube.com/watch?v=quwebVjAEJA&width=500&height=350&start=20`
31
+ * end - Sets the time (in seconds) to stop the video. Example: `http://www.youtube.com/watch?v=quwebVjAEJA&width=500&height=350&end=100`
32
+
33
+ Beyond the above features, you have the option of upgrading to PRO to add enhanced features like a visual embedding wizard (so you can avoid memorizing codes), priority support, and security/performance. PRO users also get **warnings you when YouTube has deleted one of your recent popular videos that you've embedded**. You even get an embedder-centric analytics dashboard that adds view tracking to each of your embeds so that you can answers questions like:
34
+
35
+ * How much are your visitors actually watching the videos you post?
36
+ * How does the view activity on your site compare to other sites like it?
37
+ * What and when are your best and worst performing YouTube embeds?
38
+ * How much do the producers of the YouTube videos you embed rely on **your site**, versus other sites and YouTube.com, for views?
39
+
40
+ See more details after installing. Enjoy!
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/pro-easy-video-analytics.aspx)
49
+
50
+ Always follow these rules when pasting a link:
51
+
52
+ * Make sure the url is really on its own line by itself.
53
+ * 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.
54
+ * Make sure you did **not** 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).
55
+ * Finally, there's a slight chance your custom theme is the issue, if you have one. To know for sure, we suggest temporarily switching to one of the default WordPress themes (e.g., "Twenty Thirteen") just to see if your video does appear. If it suddenly works, then your custom theme is the issue. You can switch back when done testing.
56
+
57
+ Additional codes (adding these will override the default settings in the admin):
58
+
59
+ * 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`
60
+ * 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`
61
+ * 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`
62
+ * 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`
63
+ * 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`
64
+ * 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`
65
+ * loop - Set this to 1 to loop the video (or 0 to not loop). Example: `http://www.youtube.com/watch?v=quwebVjAEJA&loop=1`
66
+ * 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`
67
+ * 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`
68
+ * 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`
69
+ * 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`
70
+
71
+ You can also start and end each individual video at particular times. Like the above, each option should begin with '&'
72
+
73
+ * start - Sets the time (in seconds) to start the video. Example: `http://www.youtube.com/watch?v=quwebVjAEJA&width=500&height=350&start=20`
74
+ * end - Sets the time (in seconds) to stop the video. Example: `http://www.youtube.com/watch?v=quwebVjAEJA&width=500&height=350&end=100`
75
+
76
+ == Screenshots ==
77
+
78
+ 1. YouTube Embed Screenshot 1: Paste a YouTube link on its own line and it will become a YouTube embed on your website.
79
+ 2. YouTube Embed Screenshot 2: YouTube's admin settings.
80
+ 3. YouTube Embed Screenshot 3: PRO Visual YouTube Wizard
81
+
82
+ == Changelog ==
83
+
84
+ = YouTube Embed 4.1 =
85
+ Fixed spacing issue. Also added ability to fall back to old spacing format.
86
+
87
+ = YouTube Embed 4.0 =
88
+ New features for all users: lazy loading for the flash player by default and the ability to hide player controls for a cleaner look.
89
+
90
+ = YouTube Embed 3.7 =
91
+ Enhanced deleted video checker for PRO users
92
+
93
+ = YouTube Embed 3.5 =
94
+ Added ability to try to force HTML5 player to speed up page loading
95
+
96
+ = YouTube Embed 3.3 =
97
+ HTTPS: Added secure YouTube embedding for PRO users
98
+
99
+ = YouTube Embed 3.2 =
100
+ Ensures video-specific height overrides defaults properly
101
+
102
+ = YouTube Embed 3.1 =
103
+ Fixed obscure height problem
104
+
105
+ = YouTube Embed 3.0 =
106
+ Added Visual YouTube Wizard for PRO users
107
+ Added autologin to analytics for PRO users
108
+ Added priority support form for PRO users
109
+
110
+ = YouTube Embed 2.6 =
111
+ Compatible with WP 3.6
112
+
113
+ = YouTube Embed 2.4 =
114
+ Added auto HD support
115
+ Support for shorthand (i.e. `http://www.youtu.be`)
116
+ Fixed editor issue
117
+
118
+ = YouTube Embed 2.3 =
119
+ Start/end time shortcut bug fix
120
+
121
+ = YouTube Embed 2.2 =
122
+ Minor changes
123
+
124
+ = YouTube Embed 2.1 =
125
+ By request from several users, we've added easier access to the video analytics dashboard
126
+
127
+ = YouTube Embed 2.0 =
128
+
129
+ 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:
130
+
131
+ * How much are your visitors actually watching the videos you post?
132
+ * How does the view activity on your site compare to other sites like it?
133
+ * What and when are your best and worst performers?
134
+ * How much do the producers of the YouTube videos you embed rely on **your site** for views?
135
+
136
+ We think these are all interesting questions; however, note that there's no need to upgrade if you don't.
137
+
138
+ = YouTube Embed 1.1 =
139
+ Fixed minor bug.
140
+
141
+ = YouTube Embed 1.0 =
142
+ First release uploaded to the plugin repository.
143
+
144
+ == Other Notes ==
145
+
146
+ This YouTube plugin includes [YouTube embed analytics](https://www.embedplus.com/dashboard/pro-easy-video-analytics.aspx) to help you learn a lot about the videos you post.
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,1028 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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: 4.1
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 = '4.1';
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_controls = 'controls';
50
+ public static $opt_theme = 'theme';
51
+ public static $opt_vq = 'vq';
52
+ public static $opt_html5 = 'html5';
53
+ public static $opt_ssl = 'ssl';
54
+ public static $opt_nocookie = 'nocookie';
55
+ public static $opt_pro = 'pro';
56
+ public static $opt_oldspacing = 'oldspacing';
57
+ public static $opt_alloptions = 'youtubeprefs_alloptions';
58
+ public static $alloptions = null;
59
+ public static $yt_options = array();
60
+ //public static $epbase = 'http://localhost:2346';
61
+ public static $epbase = 'http://www.embedplus.com';
62
+ /*
63
+ color
64
+ autohide
65
+ list
66
+ listType
67
+ playlist
68
+ */
69
+ ///////////////////////////////////////////////////////////////////////////////////////////////////
70
+ ///////////////////////////////////////////////////////////////////////////////////////////////////
71
+ ///////////////////////////////////////////////////////////////////////////////////////////////////
72
+ ///////////////////////////////////////////////////////////////////////////////////////////////////
73
+ ///////////////////////////////////////////////////////////////////////////////////////////////////
74
+ public static $oldytregex = '@^\s*https?://(?:www\.)?(?:(?:youtube.com/watch\?)|(?:youtu.be/))([^\s"]+)\s*$@im';
75
+ public static $ytregex = '@^[\r\n]{0,1}[[:blank:]]*https?://(?:www\.)?(?:(?:youtube.com/watch\?)|(?:youtu.be/))([^\s"]+)[[:blank:]]*[\r\n]{0,1}$@im';
76
+
77
+ ///////////////////////////////////////////////////////////////////////////////////////////////////
78
+ ///////////////////////////////////////////////////////////////////////////////////////////////////
79
+ ///////////////////////////////////////////////////////////////////////////////////////////////////
80
+ ///////////////////////////////////////////////////////////////////////////////////////////////////
81
+ ///////////////////////////////////////////////////////////////////////////////////////////////////
82
+ ///////////////////////////////////////////////////////////////////////////////////////////////////
83
+
84
+ public function __construct()
85
+ {
86
+ self::$alloptions = get_option(self::$opt_alloptions);
87
+ if (self::$alloptions == false || version_compare(self::$alloptions[self::$opt_version], self::$version, '<'))
88
+ {
89
+ self::initoptions();
90
+ }
91
+
92
+ if (self::$alloptions[self::$opt_oldspacing] == 1)
93
+ {
94
+ self::$ytregex = self::$oldytregex;
95
+ }
96
+
97
+ self::$optembedwidth = intval(get_option('embed_size_w'));
98
+ self::$optembedheight = intval(get_option('embed_size_h'));
99
+
100
+ self::$yt_options = array(
101
+ self::$opt_autoplay,
102
+ self::$opt_cc_load_policy,
103
+ self::$opt_iv_load_policy,
104
+ self::$opt_loop,
105
+ self::$opt_modestbranding,
106
+ self::$opt_rel,
107
+ self::$opt_showinfo,
108
+ self::$opt_controls,
109
+ self::$opt_html5,
110
+ self::$opt_theme,
111
+ self::$opt_vq,
112
+ 'start',
113
+ 'end'
114
+ );
115
+
116
+ self::do_ytprefs();
117
+ add_action('admin_menu', 'YouTubePrefs::ytprefs_plugin_menu');
118
+ }
119
+
120
+ static function initoptions()
121
+ {
122
+ $_center = 0;
123
+ $_autoplay = get_option('youtubeprefs_autoplay', 0);
124
+ $_cc_load_policy = get_option('youtubeprefs_cc_load_policy', 0);
125
+ $_iv_load_policy = get_option('youtubeprefs_iv_load_policy', 1);
126
+ $_loop = get_option('youtubeprefs_loop', 0);
127
+ $_modestbranding = get_option('youtubeprefs_modestbranding', 0);
128
+ $_rel = get_option('youtubeprefs_rel', 1);
129
+ $_showinfo = get_option('youtubeprefs_showinfo', 1);
130
+ $_html5 = get_option('youtubeprefs_html5', 0);
131
+ $_theme = get_option('youtubeprefs_theme', 'dark');
132
+ $_vq = get_option('youtubeprefs_vq', '');
133
+ $_pro = '';
134
+ $_ssl = 0;
135
+ $_nocookie = 0;
136
+ $_controls = 2;
137
+ $_oldspacing = 1;
138
+
139
+ $arroptions = get_option(self::$opt_alloptions);
140
+
141
+ if ($arroptions !== false)
142
+ {
143
+ $_center = self::tryget($arroptions, self::$opt_center, 0);
144
+ $_autoplay = self::tryget($arroptions, self::$opt_autoplay, 0);
145
+ $_cc_load_policy = self::tryget($arroptions, self::$opt_cc_load_policy, 0);
146
+ $_iv_load_policy = self::tryget($arroptions, self::$opt_iv_load_policy, 1);
147
+ $_loop = self::tryget($arroptions, self::$opt_loop, 0);
148
+ $_modestbranding = self::tryget($arroptions, self::$opt_modestbranding, 0);
149
+ $_rel = self::tryget($arroptions, self::$opt_rel, 1);
150
+ $_showinfo = self::tryget($arroptions, self::$opt_showinfo, 1);
151
+ $_html5 = self::tryget($arroptions, self::$opt_html5, 0);
152
+ $_theme = self::tryget($arroptions, self::$opt_theme, 'dark');
153
+ $_vq = self::tryget($arroptions, self::$opt_vq, '');
154
+ $_pro = self::tryget($arroptions, self::$opt_pro, '');
155
+ $_ssl = self::tryget($arroptions, self::$opt_ssl, 0);
156
+ $_nocookie = self::tryget($arroptions, self::$opt_nocookie, 0);
157
+ $_controls = self::tryget($arroptions, self::$opt_controls, 2);
158
+ $_oldspacing = self::tryget($arroptions, self::$opt_oldspacing, 1);
159
+ }
160
+ else
161
+ {
162
+ $_oldspacing = 0;
163
+ }
164
+
165
+ $all = array(
166
+ self::$opt_version => self::$version,
167
+ self::$opt_center => $_center,
168
+ self::$opt_autoplay => $_autoplay,
169
+ self::$opt_cc_load_policy => $_cc_load_policy,
170
+ self::$opt_iv_load_policy => $_iv_load_policy,
171
+ self::$opt_loop => $_loop,
172
+ self::$opt_modestbranding => $_modestbranding,
173
+ self::$opt_rel => $_rel,
174
+ self::$opt_showinfo => $_showinfo,
175
+ self::$opt_html5 => $_html5,
176
+ self::$opt_theme => $_theme,
177
+ self::$opt_vq => $_vq,
178
+ self::$opt_pro => $_pro,
179
+ self::$opt_ssl => $_ssl,
180
+ self::$opt_nocookie => $_nocookie,
181
+ self::$opt_controls => $_controls,
182
+ self::$opt_oldspacing => $_oldspacing
183
+ );
184
+
185
+ update_option(self::$opt_alloptions, $all);
186
+ update_option('embed_autourls', 1);
187
+ self::$alloptions = get_option(self::$opt_alloptions);
188
+ }
189
+
190
+ public static function tryget($array, $key, $default = null)
191
+ {
192
+ return isset($array[$key]) ? $array[$key] : $default;
193
+ }
194
+
195
+ public static function wp_above_version($ver)
196
+ {
197
+ global $wp_version;
198
+ if (version_compare($wp_version, $ver, '>='))
199
+ {
200
+ return true;
201
+ }
202
+ return false;
203
+ }
204
+
205
+ public static function do_ytprefs()
206
+ {
207
+ if (!is_admin())
208
+ {
209
+ add_filter('the_content', 'YouTubePrefs::apply_prefs', 1);
210
+ }
211
+ }
212
+
213
+ public static function apply_prefs($content)
214
+ {
215
+ $content = preg_replace_callback(self::$ytregex, "YouTubePrefs::get_html", $content);
216
+ return $content;
217
+ }
218
+
219
+ public static function get_html($m)
220
+ {
221
+ $link = trim(preg_replace('/&amp;/i', '&', $m[0]));
222
+ $link = preg_replace('/\s/', '', $link);
223
+ $linkparamstemp = explode('?', $link);
224
+ $linkparams = self::keyvalue($linkparamstemp[1], true);
225
+ if (strpos($linkparamstemp[0], 'youtu.be') !== false && !$linkparams['v'])
226
+ {
227
+ $vtemp = explode('/', $linkparamstemp[0]);
228
+ $linkparams['v'] = array_pop($vtemp);
229
+ }
230
+
231
+ self::init_dimensions($link, $linkparams);
232
+
233
+ $linkscheme = 'http';
234
+ $youtubebaseurl = 'youtube';
235
+
236
+ $finalparams = $linkparams + self::$alloptions;
237
+
238
+ if (self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0)
239
+ {
240
+ if (self::$alloptions[self::$opt_ssl] == 1)
241
+ {
242
+ $linkscheme = 'https';
243
+ }
244
+
245
+ if (self::$alloptions[self::$opt_nocookie] == 1)
246
+ {
247
+ $youtubebaseurl = 'youtube-nocookie';
248
+ }
249
+
250
+ if (isset($finalparams[self::$opt_html5]) && $finalparams[self::$opt_html5] == 0)
251
+ {
252
+ unset($finalparams[self::$opt_html5]);
253
+ }
254
+ }
255
+ else
256
+ {
257
+ if (isset($finalparams[self::$opt_html5]))
258
+ {
259
+ unset($finalparams[self::$opt_html5]);
260
+ }
261
+ }
262
+
263
+ $centercode = '';
264
+ if ($finalparams[self::$opt_center] == 1)
265
+ {
266
+ $centercode = ' style="display: block; margin: 0px auto;" ';
267
+ }
268
+
269
+ $code1 = '<iframe ' . $centercode . ' id="_ytid_' . rand(10000, 99999) . '" width="' . self::$defaultwidth . '" height="' . self::$defaultheight .
270
+ '" src="' . $linkscheme . '://www.' . $youtubebaseurl . '.com/embed/' . $linkparams['v'] . '?';
271
+ $code2 = '" frameborder="0" allowfullscreen type="text/html" class="__youtube_prefs__"></iframe>';
272
+
273
+
274
+ $origin = '';
275
+
276
+ try
277
+ {
278
+ if (!empty($_SERVER["HTTP_HOST"]))
279
+ {
280
+ $origin = 'origin=' .
281
+ ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? 'https://' : 'http://') . $_SERVER["HTTP_HOST"] . '&';
282
+ }
283
+ }
284
+ catch (Exception $e)
285
+ {
286
+
287
+ }
288
+ $finalsrc = 'enablejsapi=1&'; // . $origin;
289
+
290
+ if (count($finalparams) > 1)
291
+ {
292
+ foreach ($finalparams as $key => $value)
293
+ {
294
+ if (in_array($key, self::$yt_options))
295
+ {
296
+ $finalsrc .= htmlspecialchars($key) . '=' . htmlspecialchars($value) . '&';
297
+ if ($key == 'loop' && $value == 1)
298
+ $finalsrc .= 'playlist=' . $finalparams['v'] . '&';
299
+ }
300
+ }
301
+ }
302
+
303
+ $code = $code1 . $finalsrc . $code2;
304
+
305
+ // reset static vals for next embed
306
+ self::$defaultheight = null;
307
+ self::$defaultwidth = null;
308
+
309
+ return $code;
310
+ }
311
+
312
+ public static function keyvalue($qry, $includev)
313
+ {
314
+ $ytvars = explode('&', $qry);
315
+ $ytkvp = array();
316
+ foreach ($ytvars as $k => $v)
317
+ {
318
+ $kvp = explode('=', $v);
319
+ if (count($kvp) == 2 && ($includev || strtolower($kvp[0]) != 'v'))
320
+ {
321
+ $ytkvp[$kvp[0]] = $kvp[1];
322
+ }
323
+ }
324
+
325
+ return $ytkvp;
326
+ }
327
+
328
+ public static function init_dimensions($url, $urlkvp)
329
+ {
330
+ // get default dimensions; try embed size in settings, then try theme's content width, then just 480px
331
+ if (self::$defaultwidth == null)
332
+ {
333
+ global $content_width;
334
+ if (empty($content_width))
335
+ $content_width = $GLOBALS['content_width'];
336
+
337
+ self::$defaultwidth = $urlkvp['width'] ? $urlkvp['width'] : (self::$optembedwidth ? self::$optembedwidth : ($content_width ? $content_width : 480));
338
+ self::$defaultheight = $urlkvp['height'] ? $urlkvp['height'] + 30 : self::get_aspect_height($url, $urlkvp);
339
+ }
340
+ }
341
+
342
+ public static function get_aspect_height($url, $urlkvp)
343
+ {
344
+
345
+ // attempt to get aspect ratio correct height from oEmbed
346
+ $aspectheight = round((self::$defaultwidth * 9) / 16, 0);
347
+ if ($url)
348
+ {
349
+ require_once( ABSPATH . WPINC . '/class-oembed.php' );
350
+ $oembed = _wp_oembed_get_object();
351
+ $args = array();
352
+ $args['width'] = self::$defaultwidth;
353
+ $args['height'] = self::$defaultwidth; //square to get biggest height from width // self::$optembedheight;
354
+ $args['discover'] = false;
355
+ $odata = $oembed->fetch('https://www.youtube.com/oembed', $url, $args);
356
+
357
+ if ($odata)
358
+ {
359
+ $aspectheight = $odata->height;
360
+ }
361
+ }
362
+
363
+ //add 30 for YouTube's own bar
364
+ return $aspectheight + 30;
365
+ }
366
+
367
+ public static function ytprefs_plugin_menu()
368
+ {
369
+ add_menu_page('YouTube Settings', 'YouTube', 'manage_options', 'youtube-my-preferences', 'YouTubePrefs::ytprefs_show_options', plugins_url('images/youtubeicon16.png', __FILE__), '10.00392854349');
370
+
371
+ if (self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0)
372
+ {
373
+ add_menu_page('YouTube Analytics Dashboard', 'PRO Analytics', 'manage_options', 'youtube-ep-analytics-dashboard', 'YouTubePrefs::epstats_show_options', plugins_url('images/epstats16.png', __FILE__), '10.00492884349');
374
+ }
375
+ else
376
+ {
377
+ 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');
378
+ }
379
+ }
380
+
381
+ public static function epstats_show_options()
382
+ {
383
+
384
+ if (!current_user_can('manage_options'))
385
+ {
386
+ wp_die(__('You do not have sufficient permissions to access this page.'));
387
+ }
388
+
389
+ // Now display the settings editing screen
390
+ ?>
391
+ <div class="wrap">
392
+ <style type="text/css">
393
+ .epicon { width: 20px; height: 20px; vertical-align: middle; padding-right: 5px;}
394
+ .epindent {padding-left: 25px;}
395
+ iframe.shadow {-webkit-box-shadow: 0px 0px 20px 0px #000000; box-shadow: 0px 0px 20px 0px #000000;}
396
+ </style>
397
+ <br>
398
+ <?php
399
+ $thishost = (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : "");
400
+ $thiskey = self::$alloptions[self::$opt_pro];
401
+ if (self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0)
402
+ {
403
+ //// header
404
+ echo "<h2>" . '<img src="' . plugins_url('images/epstats16.png', __FILE__) . '" /> ' . __('YouTube Analytics Dashboard') . "</h2>";
405
+ echo '<p><i>Logging you in...</i></p>';
406
+ }
407
+ else
408
+ {
409
+ //// header
410
+ echo "<h2>" . '<img src="' . plugins_url('images/epstats16.png', __FILE__) . '" /> ' . __('YouTube Plugin PRO') . "</h2><br>";
411
+ }
412
+ ?>
413
+ <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="2700" scrolling="auto"/>
414
+ </div>
415
+ <?php
416
+ }
417
+
418
+ public static function my_embedplus_pro_record()
419
+ {
420
+ $result = array();
421
+ if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
422
+ {
423
+ $tmppro = preg_replace('/[^A-Za-z0-9-]/i', '', $_REQUEST[self::$opt_pro]);
424
+ $new_options = array();
425
+ $new_options[self::$opt_pro] = $tmppro;
426
+ $all = get_option(self::$opt_alloptions);
427
+ $all = $new_options + $all;
428
+ update_option(self::$opt_alloptions, $all);
429
+
430
+ if (strlen($tmppro) > 0)
431
+ {
432
+ $result['type'] = 'success';
433
+ }
434
+ else
435
+ {
436
+ $result['type'] = 'error';
437
+ }
438
+ echo json_encode($result);
439
+ }
440
+ else
441
+ {
442
+ $result['type'] = 'error';
443
+ header("Location: " . $_SERVER["HTTP_REFERER"]);
444
+ }
445
+ die();
446
+ }
447
+
448
+ public static function ytprefs_show_options()
449
+ {
450
+
451
+ if (!current_user_can('manage_options'))
452
+ {
453
+ wp_die(__('You do not have sufficient permissions to access this page.'));
454
+ }
455
+
456
+ // variables for the field and option names
457
+ $ytprefs_submitted = 'ytprefs_submitted';
458
+
459
+ // Read in existing option values from database
460
+
461
+ $all = get_option(self::$opt_alloptions);
462
+
463
+ // See if the user has posted us some information
464
+ // If they did, this hidden field will be set to 'Y'
465
+ if (isset($_POST[$ytprefs_submitted]) && $_POST[$ytprefs_submitted] == 'Y')
466
+ {
467
+ // Read their posted values
468
+
469
+ $new_options = array();
470
+ $new_options[self::$opt_center] = $_POST[self::$opt_center] == (true || 'on') ? 1 : 0;
471
+ $new_options[self::$opt_autoplay] = $_POST[self::$opt_autoplay] == (true || 'on') ? 1 : 0;
472
+ $new_options[self::$opt_cc_load_policy] = $_POST[self::$opt_cc_load_policy] == (true || 'on') ? 1 : 0;
473
+ $new_options[self::$opt_iv_load_policy] = $_POST[self::$opt_iv_load_policy] == (true || 'on') ? 1 : 3;
474
+ $new_options[self::$opt_loop] = $_POST[self::$opt_loop] == (true || 'on') ? 1 : 0;
475
+ $new_options[self::$opt_modestbranding] = $_POST[self::$opt_modestbranding] == (true || 'on') ? 1 : 0;
476
+ $new_options[self::$opt_rel] = $_POST[self::$opt_rel] == (true || 'on') ? 1 : 0;
477
+ $new_options[self::$opt_showinfo] = $_POST[self::$opt_showinfo] == (true || 'on') ? 1 : 0;
478
+ $new_options[self::$opt_controls] = $_POST[self::$opt_controls] == (true || 'on') ? 2 : 0;
479
+ $new_options[self::$opt_html5] = $_POST[self::$opt_html5] == (true || 'on') ? 1 : 0;
480
+ $new_options[self::$opt_theme] = $_POST[self::$opt_theme] == (true || 'on') ? 'dark' : 'light';
481
+ $new_options[self::$opt_vq] = $_POST[self::$opt_vq] == (true || 'on') ? 'hd720' : '';
482
+ $new_options[self::$opt_ssl] = isset($_POST[self::$opt_ssl]) && $_POST[self::$opt_ssl] == (true || 'on') ? 1 : 0;
483
+ $new_options[self::$opt_nocookie] = isset($_POST[self::$opt_nocookie]) && $_POST[self::$opt_nocookie] == (true || 'on') ? 1 : 0;
484
+ $new_options[self::$opt_oldspacing] = isset($_POST[self::$opt_oldspacing]) && $_POST[self::$opt_oldspacing] == (true || 'on') ? 1 : 0;
485
+
486
+ $all = $new_options + $all;
487
+
488
+ // Save the posted value in the database
489
+
490
+ update_option(self::$opt_alloptions, $all);
491
+ // Put a settings updated message on the screen
492
+ ?>
493
+ <div class="updated"><p><strong><?php _e('Settings saved.'); ?></strong></p></div>
494
+ <?php
495
+ }
496
+
497
+ // Now display the settings editing screen
498
+
499
+ echo '<div class="wrap">';
500
+
501
+ // header
502
+
503
+ echo "<h2>" . '<img src="' . plugins_url('images/youtubeicon16.png', __FILE__) . '" /> ' . __('YouTube Settings (For Free and PRO Users)') . "</h2>";
504
+
505
+ // settings form
506
+ ?>
507
+
508
+ <style type="text/css">
509
+ #ytform p { line-height: 20px; }
510
+ #ytform ul li {margin-left: 30px; list-style: disc outside none;}
511
+ .ytindent {padding: 0px 0px 0px 20px; font-size: 11px;}
512
+ .shadow {-webkit-box-shadow: 0px 0px 20px 0px #000000; box-shadow: 0px 0px 20px 0px #000000;}
513
+ .gopro {margin: 0px;}
514
+ .gopro img {vertical-align: middle;
515
+ width: 19px;
516
+ height: 19px;
517
+ padding-bottom: 4px;}
518
+ .gopro li {margin-bottom: 0px;}
519
+ .orange {color: #f85d00;}
520
+ .bold {font-weight: bold;}
521
+ .grey{color: #888888;}
522
+ #goprobox {border-radius: 15px; padding: 0px 0px 15px 15px; margin-top: 15px; border: 3px solid #CCE5EC; width: 700px;}
523
+ #nonprosupport {border-radius: 15px; padding: 5px 10px 10px 10px; border: 3px solid #ff6655; width: 800px;}
524
+ .pronon {font-weight: bold; color: #f85d00;}
525
+ ul.reglist li {margin: 0px 0px 0px 30px; list-style: disc outside none;}
526
+ .procol {width: 430px; float: left;}
527
+ .smallnote {font-style: italic; font-size: 10px;}
528
+ .italic {font-style: italic;}
529
+ .ytindent h3 {font-size: 15px; line-height: 22px; margin: 5px 0px 10px 0px;}
530
+ #wizleftlink {float: left; display: block; width: 240px; font-style: italic; text-align: center; text-decoration: none;}
531
+ .button-primary {font-weight: bold;}
532
+ #opt_pro {box-shadow: 0px 0px 5px 0px #1870D5; width: 270px;vertical-align: top;}
533
+ #goprobox h3 {font-size: 13px;}
534
+ .chx p {margin: 0px 0px 5px 0px;}
535
+
536
+ </style>
537
+
538
+ <div class="ytindent">
539
+
540
+ <div id="goprobox">
541
+
542
+ <?php
543
+ $haspro = ($all[self::$opt_pro] && strlen(trim($all[self::$opt_pro])) > 0);
544
+
545
+ if ($haspro)
546
+ {
547
+ echo "<h3>" . __('Thank you for going PRO.');
548
+ echo ' &nbsp;<input type="submit" name="showkey" class="button-primary" style="vertical-align: 15%;" id="showprokey" value="View my PRO key" />';
549
+ echo "</h3>";
550
+ ?>
551
+ <?php
552
+ }
553
+ else
554
+ {
555
+ ?>
556
+
557
+ <h3>
558
+ <a href="<?php echo self::$epbase ?>/dashboard/pro-easy-video-analytics.aspx" class="button-primary" target="_blank">Want to go PRO?</a> PRO users help to keep this plugin running and frequently updated. They get perks like:
559
+ </h3>
560
+ <div class="procol">
561
+ <ul class="gopro">
562
+ <li>
563
+ <img src="<?php echo plugins_url('images/youtubewizard.png', __FILE__) ?>">
564
+ Visual YouTube Wizard (Easily embed without memorizing codes)
565
+ </li>
566
+ <li>
567
+ <img src="<?php echo plugins_url('images/deletechecker.png', __FILE__) ?>">
568
+ Deleted Video Checker (alerts you if YouTube deletes videos you embedded)
569
+ </li>
570
+ <li>
571
+ <img src="<?php echo plugins_url('images/html5.png', __FILE__) ?>">
572
+ HTML5-first to speedup page loads (will even work for your old embeds)
573
+ </li>
574
+ <li>
575
+ <img src="<?php echo plugins_url('images/lock.png', __FILE__) ?>">
576
+ Secure YouTube embedded player (will even work for your old embeds)
577
+ </li>
578
+ </ul>
579
+ </div>
580
+ <div class="procol" style="width: 240px;">
581
+ <ul class="gopro">
582
+ <li>
583
+ <img src="<?php echo plugins_url('images/prioritysupport.png', __FILE__) ?>">
584
+ Priority support (Puts your request in front)
585
+ </li>
586
+ <li>
587
+ <img src="<?php echo plugins_url('images/bulletgraph45.png', __FILE__) ?>">
588
+ Your own video analytics dashboard
589
+ </li>
590
+ <li>
591
+ <img src="<?php echo plugins_url('images/infinity.png', __FILE__) ?>">
592
+ Unlimited PRO upgrades and downloads
593
+ </li>
594
+ <li>
595
+ <img src="<?php echo plugins_url('images/questionsale.png', __FILE__) ?>">
596
+ What else? You tell us!
597
+ </li>
598
+ </ul>
599
+ </div>
600
+ <br>
601
+ <br>
602
+ <div style="clear: both;"></div>
603
+ <h3>Enter and save your PRO key (emailed to you):</h3>
604
+ <?php } ?>
605
+ <form name="form2" method="post" action="" id="epform2" class="submitpro" <?php if ($haspro) echo 'style="display: none;"' ?>>
606
+ <input type="hidden" name="<?php echo $pro_submitted; ?>" value="Y">
607
+
608
+ <input name="<?php echo self::$opt_pro; ?>" id="opt_pro" value="<?php echo $all[self::$opt_pro]; ?>" type="text">
609
+ <input type="submit" name="Submit" class="button-primary" id="prokeysubmit" value="<?php _e('Save Key') ?>" />
610
+ <?php
611
+ if (!$haspro)
612
+ {
613
+ ?>
614
+ &nbsp; &nbsp; &nbsp; <span style="font-size: 25px; color: #cccccc;">|</span> &nbsp; &nbsp; &nbsp; <a href="<?php echo self::$epbase ?>/dashboard/pro-easy-video-analytics.aspx" class="button-primary" target="_blank">Click here to go PRO &raquo;</a>
615
+ <?php
616
+ }
617
+ ?>
618
+ <br>
619
+ <span style="display: none;" id="prokeyloading" class="orange bold">Verifying...</span>
620
+ <span class="orange bold" style="display: none;" id="prokeysuccess">Success! Please refresh this page.</span>
621
+ <span class="orange bold" style="display: none;" id="prokeyfailed">Sorry, that seems to be an invalid key.</span>
622
+
623
+ </form>
624
+
625
+ </div>
626
+ <!-- <div class="smallnote">&nbsp; *One of the upcoming updates will provide all users (Free and PRO) with the ability to hide play controls when the embed is loaded. </div>-->
627
+ <br>
628
+ <form name="form1" method="post" action="" id="ytform">
629
+ <input type="hidden" name="<?php echo $ytprefs_submitted; ?>" value="Y">
630
+ <h3>
631
+ <?php _e("How to Insert a YouTube Video") ?> <span class="pronon">(For Free and PRO Users)</span>
632
+ </h3>
633
+ <p>
634
+ 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?
635
+ </p>
636
+ <ul class="reglist">
637
+ <li>Make sure the url is really on its own line by itself</li>
638
+ <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>
639
+ <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>
640
+ </ul>
641
+ <p>
642
+ <img style="width: 375px; height: auto;" class="shadow" src="<?php echo plugins_url('images/ownline.jpg', __FILE__) ?>" />
643
+ </p>
644
+ <br>
645
+
646
+
647
+
648
+ <h3>Visual YouTube Wizard - Easily embed without memorizing special codes <span class="pronon">(PRO Users)</span></h3>
649
+ <p>
650
+ More options are available to PRO users! Simply click the PRO editor button <img style="width: 16px;height:16px;" src="<?php echo plugins_url('images/youtubewizard.png', __FILE__) ?>"> to launch the visual embedding wizard. <br>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. <br>No memorization needed.
651
+ <br>
652
+ <img src="<?php echo plugins_url('images/ssprowizard.jpg', __FILE__) ?>" >
653
+ </p>
654
+ <div style="clear: both;"></div>
655
+ <br>
656
+
657
+
658
+ <h3>
659
+ <?php _e("Default Options") ?> <span class="pronon">(For Free and PRO Users)</span>
660
+ </h3>
661
+ <p>
662
+ <?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.") ?>
663
+ </p>
664
+
665
+ <div class="ytindent chx">
666
+ <p>
667
+ <input name="<?php echo self::$opt_oldspacing; ?>" id="<?php echo self::$opt_oldspacing; ?>" <?php checked($all[self::$opt_oldspacing], 1); ?> type="checkbox" class="checkbox">
668
+ <label for="<?php echo self::$opt_oldspacing; ?>">
669
+ Continue the spacing style from version 4.0 and older. Those versions required you to manually add spacing above and below your video. Unchecking this will automatically add the spacing for you.
670
+ </label>
671
+ </p>
672
+ <p>
673
+ <input name="<?php echo self::$opt_center; ?>" id="<?php echo self::$opt_center; ?>" <?php checked($all[self::$opt_center], 1); ?> type="checkbox" class="checkbox">
674
+ <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>
675
+ </p>
676
+ <p>
677
+ <input name="<?php echo self::$opt_autoplay; ?>" id="<?php echo self::$opt_autoplay; ?>" <?php checked($all[self::$opt_autoplay], 1); ?> type="checkbox" class="checkbox">
678
+ <label for="<?php echo self::$opt_autoplay; ?>"><?php _e('Automatically start playing your videos') ?></label>
679
+ </p>
680
+ <p>
681
+ <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">
682
+ <label for="<?php echo self::$opt_cc_load_policy; ?>"><?php _e('Turn on closed captions by default') ?></label>
683
+ </p>
684
+ <p>
685
+ <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">
686
+ <label for="<?php echo self::$opt_iv_load_policy; ?>"><?php _e('Show annotations by default') ?></label>
687
+ </p>
688
+ <p>
689
+ <input name="<?php echo self::$opt_loop; ?>" id="<?php echo self::$opt_loop; ?>" <?php checked($all[self::$opt_loop], 1); ?> type="checkbox" class="checkbox">
690
+ <label for="<?php echo self::$opt_loop; ?>"><?php _e('Loop all your videos') ?></label>
691
+ </p>
692
+ <p>
693
+ <input name="<?php echo self::$opt_modestbranding; ?>" id="<?php echo self::$opt_modestbranding; ?>" <?php checked($all[self::$opt_modestbranding], 1); ?> type="checkbox" class="checkbox">
694
+ <label for="<?php echo self::$opt_modestbranding; ?>"><?php _e('Modest branding - hide YouTube logo while playing') ?></label>
695
+ </p>
696
+ <p>
697
+ <input name="<?php echo self::$opt_rel; ?>" id="<?php echo self::$opt_rel; ?>" <?php checked($all[self::$opt_rel], 1); ?> type="checkbox" class="checkbox">
698
+ <label for="<?php echo self::$opt_rel; ?>"><?php _e('Show related videos at the end') ?></label>
699
+ </p>
700
+ <p>
701
+ <input name="<?php echo self::$opt_showinfo; ?>" id="<?php echo self::$opt_showinfo; ?>" <?php checked($all[self::$opt_showinfo], 1); ?> type="checkbox" class="checkbox">
702
+ <label for="<?php echo self::$opt_showinfo; ?>"><?php _e('Show the video title and other info') ?></label>
703
+ </p>
704
+ <p>
705
+ <input name="<?php echo self::$opt_theme; ?>" id="<?php echo self::$opt_theme; ?>" <?php checked($all[self::$opt_theme], 'dark'); ?> type="checkbox" class="checkbox">
706
+ <label for="<?php echo self::$opt_theme; ?>"><?php _e('Use the dark theme (uncheck to use light theme)') ?></label>
707
+ </p>
708
+ <p>
709
+ <input name="<?php echo self::$opt_vq; ?>" id="<?php echo self::$opt_vq; ?>" <?php checked($all[self::$opt_vq], 'hd720'); ?> type="checkbox" class="checkbox">
710
+ <label for="<?php echo self::$opt_vq; ?>"><?php _e('Force HD quality when available') ?></label>
711
+ </p>
712
+ <p>
713
+ <input name="<?php echo self::$opt_controls; ?>" id="<?php echo self::$opt_controls; ?>" <?php checked($all[self::$opt_controls], 2); ?> type="checkbox" class="checkbox">
714
+ <label for="<?php echo self::$opt_controls; ?>"><?php _e('Show player controls. Checking this also speeds up page loading (the Flash player will "lazy load," which means it will load the player after clicking play). Uncheck this to hide the player controls for a cleaner look.') ?></label>
715
+ </p>
716
+
717
+ <p class="smallnote orange">Below are PRO features for enhanced performance, privacy, and security (works for even past embed links):</p>
718
+ <?php
719
+ if ($haspro)
720
+ {
721
+ ?>
722
+ <p>
723
+ <input name="<?php echo self::$opt_ssl; ?>" id="<?php echo self::$opt_ssl; ?>" <?php checked($all[self::$opt_ssl], 1); ?> type="checkbox" class="checkbox">
724
+ <label for="<?php echo self::$opt_ssl; ?>">
725
+ <b>(PRO)</b> Use the secure YouTube player for all of your visitors and videos you embed. This will go back and also secure your past embeds as they are loaded on their pages.
726
+ </label>
727
+ </p>
728
+ <p>
729
+ <input name="<?php echo self::$opt_nocookie; ?>" id="<?php echo self::$opt_nocookie; ?>" <?php checked($all[self::$opt_nocookie], 1); ?> type="checkbox" class="checkbox">
730
+ <label for="<?php echo self::$opt_nocookie; ?>">
731
+ <b>(PRO)</b> Prevent YouTube from leaving tracking cookies on your visitors browsers unless they actual play the videos. This is coded to apply this behavior on links in your past post as well.
732
+ </label>
733
+ </p>
734
+ <p>
735
+ <input name="<?php echo self::$opt_html5; ?>" id="<?php echo self::$opt_html5; ?>" <?php checked($all[self::$opt_html5], 1); ?> type="checkbox" class="checkbox">
736
+ <label for="<?php echo self::$opt_html5; ?>">
737
+ <b>(PRO)</b> Speed up your pages containing YouTube videos by using YouTube's HTML5 player instead of the Flash player when available. It's been noted that using the HTML5 player offers visibly lower page load times than Flash. Our own internal tests along with data from some beta testers suggest the same thing. In fact, some experiments show that pages (with multiple embeds) can have over four times less size with HTML5 than Flash. <br><span class="italic">So what does this all mean?</span> Well given that site speed may have an effect on search engine rankings, we suggest checking this option if you typically embed videos in your posts as it may have a site-wide benefit. Our code will even go back and load your older posted videos as HTML5 instead of Flash, where possible.
738
+ </label>
739
+ </p>
740
+
741
+ <?php
742
+ }
743
+ else
744
+ {
745
+ ?>
746
+ <p>
747
+ <input disabled type="checkbox" class="checkbox">
748
+ <label>
749
+ <span class="pronon">(PRO Users)</span> Use the secure YouTube player for all of your visitors and videos you embed. This will go back and also secure your past embeds as they are loaded on their pages.
750
+ </label>
751
+ </p>
752
+ <p>
753
+ <input disabled type="checkbox" class="checkbox">
754
+ <label>
755
+ <span class="pronon">(PRO Users)</span> Prevent YouTube from leaving tracking cookies on your visitors browsers unless they actual play the videos. This is coded to apply this behavior on links in your past post as well.
756
+ </label>
757
+ </p>
758
+ <p>
759
+ <input disabled type="checkbox" class="checkbox">
760
+ <label>
761
+ <span class="pronon">(PRO Users)</span> Speed up your pages containing YouTube videos by using YouTube's HTML5 player instead of the Flash player when available. It's been noted that using the HTML5 player offers visibly lower page load times than Flash. Our own internal tests along with data from some beta testers suggest the same thing. <b>In fact, some experiments show that pages (with multiple embeds) can have over four times less size with HTML5 than Flash.</b> <br><span class="italic">So what does this all mean?</span> Well given that site speed may have an effect on search engine rankings, we suggest checking this option if you typically embed videos in your posts. Our code will even go back and load your older posted videos as HTML5 instead of Flash, where possible.
762
+ </label>
763
+ </p>
764
+ <?php
765
+ }
766
+ ?>
767
+
768
+ <p class="submit">
769
+ <input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
770
+ </p>
771
+ </div>
772
+
773
+ <h3>
774
+ <?php _e("How To Override Defaults / Other Options") ?> <span class="pronon">(For Free and PRO Users)</span>
775
+ </h3>
776
+ <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 '&'.
777
+ <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>
778
+ <?php
779
+ _e('<ul>');
780
+ _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>");
781
+ _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>");
782
+ _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>");
783
+ _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>");
784
+ _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>");
785
+ _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>");
786
+ _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>");
787
+ _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>");
788
+ _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>");
789
+ _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>");
790
+ _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>");
791
+ _e("<li><strong>controls</strong> - Set this to 0 to hide the video controls (or 2 to show it). <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&controls=0</strong></em> </li>");
792
+ _e('</ul>');
793
+
794
+ _e("<p>You can also start and end each individual video at particular times. Like the above, each option should begin with '&'</p>");
795
+ _e('<ul>');
796
+ _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>");
797
+ _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>");
798
+ _e('</ul>');
799
+ ?>
800
+
801
+ </form>
802
+ <br>
803
+ <h3>
804
+ Priority Support <span class="pronon">(PRO Users)</span>
805
+ </h3>
806
+ <p>
807
+ <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.
808
+ </p>
809
+
810
+ <div id="nonprosupport">
811
+ <h3>Support tips for non-PRO users</h3>
812
+ 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 suggestions is usually the fix:
813
+ <ul class="reglist">
814
+ <li>Make sure the url is really on its own line by itself</li>
815
+ <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>
816
+ <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>
817
+ <li>Finally, there's a slight chance your custom theme is the issue, if you have one. To know for sure, we suggest temporarily switching to one of the default WordPress themes (e.g., "Twenty Thirteen") just to see if your video does appear. If it suddenly works, then your custom theme is the issue. You can switch back when done testing.</li>
818
+ </ul>
819
+ </p>
820
+ </div>
821
+ <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="500"></iframe>
822
+
823
+ <h3 class="orange">What's next for us? Take this survey.</h3>
824
+
825
+ <div id="surveyMonkeyInfo" style="width:700px;font-size:10px;color:#666;border:1px solid #ccc;padding:4px;"><div><iframe id="sm_e_s" src="http://www.surveymonkey.com/jsEmbed.aspx?sm=uYXvJKm2UNLkrpXHzLJ57Q_3d_3d" width="700" height="800" style="border:0px;padding-bottom:4px;" frameborder="0" allowtransparency="true" ></iframe></div>
826
+
827
+ </div>
828
+ <script type="text/javascript">
829
+ var prokeyval;
830
+ jQuery(document).ready(function($) {
831
+
832
+ jQuery('#showprokey').click(function(){
833
+ jQuery('.submitpro').show(500);
834
+ return false;
835
+ });
836
+
837
+ jQuery('#prokeysubmit').click(function(){
838
+ jQuery(this).attr('disabled', 'disabled');
839
+ jQuery('#prokeyfailed').hide();
840
+ jQuery('#prokeysuccess').hide();
841
+ jQuery('#prokeyloading').show();
842
+ prokeyval = jQuery('#opt_pro').val();
843
+
844
+ var mydomain = escape(window.location.toString());
845
+
846
+ var tempscript=document.createElement("script");
847
+ tempscript.src="//www.embedplus.com/dashboard/wordpress-pro-validatejp.aspx?simple=1&prokey=" + prokeyval + "&domain=" + mydomain;
848
+ var n=document.getElementsByTagName("head")[0].appendChild(tempscript);
849
+ setTimeout(function(){
850
+ n.parentNode.removeChild(n)
851
+ },500);
852
+ return false;
853
+ });
854
+
855
+ window.embedplus_record_prokey = function(good){
856
+
857
+ jQuery.ajax({
858
+ type : "post",
859
+ dataType : "json",
860
+ timeout: 30000,
861
+ url : "<?php echo admin_url('admin-ajax.php') ?>",
862
+ data : { action: 'my_embedplus_pro_record', <?php echo self::$opt_pro; ?>: (good? prokeyval : "")},
863
+ success: function(response) {
864
+ if(response.type == "success") {
865
+ jQuery("#prokeysuccess").show();
866
+ }
867
+ else {
868
+ jQuery("#prokeyfailed").show();
869
+ }
870
+ },
871
+ error: function(xhr, ajaxOptions, thrownError){
872
+ jQuery('#prokeyfailed').show();
873
+ },
874
+ complete: function() {
875
+ jQuery('#prokeyloading').hide();
876
+ jQuery('#prokeysubmit').removeAttr('disabled');
877
+ }
878
+
879
+ });
880
+
881
+ };
882
+
883
+ });
884
+ </script>
885
+ <?php
886
+ if (function_exists('add_thickbox'))
887
+ {
888
+ add_thickbox();
889
+ }
890
+ ?>
891
+
892
+ <?php
893
+ }
894
+
895
+ public static function ytprefsscript()
896
+ {
897
+ wp_enqueue_script('__ytprefs__', plugins_url('scripts/ytprefs.min.js', __FILE__));
898
+ }
899
+
900
+ }
901
+
902
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
903
+ //class start
904
+ class Add_new_tinymce_btn_Youtubeprefs
905
+ {
906
+
907
+ public $btn_arr;
908
+ public $js_file;
909
+
910
+ /*
911
+ * call the constructor and set class variables
912
+ * From the constructor call the functions via wordpress action/filter
913
+ */
914
+
915
+ function __construct($seperator, $btn_name, $javascrip_location)
916
+ {
917
+ $this->btn_arr = array("Seperator" => $seperator, "Name" => $btn_name);
918
+ $this->js_file = $javascrip_location;
919
+ add_action('init', array($this, 'add_tinymce_button'));
920
+ add_filter('tiny_mce_version', array($this, 'refresh_mce_version'));
921
+ }
922
+
923
+ /*
924
+ * create the buttons only if the user has editing privs.
925
+ * If so we create the button and add it to the tinymce button array
926
+ */
927
+
928
+ function add_tinymce_button()
929
+ {
930
+ if (!current_user_can('edit_posts') && !current_user_can('edit_pages'))
931
+ return;
932
+ if (get_user_option('rich_editing') == 'true')
933
+ {
934
+ //the function that adds the javascript
935
+ add_filter('mce_external_plugins', array($this, 'add_new_tinymce_plugin'));
936
+ //adds the button to the tinymce button array
937
+ add_filter('mce_buttons', array($this, 'register_new_button'));
938
+ }
939
+ }
940
+
941
+ /*
942
+ * add the new button to the tinymce array
943
+ */
944
+
945
+ function register_new_button($buttons)
946
+ {
947
+ array_push($buttons, $this->btn_arr["Seperator"], $this->btn_arr["Name"]);
948
+ return $buttons;
949
+ }
950
+
951
+ /*
952
+ * Call the javascript file that loads the
953
+ * instructions for the new button
954
+ */
955
+
956
+ function add_new_tinymce_plugin($plugin_array)
957
+ {
958
+ $plugin_array[$this->btn_arr['Name']] = $this->js_file;
959
+ return $plugin_array;
960
+ }
961
+
962
+ /*
963
+ * This function tricks tinymce in thinking
964
+ * it needs to refresh the buttons
965
+ */
966
+
967
+ function refresh_mce_version($ver)
968
+ {
969
+ $ver += 3;
970
+ return $ver;
971
+ }
972
+
973
+ }
974
+
975
+ //class end
976
+
977
+
978
+ register_activation_hook(__FILE__, array('YouTubePrefs', 'initoptions'));
979
+ add_action('wp_enqueue_scripts', array('YouTubePrefs', 'ytprefsscript'));
980
+ add_action("wp_ajax_my_embedplus_pro_record", array('YouTubePrefs', 'my_embedplus_pro_record'));
981
+
982
+
983
+ $youtubeplg = new YouTubePrefs();
984
+
985
+ $embedplusmce_youtubeprefs = new Add_new_tinymce_btn_Youtubeprefs('|', 'embedpluswiz_youtubeprefs', plugins_url() . '/youtube-embed-plus/scripts/embedplus_mce.js');
986
+ //$epstatsmce_youtubeprefs = new Add_new_tinymce_btn_Youtubeprefs('|', 'embedplusstats_youtubeprefs', plugins_url() . '/youtube-embed-plus/scripts/embedplusstats_mce.js');
987
+
988
+ add_action('admin_enqueue_scripts', 'youtubeprefs_admin_enqueue_scripts');
989
+
990
+ function youtubeprefs_admin_enqueue_scripts()
991
+ {
992
+ add_action('wp_print_scripts', 'youtubeprefs_output_scriptvars');
993
+ wp_enqueue_style('embedplusyoutube', plugins_url() . '/youtube-embed-plus/scripts/embedplus_mce.css');
994
+ }
995
+
996
+ function youtubeprefs_output_scriptvars()
997
+ {
998
+ $blogwidth = null;
999
+ try
1000
+ {
1001
+ $embed_size_w = intval(get_option('embed_size_w'));
1002
+
1003
+ global $content_width;
1004
+ if (empty($content_width))
1005
+ $content_width = $GLOBALS['content_width'];
1006
+ if (empty($content_width))
1007
+ $content_width = $_GLOBALS['content_width'];
1008
+
1009
+ $blogwidth = $embed_size_w ? $embed_size_w : ($content_width ? $content_width : 450);
1010
+ }
1011
+ catch (Exception $ex)
1012
+ {
1013
+
1014
+ }
1015
+
1016
+ $epprokey = YouTubePrefs::$alloptions[YouTubePrefs::$opt_pro];
1017
+
1018
+ $myytdefaults = http_build_query(YouTubePrefs::$alloptions);
1019
+ ?>
1020
+ <script type="text/javascript">
1021
+ var epblogwidth = <?php echo $blogwidth; ?>;
1022
+ var epprokey = '<?php echo $epprokey; ?>';
1023
+ var epbasesite = '<?php echo YouTubePrefs::$epbase; ?>';
1024
+ var epversion = '<?php echo YouTubePrefs::$version; ?>';
1025
+ var myytdefaults = '<?php echo $myytdefaults; ?>';
1026
+ </script>
1027
+ <?php
1028
+ }