WordPress.org

Make WordPress Core

Changeset 25143


Ignore:
Timestamp:
08/27/13 21:12:40 (8 months ago)
Author:
nacin
Message:

Add a terms_updated_messages filter to edit-tags.php, along with taxonomy-specific strings.

props johnbillion.
fixes #18714.

File:
1 edited

Legend:

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

    r25123 r25143  
    253253    wp_die( __('You are not allowed to edit this item.') ); 
    254254 
    255 $messages[1] = __('Item added.'); 
    256 $messages[2] = __('Item deleted.'); 
    257 $messages[3] = __('Item updated.'); 
    258 $messages[4] = __('Item not added.'); 
    259 $messages[5] = __('Item not updated.'); 
    260 $messages[6] = __('Items deleted.'); 
     255$messages = array(); 
     256$messages['_item'] = array( 
     257    0 => '', // Unused. Messages start at index 1. 
     258    1 => __( 'Item added.' ), 
     259    2 => __( 'Item deleted.' ), 
     260    3 => __( 'Item updated.' ), 
     261    4 => __( 'Item not added.' ), 
     262    5 => __( 'Item not updated.' ), 
     263    6 => __( 'Items deleted.' ) 
     264); 
     265$messages['category'] = array( 
     266    0 => '', // Unused. Messages start at index 1. 
     267    1 => __( 'Category added.' ), 
     268    2 => __( 'Category deleted.' ), 
     269    3 => __( 'Category updated.' ), 
     270    4 => __( 'Category not added.' ), 
     271    5 => __( 'Category not updated.' ), 
     272    6 => __( 'Categories deleted.' ) 
     273); 
     274$messages['link_category'] = array( 
     275    0 => '', // Unused. Messages start at index 1. 
     276    1 => __( 'Category added.' ), 
     277    2 => __( 'Category deleted.' ), 
     278    3 => __( 'Category updated.' ), 
     279    4 => __( 'Category not added.' ), 
     280    5 => __( 'Category not updated.' ), 
     281    6 => __( 'Categories deleted.' ) 
     282); 
     283$messages['post_tag'] = array( 
     284    0 => '', // Unused. Messages start at index 1. 
     285    1 => __( 'Tag added.' ), 
     286    2 => __( 'Tag deleted.' ), 
     287    3 => __( 'Tag updated.' ), 
     288    4 => __( 'Tag not added.' ), 
     289    5 => __( 'Tag not updated.' ), 
     290    6 => __( 'Tags deleted.' ) 
     291); 
     292 
     293$messages = apply_filters( 'term_updated_messages', $messages ); 
     294 
     295$message = false; 
     296if ( isset( $_REQUEST['message'] ) && ( $msg = (int) $_REQUEST['message'] ) ) { 
     297    if ( isset( $messages[ $taxonomy ][ $msg ] ) ) 
     298        $message = $messages[ $taxonomy ][ $msg ]; 
     299    elseif ( ! isset( $messages[ $taxonomy ] ) && isset( $messages['_item'][ $msg ] ) ) 
     300        $message = $messages['_item'][ $msg ]; 
     301} 
    261302 
    262303?> 
     
    269310</h2> 
    270311 
    271 <?php if ( isset($_REQUEST['message']) && ( $msg = (int) $_REQUEST['message'] ) ) : ?> 
    272 <div id="message" class="updated"><p><?php echo $messages[$msg]; ?></p></div> 
     312<?php if ( $message ) : ?> 
     313<div id="message" class="updated"><p><?php echo $message; ?></p></div> 
    273314<?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']); 
    274315endif; ?> 
Note: See TracChangeset for help on using the changeset viewer.