From 3ca1ff6b728b085f011561fc082ae6709882a274 Mon Sep 17 00:00:00 2001 From: Drew Jaynes Date: Tue, 5 May 2015 02:19:47 +0000 Subject: [PATCH] Fix documentation syntax and formatting for the `media_sideload_image()` DocBlock. See #32246. git-svn-id: https://develop.svn.wordpress.org/trunk@32352 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/media.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/wp-admin/includes/media.php b/src/wp-admin/includes/media.php index 7299dc247f..123054bf63 100644 --- a/src/wp-admin/includes/media.php +++ b/src/wp-admin/includes/media.php @@ -822,19 +822,20 @@ function wp_media_upload_handler() { } /** - * Download an image from the specified URL and attach it to a post. + * Downloads an image from the specified URL and attaches it to a post. * * @since 2.6.0 * @since 4.2.0 Introduced the `$return` parameter. * - * @param string $file The URL of the image to download - * @param int $post_id The post ID the media is to be associated with - * @param string $desc Optional. Description of the image - * @param string $return Optional. Accepts 'html' (image tag html) or 'src' (URL). Default 'html'. - * @return string|WP_Error Populated HTML img tag on success + * @param string $file The URL of the image to download. + * @param int $post_id The post ID the media is to be associated with. + * @param string $desc Optional. Description of the image. + * @param string $return Optional. Accepts 'html' (image tag html) or 'src' (URL). Default 'html'. + * @return string|WP_Error Populated HTML img tag on success, WP_Error object otherwise. */ function media_sideload_image( $file, $post_id, $desc = null, $return = 'html' ) { if ( ! empty( $file ) ) { + // Set variables for storage, fix file filename for query strings. preg_match( '/[^\?]+\.(jpe?g|jpe|gif|png)\b/i', $file, $matches ); $file_array = array(); @@ -860,7 +861,7 @@ function media_sideload_image( $file, $post_id, $desc = null, $return = 'html' ) $src = wp_get_attachment_url( $id ); } - // Finally check to make sure the file has been saved, then return the HTML. + // Finally, check to make sure the file has been saved, then return the HTML. if ( ! empty( $src ) ) { if ( $return === 'src' ) { return $src;