Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (8 years ago)
Author:
pento
Message:

Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php

    r41979 r42343  
    4343        $this->post_type = $post_type;
    4444        $this->namespace = 'wp/v2';
    45         $obj = get_post_type_object( $post_type );
     45        $obj             = get_post_type_object( $post_type );
    4646        $this->rest_base = ! empty( $obj->rest_base ) ? $obj->rest_base : $obj->name;
    4747
     
    5858    public function register_routes() {
    5959
    60         register_rest_route( $this->namespace, '/' . $this->rest_base, array(
    61             array(
    62                 'methods'             => WP_REST_Server::READABLE,
    63                 'callback'            => array( $this, 'get_items' ),
    64                 'permission_callback' => array( $this, 'get_items_permissions_check' ),
    65                 'args'                => $this->get_collection_params(),
    66             ),
    67             array(
    68                 'methods'             => WP_REST_Server::CREATABLE,
    69                 'callback'            => array( $this, 'create_item' ),
    70                 'permission_callback' => array( $this, 'create_item_permissions_check' ),
    71                 'args'                => $this->get_endpoint_args_for_item_schema( WP_REST_Server::CREATABLE ),
    72             ),
    73             'schema' => array( $this, 'get_public_item_schema' ),
    74         ) );
    75 
    76         $schema = $this->get_item_schema();
     60        register_rest_route(
     61            $this->namespace, '/' . $this->rest_base, array(
     62                array(
     63                    'methods'             => WP_REST_Server::READABLE,
     64                    'callback'            => array( $this, 'get_items' ),
     65                    'permission_callback' => array( $this, 'get_items_permissions_check' ),
     66                    'args'                => $this->get_collection_params(),
     67                ),
     68                array(
     69                    'methods'             => WP_REST_Server::CREATABLE,
     70                    'callback'            => array( $this, 'create_item' ),
     71                    'permission_callback' => array( $this, 'create_item_permissions_check' ),
     72                    'args'                => $this->get_endpoint_args_for_item_schema( WP_REST_Server::CREATABLE ),
     73                ),
     74                'schema' => array( $this, 'get_public_item_schema' ),
     75            )
     76        );
     77
     78        $schema        = $this->get_item_schema();
    7779        $get_item_args = array(
    78             'context'  => $this->get_context_param( array( 'default' => 'view' ) ),
     80            'context' => $this->get_context_param( array( 'default' => 'view' ) ),
    7981        );
    8082        if ( isset( $schema['properties']['password'] ) ) {
     
    8486            );
    8587        }
    86         register_rest_route( $this->namespace, '/' . $this->rest_base . '/(?P<id>[\d]+)', array(
    87             'args' => array(
    88                 'id' => array(
    89                     'description' => __( 'Unique identifier for the object.' ),
    90                     'type'        => 'integer',
    91                 ),
    92             ),
    93             array(
    94                 'methods'             => WP_REST_Server::READABLE,
    95                 'callback'            => array( $this, 'get_item' ),
    96                 'permission_callback' => array( $this, 'get_item_permissions_check' ),
    97                 'args'                => $get_item_args,
    98             ),
    99             array(
    100                 'methods'             => WP_REST_Server::EDITABLE,
    101                 'callback'            => array( $this, 'update_item' ),
    102                 'permission_callback' => array( $this, 'update_item_permissions_check' ),
    103                 'args'                => $this->get_endpoint_args_for_item_schema( WP_REST_Server::EDITABLE ),
    104             ),
    105             array(
    106                 'methods'             => WP_REST_Server::DELETABLE,
    107                 'callback'            => array( $this, 'delete_item' ),
    108                 'permission_callback' => array( $this, 'delete_item_permissions_check' ),
    109                 'args'                => array(
    110                     'force' => array(
    111                         'type'        => 'boolean',
    112                         'default'     => false,
    113                         'description' => __( 'Whether to bypass trash and force deletion.' ),
     88        register_rest_route(
     89            $this->namespace, '/' . $this->rest_base . '/(?P<id>[\d]+)', array(
     90                'args'   => array(
     91                    'id' => array(
     92                        'description' => __( 'Unique identifier for the object.' ),
     93                        'type'        => 'integer',
    11494                    ),
    11595                ),
    116             ),
    117             'schema' => array( $this, 'get_public_item_schema' ),
    118         ) );
     96                array(
     97                    'methods'             => WP_REST_Server::READABLE,
     98                    'callback'            => array( $this, 'get_item' ),
     99                    'permission_callback' => array( $this, 'get_item_permissions_check' ),
     100                    'args'                => $get_item_args,
     101                ),
     102                array(
     103                    'methods'             => WP_REST_Server::EDITABLE,
     104                    'callback'            => array( $this, 'update_item' ),
     105                    'permission_callback' => array( $this, 'update_item_permissions_check' ),
     106                    'args'                => $this->get_endpoint_args_for_item_schema( WP_REST_Server::EDITABLE ),
     107                ),
     108                array(
     109                    'methods'             => WP_REST_Server::DELETABLE,
     110                    'callback'            => array( $this, 'delete_item' ),
     111                    'permission_callback' => array( $this, 'delete_item_permissions_check' ),
     112                    'args'                => array(
     113                        'force' => array(
     114                            'type'        => 'boolean',
     115                            'default'     => false,
     116                            'description' => __( 'Whether to bypass trash and force deletion.' ),
     117                        ),
     118                    ),
     119                ),
     120                'schema' => array( $this, 'get_public_item_schema' ),
     121            )
     122        );
    119123    }
    120124
     
    160164        // Retrieve the list of registered collection query parameters.
    161165        $registered = $this->get_collection_params();
    162         $args = array();
     166        $args       = array();
    163167
    164168        /*
     
    259263         * @param WP_REST_Request $request The request used.
    260264         */
    261         $args = apply_filters( "rest_{$this->post_type}_query", $args, $request );
     265        $args       = apply_filters( "rest_{$this->post_type}_query", $args, $request );
    262266        $query_args = $this->prepare_items_query( $args, $request );
    263267
     
    265269
    266270        foreach ( $taxonomies as $taxonomy ) {
    267             $base = ! empty( $taxonomy->rest_base ) ? $taxonomy->rest_base : $taxonomy->name;
     271            $base        = ! empty( $taxonomy->rest_base ) ? $taxonomy->rest_base : $taxonomy->name;
    268272            $tax_exclude = $base . '_exclude';
    269273
     
    312316        }
    313317
    314         $page = (int) $query_args['paged'];
     318        $page        = (int) $query_args['paged'];
    315319        $total_posts = $posts_query->found_posts;
    316320
     
    330334        }
    331335
    332         $response  = rest_ensure_response( $posts );
     336        $response = rest_ensure_response( $posts );
    333337
    334338        $response->header( 'X-WP-Total', (int) $total_posts );
     
    336340
    337341        $request_params = $request->get_query_params();
    338         $base = add_query_arg( $request_params, rest_url( sprintf( '%s/%s', $this->namespace, $this->rest_base ) ) );
     342        $base           = add_query_arg( $request_params, rest_url( sprintf( '%s/%s', $this->namespace, $this->rest_base ) ) );
    339343
    340344        if ( $page > 1 ) {
     
    467471
    468472        if ( is_post_type_viewable( get_post_type_object( $post->post_type ) ) ) {
    469             $response->link_header( 'alternate',  get_permalink( $post->ID ), array( 'type' => 'text/html' ) );
     473            $response->link_header( 'alternate', get_permalink( $post->ID ), array( 'type' => 'text/html' ) );
    470474        }
    471475
     
    592596        }
    593597
    594         $post = get_post( $post_id );
     598        $post          = get_post( $post_id );
    595599        $fields_update = $this->update_additional_fields_for_object( $post, $request );
    596600
     
    718722        }
    719723
    720         $post = get_post( $post_id );
     724        $post          = get_post( $post_id );
    721725        $fields_update = $this->update_additional_fields_for_object( $post, $request );
    722726
     
    796800        $request->set_param( 'context', 'edit' );
    797801
    798 
    799802        // If we're forcing, then delete permanently.
    800803        if ( $force ) {
    801804            $previous = $this->prepare_item_for_response( $post, $request );
    802             $result = wp_delete_post( $id, true );
     805            $result   = wp_delete_post( $id, true );
    803806            $response = new WP_REST_Response();
    804             $response->set_data( array( 'deleted' => true, 'previous' => $previous->get_data() ) );
     807            $response->set_data(
     808                array(
     809                    'deleted'  => true,
     810                    'previous' => $previous->get_data(),
     811                )
     812            );
    805813        } else {
    806814            // If we don't support trashing for this type, error out.
     
    817825            // (Note that internally this falls through to `wp_delete_post` if
    818826            // the trash is disabled.)
    819             $result = wp_trash_post( $id );
    820             $post = get_post( $id );
     827            $result   = wp_trash_post( $id );
     828            $post     = get_post( $id );
    821829            $response = $this->prepare_item_for_response( $post, $request );
    822830        }
     
    9921000            if ( ! empty( $date_data ) ) {
    9931001                list( $prepared_post->post_date, $prepared_post->post_date_gmt ) = $date_data;
    994                 $prepared_post->edit_date = true;
     1002                $prepared_post->edit_date                                        = true;
    9951003            }
    9961004        } elseif ( ! empty( $schema['properties']['date_gmt'] ) && ! empty( $request['date_gmt'] ) ) {
     
    9991007            if ( ! empty( $date_data ) ) {
    10001008                list( $prepared_post->post_date, $prepared_post->post_date_gmt ) = $date_data;
    1001                 $prepared_post->edit_date = true;
     1009                $prepared_post->edit_date                                        = true;
    10021010            }
    10031011        }
     
    15031511        if ( ! empty( $schema['properties']['excerpt'] ) ) {
    15041512            /** This filter is documented in wp-includes/post-template.php */
    1505             $excerpt = apply_filters( 'the_excerpt', apply_filters( 'get_the_excerpt', $post->post_excerpt, $post ) );
     1513            $excerpt         = apply_filters( 'the_excerpt', apply_filters( 'get_the_excerpt', $post->post_excerpt, $post ) );
    15061514            $data['excerpt'] = array(
    15071515                'raw'       => $post->post_excerpt,
     
    15711579
    15721580            if ( ! empty( $schema['properties'][ $base ] ) ) {
    1573                 $terms = get_the_terms( $post, $taxonomy->name );
     1581                $terms         = get_the_terms( $post, $taxonomy->name );
    15741582                $data[ $base ] = $terms ? array_values( wp_list_pluck( $terms, 'term_id' ) ) : array();
    15751583            }
     
    16271635        // Entity meta.
    16281636        $links = array(
    1629             'self' => array(
    1630                 'href'   => rest_url( trailingslashit( $base ) . $post->ID ),
     1637            'self'       => array(
     1638                'href' => rest_url( trailingslashit( $base ) . $post->ID ),
    16311639            ),
    16321640            'collection' => array(
    1633                 'href'   => rest_url( $base ),
     1641                'href' => rest_url( $base ),
    16341642            ),
    16351643            'about'      => array(
    1636                 'href'   => rest_url( 'wp/v2/types/' . $this->post_type ),
     1644                'href' => rest_url( 'wp/v2/types/' . $this->post_type ),
    16371645            ),
    16381646        );
     
    17371745            // Base properties for every Post.
    17381746            'properties' => array(
    1739                 'date'            => array(
     1747                'date'         => array(
    17401748                    'description' => __( "The date the object was published, in the site's timezone." ),
    17411749                    'type'        => 'string',
     
    17431751                    'context'     => array( 'view', 'edit', 'embed' ),
    17441752                ),
    1745                 'date_gmt'        => array(
     1753                'date_gmt'     => array(
    17461754                    'description' => __( 'The date the object was published, as GMT.' ),
    17471755                    'type'        => 'string',
     
    17491757                    'context'     => array( 'view', 'edit' ),
    17501758                ),
    1751                 'guid'            => array(
     1759                'guid'         => array(
    17521760                    'description' => __( 'The globally unique identifier for the object.' ),
    17531761                    'type'        => 'object',
     
    17691777                    ),
    17701778                ),
    1771                 'id'              => array(
     1779                'id'           => array(
    17721780                    'description' => __( 'Unique identifier for the object.' ),
    17731781                    'type'        => 'integer',
     
    17751783                    'readonly'    => true,
    17761784                ),
    1777                 'link'            => array(
     1785                'link'         => array(
    17781786                    'description' => __( 'URL to the object.' ),
    17791787                    'type'        => 'string',
     
    17821790                    'readonly'    => true,
    17831791                ),
    1784                 'modified'        => array(
     1792                'modified'     => array(
    17851793                    'description' => __( "The date the object was last modified, in the site's timezone." ),
    17861794                    'type'        => 'string',
     
    17891797                    'readonly'    => true,
    17901798                ),
    1791                 'modified_gmt'    => array(
     1799                'modified_gmt' => array(
    17921800                    'description' => __( 'The date the object was last modified, as GMT.' ),
    17931801                    'type'        => 'string',
     
    17961804                    'readonly'    => true,
    17971805                ),
    1798                 'slug'            => array(
     1806                'slug'         => array(
    17991807                    'description' => __( 'An alphanumeric identifier for the object unique to its type.' ),
    18001808                    'type'        => 'string',
     
    18041812                    ),
    18051813                ),
    1806                 'status'          => array(
     1814                'status'       => array(
    18071815                    'description' => __( 'A named status for the object.' ),
    18081816                    'type'        => 'string',
     
    18101818                    'context'     => array( 'view', 'edit' ),
    18111819                ),
    1812                 'type'            => array(
     1820                'type'         => array(
    18131821                    'description' => __( 'Type of Post for the object.' ),
    18141822                    'type'        => 'string',
     
    18161824                    'readonly'    => true,
    18171825                ),
    1818                 'password'        => array(
     1826                'password'     => array(
    18191827                    'description' => __( 'A password to protect access to the content and excerpt.' ),
    18201828                    'type'        => 'string',
     
    18461854            'custom-fields',
    18471855        );
    1848         $fixed_schemas = array(
    1849             'post' => array(
     1856        $fixed_schemas        = array(
     1857            'post'       => array(
    18501858                'title',
    18511859                'editor',
     
    18581866                'custom-fields',
    18591867            ),
    1860             'page' => array(
     1868            'page'       => array(
    18611869                'title',
    18621870                'editor',
     
    18961904                        ),
    18971905                        'properties'  => array(
    1898                             'raw' => array(
     1906                            'raw'      => array(
    18991907                                'description' => __( 'Title for the object, as it exists in the database.' ),
    19001908                                'type'        => 'string',
     
    19211929                        ),
    19221930                        'properties'  => array(
    1923                             'raw' => array(
     1931                            'raw'       => array(
    19241932                                'description' => __( 'Content for the object, as it exists in the database.' ),
    19251933                                'type'        => 'string',
    19261934                                'context'     => array( 'edit' ),
    19271935                            ),
    1928                             'rendered' => array(
     1936                            'rendered'  => array(
    19291937                                'description' => __( 'HTML content for the object, transformed for display.' ),
    19301938                                'type'        => 'string',
     
    19321940                                'readonly'    => true,
    19331941                            ),
    1934                             'protected'       => array(
     1942                            'protected' => array(
    19351943                                'description' => __( 'Whether the content is protected with a password.' ),
    19361944                                'type'        => 'boolean',
     
    19601968                        ),
    19611969                        'properties'  => array(
    1962                             'raw' => array(
     1970                            'raw'       => array(
    19631971                                'description' => __( 'Excerpt for the object, as it exists in the database.' ),
    19641972                                'type'        => 'string',
    19651973                                'context'     => array( 'edit' ),
    19661974                            ),
    1967                             'rendered' => array(
     1975                            'rendered'  => array(
    19681976                                'description' => __( 'HTML excerpt for the object, transformed for display.' ),
    19691977                                'type'        => 'string',
     
    19711979                                'readonly'    => true,
    19721980                            ),
    1973                             'protected'       => array(
     1981                            'protected' => array(
    19741982                                'description' => __( 'Whether the excerpt is protected with a password.' ),
    19751983                                'type'        => 'boolean',
     
    19962004                        'context'     => array( 'view', 'edit' ),
    19972005                    );
    1998                     $schema['properties']['ping_status'] = array(
     2006                    $schema['properties']['ping_status']    = array(
    19992007                        'description' => __( 'Whether or not the object can be pinged.' ),
    20002008                        'type'        => 'string',
     
    20502058        $taxonomies = wp_list_filter( get_object_taxonomies( $this->post_type, 'objects' ), array( 'show_in_rest' => true ) );
    20512059        foreach ( $taxonomies as $taxonomy ) {
    2052             $base = ! empty( $taxonomy->rest_base ) ? $taxonomy->rest_base : $taxonomy->name;
     2060            $base                          = ! empty( $taxonomy->rest_base ) ? $taxonomy->rest_base : $taxonomy->name;
    20532061            $schema['properties'][ $base ] = array(
    20542062                /* translators: %s: taxonomy name */
     
    20562064                'type'        => 'array',
    20572065                'items'       => array(
    2058                     'type'    => 'integer',
     2066                    'type' => 'integer',
    20592067                ),
    20602068                'context'     => array( 'view', 'edit' ),
     
    20782086
    20792087        $query_params['after'] = array(
    2080             'description'        => __( 'Limit response to posts published after a given ISO8601 compliant date.' ),
    2081             'type'               => 'string',
    2082             'format'             => 'date-time',
     2088            'description' => __( 'Limit response to posts published after a given ISO8601 compliant date.' ),
     2089            'type'        => 'string',
     2090            'format'      => 'date-time',
    20832091        );
    20842092
    20852093        if ( post_type_supports( $this->post_type, 'author' ) ) {
    2086             $query_params['author'] = array(
    2087                 'description'         => __( 'Limit result set to posts assigned to specific authors.' ),
    2088                 'type'                => 'array',
    2089                 'items'               => array(
    2090                     'type'            => 'integer',
     2094            $query_params['author']         = array(
     2095                'description' => __( 'Limit result set to posts assigned to specific authors.' ),
     2096                'type'        => 'array',
     2097                'items'       => array(
     2098                    'type' => 'integer',
    20912099                ),
    2092                 'default'             => array(),
     2100                'default'     => array(),
    20932101            );
    20942102            $query_params['author_exclude'] = array(
    2095                 'description'         => __( 'Ensure result set excludes posts assigned to specific authors.' ),
    2096                 'type'                => 'array',
    2097                 'items'               => array(
    2098                     'type'            => 'integer',
     2103                'description' => __( 'Ensure result set excludes posts assigned to specific authors.' ),
     2104                'type'        => 'array',
     2105                'items'       => array(
     2106                    'type' => 'integer',
    20992107                ),
    2100                 'default'             => array(),
     2108                'default'     => array(),
    21012109            );
    21022110        }
    21032111
    21042112        $query_params['before'] = array(
    2105             'description'        => __( 'Limit response to posts published before a given ISO8601 compliant date.' ),
    2106             'type'               => 'string',
    2107             'format'             => 'date-time',
     2113            'description' => __( 'Limit response to posts published before a given ISO8601 compliant date.' ),
     2114            'type'        => 'string',
     2115            'format'      => 'date-time',
    21082116        );
    21092117
    21102118        $query_params['exclude'] = array(
    2111             'description'        => __( 'Ensure result set excludes specific IDs.' ),
    2112             'type'               => 'array',
    2113             'items'              => array(
    2114                 'type'           => 'integer',
     2119            'description' => __( 'Ensure result set excludes specific IDs.' ),
     2120            'type'        => 'array',
     2121            'items'       => array(
     2122                'type' => 'integer',
    21152123            ),
    2116             'default'            => array(),
     2124            'default'     => array(),
    21172125        );
    21182126
    21192127        $query_params['include'] = array(
    2120             'description'        => __( 'Limit result set to specific IDs.' ),
    2121             'type'               => 'array',
    2122             'items'              => array(
    2123                 'type'           => 'integer',
     2128            'description' => __( 'Limit result set to specific IDs.' ),
     2129            'type'        => 'array',
     2130            'items'       => array(
     2131                'type' => 'integer',
    21242132            ),
    2125             'default'            => array(),
     2133            'default'     => array(),
    21262134        );
    21272135
    21282136        if ( 'page' === $this->post_type || post_type_supports( $this->post_type, 'page-attributes' ) ) {
    21292137            $query_params['menu_order'] = array(
    2130                 'description'        => __( 'Limit result set to posts with a specific menu_order value.' ),
    2131                 'type'               => 'integer',
     2138                'description' => __( 'Limit result set to posts with a specific menu_order value.' ),
     2139                'type'        => 'integer',
    21322140            );
    21332141        }
    21342142
    21352143        $query_params['offset'] = array(
    2136             'description'        => __( 'Offset the result set by a specific number of items.' ),
    2137             'type'               => 'integer',
     2144            'description' => __( 'Offset the result set by a specific number of items.' ),
     2145            'type'        => 'integer',
    21382146        );
    21392147
    21402148        $query_params['order'] = array(
    2141             'description'        => __( 'Order sort attribute ascending or descending.' ),
    2142             'type'               => 'string',
    2143             'default'            => 'desc',
    2144             'enum'               => array( 'asc', 'desc' ),
     2149            'description' => __( 'Order sort attribute ascending or descending.' ),
     2150            'type'        => 'string',
     2151            'default'     => 'desc',
     2152            'enum'        => array( 'asc', 'desc' ),
    21452153        );
    21462154
    21472155        $query_params['orderby'] = array(
    2148             'description'        => __( 'Sort collection by object attribute.' ),
    2149             'type'               => 'string',
    2150             'default'            => 'date',
    2151             'enum'               => array(
     2156            'description' => __( 'Sort collection by object attribute.' ),
     2157            'type'        => 'string',
     2158            'default'     => 'date',
     2159            'enum'        => array(
    21522160                'author',
    21532161                'date',
     
    21702178
    21712179        if ( $post_type->hierarchical || 'attachment' === $this->post_type ) {
    2172             $query_params['parent'] = array(
    2173                 'description'       => __( 'Limit result set to items with particular parent IDs.' ),
    2174                 'type'              => 'array',
    2175                 'items'             => array(
    2176                     'type'          => 'integer',
     2180            $query_params['parent']         = array(
     2181                'description' => __( 'Limit result set to items with particular parent IDs.' ),
     2182                'type'        => 'array',
     2183                'items'       => array(
     2184                    'type' => 'integer',
    21772185                ),
    2178                 'default'           => array(),
     2186                'default'     => array(),
    21792187            );
    21802188            $query_params['parent_exclude'] = array(
    2181                 'description'       => __( 'Limit result set to all items except those of a particular parent ID.' ),
    2182                 'type'              => 'array',
    2183                 'items'             => array(
    2184                     'type'          => 'integer',
     2189                'description' => __( 'Limit result set to all items except those of a particular parent ID.' ),
     2190                'type'        => 'array',
     2191                'items'       => array(
     2192                    'type' => 'integer',
    21852193                ),
    2186                 'default'           => array(),
     2194                'default'     => array(),
    21872195            );
    21882196        }
     
    21922200            'type'              => 'array',
    21932201            'items'             => array(
    2194                 'type'          => 'string',
     2202                'type' => 'string',
    21952203            ),
    21962204            'sanitize_callback' => 'wp_parse_slug_list',
     
    22022210            'type'              => 'array',
    22032211            'items'             => array(
    2204                 'enum'          => array_merge( array_keys( get_post_stati() ), array( 'any' ) ),
    2205                 'type'          => 'string',
     2212                'enum' => array_merge( array_keys( get_post_stati() ), array( 'any' ) ),
     2213                'type' => 'string',
    22062214            ),
    22072215            'sanitize_callback' => array( $this, 'sanitize_post_statuses' ),
     
    22152223            $query_params[ $base ] = array(
    22162224                /* translators: %s: taxonomy name */
    2217                 'description'       => sprintf( __( 'Limit result set to all items that have the specified term assigned in the %s taxonomy.' ), $base ),
    2218                 'type'              => 'array',
    2219                 'items'             => array(
    2220                     'type'          => 'integer',
     2225                'description' => sprintf( __( 'Limit result set to all items that have the specified term assigned in the %s taxonomy.' ), $base ),
     2226                'type'        => 'array',
     2227                'items'       => array(
     2228                    'type' => 'integer',
    22212229                ),
    2222                 'default'           => array(),
     2230                'default'     => array(),
    22232231            );
    22242232
     
    22282236                'type'        => 'array',
    22292237                'items'       => array(
    2230                     'type'    => 'integer',
     2238                    'type' => 'integer',
    22312239                ),
    2232                 'default'           => array(),
     2240                'default'     => array(),
    22332241            );
    22342242        }
     
    22362244        if ( 'post' === $this->post_type ) {
    22372245            $query_params['sticky'] = array(
    2238                 'description'       => __( 'Limit result set to items that are sticky.' ),
    2239                 'type'              => 'boolean',
     2246                'description' => __( 'Limit result set to items that are sticky.' ),
     2247                'type'        => 'boolean',
    22402248            );
    22412249        }
     
    22742282
    22752283        // The default status is different in WP_REST_Attachments_Controller
    2276         $attributes = $request->get_attributes();
     2284        $attributes     = $request->get_attributes();
    22772285        $default_status = $attributes['args']['status']['default'];
    22782286
Note: See TracChangeset for help on using the changeset viewer.