Docs: Replace multiple single line comments with multi-line comments.
This changeset updates various comments as per WordPress PHP Inline Documentation Standards. See https://developer.wordpress.org/coding-standards/inline-documentation-standards/php/#5-inline-comments. Follow-up to [56174], [56175], [56176], [56177], [56178], [56179], [56180], [56191]. Props costdev, audrasjb. See #58459. Built from https://develop.svn.wordpress.org/trunk@56192 git-svn-id: http://core.svn.wordpress.org/trunk@55704 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -473,8 +473,10 @@ function get_rest_url( $blog_id = null, $path = '/', $scheme = 'rest' ) {
|
||||
$url .= $path;
|
||||
} else {
|
||||
$url = trailingslashit( get_home_url( $blog_id, '', $scheme ) );
|
||||
// nginx only allows HTTP/1.0 methods when redirecting from / to /index.php.
|
||||
// To work around this, we manually add index.php to the URL, avoiding the redirect.
|
||||
/*
|
||||
* nginx only allows HTTP/1.0 methods when redirecting from / to /index.php.
|
||||
* To work around this, we manually add index.php to the URL, avoiding the redirect.
|
||||
*/
|
||||
if ( ! str_ends_with( $url, 'index.php' ) ) {
|
||||
$url .= 'index.php';
|
||||
}
|
||||
@@ -632,8 +634,10 @@ function rest_ensure_response( $response ) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
// While WP_HTTP_Response is the base class of WP_REST_Response, it doesn't provide
|
||||
// all the required methods used in WP_REST_Server::dispatch().
|
||||
/*
|
||||
* While WP_HTTP_Response is the base class of WP_REST_Response, it doesn't provide
|
||||
* all the required methods used in WP_REST_Server::dispatch().
|
||||
*/
|
||||
if ( $response instanceof WP_HTTP_Response ) {
|
||||
return new WP_REST_Response(
|
||||
$response->get_data(),
|
||||
@@ -945,13 +949,17 @@ function rest_is_field_included( $field, $fields ) {
|
||||
}
|
||||
|
||||
foreach ( $fields as $accepted_field ) {
|
||||
// Check to see if $field is the parent of any item in $fields.
|
||||
// A field "parent" should be accepted if "parent.child" is accepted.
|
||||
/*
|
||||
* Check to see if $field is the parent of any item in $fields.
|
||||
* A field "parent" should be accepted if "parent.child" is accepted.
|
||||
*/
|
||||
if ( str_starts_with( $accepted_field, "$field." ) ) {
|
||||
return true;
|
||||
}
|
||||
// Conversely, if "parent" is accepted, all "parent.child" fields
|
||||
// should also be accepted.
|
||||
/*
|
||||
* Conversely, if "parent" is accepted, all "parent.child" fields
|
||||
* should also be accepted.
|
||||
*/
|
||||
if ( str_starts_with( $field, "$accepted_field." ) ) {
|
||||
return true;
|
||||
}
|
||||
@@ -1609,8 +1617,10 @@ function rest_get_best_type_for_value( $value, $types ) {
|
||||
'null' => 'is_null',
|
||||
);
|
||||
|
||||
// Both arrays and objects allow empty strings to be converted to their types.
|
||||
// But the best answer for this type is a string.
|
||||
/*
|
||||
* Both arrays and objects allow empty strings to be converted to their types.
|
||||
* But the best answer for this type is a string.
|
||||
*/
|
||||
if ( '' === $value && in_array( 'string', $types, true ) ) {
|
||||
return 'string';
|
||||
}
|
||||
@@ -2191,8 +2201,10 @@ function rest_validate_value_from_schema( $value, $args, $param = '' ) {
|
||||
}
|
||||
}
|
||||
|
||||
// The "format" keyword should only be applied to strings. However, for backward compatibility,
|
||||
// we allow the "format" keyword if the type keyword was not specified, or was set to an invalid value.
|
||||
/*
|
||||
* The "format" keyword should only be applied to strings. However, for backward compatibility,
|
||||
* we allow the "format" keyword if the type keyword was not specified, or was set to an invalid value.
|
||||
*/
|
||||
if ( isset( $args['format'] )
|
||||
&& ( ! isset( $args['type'] ) || 'string' === $args['type'] || ! in_array( $args['type'], $allowed_types, true ) )
|
||||
) {
|
||||
@@ -2858,8 +2870,10 @@ function rest_sanitize_value_from_schema( $value, $args, $param = '' ) {
|
||||
* @return array Modified reduce accumulator.
|
||||
*/
|
||||
function rest_preload_api_request( $memo, $path ) {
|
||||
// array_reduce() doesn't support passing an array in PHP 5.2,
|
||||
// so we need to make sure we start with one.
|
||||
/*
|
||||
* array_reduce() doesn't support passing an array in PHP 5.2,
|
||||
* so we need to make sure we start with one.
|
||||
*/
|
||||
if ( ! is_array( $memo ) ) {
|
||||
$memo = array();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user