\
Namespaces
Hazaar
HazaarTest
Classes
IndexController
Markdown_Parser
Textile
Textile Textile parser.
TextileBag Class to allow simple assignment to members of the internal data array
TextileTag Class to allow contruction of HTML tags on conversion of an object to a string
Functions
set_log_level()
set_log_level($level)

Parameters

$level

No description

stdout()
stdout($level, $message, $job = null)

Parameters

$level

No description

$message

No description

$job

No description

Markdown()
Markdown($text)

Parameters

$text

No description

mdwp_add_p()
mdwp_add_p($text)

Parameters

$text

No description

mdwp_strip_p()
mdwp_strip_p($t)

Parameters

$t

No description

mdwp_hide_tags()
mdwp_hide_tags($text)

Parameters

$text

No description

mdwp_show_tags()
mdwp_show_tags($text)

Parameters

$text

No description

identify_modifier_markdown()
identify_modifier_markdown()
smarty_modifier_markdown()
smarty_modifier_markdown($text)

Parameters

$text

No description

errorAndDie()
errorAndDie()
Error and die

Tags

Since

1.0.0

error_handler()
error_handler($errno, $errstr, $errfile = null, $errline = null, $errcontext = null)

Parameters

$errno

No description

$errstr

No description

$errfile

No description

$errline

No description

$errcontext

No description

exception_handler()
exception_handler($e)

Parameters

$e

No description

shutdown_handler()
shutdown_handler()
basic_handler()
basic_handler($errno, $errstr, $errfile = null, $errline = null, $errcontext = null)

Parameters

$errno

No description

$errstr

No description

$errfile

No description

$errline

No description

$errcontext

No description

traceAndDie()
traceAndDie()
ake()
ake($array, $key, $default = null, $non_empty = false) : mixed
Array value normalizer

Returns a value from an array if it exists. If it doesn’t exist a default value can be specified. Otherwise null is returned.

This helps prevent array key not found errors in the PHP interpreter.

Tags

Since

1.0.0

Parameters

$arraymixed

The array to search.

$keymixed

The array key value to look for.

$defaultmixed

An optional default value to return if the key does not exist.

$non_empty

No description

Returns

mixed

The value if it exists in the array. Returns the default if it does not. Default is null if not specified.

akr()
akr($array, $key_from, $key_to)
Array Key Rename

Rename a key in an array to something else.

Parameters

$arrayarray

The array to work on.

$key_fromstring

The key name to rename.

$key_tostring

The key name to change to.

boolify()
boolify($value) : boolean
Normalize boolean values

This helper function will take a string representation of a boolean such as ‘t’, ‘true’, ‘yes’, ‘ok’ and return a boolean type value.

Tags

Since

1.0.0

Parameters

$valuestring

The string representation of the boolean

Returns

boolean
strbool()
strbool($value) : string
Retrieve string value of boolean

Normalise boolean string to ‘true’ or ‘false’ based on various boolean representations

Tags

Since

1.0.0

Parameters

$valuestring

The string representation of the boolean

Returns

string
is_boolean()
is_boolean($value) : boolean
Test whether a value is a boolean

Checks for various representations of a boolean, including strings of ‘true/false’ and ‘yes/no’.

Tags

Since

2.0.0

Parameters

$valuestring

The string representation of the boolean

Returns

boolean
yn()
yn($value)
The Yes/No function

Simply returns Yes or No based on a boolean value.

Tags

Returns

string

Parameters

$value

No description

coalesce()
coalesce() : mixed
Retreive first non-null value from parameter list

Takes a variable list of arguments and returns the first non-null value.

Tags

Since

1.0.0

Returns

mixed

The first non-NULL argument value, or NULL if all values are NULL.

is_multi_array()
is_multi_array($array) : boolean
Test of array is multi-dimensional

Test an array to see if it’s a multidimensional array and returns TRUE or FALSE.

Tags

Since

1.0.0

Parameters

$arrayarray

The array to test

Returns

boolean
is_assoc()
is_assoc($array) : boolean
Test of array is an associative array

Test an array to see if it is associative or numerically keyed. Returns TRUE for associative or FALSE for numeric.

Tags

Since

1.0.0

Parameters

$arrayarray

The array to test

Returns

boolean
array_flatten()
array_flatten($array, $delim = '=', $section_delim = ';')

Parameters

$array

No description

$delim

No description

$section_delim

No description

array_unflatten()
array_unflatten($items, $delim = '=', $section_delim = ';')

