Make WordPress Core

Ticket #18714: 18714.patch

File 18714.patch, 2.6 KB (added by johnbillion, 13 years ago)
  • wp-admin/edit-tags.php

     
    226226if ( !current_user_can($tax->cap->edit_terms) )
    227227        wp_die( __('You are not allowed to edit this item.') );
    228228
    229 $messages[1] = __('Item added.');
    230 $messages[2] = __('Item deleted.');
    231 $messages[3] = __('Item updated.');
    232 $messages[4] = __('Item not added.');
    233 $messages[5] = __('Item not updated.');
    234 $messages[6] = __('Items deleted.');
     229$messages = array();
    235230
     231$messages['_item'] = array(
     232        0 => '', // Unused. Messages start at index 1.
     233        1 => __('Item added.'),
     234        2 => __('Item deleted.'),
     235        3 => __('Item updated.'),
     236        4 => __('Item not added.'),
     237        5 => __('Item not updated.'),
     238        6 => __('Items deleted.')
     239);
     240$messages['category'] = array(
     241        0 => '', // Unused. Messages start at index 1.
     242        1 => __('Category added.'),
     243        2 => __('Category deleted.'),
     244        3 => __('Category updated.'),
     245        4 => __('Category not added.'),
     246        5 => __('Category not updated.'),
     247        6 => __('Categories deleted.')
     248);
     249$messages['link_category'] = array(
     250        0 => '', // Unused. Messages start at index 1.
     251        1 => __('Category added.'),
     252        2 => __('Category deleted.'),
     253        3 => __('Category updated.'),
     254        4 => __('Category not added.'),
     255        5 => __('Category not updated.'),
     256        6 => __('Categories deleted.')
     257);
     258$messages['post_tag'] = array(
     259        0 => '', // Unused. Messages start at index 1.
     260        1 => __('Tag added.'),
     261        2 => __('Tag deleted.'),
     262        3 => __('Tag updated.'),
     263        4 => __('Tag not added.'),
     264        5 => __('Tag not updated.'),
     265        6 => __('Tags deleted.')
     266);
     267
     268$messages = apply_filters( 'term_updated_messages', $messages );
     269
     270$message = false;
     271if ( isset($_REQUEST['message']) && ( $msg = (int) $_REQUEST['message'] ) ) {
     272        if ( isset($messages[$taxonomy][$msg]) )
     273                $message = $messages[$taxonomy][$msg];
     274        elseif ( !isset($messages[$taxonomy]) && isset($messages['_item'][$msg]) )
     275                $message = $messages['_item'][$msg];
     276}
     277
    236278?>
    237279
    238280<div class="wrap nosubsub">
     
    242284        printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( stripslashes($_REQUEST['s']) ) ); ?>
    243285</h2>
    244286
    245 <?php if ( isset($_REQUEST['message']) && ( $msg = (int) $_REQUEST['message'] ) ) : ?>
    246 <div id="message" class="updated"><p><?php echo $messages[$msg]; ?></p></div>
     287<?php if ( $message ) : ?>
     288<div id="message" class="updated"><p><?php echo $message; ?></p></div>
    247289<?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
    248290endif; ?>
    249291<div id="ajax-response"></div>