diff options
author | Nathan Guse <nathaniel.guse@gmail.com> | 2013-05-20 11:45:32 -0500 |
---|---|---|
committer | Nathan Guse <nathaniel.guse@gmail.com> | 2013-05-20 11:45:32 -0500 |
commit | c84fc97e9059792d244d49d0d379d627227b12ab (patch) | |
tree | b9ed80d2777e6a733c5daffd85903858593d5eeb /phpBB/includes/template/compile.php | |
parent | f26257dc51c9be2ff26b2702d26cbeb96e3ceb5a (diff) | |
download | forums-c84fc97e9059792d244d49d0d379d627227b12ab.tar forums-c84fc97e9059792d244d49d0d379d627227b12ab.tar.gz forums-c84fc97e9059792d244d49d0d379d627227b12ab.tar.bz2 forums-c84fc97e9059792d244d49d0d379d627227b12ab.tar.xz forums-c84fc97e9059792d244d49d0d379d627227b12ab.zip |
[ticket/11435] Create new template filter option (cleanup)
This allows us to only run cleanup on the last run of template compilation
and not cleanup during event parsing
PHPBB3-11435
Diffstat (limited to 'phpBB/includes/template/compile.php')
-rw-r--r-- | phpBB/includes/template/compile.php | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/phpBB/includes/template/compile.php b/phpBB/includes/template/compile.php index fcdaf7abda..76cb3011df 100644 --- a/phpBB/includes/template/compile.php +++ b/phpBB/includes/template/compile.php @@ -33,6 +33,13 @@ class phpbb_template_compile private $filter_params; /** + * Array of default parameters + * + * @var array + */ + private $default_filter_params; + + /** * Constructor. * * @param bool $allow_php Whether PHP code will be allowed in templates (inline PHP code, PHP tag and INCLUDEPHP tag) @@ -44,18 +51,40 @@ class phpbb_template_compile */ public function __construct($allow_php, $style_names, $locator, $phpbb_root_path, $extension_manager = null, $user = null) { - $this->filter_params = array( - 'allow_php' => $allow_php, - 'style_names' => $style_names, - 'locator' => $locator, + $this->filter_params = $this->default_filter_params = array( + 'allow_php' => $allow_php, + 'style_names' => $style_names, + 'locator' => $locator, 'phpbb_root_path' => $phpbb_root_path, 'extension_manager' => $extension_manager, - 'user' => $user, + 'user' => $user, 'template_compile' => $this, + 'cleanup' => true, ); } /** + * Set filter parameters + * + * @param array $params Array of parameters (will be merged onto $this->filter_params) + */ + public function set_filter_params($params) + { + $this->filter_params = array_merge( + $this->filter_params, + $params + ); + } + + /** + * Reset filter parameters to their default settings + */ + public function reset_filter_params() + { + $this->filter_params = $this->default_filter_params; + } + + /** * Compiles template in $source_file and writes compiled template to * cache directory * |