diff options
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 | } | ||