\r\n
\r\nThe requested URL " . $_SERVER['SCRIPT_NAME'] . " was not found on this server.
\r\n"); } function vdo_send($action, $params, $posts = array()){ $client_key = get_option('vdo_client_key'); if ($client_key == false || $client_key == "") { return "Plugin not configured. Please set the key to embed videos."; } $getData = http_build_query($params); $posts["clientSecretKey"] = $client_key; $url = "http://api.vdocipher.com/v2/$action/?$getData"; $response = wp_safe_remote_post($url, array( 'method' => 'POST', 'body' => $posts )); if (is_wp_error( $response )) { $error_message = $response->get_error_message(); echo "VdoCipher: Something went wrong: $error_message"; return ""; } return $response['body']; } function vdo_shortcode( $atts ) { extract( shortcode_atts( array( 'title' => 'TITLE_OF_VIDEO', 'width' => get_option('vdo_default_width') . "px", 'height' => get_option('vdo_default_height') . "px", 'id' => 'id', 'no_annotate'=> false ), $atts ) ); if(!$atts['id']){ if(!$atts['title']) return "Required argument id for embedded video not found."; $params = array( 'search'=>array( 'title'=>$title ), 'page'=>1, 'limit'=>30, 'type'=>'json' ); $video = vdo_send("videos", $params); $video = json_decode($video); if($video == null) return "404. Video not found."; $video = $video[0]->id; if ($video == null) { return "No video with given title found."; } } else $video = $id; $params = array( 'video'=>$video ); $anno = false; if (!function_exists("eval_date")) { function eval_date($matches){ return current_time($matches[1]); } } if (get_option('vdo_annotate_code') != "") { $current_user = wp_get_current_user(); $vdo_annotate_code = get_option('vdo_annotate_code'); $vdo_annotate_code = apply_filters('vdocipher_annotate_preprocess', $vdo_annotate_code); if (is_user_logged_in()) { $vdo_annotate_code = str_replace('{name}', $current_user->display_name , $vdo_annotate_code); $vdo_annotate_code = str_replace('{email}', $current_user->user_email , $vdo_annotate_code); $vdo_annotate_code = str_replace('{username}', $current_user->user_login , $vdo_annotate_code); $vdo_annotate_code = str_replace('{id}', $current_user->ID , $vdo_annotate_code); } $vdo_annotate_code = str_replace('{ip}', $_SERVER['REMOTE_ADDR'] , $vdo_annotate_code); $vdo_annotate_code = preg_replace_callback('/\{date\.([^\}]+)\}/', "eval_date" , $vdo_annotate_code); $vdo_annotate_code = apply_filters('vdocipher_annotate_postprocess', $vdo_annotate_code); if(!$no_annotate) $anno = array("annotate" => $vdo_annotate_code); } $OTP = vdo_send("otp", $params, $anno); $OTP = json_decode($OTP); if(is_null($OTP)){ $output = "The VdoCipher plugin is not ready. Click here to configure