diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php
index 3187e7edca..512accbe9f 100644
--- a/wp-includes/formatting.php
+++ b/wp-includes/formatting.php
@@ -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 ) . '">';
}
diff --git a/wp-includes/media.php b/wp-includes/media.php
index 0b28b2b93d..7e7cff4591 100644
--- a/wp-includes/media.php
+++ b/wp-includes/media.php
@@ -1929,11 +1929,11 @@ function get_content_media( $type, &$content, $html = true, $remove = false, $li
$data = array();
foreach ( $items as $item ) {
- preg_match_all( '#src=[\'"](.+?)[\'"]#is', $item, $src, PREG_SET_ORDER );
+ preg_match_all( '#src=([\'"])(.+?)\1#is', $item, $src, PREG_SET_ORDER );
if ( ! empty( $src ) ) {
$srcs = array();
foreach ( $src as $s )
- $srcs[] = $s[1];
+ $srcs[] = $s[2];
$data[] = array_values( array_unique( $srcs ) );
}
@@ -2254,9 +2254,9 @@ function get_content_images( &$content, $html = true, $remove = false, $limit =
$srcs = array();
foreach ( $tags as $tag ) {
- preg_match( '#src=[\'"](.+?)[\'"]#is', $tag, $src );
- if ( ! empty( $src[1] ) ) {
- $srcs[] = $src[1];
+ preg_match( '#src=([\'"])(.+?)\1#is', $tag, $src );
+ if ( ! empty( $src[2] ) ) {
+ $srcs[] = $src[2];
if ( $limit > 0 && count( $srcs ) >= $limit )
break;
}
@@ -2310,10 +2310,10 @@ function get_content_galleries( &$content, $html = true, $remove = false, $limit
if ( $html ) {
$galleries[] = $gallery;
} else {
- preg_match_all( '#src=[\'"](.+?)[\'"]#is', $gallery, $src, PREG_SET_ORDER );
+ preg_match_all( '#src=([\'"])(.+?)\1#is', $gallery, $src, PREG_SET_ORDER );
if ( ! empty( $src ) ) {
foreach ( $src as $s )
- $srcs[] = $s[1];
+ $srcs[] = $s[2];
}
$data['src'] = array_values( array_unique( $srcs ) );
diff --git a/wp-includes/post-formats.php b/wp-includes/post-formats.php
index 7993b538d6..e5340e66e1 100644
--- a/wp-includes/post-formats.php
+++ b/wp-includes/post-formats.php
@@ -791,8 +791,8 @@ function get_content_url( &$content, $remove = false ) {
return $trimmed;
// the content is HTML so we grab the first href
- } elseif ( preg_match( '/]*?href=[\'"](.+?)[\'"]/is', $content, $matches ) ) {
- return esc_url_raw( $matches[1] );
+ } elseif ( preg_match( '/]*?href=([\'"])(.+?)\1/is', $content, $matches ) ) {
+ return esc_url_raw( $matches[2] );
}
$lines = explode( "\n", $trimmed );