Make WordPress Core

Changeset 19471


Ignore:
Timestamp:
11/28/2011 10:58:51 PM (15 years ago)
Author:
nacin
Message:

WP_Screen: Whitelist -new and -add screens, and prevent edit-comments and edit-tags from being mashed on. fixes #19353.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/screen.php

    r19468 r19471  
    234234         * @access public
    235235         */
    236         public $action = '';
     236        public $action;
    237237
    238238        /**
    … …  
    388388                        return $hook_name;
    389389
    390                 $action = $post_type = $taxonomy = null;
     390                $post_type = $taxonomy = null;
    391391                $is_network = $is_user = false;
     392                $action = '';
    392393
    393394                if ( $hook_name )
    … …  
    401402                        $id = 'post'; // changes later. ends up being $base.
    402403                } else {
    403                         $last_four = substr( $id, -4 );
    404                         if ( '.php' == $last_four ) {
     404                        if ( '.php' == substr( $id, -4 ) )
    405405                                $id = substr( $id, 0, -4 );
    406                                 $last_four = substr( $id, -4 );
    407                         }
    408                         if ( '-add' == $last_four || '-new' == $last_four ) {
     406
     407                        if ( 'post-new' == $id || 'link-add' == $id || 'media-new' == $id || 'user-new' == $id ) {
    409408                                $id = substr( $id, 0, -4 );
    410409                                $action = 'add';
    … …  
    422421
    423422                        $id = sanitize_key( $id );
    424                         if ( 'edit-' == substr( $id, 0, 5 ) ) {
     423                        if ( 'edit-comments' != $id && 'edit-tags' != $id && 'edit-' == substr( $id, 0, 5 ) ) {
    425424                                $maybe = substr( $id, 5 );
    426425                                if ( taxonomy_exists( $maybe ) ) {
    … …  
    486485                                        $taxonomy = 'post_tag';
    487486                                $id = 'edit-' . $taxonomy;
    488                                 break;
    489                         case 'upload' :
    490                                 if ( null === $post_type )
    491                                         $post_type = 'attachment';
    492487                                break;
    493488                }
Note: See TracChangeset for help on using the changeset viewer.