PHP Класс Inspekt\Inspekt

Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$useFilterExtension

Открытые методы

Метод Описание
convertArrayToArrayObject ( &$arr ) : ArrayObject Converts an array into an ArrayObject. We use ArrayObjects when walking arrays in Inspekt
escMySQL ( string $value, resource $conn ) : mixed Escapes the value given with mysql_real_escape_string
escPgSQL ( mixed $value, resource $conn = null ) : mixed Escapes the value given with pg_escape_string
escPgSQLBytea ( mixed $value, resource $conn = null ) : mixed Escapes the value given with pg_escape_bytea
getAlnum ( mixed $value ) : mixed Returns only the alphabetic characters and digits in value.
getAlpha ( mixed $value ) : mixed Returns only the alphabetic characters in value.
getDigits ( mixed $value ) : mixed Returns only the digits in value.
getDir ( mixed $value ) : mixed Returns dirname(value).
getInt ( mixed $value ) : integer Returns (int) value.
getPath ( mixed $value ) : mixed Returns realpath(value).
getROT13 ( mixed $value ) : mixed Returns the value encoded as ROT13 (or decoded, if already was ROT13)
isAlnum ( mixed $value ) : boolean Returns true if every character is alphabetic or a digit, false otherwise.
isAlpha ( mixed $value ) : boolean Returns true if every character is alphabetic, false otherwise.
isArrayObject ( $obj ) : boolean Checks to see if this is an ArrayObject
isArrayOrArrayObject ( $arr ) : boolean Checks to see if this is an array or an ArrayObject
isBetween ( mixed $value, mixed $min, mixed $max, boolean $inc = true ) : boolean 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.
isCcnum ( mixed $value, mixed $type = null ) : boolean Returns true if it is a valid credit card number format. The optional second argument allows developers to indicate the type.
isDate ( mixed $value ) : boolean Returns true if value is a valid date, false otherwise. The date is required to be in ISO 8601 format.
isDigits ( mixed $value ) : boolean Returns true if every character is a digit, false otherwise.
isEmail ( string $value ) : boolean Returns true if value is a valid email format, false otherwise.
isFloat ( string $value ) : boolean Returns true if value is a valid float value, false otherwise.
isGreaterThan ( mixed $value, mixed $min ) : boolean Returns true if value is greater than $min, false otherwise.
isHex ( mixed $value ) : boolean Returns true if value is a valid hexadecimal format, false otherwise.
isHostname ( mixed $value, integer $allow = self::ISPK_HOST_ALLOW_ALL ) : boolean Returns true if value is a valid hostname, false otherwise.
isInt ( string | array $value ) : boolean Returns true if value is a valid integer value, false otherwise.
isIp ( mixed $value ) : boolean Returns true if value is a valid IPV4 format, false otherwise.
isLessThan ( mixed $value, mixed $max ) : boolean Returns true if value is less than $max, false otherwise.
isOneOf ( mixed $value, array | string $allowed ) : boolean Returns true if value is one of $allowed, false otherwise.
isPhone ( mixed $value, string $country = 'US' ) : boolean Returns true if value is a valid phone number format, false otherwise. The optional second argument indicates the country.
isRegex ( mixed $value, mixed $pattern ) : mixed Returns true if value matches $pattern, false otherwise. Uses preg_match() for the matching.
isUri ( string $value, integer $mode = self::ISPK_URI_ALLOW_COMMON ) : boolean Enter description here.
isZip ( mixed $value ) : boolean Returns true if value is a valid US ZIP, false otherwise.
makeCookieCage ( string $config_file = null, boolean $strict = true ) : Cage Returns the $_COOKIE data wrapped in an Cage object
makeEnvCage ( string $config_file = null, boolean $strict = true ) : Cage Returns the $_ENV data wrapped in an Cage object
makeFilesCage ( string $config_file = null, boolean $strict = true ) : Cage Returns the $_FILES data wrapped in an Cage object
makeGetCage ( string $config_file = null, boolean $strict = true ) : Cage Returns the $_GET data wrapped in an Cage object
makePostCage ( string $config_file = null, boolean $strict = true ) : Cage Returns the $_POST data wrapped in an Cage object
makeServerCage ( string $config_file = null, boolean $strict = true ) : Cage Returns the $_SERVER data wrapped in an Cage object
makeSuperCage ( string $config_file = null, boolean $strict = true ) : SuperglobalsCage Returns a SuperglobalsCage object, which wraps ALL input superglobals
noPath ( mixed $value ) : mixed Returns basename(value).
noTags ( mixed $value ) : mixed Returns value with all tags removed.
noTagsOrSpecial ( mixed $value ) : array | mixed | string returns value with tags stripped and the chars '"&<> and all ascii chars under 32 encoded as html entities
useFilterExt ( boolean $state = null ) : boolean 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

