2015-09-29 22:59:44 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Wallabag\CoreBundle\Twig;
|
|
|
|
|
|
|
|
|
|
class WallabagExtension extends \Twig_Extension
|
|
|
|
|
{
|
|
|
|
|
public function getFilters()
|
|
|
|
|
{
|
2016-04-12 11:36:01 +02:00
|
|
|
return [
|
|
|
|
|
new \Twig_SimpleFilter('removeWww', [$this, 'removeWww']),
|
|
|
|
|
];
|
2015-09-29 22:59:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function removeWww($url)
|
|
|
|
|
{
|
2015-10-01 09:26:52 +02:00
|
|
|
return preg_replace('/^www\./i', '', $url);
|
2015-09-29 22:59:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getName()
|
|
|
|
|
{
|
|
|
|
|
return 'wallabag_extension';
|
|
|
|
|
}
|
|
|
|
|
}
|