aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/includes/template/filter.php27
1 files changed, 27 insertions, 0 deletions
diff --git a/phpBB/includes/template/filter.php b/phpBB/includes/template/filter.php
index 66d28242a3..fc99ba5917 100644
--- a/phpBB/includes/template/filter.php
+++ b/phpBB/includes/template/filter.php
@@ -317,6 +317,12 @@ class phpbb_template_filter extends php_user_filter
return '<!-- ENDPHP -->';
break;
+ case 'RUNHOOKS':
+ // return value here will be compiled code (html with embedded php).
+ // we don't want to wrap it in php tags here.
+ return '<?php ' . $this->compile_tag_run_hooks($matches[2]) . '?>';
+ break;
+
default:
return $matches[0];
break;
@@ -836,6 +842,27 @@ class phpbb_template_filter extends php_user_filter
}
/**
+ * Compile RUNHOOKS tag.
+ *
+ * $tag_args should be a single string identifying hook location.
+ */
+ private function compile_tag_run_hooks($tag_args)
+ {
+ if (!preg_match('/^\w+$/', $tag_args))
+ {
+ // do something
+ var_dump($tag_args);
+ }
+ $location = $tag_args;
+ // 1. find all mods defining hooks for location
+ // 2. obtain mods' template fragments
+ // 3. compile template fragments
+ // 4. return compiled code
+ // note: need to make sure we get fragments in the right order
+ return 'echo "test";';
+ }
+
+ /**
* parse expression
* This is from Smarty
*/