PHP 클래스 Inspekt\Cage

상속: implements IteratorAggregate, implements ArrayAccess, implements Countable
파일 보기 프로젝트 열기: funkatron/inspekt 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$autofilter_conf array the holding property for autofilter config
$purifier HTMLPurifer
$user_accessors array where we store user-defined methods

보호된 프로퍼티들

프로퍼티 타입 설명
$source ArrayObject Don't try to access this. ever. Now that we're safely on PHP5, we'll enforce this with the "protected" keyword.

공개 메소드들

메소드 설명
__call ( $name, $args ) : boolean | mixed
__construct ( ) : Cage
addAccessor ( string $accessor_name ) : void 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()
count ( ) : integer Returns the number of elements in $this->source.
escMySQL ( string $key, resource $conn ) : boolean | mixed
escPgSQL ( $key, null $conn = null ) : boolean | mixed
escPgSQLBytea ( $key, null $conn = null ) : boolean | mixed
factory ( array &$source, string $conf_file = null, string $conf_section = null, boolean $strict = true ) : 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
getAlnum ( mixed $key ) : mixed Returns only the alphabetic characters and digits in value.
getAlpha ( mixed $key ) : mixed Returns only the alphabetic characters in value.
getDigits ( mixed $key ) : mixed Returns only the digits in value. This differs from getInt().
getDir ( mixed $key ) : mixed Returns dirname(value).
getHTMLPurifier ( ) : HTMLPurifier
getInt ( mixed $key ) : integer Returns (int) value.
getIterator ( ) : ArrayIterator Returns an iterator for looping through an ArrayObject.
getPath ( mixed $key ) : mixed Returns realpath(value).
getPurifiedHTML ( string $key ) : mixed This returns the value of the given key passed through the HTMLPurifer object, if it is instantiated with Cage::loadHTMLPurifer
getROT13 ( string $key ) : mixed Returns ROT13-encoded version
getRaw ( string $key ) : mixed Returns value.
getValue ( string $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
keyExists ( mixed $key ) : boolean Checks if a key exists
loadHTMLPurifier ( mixed $opts = null ) Load the HTMLPurifier library and instantiate the object
noPath ( mixed $key ) : mixed Returns basename(value).
noTags ( mixed $key ) : mixed Returns value with all tags removed.
noTagsOrSpecial ( $key ) : array | boolean | mixed | string
offsetExists ( mixed $offset ) : boolean Returns whether the $offset exists in $this->source.
offsetGet ( mixed $offset ) : mixed Returns the value at $offset from $this->source.
offsetSet ( mixed $offset, mixed $value ) : void Sets the value at the specified $offset to value$ in $this->source.
offsetUnset ( mixed $offset ) : void Unsets the value in $this->source at $offset.
setHTMLPurifier ( HTMLPurifier $pobj )
testAlnum ( mixed $key ) : mixed Returns value if every character is alphabetic or a digit, FALSE otherwise.
testAlpha ( mixed $key ) : mixed Returns value if every character is alphabetic, FALSE otherwise.
testBetween ( mixed $key, mixed $min, mixed $max, boolean $inc = true ) : 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.
testCcnum ( mixed $key, mixed $type = null ) : mixed Returns value if it is a valid credit card number format. The optional second argument allows developers to indicate the type.
testDate ( mixed $key ) : mixed Returns $value if it is a valid date, FALSE otherwise. The date is required to be in ISO 8601 format.
testDigits ( mixed $key ) : mixed Returns value if every character is a digit, FALSE otherwise.
testEmail ( mixed $key ) : mixed Returns value if it is a valid email format, FALSE otherwise.
testFloat ( mixed $key ) : mixed Returns value if it is a valid float value, FALSE otherwise.
testGreaterThan ( mixed $key, mixed $min = null ) : mixed Returns value if it is greater than $min, FALSE otherwise.
testHex ( mixed $key ) : mixed Returns value if it is a valid hexadecimal format, FALSE otherwise.
testHostname ( mixed $key, integer $allow = Inspekt::ISPK_HOST_ALLOW_ALL ) : mixed Returns value if it is a valid hostname, FALSE otherwise.
testInt ( mixed $key ) : mixed Returns value if it is a valid integer value, FALSE otherwise.
testIp ( mixed $key ) : mixed Returns value if it is a valid IP format, FALSE otherwise.
testLessThan ( mixed $key, mixed $max = null ) : mixed Returns value if it is less than $max, FALSE otherwise.
testOneOf ( mixed $key, null $allowed = null ) : mixed Returns value if it is one of $allowed, FALSE otherwise.
testPhone ( mixed $key, string $country = 'US' ) : mixed Returns value if it is a valid phone number format, FALSE otherwise. The optional second argument indicates the country.
testRegex ( mixed $key, mixed $pattern ) : mixed Returns value if it matches $pattern, FALSE otherwise. Uses preg_match() for the matching.
testUri ( string $key ) : boolean | string Enter description here.
testZip ( mixed $key ) : mixed Returns value if it is a valid US ZIP, FALSE otherwise.

보호된 메소드들

메소드 설명
applyAutoFilters ( )
buildHTMLPurifierConfig ( $opts ) : HTMLPurifier_Config
getValueOrNull ( $key ) : mixed
getValueRecursive ( $keys, $data_array, integer $level ) : boolean
keyExistsRecursive ( $keys, $data_array ) : boolean
parseAndApplyAutoFilters ( $conf_file, $conf_section )
setValue ( mixed $key, mixed $val ) : mixed Sets a value in the source array. Used by applyAutoFilters.
setValueRecursive ( $keys, $val, $data_array, integer $level ) : boolean

비공개 메소드들

메소드 설명
setSource ( array &$newsource ) {@internal we use this to set the data array in factory()}}

