Changeset 54964
- Timestamp:
- 12/13/2022 06:26:28 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api.php
r54891 r54964 24 24 * @since 5.5.0 Added a `_doing_it_wrong()` notice when the required `permission_callback` argument is not set. 25 25 * 26 * @param string $ namespace The first URL segment after core prefix. Should be unique to your package/plugin.27 * @param string $route The base URL for route you are adding.28 * @param array $args Optional. Either an array of options for the endpoint, or an array of arrays for29 * multiple methods. Default empty array.30 * @param bool $override Optional. If the route already exists, should we override it? True overrides,31 * false merges (with newer overriding if duplicate keys exist). Default false.26 * @param string $route_namespace The first URL segment after core prefix. Should be unique to your package/plugin. 27 * @param string $route The base URL for route you are adding. 28 * @param array $args Optional. Either an array of options for the endpoint, or an array of arrays for 29 * multiple methods. Default empty array. 30 * @param bool $override Optional. If the route already exists, should we override it? True overrides, 31 * false merges (with newer overriding if duplicate keys exist). Default false. 32 32 * @return bool True on success, false on error. 33 33 */ 34 function register_rest_route( $ namespace, $route, $args = array(), $override = false ) {35 if ( empty( $ namespace ) ) {34 function register_rest_route( $route_namespace, $route, $args = array(), $override = false ) { 35 if ( empty( $route_namespace ) ) { 36 36 /* 37 37 * Non-namespaced routes are not allowed, with the exception of the main … … 46 46 } 47 47 48 $clean_namespace = trim( $ namespace, '/' );49 50 if ( $clean_namespace !== $ namespace ) {48 $clean_namespace = trim( $route_namespace, '/' ); 49 50 if ( $clean_namespace !== $route_namespace ) { 51 51 _doing_it_wrong( __FUNCTION__, __( 'Namespace must not start or end with a slash.' ), '5.4.2' ); 52 52 } … … 643 643 * @since 4.4.0 644 644 * 645 * @param string $function 646 * @param string $replacement The function that should have been called.647 * @param string $version Version.648 */ 649 function rest_handle_deprecated_function( $function , $replacement, $version ) {645 * @param string $function_name The function that was called. 646 * @param string $replacement The function that should have been called. 647 * @param string $version Version. 648 */ 649 function rest_handle_deprecated_function( $function_name, $replacement, $version ) { 650 650 if ( ! WP_DEBUG || headers_sent() ) { 651 651 return; … … 653 653 if ( ! empty( $replacement ) ) { 654 654 /* translators: 1: Function name, 2: WordPress version number, 3: New function name. */ 655 $string = sprintf( __( '%1$s (since %2$s; use %3$s instead)' ), $function , $version, $replacement );655 $string = sprintf( __( '%1$s (since %2$s; use %3$s instead)' ), $function_name, $version, $replacement ); 656 656 } else { 657 657 /* translators: 1: Function name, 2: WordPress version number. */ 658 $string = sprintf( __( '%1$s (since %2$s; no alternative available)' ), $function , $version );658 $string = sprintf( __( '%1$s (since %2$s; no alternative available)' ), $function_name, $version ); 659 659 } 660 660 … … 667 667 * @since 4.4.0 668 668 * 669 * @param string $function 670 * @param string $message A message regarding the change.671 * @param string $version Version.672 */ 673 function rest_handle_deprecated_argument( $function , $message, $version ) {669 * @param string $function_name The function that was called. 670 * @param string $message A message regarding the change. 671 * @param string $version Version. 672 */ 673 function rest_handle_deprecated_argument( $function_name, $message, $version ) { 674 674 if ( ! WP_DEBUG || headers_sent() ) { 675 675 return; … … 677 677 if ( $message ) { 678 678 /* translators: 1: Function name, 2: WordPress version number, 3: Error message. */ 679 $string = sprintf( __( '%1$s (since %2$s; %3$s)' ), $function , $version, $message );679 $string = sprintf( __( '%1$s (since %2$s; %3$s)' ), $function_name, $version, $message ); 680 680 } else { 681 681 /* translators: 1: Function name, 2: WordPress version number. */ 682 $string = sprintf( __( '%1$s (since %2$s; no alternative available)' ), $function , $version );682 $string = sprintf( __( '%1$s (since %2$s; no alternative available)' ), $function_name, $version ); 683 683 } 684 684 … … 691 691 * @since 5.5.0 692 692 * 693 * @param string $function The function that was called.694 * @param string $message A message explaining what has been done incorrectly.695 * @param string|null $version The version of WordPress where the message was added.696 */ 697 function rest_handle_doing_it_wrong( $function , $message, $version ) {693 * @param string $function_name The function that was called. 694 * @param string $message A message explaining what has been done incorrectly. 695 * @param string|null $version The version of WordPress where the message was added. 696 */ 697 function rest_handle_doing_it_wrong( $function_name, $message, $version ) { 698 698 if ( ! WP_DEBUG || headers_sent() ) { 699 699 return; … … 703 703 /* translators: Developer debugging message. 1: PHP function name, 2: WordPress version number, 3: Explanatory message. */ 704 704 $string = __( '%1$s (since %2$s; %3$s)' ); 705 $string = sprintf( $string, $function , $version, $message );705 $string = sprintf( $string, $function_name, $version, $message ); 706 706 } else { 707 707 /* translators: Developer debugging message. 1: PHP function name, 2: Explanatory message. */ 708 708 $string = __( '%1$s (%2$s)' ); 709 $string = sprintf( $string, $function , $message );709 $string = sprintf( $string, $function_name, $message ); 710 710 } 711 711 … … 1657 1657 * @since 5.5.0 1658 1658 * 1659 * @param array $ array The array to check.1659 * @param array $input_array The array to check. 1660 1660 * @return bool True if the array contains unique items, false otherwise. 1661 1661 */ 1662 function rest_validate_array_contains_unique_items( $ array ) {1662 function rest_validate_array_contains_unique_items( $input_array ) { 1663 1663 $seen = array(); 1664 1664 1665 foreach ( $ array as $item ) {1665 foreach ( $input_array as $item ) { 1666 1666 $stabilized = rest_stabilize_value( $item ); 1667 1667 $key = serialize( $stabilized );
Note: See TracChangeset
for help on using the changeset viewer.