Changeset 14614
- Timestamp:
- 05/14/2010 12:34:04 AM (15 years ago)
- Location:
- trunk
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-ajax.php
r14593 r14614 282 282 283 283 ob_start(); 284 wp_dropdown_categories( array( 'taxonomy' => $taxonomy->name, 'hide_empty' => 0, 'name' => 'new'.$taxonomy->name.'_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => sprintf( __('— Parent %s —'), $taxonomy->singular_label ) ) ); 284 wp_dropdown_categories( array( 285 'taxonomy' => $taxonomy->name, 'hide_empty' => 0, 'name' => 'new'.$taxonomy->name.'_parent', 'orderby' => 'name', 286 'hierarchical' => 1, 'show_option_none' => '— '.$taxonomy->labels->parent_item.' —' 287 ) ); 285 288 $sup = ob_get_contents(); 286 289 ob_end_clean(); -
trunk/wp-admin/edit-form-advanced.php
r14585 r14614 113 113 continue; 114 114 115 $label = isset($taxonomy->label) ? esc_attr($taxonomy->label) : $tax_name;115 $label = $taxonomy->labels->name; 116 116 117 117 if ( !is_taxonomy_hierarchical($tax_name) ) -
trunk/wp-admin/edit-tag-form.php
r14398 r14614 25 25 <div class="wrap"> 26 26 <?php screen_icon(); ?> 27 <h2><?php printf(_x('Edit %s', '%s: singular taxonomy name'), $tax->singular_label); ?></h2>27 <h2><?php echo $tax->labels->edit_item; ?></h2> 28 28 <div id="ajax-response"></div> 29 29 <form name="edittag" id="edittag" method="post" action="edit-tags.php" class="validate"> … … 76 76 do_action($taxonomy . '_edit_form', $tag, $taxonomy); 77 77 ?> 78 <p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php echo esc_attr( sprintf(_x('Update %s', '%s: singular taxonomy name'), $tax->singular_label)); ?>" /></p>78 <p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php echo esc_attr( __( 'Update' ) ); ?>" /></p> 79 79 </form> 80 80 </div> -
trunk/wp-admin/edit-tags.php
r14594 r14614 20 20 $tax = get_taxonomy($taxonomy); 21 21 22 $title = $tax->label ;22 $title = $tax->labels->name; 23 23 24 24 if ( empty($post_type) || !in_array( $post_type, get_post_types( array('public' => true) ) ) ) … … 117 117 118 118 case 'edit': 119 $title = sprintf(_x('Edit %s', '%s: singular taxonomy name'), $tax->singular_label);119 $title = $tax->labels->edit_item; 120 120 121 121 require_once ('admin-header.php'); … … 193 193 <input type="hidden" name="post_type" value="<?php echo esc_attr($post_type); ?>" /> 194 194 <p class="search-box"> 195 <label class="screen-reader-text" for="tag-search-input"><?php printf(_x('Search %s', '%s: plural taxonomy name'), $tax->label); ?>:</label>195 <label class="screen-reader-text" for="tag-search-input"><?php echo $tax->labels->search_items; ?>:</label> 196 196 <input type="text" id="tag-search-input" name="s" value="<?php _admin_search_query(); ?>" /> 197 <input type="submit" value="<?php echo esc_attr( sprintf(_x('Search %s', '%s: plural taxonomy name'), $tax->label) );?>" class="button" />197 <input type="submit" value="<?php echo esc_attr( $tax->labels->search_items ); ?>" class="button" /> 198 198 </p> 199 199 </form> … … 327 327 ?> 328 328 <div class="tagcloud"> 329 <h3><?php printf(_x('Popular %s', '%s: plural taxonomy name'), $tax->label); ?></h3>329 <h3><?php echo $tax->labels->popular_items; ?></h3> 330 330 <?php echo $tag_cloud; unset( $tag_cloud ); ?> 331 331 </div> … … 342 342 343 343 <div class="form-wrap"> 344 <h3><?php printf(_x('Add a New %s', '%s: singular taxonomy name'), $tax->singular_label); ?></h3>344 <h3><?php echo $tax->labels->add_new_item; ?></h3> 345 345 <form id="addtag" method="post" action="edit-tags.php" class="validate"> 346 346 <input type="hidden" name="action" value="add-tag" /> … … 380 380 do_action($taxonomy . '_add_form_fields', $taxonomy); 381 381 ?> 382 <p class="submit"><input type="submit" class="button" name="submit" id="submit" value="<?php echo esc_attr( sprintf(_x('Add %s', '%s: singular taxonomy name'), $tax->singular_label)); ?>" /></p>382 <p class="submit"><input type="submit" class="button" name="submit" id="submit" value="<?php echo esc_attr( $tax->labels->add_new_item ); ?>" /></p> 383 383 <?php 384 384 if ( 'category' == $taxonomy ) -
trunk/wp-admin/export.php
r14571 r14614 102 102 $term_dropdown = wp_dropdown_categories( array( 'taxonomy' => $tax_obj->name, 'hide_if_empty' => true, 'show_option_all' => __( 'All Terms' ), 'name' => 'taxonomy[' . $tax_obj->name . ']', 'id' => 'taxonomy-' . $tax_obj->name, 'class' => '', 'echo' => false ) ); 103 103 if ( $term_dropdown ) 104 echo '<label for="taxonomy-' . $tax_obj->name . '">' . $tax_obj->label . '</label>: ' . $term_dropdown . '<br/>';104 echo '<label for="taxonomy-' . $tax_obj->name . '">' . $tax_obj->labels->name . '</label>: ' . $term_dropdown . '<br/>'; 105 105 } 106 106 ?> -
trunk/wp-admin/includes/meta-boxes.php
r14593 r14614 297 297 <div id="taxonomy-<?php echo $taxonomy; ?>" class="categorydiv"> 298 298 <ul id="<?php echo $taxonomy; ?>-tabs" class="category-tabs"> 299 <li class="tabs"><a href="#<?php echo $taxonomy; ?>-all" tabindex="3"><?php printf( __( 'All %s' ), $tax->label ); ?></a></li>299 <li class="tabs"><a href="#<?php echo $taxonomy; ?>-all" tabindex="3"><?php echo $tax->labels->all_items; ?></a></li> 300 300 <li class="hide-if-no-js"><a href="#<?php echo $taxonomy; ?>-pop" tabindex="3"><?php _e( 'Most Used' ); ?></a></li> 301 301 </ul> … … 321 321 <?php if ( current_user_can($tax->cap->edit_terms) ) : ?> 322 322 <div id="<?php echo $taxonomy; ?>-adder" class="wp-hidden-children"> 323 <h4><a id="<?php echo $taxonomy; ?>-add-toggle" href="#<?php echo $taxonomy; ?>-add" class="hide-if-no-js" tabindex="3"><?php printf( __( '+ Add New %s' ), $tax->singular_label ); ?></a></h4> 323 <h4> 324 <a id="<?php echo $taxonomy; ?>-add-toggle" href="#<?php echo $taxonomy; ?>-add" class="hide-if-no-js" tabindex="3"> 325 <?php 326 /* translators: %s: add new taxonomy label */ 327 printf( __( '+ %s' ), $tax->labels->add_new_item ); 328 ?> 329 </a> 330 </h4> 324 331 <p id="<?php echo $taxonomy; ?>-add" class="category-add wp-hidden-child"> 325 <label class="screen-reader-text" for="new<?php echo $taxonomy; ?>"><?php printf( __( 'Add New %s' ), $tax->singular_label ); ?></label><input type="text" name="new<?php echo $taxonomy; ?>" id="new<?php echo $taxonomy; ?>" class="form-required form-input-tip" value="<?php echo esc_attr( sprintf( 'New %s Name', $tax->singular_label ) ); ?>" tabindex="3" aria-required="true"/> 326 <label class="screen-reader-text" for="new<?php echo $taxonomy; ?>_parent"><?php printf( __('Parent %s'), $tax->singular_label ); ?>:</label><?php wp_dropdown_categories( array( 'taxonomy' => $taxonomy, 'hide_empty' => 0, 'name' => 'new'.$taxonomy.'_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => sprintf( __('— Parent %s —'), $tax->singular_label ), 'tab_index' => 3 ) ); ?> 327 <input type="button" id="<?php echo $taxonomy; ?>-add-submit" class="add:<?php echo $taxonomy ?>checklist:<?php echo $taxonomy ?>-add button category-add-sumbit" value="<?php esc_attr_e( 'Add' ); ?>" tabindex="3" /> 332 <label class="screen-reader-text" for="new<?php echo $taxonomy; ?>"><?php echo $tax->labels->add_new_item; ?></label> 333 <input type="text" name="new<?php echo $taxonomy; ?>" id="new<?php echo $taxonomy; ?>" class="form-required form-input-tip" value="<?php echo esc_attr( $tax->labels->new_item_name ); ?>" tabindex="3" aria-required="true"/> 334 <label class="screen-reader-text" for="new<?php echo $taxonomy; ?>_parent"> 335 <?php echo $tax->labels->parent_item_colon; ?> 336 </label> 337 <?php wp_dropdown_categories( array( 'taxonomy' => $taxonomy, 'hide_empty' => 0, 'name' => 'new'.$taxonomy.'_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => '— ' . $tax->labels->parent_item . ' —', 'tab_index' => 3 ) ); ?> 338 <input type="button" id="<?php echo $taxonomy; ?>-add-submit" class="add:<?php echo $taxonomy ?>checklist:<?php echo $taxonomy ?>-add button category-add-sumbit" value="<?php echo esc_attr( $tax->labels->add_new_item ); ?>" tabindex="3" /> 328 339 <?php wp_nonce_field( 'add-'.$taxonomy, '_ajax_nonce', false ); ?> 329 340 <span id="<?php echo $taxonomy; ?>-ajax-response"></span> -
trunk/wp-admin/includes/nav-menu.php
r14602 r14614 392 392 if ( $tax ) { 393 393 $id = $tax->name; 394 add_meta_box( "add-{$id}", $tax->label , 'wp_nav_menu_item_taxonomy_meta_box', 'nav-menus', 'side', 'default', $tax );394 add_meta_box( "add-{$id}", $tax->labels->name, 'wp_nav_menu_item_taxonomy_meta_box', 'nav-menus', 'side', 'default', $tax ); 395 395 } 396 396 } -
trunk/wp-admin/includes/template.php
r14593 r14614 64 64 <p class="inline-edit-save submit"> 65 65 <a accesskey="c" href="#inline-edit" title="<?php _e('Cancel'); ?>" class="cancel button-secondary alignleft"><?php _e('Cancel'); ?></a> 66 <?php $update_text = sprintf( __('Update %s'), $tax->singular_label ); ?>66 <?php $update_text = $tax->labels->update_item; ?> 67 67 <a accesskey="s" href="#inline-edit" title="<?php echo esc_attr( $update_text ); ?>" class="save button-primary alignright"><?php echo $update_text; ?></a> 68 68 <img class="waiting" style="display:none;" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" /> … … 977 977 <?php foreach ( $hierarchical_taxonomies as $taxonomy ) : ?> 978 978 979 <span class="title inline-edit-categories-label"><?php echo esc_html($taxonomy->label ) ?>979 <span class="title inline-edit-categories-label"><?php echo esc_html($taxonomy->labels->name) ?> 980 980 <span class="catshow"><?php _e('[more]'); ?></span> 981 981 <span class="cathide" style="display:none;"><?php _e('[less]'); ?></span> … … 1041 1041 1042 1042 <label class="inline-edit-tags"> 1043 <span class="title"><?php echo esc_html($taxonomy->label ) ?></span>1043 <span class="title"><?php echo esc_html($taxonomy->labels->name) ?></span> 1044 1044 <textarea cols="22" rows="1" name="tax_input[<?php echo esc_attr($taxonomy->name)?>]" class="tax_input_<?php echo esc_attr($taxonomy->name)?>"></textarea> 1045 1045 </label> … … 1567 1567 $edit_link = get_edit_post_link( $page->ID ); 1568 1568 ?> 1569 <td <?php echo $attributes ?>><strong><?php if ( current_user_can($post_type_object->cap->edit_post, $page->ID) && $post->post_status != 'trash' ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr(sprintf(__('Edit “%s”'), $title)); ?>"><?php echo $pad; echo $title ?></a><?php } else { echo $pad; echo $title; }; _post_states($page); echo isset($parent_name) ? ' | ' . $post_type_object->labels->parent . ' ' . esc_html($parent_name) : ''; ?></strong>1569 <td <?php echo $attributes ?>><strong><?php if ( current_user_can($post_type_object->cap->edit_post, $page->ID) && $post->post_status != 'trash' ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr(sprintf(__('Edit “%s”'), $title)); ?>"><?php echo $pad; echo $title ?></a><?php } else { echo $pad; echo $title; }; _post_states($page); echo isset($parent_name) ? ' | ' . $post_type_object->labels->parent_item_colon . ' ' . esc_html($parent_name) : ''; ?></strong> 1570 1570 <?php 1571 1571 $actions = array(); … … 3763 3763 case 'edit-tags': 3764 3764 global $tax; 3765 $per_page_label = $tax->label ;3765 $per_page_label = $tax->labels->name; 3766 3766 break; 3767 3767 case 'plugins': -
trunk/wp-admin/menu.php
r14593 r14614 90 90 continue; 91 91 92 $submenu['edit.php'][$i++] = array( esc_attr( $tax->label), $tax->cap->manage_terms, 'edit-tags.php?taxonomy=' . $tax->name );92 $submenu['edit.php'][$i++] = array( esc_attr( $tax->labels->name ), $tax->cap->manage_terms, 'edit-tags.php?taxonomy=' . $tax->name ); 93 93 } 94 94 unset($tax); … … 139 139 continue; 140 140 141 $submenu["edit.php?post_type=$ptype"][$i++] = array( esc_attr( $tax->label), $tax->cap->manage_terms, "edit-tags.php?taxonomy=$tax->name&post_type=$ptype" );141 $submenu["edit.php?post_type=$ptype"][$i++] = array( esc_attr( $tax->labels->name ), $tax->cap->manage_terms, "edit-tags.php?taxonomy=$tax->name&post_type=$ptype" ); 142 142 } 143 143 } -
trunk/wp-admin/press-this.php
r14593 r14614 489 489 490 490 <ul id="category-tabs" class="category-tabs"> 491 <li class="tabs"><a href="#category-all" tabindex="3"><?php printf( __( 'All %s' ), $tax->label ); ?></a></li>491 <li class="tabs"><a href="#category-all" tabindex="3"><?php echo $tax->labels->all_items; ?></a></li> 492 492 <li class="hide-if-no-js"><a href="#category-pop" tabindex="3"><?php _e( 'Most Used' ); ?></a></li> 493 493 </ul> … … 510 510 <?php if ( current_user_can($tax->cap->edit_terms) ) : ?> 511 511 <div id="category-adder" class="wp-hidden-children"> 512 <h4><a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"><?php printf( __( '+ Add New %s' ), $tax->singular_label ); ?></a></h4> 512 <h4> 513 <a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"> 514 <?php printf( __( '+ %s' ), $tax->labels->add_new_item ); ?> 515 </a> 516 </h4> 513 517 <p id="category-add" class="category-add wp-hidden-child"> 514 <label class="screen-reader-text" for="newcategory"><?php printf( __( 'Add New %s' ), $tax->singular_label ); ?></label><input type="text" name="newcategory" id="newcategory" class="form-required form-input-tip" value="<?php echo esc_attr( sprintf( 'New %s Name', $tax->singular_label ) ); ?>" tabindex="3" aria-required="true"/> 515 <label class="screen-reader-text" for="newcategory_parent"><?php printf( __('Parent %s'), $tax->singular_label ); ?>:</label><?php wp_dropdown_categories( array( 'taxonomy' => 'category', 'hide_empty' => 0, 'name' => 'newcategory_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => sprintf( __('— Parent %s —'), $tax->singular_label ), 'tab_index' => 3 ) ); ?> 516 <input type="button" id="category-add-submit" class="add:categorychecklist:category-add button category-add-sumbit" value="<?php esc_attr_e( 'Add' ); ?>" tabindex="3" /> 518 <label class="screen-reader-text" for="newcategory"><?php echo $tax->labels->add_new_item; ?></label> 519 <input type="text" name="newcategory" id="newcategory" class="form-required form-input-tip" value="<?php echo esc_attr( $tax->labels->new_item_name ); ?>" tabindex="3" aria-required="true"/> 520 <label class="screen-reader-text" for="newcategory_parent"> 521 <?php echo $tax->labels->parent_item_colon; ?> 522 </label> 523 <?php wp_dropdown_categories( array( 'taxonomy' => 'category', 'hide_empty' => 0, 'name' => 'newcategory_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => '— ' . $tax->labels->parent_item . ' —', 'tab_index' => 3 ) ); ?> 524 <input type="button" id="category-add-submit" class="add:categorychecklist:category-add button category-add-sumbit" value="<?php echo esc_attr( $tax->labels->add_new_item ); ?>" tabindex="3" /> 517 525 <?php wp_nonce_field( 'add-category', '_ajax_nonce', false ); ?> 518 526 <span id="category-ajax-response"></span> -
trunk/wp-includes/default-widgets.php
r14607 r14614 1004 1004 } else { 1005 1005 $tax = get_taxonomy($current_taxonomy); 1006 $title = $tax->label ;1006 $title = $tax->labels->name; 1007 1007 } 1008 1008 } … … 1033 1033 <?php foreach ( get_object_taxonomies('post') as $taxonomy ) : 1034 1034 $tax = get_taxonomy($taxonomy); 1035 if ( !$tax->show_tagcloud || empty($tax->label ) )1035 if ( !$tax->show_tagcloud || empty($tax->labels->name) ) 1036 1036 continue; 1037 1037 ?> 1038 <option value="<?php echo esc_attr($taxonomy) ?>" <?php selected($taxonomy, $current_taxonomy) ?>><?php echo $tax->label ?></option>1038 <option value="<?php echo esc_attr($taxonomy) ?>" <?php selected($taxonomy, $current_taxonomy) ?>><?php echo $tax->labels->name; ?></option> 1039 1039 <?php endforeach; ?> 1040 1040 </select></p><?php -
trunk/wp-includes/general-template.php
r14556 r14614 589 589 $taxonomy = get_query_var( 'taxonomy' ); 590 590 $tax = get_taxonomy( $taxonomy ); 591 $tax = $tax->label;592 591 $term = $wp_query->get_queried_object(); 593 592 $term = $term->name; 594 $title = $tax . $t_sep . $term;593 $title = $tax->labels->name . $t_sep . $term; 595 594 } 596 595 -
trunk/wp-includes/nav-menu.php
r14611 r14614 539 539 } elseif ( 'taxonomy' == $menu_item->type ) { 540 540 $object = get_taxonomy( $menu_item->object ); 541 $menu_item->type_label = $object-> singular_label;541 $menu_item->type_label = $object->labels->singular_name; 542 542 $term_url = get_term_link( (int) $menu_item->object_id, $menu_item->object ); 543 543 $menu_item->url = !is_wp_error( $term_url ) ? $term_url : ''; … … 588 588 $object = get_taxonomy( $menu_item->taxonomy ); 589 589 $menu_item->object = $object->name; 590 $menu_item->type_label = $object-> singular_label;590 $menu_item->type_label = $object->labels->singular_name; 591 591 592 592 $menu_item->title = $menu_item->name; -
trunk/wp-includes/post.php
r14602 r14614 41 41 42 42 register_post_type( 'attachment', array( 43 'label' => __( 'Media' ), 43 'labels' => array( 44 'name' => __( 'Media' ), 45 ), 44 46 'public' => true, 45 47 'show_ui' => false, … … 54 56 55 57 register_post_type( 'revision', array( 56 'label' => __( 'Revisions' ), 57 'singular_label' => __( 'Revision' ), 58 'labels' => array( 59 'name' => __( 'Revisions' ), 60 'singular_name' => __( 'Revision' ), 61 ), 58 62 'public' => false, 59 63 '_builtin' => true, /* internal use only. don't use this when registering your own post type. */ … … 66 70 67 71 register_post_type( 'nav_menu_item', array( 68 'label' => __( 'Navigation Menu Items' ), 69 'singular_label' => __( 'Navigation Menu Item' ), 72 'labels' => array( 73 'name' => __( 'Navigation Menu Items' ), 74 'singular_name' => __( 'Navigation Menu Item' ), 75 ), 70 76 'public' => false, 71 77 'show_ui' => false, … … 926 932 * - not_found - Default is No posts found/No pages found 927 933 * - not_found_in_trash - Default is No posts found in Trash/No pages found in Trash 928 * - parent - This string isn't used on non-hierarchical types. In hierarchical ones the default is Parent Page:934 * - parent_item_colon - This string isn't used on non-hierarchical types. In hierarchical ones the default is Parent Page: 929 935 * 930 936 * Above, the first default value is for non-hierarchical post types (like posts) and the second one is for hierarchical post types (like pages.) … … 948 954 'not_found_in_trash' => array( __('No posts found in Trash'), __('No pages found in Trash') ), 949 955 'view' => array( __('View Post'), __('View Page') ), 950 'parent ' => array( null, __('Parent Page:') )956 'parent_item_colon' => array( null, __('Parent Page:') ) 951 957 ); 958 return _get_custom_object_labels( $post_type_object, $nohier_vs_hier_defaults ); 959 } 960 961 /** 962 * Builds an object with custom-something object (post type, taxonomy) labels out of a custom-something object 963 * 964 * @access private 965 */ 966 function _get_custom_object_labels( $object, $nohier_vs_hier_defaults ) { 952 967 953 968 // try to get missing (singular_)?name from older style (singular_)?label member variables 954 969 // we keep that for backwards compatibility 955 970 // TODO: remove in 3.1 956 if ( !isset( $ post_type_object->labels['name'] ) && isset( $post_type_object->label ) ) {957 $ post_type_object->labels['name'] = $post_type_object->label;958 } 959 if ( !isset( $ post_type_object->labels['singular_name'] ) && isset( $post_type_object->singular_label ) ) {960 $ post_type_object->labels['singular_name'] = $post_type_object->singular_label;971 if ( !isset( $object->labels['name'] ) && isset( $object->label ) ) { 972 $object->labels['name'] = $object->label; 973 } 974 if ( !isset( $object->labels['singular_name'] ) && isset( $object->singular_label ) ) { 975 $object->labels['singular_name'] = $object->singular_label; 961 976 } 962 977 963 $defaults = array_map( create_function( '$x', $post_type_object->hierarchical? 'return $x[1];' : 'return $x[0];' ), $nohier_vs_hier_defaults ); 964 $labels = array_merge( $defaults, $post_type_object->labels ); 965 return (object)$labels; 978 if ( !isset( $object->labels['singular_name'] ) && isset( $object->labels['name'] ) ) { 979 $object->labels['singular_name'] = $object->labels['name']; 980 } 981 982 $defaults = array_map( create_function( '$x', $object->hierarchical? 'return $x[1];' : 'return $x[0];' ), $nohier_vs_hier_defaults ); 983 $labels = array_merge( $defaults, $object->labels ); 984 return (object)$labels; 966 985 } 967 986 -
trunk/wp-includes/taxonomy.php
r14606 r14614 19 19 'hierarchical' => true, 20 20 'update_count_callback' => '_update_post_term_count', 21 'label' => __( 'Categories' ),22 'singular_label' => __( 'Category' ),23 21 'query_var' => false, 24 22 'rewrite' => false, … … 31 29 'hierarchical' => false, 32 30 'update_count_callback' => '_update_post_term_count', 33 'label' => __( 'Post Tags' ),34 'singular_label' => __( 'Post Tag' ),35 31 'query_var' => false, 36 32 'rewrite' => false, … … 42 38 register_taxonomy( 'nav_menu', 'nav_menu_item', array( 43 39 'hierarchical' => false, 44 'label' => __( 'Navigation Menus' ), 45 'singular_label' => __( 'Navigation Menu' ), 40 'labels' => array( 41 'name' => __( 'Navigation Menus' ), 42 'singular_name' => __( 'Navigation Menu' ), 43 ), 46 44 'query_var' => false, 47 45 'rewrite' => false, … … 52 50 register_taxonomy( 'link_category', 'link', array( 53 51 'hierarchical' => false, 54 'label' => __( 'Categories' ), 52 'labels' => array( 53 'name' => __( 'Categories' ), 54 'singular_name' => __( 'Category' ), 55 ), 55 56 'query_var' => false, 56 57 'rewrite' => false, … … 231 232 * show_tagcloud - false to prevent the taxonomy being listed in the Tag Cloud Widget; 232 233 * defaults to show_ui which defalts to public. 234 * 235 * labels - An array of labels for this taxonomy. You can see accepted values in {@link get_taxonomy_labels()}. By default tag labels are used for non-hierarchical types and category labels for hierarchical ones. 233 236 * 234 237 * @package WordPress … … 255 258 'public' => true, 256 259 'show_ui' => null, 257 'label' => null,258 260 'show_tagcloud' => null, 259 261 '_builtin' => false, 262 'labels' => array(), 260 263 'capabilities' => array(), 261 264 ); 262 265 $args = wp_parse_args($args, $defaults); 263 266 … … 283 286 if ( is_null($args['show_tagcloud']) ) 284 287 $args['show_tagcloud'] = $args['show_ui']; 285 286 if ( is_null($args['label'] ) )287 $args['label'] = $taxonomy;288 288 289 289 $default_caps = array( … … 296 296 unset( $args['capabilities'] ); 297 297 298 if ( empty($args['singular_label']) )299 $args['singular_label'] = $args['label'];300 301 298 $args['name'] = $taxonomy; 302 299 $args['object_type'] = (array) $object_type; 300 $args['labels'] = get_taxonomy_labels( (object) $args ); 301 302 // we keep these two only for backwards compatibility 303 // TODO: remove in 3.1 304 $args['label'] = $args['labels']->name; 305 $args['singular_label'] = $args['labels']->singular_name; 306 303 307 $wp_taxonomies[$taxonomy] = (object) $args; 304 308 305 309 // register callback handling for metabox 306 310 add_filter('wp_ajax_add-'.$taxonomy, '_wp_ajax_add_hierarchical_term'); 311 } 312 313 /** 314 * Builds an object with all taxonomy labels out of a taxonomy object 315 * 316 * Accepted keys of the label array in the taxonomy object: 317 * - name - general name for the taxonomy, usually plural. Default is Post Tags/Categories 318 * - singular_name - name for one object of this taxonomy. Default is Post Tag/Category 319 * - search_items - Default is Search Tags/Search Categories 320 * - popular_items - Default is Popular Tags/Popular Categories 321 * - all_items - Default is All Tags/All Categories 322 * - parent_item - This string isn't used on non-hierarchical taxonomies. In hierarchical ones the default is Parent Category 323 * - parent_item_colon - The same as <code>parent_item</code>, but with colon <code>:</code> in the end 324 * - edit_item - Default is Edit Tag/Edit Category 325 * - update_item - Default is Update Tag/Update Category 326 * - add_new_item - Default is Add New Tag/Add New Category 327 * - new_item_name - Default is New Tag Name/New Category Name 328 * 329 * Above, the first default value is for non-hierarchical taxonomies (like tags) and the second one is for hierarchical taxonomies (like categories.) 330 * 331 * @since 3.0.0 332 * @param object $tax Taxonomy object 333 * @return object object with all the labels as member variables 334 */ 335 336 function get_taxonomy_labels( $tax ) { 337 $nohier_vs_hier_defaults = array( 338 'name' => array( _x( 'Post Tags', 'taxonomy general name' ), _x( 'Categories', 'taxonomy general name' ) ), 339 'singular_name' => array( _x( 'Post Tag', 'taxonomy singular name' ), _x( 'Category', 'taxonomy singular name' ) ), 340 'search_items' => array( __( 'Search Tags' ), __( 'Search Categories' ) ), 341 'popular_items' => array( __( 'Popular Tags' ), __( 'Popular Category' ) ), 342 'all_items' => array( __( 'All Tags' ), __( 'All Categories' ) ), 343 'parent_item' => array( null, __( 'Parent Category' ) ), 344 'parent_item_colon' => array( null, __( 'Parent Category:' ) ), 345 'edit_item' => array( __( 'Edit Tag' ), __( 'Edit Category' ) ), 346 'update_item' => array( __( 'Update Tag' ), __( 'Update Category' ) ), 347 'add_new_item' => array( __( 'Add New Tag' ), __( 'Add New Category' ) ), 348 'new_item_name' => array( __( 'New Tag Name' ), __( 'New Category Name' ) ), 349 ); 350 351 return _get_custom_object_labels( $tax, $nohier_vs_hier_defaults ); 307 352 } 308 353 … … 2613 2658 return false; 2614 2659 } 2615 2616 2617 ?>
Note: See TracChangeset
for help on using the changeset viewer.