PluginProbe
VdoCipher: Secure Video Player and Hosting / 1.17
VdoCipher: Secure Video Player and Hosting v1.17
trunk 1.10 1.11 1.12 1.13 1.14 1.15 1.17 1.18 1.19 1.20 1.21 1.22 1.23 1.24 1.25 1.26 1.27 1.28 1.29 1.3 1.30 1.4 1.5 1.6 All 28 releases
← All changes | vdocipher.php +56 -18 1.101.17 View file →
@@ -2,9 +2,9 @@
2 2 /**
3 3 * Plugin Name: VdoCipher
4 4 * Plugin URI: http://www.vdocipher.com
5 5 * Description: Secured video hosting for wordpress
6 - * Version: 1.10
6 + * Version: 1.17
7 7 * Author: VdoCipher
8 8 * Author URI: http://www.vdocipher.com
9 9 * License: GPL2
10 10 */
@@ -113,25 +113,53 @@
113 113 $version = 0;
114 114 if (isset($atts['version'])) {
115 115 $version = $atts['version'];
116 116 }
117 - $output = "<div id='vdo$OTP' style='height:$height;width:$width;max-width:100%' ></div>";
118 - $output .= "<script> (function(v,i,d,e,o){v[o]=v[o]||{}; v[o].add = v[o].add || function V(a){".
119 - " (v[o].d=v[o].d||[]).push(a);};";
120 - $output .= "if(!v[o].l) { v[o].l=1*new Date(); a=i.createElement(d), m=i.getElementsByTagName(d)[0]; a.async=1; ".
121 - "a.src=e; m.parentNode.insertBefore(a,m);}";
122 - $output .= " })(window,document,'script','//de122v0opjemw.cloudfront.net/vdo.js','vdo'); vdo.add({ ";
123 - $output .= "o: '$OTP', ";
124 - if ($version == 32) {
125 - $output .= "version: '$version' ";
117 + if ((get_option('vdo_embed_version')) == false) {
118 + update_option('vdo_embed_version', '0.5');
126 119 }
127 - $output .= "}); </script>";
120 + if ((get_option('vdo_player_theme')) == false) {
121 + update_option('vdo_player_theme','9ae8bbe8dd964ddc9bdb932cca1cb59a');
122 + }
123 + $vdo_embed_version_str = get_option('vdo_embed_version');
124 + $vdo_player_theme = get_option('vdo_player_theme');
125 +
126 + // Old Embed Code
127 + if($vdo_embed_version_str === '0.5') {
128 + $output = "<div id='vdo$OTP' style='height:$height;width:$width;max-width:100%' ></div>";
129 + $output .= "<script> (function(v,i,d,e,o){v[o]=v[o]||{}; v[o].add = v[o].add || function V(a){".
130 + " (v[o].d=v[o].d||[]).push(a);};";
131 + $output .= "if(!v[o].l) { v[o].l=1*new Date(); a=i.createElement(d), m=i.getElementsByTagName(d)[0]; a.async=1; ".
132 + "a.src=e; m.parentNode.insertBefore(a,m);}";
133 + $output .= " })(window,document,'script','//de122v0opjemw.cloudfront.net/vdo.js','vdo'); vdo.add({ ";
134 + $output .= "o: '$OTP', ";
135 + if ($version == 32) {
136 + $output .= "version: '$version' ";
137 + }
138 + $output .= "}); </script>";
139 + }
140 + //New embed code
141 + else {
142 + $output .= "<div id='vdo$OTP' style='height:$height;width:$width;max-width:100%' ></div>";
143 + $output .= "<script>(function(v,i,d,e,o){v[o]=v[o]||{}; v[o].add = v[o].add || function V(a){ (v[o].d=v[o].d||[]).push(a);};";
144 + $output .= "if(!v[o].l) { v[o].l=1*new Date(); a=i.createElement(d), m=i.getElementsByTagName(d)[0];";
145 + $output .= "a.async=1; a.src=e; m.parentNode.insertBefore(a,m);}";
146 + $output .= "})(window,document,'script','https://d1z78r8i505acl.cloudfront.net/playerAssets/";
147 + $output .= "$vdo_embed_version_str";
148 + $output .= "/vdo.js','vdo');";
149 + $output .= "vdo.add({";
150 + $output .= "otp: '$OTP',";
151 + $output .= "playbackInfo: btoa(JSON.stringify({";
152 + $output .= "videoId: '$video'})),";
153 + $output .= "theme: '$vdo_player_theme',";
154 + $output .= "container: document.querySelector('#vdo$OTP'),});";
155 + $output .= "</script>";
156 + }
128 157 return $output;
129 158 }
130 159
131 160 add_shortcode('vdo', 'vdo_shortcode');
132 161
133 -
134 162 /// adding the settings link
135 163 $plugin = plugin_basename(__FILE__);
136 164 add_filter("plugin_action_links_$plugin", 'vdo_settings_link');
137 165
@@ -136,14 +164,13 @@
136 164 add_filter("plugin_action_links_$plugin", 'vdo_settings_link');
137 165
138 166 function vdo_settings_link($links)
139 167 {
140 - $settings_link = '<a href="options-general.php?page=vdocipher.php">Settings</a>';
168 + $settings_link = '<a href="options-general.php?page=vdocipher">Settings</a>';
141 169 array_unshift($links, $settings_link);
142 170 return $links;
143 171 }
144 172
145 -
146 173 /// add the menu item and register settings
147 174 if (is_admin()) { // admin actions
148 175 add_action('admin_menu', 'vdo_menu');
149 176 add_action('admin_init', 'register_vdo_settings');
@@ -151,9 +178,9 @@
151 178 // non-admin enqueues, actions, and filters
152 179 }
153 180 function vdo_menu()
154 181 {
155 - add_options_page('VdoCipher Options', 'VdoCipher', 'manage_options', 'vdocipher', 'vdo_options');
182 + add_menu_page('VdoCipher Options', 'VdoCipher', 'manage_options', 'vdocipher', 'vdo_options');
156 183 }
157 184 function vdo_options()
158 185 {
159 186 if (!get_option('vdo_default_height')) {
@@ -178,8 +205,10 @@
178 205 register_setting('vdo_option-group', 'vdo_client_key');
179 206 register_setting('vdo_option-group', 'vdo_default_height');
180 207 register_setting('vdo_option-group', 'vdo_default_width');
181 208 register_setting('vdo_option-group', 'vdo_annotate_code');
209 + register_setting('vdo_option-group', 'vdo_embed_version');
210 + register_setting('vdo_option-group', 'vdo_player_theme');
182 211 }
183 212
184 213 /// adding a section for asking for the client key
185 214 function vdo_show_form_client_key()
@@ -192,16 +221,25 @@
192 221 delete_option('vdo_client_key');
193 222 delete_option('vdo_default_width');
194 223 delete_option('vdo_default_height');
195 224 delete_option('vdo_annotate_code');
225 + delete_option('vdo_embed_version');
226 + delete_option('vdo_player_theme');
196 227 }
197 228 function vdo_activate()
198 229 {
199 - if (!get_option('vdo_default_height')) {
200 - update_option('vdo_default_height', '400');
230 + if ((get_option('vdo_default_height')) == false) {
231 + update_option('vdo_default_height', '360');
201 232 }
202 - if (!get_option('vdo_default_width')) {
233 + if ((get_option('vdo_default_width')) == false) {
203 234 update_option('vdo_default_width', '640');
235 + }
236 + //https://stackoverflow.com/a/2173318/5022684
237 + if ((get_option('vdo_embed_version')) == false) {
238 + update_option('vdo_embed_version', '0.5');
239 + }
240 + if ((get_option('vdo_player_theme')) == false) {
241 + update_option('vdo_player_theme','9ae8bbe8dd964ddc9bdb932cca1cb59a');
204 242 }
205 243 }
206 244 register_activation_hook(__FILE__, 'vdo_activate');
207 245 function vdo_admin_notice()