`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
This commit is contained in:
parent
f30266acb9
commit
491c91196f
|
@ -457,23 +457,23 @@ function xmlrpc_removepostdata( $content ) {
|
||||||
*/
|
*/
|
||||||
function wp_extract_urls( $content ) {
|
function wp_extract_urls( $content ) {
|
||||||
preg_match_all(
|
preg_match_all(
|
||||||
"#("
|
"#([\"']?)("
|
||||||
. "(?:([\w-]+:)?//?)"
|
. "(?:([\w-]+:)?//?)"
|
||||||
. "[^\s()<>]+"
|
. "[^\s()<>]+"
|
||||||
. "[.]"
|
. "[.]"
|
||||||
. "(?:"
|
. "(?:"
|
||||||
. "\([\w\d]+\)|"
|
. "\([\w\d]+\)|"
|
||||||
. "(?:"
|
. "(?:"
|
||||||
. "[^`!()\[\]{};:'\".,<>?«»“”‘’\s]|"
|
. "[^`!()\[\]{};:'\".,<>«»“”‘’\s]|"
|
||||||
. "(?:[:]\d+)?/?"
|
. "(?:[:]\d+)?/?"
|
||||||
. ")+"
|
. ")+"
|
||||||
. ")"
|
. ")"
|
||||||
. ")#",
|
. ")\\1#",
|
||||||
$content,
|
$content,
|
||||||
$post_links
|
$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 );
|
return array_values( $post_links );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue