From b6fe8af70194e93be61493f435b9d880e369d0c0 Mon Sep 17 00:00:00 2001
From: euromark <euromark@web.de>
Date: Wed, 1 Aug 2012 12:38:06 +0200
Subject: [PATCH] adding sms as protocol

---
 lib/Cake/Routing/Router.php                       | 3 ++-
 lib/Cake/Test/Case/Routing/RouterTest.php         | 6 ++++++
 lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php | 8 ++++++++
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/lib/Cake/Routing/Router.php b/lib/Cake/Routing/Router.php
index b33f14c6a..19d0b95c6 100644
--- a/lib/Cake/Routing/Router.php
+++ b/lib/Cake/Routing/Router.php
@@ -833,7 +833,8 @@ class Router {
 				(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;
diff --git a/lib/Cake/Test/Case/Routing/RouterTest.php b/lib/Cake/Test/Case/Routing/RouterTest.php
index 7e7fffca8..512ab0565 100644
--- a/lib/Cake/Test/Case/Routing/RouterTest.php
+++ b/lib/Cake/Test/Case/Routing/RouterTest.php
@@ -2485,8 +2485,14 @@ class RouterTest extends CakeTestCase {
 		$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));
 	}
 
 /**
diff --git a/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php b/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php
index bbf5a65d5..0bb8e93bb 100644
--- a/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php
+++ b/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php
@@ -349,6 +349,14 @@ class HtmlHelperTest extends CakeTestCase {
 		$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);
 	}
 
 /**