Make WordPress Core

Changeset 26972


Ignore:
Timestamp:
01/17/2014 07:46:33 AM (11 years ago)
Author:
nacin
Message:

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.

Location:
trunk
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/formatting.php

    r26851 r26972  
    37713771 */
    37723772function get_url_in_content( $content ) {
    3773     if ( empty( $content ) )
    3774         return '';
    3775 
    3776     if ( preg_match( '/<a\s[^>]*?href=([\'"])(.+?)\1/is', $content, $matches ) )
     3773    if ( empty( $content ) ) {
     3774        return false;
     3775    }
     3776
     3777    if ( preg_match( '/<a\s[^>]*?href=([\'"])(.+?)\1/is', $content, $matches ) ) {
    37773778        return esc_url_raw( $matches[2] );
     3779    }
    37783780
    37793781    return false;
Note: See TracChangeset for help on using the changeset viewer.