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
string
CSS class for the message box
string
currency(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 |
float
Currency value
string
Trim '.00' from end of output
\number
Decimal precision. Default is two.
string
Symbol to prepend to output. Uses {@link Prefs::CURRENCY_SYMBOL} by default.
string
The decimal separator. Default is UK - period.
string
The thousands separator. Default is UK - comma.
string
dataSize(integer $bytes) : boolean | \number | string
For example, 1024 bytes --> 1kb
integer
boolean
\number
string
date(integer $uts) : string
formDate(integer $uts) : string
formTimestamp(integer $uts) : string
integer
string
orderedDate(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
string
toHTML(string $input) : string
Return is HTML encoded and newlines are converted to
. Method is set to use UTF-8.
string
string
__construct()