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

[feature/template-engine] Refactor $config dependency out of the filter

The template stream filter no longer depends on the $config global.
Instead it uses a 'allow_php' param that is passed via
stream_bucket_append's last argument.

Tests also adjusted.

PHPBB3-9726
This commit is contained in:
Igor Wiedler
2011-07-10 00:35:07 +02:00
parent ee0bba3ab6
commit ae53623230
8 changed files with 46 additions and 29 deletions

View File

@@ -25,6 +25,18 @@ stream_filter_register('phpbb_template', 'phpbb_template_filter');
*/
class phpbb_template_compile
{
/**
* Whether <!-- PHP --> tags are allowed
*
* @var bool
*/
private $allow_php;
public function __construct($allow_php)
{
$this->allow_php = $allow_php;
}
/**
* Compiles template in $source_file and writes compiled template to
* cache directory
@@ -96,7 +108,7 @@ class phpbb_template_compile
*/
private function compile_stream_to_stream($source_stream, $dest_stream)
{
stream_filter_append($source_stream, 'phpbb_template');
stream_filter_append($source_stream, 'phpbb_template', null, array('allow_php' => $this->allow_php));
stream_copy_to_stream($source_stream, $dest_stream);
}
}