From 67695754cdb27fa9ec1b5cee9ce6705affcd905d Mon Sep 17 00:00:00 2001 From: Charlie Powell Date: Wed, 21 Jun 2017 00:05:48 -0400 Subject: [PATCH] {filesize} now supports a "round" parameter to indicate precision. --- src/core/libs/smarty-plugins/function.filesize.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/libs/smarty-plugins/function.filesize.php b/src/core/libs/smarty-plugins/function.filesize.php index d2686b6b..c7f9551d 100644 --- a/src/core/libs/smarty-plugins/function.filesize.php +++ b/src/core/libs/smarty-plugins/function.filesize.php @@ -28,6 +28,8 @@ * {filesize 123} => "123 bytes" * {filesize 2048} => "2 kiB" * + * + * * Core 6.2.2 * A "round" parameter is supported to provide the level of precision to use. * * @param array $params Associative (and/or indexed) array of smarty parameters passed in from the template * @param Smarty $smarty Parent Smarty template object @@ -39,5 +41,7 @@ function smarty_function_filesize($params, $smarty){ $size = $params[0]; - return \Core\Filestore\format_size($size); + $round = isset($params['round']) ? $params['round'] : 2; + + return \Core\Filestore\format_size($size, $round); } \ No newline at end of file