Make WordPress Core

Ticket #2889: functions-formatting.php.diff

File functions-formatting.php.diff, 1.0 KB (added by ptvguy, 19 years ago)

make_clickable without anchor wrapping

  • functions-formatting.php

     
    501501        return $newtext;
    502502}
    503503
    504 function force_balance_tags($text) {
    505         return balanceTags($text, 0, true);
    506 }
    507504
    508505function format_to_edit($content, $richedit = false) {
    509506        $content = apply_filters('format_to_edit', $content);
     
    575572
    576573function make_clickable($ret) {
    577574        $ret = ' ' . $ret . ' ';
    578         $ret = preg_replace("#([\s>])(https?)://([^\s<>{}()]+[^\s.,<>{}()])#i", "$1<a href='$2://$3' rel='nofollow'>$2://$3</a>", $ret);
     575        $ret = preg_replace("#([\s>])(https?)://([^\s<>{}()]+[^\s.,<>{}()])#i", "$1$2://$3", $ret);
    579576        $ret = preg_replace("#(\s)www\.([a-z0-9\-]+)\.([a-z0-9\-.\~]+)((?:/[^ <>{}()\n\r]*[^., <>{}()\n\r]?)?)#i", "$1<a href='http://www.$2.$3$4' rel='nofollow'>www.$2.$3$4</a>", $ret);
    580577        $ret = preg_replace("#(\s)([a-z0-9\-_.]+)@([a-z0-9\-_.]+)\.([^,< \n\r]+)#i", "$1<a href=\"mailto:$2@$3.$4\">$2@$3.$4</a>", $ret);
    581578        $ret = trim($ret);