Make WordPress Core

Changeset 20376


Ignore:
Timestamp:
04/06/2012 05:38:49 PM (13 years ago)
Author:
azaozz
Message:

Fix second callback when filtering caption text for shortcode, props SergeyBiryukov, fixes #20369

File:
1 edited

Legend:

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

    r20358 r20376  
    167167// Private, preg_replace callback used in image_add_caption()
    168168function _cleanup_image_add_caption($str) {
    169     if ( isset($str[0]) ) {
     169    if ( isset( $str[0] ) ) {
    170170        // remove any line breaks from inside the tags
    171         $s = preg_replace( '/[\r\n\t]+/', ' ', $str[0]);
     171        $s = preg_replace( '/[\r\n\t]+/', ' ', $str[0] );
    172172        // look for single quotes inside html attributes (for example in title)
    173173        $s = preg_replace_callback( '/="[^"]+"/', '_cleanup_image_add_caption2', $s );
     
    180180// Private, preg_replace callback used in image_add_caption()
    181181function _cleanup_image_add_caption2($str) {
    182     return str_replace( "'", ''', $str );
     182    return ( isset( $str[0] ) ) ? str_replace( "'", ''', $str[0] ) : '';
    183183}
    184184
Note: See TracChangeset for help on using the changeset viewer.