Parameters

$items

No description

$delim

No description

$section_delim

No description

array_collate()
array_collate($array, $key_item, $value_item, $group_item = null) : array
Collate a multi-dimensional array into an associative array where $key_item is the key and $value_item is the value.
  • If the key value does not exist in the array, the element is skipped.
  • If the value item does not exist, the value will be NULL.

Parameters

$arraymixed

The array to collate.

$key_itemmixed

The value to use as the key.

$value_itemmixed

The value to use as the value.

$group_itemmixed

Optional value to group items by.

Returns

array
array_build_html()
array_build_html($array, $root = true) : array
Converts a multi dimensional array into key[key][key] => value syntax that can be used in html INPUT field names.

Parameters

$arraymixed

No description

$root

No description

Returns

array
array_to_dot_notation()
array_to_dot_notation($array, $separator = '.', $depth = null) : array|boolean
Convert to dot notation

Converts/reduces a multidimensional array into a single dimensional array with keys in dot-notation.

Tags

Since

2.0.0

Parameters

$arraymixed

The array to convert.

$separatormixed

The separater to use between keys. Defaults to ‘.’, hence the name of the functions.

$depthmixed

Limit to the specified depth. Starting at 1, this is the number of levels to return. Essentially, this is the number of dots, plus one.

Returns

\array|boolean
array_from_dot_notation()
array_from_dot_notation($array) : array
Convert a single dimension array in dot notation into a multi-dimensional array.

Inverse to the above function, array_to_dot_notation().

Tags

Since

2.3.27

Parameters

$arraymixed

No description

Returns

array
base64url_encode()
base64url_encode($data)

Parameters

$data

No description

base64url_decode()
base64url_decode($data)

Parameters

$data

No description

array_seek()
array_seek($array, $count)
Seek the array cursor forward $count number of elements

Parameters

$array

No description

$count

No description

build_url()
build_url($scheme = 'http', $host = 'localhost', $port = null, $user = null, $pass = null, $path = null, $query = Array ( ) , $fragment = null)
Build a correctly formatted URL from argument list

This function will build a correctly formatted HTTP compliant URL using a list of parameters. If any of the parameters are null then they will be omitted from the formatted output, including any extra values.

For example, you can specify a username and a password which will be formatted as username:password\@. However if you omit the password you will simply get username\@.

Parameters

$schemestring

The protocol to use. Usually http or https.

$hoststring

Hostname

$portinteger

(optional) Port

$userstring

(optional) Username

$passstring

(optional) User password. If set, a username is required.

$pathstring

(optional) Path suffix

$queryarray

(optional) Array of parameters to send. ie: the stuff after the ‘?’. Uses http_build_query to generate string.

$fragmentstring

(optional) Anything to go after the ‘#’.

str_bytes()
str_bytes($bytes, $type = null, $precision = null, $exclude_suffix = false) : string
Byte to string formatter

Formats an integer representing a size in bytes to a human readable string representation.

Tags

Since

1.0.0

Parameters

$bytesint

The byte value to convert to a string.

$typestring

The type to convert to. Type can be: * B (bytes) * K (kilobytes) * M (megabytes) * G (giabytes) * T (terrabytes)

$precisionint

The number of decimal places to show.

$exclude_suffix

No description

Returns

string

The human readable byte string. eg: ’100 MB’.

bytes_str()
bytes_str($string) : int
String to bytes formatter

Returns an integer value representing a number of bytes from the standard bytes size string supplied.

Tags

Since

1.0.0

Parameters

$stringint

The byte string value to convert to an integer. eg: ‘100MB’

Returns

int

The number of bytes

seconds()
seconds($interval) : int
Convert a string interval to seconds

This function can be used to convert a string interval such as ’1 week’ into seconds. Currently supported intervals are seconds, minutes, hours, days and weeks. Months are not supported because some crazy crackpot decided to make them all different lengths, so without knowing which month we’re talking about, converting them to seconds is impossible.

Multiple interval support is also possible. Intervals can be separated with a comma (,) or the word ‘and’, for example:

<code class="php">
$foo = seconds('1 week, 2 days');
$bar = seconds('1 week and 2 days');
</code>

Both of these function calls will yeild the same result.

Tags

Since

1.0.0

Parameters

$intervalstring

The string interval to convert to seconds

Returns

int

Number of seconds in the interval

minutes()
minutes($interval) : int
Convert interval to minutes

Same as the seconds function except returns the number of minutes.

