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
This commit is contained in:
Drew Jaynes 2015-05-05 02:19:47 +00:00
parent 9d9fbf6a5b
commit 3ca1ff6b72

View File

@ -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;