X-Git-Url: https://scripts.mit.edu/gitweb/autoinstallsdev/wordpress.git/blobdiff_plain/fa11948979fd6a4ea5705dc613b239699a459db3..874d2a2f468a0d1e69aab49b1fe2d9d79d3e1142:/wp-admin/press-this.php diff --git a/wp-admin/press-this.php b/wp-admin/press-this.php index 5e9e2596..97733648 100644 --- a/wp-admin/press-this.php +++ b/wp-admin/press-this.php @@ -19,8 +19,6 @@ if ( ! current_user_can( 'edit_posts' ) || ! current_user_can( get_post_type_obj /** * Press It form handler. * - * @package WordPress - * @subpackage Press_This * @since 2.6.0 * * @return int Post ID @@ -42,7 +40,7 @@ function press_it() { $upload = false; if ( !empty($_POST['photo_src']) && current_user_can('upload_files') ) { foreach( (array) $_POST['photo_src'] as $key => $image) { - // see if files exist in content - we don't want to upload non-used selected files. + // See if files exist in content - we don't want to upload non-used selected files. if ( strpos($_POST['content'], htmlspecialchars($image)) !== false ) { $desc = isset($_POST['photo_description'][$key]) ? $_POST['photo_description'][$key] : ''; $upload = media_sideload_image($image, $post_ID, $desc); @@ -53,7 +51,7 @@ function press_it() { } } } - // set the post_content and status + // Set the post_content and status. $post['post_content'] = $content; if ( isset( $_POST['publish'] ) && current_user_can( 'publish_posts' ) ) $post['post_status'] = 'publish'; @@ -62,12 +60,12 @@ function press_it() { else $post['post_status'] = 'draft'; - // error handling for media_sideload + // Error handling for media_sideload. if ( is_wp_error($upload) ) { wp_delete_post($post_ID); - wp_die($upload); + wp_die( esc_html( $upload->get_error_message() ) ); } else { - // Post formats + // Post formats. if ( isset( $_POST['post_format'] ) ) { if ( current_theme_supports( 'post-formats', $_POST['post_format'] ) ) set_post_format( $post_ID, $_POST['post_format'] ); @@ -146,7 +144,7 @@ if ( !empty($_REQUEST['ajax']) ) {