Make WordPress Core

Changeset 12088


Ignore:
Timestamp:
10/22/2009 06:46:27 PM (14 years ago)
Author:
westi
Message:

Ensure that trailing ) in urls are included in the link when it looks appropriate. Fixes #10990 props filosofo.

File:
1 edited

Legend:

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

    r12084 r12088  
    12331233    $url = $matches[2];
    12341234
    1235     $after = '';
    1236     if ( preg_match( '|(.+?)([).,;:]*)$|', $url, $split ) ) {
    1237         $url = $split[1];
    1238         $after = $split[2];
    1239     }
    1240 
    12411235    $url = esc_url($url);
    12421236    if ( empty($url) )
    12431237        return $matches[0];
    12441238
    1245     return $matches[1] . "<a href=\"$url\" rel=\"nofollow\">$url</a>$after";
     1239    return $matches[1] . "<a href=\"$url\" rel=\"nofollow\">$url</a>";
    12461240}
    12471241
     
    13051299    $ret = ' ' . $ret;
    13061300    // in testing, using arrays here was found to be faster
    1307     $ret = preg_replace_callback('#(?<=[\s>])(\()?([\w]+?://(?:[\w\\x80-\\xff\#$%&~/\-=?@\[\](+]|[.,;:](?![\s<])|(?(1)\)(?![\s<])|\)))+)#is', '_make_url_clickable_cb', $ret);
     1301    $ret = preg_replace_callback('#(?<=[\s>])(\()?([\w]+?://(?:[\w\\x80-\\xff\#$%&~/=?@\[\](+-]|[.,;:](?![\s<]|(\))?([\s]|$))|(?(1)\)(?![\s<]|$)|\)))+)#is', '_make_url_clickable_cb', $ret);
    13081302    $ret = preg_replace_callback('#([\s>])((www|ftp)\.[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]+)#is', '_make_web_ftp_clickable_cb', $ret);
    13091303    $ret = preg_replace_callback('#([\s>])([.0-9a-z_+-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})#i', '_make_email_clickable_cb', $ret);
Note: See TracChangeset for help on using the changeset viewer.