| 1 | From aa2f10e5d8ee854f597250fca963e44efdd899ae Mon Sep 17 00:00:00 2001
|
|---|
| 2 | From: "John R. D'Orazio" <priest@johnromanodorazio.com>
|
|---|
| 3 | Date: Thu, 16 Jul 2020 22:15:07 +0200
|
|---|
| 4 | Subject: [PATCH] Update rest-api.php
|
|---|
| 5 |
|
|---|
| 6 | ---
|
|---|
| 7 | src/wp-includes/rest-api.php | 16 +++++++++-------
|
|---|
| 8 | 1 file changed, 9 insertions(+), 7 deletions(-)
|
|---|
| 9 |
|
|---|
| 10 | diff --git a/src/wp-includes/rest-api.php b/src/wp-includes/rest-api.php
|
|---|
| 11 | index d3bb80a3d6..d6db464c0e 100644
|
|---|
| 12 | --- a/src/wp-includes/rest-api.php
|
|---|
| 13 | +++ b/src/wp-includes/rest-api.php
|
|---|
| 14 | @@ -37,25 +37,27 @@ function register_rest_route( $namespace, $route, $args = array(), $override = f
|
|---|
| 15 | * and namespace indexes. If you really need to register a
|
|---|
| 16 | * non-namespaced route, call `WP_REST_Server::register_route` directly.
|
|---|
| 17 | */
|
|---|
| 18 | - _doing_it_wrong( 'register_rest_route', __( 'Routes must be namespaced with plugin or theme name and version.' ), '4.4.0' );
|
|---|
| 19 | + _doing_it_wrong( 'register_rest_route', __( 'Routes must be namespaced with plugin or theme name and version.' ) . ' [Namespace = "' . $namespace . '", Route = "' . $route . '"]', '4.4.0' );
|
|---|
| 20 | return false;
|
|---|
| 21 | } elseif ( empty( $route ) ) {
|
|---|
| 22 | - _doing_it_wrong( 'register_rest_route', __( 'Route must be specified.' ), '4.4.0' );
|
|---|
| 23 | + _doing_it_wrong( 'register_rest_route', __( 'Route must be specified.' ) . ' [Namespace = "' . $namespace . '", Route = "' . $route . '"]', '4.4.0' );
|
|---|
| 24 | return false;
|
|---|
| 25 | }
|
|---|
| 26 |
|
|---|
| 27 | $clean_namespace = trim( $namespace, '/' );
|
|---|
| 28 |
|
|---|
| 29 | if ( $clean_namespace !== $namespace ) {
|
|---|
| 30 | - _doing_it_wrong( __FUNCTION__, __( 'Namespace must not start or end with a slash.' ), '5.4.2' );
|
|---|
| 31 | + _doing_it_wrong(
|
|---|
| 32 | + __FUNCTION__,
|
|---|
| 33 | + __( 'Namespace must not start or end with a slash.' ) . ' [Namespace = "' . $namespace . '", Route = "' . $route . '"]', '5.4.2' );
|
|---|
| 34 | }
|
|---|
| 35 | -
|
|---|
| 36 | +
|
|---|
| 37 | if ( ! did_action( 'rest_api_init' ) ) {
|
|---|
| 38 | _doing_it_wrong(
|
|---|
| 39 | - 'register_rest_route',
|
|---|
| 40 | + __FUNCTION__,
|
|---|
| 41 | sprintf(
|
|---|
| 42 | /* translators: %s: rest_api_init */
|
|---|
| 43 | - __( 'REST API routes must be registered on the %s action.' ),
|
|---|
| 44 | + __( 'REST API routes must be registered on the %s action.' ) . ' [Namespace = "' . $namespace . '", Route = "' . $route . '"]',
|
|---|
| 45 | '<code>rest_api_init</code>'
|
|---|
| 46 | ),
|
|---|
| 47 | '5.1.0'
|
|---|
| 48 | @@ -1835,7 +1837,7 @@ function rest_sanitize_value_from_schema( $value, $args, $param = '' ) {
|
|---|
| 49 | _doing_it_wrong(
|
|---|
| 50 | __FUNCTION__,
|
|---|
| 51 | /* translators: 1. Parameter. 2. The list of allowed types. */
|
|---|
| 52 | - wp_sprintf( __( 'The "type" schema keyword for %1$s can only be on of the built-in types: %2$l.' ), $param, $allowed_types ),
|
|---|
| 53 | + wp_sprintf( __( 'The "type" schema keyword for %1$s can only be one of the built-in types: %2$l.' ), $param, $allowed_types ),
|
|---|
| 54 | '5.5.0'
|
|---|
| 55 | );
|
|---|
| 56 | }
|
|---|