From bd0f79d427b7c30735834be74d350f90182cd518 Mon Sep 17 00:00:00 2001 From: Andrey Kutejko Date: Tue, 30 Jul 2013 23:29:34 +0300 Subject: [PATCH] configurable debug mode for filesystem environment --- ipf/shortcuts.php | 1 + ipf/template/environment/filesystem.php | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ipf/shortcuts.php b/ipf/shortcuts.php index 738ba4e..7048f92 100644 --- a/ipf/shortcuts.php +++ b/ipf/shortcuts.php @@ -51,6 +51,7 @@ final class IPF_Shortcuts } self::$defaultEnvironment = new IPF_Template_Environment_FileSystem($dirs, IPF::get('tmp')); + self::$defaultEnvironment->debug = IPF::get('debug'); self::$defaultEnvironment->tags['url'] = 'IPF_Template_Tag_Url'; // extra tags diff --git a/ipf/template/environment/filesystem.php b/ipf/template/environment/filesystem.php index 5f053ed..42c3aa5 100644 --- a/ipf/template/environment/filesystem.php +++ b/ipf/template/environment/filesystem.php @@ -4,6 +4,7 @@ class IPF_Template_Environment_FileSystem extends IPF_Template_Environment { public $folders = array(); public $cache = ''; + public $debug = false; public function __construct($folders, $cache) { @@ -29,7 +30,7 @@ class IPF_Template_Environment_FileSystem extends IPF_Template_Environment { $_tmp = var_export($this->folders, true); $filename = $this->cache.'/IPF_Template-'.md5($_tmp.(string)$template).'.phps'; - if (IPF::get('debug') or !file_exists($filename)) { + if ($this->debug or !file_exists($filename)) { $this->write($filename, $template->compile()); } return $filename; -- 2.49.0