X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=application%2FUrl.php;h=a4ac2e73cad2537ab28cd6bb604356bd311d14d7;hb=1557cefbd76257ceb830f65806831b490faf0acc;hp=d80c9c582f32e5e8b8053b291d354a112e21b6c0;hpb=c0a50f3663e207d5df007e0fa321219c1b32d6ea;p=github%2Fshaarli%2FShaarli.git diff --git a/application/Url.php b/application/Url.php old mode 100644 new mode 100755 index d80c9c58..a4ac2e73 --- a/application/Url.php +++ b/application/Url.php @@ -118,7 +118,7 @@ class Url */ public function __construct($url) { - $this->parts = parse_url($url); + $this->parts = parse_url(trim($url)); if (!empty($url) && empty($this->parts['scheme'])) { $this->parts['scheme'] = 'http'; @@ -201,4 +201,13 @@ class Url } return $this->parts['scheme']; } + + /** + * Test if the Url is an HTTP one. + * + * @return true is HTTP, false otherwise. + */ + public function isHttp() { + return strpos(strtolower($this->parts['scheme']), 'http') !== false; + } }