Commit | Line | Data |
---|---|---|
349976a8 MS |
1 | <?php |
2 | namespace wcf\system\template\plugin; | |
3 | use wcf\system\template\TemplateEngine; | |
349976a8 MS |
4 | use wcf\util\FileUtil; |
5 | ||
6 | /** | |
a17de04e | 7 | * Template modifier plugin which formats a filesize (given in bytes). |
349976a8 MS |
8 | * |
9 | * Usage: | |
a17de04e MS |
10 | * {$string|filesize} |
11 | * {123456789|filesize} | |
9f959ced MS |
12 | * |
13 | * @author Marcel Werk | |
7d739af0 | 14 | * @copyright 2001-2016 WoltLab GmbH |
349976a8 MS |
15 | * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php> |
16 | * @package com.woltlab.wcf | |
17 | * @subpackage system.template.plugin | |
9f959ced | 18 | * @category Community Framework |
349976a8 MS |
19 | */ |
20 | class FilesizeModifierTemplatePlugin implements IModifierTemplatePlugin { | |
21 | /** | |
0fcfe5f6 | 22 | * @inheritDoc |
349976a8 MS |
23 | */ |
24 | public function execute($tagArgs, TemplateEngine $tplObj) { | |
25 | return FileUtil::formatFilesize($tagArgs[0]); | |
26 | } | |
27 | } |