mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00: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:
parent
b5e069f879
commit
ed548ae8ff
1 changed files with 27 additions and 0 deletions
|
@ -317,6 +317,12 @@ class phpbb_template_filter extends php_user_filter
|
||||||
return '<!-- ENDPHP -->';
|
return '<!-- ENDPHP -->';
|
||||||
break;
|
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:
|
default:
|
||||||
return $matches[0];
|
return $matches[0];
|
||||||
break;
|
break;
|
||||||
|
@ -835,6 +841,27 @@ class phpbb_template_filter extends php_user_filter
|
||||||
return "\$_template->_php_include('$tag_args');";
|
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
|
* parse expression
|
||||||
* This is from Smarty
|
* This is from Smarty
|
||||||
|
|
Loading…
Add table
Reference in a new issue