WordPress.org

Make WordPress Core

Changeset 24572


Ignore:
Timestamp:
07/05/13 20:54:46 (10 months ago)
Author:
markjaquith
Message:

Make sure get_post_gallery() doesn't ever return an array when asked for a string.

props kovshenin, wonderboymusic, ocean90. fixes #24270.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/media.php

    r24571 r24572  
    20252025 * 
    20262026 * @param string $content A string which might contain image data. 
    2027  * @param boolean $html Whether to return HTML or URLs 
     2027 * @param boolean $html Whether to return HTML or URLs in the array 
    20282028 * @param int $limit Optional. The number of image srcs to return 
    20292029 * @return array The found images or srcs 
     
    21102110 * 
    21112111 * @param string $content A string which might contain image data. 
    2112  * @param boolean $html Whether to return HTML or data 
     2112 * @param boolean $html Whether to return HTML or data in the array 
    21132113 * @param int $limit Optional. The number of galleries to return 
    21142114 * @return array A list of galleries, which in turn are a list of their srcs in order 
     
    21532153 * 
    21542154 * @param int $post_id Optional. Post ID. 
    2155  * @param boolean $html Whether to return HTML or data 
     2155 * @param boolean $html Whether to return HTML or data in the array 
    21562156 * @return array A list of arrays, each containing gallery data and srcs parsed 
    21572157 *      from the expanded shortcode 
     
    21942194 * @param int $post_id Optional. Post ID. 
    21952195 * @param boolean $html Whether to return HTML or data 
    2196  * @return array Gallery data and srcs parsed from the expanded shortcode 
     2196 * @return string|array Gallery data and srcs parsed from the expanded shortcode 
    21972197 */ 
    21982198function get_post_gallery( $post_id = 0, $html = true ) { 
    21992199    if ( ! $post = get_post( $post_id ) ) 
    2200         return array(); 
     2200        return $html ? '' : array(); 
    22012201 
    22022202    if ( ! has_shortcode( $post->post_content, 'gallery' ) ) 
    2203         return array(); 
     2203        return $html ? '' : array(); 
    22042204 
    22052205    $data = get_content_galleries( $post->post_content, $html, false, 1 ); 
Note: See TracChangeset for help on using the changeset viewer.