메소드 상세

__call() 공개 메소드

public __call ( $name, $args ) : boolean | mixed
$name
$args
리턴 boolean | mixed

__construct() 공개 메소드

public __construct ( ) : Cage
리턴 Cage

addAccessor() 공개 메소드

The dev needs to define a procedural function like so: function foo_bar($cage_object, $arg2, $arg3, $arg4, $arg5...) { ... }
저자: Ed Finkler
public addAccessor ( string $accessor_name ) : void
$accessor_name string
리턴 void

applyAutoFilters() 보호된 메소드

또한 보기: Cage::parseAndApplyAutoFilters
protected applyAutoFilters ( )

buildHTMLPurifierConfig() 보호된 메소드

protected buildHTMLPurifierConfig ( $opts ) : HTMLPurifier_Config
$opts
리턴 HTMLPurifier_Config

count() 공개 메소드

Returns the number of elements in $this->source.
public count ( ) : integer
리턴 integer

escMySQL() 공개 메소드

public escMySQL ( string $key, resource $conn ) : boolean | mixed
$key string
$conn resource a connection resource
리턴 boolean | mixed

escPgSQL() 공개 메소드

public escPgSQL ( $key, null $conn = null ) : boolean | mixed
$key
$conn null
리턴 boolean | mixed

escPgSQLBytea() 공개 메소드

public escPgSQLBytea ( $key, null $conn = null ) : boolean | mixed
$key
$conn null
리턴 boolean | mixed

factory() 공개 정적인 메소드

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
public static factory ( array &$source, string $conf_file = null, string $conf_section = null, boolean $strict = true ) : Cage
$source array
$conf_file string
$conf_section string
$strict boolean
리턴 Cage

getAlnum() 공개 메소드

Returns only the alphabetic characters and digits in value.
public getAlnum ( mixed $key ) : mixed
$key mixed
리턴 mixed

getAlpha() 공개 메소드

Returns only the alphabetic characters in value.
public getAlpha ( mixed $key ) : mixed
$key mixed
리턴 mixed

getDigits() 공개 메소드

Returns only the digits in value. This differs from getInt().
public getDigits ( mixed $key ) : mixed
$key mixed
리턴 mixed

getDir() 공개 메소드

Returns dirname(value).
public getDir ( mixed $key ) : mixed
$key mixed
리턴 mixed

getHTMLPurifier() 공개 메소드

public getHTMLPurifier ( ) : HTMLPurifier
리턴 HTMLPurifier

