/** * @param number $post_id * @return html featured video code */ function video_get_featured_video($post_id = null, $width = "", $height = "", $args = array()) { if ($post_id == null) { $post_id = get_the_ID(); } $res = ''; if (video_has_featured_video($post_id)) { $meta = get_post_meta($post_id, META_VIDEO_FEATURED_URL, true); $res = get_video_embed_code($meta, $width, $height, $args); } return $res; }
/** * retrieve configuration's form for video présentation */ function video_ajax_get_video_preview() { if (!check_ajax_referer('video-ajax-nonce', 'ajaxNonce', false)) { die('Busted!'); } $response = array('what' => 'video_ajax_get_video_preview', 'action' => 'video_ajax_get_video_preview', 'id' => '1'); $meta_video_url = isset($_POST['video_url']) ? $_POST['video_url'] : ""; $meta_video_width = isset($_POST['video_width']) ? $_POST['video_width'] : ""; $meta_video_height = isset($_POST['video_height']) ? $_POST['video_height'] : ""; $results = get_video_embed_code($meta_video_url, $meta_video_width, $meta_video_height); $response['data'] = $results; $xmlResponse = new WP_Ajax_Response($response); $xmlResponse->send(); exit; }