Methods summary
public static
array
|
#
ParseHttpAcceptLang( string[] $languagesList )
Parse list of comma separated language tags and sort it by the
quality value from $this->globalServer['HTTP_ACCEPT_LANGUAGE'] .
Parse list of comma separated language tags and sort it by the
quality value from $this->globalServer['HTTP_ACCEPT_LANGUAGE'] .
Parameters
Returns
array
|
public static
|
#
AddTwoSegmentTlds( string[] $twoSegmentTlds )
Add exceptional two-segment top-level domain like
'co.jp', 'co.uk', 'co.kr', 'co.nf' ... to parse
domain string correctly.
Example:
\MvcCore\Request::AddTwoSegmentTlds('co.uk', 'co.jp');
\MvcCore\Request::AddTwoSegmentTlds(['co.uk', 'co.jp']);
Add exceptional two-segment top-level domain like
'co.jp', 'co.uk', 'co.kr', 'co.nf' ... to parse
domain string correctly.
Example:
\MvcCore\Request::AddTwoSegmentTlds('co.uk', 'co.jp');
\MvcCore\Request::AddTwoSegmentTlds(['co.uk', 'co.jp']);
Parameters
- $twoSegmentTlds
- List of two-segment top-level domains without leading dot.
|
public static
MvcCore\Request
|
#
CreateInstance( array & $server = [], array & $get = [], array & $post = [], array & $cookie = [], array & $files = [] )
Static factory to get every time new instance of http request object.
Global variables for constructor arguments ($_SERVER , $_GET , $_POST ...)
should be changed to any arrays with any values and injected here to get
different request object then currently called real request object.
For example to create fake request object for testing purposes
or for non-real request rendering into request output cache.
Static factory to get every time new instance of http request object.
Global variables for constructor arguments ($_SERVER , $_GET , $_POST ...)
should be changed to any arrays with any values and injected here to get
different request object then currently called real request object.
For example to create fake request object for testing purposes
or for non-real request rendering into request output cache.
Parameters
- $server
- $get
- $post
- $cookie
- $files
Returns
|
public
array
&
|
#
GetGlobalCollection( string $type )
Get one of the global data collections stored as protected properties inside request object.
Example:
// to get global $_GET with raw values:
$globalGet = $request->GetGlobalCollection('get');
Get one of the global data collections stored as protected properties inside request object.
Example: // to get global $_GET with raw values: $globalGet = $request->GetGlobalCollection('get');
Parameters
Returns
array
|
public
MvcCore\Request
|
#
SetParams( array & $params = [] )
Set directly all raw parameters without any conversion at once.
Set directly all raw parameters without any conversion at once.
Parameters
Returns
|
public
array
&
|
#
GetParams( string|array|boolean $pregReplaceAllowedChars = ['#[\<\>\'"]#', ''], array $onlyKeys = [] )
Get directly all raw parameters at once (with/without conversion).
If any defined char groups in $pregReplaceAllowedChars , there will be returned
all params filtered by given rule in preg_replace() .
Get directly all raw parameters at once (with/without conversion).
If any defined char groups in $pregReplaceAllowedChars , there will be returned
all params filtered by given rule in preg_replace() .
Parameters
- $pregReplaceAllowedChars
- If String - list of regular expression characters to only keep, if array -
preg_replace() pattern and reverse, if FALSE , raw value is returned.
- $onlyKeys
- Array with keys to get only. If empty (by default), all possible params are returned.
Returns
array
|
public
MvcCore\Request
|
#
SetParam( string $name = '', string|string[] $value = '' )
Set directly raw parameter value without any conversion.
Set directly raw parameter value without any conversion.
Parameters
Returns
|
public
MvcCore\Request
|
#
RemoveParam( string $name = '' )
Remove parameter by name.
Remove parameter by name.
Parameters
Returns
|
public
string|string[]|integer|int[]|boolean|bool[]|array|mixed
|
#
GetParam( string $name = '', string|array|boolean $pregReplaceAllowedChars = "a-zA-Z0-9_;, /\-\@\:", mixed $ifNullValue = NULL, string $targetType = NULL )
Get param value from $_GET , $_POST or php://input , filtered by
"rule to keep defined characters only", defined in second argument (by preg_replace() ).
Place into second argument only char groups you want to keep.
Get param value from $_GET , $_POST or php://input , filtered by
"rule to keep defined characters only", defined in second argument (by preg_replace() ).
Place into second argument only char groups you want to keep.
Parameters
- $name
- Parameter string name.
- $pregReplaceAllowedChars
- If String - list of regular expression characters to only keep, if array -
preg_replace() pattern and reverse, if FALSE , raw value is returned.
- $ifNullValue
- Default value returned if given param name is null.
- $targetType
- Target type to retype param value or default if-null value. If param is an array, every param item will be retyped into given target type.
Returns
string|string[]|integer|int[]|boolean|bool[]|array|mixed
Throws
InvalidArgumentException
$name must be a $targetType , not an array .
|
public
boolean
|
#
HasParam( string $name = '' )
Get if any param value exists in $_GET , $_POST or php://input
Get if any param value exists in $_GET , $_POST or php://input
Parameters
- $name
- Parameter string name.
Returns
boolean
|
public
MvcCore\Request
|
#
SetFiles( array & $files = [] )
Set directly whole raw global $_FILES without any conversion at once.
Set directly whole raw global $_FILES without any conversion at once.
Parameters
Returns
|
public
array
&
|
#
GetFiles( )
Return reference to configured global $_FILES
or reference to any other testing array representing it.
Return reference to configured global $_FILES
or reference to any other testing array representing it.
Returns
array
|
public
MvcCore\Request
|
#
SetFile( string $file = '', array $data = [] )
Set file item into global $_FILES without any conversion at once.
Set file item into global $_FILES without any conversion at once.
Parameters
- $file
- Uploaded file string name.
- $data
Returns
|
public
array
|
#
GetFile( string $file = '' )
Return item by file name from referenced global $_FILES
or reference to any other testing array item representing it.
Return item by file name from referenced global $_FILES
or reference to any other testing array item representing it.
Parameters
- $file
- Uploaded file string name.
Returns
array
|
public
boolean
|
#
HasFile( string $file = '' )
Return if any item by file name exists or not in referenced global $_FILES .
Return if any item by file name exists or not in referenced global $_FILES .
Parameters
- $file
- Uploaded file string name.
Returns
boolean
|
public
MvcCore\Request
|
#
SetCookies( array & $cookies = [] )
Set directly whole raw global $_COOKIE without any conversion at once.
Set directly whole raw global $_COOKIE without any conversion at once.
Parameters
Returns
|
public
array
&
|
#
GetCookies( string|array|boolean $pregReplaceAllowedChars = ['#[\<\>\'"]#', ''], $onlyKeys = [] )
Get directly all raw global $_COOKIE s at once (with/without conversion).
Cookies are returned as key => value array.
Get directly all raw global $_COOKIE s at once (with/without conversion).
Cookies are returned as key => value array.
Parameters
- $pregReplaceAllowedChars
- If String - list of regular expression characters to only keep, if array -
preg_replace() pattern and reverse, if FALSE , raw value is returned.
- $onlyKeys
Returns
array
array
|
public
MvcCore\Request
|
#
SetCookie( string $name = '', string|string[] $value = '' )
Set raw request cookie into referenced global $_COOKIE without any conversion.
Set raw request cookie into referenced global $_COOKIE without any conversion.
Parameters
Returns
|
public
string|string[]|integer|int[]|boolean|bool[]|array|mixed
|
#
GetCookie( string $name = '', string|array|boolean $pregReplaceAllowedChars = "a-zA-Z0-9_;, /\-\.\@\=\+\?\!", mixed $ifNullValue = NULL, string $targetType = NULL )
Get request cookie value from referenced global $_COOKIE variable,
filtered by characters defined in second argument through preg_replace() .
Place into second argument only char groups you want to keep.
Get request cookie value from referenced global $_COOKIE variable,
filtered by characters defined in second argument through preg_replace() .
Place into second argument only char groups you want to keep.
Parameters
- $name
- Cookie string name.
- $pregReplaceAllowedChars
- If String - list of regular expression characters to only keep, if array -
preg_replace() pattern and reverse, if FALSE , raw value is returned.
- $ifNullValue
- Default value returned if given param name is null.
- $targetType
- Target type to retype param value or default if-null value. If param is an array, every param item will be retyped into given target type.
Returns
string|string[]|integer|int[]|boolean|bool[]|array|mixed
Throws
InvalidArgumentException
$name must be a $targetType , not an array .
|
public
boolean
|
#
HasCookie( string $name = '' )
Return if any item by cookie name exists or not in referenced global $_COOKIE .
Return if any item by cookie name exists or not in referenced global $_COOKIE .
Parameters
- $name
- Cookie string name.
Returns
boolean
|
public
MvcCore\Request
|
#
InitAll( )
Initialize all possible protected values from all global variables,
including all http headers, all params and application inputs.
This method is not recommended to use in production mode, it's
designed mostly for development purposes, to see in one moment,
what could be inside request after calling any getter method.
Initialize all possible protected values from all global variables,
including all http headers, all params and application inputs.
This method is not recommended to use in production mode, it's
designed mostly for development purposes, to see in one moment,
what could be inside request after calling any getter method.
Returns
|
public
boolean
|
#
IsInternalRequest( )
Return TRUE boolean flag if request targets Controller:Asset .
Return TRUE boolean flag if request targets Controller:Asset .
Returns
boolean
|
public
MvcCore\Request
|
#
SetControllerName( string $controllerName )
Set cleaned requested controller name into \MvcCore\Request::$controllerName;
and into \MvcCore\Request::$params['controller']; .
Set cleaned requested controller name into \MvcCore\Request::$controllerName;
and into \MvcCore\Request::$params['controller']; .
Parameters
Returns
|
public
string
|
#
GetControllerName( )
Return cleaned requested controller name from \MvcCore\Request::$params['controller']; .
Return cleaned requested controller name from \MvcCore\Request::$params['controller']; .
Returns
string
|
public
MvcCore\Request
|
#
SetActionName( string $actionName )
Set cleaned requested controller name into \MvcCore\Request::$actionName;
and into \MvcCore\Request::$params['action']; .
Set cleaned requested controller name into \MvcCore\Request::$actionName;
and into \MvcCore\Request::$params['action']; .
Parameters
Returns
|
public
string
|
#
GetActionName( )
Return cleaned requested action name from \MvcCore\Request::$params['action']; .
Return cleaned requested action name from \MvcCore\Request::$params['action']; .
Returns
string
|
public
boolean
|
#
IsCli( )
TRUE if PHP php_sapi_name() is cli and also
if there is no $_SERVER['REQUEST_URI'] defined.
TRUE if PHP php_sapi_name() is cli and also
if there is no $_SERVER['REQUEST_URI'] defined.
Returns
boolean
|
public
MvcCore\Request
|
#
SetLang( string|null $lang )
Set language international code.
Use this lang storage by your own decision.
Example: "en" | "de"
Set language international code.
Use this lang storage by your own decision.
Example: "en" | "de"
Parameters
Returns
|
public
string|null
|
#
GetLang( )
Get language international code, lower case, not used by default.
To use this variable - install \MvcCore\Router extension \MvcCore\Ext\Router\Lang
Or use this variable by your own decision.
Example: "en" | "de"
Get language international code, lower case, not used by default.
To use this variable - install \MvcCore\Router extension \MvcCore\Ext\Router\Lang
Or use this variable by your own decision.
Example: "en" | "de"
Returns
string|null
|
public
MvcCore\Request
|
#
SetLocale( string|null $locale )
Set country/locale code, upper case.
Use this locale storage by your own decision.
Example: "US" | "UK"
Set country/locale code, upper case.
Use this locale storage by your own decision.
Example: "US" | "UK"
Parameters
Returns
|
public
string|null
|
#
GetLocale( )
Get country/locale code, upper case, not used by default.
To use this variable - install \MvcCore\Router extension \MvcCore\Ext\Router\Lang
Or use this variable by your own decision.
Example: "US" | "UK"
Get country/locale code, upper case, not used by default.
To use this variable - install \MvcCore\Router extension \MvcCore\Ext\Router\Lang
Or use this variable by your own decision.
Example: "US" | "UK"
Returns
string|null
|
public
MvcCore\Request
|
#
SetMediaSiteVersion( string|null $mediaSiteVersion )
Set media site version - "full" | "tablet" | "mobile" .
Use this media site version storage by your own decision.
Example: "full" | "tablet" | "mobile"
Set media site version - "full" | "tablet" | "mobile" .
Use this media site version storage by your own decision.
Example: "full" | "tablet" | "mobile"
Parameters
Returns
|
public
string|null
|
#
GetMediaSiteVersion( )
Get media site version - "full" | "tablet" | "mobile" .
To use this variable - install \MvcCore\Router extension \MvcCoreExt\Router\Media
Or use this variable by your own decision.
Example: "full" | "tablet" | "mobile"
Get media site version - "full" | "tablet" | "mobile" .
To use this variable - install \MvcCore\Router extension \MvcCoreExt\Router\Media
Or use this variable by your own decision.
Example: "full" | "tablet" | "mobile"
Returns
string|null
|
public
mixed|MvcCore\Request
|
#
__call( string $rawName, array $arguments = [] )
Sets any custom property "propertyName" by \MvcCore\Request::SetPropertyName("value"); ,
which is not necessary to define previously or gets previously defined
property "propertyName" by \MvcCore\Request::GetPropertyName(); .
Throws exception if no property defined by get call or if virtual call
begins with anything different from Set or Get .
This method returns custom value for get and \MvcCore\Request instance for set.
Sets any custom property "propertyName" by \MvcCore\Request::SetPropertyName("value"); ,
which is not necessary to define previously or gets previously defined
property "propertyName" by \MvcCore\Request::GetPropertyName(); .
Throws exception if no property defined by get call or if virtual call
begins with anything different from Set or Get .
This method returns custom value for get and \MvcCore\Request instance for set.
Parameters
Returns
Throws
InvalidArgumentException
|
public
mixed
|
#
__get( string $name )
Universal getter, if property not defined, NULL is returned.
Universal getter, if property not defined, NULL is returned.
Parameters
Returns
mixed
|
public
MvcCore\Request
|
#
__set( string $name, mixed $value )
Universal setter, if property not defined, it's automatically declared.
Universal setter, if property not defined, it's automatically declared.
Parameters
Returns
|
public
string
|
#
GetScriptName( )
Php requested script name path from application root.
Example: "/index.php"
Php requested script name path from application root.
Example: "/index.php"
Returns
string
|
public
string
|
#
GetAppRoot( )
Get application root path on hard drive.
Example: "C:/www/my/development/directory/www"
Get application root path on hard drive.
Example: "C:/www/my/development/directory/www"
Returns
string
|
public
MvcCore\Request
|
#
SetMethod( string $rawMethod )
Set upper cased http method from global $_SERVER['REQUEST_METHOD'] .
Example: $request->SetMethod("GET" | "POST" | "PUT" | "HEAD"...);
Set upper cased http method from global $_SERVER['REQUEST_METHOD'] .
Example: $request->SetMethod("GET" | "POST" | "PUT" | "HEAD"...);
Parameters
Returns
|
public
string
|
#
GetMethod( )
Get upper cased http method from global $_SERVER['REQUEST_METHOD'] .
Example: "GET" | "POST" | "PUT" | "HEAD"...
Get upper cased http method from global $_SERVER['REQUEST_METHOD'] .
Example: "GET" | "POST" | "PUT" | "HEAD"...
Returns
string
|
public
MvcCore\Request
|
#
SetBasePath( string $rawBasePath )
Set base app directory path after domain,
if application is placed in domain subdirectory.
Example:
- for full url: "http://localhost:88/my/development/direcotry/www/requested/path/after/domain?with=possible&query=string"
- set base path: $request->SetBasePath("/my/development/directory/www");
Set base app directory path after domain,
if application is placed in domain subdirectory.
Example:
- for full url: "http://localhost:88/my/development/direcotry/www/requested/path/after/domain?with=possible&query=string"
- set base path: $request->SetBasePath("/my/development/directory/www");
Parameters
Returns
|
public
string
|
#
GetBasePath( )
Get base app directory path after domain,
if application is placed in domain subdirectory.
Example:
- full url: "http://localhost:88/my/development/direcotry/www/requested/path/after/domain?with=possible&query=string"
- base path: "/my/development/directory/www"
Get base app directory path after domain,
if application is placed in domain subdirectory.
Example:
- full url: "http://localhost:88/my/development/direcotry/www/requested/path/after/domain?with=possible&query=string"
- base path: "/my/development/directory/www"
Returns
string
|
public
MvcCore\Request
|
#
SetScheme( string $rawProtocol )
Set http scheme string.
Example: $request->SetScheme("https:");
Set http scheme string.
Example: $request->SetScheme("https:");
Parameters
Returns
|
public
string
|
#
GetScheme( )
Get http scheme string.
Example: "http:" | "https:"
Get http scheme string.
Example: "http:" | "https:"
Returns
string
|
public
boolean
|
#
IsSecure( )
Get TRUE if http scheme is "https:" .
Get TRUE if http scheme is "https:" .
Returns
boolean
|
public
string
|
#
GetReferer( boolean $rawInput = FALSE )
Get referer URL if any, safely read by:
filter_var($_SERVER['HTTP_REFERER'], FILTER_SANITIZE_URL);
Example: "http://foreing.domain.com/path/where/is/link/to/?my=app"
Get referer URL if any, safely read by:
filter_var($_SERVER['HTTP_REFERER'], FILTER_SANITIZE_URL);
Example: "http://foreing.domain.com/path/where/is/link/to/?my=app"
Parameters
- $rawInput
- Get raw input if
TRUE . FALSE by default to get value through htmlspecialchars($result); without ampersand & escaping.
Returns
string
|
public
float
|
#
GetStartTime( )
Get timestamp in seconds as float, when the request has been started,
with microsecond precision.
Get timestamp in seconds as float, when the request has been started,
with microsecond precision.
Returns
float
|
public
MvcCore\Request
|
#
SetTopLevelDomain( string|null $topLevelDomain )
Set TOP level domain like com or co.uk .
Method also change server name and host record automatically.
Set TOP level domain like com or co.uk .
Method also change server name and host record automatically.
Parameters
Returns
|
public
string|null
|
#
GetTopLevelDomain( )
Set top level domain like com from www.example.com .
Set top level domain like com from www.example.com .
Returns
string|null
|
public
MvcCore\Request
|
#
SetSecondLevelDomain( string|null $secondLevelDomain )
Set second level domain like example in www.example.com .
Method also change server name and host record automatically.
Set second level domain like example in www.example.com .
Method also change server name and host record automatically.
Parameters
Returns
|
public
string|null
|
#
GetSecondLevelDomain( )
Get second level domain like example in www.example.com .
Get second level domain like example in www.example.com .
Returns
string|null
|
public
MvcCore\Request
|
#
SetThirdLevelDomain( string|null $thirdLevelDomain )
Set second level domain like example from www.example.com .
Method also change server name and host record automatically.
Set second level domain like example from www.example.com .
Method also change server name and host record automatically.
Parameters
Returns
|
public
string|null
|
#
GetThirdLevelDomain( )
Get third level domain like www from www.example.com .
Get third level domain like www from www.example.com .
Returns
string|null
|
public
MvcCore\Request
|
#
SetHostName( string $rawHostName )
Set application server name - domain without any port.
Method also change host record and domain records automatically.
Example: $request->SetHostName("localhost");
Set application server name - domain without any port.
Method also change host record and domain records automatically.
Example: $request->SetHostName("localhost");
Parameters
Returns
|
public
string
|
#
GetHostName( )
Get application server name - domain without any port.
Example: "localhost"
Get application server name - domain without any port.
Example: "localhost"
Returns
string
|
public
MvcCore\Request
|
#
SetHost( string $rawHost )
Set application host with port if there is any.
Method also change server name record and domain records automatically.
Example: $request->SetHost("localhost:88");
Set application host with port if there is any.
Method also change server name record and domain records automatically.
Example: $request->SetHost("localhost:88");
Parameters
Returns
|
public
string
|
#
GetHost( )
Get application host with port if there is any.
Example: "localhost:88"
Get application host with port if there is any.
Example: "localhost:88"
Returns
string
|
public
MvcCore\Request
|
#
SetPort( string $rawPort )
Set http port defined in requested URL if any, parsed by parse_url().
Empty string if there is no port number in requested address. .
Example: $request->SetPort("88")
Set http port defined in requested URL if any, parsed by parse_url().
Empty string if there is no port number in requested address. .
Example: $request->SetPort("88")
Parameters
Returns
|
public
string
|
#
GetPort( )
Get http port defined in requested URL if any, parsed by parse_url().
Empty string if there is no port number in requested address. .
Example: "88" | ""
Get http port defined in requested URL if any, parsed by parse_url().
Empty string if there is no port number in requested address. .
Example: "88" | ""
Returns
string
|
public
MvcCore\Request
|
#
SetPath( string $rawPathValue )
Set requested path in from application root (if mod_rewrite enabled), never with query string.
Example: $request->SetPort("/products/page/2");
Set requested path in from application root (if mod_rewrite enabled), never with query string.
Example: $request->SetPort("/products/page/2");
Parameters
Returns
|
public
string
|
#
GetPath( boolean $rawInput = FALSE )
Get requested path in from application root (if mod_rewrite enabled), never with query string.
Example: "/products/page/2"
Get requested path in from application root (if mod_rewrite enabled), never with query string.
Example: "/products/page/2"
Parameters
- $rawInput
- Get raw input if
TRUE . FALSE by default to get value through htmlspecialchars($result); without ampersand & escaping.
Returns
string
|
public
MvcCore\Request
|
#
SetQuery( string $rawQuery )
Set URL query string, with or without question mark character, doesn't matter.
Example: $request->SetQuery("param-1=value-1¶m-2=value-2¶m-3[]=value-3-a¶m-3[]=value-3-b");
Set URL query string, with or without question mark character, doesn't matter.
Example: $request->SetQuery("param-1=value-1¶m-2=value-2¶m-3[]=value-3-a¶m-3[]=value-3-b");
Parameters
Returns
|
public
string
|
#
GetQuery( boolean $withQuestionMark = FALSE, boolean $rawInput = FALSE )
Get URL query string (without question mark character by default).
Example: "param-1=value-1¶m-2=value-2¶m-3[]=value-3-a¶m-3[]=value-3-b"
Get URL query string (without question mark character by default).
Example: "param-1=value-1¶m-2=value-2¶m-3[]=value-3-a¶m-3[]=value-3-b"
Parameters
- $withQuestionMark
If FALSE (by default), query string is returned always without question
mark character at the beginning.
If TRUE , and query string contains any character(s), query string is returned
with question mark character at the beginning. But if query string contains no
character(s), query string is returned as EMPTY STRING WITHOUT question mark character.
- $rawInput
- Get raw input if
TRUE . FALSE by default to get value through htmlspecialchars($result); without ampersand & escaping.
Returns
string
|
public
string
|
#
GetRequestPath( boolean $rawInput = FALSE )
Get request path after domain with possible query string
Example: "/requested/path/after/app/root?with=possible&query=string"
Get request path after domain with possible query string
Example: "/requested/path/after/app/root?with=possible&query=string"
Parameters
- $rawInput
- Get raw input if
TRUE . FALSE by default to get value through htmlspecialchars($result); without ampersand & escaping.
Returns
string
|
public
string
|
#
GetDomainUrl( )
Get URL to requested domain and possible port.
Example: "https://domain.com" | "http://domain:88" if any port.
Get URL to requested domain and possible port.
Example: "https://domain.com" | "http://domain:88" if any port.
Returns
string
|
public
string
|
#
GetBaseUrl( )
Get base URL to application root.
Example: "http://domain:88/my/development/direcotry/www"
Get base URL to application root.
Example: "http://domain:88/my/development/direcotry/www"
Returns
string
|
public
string
|
#
GetRequestUrl( boolean $rawInput = FALSE )
Get request URL including scheme, domain, port, path, without any query string
Example: "http://localhost:88/my/development/direcotry/www/requested/path/after/domain"
Get request URL including scheme, domain, port, path, without any query string
Example: "http://localhost:88/my/development/direcotry/www/requested/path/after/domain"
Parameters
- $rawInput
- Get raw input if
TRUE . FALSE by default to get value through htmlspecialchars($result); without ampersand & escaping.
Returns
string
|
public
string
|
#
GetFullUrl( boolean $rawInput = FALSE )
Get request URL including scheme, domain, port, path and with query string
Example: "http://localhost:88/my/development/direcotry/www/requested/path/after/domain?with=possible&query=string"
Get request URL including scheme, domain, port, path and with query string
Example: "http://localhost:88/my/development/direcotry/www/requested/path/after/domain?with=possible&query=string"
Parameters
- $rawInput
- Get raw input if
TRUE . FALSE by default to get value through htmlspecialchars($result); without ampersand & escaping.
Returns
string
|
public
string
|
#
GetFragment( boolean $withHash = FALSE, boolean $rawInput = FALSE )
Get URI fragment parsed by parse_url() (without hash character by default).
Example: "any-sublink-path"
Get URI fragment parsed by parse_url() (without hash character by default).
Example: "any-sublink-path"
Parameters
- $withHash
If FALSE (by default), fragment is returned always without hash character
at the beginning.
If TRUE , and fragment contains any character(s), fragment is returned
with hash character at the beginning. But if fragment contains no
character(s), fragment is returned as EMPTY STRING WITHOUT hash character.
- $rawInput
- Get raw input if
TRUE . FALSE by default to get value through htmlspecialchars($result); without ampersand & escaping.
Returns
string
|
public
string
|
#
GetServerIp( )
Get server IP from $_SERVER global variable.
Get server IP from $_SERVER global variable.
Returns
string
|
public
string
|
#
GetClientIp( )
Get client IP from $_SERVER global variable.
Get client IP from $_SERVER global variable.
Returns
string
|
public
boolean
|
#
IsAjax( )
Get TRUE if request is requested on the background
with usual Javascript HTTP header containing:
X-Requested-With: AnyJsFrameworkName .
Get TRUE if request is requested on the background
with usual Javascript HTTP header containing:
X-Requested-With: AnyJsFrameworkName .
Returns
boolean
|
public
integer|null
|
#
GetContentLength( )
Get integer value from global $_SERVER['CONTENT_LENGTH']
or from http header Content-Length , if no value, NULL is returned.
Get integer value from global $_SERVER['CONTENT_LENGTH']
or from http header Content-Length , if no value, NULL is returned.
Returns
integer|null
|
public
string
|
#
GetBody( )
Raw request body, usually from file_get_contents('php://input'); .
Use this method only for non-standard application inputs like: XML, binary data, etc...
Raw request body, usually from file_get_contents('php://input'); .
Use this method only for non-standard application inputs like: XML, binary data, etc...
Returns
string
|
public static
string
|
#
HtmlSpecialChars( string $str )
Convert special characters to HTML entities except ampersand & .
Convert special characters to HTML entities except ampersand & .
Parameters
Returns
string
See
http://php.net/manual/en/function.htmlspecialchars.php
|