{ 'mime_type' }); echo lh_pressbox_get_file($connection, $_GET['display'], null); exit; } if (isset($_GET['display_thumb'])) { require_once( "../../../wp-load.php" ); require_once( plugin_dir_path(__FILE__) . "/includes/pressbox-oauth.php"); require_once( plugin_dir_path(__FILE__) . "/includes/pressbox-api.php"); if (!wp_verify_nonce($_GET['_wpnonce'])) { exit; } $connection = new PressboxOauth( get_option('lh_pressbox_consumer_key'), get_option('lh_pressbox_consumer_secret'), get_option('lh_pressbox_access_token'), get_option('lh_pressbox_access_token_secret')); header("Content-Type: image/jpeg"); echo lh_pressbox_get_thumbnail($connection, $_GET['display_thumb'], $_GET['size']); exit; } // Include some common functionality require_once( plugin_dir_path(__FILE__) . "/includes/pressbox-oauth.php"); require_once( plugin_dir_path(__FILE__) . "/includes/pressbox-api.php"); /** * Activation Code * * Checks for plugin compatibility and installs settings on * activation. * */ add_action( 'admin_init', 'lh_pressbox_activate' ); function lh_pressbox_activate() { // We require the JSON support in PHP 5.2+, disable if // we don't find it. if (!function_exists("json_decode")) { add_action("admin_notices", "lh_activation_php_error"); } // We require at least Wordpress 3.0 if (version_compare(get_bloginfo('version'), '3.0', '<')) { add_action("admin_notices", "lh_activation_wpversion_error"); } } function lh_activation_php_error() { echo "

Pressbox requires PHP 5.2+ to function.

"; deactivate_plugins(basename(__FILE__)); } function lh_activation_wpversion_error() { echo "

Pressbox requires Wordpress 3.0+ to function.

"; deactivate_plugins(basename(__FILE__)); } /** * Insert Settings Page * * Adds Pressbox menu into Settings menu. * */ add_action('admin_menu', 'lh_pressbox_create_menu'); function lh_pressbox_create_menu() { $settings_page = add_options_page('Pressbox Settings', 'Pressbox', 'manage_options', __FILE__, 'lh_pressbox_settings_page'); add_action('admin_head-' . $settings_page, 'lh_pressbox_get_styles'); } function lh_pressbox_get_styles() { if ($_GET['page'] == "pressbox/pressbox.php") { echo ''; } } /** * Pressbox Settings Page * * Displays Pressbox Settings * */ function lh_pressbox_settings_page() { if (file_exists(dirname(__FILE__) . '/includes/pressbox-settings.php')) { include( dirname(__FILE__) . '/includes/pressbox-settings.php' ); } else { echo "
Could not locate the settings page. Please reinstall Pressbox.
"; } } /** * Add Pressbox Media Upload Tab */ add_filter('media_upload_tabs', 'lh_pressbox_media_menu'); add_action('media_upload_pressbox', 'lh_pressbox_media_menu_handle'); function lh_pressbox_media_menu($tabs) { if (get_option('lh_pressbox_access_token')) { // Are we connected to Dropbox? $newtab = array('pressbox' => __('From Dropbox', 'pressbox')); return array_merge($tabs, $newtab); } else { // No, not connected. return $tabs; } } function lh_pressbox_media_menu_handle() { return wp_iframe('media_lh_pressbox_process'); } function media_lh_pressbox_process() { if (file_exists(dirname(__FILE__) . '/includes/pressbox-media.php')) { include( dirname(__FILE__) . '/includes/pressbox-media.php' ); } else { echo "
Could not locate the media page. Please reinstall Pressbox.
"; } } /** * Shortcodes */ add_shortcode("pressbox", "lh_pressbox_shortcode"); function lh_pressbox_shortcode($attr) { if ($attr['path']) { $code = wp_create_nonce(); if (isset($attr['type']) && $attr['type'] == "link") { if (isset($attr['name'])) { $name = $attr['name']; } else { $name = $attr['path']; } return "" . $name . ""; } else { return ""; } } else { return "Pressbox Error: No path passed to shortcode."; } }