PHP Class Ip\Request

显示文件 Open project: impresspages/impresspages Class Usage Examples

Protected Properties

Property Type Description
$_COOKIE
$_GET
$_POST
$_REQUEST
$_SERVER
$controller Ip\controller
$routePath

Public Methods

Method Description
__construct ( )
_isWebsiteRoot ( ) : boolean
_setRoutePath ( $routePath )
getMethod ( ) : string Get request method, such as 'GET', 'HEAD', 'POST', or 'PUT'
getPost ( string $name = null, mixed $default = null ) : mixed Returns POST parameter if $name is passed. Returns all query parameters if name == null.
getQuery ( string $name = null, mixed $default = null ) : mixed Return GET query parameter if $name is passed. Returns all query parameters if name == null.
getRelativePath ( ) : string Gets relative path from base URL
getRequest ( string $name = null, mixed $default = null ) : mixed Return request parameter if $name is passed. Returns all request parameters if $name == null.
getRoutePath ( )
getServer ( string $name = null, string $default = null ) : mixed Return parameters, such as headers, paths, and script locations, provided in $_SERVER array
getUrl ( ) : string Get current page URL
isAjax ( )
isGet ( ) : boolean Check if HTTP request data is provided using GET method
isHttps ( ) : boolean Check if HTTPS protocol is used
isPost ( ) : boolean Check if HTTP request data is provided using POST method
mustBePost ( ) Require to provide HTTP request data using POST method
setPost ( $post ) Set post variables
setQuery ( $query ) Set GET query
setRequest ( $request ) Set request data
setServer ( $server ) Set server data

Protected Methods

Method Description
getParam ( $name, $values, $default )

Method Details

__construct() public method

public __construct ( )

_isWebsiteRoot() public method

public _isWebsiteRoot ( ) : boolean
return boolean true if current url is pointing to website root or one of the languages

_setRoutePath() public method

public _setRoutePath ( $routePath )

getMethod() public method

Get request method, such as 'GET', 'HEAD', 'POST', or 'PUT'
public getMethod ( ) : string
return string Request method

getParam() protected method

protected getParam ( $name, $values, $default )

getPost() public method

Returns POST parameter if $name is passed. Returns all query parameters if name == null.
public getPost ( string $name = null, mixed $default = null ) : mixed
$name string query parameter name
$default mixed default value if no GET parameter exists
return mixed GET query variable (all query variables if $name == null)

getQuery() public method

Return GET query parameter if $name is passed. Returns all query parameters if name == null.
public getQuery ( string $name = null, mixed $default = null ) : mixed
$name string query parameter name
$default mixed default value if no GET parameter exists
return mixed GET query variable (all query variables if $name == null)

getRelativePath() public method

Gets relative path from base URL
public getRelativePath ( ) : string
return string Path after BASE_URL

getRequest() public method

Return request parameter if $name is passed. Returns all request parameters if $name == null.
public getRequest ( string $name = null, mixed $default = null ) : mixed
$name string query parameter name
$default mixed default value if no GET parameter exists
return mixed GET query variable (all query variables if $name == null)

getRoutePath() public method

public getRoutePath ( )

getServer() public method

Return parameters, such as headers, paths, and script locations, provided in $_SERVER array
public getServer ( string $name = null, string $default = null ) : mixed
$name string parameter name
$default string default value returned when a server parameter is null
return mixed

getUrl() public method

Get current page URL
public getUrl ( ) : string
return string URL address

isAjax() public method

public isAjax ( )

isGet() public method

Check if HTTP request data is provided using GET method
public isGet ( ) : boolean
return boolean Returns true for GET method

isHttps() public method

Check if HTTPS protocol is used
public isHttps ( ) : boolean
return boolean Returns true for HTTPS request

isPost() public method

Check if HTTP request data is provided using POST method
public isPost ( ) : boolean
return boolean Returns true for POST method

mustBePost() public method

Require to provide HTTP request data using POST method
public mustBePost ( )

setPost() public method

Set post variables
public setPost ( $post )
$post

setQuery() public method

Set GET query
public setQuery ( $query )
$query

setRequest() public method

Set request data
public setRequest ( $request )
$request

setServer() public method

Set server data
public setServer ( $server )
$server

Property Details

$_GET protected_oe property

protected $_GET

$_POST protected_oe property

protected $_POST

$_REQUEST protected_oe property

protected $_REQUEST

$_SERVER protected_oe property

protected $_SERVER

$controller protected_oe property

protected controller,Ip $controller
return Ip\controller

$routePath protected_oe property

protected $routePath