From af612805e86a389e51a7a1a556c731ef5bd08edd Mon Sep 17 00:00:00 2001 From: nacin Date: Thu, 10 Jun 2010 16:07:33 +0000 Subject: [PATCH] Move 'helps' argument to the taxonomy labels object. Also move over help_nojs and help_cloud, both introduced in 3.0. This adds three new core labels for non-hierarchical taxonomies, for tweaking the meta box strings. fixes #13805. git-svn-id: http://svn.automattic.com/wordpress/trunk@15190 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/meta-boxes.php | 11 +++-------- wp-includes/post.php | 6 ++---- wp-includes/taxonomy.php | 9 +++++++++ 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/wp-admin/includes/meta-boxes.php b/wp-admin/includes/meta-boxes.php index 3eabf13d3..0f8b339b2 100644 --- a/wp-admin/includes/meta-boxes.php +++ b/wp-admin/includes/meta-boxes.php @@ -250,17 +250,12 @@ function post_tags_meta_box($post, $box) { extract( wp_parse_args($args, $defaults), EXTR_SKIP ); $tax_name = esc_attr($taxonomy); $taxonomy = get_taxonomy($taxonomy); - - $helps = isset( $taxonomy->helps ) ? esc_attr( $taxonomy->helps ) : esc_attr__('Separate tags with commas.'); - $help_nojs = isset( $taxonomy->help_nojs ) ? $taxonomy->help_nojs : __('Add or remove tags'); - $help_cloud = isset( $taxonomy->help_cloud ) ? $taxonomy->help_cloud : __('Choose from the most used tags'); - $disabled = !current_user_can($taxonomy->cap->assign_terms) ? 'disabled="disabled"' : ''; ?>
-

+

labels->add_or_remove_items; ?>

cap->assign_terms) ) : ?>
@@ -269,13 +264,13 @@ function post_tags_meta_box($post, $box) {

-

+

labels->separate_items_with_commas ); ?>

cap->assign_terms) ) : ?> -

+

labels->choose_from_most_used; ?>

diff --git a/wp-includes/post.php b/wp-includes/post.php index a1163c24e..17c6dbcbf 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -966,13 +966,11 @@ function get_post_type_labels( $post_type_object ) { */ function _get_custom_object_labels( $object, $nohier_vs_hier_defaults ) { - if ( isset( $object->label ) ) { + if ( isset( $object->label ) && empty( $object->labels['name'] ) ) $object->labels['name'] = $object->label; - } - if ( !isset( $object->labels['singular_name'] ) && isset( $object->labels['name'] ) ) { + if ( !isset( $object->labels['singular_name'] ) && isset( $object->labels['name'] ) ) $object->labels['singular_name'] = $object->labels['name']; - } $defaults = array_map( create_function( '$x', $object->hierarchical? 'return $x[1];' : 'return $x[0];' ), $nohier_vs_hier_defaults ); $labels = array_merge( $defaults, $object->labels ); diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index 2d9b85d88..5a2564243 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -334,6 +334,9 @@ function register_taxonomy( $taxonomy, $object_type, $args = array() ) { * - update_item - Default is Update Tag/Update Category * - add_new_item - Default is Add New Tag/Add New Category * - new_item_name - Default is New Tag Name/New Category Name + * - separate_items_with_commas - This string isn't used on hierarchical taxonomies. Default is "Separate tags with commas," used in the meta box. + * - add_or_remove_items - This string isn't used on hierarchical taxonomies. Default is "Add or remove tags," used in the meta box when JavaScript is disabled. + * - choose_from_most_used - This string isn't used on hierarchical taxonomies. Default is "Choose from the most used tags," used in the meta box. * * Above, the first default value is for non-hierarchical taxonomies (like tags) and the second one is for hierarchical taxonomies (like categories.) * @@ -343,6 +346,9 @@ function register_taxonomy( $taxonomy, $object_type, $args = array() ) { */ function get_taxonomy_labels( $tax ) { + if ( isset( $tax->helps ) && empty( $tax->labels['separate_items_with_commas'] ) ) + $tax->labels['separate_items_with_commas'] = $tax->helps; + $nohier_vs_hier_defaults = array( 'name' => array( _x( 'Post Tags', 'taxonomy general name' ), _x( 'Categories', 'taxonomy general name' ) ), 'singular_name' => array( _x( 'Post Tag', 'taxonomy singular name' ), _x( 'Category', 'taxonomy singular name' ) ), @@ -355,6 +361,9 @@ function get_taxonomy_labels( $tax ) { 'update_item' => array( __( 'Update Tag' ), __( 'Update Category' ) ), 'add_new_item' => array( __( 'Add New Tag' ), __( 'Add New Category' ) ), 'new_item_name' => array( __( 'New Tag Name' ), __( 'New Category Name' ) ), + 'separate_items_with_commas' => array( __( 'Separate tags with commas' ), null ), + 'add_or_remove_items' => array( __( 'Add or remove tags' ), null ), + 'choose_from_most_used' => array( __( 'Choose from the most used tags' ), null ), ); return _get_custom_object_labels( $tax, $nohier_vs_hier_defaults );