diff options
Diffstat (limited to 'application')
-rwxr-xr-x[-rw-r--r--] | application/Url.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/application/Url.php b/application/Url.php index 23356f39..02a4395d 100644..100755 --- a/application/Url.php +++ b/application/Url.php | |||
@@ -81,6 +81,10 @@ class Url | |||
81 | public function __construct($url) | 81 | public function __construct($url) |
82 | { | 82 | { |
83 | $this->parts = parse_url($url); | 83 | $this->parts = parse_url($url); |
84 | |||
85 | if (!empty($url) && empty($this->parts['scheme'])) { | ||
86 | $this->parts['scheme'] = 'http'; | ||
87 | } | ||
84 | } | 88 | } |
85 | 89 | ||
86 | /** | 90 | /** |
@@ -147,4 +151,16 @@ class Url | |||
147 | $this->cleanupFragment(); | 151 | $this->cleanupFragment(); |
148 | return $this->__toString(); | 152 | return $this->__toString(); |
149 | } | 153 | } |
154 | |||
155 | /** | ||
156 | * Get URL scheme. | ||
157 | * | ||
158 | * @return string the URL scheme or false if none is provided. | ||
159 | */ | ||
160 | public function getScheme() { | ||
161 | if (!isset($this->parts['scheme'])) { | ||
162 | return false; | ||
163 | } | ||
164 | return $this->parts['scheme']; | ||
165 | } | ||
150 | } | 166 | } |