Защищенные методы

Метод Описание
walkArray ( array | ArrayObjec\ArrayObject $input, string $method, string | null $classname = null ) : array Recursively walks an array and applies a given filter method to every value in the array.

Описание методов

convertArrayToArrayObject() публичный статический Метод

Converts an array into an ArrayObject. We use ArrayObjects when walking arrays in Inspekt
public static convertArrayToArrayObject ( &$arr ) : ArrayObject
Результат ArrayObject

escMySQL() публичный статический Метод

Escapes the value given with mysql_real_escape_string
public static escMySQL ( string $value, resource $conn ) : mixed
$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
Результат mixed

escPgSQL() публичный статический Метод

If the data is for a column of the type bytea, use Inspekt::escPgSQLBytea()
public static escPgSQL ( mixed $value, resource $conn = null ) : mixed
$value mixed
$conn resource the postgresql connection. If none is given, it will use the last link opened, per behavior of pg_escape_string
Результат mixed

escPgSQLBytea() публичный статический Метод

Escapes the value given with pg_escape_bytea
public static escPgSQLBytea ( mixed $value, resource $conn = null ) : mixed
$value mixed
$conn resource the postgresql connection. If none is given, it will use the last link opened, per behavior of pg_escape_bytea
Результат mixed

getAlnum() публичный статический Метод

Returns only the alphabetic characters and digits in value.
public static getAlnum ( mixed $value ) : mixed
$value mixed
Результат mixed

getAlpha() публичный статический Метод

Returns only the alphabetic characters in value.
public static getAlpha ( mixed $value ) : mixed
$value mixed
Результат mixed

getDigits() публичный статический Метод

Returns only the digits in value.
public static getDigits ( mixed $value ) : mixed
$value mixed
Результат mixed

getDir() публичный статический Метод

Returns dirname(value).
public static getDir ( mixed $value ) : mixed
$value mixed
Результат mixed

getInt() публичный статический Метод

Returns (int) value.
public static getInt ( mixed $value ) : integer
$value mixed
Результат integer

getPath() публичный статический Метод

Returns realpath(value).
public static getPath ( mixed $value ) : mixed
$value mixed
Результат mixed

getROT13() публичный статический Метод

Returns the value encoded as ROT13 (or decoded, if already was ROT13)
public static getROT13 ( mixed $value ) : mixed
$value mixed
Результат mixed

isAlnum() публичный статический Метод

Returns true if every character is alphabetic or a digit, false otherwise.
public static isAlnum ( mixed $value ) : boolean
$value mixed
Результат boolean

isAlpha() публичный статический Метод

Returns true if every character is alphabetic, false otherwise.
public static isAlpha ( mixed $value ) : boolean
$value mixed
Результат boolean

isArrayObject() публичный статический Метод

Checks to see if this is an ArrayObject
Устаревший:
public static isArrayObject ( $obj ) : boolean
Результат boolean

isArrayOrArrayObject() публичный статический Метод

Checks to see if this is an array or an ArrayObject
public static isArrayOrArrayObject ( $arr ) : boolean
Результат boolean

isBetween() публичный статический Метод

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.
public static isBetween ( mixed $value, mixed $min, mixed $max, boolean $inc = true ) : boolean
$value mixed
$min mixed
$max mixed
$inc boolean
Результат boolean

isCcnum() публичный статический Метод

Returns true if it is a valid credit card number format. The optional second argument allows developers to indicate the type.
public static isCcnum ( mixed $value, mixed $type = null ) : boolean
$value mixed
$type mixed
Результат boolean

isDate() публичный статический Метод

Returns true if value is a valid date, false otherwise. The date is required to be in ISO 8601 format.
public static isDate ( mixed $value ) : boolean
$value mixed
Результат boolean

isDigits() публичный статический Метод

This is just like isInt(), except there is no upper limit.
public static isDigits ( mixed $value ) : boolean
$value mixed
Результат boolean

isEmail() публичный статический Метод

Returns true if value is a valid email format, false otherwise.
См. также: http://www.regular-expressions.info/email.html
См. также: self::ISPK_EMAIL_VALID
public static isEmail ( string $value ) : boolean
$value string
Результат boolean

isFloat() публичный статический Метод

Returns true if value is a valid float value, false otherwise.
public static isFloat ( string $value ) : boolean
$value string
Результат boolean

isGreaterThan() публичный статический Метод

Returns true if value is greater than $min, false otherwise.
public static isGreaterThan ( mixed $value, mixed $min ) : boolean
$value mixed
$min mixed
Результат boolean

isHex() публичный статический Метод

Returns true if value is a valid hexadecimal format, false otherwise.
public static isHex ( mixed $value ) : boolean
$value mixed
Результат boolean

