fenom/tests/resources/actions.php

31 lines
873 B
PHP
Raw Normal View History

2013-01-25 18:36:16 +04:00
<?php
function myMod($str) {
return "(myMod)".$str."(/myMod)";
}
function myFunc($params) {
return "MyFunc:".$params["name"];
}
function myBlockFunc($params, $content) {
return "Block:".$params["name"].':'.trim($content).':Block';
}
2013-04-04 10:56:44 +04:00
function myCompiler(Cytro\Tokenizer $tokenizer, Cytro\Template $tpl) {
2013-01-25 18:36:16 +04:00
$p = $tpl->parseParams($tokenizer);
return 'echo "PHP_VERSION: ".PHP_VERSION." (for ".'.$p["name"].'.")";';
}
2013-04-04 10:56:44 +04:00
function myBlockCompilerOpen(Cytro\Tokenizer $tokenizer, Cytro\Scope $scope) {
2013-01-25 18:36:16 +04:00
return myCompiler($tokenizer, $scope->tpl);
}
2013-04-04 10:56:44 +04:00
function myBlockCompilerClose(Cytro\Tokenizer $tokenizer, Cytro\Scope $scope) {
2013-01-25 18:36:16 +04:00
return 'echo "End of compiler";';
}
2013-04-04 10:56:44 +04:00
function myBlockCompilerTag(Cytro\Tokenizer $tokenizer, Cytro\Scope $scope) {
2013-01-25 18:36:16 +04:00
$p = $scope->tpl->parseParams($tokenizer);
return 'echo "Tag ".'.$p["name"].'." of compiler";';
}