aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Pudeyev <oleg@bsdpower.com>2011-04-23 16:43:55 -0400
committerOleg Pudeyev <oleg@bsdpower.com>2012-11-17 16:38:25 -0500
commited548ae8ff0e87035c0c173d40212a96fa642135 (patch)
tree70aa5cbdb17579bf05eb28266a27e1c0a1fba610
parentb5e069f8798a4ecd8f8b7d054932f63cdebb2a72 (diff)
downloadforums-ed548ae8ff0e87035c0c173d40212a96fa642135.tar
forums-ed548ae8ff0e87035c0c173d40212a96fa642135.tar.gz
forums-ed548ae8ff0e87035c0c173d40212a96fa642135.tar.bz2
forums-ed548ae8ff0e87035c0c173d40212a96fa642135.tar.xz
forums-ed548ae8ff0e87035c0c173d40212a96fa642135.zip
[feature/template-events] Outline for RUNHOOKS template tag.
Ported to the new develop, hopefully this is still sensible. PHPBB3-9550
-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
*/