PHP 클래스 CI_Input, ci-phpunit-test

Pre-processes global input data for security
저자: ExpressionEngine Dev Team
파일 보기 프로젝트 열기: kenjis/ci-phpunit-test 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$_allow_get_array boolean If set to FALSE, then $_GET will be set to an empty array.
$_enable_csrf boolean Enables a CSRF cookie token to be set. Set automatically based on config setting.
$_enable_xss boolean Determines whether the XSS filter is always active when GET, POST or COOKIE data is encountered. Set automatically based on config setting.
$_input_stream array Parsed from php://input at runtime
$_raw_input_stream string Holds a cache of php://input contents
$_standardize_newlines boolean If set to TRUE, then newlines are standardized.
$headers array List of all HTTP request headers
$ip_address string IP address of the current user
$security
$uni

공개 메소드들

메소드 설명
__construct ( ) : void Class constructor
__get ( string $name ) : mixed Magic __get()
cookie ( mixed $index = NULL, boolean $xss_clean = NULL ) : mixed Fetch an item from the COOKIE array
get ( mixed $index = NULL, boolean $xss_clean = NULL ) : mixed Fetch an item from the GET array
get_post ( string $index, boolean $xss_clean = NULL ) : mixed Fetch an item from GET data with fallback to POST
get_request_header ( string $index, boolean $xss_clean = FALSE ) : string | null Get Request Header
input_stream ( string $index = NULL, boolean $xss_clean = NULL ) : mixed Fetch an item from the php://input stream
ip_address ( ) : string Fetch the IP Address
is_ajax_request ( ) : boolean Is AJAX request?
is_cli_request ( ) : boolean Is CLI request?
method ( boolean $upper = FALSE ) : string Get Request Method
post ( mixed $index = NULL, boolean $xss_clean = NULL ) : mixed Fetch an item from the POST array
post_get ( string $index, boolean $xss_clean = NULL ) : mixed Fetch an item from POST data with fallback to GET
request_headers ( boolean $xss_clean = FALSE ) : array Request Headers
server ( mixed $index, boolean $xss_clean = NULL ) : mixed Fetch an item from the SERVER array
set_cookie ( string | mixed[] $name, string $value = '', integer $expire = '', string $domain = '', string $path = '/', string $prefix = '', boolean $secure = FALSE, boolean $httponly = FALSE ) : void Set cookie
user_agent ( $xss_clean = NULL ) : string | null Fetch User Agent string
valid_ip ( string $ip, string $which = '' ) : boolean Validate IP Address

보호된 메소드들

메소드 설명
_clean_input_data ( string | string[] $str ) : string Clean Input Data
_clean_input_keys ( string $str, boolean $fatal = TRUE ) : string | boolean Clean Keys
_fetch_from_array ( &$array, mixed $index = NULL, boolean $xss_clean = NULL ) : mixed Fetch from array
_sanitize_globals ( ) : void Sanitize Globals

메소드 상세

__construct() 공개 메소드

Determines whether to globally enable the XSS processing and whether to allow the $_GET array.
public __construct ( ) : void
리턴 void

__get() 공개 메소드

Allows read access to protected properties
public __get ( string $name ) : mixed
$name string
리턴 mixed

_clean_input_data() 보호된 메소드

Internal method that aids in escaping data and standardizing newline characters to PHP_EOL.
protected _clean_input_data ( string | string[] $str ) : string
$str string | string[] Input string(s)
리턴 string

_clean_input_keys() 보호된 메소드

Internal method that helps to prevent malicious users from trying to exploit keys we make sure that keys are only named with alpha-numeric text and a few other items.
protected _clean_input_keys ( string $str, boolean $fatal = TRUE ) : string | boolean
$str string Input string
$fatal boolean Whether to terminate script exection or to return FALSE if an invalid key is encountered
리턴 string | boolean

_fetch_from_array() 보호된 메소드

Internal method used to retrieve values from global arrays.
protected _fetch_from_array ( &$array, mixed $index = NULL, boolean $xss_clean = NULL ) : mixed
$index mixed Index for item to be fetched from $array
$xss_clean boolean Whether to apply XSS filtering
리턴 mixed

_sanitize_globals() 보호된 메소드

