Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

adding sms as protocol

  • Loading branch information...
commit b6fe8af70194e93be61493f435b9d880e369d0c0 1 parent 2a674fc
@dereuromark dereuromark authored
View
3  lib/Cake/Routing/Router.php
@@ -833,7 +833,8 @@ public static function url($url = null, $full = false) {
(strpos($url, '://') !== false ||
(strpos($url, 'javascript:') === 0) ||
(strpos($url, 'mailto:') === 0) ||
- (strpos($url, 'tel:') === 0)) ||
+ (strpos($url, 'tel:') === 0) ||
+ (strpos($url, 'sms:') === 0)) ||
(!strncmp($url, '#', 1))
) {
return $url;
View
6 lib/Cake/Test/Case/Routing/RouterTest.php
@@ -2485,8 +2485,14 @@ public function testUrlProtocol() {
$url = '://example.com';
$this->assertEquals($url, Router::url($url));
+ $url = 'javascript:void(0)';
+ $this->assertEquals($url, Router::url($url));
+
$url = 'tel:012345-678';
$this->assertEquals($url, Router::url($url));
+
+ $url = 'sms:012345-678';
+ $this->assertEquals($url, Router::url($url));
}
/**
View
8 lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php
@@ -349,6 +349,14 @@ public function testLink() {
$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');
$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);
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.