WordPress.org

Make WordPress Core

Changeset 39029


Ignore:
Timestamp:
10/30/2016 05:53:04 PM (4 years ago)
Author:
DrewAPicture
Message:

REST: Fix some errant else if conditions and add a few missing periods on inline comments.

Props mrahmadawais.
See #38398.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/class-wp-rest-server.php

    r38947 r39029  
    115115    public function check_authentication() {
    116116        /**
    117          * Pass an authentication error to the API
     117         * Filters REST authentication errors.
    118118         *
    119119         * This is used to pass a WP_Error from an authentication method back to
     
    392392
    393393            if ( $jsonp_callback ) {
    394                 // Prepend '/**/' to mitigate possible JSONP Flash attacks
     394                // Prepend '/**/' to mitigate possible JSONP Flash attacks.
    395395                // https://miki.it/blog/2014/7/8/abusing-jsonp-with-rosetta-flash/
    396396                echo '/**/' . $jsonp_callback . '(' . $result . ')';
     
    503503                }
    504504
    505                 // Relation now changes from '$uri' to '$curie:$relation'
     505                // Relation now changes from '$uri' to '$curie:$relation'.
    506506                $rel_regex = str_replace( '\{rel\}', '(.+)', preg_quote( $curie['href'], '!' ) );
    507507                preg_match( '!' . $rel_regex . '!', $rel, $matches );
     
    583583            // Determine if any real links were found.
    584584            $has_links = count( array_filter( $embeds ) );
     585
    585586            if ( $has_links ) {
    586587                $embedded[ $rel ] = $embeds;
     
    742743                if ( is_string( $handler['methods'] ) ) {
    743744                    $methods = explode( ',', $handler['methods'] );
    744                 } else if ( is_array( $handler['methods'] ) ) {
     745                } elseif ( is_array( $handler['methods'] ) ) {
    745746                    $methods = $handler['methods'];
    746747                } else {
     
    756757            }
    757758        }
     759
    758760        return $endpoints;
    759761    }
     
    897899                        if ( is_wp_error( $permission ) ) {
    898900                            $response = $permission;
    899                         } else if ( false === $permission || null === $permission ) {
     901                        } elseif ( false === $permission || null === $permission ) {
    900902                            $response = new WP_Error( 'rest_forbidden', __( 'Sorry, you are not allowed to do that.' ), array( 'status' => 403 ) );
    901903                        }
Note: See TracChangeset for help on using the changeset viewer.