From a92d4f6fcb724925c6f3475185453dde7084b7f6 Mon Sep 17 00:00:00 2001 From: Drew Jaynes Date: Mon, 19 Oct 2015 22:39:25 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@35274 git-svn-id: http://core.svn.wordpress.org/trunk@35240 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/link-template.php | 27 ++++++++++++++----------- wp-includes/rest-api/rest-functions.php | 4 ++-- wp-includes/version.php | 2 +- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index dfd80f46e6..0999aec050 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -2920,9 +2920,9 @@ function get_shortcut_link() { * * @since 3.0.0 * - * @param string $path Optional. Path relative to the home url. Default empty. - * @param string $scheme Optional. Scheme to give the home url context. Accepts - * 'http', 'https', or 'relative'. Default null. + * @param string $path Optional. Path relative to the home url. Default empty. + * @param string|null $scheme Optional. Scheme to give the home url context. Accepts + * 'http', 'https', 'relative', 'rest', or null. Default null. * @return string Home url link with optional path appended. */ function home_url( $path = '', $scheme = null ) { @@ -2944,7 +2944,7 @@ function home_url( $path = '', $scheme = null ) { * @param int $blog_id Optional. Blog ID. Default null (current blog). * @param string $path Optional. Path relative to the home URL. Default empty. * @param string|null $orig_scheme Optional. Scheme to give the home URL context. Accepts - * 'http', 'https', 'relative', or null. Default null. + * 'http', 'https', 'relative', 'rest', or null. Default null. * @return string Home URL link with optional path appended. */ function get_home_url( $blog_id = null, $path = '', $scheme = null ) { @@ -2979,7 +2979,8 @@ function get_home_url( $blog_id = null, $path = '', $scheme = null ) { * * @param string $url The complete home URL including scheme and path. * @param string $path Path relative to the home URL. Blank string if no path is specified. - * @param string|null $orig_scheme Scheme to give the home URL context. Accepts 'http', 'https', 'relative' or null. + * @param string|null $orig_scheme Scheme to give the home URL context. Accepts 'http', 'https', + * 'relative', 'rest', or null. * @param int|null $blog_id Blog ID, or null for the current blog. */ return apply_filters( 'home_url', $url, $path, $orig_scheme, $blog_id ); @@ -3356,12 +3357,14 @@ function self_admin_url($path = '', $scheme = 'admin') { } /** - * Set the scheme for a URL + * Sets the scheme for a URL. * * @since 3.4.0 + * @since 4.4.0 The 'rest' scheme was added. * - * @param string $url Absolute url that includes a scheme - * @param string $scheme Optional. Scheme to give $url. Currently 'http', 'https', 'login', 'login_post', 'admin', or 'relative'. + * @param string $url Absolute url that includes a scheme + * @param string|null $scheme Optional. Scheme to give $url. Currently 'http', 'https', 'login', + * 'login_post', 'admin', 'relative', 'rest', 'rpc', or null. Default null. * @return string $url URL with chosen scheme. */ function set_url_scheme( $url, $scheme = null ) { @@ -3392,10 +3395,10 @@ function set_url_scheme( $url, $scheme = null ) { * * @since 3.4.0 * - * @param string $url The complete URL including scheme and path. - * @param string $scheme Scheme applied to the URL. One of 'http', 'https', or 'relative'. - * @param string $orig_scheme Scheme requested for the URL. One of 'http', 'https', 'login', - * 'login_post', 'admin', 'rpc', or 'relative'. + * @param string $url The complete URL including scheme and path. + * @param string $scheme Scheme applied to the URL. One of 'http', 'https', or 'relative'. + * @param string|null $orig_scheme Scheme requested for the URL. One of 'http', 'https', 'login', + * 'login_post', 'admin', 'relative', 'rest', 'rpc', or null. */ return apply_filters( 'set_url_scheme', $url, $scheme, $orig_scheme ); } diff --git a/wp-includes/rest-api/rest-functions.php b/wp-includes/rest-api/rest-functions.php index c4473679f4..ae8f123b53 100644 --- a/wp-includes/rest-api/rest-functions.php +++ b/wp-includes/rest-api/rest-functions.php @@ -235,10 +235,10 @@ function rest_get_url_prefix() { * * @param int $blog_id Optional. Blog ID. Default of null returns URL for current blog. * @param string $path Optional. REST route. Default '/'. - * @param string $scheme Optional. Sanitization scheme. Default 'json'. + * @param string $scheme Optional. Sanitization scheme. Default 'rest'. * @return string Full URL to the endpoint. */ -function get_rest_url( $blog_id = null, $path = '/', $scheme = 'json' ) { +function get_rest_url( $blog_id = null, $path = '/', $scheme = 'rest' ) { if ( empty( $path ) ) { $path = '/'; } diff --git a/wp-includes/version.php b/wp-includes/version.php index b7f83dae6f..4095d738c3 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-35273'; +$wp_version = '4.4-alpha-35274'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.