From 10b3106ed6d0169914a9a46bb93fd46057a6c75a Mon Sep 17 00:00:00 2001 From: Andrey Kutejko Date: Tue, 30 Jul 2013 19:15:31 +0300 Subject: [PATCH] explicitely pass template environment --- ipf/shortcuts.php | 4 +++- ipf/template.php | 2 +- ipf/template/file.php | 4 ++-- ipf/template/string.php | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/ipf/shortcuts.php b/ipf/shortcuts.php index 986e8f2..8e1c147 100644 --- a/ipf/shortcuts.php +++ b/ipf/shortcuts.php @@ -29,7 +29,9 @@ final class IPF_Shortcuts } $context = new IPF_Template_Context($params); - $tmpl = new IPF_Template_File($tplfile); + $environment = IPF_Template_Environment::getDefault(); + + $tmpl = new IPF_Template_File($tplfile, $environment); return $tmpl->render($context); } diff --git a/ipf/template.php b/ipf/template.php index 18c03ef..fd9b27b 100644 --- a/ipf/template.php +++ b/ipf/template.php @@ -4,7 +4,7 @@ abstract class IPF_Template { protected $environment; - public function __construct($environment) + public function __construct(IPF_Template_Environment $environment) { $this->environment = $environment; } diff --git a/ipf/template/file.php b/ipf/template/file.php index 50e0144..2c813eb 100644 --- a/ipf/template/file.php +++ b/ipf/template/file.php @@ -4,9 +4,9 @@ class IPF_Template_File extends IPF_Template { private $tpl; - function __construct($template, $environment=null) + function __construct($template, IPF_Template_Environment $environment) { - parent::__construct($environment ? $environment : IPF_Template_Environment::getDefault()); + parent::__construct($environment); $this->tpl = $template; } diff --git a/ipf/template/string.php b/ipf/template/string.php index 09a6f5f..835e55a 100644 --- a/ipf/template/string.php +++ b/ipf/template/string.php @@ -4,9 +4,9 @@ class IPF_Template_String extends IPF_Template { private $tpl; - function __construct($template, $environment=null) + function __construct($template, IPF_Template_Environment $environment) { - parent::__construct($environment ? $environment : IPF_Template_Environment::getDefault()); + parent::__construct($environment); $this->tpl = $template; } -- 2.49.0