Make WordPress Core

Ticket #24225: 24225.2.diff

File 24225.2.diff, 3.0 KB (added by kovshenin, 12 years ago)
  • wp-admin/includes/media.php

     
    150150        // convert any remaining line breaks to <br>
    151151        $caption = preg_replace( '/[ \n\t]*\n[ \t]*/', '<br />', $caption );
    152152
    153         $html = preg_replace( '/(class=["\'][^\'"]*)align(none|left|right|center)\s?/', '$1', $html );
     153        $html = preg_replace( '/(class=(["\'])[^\\2]*)align(none|left|right|center)\s?/', '$1', $html );
    154154        if ( empty($align) )
    155155                $align = 'none';
    156156
  • wp-includes/media.php

     
    19291929        $data = array();
    19301930
    19311931        foreach ( $items as $item ) {
    1932                 preg_match_all( '#src=[\'"](.+?)[\'"]#is', $item, $src, PREG_SET_ORDER );
     1932                preg_match_all( '#src=([\'"])(.+?)\\1#is', $item, $src, PREG_SET_ORDER );
    19331933                if ( ! empty( $src ) ) {
    19341934                        $srcs = array();
    19351935                        foreach ( $src as $s )
    1936                                 $srcs[] = $s[1];
     1936                                $srcs[] = $s[2];
    19371937
    19381938                        $data[] = array_values( array_unique( $srcs ) );
    19391939                }
     
    22542254        $srcs = array();
    22552255
    22562256        foreach ( $tags as $tag ) {
    2257                 preg_match( '#src=[\'"](.+?)[\'"]#is', $tag, $src );
    2258                 if ( ! empty( $src[1] ) ) {
    2259                         $srcs[] = $src[1];
     2257                preg_match( '#src=([\'"])(.+?)\\1#is', $tag, $src );
     2258                if ( ! empty( $src[2] ) ) {
     2259                        $srcs[] = $src[2];
    22602260                        if ( $limit > 0 && count( $srcs ) >= $limit )
    22612261                                break;
    22622262                }
     
    23102310                                if ( $html ) {
    23112311                                        $galleries[] = $gallery;
    23122312                                } else {
    2313                                         preg_match_all( '#src=[\'"](.+?)[\'"]#is', $gallery, $src, PREG_SET_ORDER );
     2313                                        preg_match_all( '#src=([\'"])(.+?)\\1#is', $gallery, $src, PREG_SET_ORDER );
    23142314                                        if ( ! empty( $src ) ) {
    23152315                                                foreach ( $src as $s )
    2316                                                         $srcs[] = $s[1];
     2316                                                        $srcs[] = $s[2];
    23172317                                        }
    23182318
    23192319                                        $data['src'] = array_values( array_unique( $srcs ) );
  • wp-includes/post-formats.php

     
    789789
    790790                return $trimmed;
    791791        // the content is HTML so we grab the first href
    792         } elseif ( preg_match( '/<a\s[^>]*?href=[\'"](.+?)[\'"]/is', $content, $matches ) ) {
    793                 return esc_url_raw( $matches[1] );
     792        } elseif ( preg_match( '/<a\s[^>]*?href=([\'"])(.+?)\\1/is', $content, $matches ) ) {
     793                return esc_url_raw( $matches[2] );
    794794        }
    795795
    796796        $lines = explode( "\n", $trimmed );
  • wp-includes/formatting.php

     
    32013201function _links_add_target( $m ) {
    32023202        global $_links_add_target;
    32033203        $tag = $m[1];
    3204         $link = preg_replace('|(target=[\'"](.*?)[\'"])|i', '', $m[2]);
     3204        $link = preg_replace('|(target=([\'"])(.*?)\\2)|i', '', $m[2]);
    32053205        return '<' . $tag . $link . ' target="' . esc_attr( $_links_add_target ) . '">';
    32063206}
    32073207