X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/699231ae09f7057a4d0000cdf32e50a3df6a04ca..refs/tags/wordpress-3.1.2:/wp-admin/press-this.php diff --git a/wp-admin/press-this.php b/wp-admin/press-this.php index a1a6f780..e2b3f334 100644 --- a/wp-admin/press-this.php +++ b/wp-admin/press-this.php @@ -6,8 +6,11 @@ * @subpackage Press_This */ +define('IFRAME_REQUEST' , true); + /** WordPress Administration Bootstrap */ require_once('./admin.php'); + header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset')); if ( ! current_user_can('edit_posts') ) @@ -24,6 +27,7 @@ if ( ! current_user_can('edit_posts') ) */ function press_it() { // define some basic variables + $quick = array(); $quick['post_status'] = 'draft'; // set as draft first $quick['post_category'] = isset($_POST['post_category']) ? $_POST['post_category'] : null; $quick['tax_input'] = isset($_POST['tax_input']) ? $_POST['tax_input'] : null; @@ -52,13 +56,30 @@ function press_it() { } } // set the post_content and status - $quick['post_status'] = isset($_POST['publish']) ? 'publish' : 'draft'; + if ( isset( $_POST['publish'] ) && current_user_can( 'publish_posts' ) ) + $quick['post_status'] = 'publish'; + elseif ( isset( $_POST['review'] ) ) + $quick['post_status'] = 'pending'; + else + $quick['post_status'] = 'draft'; $quick['post_content'] = $content; // error handling for media_sideload if ( is_wp_error($upload) ) { wp_delete_post($post_ID); wp_die($upload); } else { + // Post formats + if ( current_theme_supports( 'post-formats' ) && isset( $_POST['post_format'] ) ) { + $post_formats = get_theme_support( 'post-formats' ); + if ( is_array( $post_formats ) ) { + $post_formats = $post_formats[0]; + if ( in_array( $_POST['post_format'], $post_formats ) ) + set_post_format( $post_ID, $_POST['post_format'] ); + elseif ( '0' == $_POST['post_format'] ) + set_post_format( $post_ID, false ); + } + } + $quick['ID'] = $post_ID; wp_update_post($quick); } @@ -110,7 +131,7 @@ if ( !empty($_REQUEST['ajax']) ) {

- +

@@ -317,7 +338,7 @@ die; //','uid':'ID; ?>','time':''}; -var ajaxurl = '', pagenow = 'press-this'; +var ajaxurl = '', pagenow = 'press-this', isRtl = ; var photostorage = false; //]]> @@ -327,8 +348,10 @@ var photostorage = false; do_action('admin_print_scripts'); do_action('admin_head'); - if ( user_can_richedit() ) + if ( user_can_richedit() ) { wp_tiny_mce( true, array( 'height' => '370' ) ); + add_action( 'admin_print_footer_scripts', 'wp_tiny_mce_preload_dialogs', 30 ); + } ?>