mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
Simplify logic in wp-fullscreen-save-post. Most of this came from post.php but that's been cut down as well. see #18785.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19107 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
9e397bfb12
commit
687642fead
@ -1506,26 +1506,17 @@ case 'time_format' :
|
||||
die( date_i18n( sanitize_option( 'time_format', $_POST['date'] ) ) );
|
||||
break;
|
||||
case 'wp-fullscreen-save-post' :
|
||||
if ( isset($_POST['post_ID']) )
|
||||
$post_id = (int) $_POST['post_ID'];
|
||||
else
|
||||
$post_id = 0;
|
||||
$post_id = isset( $_POST['post_ID'] ) ? (int) $_POST['post_ID'] : 0;
|
||||
|
||||
$post = null;
|
||||
$post_type_object = null;
|
||||
$post_type = null;
|
||||
if ( $post_id ) {
|
||||
$post = get_post($post_id);
|
||||
if ( $post ) {
|
||||
$post_type_object = get_post_type_object($post->post_type);
|
||||
if ( $post_type_object )
|
||||
$post_type = $post->post_type;
|
||||
}
|
||||
} elseif ( isset($_POST['post_type']) ) {
|
||||
$post_type_object = get_post_type_object($_POST['post_type']);
|
||||
if ( $post_type_object )
|
||||
$post_type = $post_type_object->name;
|
||||
}
|
||||
$post = $post_type = null;
|
||||
|
||||
if ( $post_id )
|
||||
$post = get_post( $post_id );
|
||||
|
||||
if ( $post )
|
||||
$post_type = $post->post_type;
|
||||
elseif ( isset( $_POST['post_type'] ) && post_type_exists( $_POST['post_type'] ) )
|
||||
$post_type = $_POST['post_type'];
|
||||
|
||||
check_ajax_referer('update-' . $post_type . '_' . $post_id, '_wpnonce');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user