WordPress.org

Make WordPress Core

Ticket #18260: 18260.2.diff

File 18260.2.diff, 849 bytes (added by ryan, 7 years ago)

in_array()

  • wp-includes/formatting.php

     
    22562256        $url = str_replace(';//', '://', $url);
    22572257        /* If the URL doesn't appear to contain a scheme, we
    22582258         * presume it needs http:// appended (unless a relative
    2259          * link starting with / or a php file).
     2259         * link starting with /, # or ? or a php file).
    22602260         */
    2261         if ( strpos($url, ':') === false &&
    2262                 substr( $url, 0, 1 ) != '/' && substr( $url, 0, 1 ) != '#' && !preg_match('/^[a-z0-9-]+?\.php/i', $url) )
     2261        if ( strpos($url, ':') === false && ! in_array( $url[0], array( '/', '#', '?' ) ) &&
     2262                ! preg_match('/^[a-z0-9-]+?\.php/i', $url) )
    22632263                $url = 'http://' . $url;
    22642264
    22652265        // Replace ampersands and single quotes only when displaying.