adding sms as protocol

This commit is contained in:
euromark 2012-08-01 12:38:06 +02:00
parent 2a674fc461
commit b6fe8af701
3 changed files with 16 additions and 1 deletions

View file

@ -833,7 +833,8 @@ class Router {
(strpos($url, '://') !== false || (strpos($url, '://') !== false ||
(strpos($url, 'javascript:') === 0) || (strpos($url, 'javascript:') === 0) ||
(strpos($url, 'mailto:') === 0) || (strpos($url, 'mailto:') === 0) ||
(strpos($url, 'tel:') === 0)) || (strpos($url, 'tel:') === 0) ||
(strpos($url, 'sms:') === 0)) ||
(!strncmp($url, '#', 1)) (!strncmp($url, '#', 1))
) { ) {
return $url; return $url;

View file

@ -2485,8 +2485,14 @@ class RouterTest extends CakeTestCase {
$url = '://example.com'; $url = '://example.com';
$this->assertEquals($url, Router::url($url)); $this->assertEquals($url, Router::url($url));
$url = 'javascript:void(0)';
$this->assertEquals($url, Router::url($url));
$url = 'tel:012345-678'; $url = 'tel:012345-678';
$this->assertEquals($url, Router::url($url)); $this->assertEquals($url, Router::url($url));
$url = 'sms:012345-678';
$this->assertEquals($url, Router::url($url));
} }
/** /**

View file

@ -349,6 +349,14 @@ class HtmlHelperTest extends CakeTestCase {
$result = $this->Html->link('call me on 0123465-798', 'tel:0123465-798'); $result = $this->Html->link('call me on 0123465-798', 'tel:0123465-798');
$expected = array('a' => array('href' => 'tel:0123465-798'), 'call me on 0123465-798', '/a'); $expected = array('a' => array('href' => 'tel:0123465-798'), 'call me on 0123465-798', '/a');
$this->assertTags($result, $expected); $this->assertTags($result, $expected);
$result = $this->Html->link('text me on 0123465-798', 'sms:0123465-798');
$expected = array('a' => array('href' => 'sms:0123465-798'), 'text me on 0123465-798', '/a');
$this->assertTags($result, $expected);
$result = $this->Html->link('say hello to 0123465-798', 'sms:0123465-798?body=hello there');
$expected = array('a' => array('href' => 'sms:0123465-798?body=hello there'), 'say hello to 0123465-798', '/a');
$this->assertTags($result, $expected);
} }
/** /**