From 45bda3af69ebff33b25f5e86cfa66b9ab79f8164 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 8 Oct 2015 18:01:25 +0000 Subject: [PATCH] REST API: Add some missing documentation. Props swissspidy. Fixes #34215. Built from https://develop.svn.wordpress.org/trunk@34949 git-svn-id: http://core.svn.wordpress.org/trunk@34914 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/rest-api/rest-functions.php | 16 ++++++++++------ wp-includes/version.php | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/wp-includes/rest-api/rest-functions.php b/wp-includes/rest-api/rest-functions.php index 8a687f78ad..e13814eef7 100644 --- a/wp-includes/rest-api/rest-functions.php +++ b/wp-includes/rest-api/rest-functions.php @@ -4,6 +4,7 @@ * * @package WordPress * @subpackage REST_API + * @since 4.4.0 */ /** @@ -11,6 +12,8 @@ * * @since 4.4.0 * + * @global WP_REST_Server $wp_rest_server ResponseHandler instance (usually WP_REST_Server). + * * @param string $namespace The first URL segment after core prefix. Should be unique to your package/plugin. * @param string $route The base URL for route you are adding. * @param array $args Optional. Either an array of options for the endpoint, or an array of arrays for @@ -19,7 +22,6 @@ * false merges (with newer overriding if duplicate keys exist). Default false. */ function register_rest_route( $namespace, $route, $args = array(), $override = false ) { - /** @var WP_REST_Server $wp_rest_server */ global $wp_rest_server; @@ -67,7 +69,7 @@ function register_rest_route( $namespace, $route, $args = array(), $override = f * by object type. * * @param string|array $object_type Object(s) the field is being registered - * to, "post"|"term"|"comment" etc. + * to, "post"|"term"|"comment" etc. * @param string $attribute The attribute name. * @param array $args { * Optional. An array of arguments used to handle the registered field. @@ -78,12 +80,11 @@ function register_rest_route( $namespace, $route, $args = array(), $override = f * @type string|array|null $update_callback Optional. The callback function used to set and update the * field value. Default is 'null', the value cannot be set or * updated. - * @type string|array|null schema Optional. The callback function used to create the schema for + * @type string|array|null $schema Optional. The callback function used to create the schema for * this field. Default is 'null', no schema entry will be returned. * } */ function register_api_field( $object_type, $attribute, $args = array() ) { - $defaults = array( 'get_callback' => null, 'update_callback' => null, @@ -153,6 +154,9 @@ function rest_api_default_filters() { * Loads the REST API. * * @since 4.4.0 + * + * @global WP $wp Current WordPress environment instance. + * @global WP_REST_Server $wp_rest_server ResponseHandler instance (usually WP_REST_Server). */ function rest_api_loaded() { if ( empty( $GLOBALS['wp']->query_vars['rest_route'] ) ) { @@ -162,6 +166,7 @@ function rest_api_loaded() { /** * Whether this is a REST Request. * + * @since 4.4.0 * @var bool */ define( 'REST_REQUEST', true ); @@ -286,7 +291,7 @@ function rest_url( $path = '', $scheme = 'json' ) { * * @since 4.4.0 * - * @global WP_REST_Server $wp_rest_server + * @global WP_REST_Server $wp_rest_server ResponseHandler instance (usually WP_REST_Server). * * @param WP_REST_Request|string $request Request. * @return WP_REST_Response REST response. @@ -447,7 +452,6 @@ function rest_handle_options_request( $response, $handler, $request ) { * @return WP_REST_Response Current response being served. */ function rest_send_allow_header( $response, $server, $request ) { - $matched_route = $response->get_matched_route(); if ( ! $matched_route ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index decddf6b73..42e9682922 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-34948'; +$wp_version = '4.4-alpha-34949'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.