Make WordPress Core


Ignore:
Timestamp:
05/10/2013 10:54:33 PM (12 years ago)
Author:
markjaquith
Message:

Improve regular expressions by using a backreference to match right quote of quote pair when matching attributes.

props kovshenin. see #24225.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/post-formats.php

    r24233 r24241  
    792792        return $trimmed;
    793793    // the content is HTML so we grab the first href
    794     } elseif ( preg_match( '/<a\s[^>]*?href=[\'"](.+?)[\'"]/is', $content, $matches ) ) {
    795         return esc_url_raw( $matches[1] );
     794    } elseif ( preg_match( '/<a\s[^>]*?href=([\'"])(.+?)\1/is', $content, $matches ) ) {
     795        return esc_url_raw( $matches[2] );
    796796    }
    797797
Note: See TracChangeset for help on using the changeset viewer.