YouTube - Version 3.3

Version Description

Download this release

Release Info

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

Version 3.3

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