Tags

Since

1.0.0

Parameters

$interval

No description

Returns

int

Minutes in interval

hours()
hours($interval) : int
Convert interval to hours

Same as the seconds function except returns the number of hours.

Tags

Since

1.0.0

Parameters

$interval

No description

Returns

int

Hours in interval

days()
days($interval) : int
Convert interval to days

Same as the seconds function except returns the number of days.

Tags

Since

1.0.0

Parameters

$interval

No description

Returns

int

Days in interval

weeks()
weeks($interval) : int
Convert interval to weeks

Same as the seconds function except returns the number of weeks.

Tags

Since

1.0.0

Parameters

$interval

No description

Returns

int

Weeks in interval

years()
years($interval) : int
Convert interval to years

Same as the seconds function except returns the number of years.

Tags

Since

1.0.0

Parameters

$interval

No description

Returns

int

Years in interval

age()
age($date)
Get the age of a date.

This helper function will return the number of years between a specified date and now. Useful for getting an age.

Tags

Since

1.0.0

$retval int Number of years from the specified date to now.

Parameters

$date

No description

uptime()
uptime($seconds) : int
Convert interval to uptime string

This function will convert an integer of seconds into an uptime string similar to what is returned by the unix uptime command. ie: ’9 days 3:32:02’

Tags

Since

1.0.0

Parameters

$seconds

No description

Returns

int

Minutes in interval

interval()
interval($seconds) : string
Return a string interval in a nice readable format.

Similar to uptime() this extends the format into a complete string in a nice, friendly readable format.

Parameters

$secondsmixed

The interval to convert in seconds.

Returns

string

A friendly string.

str_fixtype()
str_fixtype($value) : mixed
Fix a numeric string

Sometimes a numeric (int or float) will be stored as a string variable. This can cause issues with functions that check the variable type to determine what to do with it. This function allows you to simply pass a variable through it and it will ‘fix’ it. If it is a string and is a numeric value, it will be converted to the appropriate variable type.

If the value is a string and is meant to be a string, it will be left alone.

Tags

Since

1.0.0

Parameters

$valuemixed

The variable to type check and possibly fix.

Returns

mixed

The fixed variable.

http_response_text()
http_response_text($code) : mixed
Helper function to get the status text for an HTTP response code

Parameters

$codeinteger

The response code.

Returns

mixed

A string containing the response text if the code is valid. False otherwise.

hazaar_request_headers()
hazaar_request_headers()
getallheaders()
getallheaders()
apache_request_headers()
apache_request_headers()
http_response_code()
http_response_code($code = null)

Parameters

$code

No description

guid()
guid()
dump()
dump($data = null)

Parameters

$data

No description

preg_match_array()
preg_match_array($patterns, $subject, $matches = null, $flags = 0, $offset = 0)

Parameters

$patterns

No description

$subject

No description

$matches

No description

$flags

No description

$offset

No description

money_format()
money_format($format, $number) : string
Replacement for the "built-in" PHP function money_format(), which isn't always built-in.

Some systems, particularly Windows (also possible BSD) the built-in money_format() function will not be defined. This is because it’s just a wrapper for a C function called strfmon() which isn’t available on all platforms (such as Windows).

Parameters

$formatmixed

The format specification, see

$numbermixed

The number to be formatted.

Returns

string

The formatted number.

str_putcsv()
str_putcsv($input, $delimiter = ',', $enclosure = '"') : string
Convert an array into a CSV line.

Parameters

$inputarray

No description

$delimiterstring

Defaults to comma (,)

$enclosurestring

Defaults to double quote (“)

Returns

string
replace_recursive()
replace_recursive() : mixed
Replaces elements from passed arrays or objects into the first array or object recursively

NOTE: This function is almost identical to the PHP function array_replace_recursive() except that it also works with stdClass objects.

replace_recursive() replaces the values of item1 with the same values from all the following items. If a key from the first item exists in the second item, its value will be replaced by the value from the second item. If the key exists in the second item, and not the first, it will be created in the first item. If a key only exists in the first item, it will be left as is. If several items are passed for replacement, they will be processed in order, the later item overwriting the previous values.

replace_recursive() is recursive : it will recurse into item and apply the same process to the inner value.

When the value in item1 is scalar, it will be replaced by the value in item2, may it be scalar, array or stdClass. When the value in item1 and item2 are both arrays or objects, replace_recursive() will replace their respective value recursively.

Tags

Since

2.3.41

Returns

mixed