Internal method serving for the following purposes: - Unsets $_GET data, if query strings are not enabled - Cleans POST, COOKIE and SERVER data - Standardizes newline characters to PHP_EOL
protected _sanitize_globals ( ) : void
리턴 void

get() 공개 메소드

Fetch an item from the GET array
public get ( mixed $index = NULL, boolean $xss_clean = NULL ) : mixed
$index mixed Index for item to be fetched from $_GET
$xss_clean boolean Whether to apply XSS filtering
리턴 mixed

get_post() 공개 메소드

Fetch an item from GET data with fallback to POST
public get_post ( string $index, boolean $xss_clean = NULL ) : mixed
$index string Index for item to be fetched from $_GET or $_POST
$xss_clean boolean Whether to apply XSS filtering
리턴 mixed

get_request_header() 공개 메소드

Returns the value of a single member of the headers class member
public get_request_header ( string $index, boolean $xss_clean = FALSE ) : string | null
$index string Header name
$xss_clean boolean Whether to apply XSS filtering
리턴 string | null The requested header on success or NULL on failure modified by ci-phpunit-test

input_stream() 공개 메소드

Useful when you need to access PUT, DELETE or PATCH request data.
public input_stream ( string $index = NULL, boolean $xss_clean = NULL ) : mixed
$index string Index for item to be fetched
$xss_clean boolean Whether to apply XSS filtering
리턴 mixed

ip_address() 공개 메소드

Determines and validates the visitor's IP address.
public ip_address ( ) : string
리턴 string IP address

is_ajax_request() 공개 메소드

Test to see if a request contains the HTTP_X_REQUESTED_WITH header.
public is_ajax_request ( ) : boolean
리턴 boolean

is_cli_request() 공개 메소드

Test to see if a request was made from the command line.
사용 중단: 3.0.0 Use is_cli() instead
public is_cli_request ( ) : boolean
리턴 boolean

method() 공개 메소드

Return the request method
public method ( boolean $upper = FALSE ) : string
$upper boolean Whether to return in upper or lower case (default: FALSE)
리턴 string

post() 공개 메소드

Fetch an item from the POST array
public post ( mixed $index = NULL, boolean $xss_clean = NULL ) : mixed
$index mixed Index for item to be fetched from $_POST
$xss_clean boolean Whether to apply XSS filtering
리턴 mixed

post_get() 공개 메소드

Fetch an item from POST data with fallback to GET
public post_get ( string $index, boolean $xss_clean = NULL ) : mixed
$index string Index for item to be fetched from $_POST or $_GET
$xss_clean boolean Whether to apply XSS filtering
리턴 mixed

request_headers() 공개 메소드

Request Headers
public request_headers ( boolean $xss_clean = FALSE ) : array
$xss_clean boolean Whether to apply XSS filtering
리턴 array

server() 공개 메소드

Fetch an item from the SERVER array
public server ( mixed $index, boolean $xss_clean = NULL ) : mixed
$index mixed Index for item to be fetched from $_SERVER
$xss_clean boolean Whether to apply XSS filtering
리턴 mixed

user_agent() 공개 메소드

Fetch User Agent string
public user_agent ( $xss_clean = NULL ) : string | null
리턴 string | null User Agent string or NULL if it doesn't exist

valid_ip() 공개 메소드

Validate IP Address
public valid_ip ( string $ip, string $which = '' ) : boolean
$ip string IP address
$which string IP protocol: 'ipv4' or 'ipv6'
리턴 boolean

프로퍼티 상세

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

If set to FALSE, then $_GET will be set to an empty array.
protected bool $_allow_get_array
리턴 boolean

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

Enables a CSRF cookie token to be set. Set automatically based on config setting.
protected bool $_enable_csrf
리턴 boolean

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

Determines whether the XSS filter is always active when GET, POST or COOKIE data is encountered. Set automatically based on config setting.
protected bool $_enable_xss
리턴 boolean

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

Parsed from php://input at runtime
또한 보기: CI_Input::input_stream()
protected array $_input_stream
리턴 array

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

Holds a cache of php://input contents
protected string $_raw_input_stream
리턴 string

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

If set to TRUE, then newlines are standardized.
protected bool $_standardize_newlines
리턴 boolean

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

List of all HTTP request headers
protected array $headers
리턴 array

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

IP address of the current user
protected string $ip_address
리턴 string

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

protected $security

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

protected $uni