From: Andrey Kutejko Date: Tue, 30 Jul 2013 20:29:34 +0000 (+0300) Subject: configurable debug mode for filesystem environment X-Git-Tag: 0.5~98 X-Git-Url: https://git.andy128k.dev/?a=commitdiff_plain;h=bd0f79d427b7c30735834be74d350f90182cd518;p=ipf.git configurable debug mode for filesystem environment --- 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;