| @@ -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.15 | |
| 6 | + * Version: 1.10 | |
| 7 | 7 | * Author: VdoCipher |
| 8 | 8 | * Author URI: http://www.vdocipher.com |
| 9 | 9 | * License: GPL2 |
| 10 | 10 | */ |
| @@ -113,53 +113,25 @@ | ||
| 113 | 113 | $version = 0; |
| 114 | 114 | if (isset($atts['version'])) { |
| 115 | 115 | $version = $atts['version']; |
| 116 | 116 | } |
| 117 | - if ((get_option('vdo_embed_version')) == false) { | |
| 118 | - update_option('vdo_embed_version', '0.5'); | |
| 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' "; | |
| 119 | 126 | } |
| 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 | - } | |
| 127 | + $output .= "}); </script>"; | |
| 157 | 128 | return $output; |
| 158 | 129 | } |
| 159 | 130 | |
| 160 | 131 | add_shortcode('vdo', 'vdo_shortcode'); |
| 161 | 132 | |
| 133 | + | |
| 162 | 134 | /// adding the settings link |
| 163 | 135 | $plugin = plugin_basename(__FILE__); |
| 164 | 136 | add_filter("plugin_action_links_$plugin", 'vdo_settings_link'); |
| 165 | 137 | |
| @@ -164,13 +136,14 @@ | ||
| 164 | 136 | add_filter("plugin_action_links_$plugin", 'vdo_settings_link'); |
| 165 | 137 | |
| 166 | 138 | function vdo_settings_link($links) |
| 167 | 139 | { |
| 168 | - $settings_link = '<a href="options-general.php?page=vdocipher">Settings</a>'; | |
| 140 | + $settings_link = '<a href="options-general.php?page=vdocipher.php">Settings</a>'; | |
| 169 | 141 | array_unshift($links, $settings_link); |
| 170 | 142 | return $links; |
| 171 | 143 | } |
| 172 | 144 | |
| 145 | + | |
| 173 | 146 | /// add the menu item and register settings |
| 174 | 147 | if (is_admin()) { // admin actions |
| 175 | 148 | add_action('admin_menu', 'vdo_menu'); |
| 176 | 149 | add_action('admin_init', 'register_vdo_settings'); |
| @@ -178,9 +151,9 @@ | ||
| 178 | 151 | // non-admin enqueues, actions, and filters |
| 179 | 152 | } |
| 180 | 153 | function vdo_menu() |
| 181 | 154 | { |
| 182 | - add_menu_page('VdoCipher Options', 'VdoCipher', 'manage_options', 'vdocipher', 'vdo_options'); | |
| 155 | + add_options_page('VdoCipher Options', 'VdoCipher', 'manage_options', 'vdocipher', 'vdo_options'); | |
| 183 | 156 | } |
| 184 | 157 | function vdo_options() |
| 185 | 158 | { |
| 186 | 159 | if (!get_option('vdo_default_height')) { |
| @@ -205,10 +178,8 @@ | ||
| 205 | 178 | register_setting('vdo_option-group', 'vdo_client_key'); |
| 206 | 179 | register_setting('vdo_option-group', 'vdo_default_height'); |
| 207 | 180 | register_setting('vdo_option-group', 'vdo_default_width'); |
| 208 | 181 | 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'); | |
| 211 | 182 | } |
| 212 | 183 | |
| 213 | 184 | /// adding a section for asking for the client key |
| 214 | 185 | function vdo_show_form_client_key() |
| @@ -221,26 +192,17 @@ | ||
| 221 | 192 | delete_option('vdo_client_key'); |
| 222 | 193 | delete_option('vdo_default_width'); |
| 223 | 194 | delete_option('vdo_default_height'); |
| 224 | 195 | delete_option('vdo_annotate_code'); |
| 225 | - delete_option('vdo_embed_version'); | |
| 226 | - delete_option('vdo_player_theme'); | |
| 227 | 196 | } |
| 228 | 197 | function vdo_activate() |
| 229 | 198 | { |
| 230 | - if ((get_option('vdo_default_height')) == false) { | |
| 231 | - update_option('vdo_default_height', '360'); | |
| 199 | + if (!get_option('vdo_default_height')) { | |
| 200 | + update_option('vdo_default_height', '400'); | |
| 232 | 201 | } |
| 233 | - if ((get_option('vdo_default_width')) == false) { | |
| 202 | + if (!get_option('vdo_default_width')) { | |
| 234 | 203 | update_option('vdo_default_width', '640'); |
| 235 | 204 | } |
| 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'); | |
| 242 | - } | |
| 243 | 205 | } |
| 244 | 206 | register_activation_hook(__FILE__, 'vdo_activate'); |
| 245 | 207 | function vdo_admin_notice() |
| 246 | 208 | { |
| @@ -256,5 +218,5 @@ | ||
| 256 | 218 | </div> |
| 257 | 219 | <?php |
| 258 | 220 | } |
| 259 | 221 | } |
| 260 | -add_action('admin_notices', 'vdo_admin_notice'); | |
| 222 | +add_action('admin_notices', 'vdo_admin_notice'); | |