From 2452f69485b00836b07baab61cf2d232ec8aabc7 Mon Sep 17 00:00:00 2001 From: Drew Jaynes Date: Sun, 30 Oct 2016 17:54:30 +0000 Subject: [PATCH] REST: Fix some errant `else if` conditions and add a few missing periods on inline comments. Props mrahmadawais. See #38398. Built from https://develop.svn.wordpress.org/trunk@39029 git-svn-id: http://core.svn.wordpress.org/trunk@38971 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/rest-api/class-wp-rest-server.php | 12 +++++++----- wp-includes/version.php | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/wp-includes/rest-api/class-wp-rest-server.php b/wp-includes/rest-api/class-wp-rest-server.php index 391f549f3a..1b1a24439b 100644 --- a/wp-includes/rest-api/class-wp-rest-server.php +++ b/wp-includes/rest-api/class-wp-rest-server.php @@ -114,7 +114,7 @@ class WP_REST_Server { */ public function check_authentication() { /** - * Pass an authentication error to the API + * Filters REST authentication errors. * * This is used to pass a WP_Error from an authentication method back to * the API. @@ -391,7 +391,7 @@ class WP_REST_Server { } if ( $jsonp_callback ) { - // Prepend '/**/' to mitigate possible JSONP Flash attacks + // Prepend '/**/' to mitigate possible JSONP Flash attacks. // https://miki.it/blog/2014/7/8/abusing-jsonp-with-rosetta-flash/ echo '/**/' . $jsonp_callback . '(' . $result . ')'; } else { @@ -502,7 +502,7 @@ class WP_REST_Server { continue; } - // Relation now changes from '$uri' to '$curie:$relation' + // Relation now changes from '$uri' to '$curie:$relation'. $rel_regex = str_replace( '\{rel\}', '(.+)', preg_quote( $curie['href'], '!' ) ); preg_match( '!' . $rel_regex . '!', $rel, $matches ); if ( $matches ) { @@ -582,6 +582,7 @@ class WP_REST_Server { // Determine if any real links were found. $has_links = count( array_filter( $embeds ) ); + if ( $has_links ) { $embedded[ $rel ] = $embeds; } @@ -741,7 +742,7 @@ class WP_REST_Server { // Allow comma-separated HTTP methods. if ( is_string( $handler['methods'] ) ) { $methods = explode( ',', $handler['methods'] ); - } else if ( is_array( $handler['methods'] ) ) { + } elseif ( is_array( $handler['methods'] ) ) { $methods = $handler['methods']; } else { $methods = array(); @@ -755,6 +756,7 @@ class WP_REST_Server { } } } + return $endpoints; } @@ -896,7 +898,7 @@ class WP_REST_Server { if ( is_wp_error( $permission ) ) { $response = $permission; - } else if ( false === $permission || null === $permission ) { + } elseif ( false === $permission || null === $permission ) { $response = new WP_Error( 'rest_forbidden', __( 'Sorry, you are not allowed to do that.' ), array( 'status' => 403 ) ); } } diff --git a/wp-includes/version.php b/wp-includes/version.php index f35452092f..587e136e6f 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.7-beta1-39028'; +$wp_version = '4.7-beta1-39029'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.