Make WordPress Core

Changeset 49955


Ignore:
Timestamp:
01/10/2021 10:21:39 PM (4 years ago)
Author:
johnbillion
Message:

REST API: Corrections and improvements to docblocks for REST API filters.

See #51800

Location:
trunk/src/wp-includes/rest-api
Files:
12 edited

Legend:

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

    r49927 r49955  
    340340     * Retrieves the parameter priority order.
    341341     *
    342      * Used when checking parameters in get_param().
     342     * Used when checking parameters in WP_REST_Request::get_param().
    343343     *
    344344     * @since 4.4.0
     
    372372
    373373        /**
    374          * Filters the parameter order.
     374         * Filters the parameter priority order for a REST API request.
    375375         *
    376          * The order affects which parameters are checked when using get_param() and family.
    377          * This acts similarly to PHP's `request_order` setting.
     376         * The order affects which parameters are checked when using WP_REST_Request::get_param()
     377         * and family. This acts similarly to PHP's `request_order` setting.
    378378         *
    379379         * @since 4.4.0
     
    10361036
    10371037        /**
    1038          * Filters the request generated from a URL.
     1038         * Filters the REST API request generated from a URL.
    10391039         *
    10401040         * @since 4.5.0
  • trunk/src/wp-includes/rest-api/class-wp-rest-server.php

    r49946 r49955  
    163163    public function check_authentication() {
    164164        /**
    165          * Filters REST authentication errors.
     165         * Filters REST API authentication errors.
    166166         *
    167167         * This is used to pass a WP_Error from an authentication method back to
     
    311311
    312312        /**
    313          * Filters the list of response headers that are exposed to CORS requests.
     313         * Filters the list of response headers that are exposed to REST API CORS requests.
    314314         *
    315315         * @since 5.5.0
    316316         *
    317          * @param string[] $expose_headers The list of headers to expose.
     317         * @param string[] $expose_headers The list of response headers to expose.
    318318         */
    319319        $expose_headers = apply_filters( 'rest_exposed_cors_headers', $expose_headers );
     
    330330
    331331        /**
    332          * Filters the list of request headers that are allowed for CORS requests.
     332         * Filters the list of request headers that are allowed for REST API CORS requests.
    333333         *
    334334         * The allowed headers are passed to the browser to specify which
     
    339339         * @since 5.5.0
    340340         *
    341          * @param string[] $allow_headers The list of headers to allow.
     341         * @param string[] $allow_headers The list of request headers to allow.
    342342         */
    343343        $allow_headers = apply_filters( 'rest_allowed_cors_headers', $allow_headers );
     
    346346
    347347        /**
    348          * Send nocache headers on authenticated requests.
     348         * Filters whether to send nocache headers on a REST API request.
    349349         *
    350350         * @since 4.4.0
     
    385385
    386386        /**
    387          * Filters whether jsonp is enabled.
     387         * Filters whether JSONP is enabled for the REST API.
    388388         *
    389389         * @since 4.4.0
    390390         *
    391          * @param bool $jsonp_enabled Whether jsonp is enabled. Default true.
     391         * @param bool $jsonp_enabled Whether JSONP is enabled. Default true.
    392392         */
    393393        $jsonp_enabled = apply_filters( 'rest_jsonp_enabled', true );
     
    769769
    770770        /**
    771          * Filters the enveloped form of a response.
     771         * Filters the enveloped form of a REST API response.
    772772         *
    773773         * @since 4.4.0
    774774         *
    775          * @param array            $envelope Envelope data.
     775         * @param array            $envelope {
     776         *     Envelope data.
     777         *
     778         *     @type array $body    Response data.
     779         *     @type int   $status  The 3-digit HTTP status code.
     780         *     @type array $headers Map of header name to header value.
     781         * }
    776782         * @param WP_REST_Response $response Original response data.
    777783         */
     
    858864
    859865        /**
    860          * Filters the array of available endpoints.
     866         * Filters the array of available REST API endpoints.
    861867         *
    862868         * @since 4.4.0
     
    958964    public function dispatch( $request ) {
    959965        /**
    960          * Filters the pre-calculated result of a REST dispatch request.
     966         * Filters the pre-calculated result of a REST API dispatch request.
    961967         *
    962968         * Allow hijacking the request before dispatching by returning a non-empty. The returned value
     
    11171123         * @since 4.7.0
    11181124         *
    1119          * @param WP_REST_Response|WP_HTTP_Response|WP_Error|mixed $response Result to send to the client. Usually a WP_REST_Response or WP_Error.
     1125         * @param WP_REST_Response|WP_HTTP_Response|WP_Error|mixed $response Result to send to the client.
     1126         *                                                                   Usually a WP_REST_Response or WP_Error.
    11201127         * @param array                                            $handler  Route handler used for the request.
    11211128         * @param WP_REST_Request                                  $request  Request used to generate the response.
     
    11401147        if ( ! is_wp_error( $response ) ) {
    11411148            /**
    1142              * Filters the REST dispatch request result.
     1149             * Filters the REST API dispatch request result.
    11431150             *
    11441151             * Allow plugins to override dispatching the request.
     
    11781185         * @since 4.7.0
    11791186         *
    1180          * @param WP_REST_Response|WP_HTTP_Response|WP_Error|mixed $response Result to send to the client. Usually a WP_REST_Response or WP_Error.
     1187         * @param WP_REST_Response|WP_HTTP_Response|WP_Error|mixed $response Result to send to the client.
     1188         *                                                                   Usually a WP_REST_Response or WP_Error.
    11811189         * @param array                                            $handler  Route handler used for the request.
    11821190         * @param WP_REST_Request                                  $request  Request used to generate the response.
     
    13241332
    13251333        /**
    1326          * Filters the namespace index data.
     1334         * Filters the REST API namespace index data.
    13271335         *
    13281336         * This typically is just the route data for the namespace, but you can
     
    13571365
    13581366            /**
    1359              * Filters the REST endpoint data.
     1367             * Filters the REST API endpoint data.
    13601368             *
    13611369             * @since 4.4.0
     
    13671375
    13681376        /**
    1369          * Filters the publicly-visible data for routes.
     1377         * Filters the publicly-visible data for REST API routes.
    13701378         *
    13711379         * This data is exposed on indexes and can be used by clients or
     
    14671475    protected function get_max_batch_size() {
    14681476        /**
    1469          * Filters the maximum number of requests that can be included in a batch.
     1477         * Filters the maximum number of REST API requests that can be included in a batch.
    14701478         *
    14711479         * @since 5.6.0
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-block-directory-controller.php

    r49929 r49955  
    314314
    315315        /**
    316          * Filters collection parameters for the block directory controller.
     316         * Filters REST API collection parameters for the block directory controller.
    317317         *
    318318         * @since 5.5.0
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php

    r49610 r49955  
    450450
    451451            /**
    452              * Filters whether comments can be created without authentication.
     452             * Filters whether comments can be created via the REST API without authentication.
    453453             *
    454454             * Enables creating comments for anonymous users.
     
    956956
    957957        /**
    958          * Filters whether a comment can be trashed.
    959          *
    960          * Return false to disable Trash support for the post.
     958         * Filters whether a comment can be trashed via the REST API.
     959         *
     960         * Return false to disable trash support for the comment.
    961961         *
    962962         * @since 4.7.0
    963963         *
    964          * @param bool    $supports_trash Whether the post type support trashing.
    965          * @param WP_Post $comment        The comment object being considered for trashing support.
     964         * @param bool       $supports_trash Whether the comment supports trashing.
     965         * @param WP_Comment $comment        The comment object being considered for trashing support.
    966966         */
    967967        $supports_trash = apply_filters( 'rest_comment_trashable', ( EMPTY_TRASH_DAYS > 0 ), $comment );
     
    13521352
    13531353        /**
    1354          * Filters a comment after it is prepared for the database.
     1354         * Filters a comment added via the REST API after it is prepared for insertion into the database.
    13551355         *
    13561356         * Allows modification of the comment right after it is prepared for the database.
     
    16751675
    16761676        /**
    1677          * Filters collection parameters for the comments controller.
     1677         * Filters REST API collection parameters for the comments controller.
    16781678         *
    16791679         * This filter registers the collection parameter, but does not map the
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php

    r49952 r49955  
    587587
    588588        /**
    589          * Filters the plugin data for a response.
     589         * Filters plugin data for a REST API response.
    590590         *
    591591         * @since 5.5.0
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-post-statuses-controller.php

    r47122 r49955  
    269269
    270270        /**
    271          * Filters a status returned from the REST API.
     271         * Filters a post status returned from the REST API.
    272272         *
    273273         * Allows modification of the status data right before it is returned.
     
    276276         *
    277277         * @param WP_REST_Response $response The response object.
    278          * @param object           $status   The original status object.
     278         * @param object           $status   The original post status object.
    279279         * @param WP_REST_Request  $request  Request used to generate the response.
    280280         */
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php

    r48121 r49955  
    155155
    156156            /**
    157              * Filters whether to preempt a setting value update.
     157             * Filters whether to preempt a setting value update via the REST API.
    158158             *
    159159             * Allows hijacking the setting update logic and overriding the built-in behavior by
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php

    r49925 r49955  
    581581
    582582        /**
    583          * Filters collection parameters for the themes controller.
     583         * Filters REST API collection parameters for the themes controller.
    584584         *
    585585         * @since 5.0.0
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php

    r49906 r49955  
    15601560
    15611561        /**
    1562          * Filters collection parameters for the users controller.
     1562         * Filters REST API collection parameters for the users controller.
    15631563         *
    15641564         * This filter registers the collection parameter, but does not map the
  • trunk/src/wp-includes/rest-api/search/class-wp-rest-post-format-search-handler.php

    r49132 r49955  
    4747
    4848        /**
    49          * Filters the query arguments for a search request.
     49         * Filters the query arguments for a REST API search request.
    5050         *
    5151         * Enables adding extra arguments or setting defaults for a post format search request.
  • trunk/src/wp-includes/rest-api/search/class-wp-rest-post-search-handler.php

    r48381 r49955  
    7272
    7373        /**
    74          * Filters the query arguments for a search request.
     74         * Filters the query arguments for a REST API search request.
    7575         *
    7676         * Enables adding extra arguments or setting defaults for a post search request.
  • trunk/src/wp-includes/rest-api/search/class-wp-rest-term-search-handler.php

    r49787 r49955  
    6767
    6868        /**
    69          * Filters the query arguments for a search request.
     69         * Filters the query arguments for a REST API search request.
    7070         *
    7171         * Enables adding extra arguments or setting defaults for a term search request.
Note: See TracChangeset for help on using the changeset viewer.