aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/Url.php
diff options
context:
space:
mode:
authorVirtualTam <virtualtam@flibidi.net>2015-08-31 20:31:41 +0200
committerVirtualTam <virtualtam@flibidi.net>2015-08-31 20:31:41 +0200
commit6211c498f6e0bdc6d86152e9777bcc75955a5ec4 (patch)
treef7b48317044c151609b9d8e7d476cc5014916245 /application/Url.php
parentce8e248ab04a035c2824bee6af91aed49d623a6a (diff)
parent26c503460cd2b50c2c122dba73d62e09ee04b9c8 (diff)
downloadShaarli-6211c498f6e0bdc6d86152e9777bcc75955a5ec4.tar.gz
Shaarli-6211c498f6e0bdc6d86152e9777bcc75955a5ec4.tar.zst
Shaarli-6211c498f6e0bdc6d86152e9777bcc75955a5ec4.zip
Merge pull request #326 from ArthurHoaro/bug-url
Fixes #325 - Shaarli does not recognize saved links
Diffstat (limited to 'application/Url.php')
-rwxr-xr-x[-rw-r--r--]application/Url.php16
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}