git.gnu.io has moved to IP address 209.51.188.249 -- please double check where you are logging in.

URLDetectionTest.php 26.3 KB
Newer Older
1 2 3 4 5 6 7 8
<?php

if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) {
    print "This script must be run from the command line\n";
    exit();
}

define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
9 10
define('GNUSOCIAL', true);
define('STATUSNET', true);  // compatibility
11 12 13 14 15 16 17 18 19 20 21 22

require_once INSTALLDIR . '/lib/common.php';

class URLDetectionTest extends PHPUnit_Framework_TestCase
{
    /**
     * @dataProvider provider
     *
     */
    public function testProduction($content, $expected)
    {
        $rendered = common_render_text($content);
23 24
        // hack!
        $rendered = preg_replace('/id="attachment-\d+"/', 'id="attachment-XXX"', $rendered);
25 26 27 28 29 30
        $this->assertEquals($expected, $rendered);
    }

    static public function provider()
    {
        return array(
31 32
                     array('not a link :: no way',
                           'not a link :: no way'),
33
                     array('link http://www.somesite.com/xyz/35637563@N00/52803365/ link',
34
                           'link <a href="http://www.somesite.com/xyz/35637563@N00/52803365/" title="http://www.somesite.com/xyz/35637563@N00/52803365/" rel="nofollow external">http://www.somesite.com/xyz/35637563@N00/52803365/</a> link'),
35
                     array('http://127.0.0.1',
36
                           '<a href="http://127.0.0.1/" title="http://127.0.0.1/" rel="nofollow external">http://127.0.0.1</a>'),
37
                     array('127.0.0.1',
38
                           '<a href="http://127.0.0.1/" title="http://127.0.0.1/" rel="nofollow external">127.0.0.1</a>'),
39
                     array('127.0.0.1:99',
40
                           '<a href="http://127.0.0.1:99/" title="http://127.0.0.1:99/" rel="nofollow external">127.0.0.1:99</a>'),
41
                     array('127.0.0.1/Name:test.php',
42
                           '<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>'),
43
                     array('127.0.0.1/~test',
44
                           '<a href="http://127.0.0.1/~test" title="http://127.0.0.1/~test" rel="nofollow external">127.0.0.1/~test</a>'),
45
                     array('127.0.0.1/+test',
46
                           '<a href="http://127.0.0.1/+test" title="http://127.0.0.1/+test" rel="nofollow external">127.0.0.1/+test</a>'),
47
                     array('127.0.0.1/$test',
48
                           '<a href="http://127.0.0.1/$test" title="http://127.0.0.1/$test" rel="nofollow external">127.0.0.1/$test</a>'),
49
                     array('127.0.0.1/\'test',
50
                           '<a href="http://127.0.0.1/\'test" title="http://127.0.0.1/\'test" rel="nofollow external">127.0.0.1/\'test</a>'),
51
                     array('127.0.0.1/"test',
52
                           '<a href="http://127.0.0.1/" title="http://127.0.0.1/" rel="nofollow external">127.0.0.1/</a>&quot;test'),
53
                     array('127.0.0.1/test"test',
54
                           '<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'),
55
                     array('127.0.0.1/-test',
56
                           '<a href="http://127.0.0.1/-test" title="http://127.0.0.1/-test" rel="nofollow external">127.0.0.1/-test</a>'),
57
                     array('127.0.0.1/_test',
58
                           '<a href="http://127.0.0.1/_test" title="http://127.0.0.1/_test" rel="nofollow external">127.0.0.1/_test</a>'),
59
                     array('127.0.0.1/!test',
60
                           '<a href="http://127.0.0.1/!test" title="http://127.0.0.1/!test" rel="nofollow external">127.0.0.1/!test</a>'),
61
                     array('127.0.0.1/*test',
62
                           '<a href="http://127.0.0.1/*test" title="http://127.0.0.1/*test" rel="nofollow external">127.0.0.1/*test</a>'),
63
                     array('127.0.0.1/test%20stuff',
64
                           '<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>'),
65
                     array('http://[::1]:99/test.php',
66
                           '<a href="http://[::1]:99/test.php" title="http://[::1]:99/test.php" rel="nofollow external">http://[::1]:99/test.php</a>'),
67
                     array('http://::1/test.php',
68
                           '<a href="http://::1/test.php" title="http://::1/test.php" rel="nofollow external">http://::1/test.php</a>'),
69
                     array('http://::1',
70
                           '<a href="http://::1/" title="http://::1/" rel="nofollow external">http://::1</a>'),
71
                     array('2001:4978:1b5:0:21d:e0ff:fe66:59ab/test.php',
72
                           '<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>'),
73
                     array('[2001:4978:1b5:0:21d:e0ff:fe66:59ab]:99/test.php',
74
                           '<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>'),
75
                     array('2001:4978:1b5:0:21d:e0ff:fe66:59ab',
76
                           '<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>'),
77
                     array('http://127.0.0.1',
78
                           '<a href="http://127.0.0.1/" title="http://127.0.0.1/" rel="nofollow external">http://127.0.0.1</a>'),
79
                     array('example.com',
80
                           '<a href="http://example.com/" title="http://example.com/" rel="nofollow external">example.com</a>'),
81
                     array('example.com',
82
                           '<a href="http://example.com/" title="http://example.com/" rel="nofollow external">example.com</a>'),
83
                     array('http://example.com',
84
                           '<a href="http://example.com/" title="http://example.com/" rel="nofollow external">http://example.com</a>'),
85
                     array('http://example.com.',
86
                           '<a href="http://example.com/" title="http://example.com/" rel="nofollow external">http://example.com</a>.'),
87 88
                     array('/var/lib/example.so',
                           '/var/lib/example.so'),
89 90
                     array('example',
                           'example'),
91
                     array('user@example.com',
92
                           '<a href="mailto:user@example.com" title="mailto:user@example.com" rel="nofollow external">user@example.com</a>'),
93
                     array('user_name+other@example.com',
94
                           '<a href="mailto:user_name+other@example.com" title="mailto:user_name+other@example.com" rel="nofollow external">user_name+other@example.com</a>'),
95
                     array('mailto:user@example.com',
96
                           '<a href="mailto:user@example.com" title="mailto:user@example.com" rel="nofollow external">mailto:user@example.com</a>'),
97
                     array('mailto:user@example.com?subject=test',
98
                           '<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>'),
99
                     array('xmpp:user@example.com',
100
                           '<a href="xmpp:user@example.com" title="xmpp:user@example.com" rel="nofollow external">xmpp:user@example.com</a>'),
101 102 103 104 105 106
                     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',
                           '#<span class="tag"><a href="' . common_local_url('tag', array('tag' => common_canonical_tag('example.com'))) . '" rel="tag">example.com</a></span>'),
                     array('#.net',
                           '#<span class="tag"><a href="' . common_local_url('tag', array('tag' => common_canonical_tag('.net'))) . '" rel="tag">.net</a></span>'),
107
                     array('http://example',
108
                           '<a href="http://example/" title="http://example/" rel="nofollow external">http://example</a>'),
109
                     array('http://3xampl3',
110
                           '<a href="http://3xampl3/" title="http://3xampl3/" rel="nofollow external">http://3xampl3</a>'),
111
                     array('http://example/',
112
                           '<a href="http://example/" title="http://example/" rel="nofollow external">http://example/</a>'),
113
                     array('http://example/path',
114
                           '<a href="http://example/path" title="http://example/path" rel="nofollow external">http://example/path</a>'),
115
                     array('http://example.com',
116
                           '<a href="http://example.com/" title="http://example.com/" rel="nofollow external">http://example.com</a>'),
117
                     array('https://example.com',
118
                           '<a href="https://example.com/" title="https://example.com/" rel="nofollow external">https://example.com</a>'),
119
                     array('ftp://example.com',
120
                           '<a href="ftp://example.com/" title="ftp://example.com/" rel="nofollow external">ftp://example.com</a>'),
121
                     array('ftps://example.com',
122
                           '<a href="ftps://example.com/" title="ftps://example.com/" rel="nofollow external">ftps://example.com</a>'),
123
                     array('http://user@example.com',
124
                           '<a href="http://user@example.com/" title="http://user@example.com/" rel="nofollow external">http://user@example.com</a>'),
125
                     array('http://user:pass@example.com',
126
                           '<a href="http://user:pass@example.com/" title="http://user:pass@example.com/" rel="nofollow external">http://user:pass@example.com</a>'),
127
                     array('http://example.com:8080',
128
                           '<a href="http://example.com:8080/" title="http://example.com:8080/" rel="nofollow external">http://example.com:8080</a>'),
129
                     array('http://example.com:8080/test.php',
130
                           '<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>'),
131
                     array('example.com:8080/test.php',
132
                           '<a href="http://example.com:8080/test.php" title="http://example.com:8080/test.php" rel="nofollow external">example.com:8080/test.php</a>'),
133
                     array('http://www.example.com',
134
                           '<a href="http://www.example.com/" title="http://www.example.com/" rel="nofollow external">http://www.example.com</a>'),
135
                     array('http://example.com/',
136
                           '<a href="http://example.com/" title="http://example.com/" rel="nofollow external">http://example.com/</a>'),
137
                     array('http://example.com/path',
138
                           '<a href="http://example.com/path" title="http://example.com/path" rel="nofollow external">http://example.com/path</a>'),
139
                     array('http://example.com/path.html',
140
                           '<a href="http://example.com/path.html" title="http://example.com/path.html" rel="nofollow external">http://example.com/path.html</a>'),
141
                     array('http://example.com/path.html#fragment',
142
                           '<a href="http://example.com/path.html#fragment" title="http://example.com/path.html#fragment" rel="nofollow external">http://example.com/path.html#fragment</a>'),
143
                     array('http://example.com/path.php?foo=bar&bar=foo',
144
                           '<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">http://example.com/path.php?foo=bar&amp;bar=foo</a>'),
145
                     array('http://example.com.',
146
                           '<a href="http://example.com/" title="http://example.com/" rel="nofollow external">http://example.com</a>.'),
147
                     array('http://müllärör.de',
148
                           '<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>'),
149
                     array('http://ﺱﺲﺷ.com',
150
                           '<a href="http://&#xFEB1;&#xFEB2;&#xFEB7;.com/" title="http://&#xFEB1;&#xFEB2;&#xFEB7;.com/" rel="nofollow external">http://ﺱﺲﺷ.com</a>'),
151
                     array('http://сделаткартинки.com',
152
                           '<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>'),
153
                     array('http://tūdaliņ.lv',
154
                           '<a href="http://t&#x16B;dali&#x146;.lv/" title="http://t&#x16B;dali&#x146;.lv/" rel="nofollow external">http://tūdaliņ.lv</a>'),
155
                     array('http://brændendekærlighed.com',
156
                           '<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>'),
157
                     array('http://あーるいん.com',
158
                           '<a href="http://&#x3042;&#x30FC;&#x308B;&#x3044;&#x3093;.com/" title="http://&#x3042;&#x30FC;&#x308B;&#x3044;&#x3093;.com/" rel="nofollow external">http://あーるいん.com</a>'),
159
                     array('http://예비교사.com',
160
                           '<a href="http://&#xC608;&#xBE44;&#xAD50;&#xC0AC;.com/" title="http://&#xC608;&#xBE44;&#xAD50;&#xC0AC;.com/" rel="nofollow external">http://예비교사.com</a>'),
161
                     array('http://example.com.',
162
                           '<a href="http://example.com/" title="http://example.com/" rel="nofollow external">http://example.com</a>.'),
163
                     array('http://example.com?',
164
                           '<a href="http://example.com/" title="http://example.com/" rel="nofollow external">http://example.com</a>?'),
165
                     array('http://example.com!',
166
                           '<a href="http://example.com/" title="http://example.com/" rel="nofollow external">http://example.com</a>!'),
167
                     array('http://example.com,',
168
                           '<a href="http://example.com/" title="http://example.com/" rel="nofollow external">http://example.com</a>,'),
169
                     array('http://example.com;',
170
                           '<a href="http://example.com/" title="http://example.com/" rel="nofollow external">http://example.com</a>;'),
171
                     array('http://example.com:',
172
                           '<a href="http://example.com/" title="http://example.com/" rel="nofollow external">http://example.com</a>:'),
173
                     array('\'http://example.com\'',
174
                           '\'<a href="http://example.com/" title="http://example.com/" rel="nofollow external">http://example.com</a>\''),
175
                     array('"http://example.com"',
176
                           '&quot;<a href="http://example.com/" title="http://example.com/" rel="nofollow external">http://example.com</a>&quot;'),
177
                     array('"http://example.com/"',
178
                           '&quot;<a href="http://example.com/" title="http://example.com/" rel="nofollow external">http://example.com/</a>&quot;'),
179
                     array('http://example.com',
180
                           '<a href="http://example.com/" title="http://example.com/" rel="nofollow external">http://example.com</a>'),
181
                     array('(http://example.com)',
182
                           '(<a href="http://example.com/" title="http://example.com/" rel="nofollow external">http://example.com</a>)'),
183
                     array('[http://example.com]',
184
                           '[<a href="http://example.com/" title="http://example.com/" rel="nofollow external">http://example.com</a>]'),
185
                     array('<http://example.com>',
186
                           '&lt;<a href="http://example.com/" title="http://example.com/" rel="nofollow external">http://example.com</a>&gt;'),
187
                     array('http://example.com/path/(foo)/bar',
188
                           '<a href="http://example.com/path/(foo)/bar" title="http://example.com/path/(foo)/bar" rel="nofollow external">http://example.com/path/(foo)/bar</a>'),
189
                     array('http://example.com/path/[foo]/bar',
190
                           '<a href="http://example.com/path/" title="http://example.com/path/" rel="nofollow external">http://example.com/path/</a>[foo]/bar'),
191
                     array('http://example.com/path/foo/(bar)',
192
                           '<a href="http://example.com/path/foo/(bar)" title="http://example.com/path/foo/(bar)" rel="nofollow external">http://example.com/path/foo/(bar)</a>'),
193
                     //Not a valid url - urls cannot contain unencoded square brackets
194
                     array('http://example.com/path/foo/[bar]',
195
                           '<a href="http://example.com/path/foo/" title="http://example.com/path/foo/" rel="nofollow external">http://example.com/path/foo/</a>[bar]'),
196
                     array('Hey, check out my cool site http://example.com okay?',
197
                           'Hey, check out my cool site <a href="http://example.com/" title="http://example.com/" rel="nofollow external">http://example.com</a> okay?'),
198
                     array('What about parens (e.g. http://example.com/path/foo/(bar))?',
199
                           'What about parens (e.g. <a href="http://example.com/path/foo/(bar)" title="http://example.com/path/foo/(bar)" rel="nofollow external">http://example.com/path/foo/(bar)</a>)?'),
200
                     array('What about parens (e.g. http://example.com/path/foo/(bar)?',
201
                           'What about parens (e.g. <a href="http://example.com/path/foo/(bar)" title="http://example.com/path/foo/(bar)" rel="nofollow external">http://example.com/path/foo/(bar)</a>?'),
202
                     array('What about parens (e.g. http://example.com/path/foo/(bar).)?',
203
                           'What about parens (e.g. <a href="http://example.com/path/foo/(bar)" title="http://example.com/path/foo/(bar)" rel="nofollow external">http://example.com/path/foo/(bar)</a>.)?'),
204
                     //Not a valid url - urls cannot contain unencoded commas
205
                     array('What about parens (e.g. http://example.com/path/(foo,bar)?',
206
                           'What about parens (e.g. <a href="http://example.com/path/(foo,bar)" title="http://example.com/path/(foo,bar)" rel="nofollow external">http://example.com/path/(foo,bar)</a>?'),
207
                     array('Unbalanced too (e.g. http://example.com/path/((((foo)/bar)?',
208
                           'Unbalanced too (e.g. <a href="http://example.com/path/((((foo)/bar)" title="http://example.com/path/((((foo)/bar)" rel="nofollow external">http://example.com/path/((((foo)/bar)</a>?'),
209
                     array('Unbalanced too (e.g. http://example.com/path/(foo))))/bar)?',
210
                           'Unbalanced too (e.g. <a href="http://example.com/path/(foo))))/bar" title="http://example.com/path/(foo))))/bar" rel="nofollow external">http://example.com/path/(foo))))/bar</a>)?'),
211
                     array('Unbalanced too (e.g. http://example.com/path/foo/((((bar)?',
212
                           'Unbalanced too (e.g. <a href="http://example.com/path/foo/((((bar)" title="http://example.com/path/foo/((((bar)" rel="nofollow external">http://example.com/path/foo/((((bar)</a>?'),
213
                     array('Unbalanced too (e.g. http://example.com/path/foo/(bar))))?',
214
                           'Unbalanced too (e.g. <a href="http://example.com/path/foo/(bar)" title="http://example.com/path/foo/(bar)" rel="nofollow external">http://example.com/path/foo/(bar)</a>)))?'),
215
                     array('example.com',
216
                           '<a href="http://example.com/" title="http://example.com/" rel="nofollow external">example.com</a>'),
217
                     array('example.org',
218
                           '<a href="http://example.org/" title="http://example.org/" rel="nofollow external">example.org</a>'),
219
                     array('example.co.uk',
220
                           '<a href="http://example.co.uk/" title="http://example.co.uk/" rel="nofollow external">example.co.uk</a>'),
221
                     array('www.example.co.uk',
222
                           '<a href="http://www.example.co.uk/" title="http://www.example.co.uk/" rel="nofollow external">www.example.co.uk</a>'),
223
                     array('farm1.images.example.co.uk',
224
                           '<a href="http://farm1.images.example.co.uk/" title="http://farm1.images.example.co.uk/" rel="nofollow external">farm1.images.example.co.uk</a>'),
225
                     array('example.museum',
226
                           '<a href="http://example.museum/" title="http://example.museum/" rel="nofollow external">example.museum</a>'),
227
                     array('example.travel',
228
                           '<a href="http://example.travel/" title="http://example.travel/" rel="nofollow external">example.travel</a>'),
229
                     array('example.com.',
230
                           '<a href="http://example.com/" title="http://example.com/" rel="nofollow external">example.com</a>.'),
231
                     array('example.com?',
232
                           '<a href="http://example.com/" title="http://example.com/" rel="nofollow external">example.com</a>?'),
233
                     array('example.com!',
234
                           '<a href="http://example.com/" title="http://example.com/" rel="nofollow external">example.com</a>!'),
235
                     array('example.com,',
236
                           '<a href="http://example.com/" title="http://example.com/" rel="nofollow external">example.com</a>,'),
237
                     array('example.com;',
238
                           '<a href="http://example.com/" title="http://example.com/" rel="nofollow external">example.com</a>;'),
239
                     array('example.com:',
240
                           '<a href="http://example.com/" title="http://example.com/" rel="nofollow external">example.com</a>:'),
241
                     array('\'example.com\'',
242
                           '\'<a href="http://example.com/" title="http://example.com/" rel="nofollow external">example.com</a>\''),
243
                     array('"example.com"',
244
                           '&quot;<a href="http://example.com/" title="http://example.com/" rel="nofollow external">example.com</a>&quot;'),
245
                     array('example.com',
246
                           '<a href="http://example.com/" title="http://example.com/" rel="nofollow external">example.com</a>'),
247
                     array('(example.com)',
248
                           '(<a href="http://example.com/" title="http://example.com/" rel="nofollow external">example.com</a>)'),
249
                     array('[example.com]',
250
                           '[<a href="http://example.com/" title="http://example.com/" rel="nofollow external">example.com</a>]'),
251
                     array('<example.com>',
252
                           '&lt;<a href="http://example.com/" title="http://example.com/" rel="nofollow external">example.com</a>&gt;'),
253
                     array('Hey, check out my cool site example.com okay?',
254
                           'Hey, check out my cool site <a href="http://example.com/" title="http://example.com/" rel="nofollow external">example.com</a> okay?'),
255
                     array('Hey, check out my cool site example.com.I made it.',
256
                           'Hey, check out my cool site <a href="http://example.com/" title="http://example.com/" rel="nofollow external">example.com</a>.I made it.'),
257
                     array('Hey, check out my cool site example.com.Funny thing...',
258
                           'Hey, check out my cool site <a href="http://example.com/" title="http://example.com/" rel="nofollow external">example.com</a>.Funny thing...'),
259
                     array('Hey, check out my cool site example.com.You will love it.',
260
                           '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.'),
261
                     array('What about parens (e.g. example.com/path/foo/(bar))?',
262
                           '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>)?'),
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
                     array('What about parens (e.g. example.com/path/foo/(bar).)?',
266
                           '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>.)?'),
267
                     array('What about parens (e.g. example.com/path/(foo,bar)?',
268
                           '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>?'),
269 270 271 272 273
                     array('file.ext',
                           'file.ext'),
                     array('file.html',
                           'file.html'),
                     array('file.php',
274 275 276 277 278 279 280
                           'file.php'),

                     // scheme-less HTTP URLs with @ in the path: http://status.net/open-source/issues/2248
                     array('http://flickr.com/photos/34807140@N05/3838905434',
                           '<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">http://flickr.com/photos/34807140@N05/3838905434</a>'),
                     array('flickr.com/photos/34807140@N05/3838905434',
                           '<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>'),
281 282 283 284
                     );
    }
}