WordPress.org

Make WordPress Core

Ticket #18710: 18710.patch

File 18710.patch, 4.7 KB (added by johnbillion, 7 years ago)
  • wp-admin/edit.php

     
    182182
    183183add_screen_option( 'per_page', array('label' => $title, 'default' => 20) );
    184184
     185$counts = array(
     186        0 => null,
     187        1 => isset( $_REQUEST['updated'] )   ? intval( $_REQUEST['updated'] )   : 0,
     188        2 => isset( $_REQUEST['locked'] )    ? intval( $_REQUEST['locked'] )    : 0,
     189        3 => isset( $_REQUEST['deleted'] )   ? intval( $_REQUEST['deleted'] )   : 0,
     190        4 => isset( $_REQUEST['trashed'] )   ? intval( $_REQUEST['trashed'] )   : 0,
     191        5 => isset( $_REQUEST['untrashed'] ) ? intval( $_REQUEST['untrashed'] ) : 0,
     192);
     193
     194$messages = array();
     195$messages['post'] = array(
     196        0 => '',
     197        1 => _n('%s post updated.', '%s posts updated.', $counts[1]),
     198        2 => _n('%s post not updated, somebody is editing it.', '%s posts not updated, somebody is editing them.', $counts[2]),
     199        3 => _n('Post permanently deleted.', '%s posts permanently deleted.', $counts[3]),
     200        4 => _n('Post moved to the Trash.', '%s posts moved to the Trash.', $counts[4]),
     201        5 => _n('Post restored from the Trash.', '%s posts restored from the Trash.', $counts[5]),
     202);
     203$messages['page'] = array(
     204        0 => '',
     205        1 => _n('%s page updated.', '%s pages updated.', $counts[1]),
     206        2 => _n('%s page not updated, somebody is editing it.', '%s pages not updated, somebody is editing them.', $counts[2]),
     207        3 => _n('Page permanently deleted.', '%s pages permanently deleted.', $counts[3]),
     208        4 => _n('Page moved to the Trash.', '%s pages moved to the Trash.', $counts[4]),
     209        5 => _n('Page restored from the Trash.', '%s pages restored from the Trash.', $counts[5]),
     210);
     211
     212$messages = apply_filters( 'bulk_post_updated_messages', $messages, $counts );
     213unset($counts);
     214
    185215require_once('./admin-header.php');
    186216?>
    187217<div class="wrap">
     
    200230<?php if ( isset($_REQUEST['locked']) || isset($_REQUEST['skipped']) || isset($_REQUEST['updated']) || isset($_REQUEST['deleted']) || isset($_REQUEST['trashed']) || isset($_REQUEST['untrashed']) ) { ?>
    201231<div id="message" class="updated"><p>
    202232<?php if ( isset($_REQUEST['updated']) && (int) $_REQUEST['updated'] ) {
    203         printf( _n( '%s post updated.', '%s posts updated.', $_REQUEST['updated'] ), number_format_i18n( $_REQUEST['updated'] ) );
     233        if ( isset( $messages[$post_type][1] ) )
     234                $message = $messages[$post_type][1];
     235        else
     236                $message = $messages['post'][1];
     237
     238        printf( $message, $_REQUEST['updated'], number_format_i18n( $_REQUEST['updated'] ) );
    204239        unset($_REQUEST['updated']);
    205240}
    206241
     
    208243        unset($_REQUEST['skipped']);
    209244
    210245if ( isset($_REQUEST['locked']) && (int) $_REQUEST['locked'] ) {
    211         printf( _n( '%s item not updated, somebody is editing it.', '%s items not updated, somebody is editing them.', $_REQUEST['locked'] ), number_format_i18n( $_REQUEST['locked'] ) );
     246        if ( isset( $messages[$post_type][2] ) )
     247                $message = $messages[$post_type][2];
     248        else
     249                $message = $messages['post'][2];
     250
     251        printf( $message, $_REQUEST['locked'], number_format_i18n( $_REQUEST['locked'] ) );
    212252        unset($_REQUEST['locked']);
    213253}
    214254
    215255if ( isset($_REQUEST['deleted']) && (int) $_REQUEST['deleted'] ) {
    216         printf( _n( 'Item permanently deleted.', '%s items permanently deleted.', $_REQUEST['deleted'] ), number_format_i18n( $_REQUEST['deleted'] ) );
     256        if ( isset( $messages[$post_type][3] ) )
     257                $message = $messages[$post_type][3];
     258        else
     259                $message = $messages['post'][3];
     260
     261        printf( $message, $_REQUEST['deleted'], number_format_i18n( $_REQUEST['deleted'] ) );
    217262        unset($_REQUEST['deleted']);
    218263}
    219264
    220265if ( isset($_REQUEST['trashed']) && (int) $_REQUEST['trashed'] ) {
    221         printf( _n( 'Item moved to the Trash.', '%s items moved to the Trash.', $_REQUEST['trashed'] ), number_format_i18n( $_REQUEST['trashed'] ) );
     266        if ( isset( $messages[$post_type][4] ) )
     267                $message = $messages[$post_type][4];
     268        else
     269                $message = $messages['post'][4];
     270
     271        printf( $message, $_REQUEST['trashed'], number_format_i18n( $_REQUEST['trashed'] ) );
    222272        $ids = isset($_REQUEST['ids']) ? $_REQUEST['ids'] : 0;
    223273        echo ' <a href="' . esc_url( wp_nonce_url( "edit.php?post_type=$post_type&doaction=undo&action=untrash&ids=$ids", "bulk-posts" ) ) . '">' . __('Undo') . '</a><br />';
    224274        unset($_REQUEST['trashed']);
    225275}
    226276
    227277if ( isset($_REQUEST['untrashed']) && (int) $_REQUEST['untrashed'] ) {
    228         printf( _n( 'Item restored from the Trash.', '%s items restored from the Trash.', $_REQUEST['untrashed'] ), number_format_i18n( $_REQUEST['untrashed'] ) );
     278        if ( isset( $messages[$post_type][5] ) )
     279                $message = $messages[$post_type][5];
     280        else
     281                $message = $messages['post'][5];
     282
     283        printf( $message, $_REQUEST['untrashed'], number_format_i18n( $_REQUEST['untrashed'] ) );
    229284        unset($_REQUEST['undeleted']);
    230285}
    231286