mirror of
https://github.com/smarty-php/smarty.git
synced 2026-08-07 14:04:13 +02:00
41d80b99ac
* Implemented support for substr, implode and json_encode as modifiers. Fixes #939 * Added split and join in favor of explode and implode modifiers. * Documented all available modifiers
14 lines
313 B
PHP
14 lines
313 B
PHP
<?php
|
|
|
|
namespace Smarty\Compile\Modifier;
|
|
|
|
/**
|
|
* Smarty json_encode modifier plugin
|
|
*/
|
|
class JsonEncodeModifierCompiler extends Base {
|
|
|
|
public function compile($params, \Smarty\Compiler\Template $compiler) {
|
|
return 'json_encode(' . $params[0] . (isset($params[1]) ? ', (int) ' . $params[1] : '') . ')';
|
|
}
|
|
|
|
} |