aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/template/compile.php
diff options
context:
space:
mode:
authorIgor Wiedler <igor@wiedler.ch>2011-07-10 00:35:07 +0200
committerIgor Wiedler <igor@wiedler.ch>2011-07-10 00:35:07 +0200
commitae53623230a45eeedf50cc3f6220164d8cd256c3 (patch)
tree130080560cc500d1da9b1e83f05c29d29a688e64 /phpBB/includes/template/compile.php
parentee0bba3ab65f68a24942a650b9414b8f2ad700b4 (diff)
downloadforums-ae53623230a45eeedf50cc3f6220164d8cd256c3.tar
forums-ae53623230a45eeedf50cc3f6220164d8cd256c3.tar.gz
forums-ae53623230a45eeedf50cc3f6220164d8cd256c3.tar.bz2
forums-ae53623230a45eeedf50cc3f6220164d8cd256c3.tar.xz
forums-ae53623230a45eeedf50cc3f6220164d8cd256c3.zip
[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
Diffstat (limited to 'phpBB/includes/template/compile.php')
-rw-r--r--phpBB/includes/template/compile.php14
1 files changed, 13 insertions, 1 deletions
diff --git a/phpBB/includes/template/compile.php b/phpBB/includes/template/compile.php
index 59ab9e654e..647e8ccf8a 100644
--- a/phpBB/includes/template/compile.php
+++ b/phpBB/includes/template/compile.php
@@ -26,6 +26,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
* @param string $handle Template handle to compile
@@ -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);
}
}