isHostname() публичный статический Метод

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 static isHostname ( mixed $value, integer $allow = self::ISPK_HOST_ALLOW_ALL ) : boolean
$value mixed
$allow integer bitfield for self::ISPK_HOST_ALLOW_DNS, self::ISPK_HOST_ALLOW_IP, self::ISPK_HOST_ALLOW_LOCAL
Результат boolean

isInt() публичный статический Метод

Returns true if value is a valid integer value, false otherwise.
public static isInt ( string | array $value ) : boolean
$value string | array
Результат boolean

isIp() публичный статический Метод

Returns true if value is a valid IPV4 format, false otherwise.
public static isIp ( mixed $value ) : boolean
$value mixed
Результат boolean

isLessThan() публичный статический Метод

Returns true if value is less than $max, false otherwise.
public static isLessThan ( mixed $value, mixed $max ) : boolean
$value mixed
$max mixed
Результат boolean

isOneOf() публичный статический Метод

Returns true if value is one of $allowed, false otherwise.
public static isOneOf ( mixed $value, array | string $allowed ) : boolean
$value mixed
$allowed array | string
Результат boolean

isPhone() публичный статический Метод

This method requires that the value consist of only digits.
public static isPhone ( mixed $value, string $country = 'US' ) : boolean
$value mixed
$country string
Результат boolean

isRegex() публичный статический Метод

Returns true if value matches $pattern, false otherwise. Uses preg_match() for the matching.
public static isRegex ( mixed $value, mixed $pattern ) : mixed
$value mixed
$pattern mixed
Результат mixed

isUri() публичный статический Метод

..
public static isUri ( string $value, integer $mode = self::ISPK_URI_ALLOW_COMMON ) : boolean
$value string
$mode integer
Результат boolean

isZip() публичный статический Метод

Returns true if value is a valid US ZIP, false otherwise.
public static isZip ( mixed $value ) : boolean
$value mixed
Результат boolean

makeCookieCage() публичный статический Метод

This utilizes a singleton pattern to get around scoping issues
public static makeCookieCage ( string $config_file = null, boolean $strict = true ) : Cage
$config_file string
$strict boolean whether or not to nullify the superglobal array
Результат Cage

makeEnvCage() публичный статический Метод

This utilizes a singleton pattern to get around scoping issues
public static makeEnvCage ( string $config_file = null, boolean $strict = true ) : Cage
$config_file string
$strict boolean whether or not to nullify the superglobal array
Результат Cage

makeFilesCage() публичный статический Метод

This utilizes a singleton pattern to get around scoping issues
public static makeFilesCage ( string $config_file = null, boolean $strict = true ) : Cage
$config_file string
$strict boolean whether or not to nullify the superglobal array
Результат Cage

makeGetCage() публичный статический Метод

This utilizes a singleton pattern to get around scoping issues
public static makeGetCage ( string $config_file = null, boolean $strict = true ) : Cage
$config_file string
$strict boolean whether or not to nullify the superglobal array
Результат Cage

makePostCage() публичный статический Метод

This utilizes a singleton pattern to get around scoping issues
public static makePostCage ( string $config_file = null, boolean $strict = true ) : Cage
$config_file string
$strict boolean whether or not to nullify the superglobal array
Результат Cage

makeServerCage() публичный статический Метод

This utilizes a singleton pattern to get around scoping issues
public static makeServerCage ( string $config_file = null, boolean $strict = true ) : Cage
$config_file string
$strict boolean whether or not to nullify the superglobal array
Результат Cage

makeSuperCage() публичный статический Метод

Returns a SuperglobalsCage object, which wraps ALL input superglobals
public static makeSuperCage ( string $config_file = null, boolean $strict = true ) : SuperglobalsCage
$config_file string
$strict boolean whether or not to nullify the superglobal
Результат SuperglobalsCage

noPath() публичный статический Метод

Returns basename(value).
public static noPath ( mixed $value ) : mixed
$value mixed
Результат mixed

noTags() публичный статический Метод

This will utilize the PHP Filter extension if available
public static noTags ( mixed $value ) : mixed
$value mixed
Результат mixed

noTagsOrSpecial() публичный статический Метод

This will utilize the PHP Filter extension if available
public static noTagsOrSpecial ( mixed $value ) : array | mixed | string
$value mixed
Результат array | mixed | string @mixed

useFilterExt() публичный статический Метод

We use this method of storing in a static class property so that we can access the value outside of class instances
public static useFilterExt ( boolean $state = null ) : boolean
$state boolean optional
Результат boolean

walkArray() защищенный статический Метод

This should be considered a "protected" method, and not be called outside of the class
protected static walkArray ( array | ArrayObjec\ArrayObject $input, string $method, string | null $classname = null ) : array
$input array | ArrayObjec\ArrayObject
$method string
$classname string | null
Результат array

Описание свойств

$useFilterExtension защищенное статическое свойство

protected static $useFilterExtension