Static methods providing formatting.
| package | dstruct_common |
|---|
asMessage(mixed $messages, string $class) : string
If a string is passed as $message, a div with the $message string is returned.
If an array is passed, and un-ordered list of the variables is returned.
Boxes have the class 'message', in addition to the default 'error' class or whatever is passed in its place.
If an empty string is passed, nothing is returned, rather than an empty box.
mixed
stringCSS class for the message box
stringcurrency(float $val, string $trimdecimals, \number $precision, string $symbol, string $decsep, string $thousep) : string
| todo | Set default dec and thou separators in Prefs |
|---|---|
| todo | $trimdecimals currently doesn't take account of $decsep |
floatCurrency value
stringTrim '.00' from end of output
\numberDecimal precision. Default is two.
stringSymbol to prepend to output. Uses {@link Prefs::CURRENCY_SYMBOL} by default.
stringThe decimal separator. Default is UK - period.
stringThe thousands separator. Default is UK - comma.
stringdataSize(integer $bytes) : boolean | \number | string
For example, 1024 bytes --> 1kb
integer
boolean\numberstring
date(integer $uts) : string
formDate(integer $uts) : string
formTimestamp(integer $uts) : string
integer
stringorderedDate(integer $uts) : string
Particularly useful for where there is a need to sort by date, for example, naming folders which are to be listed by their date.
integer
stringtoHTML(string $input) : string
Return is HTML encoded and newlines are converted to
. Method is set to use UTF-8.
string
string__construct()