Skip to content

Commit

Permalink
{filesize} now supports a "round" parameter to indicate precision.
Browse files Browse the repository at this point in the history
  • Loading branch information
cdp1337 committed Jun 21, 2017
1 parent 2fc415d commit 6769575
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/core/libs/smarty-plugins/function.filesize.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
* {filesize 123} => "123 bytes"
* {filesize 2048} => "2 kiB"
* </pre>
*
* * 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
Expand All @@ -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);
}

0 comments on commit 6769575

Please sign in to comment.