return array(
// Protocol, Search pattern, URL which matches the pattern
- array( 'http://' , '*.test.com' , 'http://www.test.com' ),
- array( 'http://' , 'test.com:8080/dir/file' , 'http://name:pass@test.com:8080/dir/file' ),
- array( 'https://' , '*.com' , 'https://s.s.test..com:88/dir/file?a=1&b=2' ),
- array( 'https://' , '*.com' , 'https://name:pass@secure.com/index.html' ),
- array( 'http://' , 'name:pass@test.com' , 'http://test.com' ),
- array( 'http://' , 'test.com' , 'http://name:pass@test.com' ),
- array( 'http://' , '*.test.com' , 'http://a.b.c.test.com/dir/dir/file?a=6'),
- array( null , 'http://*.test.com' , 'http://www.test.com' ),
- array( 'mailto:' , 'name@mail.test123.com' , 'mailto:name@mail.test123.com' ),
- array( '' ,
- 'http://name:pass@www.test.com:12345/dir/dir/file.xyz.php#__se__?arg1=_&arg2[]=4rtg' ,
+ array( 'http://', '*.test.com', 'http://www.test.com' ),
+ array( 'http://', 'test.com:8080/dir/file', 'http://name:pass@test.com:8080/dir/file' ),
+ array( 'https://', '*.com', 'https://s.s.test..com:88/dir/file?a=1&b=2' ),
+ array( 'https://', '*.com', 'https://name:pass@secure.com/index.html' ),
+ array( 'http://', 'name:pass@test.com', 'http://test.com' ),
+ array( 'http://', 'test.com', 'http://name:pass@test.com' ),
+ array( 'http://', '*.test.com', 'http://a.b.c.test.com/dir/dir/file?a=6'),
+ array( null, 'http://*.test.com', 'http://www.test.com' ),
+ array( 'mailto:', 'name@mail.test123.com', 'mailto:name@mail.test123.com' ),
+ array( '',
+ 'http://name:pass@www.test.com:12345/dir/dir/file.xyz.php#__se__?arg1=_&arg2[]=4rtg',
'http://name:pass@www.test.com:12345/dir/dir/file.xyz.php#__se__?arg1=_&arg2[]=4rtg'
),
- array( '' , 'http://name:pass@*.test.com:12345/dir/dir/file.xyz.php#__se__?arg1=_&arg2[]=4rtg' ,
+ array( '', 'http://name:pass@*.test.com:12345/dir/dir/file.xyz.php#__se__?arg1=_&arg2[]=4rtg',
'http://name:pass@www.test.com:12345/dir/dir/file.xyz.php#__se__?arg1=_&arg2[]=4rtg' ),
- array( '' , 'http://name:wrongpass@*.com:12345/dir/dir/file.xyz.php#__se__?arg1=_&arg2[]' ,
+ array( '', 'http://name:wrongpass@*.com:12345/dir/dir/file.xyz.php#__se__?arg1=_&arg2[]',
'http://name:pass@www.test.com:12345/dir/dir/file.xyz.php#__se__?arg1=_&arg2[]=4rtg' ),
- array( 'http://' , 'name:pass@*.test.com:12345/dir/dir/file.xyz.php#__se__?arg1=_&arg2[]=4rtg' ,
+ array( 'http://', 'name:pass@*.test.com:12345/dir/dir/file.xyz.php#__se__?arg1=_&arg2[]=4rtg',
'http://name:pass@www.test.com:12345/dir/dir/file.xyz.php#__se__?arg1=_&arg2[]=4rtg' ),
- array( '' , 'http://name:pass@www.test.com:12345' ,
+ array( '', 'http://name:pass@www.test.com:12345',
'http://name:pass@www.test.com:12345/dir/dir/file.xyz.php#__se__?arg1=_&arg2[]=4rtg' ),
array( 'ftp://', 'user:pass@ftp.test.com:1233/home/user/file;type=efw',
'ftp://user:pass@ftp.test.com:1233/home/user/file;type=efw' ),
- array( null , 'ftp://otheruser:otherpass@ftp.test.com:1233/home/user/file;type=',
+ array( null, 'ftp://otheruser:otherpass@ftp.test.com:1233/home/user/file;type=',
'ftp://user:pass@ftp.test.com:1233/home/user/file;type=efw' ),
- array( null , 'ftp://@ftp.test.com:1233/home/user/file;type=',
+ array( null, 'ftp://@ftp.test.com:1233/home/user/file;type=',
'ftp://user:pass@ftp.test.com:1233/home/user/file;type=efw' ),
- array( null , 'ftp://ftp.test.com/',
+ array( null, 'ftp://ftp.test.com/',
'ftp://user:pass@ftp.test.com/home/user/file;type=efw' ),
- array( null , 'ftp://ftp.test.com/',
+ array( null, 'ftp://ftp.test.com/',
'ftp://user:pass@ftp.test.com/home/user/file;type=efw' ),
- array( null , 'ftp://*.test.com:222/',
+ array( null, 'ftp://*.test.com:222/',
'ftp://user:pass@ftp.test.com:222/home' ),
array( 'irc://', '*.myserver:6667/', 'irc://test.myserver:6667/' ),
array( 'irc://', 'name:pass@*.myserver/', 'irc://test.myserver:6667/' ),
array( 'mailto:', 'test.com', 'mailto:name@test.com' ),
array( 'news:', 'test.1234afc@news.test.com', 'news:test.1234afc@news.test.com' ),
array( 'news:', '*.test.com', 'news:test.1234afc@news.test.com' ),
- array( '' , 'news:4df8kh$iagfewewf(at)newsbf02aaa.news.aol.com',
+ array( '', 'news:4df8kh$iagfewewf(at)newsbf02aaa.news.aol.com',
'news:4df8kh$iagfewewf(at)newsbf02aaa.news.aol.com' ),
- array( '' , 'news:*.aol.com',
+ array( '', 'news:*.aol.com',
'news:4df8kh$iagfewewf(at)newsbf02aaa.news.aol.com' ),
- array( '' , 'git://github.com/prwef/abc-def.git' , 'git://github.com/prwef/abc-def.git' ),
- array( 'git://' , 'github.com/' , 'git://github.com/prwef/abc-def.git' ),
- array( 'git://' , '*.github.com/' , 'git://a.b.c.d.e.f.github.com/prwef/abc-def.git' ),
- array( '' , 'gopher://*.test.com/' , 'gopher://gopher.test.com/0/v2/vstat'),
- array( 'telnet://' , '*.test.com' , 'telnet://shell.test.com/~home/'),
+ array( '', 'git://github.com/prwef/abc-def.git', 'git://github.com/prwef/abc-def.git' ),
+ array( 'git://', 'github.com/', 'git://github.com/prwef/abc-def.git' ),
+ array( 'git://', '*.github.com/', 'git://a.b.c.d.e.f.github.com/prwef/abc-def.git' ),
+ array( '', 'gopher://*.test.com/', 'gopher://gopher.test.com/0/v2/vstat'),
+ array( 'telnet://', '*.test.com', 'telnet://shell.test.com/~home/'),
//
// The following only work in PHP >= 5.3.7, due to a bug in parse_url which eats
//
// Tests for false positives
//
- array( 'http://' , 'test.com' , 'http://www.test.com', false ),
- array( 'http://' , 'www1.test.com' , 'http://www.test.com', false ),
- array( 'http://' , '*.test.com' , 'http://www.test.t.com', false ),
- array( '' , 'http://test.com:8080' , 'http://www.test.com:8080', false ),
- array( '' , 'https://test.com' , 'http://test.com', false ),
- array( '' , 'http://test.com' , 'https://test.com', false ),
+ array( 'http://', 'test.com', 'http://www.test.com', false ),
+ array( 'http://', 'www1.test.com', 'http://www.test.com', false ),
+ array( 'http://', '*.test.com', 'http://www.test.t.com', false ),
+ array( '', 'http://test.com:8080', 'http://www.test.com:8080', false ),
+ array( '', 'https://test.com', 'http://test.com', false ),
+ array( '', 'http://test.com', 'https://test.com', false ),
array( 'http://', 'http://test.com', 'http://test.com', false ),
array( null, 'http://www.test.com', 'http://www.test.com:80', false ),
array( null, 'http://www.test.com:80', 'http://www.test.com', false ),
$matches = 0;
- foreach( $indexes as $index ) {
+ foreach ( $indexes as $index ) {
$matches += preg_match( $regex, $index );
$debugmsg .= "\t'$index'\n";
}