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