YANA 4 PHP Framework
Docs for page toolbox.php
Common tools
This file contains a variety of tools that might be usefull to all applications, no matter wether the use the rest of the framework or not.
Lowercase or uppercase all keys of an associative array
This is a recursive implementation of the PHP function array_change_key_case(). It takes the same arguments: an array $input to work on and an optional argument $case. The argument $case can be one of two constants: CASE_LOWER and CASE_UPPER, where CASE_LOWER is the default.
Name | Type | Description |
---|---|---|
$A | array | |
$case | int|bool | CASE_UPPER or CASE_LOWER |
list contents of a directory
The argument $filter may contain multiple file extension, use a pipe '|' sign to seperate them. Example: "*.xml|*.html" will find all xml- and html-files
Name | Type | Description |
---|---|---|
$dir | string | |
$filter | string | |
2 | return | array |
recursively merge two arrays to one
This function is pretty much the same as the php function "array_merge_recursive" except for the way how duplicate keys are treated. Dupplicate keys get replaced in this implementation rather than being appended.
Name | Type | Description |
---|---|---|
$A | array | |
$B | array |
Untaint user input taken from a web form
This function scrubbs your user input data shiny and clean.
It ensures: the data has a given type, maximum length, and syntax. E.g. if the data comes out of an input-field use this function with the argument $escape set to YANA_ESCAPE_LINEBREAK, to enforce the input does not have any unexpected line breaks.
Valid values for parameter $type:
Valid values for parameter $escape:
Name | Type | Description |
---|---|---|
$value | mixed | the input data |
$type | string | desired type, note that this should always be a scalar type |
$length | int | maximum length (as number of characters!), note that a float of 10.3 and length 3 will convert to 10., NOT 10.3! |
$escape | int | choose how special characters should be treated |
Documentation generated on Sat, 16 Sep 2006 17:06:16 +0200 by phpDocumentor 1.3.0RC4