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
This commit is contained in:
Drew Jaynes 2016-10-30 17:54:30 +00:00
parent 596ee8bc9d
commit 2452f69485
2 changed files with 8 additions and 6 deletions

View File

@ -114,7 +114,7 @@ class WP_REST_Server {
*/ */
public function check_authentication() { 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 * This is used to pass a WP_Error from an authentication method back to
* the API. * the API.
@ -391,7 +391,7 @@ class WP_REST_Server {
} }
if ( $jsonp_callback ) { 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/ // https://miki.it/blog/2014/7/8/abusing-jsonp-with-rosetta-flash/
echo '/**/' . $jsonp_callback . '(' . $result . ')'; echo '/**/' . $jsonp_callback . '(' . $result . ')';
} else { } else {
@ -502,7 +502,7 @@ class WP_REST_Server {
continue; 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'], '!' ) ); $rel_regex = str_replace( '\{rel\}', '(.+)', preg_quote( $curie['href'], '!' ) );
preg_match( '!' . $rel_regex . '!', $rel, $matches ); preg_match( '!' . $rel_regex . '!', $rel, $matches );
if ( $matches ) { if ( $matches ) {
@ -582,6 +582,7 @@ class WP_REST_Server {
// Determine if any real links were found. // Determine if any real links were found.
$has_links = count( array_filter( $embeds ) ); $has_links = count( array_filter( $embeds ) );
if ( $has_links ) { if ( $has_links ) {
$embedded[ $rel ] = $embeds; $embedded[ $rel ] = $embeds;
} }
@ -741,7 +742,7 @@ class WP_REST_Server {
// Allow comma-separated HTTP methods. // Allow comma-separated HTTP methods.
if ( is_string( $handler['methods'] ) ) { if ( is_string( $handler['methods'] ) ) {
$methods = explode( ',', $handler['methods'] ); $methods = explode( ',', $handler['methods'] );
} else if ( is_array( $handler['methods'] ) ) { } elseif ( is_array( $handler['methods'] ) ) {
$methods = $handler['methods']; $methods = $handler['methods'];
} else { } else {
$methods = array(); $methods = array();
@ -755,6 +756,7 @@ class WP_REST_Server {
} }
} }
} }
return $endpoints; return $endpoints;
} }
@ -896,7 +898,7 @@ class WP_REST_Server {
if ( is_wp_error( $permission ) ) { if ( is_wp_error( $permission ) ) {
$response = $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 ) ); $response = new WP_Error( 'rest_forbidden', __( 'Sorry, you are not allowed to do that.' ), array( 'status' => 403 ) );
} }
} }

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @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. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.