aboutsummaryrefslogblamecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Twig/Extension/WallabagExtension.php
blob: 5f0a9643436b71c5ca51ff7c2147beb30df6ba09 (plain) (tree)
1
2
3
4
5
6
7
8
9

     
                                             





                                               




                                                                                
                                         

                  
      






                                              



                                    
 
<?php

namespace Wallabag\CoreBundle\Twig\Extension;

class WallabagExtension extends \Twig_Extension
{
    public function getFilters()
    {
        return array(
            new \Twig_SimpleFilter('domainName', array($this, 'getDomainName')),
        );
    }

    /**
     * Returns the domain name for a URL.
     *
     * @param $url
     *
     * @return string
     */
    public static function getDomainName($url)
    {
        return parse_url($url, PHP_URL_HOST);
    }

    public function getName()
    {
        return 'wallabag_extension';
    }
}