Add unit tests for links_add_target(). Alter the patterns in links_add_target() and _links_add_target() slightly based on learnings after running tests.

Props mdbitz.
Fixes #26164.


Built from https://develop.svn.wordpress.org/trunk@26328


git-svn-id: http://core.svn.wordpress.org/trunk@26230 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2013-11-22 16:25:10 +00:00
parent 28c19ec965
commit dc01b08a5e

View File

@ -3243,7 +3243,7 @@ function links_add_target( $content, $target = '_blank', $tags = array('a') ) {
global $_links_add_target;
$_links_add_target = $target;
$tags = implode('|', (array)$tags);
return preg_replace_callback( "!<($tags)(.+?)>!i", '_links_add_target', $content );
return preg_replace_callback( "!<($tags)([^>]*)>!i", '_links_add_target', $content );
}
/**