1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-06 16:56:44 +02:00

[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
This commit is contained in:
Nathan Guse
2013-05-20 11:45:32 -05:00
parent f26257dc51
commit c84fc97e90
2 changed files with 78 additions and 30 deletions

View File

@@ -32,6 +32,13 @@ class phpbb_template_compile
*/
private $filter_params;
/**
* Array of default parameters
*
* @var array
*/
private $default_filter_params;
/**
* Constructor.
*
@@ -44,17 +51,39 @@ 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