mirror of
https://github.com/smarty-php/smarty.git
synced 2026-08-06 13:34:11 +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
15 lines
337 B
PHP
15 lines
337 B
PHP
<?php
|
|
|
|
namespace Smarty\Compile\Modifier;
|
|
|
|
/**
|
|
* Smarty substr modifier plugin
|
|
*/
|
|
class SubstrModifierCompiler extends Base {
|
|
|
|
public function compile($params, \Smarty\Compiler\Template $compiler) {
|
|
return 'substr((string) ' . $params[0] . ', (int) ' . $params[1] .
|
|
(isset($params[2]) ? ', (int) ' . $params[2] : '') . ')';
|
|
}
|
|
|
|
} |