Make WordPress Core


Ignore:
Timestamp:
01/15/2010 04:58:36 PM (17 years ago)
Author:
ryan
Message:

Merge edit-pages.php into edit.php. see #9674

File:
1 edited

Legend:

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

    r12708 r12728  
    2424        $post_id = 0;
    2525$post_ID = $post_id;
    26 
    2726$post = null;
    2827$post_type_object = null;
    2928$post_type_cap = null;
     29$post_type = null;
    3030if ( $post_id ) {
    3131        $post = get_post($post_id);
    3232        if ( $post ) {
    3333                $post_type_object = get_post_type_object($post->post_type);
    34                 if ( $post_type_object )
     34                if ( $post_type_object ) {
     35                        $post_type = $post->post_type;
     36                        $current_screen->post_type = $post->post_type;
     37                        $current_screen->id = $current_screen->post_type;
    3538                        $post_type_cap = $post_type_object->capability_type;
     39                }
     40        }
     41} elseif ( isset($_POST['post_type']) ) {
     42        $post_type_object = get_post_type_object($_POST['post_type']);
     43        if ( $post_type_object ) {
     44                $post_type = $post_type_object->name;
     45                $current_screen->post_type = $post_type;
     46                $current_screen->id = $current_screen->post_type;
     47                $post_type_cap = $post_type_object->capability_type;
    3648        }
    3749}
     
    109121case 'post-quickpress-publish':
    110122case 'post-quickpress-save':
    111         check_admin_referer('add-post');
     123        check_admin_referer('add-' . $post_type);
    112124
    113125        if ( 'post-quickpress-publish' == $action )
     
    164176                $parent_file = "edit.php";
    165177                $submenu_file = "edit.php";
    166         } elseif ( 'page' == $post_type ) {
    167                 $parent_file = "edit-pages.php";
    168                 $submenu_file = "edit-pages.php";
    169         } else {
    170                 if ( $post_type_object->hierarchical ) {
    171                         $parent_file = "edit-pages.php?post_type=$post_type";
    172                         $submenu_file = "edit-pages.php?post_type=$post_type";
    173                 } else {
    174                         $parent_file = "edit.php?post_type=$post_type";
    175                         $submenu_file = "edit.php?post_type=$post_type";
    176                 }
     178        } else {
     179                $parent_file = "edit.php?post_type=$post_type";
     180                $submenu_file = "edit.php?post_type=$post_type";
    177181        }
    178182
     
    214218
    215219case 'editpost':
    216         check_admin_referer('update-' . $post->post_type . '_' . $post_id);
     220        check_admin_referer('update-' . $post_type . '_' . $post_id);
    217221
    218222        $post_id = edit_post();
     
    224228
    225229case 'trash':
    226         check_admin_referer('trash-post_' . $post_id);
     230        check_admin_referer('trash-' . $post_type . '_' . $post_id);
    227231
    228232        $post = & get_post($post_id);
     
    239243
    240244case 'untrash':
    241         check_admin_referer('untrash-post_' . $post_id);
     245        check_admin_referer('untrash-' . $post_type . '_' . $post_id);
    242246
    243247        if ( !current_user_can('delete_' . $post_type_cap, $post_id) )
     
    252256
    253257case 'delete':
    254         check_admin_referer('delete-post_' . $post_id);
     258        check_admin_referer('delete-' . $post_type . '_' . $post_id);
    255259
    256260        if ( !current_user_can('delete_' . $post_type_cap, $post_id) )
     
    281285
    282286default:
    283         if ( $post_type_object->hierarchical )
    284                 wp_redirect('edit-pages.php');
    285         else
    286287                wp_redirect('edit.php');
    287288        exit();
Note: See TracChangeset for help on using the changeset viewer.