Ticket #48841: 48841.patch
File 48841.patch, 3.1 KB (added by , 5 years ago) |
---|
-
src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
16 16 */ 17 17 class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller { 18 18 19 /** 20 * Registers routes for attachments. 21 * 22 * @since 4.7.0 23 * 24 * @see register_rest_route() 25 */ 19 26 public function register_routes() { 20 27 parent::register_routes(); 21 28 register_rest_route( … … 184 191 * 185 192 * @since 5.3.0 186 193 * 187 * @param WP_REST_Request $request 194 * @param WP_REST_Request $request Full data about the Request object. 188 195 * @return array|WP_Error 189 196 */ 190 197 protected function insert_attachment( $request ) { … … 213 220 // Include image functions to get access to wp_read_image_metadata(). 214 221 require_once ABSPATH . 'wp-admin/includes/image.php'; 215 222 216 // use image exif/iptc data for title and caption defaults if possible 223 // use image exif/iptc data for title and caption defaults if possible. 217 224 $image_meta = wp_read_image_metadata( $file ); 218 225 219 226 if ( ! empty( $image_meta ) ) { … … 318 325 * 319 326 * @since 5.3.0 320 327 * 321 * @param WP_REST_Request $request 328 * @param WP_REST_Request $request Full data about the Request object. 322 329 * @return WP_REST_Response|WP_Error 323 330 */ 324 331 public function post_process_item( $request ) { … … 357 364 protected function prepare_item_for_database( $request ) { 358 365 $prepared_attachment = parent::prepare_item_for_database( $request ); 359 366 360 // Attachment caption (post_excerpt internally) 367 // Attachment caption (post_excerpt internally). 361 368 if ( isset( $request['caption'] ) ) { 362 369 if ( is_string( $request['caption'] ) ) { 363 370 $prepared_attachment->post_excerpt = $request['caption']; … … 539 546 'type' => 'object', 540 547 'context' => array( 'view', 'edit', 'embed' ), 541 548 'arg_options' => array( 542 'sanitize_callback' => null, // Note: sanitization implemented in self::prepare_item_for_database() 543 'validate_callback' => null, // Note: validation implemented in self::prepare_item_for_database() 549 'sanitize_callback' => null, // Note: sanitization implemented in self::prepare_item_for_database(). 550 'validate_callback' => null, // Note: validation implemented in self::prepare_item_for_database(). 544 551 ), 545 552 'properties' => array( 546 553 'raw' => array( … … 562 569 'type' => 'object', 563 570 'context' => array( 'view', 'edit' ), 564 571 'arg_options' => array( 565 'sanitize_callback' => null, // Note: sanitization implemented in self::prepare_item_for_database() 566 'validate_callback' => null, // Note: validation implemented in self::prepare_item_for_database() 572 'sanitize_callback' => null, // Note: sanitization implemented in self::prepare_item_for_database(). 573 'validate_callback' => null, // Note: validation implemented in self::prepare_item_for_database(). 567 574 ), 568 575 'properties' => array( 569 576 'raw' => array(