Plugin API: Added 'show_bytes' hook (#5001)

pull/5815/head
Aleksander Machniak 8 years ago
parent b629372db1
commit 7b4b36b16c

@ -1,6 +1,7 @@
CHANGELOG Roundcube Webmail CHANGELOG Roundcube Webmail
=========================== ===========================
- Plugin API: Added 'show_bytes' hook (#5001)
- subscriptions_option: show \\Noselect folders greyed out (#5621) - subscriptions_option: show \\Noselect folders greyed out (#5621)
- Add option to not indent quoted text on top-posting reply (#5105) - Add option to not indent quoted text on top-posting reply (#5105)
- Removed global $CONFIG variable - Removed global $CONFIG variable

@ -2330,6 +2330,15 @@ class rcmail extends rcube
*/ */
public function show_bytes($bytes, &$unit = null) public function show_bytes($bytes, &$unit = null)
{ {
// Plugins may want to display different units
$plugin = $this->plugins->exec_hook('show_bytes', array('bytes' => $bytes));
$unit = $plugin['unit'];
if ($plugin['result'] !== null) {
return $plugin['result'];
}
if ($bytes >= 1073741824) { if ($bytes >= 1073741824) {
$unit = 'GB'; $unit = 'GB';
$gb = $bytes/1073741824; $gb = $bytes/1073741824;

Loading…
Cancel
Save