Make WordPress Core


Ignore:
Timestamp:
09/29/2015 01:00:17 AM (11 years ago)
Author:
johnbillion
Message:

Revert r34674 due to failures on PHP < 5.4.

See #16859

File:
1 edited

Legend:

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

    r34674 r34675  
    20782078    $dest = $matches[2];
    20792079    $dest = 'http://' . $dest;
     2080    $dest = esc_url($dest);
     2081    if ( empty($dest) )
     2082        return $matches[0];
    20802083
    20812084    // removed trailing [.,;:)] from URL
     
    20842087        $dest = substr($dest, 0, strlen($dest)-1);
    20852088    }
    2086 
    2087     $dest = esc_url($dest);
    2088     if ( empty($dest) )
    2089         return $matches[0];
    2090 
    20912089    return $matches[1] . "<a href=\"$dest\" rel=\"nofollow\">$dest</a>$ret";
    20922090}
     
    32813279 * is applied to the returned cleaned URL.
    32823280 *
    3283  * See RFC3986
    3284  *
    32853281 * @since 2.8.0
    32863282 *
     
    32983294
    32993295    $url = str_replace( ' ', '%20', $url );
    3300     $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\[\]\\x80-\\xff]|i', '', $url);
     3296    $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\\x80-\\xff]|i', '', $url);
    33013297
    33023298    if ( '' === $url ) {
     
    33113307    $url = str_replace(';//', '://', $url);
    33123308    /* If the URL doesn't appear to contain a scheme, we
    3313      * presume it needs http:// prepended (unless a relative
     3309     * presume it needs http:// appended (unless a relative
    33143310     * link starting with /, # or ? or a php file).
    33153311     */
     
    33233319        $url = str_replace( '&amp;', '&#038;', $url );
    33243320        $url = str_replace( "'", '&#039;', $url );
    3325     }
    3326 
    3327     if ( ( false !== strpos( $url, '[' ) ) || ( false !== strpos( $url, ']' ) ) ) {
    3328 
    3329         $parsed = parse_url( $url );
    3330         $front  = '';
    3331 
    3332         if ( isset( $parsed['scheme'] ) ) {
    3333             $front .= $parsed['scheme'] . '://';
    3334         } elseif ( '/' === $url[0] ) {
    3335             $front .= '//';
    3336         }
    3337 
    3338         if ( isset( $parsed['user'] ) ) {
    3339             $front .= $parsed['user'];
    3340         }
    3341 
    3342         if ( isset( $parsed['pass'] ) ) {
    3343             $front .= ':' . $parsed['pass'];
    3344         }
    3345 
    3346         if ( isset( $parsed['user'] ) || isset( $parsed['pass'] ) ) {
    3347             $front .= '@';
    3348         }
    3349 
    3350         if ( isset( $parsed['host'] ) ) {
    3351             $front .= $parsed['host'];
    3352         }
    3353 
    3354         if ( isset( $parsed['port'] ) ) {
    3355             $front .= ':' . $parsed['port'];
    3356         }
    3357 
    3358         $end_dirty = str_replace( $front, '', $url );
    3359         $end_clean = str_replace( array( '[', ']' ), array( '%5B', '%5D' ), $end_dirty );
    3360         $url       = str_replace( $end_dirty, $end_clean, $url );
    3361 
    33623321    }
    33633322
Note: See TracChangeset for help on using the changeset viewer.