1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-24 08:10:13 +02:00

[feature/template-events] Outline for RUNHOOKS template tag.

Ported to the new develop, hopefully this is still sensible.

PHPBB3-9550
This commit is contained in:
Oleg Pudeyev 2011-04-23 16:43:55 -04:00
parent b5e069f879
commit ed548ae8ff

View File

@ -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;
@ -835,6 +841,27 @@ class phpbb_template_filter extends php_user_filter
return "\$_template->_php_include('$tag_args');";
}
/**
* 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