From 776b3c3f1dee7511f3546cc8c060215d49bf3b65 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sun, 17 Jul 2016 16:14:27 +0000 Subject: [PATCH] Text Changes: Add a full stop to "Invalid taxonomy" and "Invalid term ID" strings, for consistency with similar post-related messages. See #18218, #32329. git-svn-id: https://develop.svn.wordpress.org/trunk@38077 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/edit-tags.php | 4 +-- .../includes/class-wp-terms-list-table.php | 2 +- src/wp-includes/class-wp-term.php | 2 +- src/wp-includes/class-wp-xmlrpc-server.php | 20 ++++++------- src/wp-includes/taxonomy.php | 30 ++++++++++--------- 5 files changed, 30 insertions(+), 28 deletions(-) diff --git a/src/wp-admin/edit-tags.php b/src/wp-admin/edit-tags.php index 43033ac981..dbb1f48363 100644 --- a/src/wp-admin/edit-tags.php +++ b/src/wp-admin/edit-tags.php @@ -10,12 +10,12 @@ require_once( dirname( __FILE__ ) . '/admin.php' ); if ( ! $taxnow ) - wp_die( __( 'Invalid taxonomy' ) ); + wp_die( __( 'Invalid taxonomy.' ) ); $tax = get_taxonomy( $taxnow ); if ( ! $tax ) - wp_die( __( 'Invalid taxonomy' ) ); + wp_die( __( 'Invalid taxonomy.' ) ); if ( ! in_array( $tax->name, get_taxonomies( array( 'show_ui' => true ) ) ) ) { wp_die( __( 'Sorry, you are not allowed to manage these items.' ) ); diff --git a/src/wp-admin/includes/class-wp-terms-list-table.php b/src/wp-admin/includes/class-wp-terms-list-table.php index dcef0d71d8..e765794a4e 100644 --- a/src/wp-admin/includes/class-wp-terms-list-table.php +++ b/src/wp-admin/includes/class-wp-terms-list-table.php @@ -53,7 +53,7 @@ class WP_Terms_List_Table extends WP_List_Table { $taxonomy = 'post_tag'; if ( ! taxonomy_exists( $taxonomy ) ) - wp_die( __( 'Invalid taxonomy' ) ); + wp_die( __( 'Invalid taxonomy.' ) ); $tax = get_taxonomy( $taxonomy ); diff --git a/src/wp-includes/class-wp-term.php b/src/wp-includes/class-wp-term.php index d53d518494..3b4931a041 100644 --- a/src/wp-includes/class-wp-term.php +++ b/src/wp-includes/class-wp-term.php @@ -176,7 +176,7 @@ final class WP_Term { // Don't return terms from invalid taxonomies. if ( ! taxonomy_exists( $_term->taxonomy ) ) { - return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy' ) ); + return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) ); } $_term = sanitize_term( $_term, $_term->taxonomy, 'raw' ); diff --git a/src/wp-includes/class-wp-xmlrpc-server.php b/src/wp-includes/class-wp-xmlrpc-server.php index 71b1e1c603..be2d3edb7d 100644 --- a/src/wp-includes/class-wp-xmlrpc-server.php +++ b/src/wp-includes/class-wp-xmlrpc-server.php @@ -1426,7 +1426,7 @@ class wp_xmlrpc_server extends IXR_Server { $term = get_term_by( 'id', $term_id, $taxonomy ); if ( ! $term ) - return new IXR_Error( 403, __( 'Invalid term ID' ) ); + return new IXR_Error( 403, __( 'Invalid term ID.' ) ); $terms[$taxonomy][] = (int) $term_id; } @@ -1873,7 +1873,7 @@ class wp_xmlrpc_server extends IXR_Server { do_action( 'xmlrpc_call', 'wp.newTerm' ); if ( ! taxonomy_exists( $content_struct['taxonomy'] ) ) - return new IXR_Error( 403, __( 'Invalid taxonomy' ) ); + return new IXR_Error( 403, __( 'Invalid taxonomy.' ) ); $taxonomy = get_taxonomy( $content_struct['taxonomy'] ); @@ -1960,7 +1960,7 @@ class wp_xmlrpc_server extends IXR_Server { do_action( 'xmlrpc_call', 'wp.editTerm' ); if ( ! taxonomy_exists( $content_struct['taxonomy'] ) ) - return new IXR_Error( 403, __( 'Invalid taxonomy' ) ); + return new IXR_Error( 403, __( 'Invalid taxonomy.' ) ); $taxonomy = get_taxonomy( $content_struct['taxonomy'] ); @@ -1978,7 +1978,7 @@ class wp_xmlrpc_server extends IXR_Server { return new IXR_Error( 500, $term->get_error_message() ); if ( ! $term ) - return new IXR_Error( 404, __( 'Invalid term ID' ) ); + return new IXR_Error( 404, __( 'Invalid term ID.' ) ); if ( isset( $content_struct['name'] ) ) { $term_data['name'] = trim( $content_struct['name'] ); @@ -2056,7 +2056,7 @@ class wp_xmlrpc_server extends IXR_Server { do_action( 'xmlrpc_call', 'wp.deleteTerm' ); if ( ! taxonomy_exists( $taxonomy ) ) - return new IXR_Error( 403, __( 'Invalid taxonomy' ) ); + return new IXR_Error( 403, __( 'Invalid taxonomy.' ) ); $taxonomy = get_taxonomy( $taxonomy ); @@ -2069,7 +2069,7 @@ class wp_xmlrpc_server extends IXR_Server { return new IXR_Error( 500, $term->get_error_message() ); if ( ! $term ) - return new IXR_Error( 404, __( 'Invalid term ID' ) ); + return new IXR_Error( 404, __( 'Invalid term ID.' ) ); $result = wp_delete_term( $term_id, $taxonomy->name ); @@ -2127,7 +2127,7 @@ class wp_xmlrpc_server extends IXR_Server { do_action( 'xmlrpc_call', 'wp.getTerm' ); if ( ! taxonomy_exists( $taxonomy ) ) - return new IXR_Error( 403, __( 'Invalid taxonomy' ) ); + return new IXR_Error( 403, __( 'Invalid taxonomy.' ) ); $taxonomy = get_taxonomy( $taxonomy ); @@ -2140,7 +2140,7 @@ class wp_xmlrpc_server extends IXR_Server { return new IXR_Error( 500, $term->get_error_message() ); if ( ! $term ) - return new IXR_Error( 404, __( 'Invalid term ID' ) ); + return new IXR_Error( 404, __( 'Invalid term ID.' ) ); return $this->_prepare_term( $term ); } @@ -2185,7 +2185,7 @@ class wp_xmlrpc_server extends IXR_Server { do_action( 'xmlrpc_call', 'wp.getTerms' ); if ( ! taxonomy_exists( $taxonomy ) ) - return new IXR_Error( 403, __( 'Invalid taxonomy' ) ); + return new IXR_Error( 403, __( 'Invalid taxonomy.' ) ); $taxonomy = get_taxonomy( $taxonomy ); @@ -2280,7 +2280,7 @@ class wp_xmlrpc_server extends IXR_Server { do_action( 'xmlrpc_call', 'wp.getTaxonomy' ); if ( ! taxonomy_exists( $taxonomy ) ) - return new IXR_Error( 403, __( 'Invalid taxonomy' ) ); + return new IXR_Error( 403, __( 'Invalid taxonomy.' ) ); $taxonomy = get_taxonomy( $taxonomy ); diff --git a/src/wp-includes/taxonomy.php b/src/wp-includes/taxonomy.php index d5d8a344b5..0aa97eca74 100644 --- a/src/wp-includes/taxonomy.php +++ b/src/wp-includes/taxonomy.php @@ -505,7 +505,7 @@ function register_taxonomy( $taxonomy, $object_type, $args = array() ) { */ function unregister_taxonomy( $taxonomy ) { if ( ! taxonomy_exists( $taxonomy ) ) { - return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy' ) ); + return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) ); } $taxonomy_args = get_taxonomy( $taxonomy ); @@ -736,7 +736,7 @@ function get_objects_in_term( $term_ids, $taxonomies, $args = array() ) { } foreach ( (array) $taxonomies as $taxonomy ) { if ( ! taxonomy_exists( $taxonomy ) ) { - return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy' ) ); + return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) ); } } @@ -826,7 +826,7 @@ function get_term( $term, $taxonomy = '', $output = OBJECT, $filter = 'raw' ) { } if ( $taxonomy && ! taxonomy_exists( $taxonomy ) ) { - return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy' ) ); + return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) ); } if ( $term instanceof WP_Term ) { @@ -988,8 +988,9 @@ function get_term_by( $field, $value, $taxonomy = '', $output = OBJECT, $filter * @return array|WP_Error List of Term IDs. WP_Error returned if `$taxonomy` does not exist. */ function get_term_children( $term_id, $taxonomy ) { - if ( ! taxonomy_exists($taxonomy) ) - return new WP_Error('invalid_taxonomy', __('Invalid taxonomy')); + if ( ! taxonomy_exists( $taxonomy ) ) { + return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) ); + } $term_id = intval( $term_id ); @@ -1208,7 +1209,7 @@ function get_terms( $args = array(), $deprecated = '' ) { if ( ! empty( $args['taxonomy'] ) ) { foreach ( $args['taxonomy'] as $taxonomy ) { if ( ! taxonomy_exists( $taxonomy ) ) { - return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy' ) ); + return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) ); } } } @@ -1975,7 +1976,7 @@ function wp_get_object_terms($object_ids, $taxonomies, $args = array()) { foreach ( $taxonomies as $taxonomy ) { if ( ! taxonomy_exists($taxonomy) ) - return new WP_Error('invalid_taxonomy', __('Invalid taxonomy')); + return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) ); } if ( !is_array($object_ids) ) @@ -2226,7 +2227,7 @@ function wp_insert_term( $term, $taxonomy, $args = array() ) { global $wpdb; if ( ! taxonomy_exists($taxonomy) ) { - return new WP_Error('invalid_taxonomy', __('Invalid taxonomy')); + return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) ); } /** * Filters a term before it is sanitized and inserted into the database. @@ -2241,10 +2242,10 @@ function wp_insert_term( $term, $taxonomy, $args = array() ) { return $term; } if ( is_int($term) && 0 == $term ) { - return new WP_Error('invalid_term_id', __('Invalid term ID')); + return new WP_Error( 'invalid_term_id', __( 'Invalid term ID.' ) ); } if ( '' == trim($term) ) { - return new WP_Error('empty_term_name', __('A name is required for this term')); + return new WP_Error( 'empty_term_name', __( 'A name is required for this term.' ) ); } $defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => ''); $args = wp_parse_args( $args, $defaults ); @@ -2473,8 +2474,9 @@ function wp_set_object_terms( $object_id, $terms, $taxonomy, $append = false ) { $object_id = (int) $object_id; - if ( ! taxonomy_exists($taxonomy) ) - return new WP_Error('invalid_taxonomy', __('Invalid taxonomy')); + if ( ! taxonomy_exists( $taxonomy ) ) { + return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) ); + } if ( !is_array($terms) ) $terms = array($terms); @@ -2611,7 +2613,7 @@ function wp_remove_object_terms( $object_id, $terms, $taxonomy ) { $object_id = (int) $object_id; if ( ! taxonomy_exists( $taxonomy ) ) { - return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy' ) ); + return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) ); } if ( ! is_array( $terms ) ) { @@ -2807,7 +2809,7 @@ function wp_update_term( $term_id, $taxonomy, $args = array() ) { global $wpdb; if ( ! taxonomy_exists( $taxonomy ) ) { - return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy' ) ); + return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) ); } $term_id = (int) $term_id;