Functions

Check whether a variable is set, and return the var or $default

checkset(string $var, mixed $default) : string
echo 'posted var:' . checkset($_POST['var']);

Parameters

$var

string

&$var

$default

mixed

Returns this if the $var param is !isset()

Returns

string

DStruct Autoloader.

dstruct_autoloader(string $class_name) 

Attempts to autoload classes and then caches the results. See the 'autoloader_directories' property defined in the class constructor for Prefs for more information.

Parameters

$class_name

string

Shutdown function set by DStruct.

dstruct_shutdown_fn() 

PHP calls the shutdown function at the end of processing the script. Any un-caught errors will be seen in this function and are emailed if required.

see \global\Prefs::DEV

Shortened version of html_specialchars which passes by ref.

hsc(string $var) 

Most useful for re-encoding where a user form has not validated and inputs are being echoed to browser.

todo DOES NOT APPEAR TO WORK IF YOU PASS AN ARRAY ELEMENT e.g. hsc($data['element']);

Parameters

$var

string

Encodes HTML safely for UTF-8.

html_encode(string $var) : string

Use instead of htmlentities.

Parameters

$var

string

Returns

string

Encodes HTML special characters safely for UTF-8.

html_specialchars(string $var) : string

Use instead of htmlspecialchars.

Parameters

$var

string

Returns

string

Constants

 

APP_ROOT

APP_ROOT