File/plugins/show_quota/functions.php

Description

Copyright (c) 2007 The NaSMail Project This file is part of NaSMail show_quota plugin.

This plugin is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This plugin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with plugin; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

  • version: $Id: functions.php 773 2007-09-19 07:07:57Z tokul $
  • copyright: (c) 2007 The NaSMail Project
Includes
 include_once (SM_PATH.'config/show_quota_config.php') (line 54)

Load site configuration

 include_once (SM_PATH.'plugins/show_quota/config.php') (line 56)
Constants
NSM_SQ_BYTES = 'BYTES' (line 34)
NSM_SQ_COUNT = 'COUNT' (line 36)
NSM_SQ_ERROR = 'ERROR' (line 28)
NSM_SQ_KBYTES = 'KBYTES' (line 35)
NSM_SQ_MAX = 'MAX' (line 31)
NSM_SQ_MESSAGE = 'MESSAGE' (line 27)
NSM_SQ_STORAGE = 'STORAGE' (line 26)

Declare constants

NSM_SQ_UNIT = 'UNIT' (line 32)
NSM_SQ_USED = 'USED' (line 30)
Functions
show_quota_check_quota (line 156)

Function is used to retrieve user's quota information from configure quota backend.

  • return: See API doc for more information about array keys
array show_quota_check_quota ()
show_quota_left_main_do (line 63)

Function is used to display quota information in left_main frame

void show_quota_left_main_do ()
show_quota_message_box (line 288)

Creates html formated message box

  • return: html formated message box
string show_quota_message_box (string $title, string $message)
  • string $title: Title (no html formating)
  • string $message: Message (no html formating, linebreaks are submitted as LF symbols)
show_quota_print_bar (line 174)

Creates html table row with two colored cells.

  • return: html row
string show_quota_print_bar (int $cur_count, int $max_count, [string $unit = NSM_SQ_BYTES])
  • int $cur_count: Current value
  • int $max_count: Max value
  • string $unit: Units used in counters. See NSM_SQ_BYTES, NSM_SQ_COUNT, NSM_SQ_KBYTES constants.
show_quota_readable (line 232)

Formats number according to its type

Output uses GiB, MiB, KiB or B suffixes with size quotas

void show_quota_readable (int|float $number, string $type)
  • int|float $number: number
  • string $type: NSM_SQ_BYTES,NSM_SQ_KBYTES,NSM_SQ_COUNT constants
show_quota_right_main_do (line 123)

Function is used to display overquota warnings in right_main frame.

void show_quota_right_main_do ()
show_quota_smart_round (line 271)

Rounds float number

If number is bigger or equal to 100, it is rounded to integer. If number is bigger or equal to 10, it is rounded to one decimal place. If number is smaller than 10, it is rounded to two decimal places.

  • return: rounded float number
float show_quota_smart_round (float $float)
  • float $float: float number

Documentation generated on Sun, 22 Nov 2009 17:36:33 +0200 by phpDocumentor 1.4.3