WordPress.org

Make WordPress Core

Ticket #16945: 16945.patch

File 16945.patch, 874 bytes (added by hakre, 4 years ago)

First approach

  • wp-includes/formatting.php

    ### Eclipse Workspace Patch 1.0
    #P wordpress-trunk
     
    22602260        $url = str_replace(';//', '://', $url); 
    22612261        /* If the URL doesn't appear to contain a scheme, we 
    22622262         * presume it needs http:// appended (unless a relative 
    2263          * link starting with / or a php file). 
     2263         * link starting with /, ?, # or a php file). 
    22642264         */ 
    22652265        if ( strpos($url, ':') === false && 
    2266                 substr( $url, 0, 1 ) != '/' && substr( $url, 0, 1 ) != '#' && !preg_match('/^[a-z0-9-]+?\.php/i', $url) ) 
     2266                $url[0] !== '/' && $url[0] !== '?' && $url[0] !== '#' && !preg_match('/^[a-z0-9-]+?\.php/i', $url) ) 
    22672267                $url = 'http://' . $url; 
    22682268 
    22692269        // Replace ampersands and single quotes only when displaying.