Make WordPress Core

Changeset 35274


Ignore:
Timestamp:
10/19/2015 10:38:03 PM (9 years ago)
Author:
DrewAPicture
Message:

Docs: Update the default scheme for get_rest_url() from 'json' to 'rest'.

Also adds 'rest' to the documented list of schemes for home_url(), get_home_url(), set_url_scheme(), and the home_url and set_url_scheme hooks.

Props rachelbaker.
Fixes #34300.

Location:
trunk/src/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/link-template.php

    r35233 r35274  
    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*/
     
    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*/
     
    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     */
     
    33573358
    33583359/**
    3359  * Set the scheme for a URL
     3360 * Sets the scheme for a URL.
    33603361 *
    33613362 * @since 3.4.0
    3362  *
    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'.
     3363 * @since 4.4.0 The 'rest' scheme was added.
     3364 *
     3365 * @param string      $url    Absolute url that includes a scheme
     3366 * @param string|null $scheme Optional. Scheme to give $url. Currently 'http', 'https', 'login',
     3367 *                            'login_post', 'admin', 'relative', 'rest', 'rpc', or null. Default null.
    33653368 * @return string $url URL with chosen scheme.
    33663369 */
     
    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 );
  • trunk/src/wp-includes/rest-api/rest-functions.php

    r35266 r35274  
    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 = '/';
Note: See TracChangeset for help on using the changeset viewer.