- Timestamp:
- 01/29/2020 12:43:23 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-search-controller.php
r46586 r47122 69 69 foreach ( $search_handlers as $search_handler ) { 70 70 if ( ! $search_handler instanceof WP_REST_Search_Handler ) { 71 72 /* translators: %s: PHP class name. */ 73 _doing_it_wrong( __METHOD__, sprintf( __( 'REST search handlers must extend the %s class.' ), 'WP_REST_Search_Handler' ), '5.0.0' ); 71 _doing_it_wrong( 72 __METHOD__, 73 /* translators: %s: PHP class name. */ 74 sprintf( __( 'REST search handlers must extend the %s class.' ), 'WP_REST_Search_Handler' ), 75 '5.0.0' 76 ); 74 77 continue; 75 78 } … … 131 134 132 135 if ( ! isset( $result[ WP_REST_Search_Handler::RESULT_IDS ] ) || ! is_array( $result[ WP_REST_Search_Handler::RESULT_IDS ] ) || ! isset( $result[ WP_REST_Search_Handler::RESULT_TOTAL ] ) ) { 133 return new WP_Error( 'rest_search_handler_error', __( 'Internal search handler error.' ), array( 'status' => 500 ) ); 136 return new WP_Error( 137 'rest_search_handler_error', 138 __( 'Internal search handler error.' ), 139 array( 'status' => 500 ) 140 ); 134 141 } 135 142 … … 137 144 138 145 $results = array(); 146 139 147 foreach ( $ids as $id ) { 140 148 $data = $this->prepare_item_for_response( $id, $request ); … … 148 156 149 157 if ( $page > $max_pages && $total > 0 ) { 150 return new WP_Error( 'rest_search_invalid_page_number', __( 'The page number requested is larger than the number of pages available.' ), array( 'status' => 400 ) ); 158 return new WP_Error( 159 'rest_search_invalid_page_number', 160 __( 'The page number requested is larger than the number of pages available.' ), 161 array( 'status' => 400 ) 162 ); 151 163 } 152 164 … … 218 230 $types = array(); 219 231 $subtypes = array(); 232 220 233 foreach ( $this->search_handlers as $search_handler ) { 221 234 $types[] = $search_handler->get_type(); … … 268 281 269 282 $this->schema = $schema; 283 270 284 return $this->add_additional_fields_schema( $this->schema ); 271 285 } … … 281 295 $types = array(); 282 296 $subtypes = array(); 297 283 298 foreach ( $this->search_handlers as $search_handler ) { 284 299 $types[] = $search_handler->get_type(); … … 357 372 358 373 if ( ! $type || ! isset( $this->search_handlers[ $type ] ) ) { 359 return new WP_Error( 'rest_search_invalid_type', __( 'Invalid type parameter.' ), array( 'status' => 400 ) ); 374 return new WP_Error( 375 'rest_search_invalid_type', 376 __( 'Invalid type parameter.' ), 377 array( 'status' => 400 ) 378 ); 360 379 } 361 380
Note: See TracChangeset
for help on using the changeset viewer.