Changeset 41288
- Timestamp:
- 08/22/2017 11:11:23 AM (7 years ago)
- Location:
- trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/image-edit.php
r40922 r41288 232 232 /** 233 233 * Streams image in WP_Image_Editor to browser. 234 * Provided for backcompat reasons 235 * 236 * @param WP_Image_Editor $image 237 * @param string $mime_type 238 * @param int $post_id 239 * @return bool 240 */ 241 function wp_stream_image( $image, $mime_type, $post_id ) { 234 * 235 * @param WP_Image_Editor $image The image editor instance. 236 * @param string $mime_type The mime type of the image. 237 * @param int $attachment_id The image's attachment post ID. 238 * @return bool True on success, false on failure. 239 */ 240 function wp_stream_image( $image, $mime_type, $attachment_id ) { 242 241 if ( $image instanceof WP_Image_Editor ) { 243 242 … … 247 246 * @since 3.5.0 248 247 * 249 * @param WP_Image_Editor $image WP_Image_Editor instance.250 * @param int $ post_id Post ID.248 * @param WP_Image_Editor $image The image editor instance. 249 * @param int $attachment_id The attachment post ID. 251 250 */ 252 $image = apply_filters( 'image_editor_save_pre', $image, $ post_id );251 $image = apply_filters( 'image_editor_save_pre', $image, $attachment_id ); 253 252 254 253 if ( is_wp_error( $image->stream( $mime_type ) ) ) … … 265 264 * @deprecated 3.5.0 Use image_editor_save_pre instead. 266 265 * 267 * @param resource $image Image resource to be streamed.268 * @param int $ post_id Post ID.266 * @param resource $image Image resource to be streamed. 267 * @param int $attachment_id The attachment post ID. 269 268 */ 270 $image = apply_filters( 'image_save_pre', $image, $ post_id );269 $image = apply_filters( 'image_save_pre', $image, $attachment_id ); 271 270 272 271 switch ( $mime_type ) { -
trunk/src/wp-includes/class-wp-image-editor-gd.php
r41162 r41288 430 430 * @since 3.5.0 431 431 * 432 * @param string $mime_type 433 * @return bool 432 * @param string $mime_type The mime type of the image. 433 * @return bool True on success, false on failure. 434 434 */ 435 435 public function stream( $mime_type = null ) { -
trunk/src/wp-includes/class-wp-image-editor-imagick.php
r41162 r41288 653 653 * @since 3.5.0 654 654 * 655 * @param string $mime_type 656 * @return true|WP_Error655 * @param string $mime_type The mime type of the image. 656 * @return bool|WP_Error True on success, WP_Error object on failure. 657 657 */ 658 658 public function stream( $mime_type = null ) { -
trunk/src/wp-includes/class-wp-image-editor.php
r41162 r41288 165 165 * @abstract 166 166 * 167 * @param string $mime_type 168 * @return bool|WP_Error 167 * @param string $mime_type The mime type of the image. 168 * @return bool|WP_Error True on success, WP_Error object or false on failure. 169 169 */ 170 170 abstract public function stream( $mime_type = null ); -
trunk/src/wp-includes/post.php
r41034 r41288 4964 4964 * @since 2.1.0 4965 4965 * 4966 * @param int $ post_id Attachment ID. Default 0.4967 * @param bool $unfiltered Optional. If true, filters are not run. Default false.4966 * @param int $attachment_id Attachment post ID. Defaults to global $post. 4967 * @param bool $unfiltered Optional. If true, filters are not run. Default false. 4968 4968 * @return mixed Attachment meta field. False on failure. 4969 4969 */ 4970 function wp_get_attachment_metadata( $ post_id = 0, $unfiltered = false ) {4971 $ post_id = (int) $post_id;4972 if ( ! $post = get_post( $post_id ) )4970 function wp_get_attachment_metadata( $attachment_id = 0, $unfiltered = false ) { 4971 $attachment_id = (int) $attachment_id; 4972 if ( ! $post = get_post( $attachment_id ) ) { 4973 4973 return false; 4974 } 4974 4975 4975 4976 $data = get_post_meta( $post->ID, '_wp_attachment_metadata', true ); … … 4983 4984 * @since 2.1.0 4984 4985 * 4985 * @param array|bool $data Array of meta data for the given attachment, or false4986 * if the object does not exist.4987 * @param int $ post_id Attachment ID.4986 * @param array|bool $data Array of meta data for the given attachment, or false 4987 * if the object does not exist. 4988 * @param int $attachment_id Attachment post ID. 4988 4989 */ 4989 4990 return apply_filters( 'wp_get_attachment_metadata', $data, $post->ID ); … … 4995 4996 * @since 2.1.0 4996 4997 * 4997 * @param int $ post_id Attachment ID.4998 * @param array $data Attachmentdata.4998 * @param int $attachment_id Attachment post ID. 4999 * @param array $data Attachment meta data. 4999 5000 * @return int|bool False if $post is invalid. 5000 5001 */ 5001 function wp_update_attachment_metadata( $ post_id, $data ) {5002 $ post_id = (int) $post_id;5003 if ( ! $post = get_post( $post_id ) )5002 function wp_update_attachment_metadata( $attachment_id, $data ) { 5003 $attachment_id = (int) $attachment_id; 5004 if ( ! $post = get_post( $attachment_id ) ) { 5004 5005 return false; 5006 } 5005 5007 5006 5008 /** … … 5009 5011 * @since 2.1.0 5010 5012 * 5011 * @param array $data Array of updated attachment meta data.5012 * @param int $ post_id Attachment ID.5013 * @param array $data Array of updated attachment meta data. 5014 * @param int $attachment_id Attachment post ID. 5013 5015 */ 5014 5016 if ( $data = apply_filters( 'wp_update_attachment_metadata', $data, $post->ID ) ) … … 5025 5027 * @global string $pagenow 5026 5028 * 5027 * @param int $ post_id Optional. Attachment ID. Default 0.5029 * @param int $attachment_id Optional. Attachment post ID. Defaults to global $post. 5028 5030 * @return string|false Attachment URL, otherwise false. 5029 5031 */ 5030 function wp_get_attachment_url( $ post_id = 0 ) {5031 $ post_id = (int) $post_id;5032 if ( ! $post = get_post( $post_id ) )5032 function wp_get_attachment_url( $attachment_id = 0 ) { 5033 $attachment_id = (int) $attachment_id; 5034 if ( ! $post = get_post( $attachment_id ) ) { 5033 5035 return false; 5036 } 5034 5037 5035 5038 if ( 'attachment' != $post->post_type ) … … 5073 5076 * @since 2.1.0 5074 5077 * 5075 * @param string $url URL for the given attachment.5076 * @param int $ post_id Attachment ID.5078 * @param string $url URL for the given attachment. 5079 * @param int $attachment_id Attachment post ID. 5077 5080 */ 5078 5081 $url = apply_filters( 'wp_get_attachment_url', $url, $post->ID );
Note: See TracChangeset
for help on using the changeset viewer.