Details |
Letzte Änderung |
Log anzeigen
| RSS feed
| Revision |
Autor |
Zeilennr. |
Zeile |
| 148 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/**
|
|
|
4 |
* Smarty plugin
|
|
|
5 |
*
|
|
|
6 |
* @package Smarty
|
|
|
7 |
* @subpackage PluginsModifierCompiler
|
|
|
8 |
*/
|
|
|
9 |
/**
|
|
|
10 |
* Smarty round modifier plugin
|
|
|
11 |
* Type: modifier
|
|
|
12 |
* Name: round
|
|
|
13 |
* Purpose: Returns the rounded value of num to specified precision (number of digits after the decimal point)
|
|
|
14 |
*
|
|
|
15 |
* @link https://www.smarty.net/docs/en/language.modifier.round.tpl round (Smarty online manual)
|
|
|
16 |
*
|
|
|
17 |
* @param array $params parameters
|
|
|
18 |
*
|
|
|
19 |
* @return string with compiled code
|
|
|
20 |
*/
|
|
|
21 |
function smarty_modifiercompiler_round($params) {
|
|
|
22 |
return 'round((float) ' . $params[0] . ', (int) ' . ($params[1] ?? 0) . ', (int) ' . ($params[2] ?? PHP_ROUND_HALF_UP) . ')';
|
|
|
23 |
}
|