- Cage
- __construct
- factory
- getIterator
- offsetSet
- offsetExists
- offsetUnset
- offsetGet
- count
- loadHTMLPurifier
- setHTMLPurifier
- getHTMLPurifier
- __call
- addAccessor
- getAlpha
- getAlnum
- getDigits
- getDir
- getInt
- getPath
- getROT13
- getPurifiedHTML
- getRaw
- testAlnum
- testAlpha
- testBetween
- testCcnum
- testDate
- testDigits
- testEmail
- testFloat
- testGreaterThan
- testHex
- testHostname
- testInt
- testIp
- testLessThan
- testOneOf
- testPhone
- testRegex
- testUri
- testZip
- noTags
- noPath
- noTagsOrSpecial
- escMySQL
- escPgSQL
- escPgSQLBytea
- keyExists
- getValue
- Exception
- Inspekt
- makeServerCage
- makeGetCage
- makePostCage
- makeCookieCage
- makeEnvCage
- makeFilesCage
- makeSuperCage
- useFilterExt
- isArrayObject
- isArrayOrArrayObject
- convertArrayToArrayObject
- getAlpha
- getAlnum
- getDigits
- getDir
- getInt
- getPath
- getROT13
- isAlnum
- isAlpha
- isBetween
- isCcnum
- isDate
- isDigits
- isEmail
- isFloat
- isGreaterThan
- isHex
- isHostname
- isInt
- isIp
- isLessThan
- isOneOf
- isPhone
- isRegex
- isUri
- isZip
- noTags
- noTagsOrSpecial
- noPath
- escMySQL
- escPgSQL
- escPgSQLBytea
- KeyDoesNotExistException
- SuperglobalsCage
- Full name: \Inspekt\Cage
- This class implements: \IteratorAggregate, \ArrayAccess, \Countable
Cage::__construct( ): \Inspekt\Cage
Takes an array and wraps it inside an object. If $strict is not set to FALSE, the original array will be destroyed, and the data can only be accessed via the object's accessor methods
Cage::factory( array &$source, string $conf_file = null, string $conf_section = null, boolean $strict = true ): \Inspekt\Cage
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$source |
array | |
$conf_file |
string | |
$conf_section |
string | |
$strict |
boolean |
Returns an iterator for looping through an ArrayObject.
Cage::getIterator( ): \ArrayIterator
Sets the value at the specified
Cage::offsetSet( mixed $offset, mixed $value ): void
Parameters:
Parameter | Type | Description |
---|---|---|
$offset |
mixed | |
$value |
mixed |
Returns whether the $offset exists in $this->source.
Cage::offsetExists( mixed $offset ): boolean
Parameters:
Parameter | Type | Description |
---|---|---|
$offset |
mixed |
Unsets the value in $this->source at $offset.
Cage::offsetUnset( mixed $offset ): void
Parameters:
Parameter | Type | Description |
---|---|---|
$offset |
mixed |
Returns the value at $offset from $this->source.
Cage::offsetGet( mixed $offset ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$offset |
mixed |
Returns the number of elements in $this->source.
Cage::count( ): integer
Load the HTMLPurifier library and instantiate the object
Cage::loadHTMLPurifier( mixed $opts = null )
Parameters:
Parameter | Type | Description |
---|---|---|
$opts |
mixed | options that are sent to HTMLPurifier. Optional |
Cage::setHTMLPurifier( \HTMLPurifier $pobj )
Parameters:
Parameter | Type | Description |
---|---|---|
$pobj |
\HTMLPurifier | an HTMLPurifer Object |
Cage::getHTMLPurifier( ): \HTMLPurifier
Cage::__call( $name, $args ): boolean|mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$name |
**** | |
$args |
**** |
This method lets the developer add new accessor methods to a cage object Note that calling these will be quite a bit slower, because we have to use call_user_func()
Cage::addAccessor( string $accessor_name ): void
The dev needs to define a procedural function like so:
function foo_bar($cage_object, $arg2, $arg3, $arg4, $arg5...) {
...
}
Parameters:
Parameter | Type | Description |
---|---|---|
$accessor_name |
string |
Returns only the alphabetic characters in value.
Cage::getAlpha( mixed $key ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
mixed |
Returns only the alphabetic characters and digits in value.
Cage::getAlnum( mixed $key ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
mixed |
Returns only the digits in value. This differs from getInt().
Cage::getDigits( mixed $key ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
mixed |
Returns dirname(value).
Cage::getDir( mixed $key ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
mixed |
Returns (int) value.
Cage::getInt( mixed $key ): integer
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
mixed |
Returns realpath(value).
Cage::getPath( mixed $key ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
mixed |
Returns ROT13-encoded version
Cage::getROT13( string $key ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
string |
This returns the value of the given key passed through the HTMLPurifer object, if it is instantiated with Cage::loadHTMLPurifer
Cage::getPurifiedHTML( string $key ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
string |
Return Value:
purified HTML version of input
Returns value.
Cage::getRaw( string $key ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
string |
Returns value if every character is alphabetic or a digit, FALSE otherwise.
Cage::testAlnum( mixed $key ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
mixed |
Returns value if every character is alphabetic, FALSE otherwise.
Cage::testAlpha( mixed $key ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
mixed |
Returns value if it is greater than or equal to $min and less than or equal to $max, FALSE otherwise. If $inc is set to FALSE, then the value must be strictly greater than $min and strictly less than $max.
Cage::testBetween( mixed $key, mixed $min, mixed $max, boolean $inc = true ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
mixed | |
$min |
mixed | |
$max |
mixed | |
$inc |
boolean |
Returns value if it is a valid credit card number format. The optional second argument allows developers to indicate the type.
Cage::testCcnum( mixed $key, mixed $type = null ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
mixed | |
$type |
mixed |
Returns $value if it is a valid date, FALSE otherwise. The date is required to be in ISO 8601 format.
Cage::testDate( mixed $key ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
mixed |
Returns value if every character is a digit, FALSE otherwise.
Cage::testDigits( mixed $key ): mixed
This is just like isInt(), except there is no upper limit.
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
mixed |
Returns value if it is a valid email format, FALSE otherwise.
Cage::testEmail( mixed $key ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
mixed |
Returns value if it is a valid float value, FALSE otherwise.
Cage::testFloat( mixed $key ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
mixed |
Returns value if it is greater than $min, FALSE otherwise.
Cage::testGreaterThan( mixed $key, mixed $min = null ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
mixed | |
$min |
mixed |
Returns value if it is a valid hexadecimal format, FALSE otherwise.
Cage::testHex( mixed $key ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
mixed |
Returns value if it is a valid hostname, FALSE otherwise.
Cage::testHostname( mixed $key, integer $allow = \Inspekt\Inspekt::ISPK_HOST_ALLOW_ALL ): mixed
Depending upon the value of $allow, Internet domain names, IP addresses, and/or local network names are considered valid. The default is HOST_ALLOW_ALL, which considers all of the above to be valid.
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
mixed | |
$allow |
integer | bitfield for HOST_ALLOW_DNS, HOST_ALLOW_IP, HOST_ALLOW_LOCAL |
Returns value if it is a valid integer value, FALSE otherwise.
Cage::testInt( mixed $key ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
mixed |
Returns value if it is a valid IP format, FALSE otherwise.
Cage::testIp( mixed $key ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
mixed |
Returns value if it is less than $max, FALSE otherwise.
Cage::testLessThan( mixed $key, mixed $max = null ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
mixed | |
$max |
mixed |
Returns value if it is one of $allowed, FALSE otherwise.
Cage::testOneOf( mixed $key, null $allowed = null ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
mixed | |
$allowed |
null |
Returns value if it is a valid phone number format, FALSE otherwise. The optional second argument indicates the country.
Cage::testPhone( mixed $key, string $country = 'US' ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
mixed | |
$country |
string |
Returns value if it matches $pattern, FALSE otherwise. Uses preg_match() for the matching.
Cage::testRegex( mixed $key, mixed $pattern ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
mixed | |
$pattern |
mixed |
Enter description here.
Cage::testUri( string $key ): boolean|string
..
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
string |
Returns value if it is a valid US ZIP, FALSE otherwise.
Cage::testZip( mixed $key ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
mixed |
Returns value with all tags removed.
Cage::noTags( mixed $key ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
mixed |
Returns basename(value).
Cage::noPath( mixed $key ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
mixed |
Cage::noTagsOrSpecial( $key ): array|boolean|mixed|string
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
**** |
Cage::escMySQL( string $key, resource $conn ): boolean|mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
string | |
$conn |
resource | a connection resource |
Cage::escPgSQL( $key, null $conn = null ): boolean|mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
**** | |
$conn |
null |
Cage::escPgSQLBytea( $key, null $conn = null ): boolean|mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
**** | |
$conn |
null |
Checks if a key exists
Cage::keyExists( mixed $key ): boolean
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
mixed |
Retrieves a value from the source array. This should NOT be called directly, but needs to be public for use by AccessorAbstract. Maybe a different approach should be considered
Cage::getValue( string $key ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
string |
Class Exception
- Full name: \Inspekt\Exception
- Parent class:
- Full name: \Inspekt\Inspekt
Returns the $_SERVER data wrapped in an Cage object
Inspekt::makeServerCage( string $config_file = null, boolean $strict = true ): \Inspekt\Cage
This utilizes a singleton pattern to get around scoping issues
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$config_file |
string | |
$strict |
boolean | whether or not to nullify the superglobal array |
Returns the $_GET data wrapped in an Cage object
Inspekt::makeGetCage( string $config_file = null, boolean $strict = true ): \Inspekt\Cage
This utilizes a singleton pattern to get around scoping issues
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$config_file |
string | |
$strict |
boolean | whether or not to nullify the superglobal array |
Returns the $_POST data wrapped in an Cage object
Inspekt::makePostCage( string $config_file = null, boolean $strict = true ): \Inspekt\Cage
This utilizes a singleton pattern to get around scoping issues
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$config_file |
string | |
$strict |
boolean | whether or not to nullify the superglobal array |
Returns the $_COOKIE data wrapped in an Cage object
Inspekt::makeCookieCage( string $config_file = null, boolean $strict = true ): \Inspekt\Cage
This utilizes a singleton pattern to get around scoping issues
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$config_file |
string | |
$strict |
boolean | whether or not to nullify the superglobal array |
Returns the $_ENV data wrapped in an Cage object
Inspekt::makeEnvCage( string $config_file = null, boolean $strict = true ): \Inspekt\Cage
This utilizes a singleton pattern to get around scoping issues
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$config_file |
string | |
$strict |
boolean | whether or not to nullify the superglobal array |
Returns the $_FILES data wrapped in an Cage object
Inspekt::makeFilesCage( string $config_file = null, boolean $strict = true ): \Inspekt\Cage
This utilizes a singleton pattern to get around scoping issues
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$config_file |
string | |
$strict |
boolean | whether or not to nullify the superglobal array |
Returns a SuperglobalsCage object, which wraps ALL input superglobals
Inspekt::makeSuperCage( string $config_file = null, boolean $strict = true ): \Inspekt\SuperglobalsCage
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$config_file |
string | |
$strict |
boolean | whether or not to nullify the superglobal |
Sets and/or retrieves whether we should use the PHP filter extensions where possible If a param is passed, it will set the state in addition to returning it
Inspekt::useFilterExt( boolean $state = null ): boolean
We use this method of storing in a static class property so that we can access the value outside of class instances
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$state |
boolean | optional |
Checks to see if this is an ArrayObject
Inspekt::isArrayObject( $obj ): boolean
- This method is static.* Warning: this method is deprecated. This means that this method will likely be removed in a future version.
Parameters:
Parameter | Type | Description |
---|---|---|
$obj |
**** |
See Also:
Checks to see if this is an array or an ArrayObject
Inspekt::isArrayOrArrayObject( $arr ): boolean
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$arr |
**** |
See Also:
Converts an array into an ArrayObject. We use ArrayObjects when walking arrays in Inspekt
Inspekt::convertArrayToArrayObject( &$arr ): \ArrayObject
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$arr |
**** |
Returns only the alphabetic characters in value.
Inspekt::getAlpha( mixed $value ): mixed
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$value |
mixed |
Returns only the alphabetic characters and digits in value.
Inspekt::getAlnum( mixed $value ): mixed
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$value |
mixed |
Returns only the digits in value.
Inspekt::getDigits( mixed $value ): mixed
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$value |
mixed |
Returns dirname(value).
Inspekt::getDir( mixed $value ): mixed
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$value |
mixed |
Returns (int) value.
Inspekt::getInt( mixed $value ): integer
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$value |
mixed |
Returns realpath(value).
Inspekt::getPath( mixed $value ): mixed
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$value |
mixed |
Returns the value encoded as ROT13 (or decoded, if already was ROT13)
Inspekt::getROT13( mixed $value ): mixed
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$value |
mixed |
See Also:
Returns true if every character is alphabetic or a digit, false otherwise.
Inspekt::isAlnum( mixed $value ): boolean
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$value |
mixed |
Returns true if every character is alphabetic, false otherwise.
Inspekt::isAlpha( mixed $value ): boolean
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$value |
mixed |
Returns true if value is greater than or equal to $min and less than or equal to $max, false otherwise. If $inc is set to false, then the value must be strictly greater than $min and strictly less than $max.
Inspekt::isBetween( mixed $value, mixed $min, mixed $max, boolean $inc = true ): boolean
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$value |
mixed | |
$min |
mixed | |
$max |
mixed | |
$inc |
boolean |
Returns true if it is a valid credit card number format. The optional second argument allows developers to indicate the type.
Inspekt::isCcnum( mixed $value, mixed $type = null ): boolean
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$value |
mixed | |
$type |
mixed |
Returns true if value is a valid date, false otherwise. The date is required to be in ISO 8601 format.
Inspekt::isDate( mixed $value ): boolean
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$value |
mixed |
Returns true if every character is a digit, false otherwise.
Inspekt::isDigits( mixed $value ): boolean
This is just like isInt(), except there is no upper limit.
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$value |
mixed |
Returns true if value is a valid email format, false otherwise.
Inspekt::isEmail( string $value ): boolean
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$value |
string |
See Also:
- http://www.regular-expressions.info/email.html * \Inspekt\Inspekt::ISPK_EMAIL_VALID
Returns true if value is a valid float value, false otherwise.
Inspekt::isFloat( string $value ): boolean
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$value |
string |
Returns true if value is greater than $min, false otherwise.
Inspekt::isGreaterThan( mixed $value, mixed $min ): boolean
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$value |
mixed | |
$min |
mixed |
Returns true if value is a valid hexadecimal format, false otherwise.
Inspekt::isHex( mixed $value ): boolean
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$value |
mixed |
Returns true if value is a valid hostname, false otherwise.
Inspekt::isHostname( mixed $value, integer $allow = self::ISPK_HOST_ALLOW_ALL ): boolean
Depending upon the value of $allow, Internet domain names, IP addresses, and/or local network names are considered valid. The default is HOST_ALLOW_ALL, which considers all of the above to be valid.
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$value |
mixed | |
$allow |
integer | bitfield for self::ISPK_HOST_ALLOW_DNS, self::ISPK_HOST_ALLOW_IP, self::ISPK_HOST_ALLOW_LOCAL |
Returns true if value is a valid integer value, false otherwise.
Inspekt::isInt( string|array $value ): boolean
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$value |
string|array |
Returns true if value is a valid IPV4 format, false otherwise.
Inspekt::isIp( mixed $value ): boolean
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$value |
mixed |
Returns true if value is less than $max, false otherwise.
Inspekt::isLessThan( mixed $value, mixed $max ): boolean
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$value |
mixed | |
$max |
mixed |
Returns true if value is one of $allowed, false otherwise.
Inspekt::isOneOf( mixed $value, array|string $allowed ): boolean
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$value |
mixed | |
$allowed |
array|string |
Returns true if value is a valid phone number format, false otherwise. The optional second argument indicates the country.
Inspekt::isPhone( mixed $value, string $country = 'US' ): boolean
This method requires that the value consist of only digits.
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$value |
mixed | |
$country |
string |
Returns true if value matches $pattern, false otherwise. Uses preg_match() for the matching.
Inspekt::isRegex( mixed $value, mixed $pattern ): mixed
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$value |
mixed | |
$pattern |
mixed |
Enter description here.
Inspekt::isUri( string $value, integer $mode = self::ISPK_URI_ALLOW_COMMON ): boolean
..
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$value |
string | |
$mode |
integer |
See Also:
Returns true if value is a valid US ZIP, false otherwise.
Inspekt::isZip( mixed $value ): boolean
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$value |
mixed |
Returns value with all tags removed.
Inspekt::noTags( mixed $value ): mixed
This will utilize the PHP Filter extension if available
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$value |
mixed |
returns value with tags stripped and the chars '"&<> and all ascii chars under 32 encoded as html entities
Inspekt::noTagsOrSpecial( mixed $value ): array|mixed|string
This will utilize the PHP Filter extension if available
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$value |
mixed |
Return Value:
@mixed
Returns basename(value).
Inspekt::noPath( mixed $value ): mixed
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$value |
mixed |
Escapes the value given with mysql_real_escape_string
Inspekt::escMySQL( string $value, resource $conn ): mixed
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$value |
string | |
$conn |
resource | the mysql connection. If none is given, it will use the last link opened, |
per behavior of mysql_real_escape_string |
See Also:
Escapes the value given with pg_escape_string
Inspekt::escPgSQL( mixed $value, resource $conn = null ): mixed
If the data is for a column of the type bytea, use Inspekt::escPgSQLBytea()
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$value |
mixed | |
$conn |
resource | the postgresql connection. If none is given, it will use the last link opened, |
per behavior of pg_escape_string |
See Also:
Escapes the value given with pg_escape_bytea
Inspekt::escPgSQLBytea( mixed $value, resource $conn = null ): mixed
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$value |
mixed | |
$conn |
resource | the postgresql connection. If none is given, it will use the last link opened, |
per behavior of pg_escape_bytea |
See Also:
Class KeyDoesNotExistException
- Full name: \Inspekt\KeyDoesNotExistException
- Parent class:
The SuperglobalsCage object wraps ALL of the superglobals
- Full name: \Inspekt\SuperglobalsCage
Enter description here.
SuperglobalsCage::__construct( ): \Inspekt\SuperglobalsCage
..
Enter description here.
SuperglobalsCage::factory( string $config_file = null, boolean $strict = true ): \Inspekt\SuperglobalsCage
..
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$config_file |
string | |
$strict |
boolean |
SuperglobalsCage::addAccessor( $name )
Parameters:
Parameter | Type | Description |
---|---|---|
$name |
**** |
This document was automatically generated from source code comments on 2019-05-10 using phpDocumentor and cvuorinen/phpdoc-markdown-public