getInt() 공개 메소드

Returns (int) value.
public getInt ( mixed $key ) : integer
$key mixed
리턴 integer

getIterator() 공개 메소드

Returns an iterator for looping through an ArrayObject.

getPath() 공개 메소드

Returns realpath(value).
public getPath ( mixed $key ) : mixed
$key mixed
리턴 mixed

getPurifiedHTML() 공개 메소드

This returns the value of the given key passed through the HTMLPurifer object, if it is instantiated with Cage::loadHTMLPurifer
public getPurifiedHTML ( string $key ) : mixed
$key string
리턴 mixed purified HTML version of input

getROT13() 공개 메소드

Returns ROT13-encoded version
public getROT13 ( string $key ) : mixed
$key string
리턴 mixed

getRaw() 공개 메소드

Returns value.
public getRaw ( string $key ) : mixed
$key string
리턴 mixed

getValue() 공개 메소드

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
public getValue ( string $key ) : mixed
$key string
리턴 mixed

getValueOrNull() 보호된 메소드

protected getValueOrNull ( $key ) : mixed
$key
리턴 mixed

getValueRecursive() 보호된 메소드

protected getValueRecursive ( $keys, $data_array, integer $level ) : boolean
$keys
$data_array
$level integer
리턴 boolean

keyExists() 공개 메소드

Checks if a key exists
public keyExists ( mixed $key ) : boolean
$key mixed
리턴 boolean

keyExistsRecursive() 보호된 메소드

protected keyExistsRecursive ( $keys, $data_array ) : boolean
$keys
$data_array
리턴 boolean

loadHTMLPurifier() 공개 메소드

Load the HTMLPurifier library and instantiate the object
public loadHTMLPurifier ( mixed $opts = null )
$opts mixed options that are sent to HTMLPurifier. Optional

noPath() 공개 메소드

Returns basename(value).
public noPath ( mixed $key ) : mixed
$key mixed
리턴 mixed

noTags() 공개 메소드

Returns value with all tags removed.
public noTags ( mixed $key ) : mixed
$key mixed
리턴 mixed

noTagsOrSpecial() 공개 메소드

public noTagsOrSpecial ( $key ) : array | boolean | mixed | string
$key
리턴 array | boolean | mixed | string

offsetExists() 공개 메소드

Returns whether the $offset exists in $this->source.
public offsetExists ( mixed $offset ) : boolean
$offset mixed
리턴 boolean

offsetGet() 공개 메소드

Returns the value at $offset from $this->source.
public offsetGet ( mixed $offset ) : mixed
$offset mixed
리턴 mixed

offsetSet() 공개 메소드

Sets the value at the specified $offset to value$ in $this->source.
public offsetSet ( mixed $offset, mixed $value ) : void
$offset mixed
$value mixed
리턴 void

offsetUnset() 공개 메소드

Unsets the value in $this->source at $offset.
public offsetUnset ( mixed $offset ) : void
$offset mixed
리턴 void

parseAndApplyAutoFilters() 보호된 메소드

또한 보기: Cage::factory
protected parseAndApplyAutoFilters ( $conf_file, $conf_section )
$conf_file
$conf_section

setHTMLPurifier() 공개 메소드

public setHTMLPurifier ( HTMLPurifier $pobj )
$pobj HTMLPurifier an HTMLPurifer Object

setValue() 보호된 메소드

Sets a value in the source array. Used by applyAutoFilters.
또한 보기: Cage::applyAutoFilters
protected setValue ( mixed $key, mixed $val ) : mixed
$key mixed
$val mixed
리턴 mixed

setValueRecursive() 보호된 메소드

또한 보기: Cage::setValue
protected setValueRecursive ( $keys, $val, $data_array, integer $level ) : boolean
$keys
$val
$data_array
$level integer
리턴 boolean

testAlnum() 공개 메소드

Returns value if every character is alphabetic or a digit, FALSE otherwise.
public testAlnum ( mixed $key ) : mixed
$key mixed
리턴 mixed

testAlpha() 공개 메소드

Returns value if every character is alphabetic, FALSE otherwise.
public testAlpha ( mixed $key ) : mixed
$key mixed
리턴 mixed

