WordPress.org

Make WordPress Core

Ticket #34300: 34300.patch

File 34300.patch, 4.4 KB (added by rachelbaker, 6 years ago)

get_rest_url should default to a scheme of rest

  • src/wp-includes/link-template.php

     
    29202920 *
    29212921 * @since 3.0.0
    29222922 *
    2923  * @param  string $path   Optional. Path relative to the home url. Default empty.
    2924  * @param  string $scheme Optional. Scheme to give the home url context. Accepts
    2925  *                        'http', 'https', or 'relative'. Default null.
     2923 * @param  string      $path   Optional. Path relative to the home url. Default empty.
     2924 * @param  string|null $scheme Optional. Scheme to give the home url context. Accepts
     2925 *                             'http', 'https', 'relative', 'rest', or null. Default null.
    29262926 * @return string Home url link with optional path appended.
    29272927*/
    29282928function home_url( $path = '', $scheme = null ) {
     
    29442944 * @param  int         $blog_id     Optional. Blog ID. Default null (current blog).
    29452945 * @param  string      $path        Optional. Path relative to the home URL. Default empty.
    29462946 * @param  string|null $orig_scheme Optional. Scheme to give the home URL context. Accepts
    2947  *                                  'http', 'https', 'relative', or null. Default null.
     2947 *                                  'http', 'https', 'relative', 'rest', or null. Default null.
    29482948 * @return string Home URL link with optional path appended.
    29492949*/
    29502950function get_home_url( $blog_id = null, $path = '', $scheme = null ) {
     
    29792979         *
    29802980         * @param string      $url         The complete home URL including scheme and path.
    29812981         * @param string      $path        Path relative to the home URL. Blank string if no path is specified.
    2982          * @param string|null $orig_scheme Scheme to give the home URL context. Accepts 'http', 'https', 'relative' or null.
     2982         * @param string|null $orig_scheme Scheme to give the home URL context. Accepts 'http', 'https',
     2983         *                                 'relative', 'rest', or null.
    29832984         * @param int|null    $blog_id     Blog ID, or null for the current blog.
    29842985         */
    29852986        return apply_filters( 'home_url', $url, $path, $orig_scheme, $blog_id );
     
    33603361 *
    33613362 * @since 3.4.0
    33623363 *
    3363  * @param string $url    Absolute url that includes a scheme
    3364  * @param string $scheme Optional. Scheme to give $url. Currently 'http', 'https', 'login', 'login_post', 'admin', or 'relative'.
     3364 * @param string      $url    Absolute url that includes a scheme
     3365 * @param string|null $scheme Optional. Scheme to give $url. Currently 'http', 'https', 'login',
     3366 *                            'login_post', 'admin', 'relative', 'rest', 'rpc', or null. Default is
     3367 *                            null.
    33653368 * @return string $url URL with chosen scheme.
    33663369 */
    33673370function set_url_scheme( $url, $scheme = null ) {
     
    33923395         *
    33933396         * @since 3.4.0
    33943397         *
    3395          * @param string $url         The complete URL including scheme and path.
    3396          * @param string $scheme      Scheme applied to the URL. One of 'http', 'https', or 'relative'.
    3397          * @param string $orig_scheme Scheme requested for the URL. One of 'http', 'https', 'login',
    3398          *                            'login_post', 'admin', 'rpc', or 'relative'.
     3398         * @param string      $url         The complete URL including scheme and path.
     3399         * @param string      $scheme      Scheme applied to the URL. One of 'http', 'https', or 'relative'.
     3400         * @param string|null $orig_scheme Scheme requested for the URL. One of 'http', 'https', 'login',
     3401         *                                 'login_post', 'admin', 'relative', 'rest', 'rpc', or null.
    33993402         */
    34003403        return apply_filters( 'set_url_scheme', $url, $scheme, $orig_scheme );
    34013404}
  • src/wp-includes/rest-api/rest-functions.php

     
    235235 *
    236236 * @param int    $blog_id Optional. Blog ID. Default of null returns URL for current blog.
    237237 * @param string $path    Optional. REST route. Default '/'.
    238  * @param string $scheme  Optional. Sanitization scheme. Default 'json'.
     238 * @param string $scheme  Optional. Sanitization scheme. Default 'rest'.
    239239 * @return string Full URL to the endpoint.
    240240 */
    241 function get_rest_url( $blog_id = null, $path = '/', $scheme = 'json' ) {
     241function get_rest_url( $blog_id = null, $path = '/', $scheme = 'rest' ) {
    242242        if ( empty( $path ) ) {
    243243                $path = '/';
    244244        }