From 86c7950173428175efd1f632d86ae48f82b6c0ae Mon Sep 17 00:00:00 2001 From: Mark Jaquith Date: Fri, 5 Jul 2013 20:54:46 +0000 Subject: [PATCH] Make sure `get_post_gallery()` doesn't ever return an array when asked for a string. props kovshenin, wonderboymusic, ocean90. fixes #24270. git-svn-id: http://core.svn.wordpress.org/trunk@24572 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/media.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/wp-includes/media.php b/wp-includes/media.php index 9ea02fe15c..48e1fb5f55 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -2024,7 +2024,7 @@ function get_attached_image_srcs( $post_id = 0 ) { * @since 3.6.0 * * @param string $content A string which might contain image data. - * @param boolean $html Whether to return HTML or URLs + * @param boolean $html Whether to return HTML or URLs in the array * @param int $limit Optional. The number of image srcs to return * @return array The found images or srcs */ @@ -2109,7 +2109,7 @@ function get_content_image( $content, $html = true ) { * @since 3.6.0 * * @param string $content A string which might contain image data. - * @param boolean $html Whether to return HTML or data + * @param boolean $html Whether to return HTML or data in the array * @param int $limit Optional. The number of galleries to return * @return array A list of galleries, which in turn are a list of their srcs in order */ @@ -2152,7 +2152,7 @@ function get_content_galleries( $content, $html = true, $limit = 0 ) { * @since 3.6.0 * * @param int $post_id Optional. Post ID. - * @param boolean $html Whether to return HTML or data + * @param boolean $html Whether to return HTML or data in the array * @return array A list of arrays, each containing gallery data and srcs parsed * from the expanded shortcode */ @@ -2193,14 +2193,14 @@ function get_post_galleries_images( $post_id = 0 ) { * * @param int $post_id Optional. Post ID. * @param boolean $html Whether to return HTML or data - * @return array Gallery data and srcs parsed from the expanded shortcode + * @return string|array Gallery data and srcs parsed from the expanded shortcode */ function get_post_gallery( $post_id = 0, $html = true ) { if ( ! $post = get_post( $post_id ) ) - return array(); + return $html ? '' : array(); if ( ! has_shortcode( $post->post_content, 'gallery' ) ) - return array(); + return $html ? '' : array(); $data = get_content_galleries( $post->post_content, $html, false, 1 ); return reset( $data );