app/sysfunctions.php

Functions

handle_exception()

handle_exception(\Exception  $e)

Handle all exceptions

Parameters

\Exception $e

The exception being handled.

error()

error(integer  $errno,string  $message,string  $file,integer  $line)

Error handler

Parameters

integer $errno

The error number.

string $message

The error message

string $file

The filename where the error occurred.

integer $line

The line number the error occurred on.

tr()

tr(\iterable  $args)

Translate text to user's language

Translate string.

Translates a string of text into the necessary language, depending on the user's profile preferences. Also supports placeholders (ie. %s), with the variables being passed as additional parameters in sequential order.

Parameters

\iterable $args

First element is the contents of the string / message, and rest of the params are the values of the placeholders.

fdate()

fdate(string  $date,boolean  $add_time = false): string

Formats a date in proper readable format, and also converts timezone automatically as necessary.

Parameters

string $date

The date to format, in YYYY-MM-DD HH:II:SS

boolean $add_time

WHther or not to add the time to the outputed date.

Returns

string —

The resulting formatted date.

fmoney()

fmoney(float  $amount,string  $currency = '',boolean  $include_abbr = true): string

Format decimal into amount with correct currency

Parameters

float $amount

The decimal to format.

string $currency

The 3 character ISO currency to format to.

boolean $include_abbr

Whether or not to add the 3 character ISO currency abbreviation.

Returns

string —

The formatted amount.

fexchange()

fexchange(float  $amount,string  $from_currency,string  $to_currency): string

Exchange funds into another currency, and return the formatted value of resulting amount.

Parameters

float $amount

The amount to exchange

string $from_currency

The currency the amount is currently in

string $to_currency

The currency to exchange the funds into

Returns

string —

The resulting amount after exchange

exchange_money()

exchange_money(float  $amount,string  $from_currency,string  $to_currency): float

Exchange funds into another currency.

Parameters

float $amount

The amount to exchange

string $from_currency

The currency the amount is currently in

string $to_currency

The currency to exchange the funds into

Returns

float —

The resulting amount after exchange

check_package()

check_package(string  $alias): boolean

Checks whether or not a package is installed.

Parameters

string $alias

The alias of the package to check.

Returns

boolean —

WHether or not the package is installed.