Press75.com. Version: 1.3 Author: James Lao Author URI: http://jameslao.com/ */ require_once('video-embedder.php'); require_once('video-players.php'); if(!defined('PHP_VERSION_ID')) { $version = PHP_VERSION; define('PHP_VERSION_ID', ($version{0} * 10000 + $version{2} * 100 + $version{4})); } if ( PHP_VERSION_ID < 50000 ) { function spt_php_version_error() { ?>
You are currently using PHP4. You must be using PHP5 to use the Simple Video Embedder plugin. Ask your host for information on how to switch to PHP5.
' . __("Video Preview") . ': (' . __("Actual Size") . ')
" accesskey="p" tabindex="5" name="save"/>
get_var("SELECT post_type FROM $wpdb->posts WHERE ID=$postID")=='revision') $postID = $wpdb->get_var("SELECT post_parent FROM $wpdb->posts WHERE ID=$postID"); // Trim white space just in case. $_POST['p75-video-embed'] = trim($_POST['p75-video-embed']); $_POST['p75-video-url'] = trim($_POST['p75-video-url']); $_POST['p75-video-width'] = trim($_POST['p75-video-width']); $_POST['p75-video-height'] = trim($_POST['p75-video-height']); if ( $_POST['p75-remove-video'] ) { // Remove video delete_post_meta($postID, '_videoembed'); delete_post_meta($postID, '_videowidth'); delete_post_meta($postID, '_videoheight'); delete_post_meta($postID, '_videoembed_manual'); } elseif ( $_POST['p75-video-embed'] ) { // Save video embed code. if( !update_post_meta($postID, '_videoembed_manual', $_POST['p75-video-embed'] ) ) add_post_meta($postID, '_videoembed_manual', $_POST['p75-video-embed'] ); delete_post_meta($postID, '_videoembed'); delete_post_meta($postID, '_videowidth'); delete_post_meta($postID, '_videoheight'); } elseif ( $_POST['p75-video-url'] ) { // Save video URL. if( !update_post_meta($postID, '_videoembed', $_POST['p75-video-url'] ) ) add_post_meta($postID, '_videoembed', $_POST['p75-video-url'] ); delete_post_meta($postID, '_videoembed_manual'); // Save width and height. if ( is_numeric($_POST['p75-video-width']) ) { if( !update_post_meta($postID, '_videowidth', $_POST['p75-video-width']) ) add_post_meta($postID, '_videowidth', $_POST['p75-video-width']); } else if ( empty($_POST['p75-video-width']) ) delete_post_meta($postID, '_videowidth'); if ( is_numeric($_POST['p75-video-height']) ) { if( !update_post_meta($postID, '_videoheight', $_POST['p75-video-height']) ) add_post_meta($postID, '_videoheight', $_POST['p75-video-height']); } else if ( empty($_POST['p75-video-height']) ) delete_post_meta($postID, '_videoheight'); } } /** * Gets the embed code for a video. * * @param $postID The post ID of the video * @return The embed code */ function p75GetVideo($postID) { // legacy support... if ( $videoURL = get_post_meta($postID, 'videoembed', true) ) return $videoURL; if ( $videoEmbed = get_post_meta($postID, '_videoembed_manual', true ) ) return $videoEmbed; $videoURL = get_post_meta($postID, '_videoembed', true); if ( !($videoWidth = get_post_meta($postID, '_videowidth', true)) ) $videoWidth = get_option('p75_default_player_width'); if ( !($videoHeight = get_post_meta($postID, '_videoheight', true)) ) $videoHeight = get_option('p75_default_player_height'); $videoEmbedder = p75VideoEmbedder::getInstance(); $videoEmbedder->setWidth($videoWidth); $videoEmbedder->setHeight($videoHeight); return $videoEmbedder->getEmbedCode($videoURL); } /** * Returns true if post has a video. * * @param $postID The post ID * @return True if post has a video, false otherwise */ function p75HasVideo($postID) { return (bool) ( get_post_meta($postID, '_videoembed', true) || get_post_meta($postID, '_videoembed_manual', true) || get_post_meta($postID, 'videoembed', true) ); } function p75_videoOptionsAdmin() { ?>