- Token name and options are now passed through parse() method
This commit is contained in:
1 parent
e9b2f0ece3
commit
b3a8e3aca2
29 files changed
+70
-59
No files matched your search
@@ -25,10 +25,8 @@ class LanguageExtension implements Extension, FunctionExtension {
|
||||
];
|
||||
}
|
||||
|
||||
public function parse(\Picea\Compiler\Context &$context, ?string $arguments, string $token) : string
|
||||
public function parse(\Picea\Compiler\Context &$context, ?string $arguments, string $token, array $options = []) : string
|
||||
{
|
||||
$opt = $context->tokenOptions($token);
|
||||
|
||||
switch(explode('.', $token)[0]) {
|
||||
case "language":
|
||||
$cls = $this::class;
|
||||
@@ -49,14 +47,14 @@ class LanguageExtension implements Extension, FunctionExtension {
|
||||
PHP;
|
||||
|
||||
case "lang":
|
||||
if ( in_array('raw', $opt) ) {
|
||||
if ( in_array('raw', $options) ) {
|
||||
return "<?php echo \$picea->compiler->getExtensionFromToken('$token')->absoluteLang($arguments) ?>";
|
||||
}
|
||||
|
||||
return "<?php echo htmlspecialchars(\$picea->compiler->getExtensionFromToken('$token')->absoluteLang($arguments), \ENT_QUOTES, ini_get('default_charset'), true) ?>";
|
||||
|
||||
case "_":
|
||||
if ( in_array('raw', $opt) ) {
|
||||
if ( in_array('raw', $options) ) {
|
||||
return "<?php echo \$picea->compiler->getExtensionFromToken('$token')->relativeLang($arguments) ?>";
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user