WordPress.org

Make WordPress Core

Changeset 20630


Ignore:
Timestamp:
04/27/12 22:54:02 (2 years ago)
Author:
nacin
Message:

Clean up messages on edit.php. see #19470.

File:
1 edited

Legend:

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

    r19596 r20630  
    223223<?php screen_icon(); ?> 
    224224<h2><?php echo esc_html( $post_type_object->labels->name ); ?> <a href="<?php echo $post_new_file ?>" class="add-new-h2"><?php echo esc_html($post_type_object->labels->add_new); ?></a> <?php 
    225 if ( isset($_REQUEST['s']) && $_REQUEST['s'] ) 
     225if ( ! empty( $_REQUEST['s'] ) ) 
    226226    printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', get_search_query() ); ?> 
    227227</h2> 
    228228 
    229 <?php if ( isset($_REQUEST['locked']) || isset($_REQUEST['skipped']) || isset($_REQUEST['updated']) || isset($_REQUEST['deleted']) || isset($_REQUEST['trashed']) || isset($_REQUEST['untrashed']) ) { 
     229<?php if ( isset( $_REQUEST['locked'] ) || isset( $_REQUEST['updated'] ) || isset( $_REQUEST['deleted'] ) || isset( $_REQUEST['trashed'] ) || isset( $_REQUEST['untrashed'] ) ) { 
    230230    $messages = array(); 
    231231?> 
    232232<div id="message" class="updated"><p> 
    233 <?php if ( isset($_REQUEST['updated']) && (int) $_REQUEST['updated'] ) { 
    234     $messages[] = sprintf( _n( '%s post updated.', '%s posts updated.', $_REQUEST['updated'] ), number_format_i18n( $_REQUEST['updated'] ) ); 
    235     unset($_REQUEST['updated']); 
    236 } 
    237  
    238 if ( isset($_REQUEST['skipped']) && (int) $_REQUEST['skipped'] ) 
    239     unset($_REQUEST['skipped']); 
    240  
    241 if ( isset($_REQUEST['locked']) && (int) $_REQUEST['locked'] ) { 
    242     $messages[] = sprintf( _n( '%s item not updated, somebody is editing it.', '%s items not updated, somebody is editing them.', $_REQUEST['locked'] ), number_format_i18n( $_REQUEST['locked'] ) ); 
    243     unset($_REQUEST['locked']); 
    244 } 
    245  
    246 if ( isset($_REQUEST['deleted']) && (int) $_REQUEST['deleted'] ) { 
    247     $messages[] = sprintf( _n( 'Item permanently deleted.', '%s items permanently deleted.', $_REQUEST['deleted'] ), number_format_i18n( $_REQUEST['deleted'] ) ); 
    248     unset($_REQUEST['deleted']); 
    249 } 
    250  
    251 if ( isset($_REQUEST['trashed']) && (int) $_REQUEST['trashed'] ) { 
    252     $messages[] = sprintf( _n( 'Item moved to the Trash.', '%s items moved to the Trash.', $_REQUEST['trashed'] ), number_format_i18n( $_REQUEST['trashed'] ) ); 
     233<?php if ( isset( $_REQUEST['updated'] ) && $updated = absint( $_REQUEST['updated'] ) ) { 
     234    $messages[] = sprintf( _n( '%s post updated.', '%s posts updated.', $updated ), number_format_i18n( $updated ) ); 
     235} 
     236 
     237if ( isset( $_REQUEST['locked'] ) && $locked = absint( $_REQUEST['locked'] ) ) { 
     238    $messages[] = sprintf( _n( '%s item not updated, somebody is editing it.', '%s items not updated, somebody is editing them.', $locked ), number_format_i18n( $locked ) ); 
     239} 
     240 
     241if ( isset( $_REQUEST['deleted'] ) && $deleted = absint( $_REQUEST['deleted'] ) ) { 
     242    $messages[] = sprintf( _n( 'Item permanently deleted.', '%s items permanently deleted.', $deleted ), number_format_i18n( $deleted ) ); 
     243} 
     244 
     245if ( isset( $_REQUEST['trashed'] ) && $trashed = absint( $_REQUEST['trashed'] ) ) { 
     246    $messages[] = sprintf( _n( 'Item moved to the Trash.', '%s items moved to the Trash.', $trashed ), number_format_i18n( $trashed ) ); 
    253247    $ids = isset($_REQUEST['ids']) ? $_REQUEST['ids'] : 0; 
    254248    $messages[] = '<a href="' . esc_url( wp_nonce_url( "edit.php?post_type=$post_type&doaction=undo&action=untrash&ids=$ids", "bulk-posts" ) ) . '">' . __('Undo') . '</a>'; 
    255     unset($_REQUEST['trashed']); 
    256 } 
    257  
    258 if ( isset($_REQUEST['untrashed']) && (int) $_REQUEST['untrashed'] ) { 
    259     $messages[] = sprintf( _n( 'Item restored from the Trash.', '%s items restored from the Trash.', $_REQUEST['untrashed'] ), number_format_i18n( $_REQUEST['untrashed'] ) ); 
    260     unset($_REQUEST['undeleted']); 
     249} 
     250 
     251if ( isset( $_REQUEST['untrashed'] ) && $untrashed = absint( $_REQUEST['untrashed'] ) ) { 
     252    $messages[] = sprintf( _n( 'Item restored from the Trash.', '%s items restored from the Trash.', $untrashed ), number_format_i18n( $untrashed ) ); 
    261253} 
    262254 
     
    265257unset( $messages ); 
    266258 
    267 $_SERVER['REQUEST_URI'] = remove_query_arg( array('locked', 'skipped', 'updated', 'deleted', 'trashed', 'untrashed'), $_SERVER['REQUEST_URI'] ); 
     259$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'locked', 'skipped', 'updated', 'deleted', 'trashed', 'untrashed' ), $_SERVER['REQUEST_URI'] ); 
    268260?> 
    269261</p></div> 
Note: See TracChangeset for help on using the changeset viewer.