| @@ -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.3 | |
| 6 | + * Version: 1.6 | |
| 7 | 7 | * Author: VdoCipher |
| 8 | 8 | * Author URI: http://www.vdocipher.com |
| 9 | 9 | * License: GPL2 |
| 10 | 10 | */ |
| @@ -80,14 +80,17 @@ | ||
| 80 | 80 | $params = array( |
| 81 | 81 | 'video'=>$video |
| 82 | 82 | ); |
| 83 | 83 | $anno = false; |
| 84 | - function eval_date($matches){ | |
| 85 | - return date($matches[1]); | |
| 84 | + if (!function_exists("eval_date")) { | |
| 85 | + function eval_date($matches){ | |
| 86 | + return date($matches[1]); | |
| 87 | + } | |
| 86 | 88 | } |
| 87 | 89 | if (get_option('vdo_annotate_code') != "") { |
| 88 | 90 | $current_user = wp_get_current_user(); |
| 89 | 91 | $vdo_annotate_code = get_option('vdo_annotate_code'); |
| 92 | + $vdo_annotate_code = apply_filters('vdocipher_annotate_preprocess', $vdo_annotate_code); | |
| 90 | 93 | if (is_user_logged_in()) { |
| 91 | 94 | $vdo_annotate_code = str_replace('{name}', $current_user->display_name , $vdo_annotate_code); |
| 92 | 95 | $vdo_annotate_code = str_replace('{email}', $current_user->user_email , $vdo_annotate_code); |
| 93 | 96 | $vdo_annotate_code = str_replace('{username}', $current_user->user_login , $vdo_annotate_code); |
| @@ -94,13 +97,19 @@ | ||
| 94 | 97 | $vdo_annotate_code = str_replace('{id}', $current_user->ID , $vdo_annotate_code); |
| 95 | 98 | } |
| 96 | 99 | $vdo_annotate_code = str_replace('{ip}', $_SERVER['REMOTE_ADDR'] , $vdo_annotate_code); |
| 97 | 100 | $vdo_annotate_code = preg_replace_callback('/\{date\.([^\}]+)\}/', "eval_date" , $vdo_annotate_code); |
| 101 | + $vdo_annotate_code = apply_filters('vdocipher_annotate_postprocess', $vdo_annotate_code); | |
| 98 | 102 | if(!$no_annotate) |
| 99 | 103 | $anno = "annotate=". urlencode($vdo_annotate_code); |
| 100 | 104 | } |
| 101 | 105 | $OTP = vdo_send("otp", $params, $anno); |
| 102 | - $OTP = json_decode($OTP)->otp; | |
| 106 | + $OTP = json_decode($OTP); | |
| 107 | + if(is_null($OTP)){ | |
| 108 | + $output = "<span id='vdo$OTP' style='background:#555555;color:#FFFFFF'><h4>Video not found</h4></span>"; | |
| 109 | + return $output; | |
| 110 | + } | |
| 111 | + $OTP = $OTP->otp; | |
| 103 | 112 | |
| 104 | 113 | $output = "<span id='vdo$OTP'></span>"; |
| 105 | 114 | $output .= "<script src='https://de122v0opjemw.cloudfront.net/utils/playerInit.php?otp=$OTP&height=$height&width=$width&'></script>"; |
| 106 | 115 | return $output; |
| @@ -131,9 +140,9 @@ | ||
| 131 | 140 | add_options_page( 'VdoCipher Options', 'VdoCipher', 'manage_options', 'vdocipher', 'vdo_options' ); |
| 132 | 141 | } |
| 133 | 142 | function vdo_options(){ |
| 134 | 143 | if (!get_option('vdo_default_height')) |
| 135 | - update_option('vdo_default_height', '400'); | |
| 144 | + update_option('vdo_default_height', '360'); | |
| 136 | 145 | if (!get_option('vdo_default_width')) |
| 137 | 146 | update_option('vdo_default_width', '640'); |
| 138 | 147 | $vdo_client_key = get_option('vdo_client_key'); |
| 139 | 148 | if (!$vdo_client_key && strlen($vdo_client_key) != 64) { |