diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Twig')
-rw-r--r-- | src/Wallabag/CoreBundle/Twig/WallabagExtension.php | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/Wallabag/CoreBundle/Twig/WallabagExtension.php b/src/Wallabag/CoreBundle/Twig/WallabagExtension.php index 00b1e595..536185d4 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 | |||
28 | { | 28 | { |
29 | return [ | 29 | return [ |
30 | new \Twig_SimpleFilter('removeWww', [$this, 'removeWww']), | 30 | new \Twig_SimpleFilter('removeWww', [$this, 'removeWww']), |
31 | new \Twig_SimpleFilter('removeScheme', [$this, 'removeScheme']), | ||
31 | new \Twig_SimpleFilter('removeSchemeAndWww', [$this, 'removeSchemeAndWww']), | 32 | new \Twig_SimpleFilter('removeSchemeAndWww', [$this, 'removeSchemeAndWww']), |
32 | ]; | 33 | ]; |
33 | } | 34 | } |
@@ -46,11 +47,14 @@ class WallabagExtension extends \Twig_Extension implements \Twig_Extension_Globa | |||
46 | return preg_replace('/^www\./i', '', $url); | 47 | return preg_replace('/^www\./i', '', $url); |
47 | } | 48 | } |
48 | 49 | ||
50 | public function removeScheme($url) | ||
51 | { | ||
52 | return preg_replace('#^https?://#i', '', $url); | ||
53 | } | ||
54 | |||
49 | public function removeSchemeAndWww($url) | 55 | public function removeSchemeAndWww($url) |
50 | { | 56 | { |
51 | return $this->removeWww( | 57 | return $this->removeWww($this->removeScheme($url)); |
52 | preg_replace('@^https?://@i', '', $url) | ||
53 | ); | ||
54 | } | 58 | } |
55 | 59 | ||
56 | /** | 60 | /** |