Piwik\Twig::__construct PHP Метод

__construct() публичный Метод

public __construct ( )
    public function __construct()
    {
        $loader = $this->getDefaultThemeLoader();
        $this->addPluginNamespaces($loader);
        //get current theme
        $manager = Plugin\Manager::getInstance();
        $theme = $manager->getThemeEnabled();
        $loaders = array();
        $this->formatter = new Formatter();
        //create loader for custom theme to overwrite twig templates
        if ($theme && $theme->getPluginName() != \Piwik\Plugin\Manager::DEFAULT_THEME) {
            $customLoader = $this->getCustomThemeLoader($theme);
            if ($customLoader) {
                //make it possible to overwrite plugin templates
                $this->addCustomPluginNamespaces($customLoader, $theme->getPluginName());
                $loaders[] = $customLoader;
            }
        }
        $loaders[] = $loader;
        $chainLoader = new Twig_Loader_Chain($loaders);
        // Create new Twig Environment and set cache dir
        $templatesCompiledPath = StaticContainer::get('path.tmp') . '/templates_c';
        $this->twig = new Twig_Environment($chainLoader, array('debug' => true, 'strict_variables' => true, 'cache' => $templatesCompiledPath));
        $this->twig->addExtension(new Twig_Extension_Debug());
        $this->twig->clearTemplateCache();
        $this->addFilter_translate();
        $this->addFilter_urlRewriteWithParameters();
        $this->addFilter_sumTime();
        $this->addFilter_money();
        $this->addFilter_truncate();
        $this->addFilter_notification();
        $this->addFilter_percent();
        $this->addFilter_percentage();
        $this->addFilter_percentEvolution();
        $this->addFilter_prettyDate();
        $this->addFilter_safeDecodeRaw();
        $this->addFilter_number();
        $this->addFilter_nonce();
        $this->addFilter_md5();
        $this->addFilter_onlyDomain();
        $this->twig->addFilter(new Twig_SimpleFilter('implode', 'implode'));
        $this->twig->addFilter(new Twig_SimpleFilter('ucwords', 'ucwords'));
        $this->twig->addFilter(new Twig_SimpleFilter('lcfirst', 'lcfirst'));
        $this->addFunction_includeAssets();
        $this->addFunction_linkTo();
        $this->addFunction_sparkline();
        $this->addFunction_postEvent();
        $this->addFunction_isPluginLoaded();
        $this->addFunction_getJavascriptTranslations();
        $this->twig->addTokenParser(new RenderTokenParser());
        $this->addTest_false();
        $this->addTest_true();
        $this->addTest_emptyString();
        $this->twig->addExtension(new PiwikTwigFilterExtension());
    }