mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-13 05:10:18 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@26972 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user