Make WordPress Core


Ignore:
Timestamp:
11/13/2013 10:08:47 PM (13 years ago)
Author:
nacin
Message:

Merge the new dashboard design into core.

Merges https://github.com/growthdesigner/wp-dash.

props lessbloat, joen, helen, dbernar1, kraftbj, ryelle, tillkruess, grapplerulrich, markjaquith.
see #25824.

File:
1 edited

Legend:

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

    r25616 r26144  
    6767                $location = explode('#', $location);
    6868                $location = $location[0] . '#postcustom';
    69         } elseif ( 'post-quickpress-save-cont' == $_POST['action'] ) {
    70                 $location = "post.php?action=edit&post=$post_id&message=7";
    7169        } else {
    7270                $location = add_query_arg( 'message', 4, get_edit_post_link( $post_id, 'url' ) );
     
    9795
    9896switch($action) {
     97case 'post-quickdraft-save':
     98        // Check nonce and capabilities
     99        $nonce = $_REQUEST['_wpnonce'];
     100        $error_msg = false;
     101        if ( ! wp_verify_nonce( $nonce, 'add-post' ) )
     102                $error_msg = 'Unable to submit this form, please refresh and try again.';
     103
     104        if ( ! current_user_can( 'edit_posts' ) )
     105                $error_msg = "Oops, you don't have access to add new drafts.";
     106
     107        if ( $error_msg )
     108                return wp_dashboard_quick_draft( $error_msg );
     109
     110        $post = get_post( $_REQUEST['post_ID'] );
     111        check_admin_referer( 'add-' . $post->post_type );
     112        edit_post();
     113        // output the quickdraft dashboard widget
     114        require_once(ABSPATH . 'wp-admin/includes/dashboard.php');
     115        wp_dashboard_quick_draft();
     116        exit;
     117        break;
     118
    99119case 'postajaxpost':
    100120case 'post':
    101 case 'post-quickpress-publish':
    102 case 'post-quickpress-save':
    103         check_admin_referer('add-' . $post_type);
    104 
    105         if ( 'post-quickpress-publish' == $action )
    106                 $_POST['publish'] = 'publish'; // tell write_post() to publish
    107 
    108         if ( 'post-quickpress-publish' == $action || 'post-quickpress-save' == $action ) {
    109                 $_POST['comment_status'] = get_option('default_comment_status');
    110                 $_POST['ping_status'] = get_option('default_ping_status');
    111                 $post_id = edit_post();
    112         } else {
    113                 $post_id = 'postajaxpost' == $action ? edit_post() : write_post();
    114         }
    115 
    116         if ( 0 === strpos( $action, 'post-quickpress' ) ) {
    117                 $_POST['post_ID'] = $post_id;
    118                 // output the quickpress dashboard widget
    119                 require_once(ABSPATH . 'wp-admin/includes/dashboard.php');
    120                 wp_dashboard_quick_press();
    121                 exit;
    122         }
     121        // Check nonce and capabilities
     122        $nonce = $_REQUEST['_wpnonce'];
     123        $error_msg = false;
     124        if ( ! wp_verify_nonce( $nonce, 'add-post' ) )
     125                $error_msg = 'Unable to submit this form, please refresh and try again.';
     126
     127        if ( ! current_user_can( 'edit_posts' ) )
     128                $error_msg = "Oops, you don't have access to add new drafts.";
     129
     130        $post_id = 'postajaxpost' == $action ? edit_post() : write_post();
    123131
    124132        redirect_post($post_id);
Note: See TracChangeset for help on using the changeset viewer.