| @@ -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.21 | |
| 7 | 7 | * Author: VdoCipher |
| 8 | 8 | * Author URI: http://www.vdocipher.com |
| 9 | 9 | * License: GPL2 |
| 10 | 10 | */ |
| @@ -46,11 +46,15 @@ | ||
| 46 | 46 | 'height' => get_option('vdo_default_height') . "px", |
| 47 | 47 | 'id' => 'id', |
| 48 | 48 | 'no_annotate'=> false, |
| 49 | 49 | 'version'=> 0, |
| 50 | + 'player_tech'=> '' | |
| 50 | 51 | ), |
| 51 | 52 | $atts |
| 52 | 53 | )); |
| 54 | + if ((get_option('vdo_default_height')) == 'auto') { | |
| 55 | + $height = 'auto'; | |
| 56 | + } | |
| 53 | 57 | if (!$atts['id']) { |
| 54 | 58 | if (!$atts['title']) { |
| 55 | 59 | return "Required argument id for embedded video not found."; |
| 56 | 60 | } |
| @@ -114,22 +118,44 @@ | ||
| 114 | 118 | if (isset($atts['version'])) { |
| 115 | 119 | $version = $atts['version']; |
| 116 | 120 | } |
| 117 | 121 | if ((get_option('vdo_embed_version')) == false) { |
| 118 | - update_option('vdo_embed_version', '0.5'); | |
| 122 | + update_option('vdo_embed_version', '1.6.4'); | |
| 119 | 123 | } |
| 120 | 124 | if ((get_option('vdo_player_theme')) == false) { |
| 121 | - update_option('vdo_player_theme','9ae8bbe8dd964ddc9bdb932cca1cb59a'); | |
| 125 | + update_option('vdo_player_theme', '9ae8bbe8dd964ddc9bdb932cca1cb59a'); | |
| 122 | 126 | } |
| 123 | 127 | $vdo_embed_version_str = get_option('vdo_embed_version'); |
| 124 | 128 | $vdo_player_theme = get_option('vdo_player_theme'); |
| 125 | 129 | |
| 130 | + // tech override custom names start | |
| 131 | + switch ($player_tech) { | |
| 132 | + case "flash": | |
| 133 | + $player_tech = "*,-dash"; | |
| 134 | + break; | |
| 135 | + case "nohtml5": | |
| 136 | + $player_tech = "*,-dash"; | |
| 137 | + break; | |
| 138 | + case "noflash": | |
| 139 | + $player_tech = "*,-hss"; | |
| 140 | + break; | |
| 141 | + case "nozen": | |
| 142 | + $player_tech = "*,-zen"; | |
| 143 | + break; | |
| 144 | + case "noios": | |
| 145 | + $player_tech = "*,-hlse"; | |
| 146 | + break; | |
| 147 | + default: | |
| 148 | + break; | |
| 149 | + } | |
| 150 | + // tech override ends | |
| 151 | + | |
| 126 | 152 | // Old Embed Code |
| 127 | - if($vdo_embed_version_str === '0.5') { | |
| 153 | + if ($vdo_embed_version_str === '0.5') { | |
| 128 | 154 | $output = "<div id='vdo$OTP' style='height:$height;width:$width;max-width:100%' ></div>"; |
| 129 | 155 | $output .= "<script> (function(v,i,d,e,o){v[o]=v[o]||{}; v[o].add = v[o].add || function V(a){". |
| 130 | 156 | " (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; ". | |
| 157 | + $output .= "if(!v[o].l) { v[o].l=1*new Date();a=i.createElement(d),m=i.getElementsByTagName(d)[0];a.async=1;". | |
| 132 | 158 | "a.src=e; m.parentNode.insertBefore(a,m);}"; |
| 133 | 159 | $output .= " })(window,document,'script','//de122v0opjemw.cloudfront.net/vdo.js','vdo'); vdo.add({ "; |
| 134 | 160 | $output .= "o: '$OTP', "; |
| 135 | 161 | if ($version == 32) { |
| @@ -135,13 +161,18 @@ | ||
| 135 | 161 | if ($version == 32) { |
| 136 | 162 | $output .= "version: '$version' "; |
| 137 | 163 | } |
| 138 | 164 | $output .= "}); </script>"; |
| 139 | - } | |
| 140 | - //New embed code | |
| 141 | - else { | |
| 165 | + } else { | |
| 166 | + //New embed code | |
| 167 | + if ($player_tech === '') { | |
| 168 | + if (get_option(vdo_watermark_flash_html) === 'flash') { | |
| 169 | + $player_tech = "*,-dash"; | |
| 170 | + } | |
| 171 | + } | |
| 142 | 172 | $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);};"; | |
| 173 | + $output .= "<script>(function(v,i,d,e,o){v[o]=v[o]||{}; v[o].add = v[o].add || function V(a){". | |
| 174 | + "(v[o].d=v[o].d||[]).push(a);};"; | |
| 144 | 175 | $output .= "if(!v[o].l) { v[o].l=1*new Date(); a=i.createElement(d), m=i.getElementsByTagName(d)[0];"; |
| 145 | 176 | $output .= "a.async=1; a.src=e; m.parentNode.insertBefore(a,m);}"; |
| 146 | 177 | $output .= "})(window,document,'script','https://d1z78r8i505acl.cloudfront.net/playerAssets/"; |
| 147 | 178 | $output .= "$vdo_embed_version_str"; |
| @@ -150,8 +181,20 @@ | ||
| 150 | 181 | $output .= "otp: '$OTP',"; |
| 151 | 182 | $output .= "playbackInfo: btoa(JSON.stringify({"; |
| 152 | 183 | $output .= "videoId: '$video'})),"; |
| 153 | 184 | $output .= "theme: '$vdo_player_theme',"; |
| 185 | + if ($player_tech !== '') { | |
| 186 | + $output .= "techoverride: [" ; | |
| 187 | + $techarray = explode(',', $player_tech); | |
| 188 | + for ($i = 0; $i < sizeof($techarray); $i++) { | |
| 189 | + $techStr = $techarray[$i]; | |
| 190 | + $output .= "'$techStr'"; | |
| 191 | + if ($i !== sizeof($techarray)-1) { | |
| 192 | + $output .= ", "; | |
| 193 | + } | |
| 194 | + } | |
| 195 | + $output .= "],"; | |
| 196 | + } | |
| 154 | 197 | $output .= "container: document.querySelector('#vdo$OTP'),});"; |
| 155 | 198 | $output .= "</script>"; |
| 156 | 199 | } |
| 157 | 200 | return $output; |
| @@ -178,17 +221,24 @@ | ||
| 178 | 221 | // non-admin enqueues, actions, and filters |
| 179 | 222 | } |
| 180 | 223 | function vdo_menu() |
| 181 | 224 | { |
| 182 | - add_menu_page('VdoCipher Options', 'VdoCipher', 'manage_options', 'vdocipher', 'vdo_options'); | |
| 225 | + add_menu_page( | |
| 226 | + 'VdoCipher Options', | |
| 227 | + 'VdoCipher', | |
| 228 | + 'manage_options', | |
| 229 | + 'vdocipher', | |
| 230 | + 'vdo_options', | |
| 231 | + plugin_dir_url(__FILE__).'images/logo.png' | |
| 232 | + ); | |
| 183 | 233 | } |
| 184 | 234 | function vdo_options() |
| 185 | 235 | { |
| 186 | 236 | if (!get_option('vdo_default_height')) { |
| 187 | - update_option('vdo_default_height', '360'); | |
| 237 | + update_option('vdo_default_height', 'auto'); | |
| 188 | 238 | } |
| 189 | 239 | if (!get_option('vdo_default_width')) { |
| 190 | - update_option('vdo_default_width', '640'); | |
| 240 | + update_option('vdo_default_width', '1280'); | |
| 191 | 241 | } |
| 192 | 242 | $vdo_client_key = get_option('vdo_client_key'); |
| 193 | 243 | if (!$vdo_client_key && strlen($vdo_client_key) != 64) { |
| 194 | 244 | vdo_show_form_client_key(); |
| @@ -207,8 +257,9 @@ | ||
| 207 | 257 | register_setting('vdo_option-group', 'vdo_default_width'); |
| 208 | 258 | register_setting('vdo_option-group', 'vdo_annotate_code'); |
| 209 | 259 | register_setting('vdo_option-group', 'vdo_embed_version'); |
| 210 | 260 | register_setting('vdo_option-group', 'vdo_player_theme'); |
| 261 | + register_setting('vdo_option-group', 'vdo_watermark_flash_html'); | |
| 211 | 262 | } |
| 212 | 263 | |
| 213 | 264 | /// adding a section for asking for the client key |
| 214 | 265 | function vdo_show_form_client_key() |
| @@ -223,24 +274,28 @@ | ||
| 223 | 274 | delete_option('vdo_default_height'); |
| 224 | 275 | delete_option('vdo_annotate_code'); |
| 225 | 276 | delete_option('vdo_embed_version'); |
| 226 | 277 | delete_option('vdo_player_theme'); |
| 278 | + delete_option('vdo_watermark_flash_html'); | |
| 227 | 279 | } |
| 228 | 280 | function vdo_activate() |
| 229 | 281 | { |
| 230 | 282 | if ((get_option('vdo_default_height')) == false) { |
| 231 | - update_option('vdo_default_height', '360'); | |
| 283 | + update_option('vdo_default_height', 'auto'); | |
| 232 | 284 | } |
| 233 | 285 | if ((get_option('vdo_default_width')) == false) { |
| 234 | - update_option('vdo_default_width', '640'); | |
| 286 | + update_option('vdo_default_width', '1280'); | |
| 235 | 287 | } |
| 236 | 288 | //https://stackoverflow.com/a/2173318/5022684 |
| 237 | 289 | if ((get_option('vdo_embed_version')) == false) { |
| 238 | - update_option('vdo_embed_version', '0.5'); | |
| 290 | + update_option('vdo_embed_version', '1.6.4'); | |
| 239 | 291 | } |
| 240 | 292 | if ((get_option('vdo_player_theme')) == false) { |
| 241 | - update_option('vdo_player_theme','9ae8bbe8dd964ddc9bdb932cca1cb59a'); | |
| 293 | + update_option('vdo_player_theme', '9ae8bbe8dd964ddc9bdb932cca1cb59a'); | |
| 242 | 294 | } |
| 295 | + if ((get_option('vdo_watermark_flash_html')) == false) { | |
| 296 | + update_option('vdo_watermark_flash_html', 'html5'); | |
| 297 | + } | |
| 243 | 298 | } |
| 244 | 299 | register_activation_hook(__FILE__, 'vdo_activate'); |
| 245 | 300 | function vdo_admin_notice() |
| 246 | 301 | { |
| @@ -256,5 +311,5 @@ | ||
| 256 | 311 | </div> |
| 257 | 312 | <?php |
| 258 | 313 | } |
| 259 | 314 | } |
| 260 | -add_action('admin_notices', 'vdo_admin_notice'); | |
| 315 | +add_action('admin_notices', 'vdo_admin_notice'); | |