Unit tests for get_url_in_content(). Return false when no content is passed, to match the return value of no links being found.
props mdbitz. #26171. Built from https://develop.svn.wordpress.org/trunk@26972 git-svn-id: http://core.svn.wordpress.org/trunk@26851 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
8adc7db517
commit
d9b0e70d4a
|
@ -3770,11 +3770,13 @@ function wp_unslash( $value ) {
|
|||
* @return string The found URL.
|
||||
*/
|
||||
function get_url_in_content( $content ) {
|
||||
if ( empty( $content ) )
|
||||
return '';
|
||||
if ( empty( $content ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( preg_match( '/<a\s[^>]*?href=([\'"])(.+?)\1/is', $content, $matches ) )
|
||||
if ( preg_match( '/<a\s[^>]*?href=([\'"])(.+?)\1/is', $content, $matches ) ) {
|
||||
return esc_url_raw( $matches[2] );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue