X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FTwig%2FWallabagExtension.php;h=61107ce725437e218c784893f792bdac70516412;hb=531c8d0a5c55fa93438e227a7d349235fbd31d28;hp=00b1e595499d05f79de855e460a7a863af8a00a6;hpb=522e37ad274361dde697da13a92ff3f846599822;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Twig/WallabagExtension.php b/src/Wallabag/CoreBundle/Twig/WallabagExtension.php index 00b1e595..61107ce7 100644 --- a/src/Wallabag/CoreBundle/Twig/WallabagExtension.php +++ b/src/Wallabag/CoreBundle/Twig/WallabagExtension.php @@ -28,6 +28,7 @@ class WallabagExtension extends \Twig_Extension implements \Twig_Extension_Globa { return [ new \Twig_SimpleFilter('removeWww', [$this, 'removeWww']), + new \Twig_SimpleFilter('removeScheme', [$this, 'removeScheme']), new \Twig_SimpleFilter('removeSchemeAndWww', [$this, 'removeSchemeAndWww']), ]; } @@ -46,11 +47,14 @@ class WallabagExtension extends \Twig_Extension implements \Twig_Extension_Globa return preg_replace('/^www\./i', '', $url); } + public function removeScheme($url) + { + return preg_replace('#^https?://#i', '', $url); + } + public function removeSchemeAndWww($url) { - return $this->removeWww( - preg_replace('@^https?://@i', '', $url) - ); + return $this->removeWww($this->removeScheme($url) } /**