aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Twig
diff options
context:
space:
mode:
authorJérémy Benoist <j0k3r@users.noreply.github.com>2019-05-29 11:14:00 +0200
committerGitHub <noreply@github.com>2019-05-29 11:14:00 +0200
commit73ec68b1ffafb792265a3805833e5cd84c966aed (patch)
tree33c6040c050f85c537f8dbf5e91d8c281db092cd /src/Wallabag/CoreBundle/Twig
parent2ba365c7c49556cd23b444dc3bb8d4a8cf08809d (diff)
parent2cbee36a0184786644470a84fdd8c720cfcac58e (diff)
downloadwallabag-73ec68b1ffafb792265a3805833e5cd84c966aed.tar.gz
wallabag-73ec68b1ffafb792265a3805833e5cd84c966aed.tar.zst
wallabag-73ec68b1ffafb792265a3805833e5cd84c966aed.zip
Merge pull request #3984 from wallabag/2.4
Merge 2.4 into master
Diffstat (limited to 'src/Wallabag/CoreBundle/Twig')
-rw-r--r--src/Wallabag/CoreBundle/Twig/WallabagExtension.php10
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 /**