URLDetectionTest.php 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  1. <?php
  2. if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) {
  3. print "This script must be run from the command line\n";
  4. exit();
  5. }
  6. define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
  7. define('GNUSOCIAL', true);
  8. define('STATUSNET', true); // compatibility
  9. require_once INSTALLDIR . '/lib/common.php';
  10. class URLDetectionTest extends PHPUnit_Framework_TestCase
  11. {
  12. /**
  13. * @dataProvider provider
  14. *
  15. */
  16. public function testProduction($content, $expected)
  17. {
  18. $rendered = common_render_text($content);
  19. // hack!
  20. $rendered = preg_replace('/id="attachment-\d+"/', 'id="attachment-XXX"', $rendered);
  21. $this->assertEquals($expected, $rendered);
  22. }
  23. /**
  24. * @dataProvider linkifyProvider
  25. *
  26. */
  27. public function testLinkifyProduction($content, $expected, $config)
  28. {
  29. $rendered = common_render_text($content);
  30. // hack!
  31. $rendered = preg_replace('/id="attachment-\d+"/', 'id="attachment-XXX"', $rendered);
  32. if(common_config('linkify', $config)){
  33. $this->assertEquals($expected, $rendered);
  34. } else {
  35. $content = common_remove_unicode_formatting(nl2br(htmlspecialchars($content)));
  36. $this->assertEquals($content, $rendered);
  37. }
  38. }
  39. static public function provider()
  40. {
  41. return array(
  42. array('not a link :: no way',
  43. 'not a link :: no way'),
  44. array('link http://www.somesite.com/xyz/35637563@N00/52803365/ link',
  45. 'link <a href="http://www.somesite.com/xyz/35637563@N00/52803365/" title="http://www.somesite.com/xyz/35637563@N00/52803365/" rel="nofollow external noreferrer" class="attachment" id="attachment-XXX">http://www.somesite.com/xyz/35637563@N00/52803365/</a> link'),
  46. array('http://127.0.0.1',
  47. '<a href="http://127.0.0.1/" title="http://127.0.0.1/" rel="nofollow external noreferrer" class="attachment" id="attachment-XXX">http://127.0.0.1</a>'),
  48. array('http://[::1]:99/test.php',
  49. '<a href="http://[::1]:99/test.php" title="http://[::1]:99/test.php" rel="nofollow external">http://[::1]:99/test.php</a>'),
  50. array('http://::1/test.php',
  51. '<a href="http://::1/test.php" title="http://::1/test.php" rel="nofollow external">http://::1/test.php</a>'),
  52. array('http://::1',
  53. '<a href="http://::1/" title="http://::1/" rel="nofollow external">http://::1</a>'),
  54. array('http://127.0.0.1',
  55. '<a href="http://127.0.0.1/" title="http://127.0.0.1/" rel="nofollow external noreferrer" class="attachment" id="attachment-XXX">http://127.0.0.1</a>'),
  56. array('http://example.com',
  57. '<a href="http://example.com/" title="http://example.com/" rel="nofollow external noreferrer" class="attachment" id="attachment-XXX">http://example.com</a>'),
  58. array('http://example.com.',
  59. '<a href="http://example.com/" title="http://example.com/" rel="nofollow external noreferrer" class="attachment" id="attachment-XXX">http://example.com</a>.'),
  60. array('/var/lib/example.so',
  61. '/var/lib/example.so'),
  62. array('example',
  63. 'example'),
  64. array('mailto:user@example.com',
  65. '<a href="mailto:user@example.com" title="mailto:user@example.com" rel="nofollow external">mailto:user@example.com</a>'),
  66. array('mailto:user@example.com?subject=test',
  67. '<a href="mailto:user@example.com?subject=test" title="mailto:user@example.com?subject=test" rel="nofollow external">mailto:user@example.com?subject=test</a>'),
  68. array('xmpp:user@example.com',
  69. '<a href="xmpp:user@example.com" title="xmpp:user@example.com" rel="nofollow external">xmpp:user@example.com</a>'),
  70. array('#example',
  71. '#<span class="tag"><a href="' . common_local_url('tag', array('tag' => common_canonical_tag('example'))) . '" rel="tag">example</a></span>'),
  72. array('#example.com',
  73. '#<span class="tag"><a href="' . common_local_url('tag', array('tag' => common_canonical_tag('example.com'))) . '" rel="tag">example.com</a></span>'),
  74. array('#.net',
  75. '#<span class="tag"><a href="' . common_local_url('tag', array('tag' => common_canonical_tag('.net'))) . '" rel="tag">.net</a></span>'),
  76. array('http://example',
  77. '<a href="http://example/" title="http://example/" rel="nofollow external">http://example</a>'),
  78. array('http://3xampl3',
  79. '<a href="http://3xampl3/" title="http://3xampl3/" rel="nofollow external">http://3xampl3</a>'),
  80. array('http://example/',
  81. '<a href="http://example/" title="http://example/" rel="nofollow external">http://example/</a>'),
  82. array('http://example/path',
  83. '<a href="http://example/path" title="http://example/path" rel="nofollow external">http://example/path</a>'),
  84. array('http://example.com',
  85. '<a href="http://example.com/" title="http://example.com/" rel="nofollow external noreferrer" class="attachment" id="attachment-XXX">http://example.com</a>'),
  86. array('https://example.com',
  87. '<a href="https://example.com/" title="https://example.com/" rel="nofollow external">https://example.com</a>'),
  88. array('ftp://example.com',
  89. '<a href="ftp://example.com/" title="ftp://example.com/" rel="nofollow external">ftp://example.com</a>'),
  90. array('ftps://example.com',
  91. '<a href="ftps://example.com/" title="ftps://example.com/" rel="nofollow external">ftps://example.com</a>'),
  92. array('http://user@example.com',
  93. '<a href="http://@example.com/" title="http://@example.com/" rel="nofollow external noreferrer" class="attachment" id="attachment-XXX">http://user@example.com</a>'),
  94. array('http://user:pass@example.com',
  95. '<a href="http://@example.com/" title="http://@example.com/" rel="nofollow external noreferrer" class="attachment" id="attachment-XXX">http://user:pass@example.com</a>'),
  96. array('http://example.com:8080',
  97. '<a href="http://example.com:8080/" title="http://example.com:8080/" rel="nofollow external">http://example.com:8080</a>'),
  98. array('http://example.com:8080/test.php',
  99. '<a href="http://example.com:8080/test.php" title="http://example.com:8080/test.php" rel="nofollow external">http://example.com:8080/test.php</a>'),
  100. array('http://www.example.com',
  101. '<a href="http://www.example.com/" title="http://www.example.com/" rel="nofollow external noreferrer" class="attachment" id="attachment-XXX">http://www.example.com</a>'),
  102. array('http://example.com/',
  103. '<a href="http://example.com/" title="http://example.com/" rel="nofollow external noreferrer" class="attachment" id="attachment-XXX">http://example.com/</a>'),
  104. array('http://example.com/path',
  105. '<a href="http://example.com/path" title="http://example.com/path" rel="nofollow external noreferrer" class="attachment" id="attachment-XXX">http://example.com/path</a>'),
  106. array('http://example.com/path.html',
  107. '<a href="http://example.com/path.html" title="http://example.com/path.html" rel="nofollow external noreferrer" class="attachment" id="attachment-XXX">http://example.com/path.html</a>'),
  108. array('http://example.com/path.html#fragment',
  109. '<a href="http://example.com/path.html#fragment" title="http://example.com/path.html#fragment" rel="nofollow external noreferrer" class="attachment" id="attachment-XXX">http://example.com/path.html#fragment</a>'),
  110. array('http://example.com/path.php?foo=bar&bar=foo',
  111. '<a href="http://example.com/path.php?foo=bar&amp;bar=foo" title="http://example.com/path.php?foo=bar&amp;bar=foo" rel="nofollow external noreferrer" class="attachment" id="attachment-XXX">http://example.com/path.php?foo=bar&amp;bar=foo</a>'),
  112. array('http://example.com.',
  113. '<a href="http://example.com/" title="http://example.com/" rel="nofollow external noreferrer" class="attachment" id="attachment-XXX">http://example.com</a>.'),
  114. array('http://müllärör.de',
  115. '<a href="http://m&#xFC;ll&#xE4;r&#xF6;r.de/" title="http://m&#xFC;ll&#xE4;r&#xF6;r.de/" rel="nofollow external">http://müllärör.de</a>'),
  116. array('http://ﺱﺲﺷ.com',
  117. '<a href="http://&#xFEB1;&#xFEB2;&#xFEB7;.com/" title="http://&#xFEB1;&#xFEB2;&#xFEB7;.com/" rel="nofollow external">http://ﺱﺲﺷ.com</a>'),
  118. array('http://сделаткартинки.com',
  119. '<a href="http://&#x441;&#x434;&#x435;&#x43B;&#x430;&#x442;&#x43A;&#x430;&#x440;&#x442;&#x438;&#x43D;&#x43A;&#x438;.com/" title="http://&#x441;&#x434;&#x435;&#x43B;&#x430;&#x442;&#x43A;&#x430;&#x440;&#x442;&#x438;&#x43D;&#x43A;&#x438;.com/" rel="nofollow external">http://сделаткартинки.com</a>'),
  120. array('http://tūdaliņ.lv',
  121. '<a href="http://t&#x16B;dali&#x146;.lv/" title="http://t&#x16B;dali&#x146;.lv/" rel="nofollow external">http://tūdaliņ.lv</a>'),
  122. array('http://brændendekærlighed.com',
  123. '<a href="http://br&#xE6;ndendek&#xE6;rlighed.com/" title="http://br&#xE6;ndendek&#xE6;rlighed.com/" rel="nofollow external">http://brændendekærlighed.com</a>'),
  124. array('http://あーるいん.com',
  125. '<a href="http://&#x3042;&#x30FC;&#x308B;&#x3044;&#x3093;.com/" title="http://&#x3042;&#x30FC;&#x308B;&#x3044;&#x3093;.com/" rel="nofollow external">http://あーるいん.com</a>'),
  126. array('http://예비교사.com',
  127. '<a href="http://&#xC608;&#xBE44;&#xAD50;&#xC0AC;.com/" title="http://&#xC608;&#xBE44;&#xAD50;&#xC0AC;.com/" rel="nofollow external">http://예비교사.com</a>'),
  128. array('http://example.com.',
  129. '<a href="http://example.com/" title="http://example.com/" rel="nofollow external noreferrer" class="attachment" id="attachment-XXX">http://example.com</a>.'),
  130. array('http://example.com?',
  131. '<a href="http://example.com/" title="http://example.com/" rel="nofollow external noreferrer" class="attachment" id="attachment-XXX">http://example.com</a>?'),
  132. array('http://example.com!',
  133. '<a href="http://example.com/" title="http://example.com/" rel="nofollow external noreferrer" class="attachment" id="attachment-XXX">http://example.com</a>!'),
  134. array('http://example.com,',
  135. '<a href="http://example.com/" title="http://example.com/" rel="nofollow external noreferrer" class="attachment" id="attachment-XXX">http://example.com</a>,'),
  136. array('http://example.com;',
  137. '<a href="http://example.com/" title="http://example.com/" rel="nofollow external noreferrer" class="attachment" id="attachment-XXX">http://example.com</a>;'),
  138. array('http://example.com:',
  139. '<a href="http://example.com/" title="http://example.com/" rel="nofollow external noreferrer" class="attachment" id="attachment-XXX">http://example.com</a>:'),
  140. array('\'http://example.com\'',
  141. '\'<a href="http://example.com/" title="http://example.com/" rel="nofollow external noreferrer" class="attachment" id="attachment-XXX">http://example.com</a>\''),
  142. array('"http://example.com"',
  143. '&quot;<a href="http://example.com/" title="http://example.com/" rel="nofollow external noreferrer" class="attachment" id="attachment-XXX">http://example.com</a>&quot;'),
  144. array('"http://example.com/"',
  145. '&quot;<a href="http://example.com/" title="http://example.com/" rel="nofollow external noreferrer" class="attachment" id="attachment-XXX">http://example.com/</a>&quot;'),
  146. array('http://example.com',
  147. '<a href="http://example.com/" title="http://example.com/" rel="nofollow external noreferrer" class="attachment" id="attachment-XXX">http://example.com</a>'),
  148. array('(http://example.com)',
  149. '(<a href="http://example.com/" title="http://example.com/" rel="nofollow external noreferrer" class="attachment" id="attachment-XXX">http://example.com</a>)'),
  150. array('[http://example.com]',
  151. '[<a href="http://example.com/" title="http://example.com/" rel="nofollow external noreferrer" class="attachment" id="attachment-XXX">http://example.com</a>]'),
  152. array('<http://example.com>',
  153. '&lt;<a href="http://example.com/" title="http://example.com/" rel="nofollow external noreferrer" class="attachment" id="attachment-XXX">http://example.com</a>&gt;'),
  154. array('http://example.com/path/(foo)/bar',
  155. '<a href="http://example.com/path/" title="http://example.com/path/" rel="nofollow external noreferrer" class="attachment" id="attachment-XXX">http://example.com/path/</a>(foo)/bar'),
  156. array('http://example.com/path/[foo]/bar',
  157. '<a href="http://example.com/path/" title="http://example.com/path/" rel="nofollow external noreferrer" class="attachment" id="attachment-XXX">http://example.com/path/</a>[foo]/bar'),
  158. array('http://example.com/path/foo/(bar)',
  159. '<a href="http://example.com/path/foo/" title="http://example.com/path/foo/" rel="nofollow external noreferrer" class="attachment" id="attachment-XXX">http://example.com/path/foo/</a>(bar)'),
  160. //Not a valid url - urls cannot contain unencoded square brackets
  161. array('http://example.com/path/foo/[bar]',
  162. '<a href="http://example.com/path/foo/" title="http://example.com/path/foo/" rel="nofollow external noreferrer" class="attachment" id="attachment-XXX">http://example.com/path/foo/</a>[bar]'),
  163. array('Hey, check out my cool site http://example.com okay?',
  164. 'Hey, check out my cool site <a href="http://example.com/" title="http://example.com/" rel="nofollow external noreferrer" class="attachment" id="attachment-XXX">http://example.com</a> okay?'),
  165. array('What about parens (e.g. http://example.com/path/foo/(bar))?',
  166. 'What about parens (e.g. <a href="http://example.com/path/foo/" title="http://example.com/path/foo/" rel="nofollow external noreferrer" class="attachment" id="attachment-XXX">http://example.com/path/foo/</a>(bar))?'),
  167. array('What about parens (e.g. http://example.com/path/foo/(bar)?',
  168. 'What about parens (e.g. <a href="http://example.com/path/foo/" title="http://example.com/path/foo/" rel="nofollow external noreferrer" class="attachment" id="attachment-XXX">http://example.com/path/foo/</a>(bar)?'),
  169. array('What about parens (e.g. http://example.com/path/foo/(bar).)?',
  170. 'What about parens (e.g. <a href="http://example.com/path/foo/" title="http://example.com/path/foo/" rel="nofollow external noreferrer" class="attachment" id="attachment-XXX">http://example.com/path/foo/</a>(bar).)?'),
  171. //Not a valid url - urls cannot contain unencoded commas
  172. array('What about parens (e.g. http://example.com/path/(foo,bar)?',
  173. 'What about parens (e.g. <a href="http://example.com/path/" title="http://example.com/path/" rel="nofollow external noreferrer" class="attachment" id="attachment-XXX">http://example.com/path/</a>(foo,bar)?'),
  174. array('Unbalanced too (e.g. http://example.com/path/((((foo)/bar)?',
  175. 'Unbalanced too (e.g. <a href="http://example.com/path/" title="http://example.com/path/" rel="nofollow external noreferrer" class="attachment" id="attachment-XXX">http://example.com/path/</a>((((foo)/bar)?'),
  176. array('Unbalanced too (e.g. http://example.com/path/(foo))))/bar)?',
  177. 'Unbalanced too (e.g. <a href="http://example.com/path/" title="http://example.com/path/" rel="nofollow external noreferrer" class="attachment" id="attachment-XXX">http://example.com/path/</a>(foo))))/bar)?'),
  178. array('Unbalanced too (e.g. http://example.com/path/foo/((((bar)?',
  179. 'Unbalanced too (e.g. <a href="http://example.com/path/foo/" title="http://example.com/path/foo/" rel="nofollow external noreferrer" class="attachment" id="attachment-XXX">http://example.com/path/foo/</a>((((bar)?'),
  180. array('Unbalanced too (e.g. http://example.com/path/foo/(bar))))?',
  181. 'Unbalanced too (e.g. <a href="http://example.com/path/foo/" title="http://example.com/path/foo/" rel="nofollow external noreferrer" class="attachment" id="attachment-XXX">http://example.com/path/foo/</a>(bar))))?'),
  182. array('file.ext',
  183. 'file.ext'),
  184. array('file.html',
  185. 'file.html'),
  186. array('file.php',
  187. 'file.php'),
  188. // scheme-less HTTP URLs with @ in the path: http://status.net/open-source/issues/2248
  189. array('http://flickr.com/photos/34807140@N05/3838905434',
  190. '<a href="http://www.flickr.com/photos/34807140@N05/3838905434" title="http://www.flickr.com/photos/34807140@N05/3838905434" rel="nofollow external noreferrer" class="attachment thumbnail" id="attachment-XXX">http://flickr.com/photos/34807140@N05/3838905434</a>'),
  191. );
  192. }
  193. static public function linkifyProvider()
  194. {
  195. return array(
  196. //bare ip addresses are no longer supported
  197. array('127.0.0.1',
  198. '<a href="http://127.0.0.1/" title="http://127.0.0.1/" rel="nofollow external">127.0.0.1</a>',
  199. 'bare_ipv4'),
  200. array('127.0.0.1:99',
  201. '<a href="http://127.0.0.1:99/" title="http://127.0.0.1:99/" rel="nofollow external">127.0.0.1:99</a>',
  202. 'bare_ipv4'),
  203. array('127.0.0.1/Name:test.php',
  204. '<a href="http://127.0.0.1/Name:test.php" title="http://127.0.0.1/Name:test.php" rel="nofollow external">127.0.0.1/Name:test.php</a>',
  205. 'bare_ipv4'),
  206. array('127.0.0.1/~test',
  207. '<a href="http://127.0.0.1/~test" title="http://127.0.0.1/~test" rel="nofollow external">127.0.0.1/~test</a>',
  208. 'bare_ipv4'),
  209. array('127.0.0.1/+test',
  210. '<a href="http://127.0.0.1/+test" title="http://127.0.0.1/+test" rel="nofollow external">127.0.0.1/+test</a>',
  211. 'bare_ipv4'),
  212. array('127.0.0.1/$test',
  213. '<a href="http://127.0.0.1/$test" title="http://127.0.0.1/$test" rel="nofollow external">127.0.0.1/$test</a>',
  214. 'bare_ipv4'),
  215. array('127.0.0.1/\'test',
  216. '<a href="http://127.0.0.1/\'test" title="http://127.0.0.1/\'test" rel="nofollow external">127.0.0.1/\'test</a>',
  217. 'bare_ipv4'),
  218. array('127.0.0.1/"test',
  219. '<a href="http://127.0.0.1/" title="http://127.0.0.1/" rel="nofollow external">127.0.0.1/</a>&quot;test',
  220. 'bare_ipv4'),
  221. array('127.0.0.1/test"test',
  222. '<a href="http://127.0.0.1/test" title="http://127.0.0.1/test" rel="nofollow external">127.0.0.1/test</a>&quot;test',
  223. 'bare_ipv4'),
  224. array('127.0.0.1/-test',
  225. '<a href="http://127.0.0.1/-test" title="http://127.0.0.1/-test" rel="nofollow external">127.0.0.1/-test</a>',
  226. 'bare_ipv4'),
  227. array('127.0.0.1/_test',
  228. '<a href="http://127.0.0.1/_test" title="http://127.0.0.1/_test" rel="nofollow external">127.0.0.1/_test</a>',
  229. 'bare_ipv4'),
  230. array('127.0.0.1/!test',
  231. '<a href="http://127.0.0.1/!test" title="http://127.0.0.1/!test" rel="nofollow external">127.0.0.1/!test</a>',
  232. 'bare_ipv4'),
  233. array('127.0.0.1/*test',
  234. '<a href="http://127.0.0.1/*test" title="http://127.0.0.1/*test" rel="nofollow external">127.0.0.1/*test</a>',
  235. 'bare_ipv4'),
  236. array('127.0.0.1/test%20stuff',
  237. '<a href="http://127.0.0.1/test%20stuff" title="http://127.0.0.1/test%20stuff" rel="nofollow external">127.0.0.1/test%20stuff</a>',
  238. 'bare_ipv4'),
  239. array('2001:4978:1b5:0:21d:e0ff:fe66:59ab/test.php',
  240. '<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="nofollow external">2001:4978:1b5:0:21d:e0ff:fe66:59ab/test.php</a>',
  241. 'bare_ipv6'),
  242. array('[2001:4978:1b5:0:21d:e0ff:fe66:59ab]:99/test.php',
  243. '<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="nofollow external">[2001:4978:1b5:0:21d:e0ff:fe66:59ab]:99/test.php</a>',
  244. 'bare_ipv6'),
  245. array('2001:4978:1b5:0:21d:e0ff:fe66:59ab',
  246. '<a href="http://2001:4978:1b5:0:21d:e0ff:fe66:59ab/" title="http://2001:4978:1b5:0:21d:e0ff:fe66:59ab/" rel="nofollow external">2001:4978:1b5:0:21d:e0ff:fe66:59ab</a>',
  247. 'bare_ipv6'),
  248. array('example.com',
  249. '<a href="http://example.com/" title="http://example.com/" rel="nofollow external">example.com</a>',
  250. 'bare_domains'),
  251. array('flickr.com/photos/34807140@N05/3838905434',
  252. '<a href="http://flickr.com/photos/34807140@N05/3838905434" title="http://flickr.com/photos/34807140@N05/3838905434" class="attachment thumbnail" id="attachment-XXX" rel="nofollow external">flickr.com/photos/34807140@N05/3838905434</a>',
  253. 'bare_domains'),
  254. array('What about parens (e.g. example.com/path/foo/(bar))?',
  255. 'What about parens (e.g. <a href="http://example.com/path/foo/(bar)" title="http://example.com/path/foo/(bar)" rel="nofollow external">example.com/path/foo/(bar)</a>)?',
  256. 'bare_domains'),
  257. array('What about parens (e.g. example.com/path/foo/(bar)?',
  258. 'What about parens (e.g. <a href="http://example.com/path/foo/(bar)" title="http://example.com/path/foo/(bar)" rel="nofollow external">example.com/path/foo/(bar)</a>?',
  259. 'bare_domains'),
  260. array('What about parens (e.g. example.com/path/foo/(bar).)?',
  261. 'What about parens (e.g. <a href="http://example.com/path/foo/(bar)" title="http://example.com/path/foo/(bar)" rel="nofollow external">example.com/path/foo/(bar)</a>.?',
  262. 'bare_domains'),
  263. array('What about parens (e.g. example.com/path/(foo,bar)?',
  264. 'What about parens (e.g. <a href="http://example.com/path/(foo,bar)" title="http://example.com/path/(foo,bar)" rel="nofollow external">example.com/path/(foo,bar)</a>?',
  265. 'bare_domains'),
  266. array('example.com',
  267. '<a href="http://example.com/" title="http://example.com/" rel="nofollow external">example.com</a>',
  268. 'bare_domains'),
  269. array('example.org',
  270. '<a href="http://example.org/" title="http://example.org/" rel="nofollow external">example.org</a>',
  271. 'bare_domains'),
  272. array('example.co.uk',
  273. '<a href="http://example.co.uk/" title="http://example.co.uk/" rel="nofollow external">example.co.uk</a>',
  274. 'bare_domains'),
  275. array('www.example.co.uk',
  276. '<a href="http://www.example.co.uk/" title="http://www.example.co.uk/" rel="nofollow external">www.example.co.uk</a>',
  277. 'bare_domains'),
  278. array('farm1.images.example.co.uk',
  279. '<a href="http://farm1.images.example.co.uk/" title="http://farm1.images.example.co.uk/" rel="nofollow external">farm1.images.example.co.uk</a>',
  280. 'bare_domains'),
  281. array('example.museum',
  282. '<a href="http://example.museum/" title="http://example.museum/" rel="nofollow external">example.museum</a>',
  283. 'bare_domains'),
  284. array('example.travel',
  285. '<a href="http://example.travel/" title="http://example.travel/" rel="nofollow external">example.travel</a>',
  286. 'bare_domains'),
  287. array('example.com.',
  288. '<a href="http://example.com/" title="http://example.com/" rel="nofollow external">example.com</a>.',
  289. 'bare_domains'),
  290. array('example.com?',
  291. '<a href="http://example.com/" title="http://example.com/" rel="nofollow external">example.com</a>?',
  292. 'bare_domains'),
  293. array('example.com!',
  294. '<a href="http://example.com/" title="http://example.com/" rel="nofollow external">example.com</a>!',
  295. 'bare_domains'),
  296. array('example.com,',
  297. '<a href="http://example.com/" title="http://example.com/" rel="nofollow external">example.com</a>,',
  298. 'bare_domains'),
  299. array('example.com;',
  300. '<a href="http://example.com/" title="http://example.com/" rel="nofollow external">example.com</a>;',
  301. 'bare_domains'),
  302. array('example.com:',
  303. '<a href="http://example.com/" title="http://example.com/" rel="nofollow external">example.com</a>:',
  304. 'bare_domains'),
  305. array('\'example.com\'',
  306. '\'<a href="http://example.com/" title="http://example.com/" rel="nofollow external">example.com</a>\'',
  307. 'bare_domains'),
  308. array('"example.com"',
  309. '&quot;<a href="http://example.com/" title="http://example.com/" rel="nofollow external">example.com</a>&quot;',
  310. 'bare_domains'),
  311. array('example.com',
  312. '<a href="http://example.com/" title="http://example.com/" rel="nofollow external">example.com</a>',
  313. 'bare_domains'),
  314. array('(example.com)',
  315. '(<a href="http://example.com/" title="http://example.com/" rel="nofollow external">example.com</a>)',
  316. 'bare_domains'),
  317. array('[example.com]',
  318. '[<a href="http://example.com/" title="http://example.com/" rel="nofollow external">example.com</a>]',
  319. 'bare_domains'),
  320. array('<example.com>',
  321. '&lt;<a href="http://example.com/" title="http://example.com/" rel="nofollow external">example.com</a>&gt;',
  322. 'bare_domains'),
  323. array('Hey, check out my cool site example.com okay?',
  324. 'Hey, check out my cool site <a href="http://example.com/" title="http://example.com/" rel="nofollow external">example.com</a> okay?',
  325. 'bare_domains'),
  326. array('Hey, check out my cool site example.com.I made it.',
  327. 'Hey, check out my cool site <a href="http://example.com/" title="http://example.com/" rel="nofollow external">example.com</a>.I made it.',
  328. 'bare_domains'),
  329. array('Hey, check out my cool site example.com.Funny thing...',
  330. 'Hey, check out my cool site <a href="http://example.com/" title="http://example.com/" rel="nofollow external">example.com</a>.Funny thing...',
  331. 'bare_domains'),
  332. array('Hey, check out my cool site example.com.You will love it.',
  333. 'Hey, check out my cool site <a href="http://example.com/" title="http://example.com/" rel="nofollow external">example.com</a>.You will love it.',
  334. 'bare_domains'),
  335. array('example.com:8080/test.php',
  336. '<a href="http://example.com:8080/test.php" title="http://example.com:8080/test.php" rel="nofollow external">example.com:8080/test.php</a>',
  337. 'bare_domains'),
  338. array('user_name+other@example.com',
  339. '<a href="mailto:user_name+other@example.com" title="mailto:user_name+other@example.com" rel="nofollow external">user_name+other@example.com</a>',
  340. 'bare_domains'),
  341. array('user@example.com',
  342. '<a href="mailto:user@example.com" title="mailto:user@example.com" rel="nofollow external">user@example.com</a>',
  343. 'bare_domains'),
  344. );
  345. }
  346. }