diff options
author | Evan Prodromou <evan@status.net> | 2009-09-27 21:15:14 -0400 |
---|---|---|
committer | Evan Prodromou <evan@status.net> | 2009-09-27 21:15:14 -0400 |
commit | 3afcdc18f7bfd23ac780b9f27c47582c1b41bb83 (patch) | |
tree | 289e54a747c8b67d5455e85d64045aa7dfb1d54b | |
parent | ee9856c452a7e54994c30cd9138dd6faa2107001 (diff) | |
parent | fc2426d7ce33bba0e1ad4dfc1ed9af7749695b20 (diff) |
Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x
-rw-r--r-- | classes/File.php | 8 | ||||
-rw-r--r-- | classes/File_redirection.php | 3 | ||||
-rw-r--r-- | lib/util.php | 23 | ||||
-rw-r--r-- | scripts/createsim.php | 2 | ||||
-rw-r--r-- | tests/HashTagDetectionTests.php | 1 | ||||
-rw-r--r-- | tests/URLDetectionTest.php | 221 |
6 files changed, 136 insertions, 122 deletions
diff --git a/classes/File.php b/classes/File.php index 9758cf7f5..e04a9d525 100644 --- a/classes/File.php +++ b/classes/File.php @@ -94,7 +94,13 @@ class File extends Memcached_DataObject $file_redir = File_redirection::staticGet('url', $given_url); if (empty($file_redir)) { $redir_data = File_redirection::where($given_url); - $redir_url = $redir_data['url']; + if (is_array($redir_data)) { + $redir_url = $redir_data['url']; + } elseif (is_string($redir_data)) { + $redir_url = $redir_data; + } else { + throw new ServerException("Can't process url '$given_url'"); + } // TODO: max field length if ($redir_url === $given_url || strlen($redir_url) > 255) { $x = File::saveNew($redir_data, $given_url); diff --git a/classes/File_redirection.php b/classes/File_redirection.php index 76b18f672..79052bf7d 100644 --- a/classes/File_redirection.php +++ b/classes/File_redirection.php @@ -79,6 +79,9 @@ class File_redirection extends Memcached_DataObject } } + if(strpos($short_url,'://') === false){ + return $short_url; + } $curlh = File_redirection::_commonCurl($short_url, $redirs); // Don't include body in output curl_setopt($curlh, CURLOPT_NOBODY, true); diff --git a/lib/util.php b/lib/util.php index 56753debe..d249b154f 100644 --- a/lib/util.php +++ b/lib/util.php @@ -522,20 +522,21 @@ function common_linkify($url) { if(strpos($url, '@') !== false && strpos($url, ':') === false) { //url is an email address without the mailto: protocol - return XMLStringer::estring('a', array('href' => "mailto:$url", 'rel' => 'external'), $url); - } + $canon = "mailto:$url"; + $longurl = "mailto:$url"; + }else{ - $canon = File_redirection::_canonUrl($url); + $canon = File_redirection::_canonUrl($url); - $longurl_data = File_redirection::where($url); - if (is_array($longurl_data)) { - $longurl = $longurl_data['url']; - } elseif (is_string($longurl_data)) { - $longurl = $longurl_data; - } else { - throw new ServerException("Can't linkify url '$url'"); + $longurl_data = File_redirection::where($canon); + if (is_array($longurl_data)) { + $longurl = $longurl_data['url']; + } elseif (is_string($longurl_data)) { + $longurl = $longurl_data; + } else { + throw new ServerException("Can't linkify url '$url'"); + } } - $attrs = array('href' => $canon, 'title' => $longurl, 'rel' => 'external'); $is_attachment = false; diff --git a/scripts/createsim.php b/scripts/createsim.php index 71ed3bf72..1266a9700 100644 --- a/scripts/createsim.php +++ b/scripts/createsim.php @@ -101,7 +101,7 @@ function newSub($i) $to = User::staticGet('nickname', $tunic); - if (empty($from)) { + if (empty($to)) { throw new Exception("Can't find user '$tunic'."); } diff --git a/tests/HashTagDetectionTests.php b/tests/HashTagDetectionTests.php index aeac4a5e3..483d7135e 100644 --- a/tests/HashTagDetectionTests.php +++ b/tests/HashTagDetectionTests.php @@ -7,6 +7,7 @@ if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) { define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); define('STATUSNET', true); +define('LACONICA', true); require_once INSTALLDIR . '/lib/common.php'; diff --git a/tests/URLDetectionTest.php b/tests/URLDetectionTest.php index 1c3f7cd96..45203bf6e 100644 --- a/tests/URLDetectionTest.php +++ b/tests/URLDetectionTest.php @@ -7,6 +7,7 @@ if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) { define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); define('STATUSNET', true); +define('LACONICA', true); require_once INSTALLDIR . '/lib/common.php'; @@ -28,69 +29,71 @@ class URLDetectionTest extends PHPUnit_Framework_TestCase array('not a link :: no way', 'not a link :: no way'), array('link http://www.somesite.com/xyz/35637563@N00/52803365/ link', - 'link <a href="http://www.somesite.com/xyz/35637563@N00/52803365/" rel="external">http://www.somesite.com/xyz/35637563@N00/52803365/</a> link'), + 'link <a href="http://www.somesite.com/xyz/35637563@N00/52803365/" title="http://www.somesite.com/xyz/35637563@N00/52803365/" rel="external">http://www.somesite.com/xyz/35637563@N00/52803365/</a> link'), array('http://127.0.0.1', - '<a href="http://127.0.0.1/" rel="external">http://127.0.0.1</a>'), + '<a href="http://127.0.0.1/" title="http://127.0.0.1/" rel="external">http://127.0.0.1</a>'), array('127.0.0.1', - '<a href="http://127.0.0.1/" rel="external">127.0.0.1</a>'), + '<a href="http://127.0.0.1/" title="http://127.0.0.1/" rel="external">127.0.0.1</a>'), array('127.0.0.1:99', - '<a href="http://127.0.0.1:99/" rel="external">127.0.0.1:99</a>'), + '<a href="http://127.0.0.1:99/" title="http://127.0.0.1:99/" rel="external">127.0.0.1:99</a>'), array('127.0.0.1/Name:test.php', - '<a href="http://127.0.0.1/Name:test.php" rel="external">127.0.0.1/Name:test.php</a>'), + '<a href="http://127.0.0.1/Name:test.php" title="http://127.0.0.1/Name:test.php" rel="external">127.0.0.1/Name:test.php</a>'), array('127.0.0.1/~test', - '<a href="http://127.0.0.1/~test" rel="external">127.0.0.1/~test</a>'), + '<a href="http://127.0.0.1/~test" title="http://127.0.0.1/~test" rel="external">127.0.0.1/~test</a>'), array('127.0.0.1/+test', - '<a href="http://127.0.0.1/+test" rel="external">127.0.0.1/+test</a>'), + '<a href="http://127.0.0.1/+test" title="http://127.0.0.1/+test" rel="external">127.0.0.1/+test</a>'), array('127.0.0.1/$test', - '<a href="http://127.0.0.1/$test" rel="external">127.0.0.1/$test</a>'), + '<a href="http://127.0.0.1/$test" title="http://127.0.0.1/$test" rel="external">127.0.0.1/$test</a>'), array('127.0.0.1/\'test', - '<a href="http://127.0.0.1/\'test" rel="external">127.0.0.1/\'test</a>'), + '<a href="http://127.0.0.1/\'test" title="http://127.0.0.1/\'test" rel="external">127.0.0.1/\'test</a>'), array('127.0.0.1/"test', - '<a href="http://127.0.0.1/"test" rel="external">127.0.0.1/"test</a>'), + '<a href="http://127.0.0.1/"test" title="http://127.0.0.1/"test" rel="external">127.0.0.1/"test</a>'), array('127.0.0.1/-test', - '<a href="http://127.0.0.1/-test" rel="external">127.0.0.1/-test</a>'), + '<a href="http://127.0.0.1/-test" title="http://127.0.0.1/-test" rel="external">127.0.0.1/-test</a>'), array('127.0.0.1/_test', - '<a href="http://127.0.0.1/_test" rel="external">127.0.0.1/_test</a>'), + '<a href="http://127.0.0.1/_test" title="http://127.0.0.1/_test" rel="external">127.0.0.1/_test</a>'), array('127.0.0.1/!test', - '<a href="http://127.0.0.1/!test" rel="external">127.0.0.1/!test</a>'), + '<a href="http://127.0.0.1/!test" title="http://127.0.0.1/!test" rel="external">127.0.0.1/!test</a>'), array('127.0.0.1/*test', - '<a href="http://127.0.0.1/*test" rel="external">127.0.0.1/*test</a>'), + '<a href="http://127.0.0.1/*test" title="http://127.0.0.1/*test" rel="external">127.0.0.1/*test</a>'), array('127.0.0.1/test%20stuff', - '<a href="http://127.0.0.1/test%20stuff" rel="external">127.0.0.1/test%20stuff</a>'), + '<a href="http://127.0.0.1/test%20stuff" title="http://127.0.0.1/test%20stuff" rel="external">127.0.0.1/test%20stuff</a>'), array('http://[::1]:99/test.php', - '<a href="http://[::1]:99/test.php" rel="external">http://[::1]:99/test.php</a>'), + '<a href="http://[::1]:99/test.php" title="http://[::1]:99/test.php" rel="external">http://[::1]:99/test.php</a>'), array('http://::1/test.php', - '<a href="http://::1/test.php" rel="external">http://::1/test.php</a>'), + '<a href="http://::1/test.php" title="http://::1/test.php" rel="external">http://::1/test.php</a>'), array('http://::1', - '<a href="http://::1/" rel="external">http://::1</a>'), + '<a href="http://::1/" title="http://::1/" rel="external">http://::1</a>'), array('2001:4978:1b5:0:21d:e0ff:fe66:59ab/test.php', - '<a href="http://2001:4978:1b5:0:21d:e0ff:fe66:59ab/test.php" rel="external">2001:4978:1b5:0:21d:e0ff:fe66:59ab/test.php</a>'), + '<a href="http://2001:4978:1b5:0:21d:e0ff:fe66:59ab/test.php" title="http://2001:4978:1b5:0:21d:e0ff:fe66:59ab/test.php" rel="external">2001:4978:1b5:0:21d:e0ff:fe66:59ab/test.php</a>'), array('[2001:4978:1b5:0:21d:e0ff:fe66:59ab]:99/test.php', - '<a href="http://[2001:4978:1b5:0:21d:e0ff:fe66:59ab]:99/test.php" rel="external">[2001:4978:1b5:0:21d:e0ff:fe66:59ab]:99/test.php</a>'), + '<a href="http://[2001:4978:1b5:0:21d:e0ff:fe66:59ab]:99/test.php" title="http://[2001:4978:1b5:0:21d:e0ff:fe66:59ab]:99/test.php" rel="external">[2001:4978:1b5:0:21d:e0ff:fe66:59ab]:99/test.php</a>'), array('2001:4978:1b5:0:21d:e0ff:fe66:59ab', - '<a href="http://2001:4978:1b5:0:21d:e0ff:fe66:59ab/" rel="external">2001:4978:1b5:0:21d:e0ff:fe66:59ab</a>'), + '<a href="http://2001:4978:1b5:0:21d:e0ff:fe66:59ab/" title="http://2001:4978:1b5:0:21d:e0ff:fe66:59ab/" rel="external">2001:4978:1b5:0:21d:e0ff:fe66:59ab</a>'), array('http://127.0.0.1', - '<a href="http://127.0.0.1/" rel="external">http://127.0.0.1</a>'), + '<a href="http://127.0.0.1/" title="http://127.0.0.1/" rel="external">http://127.0.0.1</a>'), array('example.com', - '<a href="http://example.com/" rel="external">example.com</a>'), + '<a href="http://example.com/" title="http://example.com/" rel="external">example.com</a>'), array('example.com', - '<a href="http://example.com/" rel="external">example.com</a>'), + '<a href="http://example.com/" title="http://example.com/" rel="external">example.com</a>'), array('http://example.com', - '<a href="http://example.com/" rel="external">http://example.com</a>'), + '<a href="http://example.com/" title="http://example.com/" rel="external">http://example.com</a>'), array('http://example.com.', - '<a href="http://example.com/" rel="external">http://example.com</a>.'), + '<a href="http://example.com/" title="http://example.com/" rel="external">http://example.com</a>.'), array('/var/lib/example.so', '/var/lib/example.so'), array('example', 'example'), array('user@example.com', - '<a href="mailto:user@example.com" rel="external">user@example.com</a>'), + '<a href="mailto:user@example.com" title="mailto:user@example.com" rel="external">user@example.com</a>'), array('user_name+other@example.com', - '<a href="mailto:user_name+other@example.com" rel="external">user_name+other@example.com</a>'), + '<a href="mailto:user_name+other@example.com" title="mailto:user_name+other@example.com" rel="external">user_name+other@example.com</a>'), array('mailto:user@example.com', - '<a href="mailto:user@example.com" rel="external">mailto:user@example.com</a>'), + '<a href="mailto:user@example.com" title="mailto:user@example.com" rel="external">mailto:user@example.com</a>'), array('mailto:user@example.com?subject=test', - '<a href="mailto:user@example.com?subject=test" rel="external">mailto:user@example.com?subject=test</a>'), + '<a href="mailto:user@example.com?subject=test" title="mailto:user@example.com?subject=test" rel="external">mailto:user@example.com?subject=test</a>'), + array('xmpp:user@example.com', + '<a href="xmpp:user@example.com" title="xmpp:user@example.com" rel="external">xmpp:user@example.com</a>'), array('#example', '#<span class="tag"><a href="' . common_local_url('tag', array('tag' => common_canonical_tag('example'))) . '" rel="tag">example</a></span>'), array('#example.com', @@ -98,165 +101,165 @@ class URLDetectionTest extends PHPUnit_Framework_TestCase array('#.net', '#<span class="tag"><a href="' . common_local_url('tag', array('tag' => common_canonical_tag('.net'))) . '" rel="tag">.net</a></span>'), array('http://example', - '<a href="http://example/" rel="external">http://example</a>'), + '<a href="http://example/" title="http://example/" rel="external">http://example</a>'), array('http://3xampl3', - '<a href="http://3xampl3/" rel="external">http://3xampl3</a>'), + '<a href="http://3xampl3/" title="http://3xampl3/" rel="external">http://3xampl3</a>'), array('http://example/', - '<a href="http://example/" rel="external">http://example/</a>'), + '<a href="http://example/" title="http://example/" rel="external">http://example/</a>'), array('http://example/path', - '<a href="http://example/path" rel="external">http://example/path</a>'), + '<a href="http://example/path" title="http://example/path" rel="external">http://example/path</a>'), array('http://example.com', - '<a href="http://example.com/" rel="external">http://example.com</a>'), + '<a href="http://example.com/" title="http://example.com/" rel="external">http://example.com</a>'), array('https://example.com', - '<a href="https://example.com/" rel="external">https://example.com</a>'), + '<a href="https://example.com/" title="https://example.com/" rel="external">https://example.com</a>'), array('ftp://example.com', - '<a href="ftp://example.com/" rel="external">ftp://example.com</a>'), + '<a href="ftp://example.com/" title="ftp://example.com/" rel="external">ftp://example.com</a>'), array('ftps://example.com', - '<a href="ftps://example.com/" rel="external">ftps://example.com</a>'), + '<a href="ftps://example.com/" title="ftps://example.com/" rel="external">ftps://example.com</a>'), array('http://user@example.com', - '<a href="http://user@example.com/" rel="external">http://user@example.com</a>'), + '<a href="http://user@example.com/" title="http://user@example.com/" rel="external">http://user@example.com</a>'), array('http://user:pass@example.com', - '<a href="http://user:pass@example.com/" rel="external">http://user:pass@example.com</a>'), + '<a href="http://user:pass@example.com/" title="http://user:pass@example.com/" rel="external">http://user:pass@example.com</a>'), array('http://example.com:8080', - '<a href="http://example.com:8080/" rel="external">http://example.com:8080</a>'), + '<a href="http://example.com:8080/" title="http://example.com:8080/" rel="external">http://example.com:8080</a>'), array('http://example.com:8080/test.php', - '<a href="http://example.com:8080/test.php" rel="external">http://example.com:8080/test.php</a>'), + '<a href="http://example.com:8080/test.php" title="http://example.com:8080/test.php" rel="external">http://example.com:8080/test.php</a>'), array('example.com:8080/test.php', - '<a href="http://example.com:8080/test.php" rel="external">example.com:8080/test.php</a>'), + '<a href="http://example.com:8080/test.php" title="http://example.com:8080/test.php" rel="external">example.com:8080/test.php</a>'), array('http://www.example.com', - '<a href="http://www.example.com/" rel="external">http://www.example.com</a>'), + '<a href="http://www.example.com/" title="http://www.example.com/" rel="external">http://www.example.com</a>'), array('http://example.com/', - '<a href="http://example.com/" rel="external">http://example.com/</a>'), + '<a href="http://example.com/" title="http://example.com/" rel="external">http://example.com/</a>'), array('http://example.com/path', - '<a href="http://example.com/path" rel="external">http://example.com/path</a>'), + '<a href="http://example.com/path" title="http://example.com/path" rel="external">http://example.com/path</a>'), array('http://example.com/path.html', - '<a href="http://example.com/path.html" rel="external">http://example.com/path.html</a>'), + '<a href="http://example.com/path.html" title="http://example.com/path.html" rel="external">http://example.com/path.html</a>'), array('http://example.com/path.html#fragment', - '<a href="http://example.com/path.html#fragment" rel="external">http://example.com/path.html#fragment</a>'), + '<a href="http://example.com/path.html#fragment" title="http://example.com/path.html#fragment" rel="external">http://example.com/path.html#fragment</a>'), array('http://example.com/path.php?foo=bar&bar=foo', - '<a href="http://example.com/path.php?foo=bar&bar=foo" rel="external">http://example.com/path.php?foo=bar&bar=foo</a>'), + '<a href="http://example.com/path.php?foo=bar&bar=foo" title="http://example.com/path.php?foo=bar&bar=foo" rel="external">http://example.com/path.php?foo=bar&bar=foo</a>'), array('http://example.com.', - '<a href="http://example.com/" rel="external">http://example.com</a>.'), + '<a href="http://example.com/" title="http://example.com/" rel="external">http://example.com</a>.'), array('http://müllärör.de', - '<a href="http://müllärör.de/" rel="external">http://müllärör.de</a>'), + '<a href="http://müllärör.de/" title="http://müllärör.de/" rel="external">http://müllärör.de</a>'), array('http://ﺱﺲﺷ.com', - '<a href="http://ﺱﺲﺷ.com/" rel="external">http://ﺱﺲﺷ.com</a>'), + '<a href="http://ﺱﺲﺷ.com/" title="http://ﺱﺲﺷ.com/" rel="external">http://ﺱﺲﺷ.com</a>'), array('http://сделаткартинки.com', - '<a href="http://сделаткартинки.com/" rel="external">http://сделаткартинки.com</a>'), + '<a href="http://сделаткартинки.com/" title="http://сделаткартинки.com/" rel="external">http://сделаткартинки.com</a>'), array('http://tūdaliņ.lv', - '<a href="http://tūdaliņ.lv/" rel="external">http://tūdaliņ.lv</a>'), + '<a href="http://tūdaliņ.lv/" title="http://tūdaliņ.lv/" rel="external">http://tūdaliņ.lv</a>'), array('http://brændendekærlighed.com', - '<a href="http://brændendekærlighed.com/" rel="external">http://brændendekærlighed.com</a>'), + '<a href="http://brændendekærlighed.com/" title="http://brændendekærlighed.com/" rel="external">http://brændendekærlighed.com</a>'), array('http://あーるいん.com', - '<a href="http://あーるいん.com/" rel="external">http://あーるいん.com</a>'), + '<a href="http://あーるいん.com/" title="http://あーるいん.com/" rel="external">http://あーるいん.com</a>'), array('http://예비교사.com', - '<a href="http://예비교사.com/" rel="external">http://예비교사.com</a>'), + '<a href="http://예비교사.com/" title="http://예비교사.com/" rel="external">http://예비교사.com</a>'), array('http://example.com.', - '<a href="http://example.com/" rel="external">http://example.com</a>.'), + '<a href="http://example.com/" title="http://example.com/" rel="external">http://example.com</a>.'), array('http://example.com?', - '<a href="http://example.com/" rel="external">http://example.com</a>?'), + '<a href="http://example.com/" title="http://example.com/" rel="external">http://example.com</a>?'), array('http://example.com!', - '<a href="http://example.com/" rel="external">http://example.com</a>!'), + '<a href="http://example.com/" title="http://example.com/" rel="external">http://example.com</a>!'), array('http://example.com,', - '<a href="http://example.com/" rel="external">http://example.com</a>,'), + '<a href="http://example.com/" title="http://example.com/" rel="external">http://example.com</a>,'), array('http://example.com;', - '<a href="http://example.com/" rel="external">http://example.com</a>;'), + '<a href="http://example.com/" title="http://example.com/" rel="external">http://example.com</a>;'), array('http://example.com:', - '<a href="http://example.com/" rel="external">http://example.com</a>:'), + '<a href="http://example.com/" title="http://example.com/" rel="external">http://example.com</a>:'), array('\'http://example.com\'', - '\'<a href="http://example.com/" rel="external">http://example.com</a>\''), + '\'<a href="http://example.com/" title="http://example.com/" rel="external">http://example.com</a>\''), array('"http://example.com"', - '"<a href="http://example.com/" rel="external">http://example.com</a>"'), + '"<a href="http://example.com/" title="http://example.com/" rel="external">http://example.com</a>"'), array('http://example.com', - '<a href="http://example.com/" rel="external">http://example.com</a>'), + '<a href="http://example.com/" title="http://example.com/" rel="external">http://example.com</a>'), array('(http://example.com)', - '(<a href="http://example.com/" rel="external">http://example.com</a>)'), + '(<a href="http://example.com/" title="http://example.com/" rel="external">http://example.com</a>)'), array('[http://example.com]', - '[<a href="http://example.com/" rel="external">http://example.com</a>]'), + '[<a href="http://example.com/" title="http://example.com/" rel="external">http://example.com</a>]'), array('<http://example.com>', - '<<a href="http://example.com/" rel="external">http://example.com</a>>'), + '<<a href="http://example.com/" title="http://example.com/" rel="external">http://example.com</a>>'), array('http://example.com/path/(foo)/bar', - '<a href="http://example.com/path/(foo)/bar" rel="external">http://example.com/path/(foo)/bar</a>'), + '<a href="http://example.com/path/(foo)/bar" title="http://example.com/path/(foo)/bar" rel="external">http://example.com/path/(foo)/bar</a>'), array('http://example.com/path/[foo]/bar', - '<a href="http://example.com/path/[foo]/bar" rel="external">http://example.com/path/[foo]/bar</a>'), + '<a href="http://example.com/path/[foo]/bar" title="http://example.com/path/[foo]/bar" rel="external">http://example.com/path/[foo]/bar</a>'), array('http://example.com/path/foo/(bar)', - '<a href="http://example.com/path/foo/(bar)" rel="external">http://example.com/path/foo/(bar)</a>'), + '<a href="http://example.com/path/foo/(bar)" title="http://example.com/path/foo/(bar)" rel="external">http://example.com/path/foo/(bar)</a>'), //Not a valid url - urls cannot contain unencoded square brackets array('http://example.com/path/foo/[bar]', - '<a href="http://example.com/path/foo/[bar]" rel="external">http://example.com/path/foo/[bar]</a>'), + '<a href="http://example.com/path/foo/[bar]" title="http://example.com/path/foo/[bar]" rel="external">http://example.com/path/foo/[bar]</a>'), array('Hey, check out my cool site http://example.com okay?', - 'Hey, check out my cool site <a href="http://example.com/" rel="external">http://example.com</a> okay?'), + 'Hey, check out my cool site <a href="http://example.com/" title="http://example.com/" rel="external">http://example.com</a> okay?'), array('What about parens (e.g. http://example.com/path/foo/(bar))?', - 'What about parens (e.g. <a href="http://example.com/path/foo/(bar)" rel="external">http://example.com/path/foo/(bar)</a>)?'), + 'What about parens (e.g. <a href="http://example.com/path/foo/(bar)" title="http://example.com/path/foo/(bar)" rel="external">http://example.com/path/foo/(bar)</a>)?'), array('What about parens (e.g. http://example.com/path/foo/(bar)?', - 'What about parens (e.g. <a href="http://example.com/path/foo/(bar)" rel="external">http://example.com/path/foo/(bar)</a>?'), + 'What about parens (e.g. <a href="http://example.com/path/foo/(bar)" title="http://example.com/path/foo/(bar)" rel="external">http://example.com/path/foo/(bar)</a>?'), array('What about parens (e.g. http://example.com/path/foo/(bar).)?', - 'What about parens (e.g. <a href="http://example.com/path/foo/(bar)" rel="external">http://example.com/path/foo/(bar)</a>.)?'), + 'What about parens (e.g. <a href="http://example.com/path/foo/(bar)" title="http://example.com/path/foo/(bar)" rel="external">http://example.com/path/foo/(bar)</a>.)?'), //Not a valid url - urls cannot contain unencoded commas array('What about parens (e.g. http://example.com/path/(foo,bar)?', - 'What about parens (e.g. <a href="http://example.com/path/(foo,bar)" rel="external">http://example.com/path/(foo,bar)</a>?'), + 'What about parens (e.g. <a href="http://example.com/path/(foo,bar)" title="http://example.com/path/(foo,bar)" rel="external">http://example.com/path/(foo,bar)</a>?'), array('Unbalanced too (e.g. http://example.com/path/((((foo)/bar)?', - 'Unbalanced too (e.g. <a href="http://example.com/path/((((foo)/bar)" rel="external">http://example.com/path/((((foo)/bar)</a>?'), + 'Unbalanced too (e.g. <a href="http://example.com/path/((((foo)/bar)" title="http://example.com/path/((((foo)/bar)" rel="external">http://example.com/path/((((foo)/bar)</a>?'), array('Unbalanced too (e.g. http://example.com/path/(foo))))/bar)?', - 'Unbalanced too (e.g. <a href="http://example.com/path/(foo))))/bar" rel="external">http://example.com/path/(foo))))/bar</a>)?'), + 'Unbalanced too (e.g. <a href="http://example.com/path/(foo))))/bar" title="http://example.com/path/(foo))))/bar" rel="external">http://example.com/path/(foo))))/bar</a>)?'), array('Unbalanced too (e.g. http://example.com/path/foo/((((bar)?', - 'Unbalanced too (e.g. <a href="http://example.com/path/foo/((((bar)" rel="external">http://example.com/path/foo/((((bar)</a>?'), + 'Unbalanced too (e.g. <a href="http://example.com/path/foo/((((bar)" title="http://example.com/path/foo/((((bar)" rel="external">http://example.com/path/foo/((((bar)</a>?'), array('Unbalanced too (e.g. http://example.com/path/foo/(bar))))?', - 'Unbalanced too (e.g. <a href="http://example.com/path/foo/(bar)" rel="external">http://example.com/path/foo/(bar)</a>)))?'), + 'Unbalanced too (e.g. <a href="http://example.com/path/foo/(bar)" title="http://example.com/path/foo/(bar)" rel="external">http://example.com/path/foo/(bar)</a>)))?'), array('example.com', - '<a href="http://example.com/" rel="external">example.com</a>'), + '<a href="http://example.com/" title="http://example.com/" rel="external">example.com</a>'), array('example.org', - '<a href="http://example.org/" rel="external">example.org</a>'), + '<a href="http://example.org/" title="http://example.org/" rel="external">example.org</a>'), array('example.co.uk', - '<a href="http://example.co.uk/" rel="external">example.co.uk</a>'), + '<a href="http://example.co.uk/" title="http://example.co.uk/" rel="external">example.co.uk</a>'), array('www.example.co.uk', - '<a href="http://www.example.co.uk/" rel="external">www.example.co.uk</a>'), + '<a href="http://www.example.co.uk/" title="http://www.example.co.uk/" rel="external">www.example.co.uk</a>'), array('farm1.images.example.co.uk', - '<a href="http://farm1.images.example.co.uk/" rel="external">farm1.images.example.co.uk</a>'), + '<a href="http://farm1.images.example.co.uk/" title="http://farm1.images.example.co.uk/" rel="external">farm1.images.example.co.uk</a>'), array('example.museum', - '<a href="http://example.museum/" rel="external">example.museum</a>'), + '<a href="http://example.museum/" title="http://example.museum/" rel="external">example.museum</a>'), array('example.travel', - '<a href="http://example.travel/" rel="external">example.travel</a>'), + '<a href="http://example.travel/" title="http://example.travel/" rel="external">example.travel</a>'), array('example.com.', - '<a href="http://example.com/" rel="external">example.com</a>.'), + '<a href="http://example.com/" title="http://example.com/" rel="external">example.com</a>.'), array('example.com?', - '<a href="http://example.com/" rel="external">example.com</a>?'), + '<a href="http://example.com/" title="http://example.com/" rel="external">example.com</a>?'), array('example.com!', - '<a href="http://example.com/" rel="external">example.com</a>!'), + '<a href="http://example.com/" title="http://example.com/" rel="external">example.com</a>!'), array('example.com,', - '<a href="http://example.com/" rel="external">example.com</a>,'), + '<a href="http://example.com/" title="http://example.com/" rel="external">example.com</a>,'), array('example.com;', - '<a href="http://example.com/" rel="external">example.com</a>;'), + '<a href="http://example.com/" title="http://example.com/" rel="external">example.com</a>;'), array('example.com:', - '<a href="http://example.com/" rel="external">example.com</a>:'), + '<a href="http://example.com/" title="http://example.com/" rel="external">example.com</a>:'), array('\'example.com\'', - '\'<a href="http://example.com/" rel="external">example.com</a>\''), + '\'<a href="http://example.com/" title="http://example.com/" rel="external">example.com</a>\''), array('"example.com"', - '"<a href="http://example.com/" rel="external">example.com</a>"'), + '"<a href="http://example.com/" title="http://example.com/" rel="external">example.com</a>"'), array('example.com', - '<a href="http://example.com/" rel="external">example.com</a>'), + '<a href="http://example.com/" title="http://example.com/" rel="external">example.com</a>'), array('(example.com)', - '(<a href="http://example.com/" rel="external">example.com</a>)'), + '(<a href="http://example.com/" title="http://example.com/" rel="external">example.com</a>)'), array('[example.com]', - '[<a href="http://example.com/" rel="external">example.com</a>]'), + '[<a href="http://example.com/" title="http://example.com/" rel="external">example.com</a>]'), array('<example.com>', - '<<a href="http://example.com/" rel="external">example.com</a>>'), + '<<a href="http://example.com/" title="http://example.com/" rel="external">example.com</a>>'), array('Hey, check out my cool site example.com okay?', - 'Hey, check out my cool site <a href="http://example.com/" rel="external">example.com</a> okay?'), + 'Hey, check out my cool site <a href="http://example.com/" title="http://example.com/" rel="external">example.com</a> okay?'), array('Hey, check out my cool site example.com.I made it.', - 'Hey, check out my cool site <a href="http://example.com/" rel="external">example.com</a>.I made it.'), + 'Hey, check out my cool site <a href="http://example.com/" title="http://example.com/" rel="external">example.com</a>.I made it.'), array('Hey, check out my cool site example.com.Funny thing...', - 'Hey, check out my cool site <a href="http://example.com/" rel="external">example.com</a>.Funny thing...'), + 'Hey, check out my cool site <a href="http://example.com/" title="http://example.com/" rel="external">example.com</a>.Funny thing...'), array('Hey, check out my cool site example.com.You will love it.', - 'Hey, check out my cool site <a href="http://example.com/" rel="external">example.com</a>.You will love it.'), + 'Hey, check out my cool site <a href="http://example.com/" title="http://example.com/" rel="external">example.com</a>.You will love it.'), array('What about parens (e.g. example.com/path/foo/(bar))?', - 'What about parens (e.g. <a href="http://example.com/path/foo/(bar)" rel="external">example.com/path/foo/(bar)</a>)?'), + 'What about parens (e.g. <a href="http://example.com/path/foo/(bar)" title="http://example.com/path/foo/(bar)" rel="external">example.com/path/foo/(bar)</a>)?'), array('What about parens (e.g. example.com/path/foo/(bar)?', - 'What about parens (e.g. <a href="http://example.com/path/foo/(bar)" rel="external">example.com/path/foo/(bar)</a>?'), + 'What about parens (e.g. <a href="http://example.com/path/foo/(bar)" title="http://example.com/path/foo/(bar)" rel="external">example.com/path/foo/(bar)</a>?'), array('What about parens (e.g. example.com/path/foo/(bar).)?', - 'What about parens (e.g. <a href="http://example.com/path/foo/(bar)" rel="external">example.com/path/foo/(bar)</a>.)?'), + 'What about parens (e.g. <a href="http://example.com/path/foo/(bar)" title="http://example.com/path/foo/(bar)" rel="external">example.com/path/foo/(bar)</a>.)?'), array('What about parens (e.g. example.com/path/(foo,bar)?', - 'What about parens (e.g. <a href="http://example.com/path/(foo,bar)" rel="external">example.com/path/(foo,bar)</a>?'), + 'What about parens (e.g. <a href="http://example.com/path/(foo,bar)" title="http://example.com/path/(foo,bar)" rel="external">example.com/path/(foo,bar)</a>?'), array('file.ext', 'file.ext'), array('file.html', |