- Timestamp:
- 11/30/2017 11:09:33 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php
r42000 r42343 306 306 public function get_collection_params() { 307 307 return array( 308 'context' => $this->get_context_param(),309 'page' => array(310 'description' => __( 'Current page of the collection.' ),311 'type' => 'integer',312 'default' => 1,313 'sanitize_callback' => 'absint',314 'validate_callback' => 'rest_validate_request_arg',315 'minimum' => 1,308 'context' => $this->get_context_param(), 309 'page' => array( 310 'description' => __( 'Current page of the collection.' ), 311 'type' => 'integer', 312 'default' => 1, 313 'sanitize_callback' => 'absint', 314 'validate_callback' => 'rest_validate_request_arg', 315 'minimum' => 1, 316 316 ), 317 'per_page' => array(318 'description' => __( 'Maximum number of items to be returned in result set.' ),319 'type' => 'integer',320 'default' => 10,321 'minimum' => 1,322 'maximum' => 100,323 'sanitize_callback' => 'absint',324 'validate_callback' => 'rest_validate_request_arg',317 'per_page' => array( 318 'description' => __( 'Maximum number of items to be returned in result set.' ), 319 'type' => 'integer', 320 'default' => 10, 321 'minimum' => 1, 322 'maximum' => 100, 323 'sanitize_callback' => 'absint', 324 'validate_callback' => 'rest_validate_request_arg', 325 325 ), 326 'search' => array(327 'description' => __( 'Limit results to those matching a string.' ),328 'type' => 'string',329 'sanitize_callback' => 'sanitize_text_field',330 'validate_callback' => 'rest_validate_request_arg',326 'search' => array( 327 'description' => __( 'Limit results to those matching a string.' ), 328 'type' => 'string', 329 'sanitize_callback' => 'sanitize_text_field', 330 'validate_callback' => 'rest_validate_request_arg', 331 331 ), 332 332 ); … … 345 345 public function get_context_param( $args = array() ) { 346 346 $param_details = array( 347 'description' => __( 'Scope under which the request is made; determines fields present in response.' ),348 'type' => 'string',349 'sanitize_callback' => 'sanitize_key',350 'validate_callback' => 'rest_validate_request_arg',347 'description' => __( 'Scope under which the request is made; determines fields present in response.' ), 348 'type' => 'string', 349 'sanitize_callback' => 'sanitize_key', 350 'validate_callback' => 'rest_validate_request_arg', 351 351 ); 352 352 … … 557 557 // Only use required / default from arg_options on CREATABLE endpoints. 558 558 if ( WP_REST_Server::CREATABLE !== $method ) { 559 $params['arg_options'] = array_diff_key( $params['arg_options'], array( 'required' => '', 'default' => '' ) ); 559 $params['arg_options'] = array_diff_key( 560 $params['arg_options'], array( 561 'required' => '', 562 'default' => '', 563 ) 564 ); 560 565 } 561 566
Note: See TracChangeset
for help on using the changeset viewer.