mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-04 17:20:07 +00:00
Improve regular expressions by using a backreference to match right quote of quote pair when matching attributes.
props kovshenin. see #24225. git-svn-id: https://develop.svn.wordpress.org/trunk@24241 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -3206,7 +3206,7 @@ function links_add_target( $content, $target = '_blank', $tags = array('a') ) {
|
||||
function _links_add_target( $m ) {
|
||||
global $_links_add_target;
|
||||
$tag = $m[1];
|
||||
$link = preg_replace('|(target=[\'"](.*?)[\'"])|i', '', $m[2]);
|
||||
$link = preg_replace('|(target=([\'"])(.*?)\2)|i', '', $m[2]);
|
||||
return '<' . $tag . $link . ' target="' . esc_attr( $_links_add_target ) . '">';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user