WordPress.org

Make WordPress Core

Changeset 19107


Ignore:
Timestamp:
11/01/2011 09:23:05 PM (9 years ago)
Author:
nacin
Message:

Simplify logic in wp-fullscreen-save-post. Most of this came from post.php but that's been cut down as well. see #18785.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-ajax.php

    r19106 r19107  
    15071507    break;
    15081508case 'wp-fullscreen-save-post' :
    1509     if ( isset($_POST['post_ID']) )
    1510         $post_id = (int) $_POST['post_ID'];
    1511     else
    1512         $post_id = 0;
    1513 
    1514     $post = null;
    1515     $post_type_object = null;
    1516     $post_type = null;
    1517     if ( $post_id ) {
    1518         $post = get_post($post_id);
    1519         if ( $post ) {
    1520             $post_type_object = get_post_type_object($post->post_type);
    1521             if ( $post_type_object )
    1522                 $post_type = $post->post_type;
    1523         }
    1524     } elseif ( isset($_POST['post_type']) ) {
    1525         $post_type_object = get_post_type_object($_POST['post_type']);
    1526         if ( $post_type_object )
    1527             $post_type = $post_type_object->name;
    1528     }
     1509    $post_id = isset( $_POST['post_ID'] ) ? (int) $_POST['post_ID'] : 0;
     1510
     1511    $post = $post_type = null;
     1512
     1513    if ( $post_id )
     1514        $post = get_post( $post_id );
     1515
     1516    if ( $post )
     1517        $post_type = $post->post_type;
     1518    elseif ( isset( $_POST['post_type'] ) && post_type_exists( $_POST['post_type'] ) )
     1519        $post_type = $_POST['post_type'];
    15291520
    15301521    check_ajax_referer('update-' . $post_type . '_' . $post_id, '_wpnonce');
Note: See TracChangeset for help on using the changeset viewer.