testBetween() 공개 메소드

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.
public testBetween ( mixed $key, mixed $min, mixed $max, boolean $inc = true ) : mixed
$key mixed
$min mixed
$max mixed
$inc boolean
리턴 mixed

testCcnum() 공개 메소드

Returns value if it is a valid credit card number format. The optional second argument allows developers to indicate the type.
public testCcnum ( mixed $key, mixed $type = null ) : mixed
$key mixed
$type mixed
리턴 mixed

testDate() 공개 메소드

Returns $value if it is a valid date, FALSE otherwise. The date is required to be in ISO 8601 format.
public testDate ( mixed $key ) : mixed
$key mixed
리턴 mixed

testDigits() 공개 메소드

This is just like isInt(), except there is no upper limit.
public testDigits ( mixed $key ) : mixed
$key mixed
리턴 mixed

testEmail() 공개 메소드

Returns value if it is a valid email format, FALSE otherwise.
public testEmail ( mixed $key ) : mixed
$key mixed
리턴 mixed

testFloat() 공개 메소드

Returns value if it is a valid float value, FALSE otherwise.
public testFloat ( mixed $key ) : mixed
$key mixed
리턴 mixed

testGreaterThan() 공개 메소드

Returns value if it is greater than $min, FALSE otherwise.
public testGreaterThan ( mixed $key, mixed $min = null ) : mixed
$key mixed
$min mixed
리턴 mixed

testHex() 공개 메소드

Returns value if it is a valid hexadecimal format, FALSE otherwise.
public testHex ( mixed $key ) : mixed
$key mixed
리턴 mixed

testHostname() 공개 메소드

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.
public testHostname ( mixed $key, integer $allow = Inspekt::ISPK_HOST_ALLOW_ALL ) : mixed
$key mixed
$allow integer bitfield for HOST_ALLOW_DNS, HOST_ALLOW_IP, HOST_ALLOW_LOCAL
리턴 mixed

testInt() 공개 메소드

Returns value if it is a valid integer value, FALSE otherwise.
public testInt ( mixed $key ) : mixed
$key mixed
리턴 mixed

testIp() 공개 메소드

Returns value if it is a valid IP format, FALSE otherwise.
public testIp ( mixed $key ) : mixed
$key mixed
리턴 mixed

testLessThan() 공개 메소드

Returns value if it is less than $max, FALSE otherwise.
public testLessThan ( mixed $key, mixed $max = null ) : mixed
$key mixed
$max mixed
리턴 mixed

testOneOf() 공개 메소드

Returns value if it is one of $allowed, FALSE otherwise.
public testOneOf ( mixed $key, null $allowed = null ) : mixed
$key mixed
$allowed null
리턴 mixed

testPhone() 공개 메소드

Returns value if it is a valid phone number format, FALSE otherwise. The optional second argument indicates the country.
public testPhone ( mixed $key, string $country = 'US' ) : mixed
$key mixed
$country string
리턴 mixed

testRegex() 공개 메소드

Returns value if it matches $pattern, FALSE otherwise. Uses preg_match() for the matching.
public testRegex ( mixed $key, mixed $pattern ) : mixed
$key mixed
$pattern mixed
리턴 mixed

testUri() 공개 메소드

..
public testUri ( string $key ) : boolean | string
$key string
리턴 boolean | string

testZip() 공개 메소드

Returns value if it is a valid US ZIP, FALSE otherwise.
public testZip ( mixed $key ) : mixed
$key mixed
리턴 mixed

프로퍼티 상세

$autofilter_conf 공개적으로 프로퍼티

the holding property for autofilter config
public array $autofilter_conf
리턴 array

$purifier 공개적으로 프로퍼티

public HTMLPurifer $purifier
리턴 HTMLPurifer

$source 보호되어 있는 프로퍼티

Don't try to access this. ever. Now that we're safely on PHP5, we'll enforce this with the "protected" keyword.
protected ArrayObject $source
리턴 ArrayObject

$user_accessors 공개적으로 프로퍼티

where we store user-defined methods
public array $user_accessors
리턴 array