diff options
author | Thomas Citharel <tcit@tcit.fr> | 2015-09-29 23:23:58 +0200 |
---|---|---|
committer | Thomas Citharel <tcit@tcit.fr> | 2015-09-29 23:23:58 +0200 |
commit | d2755b1c30318f370e7e903ebbd9d34bca11d939 (patch) | |
tree | 6ec37fb78b74fcf6eb6e4c5b61d2c58bc80dabd7 /src/Wallabag/CoreBundle/Twig/WallabagExtension.php | |
parent | 917040d4a0b7694ca4f695c02243ffb4283d6901 (diff) | |
parent | 2afdea1ccc69e390758559133479eba1e49ec561 (diff) | |
download | wallabag-d2755b1c30318f370e7e903ebbd9d34bca11d939.tar.gz wallabag-d2755b1c30318f370e7e903ebbd9d34bca11d939.tar.zst wallabag-d2755b1c30318f370e7e903ebbd9d34bca11d939.zip |
Merge pull request #1440 from wallabag/v2-fix-1433
fix #1433: remove www. on entries view
Diffstat (limited to 'src/Wallabag/CoreBundle/Twig/WallabagExtension.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Twig/WallabagExtension.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Twig/WallabagExtension.php b/src/Wallabag/CoreBundle/Twig/WallabagExtension.php new file mode 100644 index 00000000..f8328860 --- /dev/null +++ b/src/Wallabag/CoreBundle/Twig/WallabagExtension.php | |||
@@ -0,0 +1,23 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\CoreBundle\Twig; | ||
4 | |||
5 | class WallabagExtension extends \Twig_Extension | ||
6 | { | ||
7 | public function getFilters() | ||
8 | { | ||
9 | return array( | ||
10 | new \Twig_SimpleFilter('removeWww', array($this, 'removeWww')), | ||
11 | ); | ||
12 | } | ||
13 | |||
14 | public function removeWww($url) | ||
15 | { | ||
16 | return preg_replace('/^www\./i', '',$url); | ||
17 | } | ||
18 | |||
19 | public function getName() | ||
20 | { | ||
21 | return 'wallabag_extension'; | ||
22 | } | ||
23 | } | ||