/** * Constructor. * * @param \phpbb\path_helper $path_helper * @param \phpbb\config\config $config * @param \phpbb\template\context $context template context * @param \phpbb\template\twig\environment $twig_environment * @param string $cache_path * @param \phpbb\user|null $user * @param array|\ArrayAccess $extensions * @param \phpbb\extension\manager $extension_manager extension manager, if null then template events will not be invoked */ public function __construct(\phpbb\path_helper $path_helper, $config, \phpbb\template\context $context, \phpbb\template\twig\environment $twig_environment, $cache_path, \phpbb\user $user = null, $extensions = array(), \phpbb\extension\manager $extension_manager = null) { $this->path_helper = $path_helper; $this->phpbb_root_path = $path_helper->get_phpbb_root_path(); $this->php_ext = $path_helper->get_php_ext(); $this->config = $config; $this->user = $user; $this->context = $context; $this->extension_manager = $extension_manager; $this->cachepath = $cache_path; $this->twig = $twig_environment; foreach ($extensions as $extension) { $this->twig->addExtension($extension); } // Add admin namespace if ($this->path_helper->get_adm_relative_path() !== null && is_dir($this->phpbb_root_path . $this->path_helper->get_adm_relative_path() . 'style/')) { $this->twig->getLoader()->setPaths($this->phpbb_root_path . $this->path_helper->get_adm_relative_path() . 'style/', 'admin'); } }
public function __construct(\phpbb\path_helper $path_helper, $config, $user, \phpbb\template\context $context, \phpbb\extension\manager $extension_manager = null) { $this->path_helper = $path_helper; $this->phpbb_root_path = $path_helper->get_phpbb_root_path(); $this->php_ext = $path_helper->get_php_ext(); $this->config = $config; $this->user = $user; $this->context = $context; $this->extension_manager = $extension_manager; $this->cachepath = $this->phpbb_root_path . 'cache/twig/'; // Initiate the loader, __main__ namespace paths will be setup later in set_style_names() $loader = new \phpbb\template\twig\loader(''); $this->twig = new \phpbb\template\twig\environment($this->config, $this->path_helper, $this->extension_manager, $loader, array('cache' => defined('IN_INSTALL') ? false : $this->cachepath, 'debug' => defined('DEBUG'), 'auto_reload' => (bool) $this->config['load_tplcompile'], 'autoescape' => false)); $this->twig->addExtension(new \phpbb\template\twig\extension($this->context, $this->user)); // Initialize Gantry. $style = 'gantry'; $this->gantry = (require_once $this->phpbb_root_path . "styles/{$style}/gantry.php"); $this->gantry['streams']; $this->gantry['theme']->add_to_twig($this->twig); if (defined('ADMIN_START')) { // We are in admin. define('GANTRYADMIN_PATH', GANTRY5_ROOT . '/ext/rockettheme/gantry'); $this->gantry['admin.theme'] = function () { return new \Gantry\Admin\Theme(GANTRYADMIN_PATH); }; // Boot the service. $this->gantry['admin.theme']; } // Initialize lexer. $lexer = new \phpbb\template\twig\lexer($this->twig); $this->twig->setLexer($lexer); // Add admin namespace if ($this->path_helper->get_adm_relative_path() !== null && is_dir($this->phpbb_root_path . $this->path_helper->get_adm_relative_path() . 'style/')) { $this->twig->getLoader()->setPaths($this->phpbb_root_path . $this->path_helper->get_adm_relative_path() . 'style/', 'admin'); } }
/** * Constructor. * * @param \phpbb\path_helper $path_helper * @param \phpbb\config\config $config * @param \phpbb\user $user * @param \phpbb\template\context $context template context * @param \phpbb\extension\manager $extension_manager extension manager, if null then template events will not be invoked */ public function __construct(\phpbb\path_helper $path_helper, $config, $user, \phpbb\template\context $context, \phpbb\extension\manager $extension_manager = null) { $this->path_helper = $path_helper; $this->phpbb_root_path = $path_helper->get_phpbb_root_path(); $this->php_ext = $path_helper->get_php_ext(); $this->config = $config; $this->user = $user; $this->context = $context; $this->extension_manager = $extension_manager; $this->cachepath = $this->phpbb_root_path . 'cache/twig/'; // Initiate the loader, __main__ namespace paths will be setup later in set_style_names() $loader = new \phpbb\template\twig\loader(''); $this->twig = new \phpbb\template\twig\environment($this->config, $this->path_helper, $this->extension_manager, $loader, array('cache' => defined('IN_INSTALL') ? false : $this->cachepath, 'debug' => defined('DEBUG'), 'auto_reload' => (bool) $this->config['load_tplcompile'], 'autoescape' => false)); $this->twig->addExtension(new \phpbb\template\twig\extension($this->context, $this->user)); if (defined('DEBUG')) { $this->twig->addExtension(new \Twig_Extension_Debug()); } $lexer = new \phpbb\template\twig\lexer($this->twig); $this->twig->setLexer($lexer); // Add admin namespace if ($this->path_helper->get_adm_relative_path() !== null && is_dir($this->phpbb_root_path . $this->path_helper->get_adm_relative_path() . 'style/')) { $this->twig->getLoader()->setPaths($this->phpbb_root_path . $this->path_helper->get_adm_relative_path() . 'style/', 'admin'); } }