forked from GNUsocial/gnu-social
Merge commit 'mainline/0.8.x' into 0.8.x
This commit is contained in:
commit
9ec3911020
@ -182,7 +182,7 @@ class File_redirection extends Memcached_DataObject
|
||||
}
|
||||
}
|
||||
|
||||
if (('ftp' == $p['scheme']) || ('http' == $p['scheme']) || ('https' == $p['scheme'])) {
|
||||
if (('ftp' == $p['scheme']) || ('ftps' == $p['scheme']) || ('http' == $p['scheme']) || ('https' == $p['scheme'])) {
|
||||
if (empty($p['host'])) return false;
|
||||
if (empty($p['path'])) {
|
||||
$out_url .= '/';
|
||||
|
@ -28,155 +28,155 @@ class URLDetectionTest extends PHPUnit_Framework_TestCase
|
||||
array('example',
|
||||
'example'),
|
||||
array('http://example',
|
||||
'http://example'),
|
||||
'<a href="http://example/" rel="external">http://example</a>'),
|
||||
array('http://example/',
|
||||
'http://example/'),
|
||||
'<a href="http://example/" rel="external">http://example/</a>'),
|
||||
array('http://example/path',
|
||||
'http://example/path'),
|
||||
'<a href="http://example/path" rel="external">http://example/path</a>'),
|
||||
array('http://example.com',
|
||||
'<a href="http://example.com" class="extlink">http://example.com</a>'),
|
||||
'<a href="http://example.com/" rel="external">http://example.com</a>'),
|
||||
array('https://example.com',
|
||||
'<a href="https://example.com" class="extlink">https://example.com</a>'),
|
||||
'<a href="https://example.com/" rel="external">https://example.com</a>'),
|
||||
array('ftp://example.com',
|
||||
'<a href="ftp://example.com" class="extlink">ftp://example.com</a>'),
|
||||
'<a href="ftp://example.com/" rel="external">ftp://example.com</a>'),
|
||||
array('ftps://example.com',
|
||||
'<a href="ftps://example.com" class="extlink">ftps://example.com</a>'),
|
||||
'<a href="ftps://example.com/" rel="external">ftps://example.com</a>'),
|
||||
array('http://user@example.com',
|
||||
'<a href="http://user@example.com" class="extlink">http://user@example.com</a>'),
|
||||
'<a href="http://user@example.com/" rel="external">http://user@example.com</a>'),
|
||||
array('http://user:pass@example.com',
|
||||
'<a href="http://user:pass@example.com" class="extlink">http://user:pass@example.com</a>'),
|
||||
'<a href="http://user:pass@example.com/" rel="external">http://user:pass@example.com</a>'),
|
||||
array('http://example.com:8080',
|
||||
'<a href="http://example.com:8080" class="extlink">http://example.com:8080</a>'),
|
||||
'<a href="http://example.com:8080/" rel="external">http://example.com:8080</a>'),
|
||||
array('http://www.example.com',
|
||||
'<a href="http://www.example.com" class="extlink">http://www.example.com</a>'),
|
||||
'<a href="http://www.example.com/" rel="external">http://www.example.com</a>'),
|
||||
array('http://example.com/',
|
||||
'<a href="http://example.com/" class="extlink">http://example.com/</a>'),
|
||||
'<a href="http://example.com/" rel="external">http://example.com/</a>'),
|
||||
array('http://example.com/path',
|
||||
'<a href="http://example.com/path" class="extlink">http://example.com/path</a>'),
|
||||
'<a href="http://example.com/path" rel="external">http://example.com/path</a>'),
|
||||
array('http://example.com/path.html',
|
||||
'<a href="http://example.com/path.html" class="extlink">http://example.com/path.html</a>'),
|
||||
'<a href="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" class="extlink">http://example.com/path.html#fragment</a>'),
|
||||
'<a href="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" class="extlink">http://example.com/path.php?foo=bar&bar=foo</a>'),
|
||||
'<a href="http://example.com/path.php?foo=bar&bar=foo" rel="external">http://example.com/path.php?foo=bar&bar=foo</a>'),
|
||||
array('http://müllärör.de',
|
||||
'<a href="http://müllärör.de" class="extlink">http://müllärör.de</a>'),
|
||||
'<a href="http://müllärör.de" rel="external">http://müllärör.de</a>'),
|
||||
array('http://ﺱﺲﺷ.com',
|
||||
'<a href="http://ﺱﺲﺷ.com" class="extlink">http://ﺱﺲﺷ.com</a>'),
|
||||
'<a href="http://ﺱﺲﺷ.com" rel="external">http://ﺱﺲﺷ.com</a>'),
|
||||
array('http://сделаткартинки.com',
|
||||
'<a href="http://сделаткартинки.com" class="extlink">http://сделаткартинки.com</a>'),
|
||||
'<a href="http://сделаткартинки.com" rel="external">http://сделаткартинки.com</a>'),
|
||||
array('http://tūdaliņ.lv',
|
||||
'<a href="http://tūdaliņ.lv" class="extlink">http://tūdaliņ.lv</a>'),
|
||||
'<a href="http://tūdaliņ.lv" rel="external">http://tūdaliņ.lv</a>'),
|
||||
array('http://brændendekærlighed.com',
|
||||
'<a href="http://brændendekærlighed.com" class="extlink">http://brændendekærlighed.com</a>'),
|
||||
'<a href="http://brændendekærlighed.com" rel="external">http://brændendekærlighed.com</a>'),
|
||||
array('http://あーるいん.com',
|
||||
'<a href="http://あーるいん.com" class="extlink">http://あーるいん.com</a>'),
|
||||
'<a href="http://あーるいん.com" rel="external">http://あーるいん.com</a>'),
|
||||
array('http://예비교사.com',
|
||||
'<a href="http://예비교사.com" class="extlink">http://예비교사.com</a>'),
|
||||
'<a href="http://예비교사.com" rel="external">http://예비교사.com</a>'),
|
||||
array('http://example.com.',
|
||||
'<a href="http://example.com" class="extlink">http://example.com</a>.'),
|
||||
'<a href="http://example.com" rel="external">http://example.com</a>.'),
|
||||
array('http://example.com?',
|
||||
'<a href="http://example.com" class="extlink">http://example.com</a>?'),
|
||||
'<a href="http://example.com" rel="external">http://example.com</a>?'),
|
||||
array('http://example.com!',
|
||||
'<a href="http://example.com" class="extlink">http://example.com</a>!'),
|
||||
'<a href="http://example.com" rel="external">http://example.com</a>!'),
|
||||
array('http://example.com,',
|
||||
'<a href="http://example.com" class="extlink">http://example.com</a>,'),
|
||||
'<a href="http://example.com" rel="external">http://example.com</a>,'),
|
||||
array('http://example.com;',
|
||||
'<a href="http://example.com" class="extlink">http://example.com</a>;'),
|
||||
'<a href="http://example.com" rel="external">http://example.com</a>;'),
|
||||
array('http://example.com:',
|
||||
'<a href="http://example.com" class="extlink">http://example.com</a>:'),
|
||||
'<a href="http://example.com" rel="external">http://example.com</a>:'),
|
||||
array('\'http://example.com\'',
|
||||
'\'<a href="http://example.com" class="extlink">http://example.com</a>\''),
|
||||
'\'<a href="http://example.com" rel="external">http://example.com</a>\''),
|
||||
array('"http://example.com"',
|
||||
'"<a href="http://example.com" class="extlink">http://example.com</a>"'),
|
||||
'"<a href="http://example.com" rel="external">http://example.com</a>"'),
|
||||
array('http://example.com
',
|
||||
'<a href="http://example.com" class="extlink">http://example.com</a>'),
|
||||
'<a href="http://example.com" rel="external">http://example.com</a>'),
|
||||
array('(http://example.com)',
|
||||
'(<a href="http://example.com" class="extlink">http://example.com</a>)'),
|
||||
'(<a href="http://example.com" rel="external">http://example.com</a>)'),
|
||||
array('[http://example.com]',
|
||||
'[<a href="http://example.com" class="extlink">http://example.com</a>]'),
|
||||
'[<a href="http://example.com" rel="external">http://example.com</a>]'),
|
||||
array('<http://example.com>',
|
||||
'<<a href="http://example.com" class="extlink">http://example.com</a>>'),
|
||||
'<<a href="http://example.com" rel="external">http://example.com</a>>'),
|
||||
array('http://example.com/path/(foo)/bar',
|
||||
'<a href="http://example.com/path/(foo)/bar" class="extlink">http://example.com/path/(foo)/bar</a>'),
|
||||
'<a href="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" class="extlink">http://example.com/path/[foo]/bar</a>'),
|
||||
'<a href="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)" class="extlink">http://example.com/path/foo/(bar)</a>'),
|
||||
'<a href="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]" class="extlink">http://example.com/path/foo/[bar]</a>'),
|
||||
'<a href="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" class="extlink">http://example.com</a> okay?'),
|
||||
'Hey, check out my cool site <a href="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)" class="extlink">http://example.com/path/foo/(bar)</a>)?'),
|
||||
'What about parens (e.g. <a href="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)" class="extlink">http://example.com/path/foo/(bar)</a>?'),
|
||||
'What about parens (e.g. <a href="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)" class="extlink">http://example.com/path/foo/(bar)</a>.)?'),
|
||||
'What about parens (e.g. <a href="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)" class="extlink">http://example.com/path/(foo,bar)</a>?'),
|
||||
'What about parens (e.g. <a href="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)" class="extlink">http://example.com/path/((((foo)/bar)</a>?'),
|
||||
'Unbalanced too (e.g. <a href="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" class="extlink">http://example.com/path/(foo))))/bar</a>)?'),
|
||||
'Unbalanced too (e.g. <a href="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)" class="extlink">http://example.com/path/foo/((((bar)</a>?'),
|
||||
'Unbalanced too (e.g. <a href="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)" class="extlink">http://example.com/path/foo/(bar)</a>)))?'),
|
||||
'Unbalanced too (e.g. <a href="http://example.com/path/foo/(bar)" rel="external">http://example.com/path/foo/(bar)</a>)))?'),
|
||||
array('example.com',
|
||||
'<a href="http://example.com" class="extlink">example.com</a>'),
|
||||
'<a href="http://example.com" rel="external">example.com</a>'),
|
||||
array('example.org',
|
||||
'<a href="http://example.org" class="extlink">example.org</a>'),
|
||||
'<a href="http://example.org" rel="external">example.org</a>'),
|
||||
array('example.co.uk',
|
||||
'<a href="http://example.co.uk" class="extlink">example.co.uk</a>'),
|
||||
'<a href="http://example.co.uk" rel="external">example.co.uk</a>'),
|
||||
array('www.example.co.uk',
|
||||
'<a href="http://www.example.co.uk" class="extlink">www.example.co.uk</a>'),
|
||||
'<a href="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" class="extlink">farm1.images.example.co.uk</a>'),
|
||||
'<a href="http://farm1.images.example.co.uk" rel="external">farm1.images.example.co.uk</a>'),
|
||||
array('example.museum',
|
||||
'<a href="http://example.museum" class="extlink">example.museum</a>'),
|
||||
'<a href="http://example.museum" rel="external">example.museum</a>'),
|
||||
array('example.travel',
|
||||
'<a href="http://example.travel" class="extlink">example.travel</a>'),
|
||||
'<a href="http://example.travel" rel="external">example.travel</a>'),
|
||||
array('example.com.',
|
||||
'<a href="http://example.com" class="extlink">example.com</a>.'),
|
||||
'<a href="http://example.com" rel="external">example.com</a>.'),
|
||||
array('example.com?',
|
||||
'<a href="http://example.com" class="extlink">example.com</a>?'),
|
||||
'<a href="http://example.com" rel="external">example.com</a>?'),
|
||||
array('example.com!',
|
||||
'<a href="http://example.com" class="extlink">example.com</a>!'),
|
||||
'<a href="http://example.com" rel="external">example.com</a>!'),
|
||||
array('example.com,',
|
||||
'<a href="http://example.com" class="extlink">example.com</a>,'),
|
||||
'<a href="http://example.com" rel="external">example.com</a>,'),
|
||||
array('example.com;',
|
||||
'<a href="http://example.com" class="extlink">example.com</a>;'),
|
||||
'<a href="http://example.com" rel="external">example.com</a>;'),
|
||||
array('example.com:',
|
||||
'<a href="http://example.com" class="extlink">example.com</a>:'),
|
||||
'<a href="http://example.com" rel="external">example.com</a>:'),
|
||||
array('\'example.com\'',
|
||||
'\'<a href="http://example.com" class="extlink">example.com</a>\''),
|
||||
'\'<a href="http://example.com" rel="external">example.com</a>\''),
|
||||
array('"example.com"',
|
||||
'"<a href="http://example.com" class="extlink">example.com</a>"'),
|
||||
'"<a href="http://example.com" rel="external">example.com</a>"'),
|
||||
array('example.com
',
|
||||
'<a href="http://example.com" class="extlink">example.com</a>'),
|
||||
'<a href="http://example.com" rel="external">example.com</a>'),
|
||||
array('(example.com)',
|
||||
'(<a href="http://example.com" class="extlink">example.com</a>)'),
|
||||
'(<a href="http://example.com" rel="external">example.com</a>)'),
|
||||
array('[example.com]',
|
||||
'[<a href="http://example.com" class="extlink">example.com</a>]'),
|
||||
'[<a href="http://example.com" rel="external">example.com</a>]'),
|
||||
array('<example.com>',
|
||||
'<<a href="http://example.com" class="extlink">example.com</a>>'),
|
||||
'<<a href="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" class="extlink">example.com</a> okay?'),
|
||||
'Hey, check out my cool site <a href="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" class="extlink">example.com</a>.I made it.'),
|
||||
'Hey, check out my cool site <a href="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" class="extlink">example.com</a>.Funny thing...'),
|
||||
'Hey, check out my cool site <a href="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" class="extlink">example.com</a>.You will love it.'),
|
||||
'Hey, check out my cool site <a href="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)" class="extlink">example.com/path/foo/(bar)</a>)?'),
|
||||
'What about parens (e.g. <a href="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)" class="extlink">example.com/path/foo/(bar)</a>?'),
|
||||
'What about parens (e.g. <a href="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)" class="extlink">example.com/path/foo/(bar)</a>.)?'),
|
||||
'What about parens (e.g. <a href="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)" class="extlink">example.com/path/(foo,bar)</a>?'),
|
||||
'What about parens (e.g. <a href="http://example.com/path/(foo,bar)" rel="external">example.com/path/(foo,bar)</a>?'),
|
||||
array('file.ext',
|
||||
'file.ext'),
|
||||
array('file.html',
|
||||
|
Loading…
Reference in New Issue
Block a user