Make WordPress Core


Ignore:
File:
1 edited

Legend:

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

    r17962 r19272  
    1717wp_reset_vars(array('action', 'safe_mode', 'withcomments', 'posts', 'content', 'edited_post_title', 'comment_error', 'profile', 'trackback_url', 'excerpt', 'showcomments', 'commentstart', 'commentend', 'commentorder'));
    1818
    19 if ( isset($_GET['post']) )
    20     $post_id = (int) $_GET['post'];
    21 elseif ( isset($_POST['post_ID']) )
    22     $post_id = (int) $_POST['post_ID'];
     19if ( isset( $_GET['post'] ) )
     20    $post_id = $post_ID = (int) $_GET['post'];
     21elseif ( isset( $_POST['post_ID'] ) )
     22    $post_id = $post_ID = (int) $_POST['post_ID'];
    2323else
    24     $post_id = 0;
    25 $post_ID = $post_id;
    26 $post = null;
    27 $post_type_object = null;
    28 $post_type = null;
    29 if ( $post_id ) {
    30     $post = get_post($post_id);
    31     if ( $post ) {
    32         $post_type_object = get_post_type_object($post->post_type);
    33         if ( $post_type_object ) {
    34             $post_type = $post->post_type;
    35             $current_screen->post_type = $post->post_type;
    36             $current_screen->id = $current_screen->post_type;
    37         }
    38     }
    39 } elseif ( isset($_POST['post_type']) ) {
    40     $post_type_object = get_post_type_object($_POST['post_type']);
    41     if ( $post_type_object ) {
    42         $post_type = $post_type_object->name;
    43         $current_screen->post_type = $post_type;
    44         $current_screen->id = $current_screen->post_type;
    45     }
     24    $post_id = $post_ID = 0;
     25
     26$post = $post_type = $post_type_object = null;
     27
     28if ( $post_id )
     29    $post = get_post( $post_id );
     30
     31if ( $post ) {
     32    $post_type = $post->post_type;
     33    $post_type_object = get_post_type_object( $post_type );
    4634}
    4735
     
    9583
    9684$sendback = wp_get_referer();
    97 if ( strpos($sendback, 'post.php') !== false || strpos($sendback, 'post-new.php') !== false ) {
    98     $sendback = admin_url('edit.php');
    99     $sendback .= ( !empty( $post_type ) ) ? '?post_type=' . $post_type : '';
     85if ( ! $sendback ||
     86     strpos( $sendback, 'post.php' ) !== false ||
     87     strpos( $sendback, 'post-new.php' ) !== false ) {
     88    $sendback = admin_url( 'edit.php' );
     89    $sendback .= ( ! empty( $post_type ) ) ? '?post_type=' . $post_type : '';
    10090} else {
    10191    $sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'ids'), $sendback );
     
    115105        $_POST['comment_status'] = get_option('default_comment_status');
    116106        $_POST['ping_status'] = get_option('default_ping_status');
    117     }
    118 
    119     if ( !empty( $_POST['quickpress_post_ID'] ) ) {
    120         $_POST['post_ID'] = (int) $_POST['quickpress_post_ID'];
    121107        $post_id = edit_post();
    122108    } else {
     
    175161        add_action('admin_notices', '_admin_notice_post_locked' );
    176162    } else {
    177         wp_set_post_lock( $post->ID );
     163        $active_post_lock = wp_set_post_lock( $post->ID );
    178164        wp_enqueue_script('autosave');
    179165    }
Note: See TracChangeset for help on using the changeset viewer.