summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-08-25 18:01:46 -0400
committerEvan Prodromou <evan@controlyourself.ca>2009-08-25 18:01:46 -0400
commitd0baab6978f1959382d568d26cc9f8f552a7b764 (patch)
tree32bbe1148e86bb7846ae1f0e581c0f3c0f68956f
parent077955cb1d45f866d65aebdc42f5e3e71dc74045 (diff)
parenta2117961be463d566c8f3c6ccd9b8e840f171804 (diff)
Merge branch '0.8.x' into testing
-rw-r--r--.gitignore1
-rw-r--r--classes/File_redirection.php2
-rw-r--r--lib/designsettings.php1
-rw-r--r--lib/util.php90
-rw-r--r--plugins/TemplatePlugin.php9
-rw-r--r--tests/HashTagDetectionTest.php47
-rw-r--r--tests/URLDetectionTest.php210
-rw-r--r--tpl/index.php2
8 files changed, 260 insertions, 102 deletions
diff --git a/.gitignore b/.gitignore
index 5394f5eac..1cde3a625 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,7 @@ avatar/*
background/*
files/*
file/*
+local/*
_darcs/*
logs/*
config.php
diff --git a/classes/File_redirection.php b/classes/File_redirection.php
index d6fa0bcb6..363e3b947 100644
--- a/classes/File_redirection.php
+++ b/classes/File_redirection.php
@@ -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 .= '/';
diff --git a/lib/designsettings.php b/lib/designsettings.php
index a48ec9d22..b86265971 100644
--- a/lib/designsettings.php
+++ b/lib/designsettings.php
@@ -326,6 +326,7 @@ class DesignSettingsAction extends AccountSettingsAction
$this->script('js/farbtastic/farbtastic.js');
$this->script('js/farbtastic/farbtastic.go.js');
+ $this->script('js/userdesign.go.js');
}
/**
diff --git a/lib/util.php b/lib/util.php
index 2be4213e7..7c1e21913 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -404,7 +404,7 @@ function common_render_text($text)
$r = preg_replace('/[\x{0}-\x{8}\x{b}-\x{c}\x{e}-\x{19}]/', '', $r);
$r = common_replace_urls_callback($r, 'common_linkify');
- $r = preg_replace('/(^|\(|\[|\s+)#([\pL\pN_\-\.]{1,64})/e', "'\\1#'.common_tag_link('\\2')", $r);
+ $r = preg_replace('/(^|\&quot\;|\'|\(|\[|\{|\s+)#([\pL\pN_\-\.]{1,64})/e', "'\\1#'.common_tag_link('\\2')", $r);
// XXX: machine tags
return $r;
}
@@ -412,44 +412,94 @@ function common_render_text($text)
function common_replace_urls_callback($text, $callback, $notice_id = null) {
// Start off with a regex
$regex = '#'.
- '(?:^|[\s\(\)\[\]\{\}]+)'.
- '('.
+ '(?:^|[\s\(\)\[\]\{\}\\\'\\\";]+)(?![\@\!\#])'.
+ '(?P<url>'.
'(?:'.
'(?:'. //Known protocols
'(?:'.
- '(?:https?|ftps?|mms|rtsp|gopher|news|nntp|telnet|wais|file|prospero|webcal|irc)://'.
+ '(?:(?:https?|ftps?|mms|rtsp|gopher|news|nntp|telnet|wais|file|prospero|webcal|irc)://)'.
'|'.
- '(?:mailto|aim|tel|xmpp):'.
- ')[^\s\/]+'.
+ '(?:(?:mailto|aim|tel|xmpp):)'.
+ ')'.
+ '(?:[\pN\pL\-\_\+]+(?::[\pN\pL\-\_\+]+)?\@)?'. //user:pass@
+ '(?:'.
+ '(?:'.
+ '\[[\pN\pL\-\_\:\.]+(?<![\.\:])\]'. //[dns]
+ ')|(?:'.
+ '[\pN\pL\-\_\:\.]+(?<![\.\:])'. //dns
+ ')'.
+ ')'.
')'.
'|(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)'. //IPv4
'|(?:'. //IPv6
- '(?:(?:(?:[0-9A-Fa-f]{1,4}:){7}(?:(?:[0-9A-F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-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|(?:(?::[0-9A-Fa-f]{1,4}){1,2})))|(?::(?::[0-9A-Fa-f]{1,4}){0,5}(?:(?::(?:(?:25[0-5]|2[0-4]\d|[01]?\d{1,2})(?:\.(?:25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|(?:(?::[0-9A-Fa-f]{1,4}){1,2})))|(?:(?:(?:25[0-5]|2[0-4]\d|[01]?\d{1,2})(?:\.(?:25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})))\]?'.
')|(?:'. //DNS
- '\S+\.(?:museum|travel|onion|local|[a-z]{2,4})'.
- ')'.
+ '(?:[\pN\pL\-\_\+]+(?:\:[\pN\pL\-\_\+]+)?\@)?'. //user:pass@
+ '[\pN\pL\-\_]+(?:\.[\pN\pL\-\_]+)*\.'.
+ //tld list from http://data.iana.org/TLD/tlds-alpha-by-domain.txt, also added local, loc, and onion
+ '(?:AC|AD|AE|AERO|AF|AG|AI|AL|AM|AN|AO|AQ|AR|ARPA|AS|ASIA|AT|AU|AW|AX|AZ|BA|BB|BD|BE|BF|BG|BH|BI|BIZ|BJ|BM|BN|BO|BR|BS|BT|BV|BW|BY|BZ|CA|CAT|CC|CD|CF|CG|CH|CI|CK|CL|CM|CN|CO|COM|COOP|CR|CU|CV|CX|CY|CZ|DE|DJ|DK|DM|DO|DZ|EC|EDU|EE|EG|ER|ES|ET|EU|FI|FJ|FK|FM|FO|FR|GA|GB|GD|GE|GF|GG|GH|GI|GL|GM|GN|GOV|GP|GQ|GR|GS|GT|GU|GW|GY|HK|HM|HN|HR|HT|HU|ID|IE|IL|IM|IN|INFO|INT|IO|IQ|IR|IS|IT|JE|JM|JO|JOBS|JP|KE|KG|KH|KI|KM|KN|KP|KR|KW|KY|KZ|LA|LB|LC|LI|LK|LR|LS|LT|LU|LV|LY|MA|MC|MD|ME|MG|MH|MIL|MK|ML|MM|MN|MO|MOBI|MP|MQ|MR|MS|MT|MU|MUSEUM|MV|MW|MX|MY|MZ|NA|NAME|NC|NE|NET|NF|NG|NI|NL|NO|NP|NR|NU|NZ|OM|ORG|PA|PE|PF|PG|PH|PK|PL|PM|PN|PR|PRO|PS|PT|PW|PY|QA|RE|RO|RS|RU|RW|SA|SB|SC|SD|SE|SG|SH|SI|SJ|SK|SL|SM|SN|SO|SR|ST|SU|SV|SY|SZ|TC|TD|TEL|TF|TG|TH|TJ|TK|TL|TM|TN|TO|TP|TR|TRAVEL|TT|TV|TW|TZ|UA|UG|UK|US|UY|UZ|VA|VC|VE|VG|VI|VN|VU|WF|WS|XN--0ZWM56D|测试|XN--11B5BS3A9AJ6G|परीक्षा|XN--80AKHBYKNJ4F|испытание|XN--9T4B11YI5A|테스트|XN--DEBA0AD|טעסט|XN--G6W251D|測試|XN--HGBK6AJ7F53BBA|آزمایشی|XN--HLCJ6AYA9ESC7A|பரிட்சை|XN--JXALPDLP|δοκιμή|XN--KGBECHTV|إختبار|XN--ZCKZAH|テスト|YE|YT|YU|ZA|ZM|ZW|local|loc|onion)'.
+ ')(?![\pN\pL\-\_])'.
')'.
'(?:'.
- '$|(?:'.
- '/[^\s\(\)\[\]\{\}]*'.
- ')'.
- ')'.
+ '(?:\:\d+)?'. //:port
+ '(?:/[\pN\pL$\[\]\,\!\(\)\.\-\_\+\/\=\&\;]*)?'. // /path
+ '(?:\?[\pN\pL\$\[\]\,\!\(\)\.\-\_\+\/\=\&\;\/]*)?'. // ?query string
+ '(?:\#[\pN\pL$\[\]\,\!\(\)\.\-\_\+\/\=\&\;\/\?\#]*)?'. // #fragment
+ ')(?<![\?\.\,\#\,])'.
')'.
- '#ix';
+ '#ixu';
+ preg_match_all($regex,$text,$matches);
+ //print_r($matches);
return preg_replace_callback($regex, curry(callback_helper,$callback,$notice_id) ,$text);
}
function callback_helper($matches, $callback, $notice_id) {
- $pos = strpos($matches[0],$matches[1]);
- $left = substr($matches[0],0,$pos);
- $right = substr($matches[0],$pos+strlen($matches[1]));
+ $url=$matches['url'];
+ $left = strpos($matches[0],$url);
+ $right = $left+strlen($url);
+
+ $groupSymbolSets=array(
+ array(
+ 'left'=>'(',
+ 'right'=>')'
+ ),
+ array(
+ 'left'=>'[',
+ 'right'=>']'
+ ),
+ array(
+ 'left'=>'{',
+ 'right'=>'}'
+ )
+ );
+ $cannotEndWith=array('.','?',',','#');
+ $original_url=$url;
+ do{
+ $original_url=$url;
+ foreach($groupSymbolSets as $groupSymbolSet){
+ if(substr($url,-1)==$groupSymbolSet['right']){
+ $group_left_count = substr_count($url,$groupSymbolSet['left']);
+ $group_right_count = substr_count($url,$groupSymbolSet['right']);
+ if($group_left_count<$group_right_count){
+ $right-=1;
+ $url=substr($url,0,-1);
+ }
+ }
+ }
+ if(in_array(substr($url,-1),$cannotEndWith)){
+ $right-=1;
+ $url=substr($url,0,-1);
+ }
+ }while($original_url!=$url);
+
+
if(empty($notice_id)){
- $result = call_user_func_array($callback,$matches[1]);
+ $result = call_user_func_array($callback,$url);
}else{
- $result = call_user_func_array($callback, array($matches[1],$notice_id) );
+ $result = call_user_func_array($callback, array($url,$notice_id) );
}
- return $left . $result . $right;
+ return substr($matches[0],0,$left) . $result . substr($matches[0],$right);
}
function curry($fn) {
diff --git a/plugins/TemplatePlugin.php b/plugins/TemplatePlugin.php
index 03daf6219..6c14f1988 100644
--- a/plugins/TemplatePlugin.php
+++ b/plugins/TemplatePlugin.php
@@ -198,13 +198,13 @@ class TemplatePlugin extends Plugin {
// unless laconica config:
// $config['template']['mode'] = 'html';
if (!(common_config('template', 'mode') == 'html')) {
- $tpl_file = 'tpl/index.php';
+ $tpl_file = $this->templateFolder() . '/index.php';
$tags = array_merge($vars,$this->blocks);
include $tpl_file;
return;
}
- $tpl_file = 'tpl/index.html';
+ $tpl_file = $this->templateFolder() . '/index.html';
// read the static template
$output = file_get_contents( $tpl_file );
@@ -236,6 +236,9 @@ class TemplatePlugin extends Plugin {
return true;
}
+ function templateFolder() {
+ return 'tpl';
+ }
// catching the StartShowHTML event to halt the rendering
function onStartShowHTML( &$act ) {
@@ -300,7 +303,7 @@ class TemplateAction extends Action
$this->clientError(_('only User #1 can update the template'), $code = 401);
// open the old template
- $tpl_file = 'tpl/index.html';
+ $tpl_file = $this->templateFolder() . '/index.html';
$fp = fopen( $tpl_file, 'w+' );
// overwrite with the new template
diff --git a/tests/HashTagDetectionTest.php b/tests/HashTagDetectionTest.php
new file mode 100644
index 000000000..901e0611c
--- /dev/null
+++ b/tests/HashTagDetectionTest.php
@@ -0,0 +1,47 @@
+<?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__) . '/..'));
+define('LACONICA', true);
+
+require_once INSTALLDIR . '/lib/common.php';
+
+class HashTagDetectionTest extends PHPUnit_Framework_TestCase
+{
+ /**
+ * @dataProvider provider
+ *
+ */
+ public function testProduction($content, $expected)
+ {
+ $rendered = common_render_text($content);
+ $this->assertEquals($expected, $rendered);
+ }
+
+ static public function provider()
+ {
+ return array(
+ array('hello',
+ 'hello'),
+ array('#hello people',
+ '#<span class="tag"><a href="' . common_local_url('tag', array('tag' => common_canonical_tag('hello'))) . '" rel="tag">hello</a></span> people'),
+ array('"#hello" people',
+ '&quot;#<span class="tag"><a href="' . common_local_url('tag', array('tag' => common_canonical_tag('hello'))) . '" rel="tag">hello</a></span>&quot; people'),
+ array('say "#hello" people',
+ 'say &quot;#<span class="tag"><a href="' . common_local_url('tag', array('tag' => common_canonical_tag('hello'))) . '" rel="tag">hello</a></span>&quot; people'),
+ array('say (#hello) people',
+ 'say (#<span class="tag"><a href="' . common_local_url('tag', array('tag' => common_canonical_tag('hello'))) . '" rel="tag">hello</a></span>) people'),
+ array('say [#hello] people',
+ 'say [#<span class="tag"><a href="' . common_local_url('tag', array('tag' => common_canonical_tag('hello'))) . '" rel="tag">hello</a></span>] people'),
+ array('say {#hello} people',
+ 'say {#<span class="tag"><a href="' . common_local_url('tag', array('tag' => common_canonical_tag('hello'))) . '" rel="tag">hello</a></span>} people'),
+ array('say \'#hello\' people',
+ 'say \'#<span class="tag"><a href="' . common_local_url('tag', array('tag' => common_canonical_tag('hello'))) . '" rel="tag">hello</a></span>\' people'),
+ );
+ }
+}
+
diff --git a/tests/URLDetectionTest.php b/tests/URLDetectionTest.php
index f35b03eaf..7b2e8c5ae 100644
--- a/tests/URLDetectionTest.php
+++ b/tests/URLDetectionTest.php
@@ -25,158 +25,214 @@ class URLDetectionTest extends PHPUnit_Framework_TestCase
static public function provider()
{
return array(
+ array('http://127.0.0.1',
+ '<a href="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>'),
+ array('127.0.0.1:99',
+ '<a href="http://127.0.0.1:99/" rel="external">127.0.0.1:99</a>'),
+ array('127.0.0.1/test.php',
+ '<a href="http://127.0.0.1/test.php" rel="external">127.0.0.1/test.php</a>'),
+ array('http://[::1]:99/test.php',
+ '<a href="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>'),
+ array('http://::1',
+ '<a href="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>'),
+ 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>'),
+ 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>'),
+ array('http://127.0.0.1',
+ '<a href="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>'),
+ array('example.com',
+ '<a href="http://example.com/" rel="external">example.com</a>'),
+ array('http://example.com',
+ '<a href="http://example.com/" rel="external">http://example.com</a>'),
+ array('http://example.com.',
+ '<a href="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>'),
+ array('user_name+other@example.com',
+ '<a href="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>'),
+ array('mailto:user@example.com?subject=test',
+ '<a href="mailto:user@example.com?subject=test" rel="external">mailto:user@example.com?subject=test</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',
+ '#<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>'),
array('http://example',
- 'http://example'),
+ '<a href="http://example/" rel="external">http://example</a>'),
+ array('http://3xampl3',
+ '<a href="http://3xampl3/" rel="external">http://3xampl3</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://example.com:8080/test.php',
+ '<a href="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>'),
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&amp;bar=foo" rel="external">http://example.com/path.php?foo=bar&amp;bar=foo</a>'),
+ array('http://example.com.',
+ '<a href="http://example.com/" rel="external">http://example.com</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&#xFC;ll&#xE4;r&#xF6;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://&#xFEB1;&#xFEB2;&#xFEB7;.com/" rel="external">http://ﺱﺲﺷ.com</a>'),
array('http://сделаткартинки.com',
- '<a href="http://сделаткартинки.com" class="extlink">http://сделаткартинки.com</a>'),
+ '<a href="http://&#x441;&#x434;&#x435;&#x43B;&#x430;&#x442;&#x43A;&#x430;&#x440;&#x442;&#x438;&#x43D;&#x43A;&#x438;.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&#x16B;dali&#x146;.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&#xE6;ndendek&#xE6;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://&#x3042;&#x30FC;&#x308B;&#x3044;&#x3093;.com/" rel="external">http://あーるいん.com</a>'),
array('http://예비교사.com',
- '<a href="http://예비교사.com" class="extlink">http://예비교사.com</a>'),
+ '<a href="http://&#xC608;&#xBE44;&#xAD50;&#xC0AC;.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>"'),
- array('http://example.com ',
- '<a href="http://example.com" class="extlink">http://example.com</a>'),
+ '&quot;<a href="http://example.com/" rel="external">http://example.com</a>&quot;'),
+ array('http://example.com',
+ '<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>>'),
+ '&lt;<a href="http://example.com/" rel="external">http://example.com</a>&gt;'),
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>'),
+ //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]" 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>.)?'),
+ //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)" 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>"'),
- array('example.com ',
- '<a href="http://example.com" class="extlink">example.com</a>'),
+ '&quot;<a href="http://example.com/" rel="external">example.com</a>&quot;'),
+ array('example.com',
+ '<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>>'),
+ '&lt;<a href="http://example.com/" rel="external">example.com</a>&gt;'),
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',
diff --git a/tpl/index.php b/tpl/index.php
index be375e75a..36a161144 100644
--- a/tpl/index.php
+++ b/tpl/index.php
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html>
+<?php echo '<?';?>xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title><?php echo section('title'); ?></title>