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.

query("UPDATE " . $wpdb->prefix . "postmeta SET meta_key='_videoembed_manual' WHERE meta_key='videoembed'"); } /** * Post admin hooks */ add_action('admin_menu', "p75_videoAdminInit"); add_action('save_post', 'p75_saveVideo'); /** * Add video posting widget and options page. */ function p75_videoAdminInit() { if( function_exists("add_meta_box") ) { add_meta_box("p75-video-posting", "Post Video Options", "p75_videoPosting", "post", "advanced"); } add_options_page('Simple Video Embedder Options', 'Video Options', 8, 'videooptions', 'p75_videoOptionsAdmin'); } /** * Code for the meta box. */ function p75_videoPosting() { global $post_ID; $videoURL = get_post_meta($post_ID, '_videoembed', true); $videoHeight = get_post_meta($post_ID, '_videoheight', true); $videoWidth = get_post_meta($post_ID, '_videowidth', true); $videoEmbed = get_post_meta($post_ID, '_videoembed_manual', true); ?>
" target="_blank">



' . __("Video Preview") . ': (' . __("Actual Size") . ')
'; $videoEmbedder = p75VideoEmbedder::getInstance(); $videoEmbedder->setWidth( $videoWidth ? $videoWidth : get_option('p75_default_player_width') ); $videoEmbedder->setHeight( $videoHeight ? $videoHeight : get_option('p75_default_player_height') ); echo $videoEmbedder->getEmbedCode($videoURL); echo '
'; } else if ( $videoEmbed ) { echo '
' . __("Video Preview") . ': (' . __("Actual Size") . ')
'; echo stripslashes($videoEmbed); echo '
'; } ?>

" 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() { ?>

Simple Video Embedder Options

The default width of the video player if not set.
The default height of the video player if not set.
: The location of the JW player files relative to your WordPress installation.
" target="_blank">: Extra parameters for JW player. For experienced users.

__( 'Press75 Simple Video Plugin 1.2' ), 'readonly' => true, 'option' => 'simple_video_embedder' ); return $blogopts; } add_filter('xmlrpc_blog_options', 'ident_simple_video_plugin'); ?>