From 491c91196f9989597261cb06df0d69783a4cc334 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Tue, 23 Sep 2014 02:50:19 +0000 Subject: [PATCH] `wp_extract_urls()` needs to also grab URLs with query strings and hashes. Updates unit test. Props hauvong, dlh. Fixes #29314. Built from https://develop.svn.wordpress.org/trunk@29756 git-svn-id: http://core.svn.wordpress.org/trunk@29528 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 0a8e1a0ccc..b164d92c6d 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -457,23 +457,23 @@ function xmlrpc_removepostdata( $content ) { */ function wp_extract_urls( $content ) { preg_match_all( - "#(" + "#([\"']?)(" . "(?:([\w-]+:)?//?)" . "[^\s()<>]+" . "[.]" . "(?:" . "\([\w\d]+\)|" . "(?:" - . "[^`!()\[\]{};:'\".,<>?«»“”‘’\s]|" + . "[^`!()\[\]{};:'\".,<>«»“”‘’\s]|" . "(?:[:]\d+)?/?" . ")+" . ")" - . ")#", + . ")\\1#", $content, $post_links ); - $post_links = array_unique( array_map( 'html_entity_decode', $post_links[0] ) ); + $post_links = array_unique( array_map( 'html_entity_decode', $post_links[2] ) ); return array_values( $post_links ); }