X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=application%2FUrl.php;h=a4ac2e73cad2537ab28cd6bb604356bd311d14d7;hb=fc17813bd1888aeace1e74a15c10ba79043a87f8;hp=d80c9c582f32e5e8b8053b291d354a112e21b6c0;hpb=938d9cce77ed5098dd69643795cb4014f3688b35;p=github%2Fshaarli%2FShaarli.git diff --git a/application/Url.php b/application/Url.php index d80c9c58..a4ac2e73 100644 --- 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; + } }