diff options
author | VirtualTam <virtualtam@flibidi.net> | 2016-01-11 21:47:00 +0100 |
---|---|---|
committer | VirtualTam <virtualtam@flibidi.net> | 2016-01-11 21:47:00 +0100 |
commit | 92ba7b573f2833bd35c7eb2fc7fdbeb1a0ac7b44 (patch) | |
tree | 787f6d8fdabe8ea2fc0c37b61d616e667cdfbda5 /application/Url.php | |
parent | c0a50f3663e207d5df007e0fa321219c1b32d6ea (diff) | |
parent | 1557cefbd76257ceb830f65806831b490faf0acc (diff) | |
download | Shaarli-92ba7b573f2833bd35c7eb2fc7fdbeb1a0ac7b44.tar.gz Shaarli-92ba7b573f2833bd35c7eb2fc7fdbeb1a0ac7b44.tar.zst Shaarli-92ba7b573f2833bd35c7eb2fc7fdbeb1a0ac7b44.zip |
Merge pull request #432 from ArthurHoaro/title-retrieve
Fixes #410 - Retrieve title fails in multiple cases
Diffstat (limited to 'application/Url.php')
-rwxr-xr-x[-rw-r--r--] | application/Url.php | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/application/Url.php b/application/Url.php index d80c9c58..a4ac2e73 100644..100755 --- a/application/Url.php +++ b/application/Url.php | |||
@@ -118,7 +118,7 @@ class Url | |||
118 | */ | 118 | */ |
119 | public function __construct($url) | 119 | public function __construct($url) |
120 | { | 120 | { |
121 | $this->parts = parse_url($url); | 121 | $this->parts = parse_url(trim($url)); |
122 | 122 | ||
123 | if (!empty($url) && empty($this->parts['scheme'])) { | 123 | if (!empty($url) && empty($this->parts['scheme'])) { |
124 | $this->parts['scheme'] = 'http'; | 124 | $this->parts['scheme'] = 'http'; |
@@ -201,4 +201,13 @@ class Url | |||
201 | } | 201 | } |
202 | return $this->parts['scheme']; | 202 | return $this->parts['scheme']; |
203 | } | 203 | } |
204 | |||
205 | /** | ||
206 | * Test if the Url is an HTTP one. | ||
207 | * | ||
208 | * @return true is HTTP, false otherwise. | ||
209 | */ | ||
210 | public function isHttp() { | ||
211 | return strpos(strtolower($this->parts['scheme']), 'http') !== false; | ||
212 | } | ||
204 | } | 213 | } |