pclib  2.3.2
Lightweight PHP framework
Public Member Functions
Request Class Reference

Provides unified access to HTTP request. More...

Inheritance diagram for Request:
BaseObject

Public Member Functions

 getMethod ()
 Return request method. More...
 
 isAjax ()
 Is current request AJAX request?
 
 isSSL ()
 We have HTTPS?
 
 getHost ()
 Return http host. More...
 
 getUrl ()
 Return current url. More...
 
 getClientIp ()
 Return client IP address. More...
 
 getServerIp ()
 Return server IP address (safe). More...
 
 getBaseUrl ()
 Return base Url. More...
 
 getWebRoot ()
 Return document root. More...
 
 getHeaders ()
 Return request headers array. More...
 
 urlMatch ($pattern)
 Match current url against pattern. More...
 
 getUserAgent ()
 It will try detect user agent, version and OS. More...
 
- Public Member Functions inherited from BaseObject
 loadDefaults ($className=null)
 Load default parameters of class $className into object instance.
 
 setProperties (array $defaults)
 Set public properties of object from the array. More...
 
 addEvent ($name, $callback)
 Add event handler to $object->$name property. More...
 
 toArray ()
 Convert object to array. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from BaseObject
static defaults ()
 Set or retireve default parameters of the object. More...
 
- Data Fields inherited from BaseObject
 $onNewInstance
 Occurs when new instance of the class is created. More...
 
 $onMissingMethod
 Occurs when called method does not exist. More...
 
 $serviceLocator
 var function() Return service object when requested with service(). More...
 
- Protected Member Functions inherited from BaseObject
 fireEvent ($name, array $args=array())
 Run all event handlers in $object->$name property. More...
 
 service ($service, $default=null)
 Try acquire $service and load it into property $this->$service. More...
 

Detailed Description

Provides unified access to HTTP request.

Can detect request method, url, user agent, request headers and such.

Member Function Documentation

getBaseUrl ( )

Return base Url.

getClientIp ( )

Return client IP address.

Warning: Can be faked!

getHeaders ( )

Return request headers array.

Returns
array headers [name => content] pairs
getHost ( )

Return http host.

getMethod ( )

Return request method.

'POST','GET' etc.

getServerIp ( )

Return server IP address (safe).

getUrl ( )

Return current url.

getUserAgent ( )

It will try detect user agent, version and OS.

Returns
array [$os,$agent,$version]
getWebRoot ( )

Return document root.

urlMatch (   $pattern)

Match current url against pattern.

Parameters
string$patternfnmatch pattern Example: 'http://localhost/*'

The documentation for this class was generated from the following file: