diff options
Diffstat (limited to 'phpBB/phpbb/template/twig/twig.php')
-rw-r--r-- | phpBB/phpbb/template/twig/twig.php | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/phpBB/phpbb/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php index 4856dd483e..2da7405743 100644 --- a/phpBB/phpbb/template/twig/twig.php +++ b/phpBB/phpbb/template/twig/twig.php @@ -33,6 +33,12 @@ class twig extends \phpbb\template\base private $cachepath = ''; /** + * phpBB filesystem + * @var \phpbb\filesystem + */ + protected $phpbb_filesystem; + + /** * phpBB root path * @var string */ @@ -73,24 +79,23 @@ class twig extends \phpbb\template\base /** * Constructor. * - * @param string $phpbb_root_path phpBB root path - * @param string $php_ext php extension (typically 'php') + * @param \phpbb\filesystem $phpbb_filesystem * @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 - * @param string $adm_relative_path relative path to adm directory */ - public function __construct($phpbb_root_path, $php_ext, $config, $user, \phpbb\template\context $context, \phpbb\extension\manager $extension_manager = null, $adm_relative_path = null) + public function __construct(\phpbb\filesystem $phpbb_filesystem, $config, $user, \phpbb\template\context $context, \phpbb\extension\manager $extension_manager = null) { - $this->phpbb_root_path = $phpbb_root_path; - $this->php_ext = $php_ext; + $this->phpbb_filesystem = $phpbb_filesystem; + $this->phpbb_root_path = $phpbb_filesystem->get_phpbb_root_path(); + $this->php_ext = $phpbb_filesystem->get_php_ext(); $this->config = $config; $this->user = $user; $this->context = $context; $this->extension_manager = $extension_manager; - $this->cachepath = $phpbb_root_path . 'cache/twig/'; + $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(''); @@ -98,7 +103,7 @@ class twig extends \phpbb\template\base $this->twig = new \phpbb\template\twig\environment( $this->config, ($this->extension_manager) ? $this->extension_manager->all_enabled() : array(), - $this->phpbb_root_path, + $this->phpbb_filesystem, $loader, array( 'cache' => (defined('IN_INSTALL')) ? false : $this->cachepath, @@ -120,9 +125,9 @@ class twig extends \phpbb\template\base $this->twig->setLexer($lexer); // Add admin namespace - if ($adm_relative_path !== null && is_dir($this->phpbb_root_path . $adm_relative_path . 'style/')) + if ($this->phpbb_filesystem->get_adm_relative_path() !== null && is_dir($this->phpbb_root_path . $this->phpbb_filesystem->get_adm_relative_path() . 'style/')) { - $this->twig->getLoader()->setPaths($this->phpbb_root_path . $adm_relative_path . 'style/', 'admin'); + $this->twig->getLoader()->setPaths($this->phpbb_root_path . $this->phpbb_filesystem->get_adm_relative_path() . 'style/', 'admin'); } } |