Fix documentation syntax and formatting for the `media_sideload_image()` DocBlock.
See #32246. Built from https://develop.svn.wordpress.org/trunk@32352 git-svn-id: http://core.svn.wordpress.org/trunk@32323 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a3b092843b
commit
a452927c39
|
@ -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;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.3-alpha-32351';
|
||||
$wp_version = '4.3-alpha-32352';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue