summaryrefslogtreecommitdiff
path: root/libs/plugins/modifiercompiler.str_repeat.php
diff options
context:
space:
mode:
authorSimon Wisselink <wisskid@users.noreply.github.com>2022-09-23 00:09:00 +0200
committerGitHub <noreply@github.com>2022-09-23 00:09:00 +0200
commit4550fc03391bd120b4add41ad7934c4c59aa21e8 (patch)
treee4c74de17d9033236183daabbf83da0808a7f0de /libs/plugins/modifiercompiler.str_repeat.php
parent4fc39d59a5d7b3cb3d49b5170eba43ceafcf6074 (diff)
downloadsmarty-4550fc03391bd120b4add41ad7934c4c59aa21e8.tar.gz
smarty-4550fc03391bd120b4add41ad7934c4c59aa21e8.tar.bz2
smarty-4550fc03391bd120b4add41ad7934c4c59aa21e8.zip
Using PHP functions as modifiers now triggers a deprecation notice (#814)
Fixes #813
Diffstat (limited to 'libs/plugins/modifiercompiler.str_repeat.php')
-rw-r--r--libs/plugins/modifiercompiler.str_repeat.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/libs/plugins/modifiercompiler.str_repeat.php b/libs/plugins/modifiercompiler.str_repeat.php
new file mode 100644
index 00000000..18eb7a76
--- /dev/null
+++ b/libs/plugins/modifiercompiler.str_repeat.php
@@ -0,0 +1,23 @@
+<?php
+
+/**
+ * Smarty plugin
+ *
+ * @package Smarty
+ * @subpackage PluginsModifierCompiler
+ */
+/**
+ * Smarty str_repeat modifier plugin
+ * Type: modifier
+ * Name: str_repeat
+ * Purpose: returns string repeated times times
+ *
+ * @link https://www.smarty.net/docs/en/language.modifier.str_repeat.tpl str_repeat (Smarty online manual)
+ *
+ * @param array $params parameters
+ *
+ * @return string with compiled code
+ */
+function smarty_modifiercompiler_str_repeat($params) {
+ return 'str_repeat((string) ' . $params[0] . ', (int) ' . $params[1] . ')';
+}