nyroFwk  0.2
Static Public Member Functions | Private Member Functions | Static Private Member Functions | Static Private Attributes
request Class Reference

Static Public Member Functions

static init ()
 
static parseParam ($param)
 
static createParam ($param, $urlify=true)
 
static forward ($request)
 
static forceSecure ()
 
static get ($get=null)
 
static getRequested ($get=null)
 
static getCfg ($key=null)
 
static hasPrm ($key)
 
static getPrm ($key, $default=null)
 
static getPathControllerUri ($forceController=false)
 
static uri ($prm=array())
 
static uploadedUri ($file, array $prm=array())
 
static uriDef (array $prm=array(), array $use=array('lang', 'module', 'action', 'param', 'out'))
 
static uriString ($uri)
 
static webUri ($uri, $absolute=false)
 
static isAbsolutizeAllUris ()
 
static getIp ()
 
static isPost ()
 
static isLocal ()
 
static isAjax ()
 
static isMobile ($test=null)
 
static isScaffolded ()
 
static extractGet (&$request, $affectGet=false)
 
static analyseRequest ($request, $alias=true)
 
static alias ($request)
 
static removeLangOutUrl ($request)
 
static getModule ()
 
static execModule ()
 
static publishModule ()
 
static isLang ($lang)
 
static avlLang ($withName=false)
 
static getDefaultLang ()
 
static isOut ($out)
 
static getResponseName ()
 

Private Member Functions

 __construct ()
 

Static Private Member Functions

static fixFiles ()
 
static initModule ()
 

Static Private Attributes

static $cfg
 
static $requestedUriInfo
 
static $uriInfo
 
static $module
 
static $scaffold
 
static $mobileStatus = false
 

Detailed Description

Store the client request Singleton

Definition at line 11 of file request.class.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( )
private

No instanciation for this class

Definition at line 86 of file request.class.php.

Member Function Documentation

◆ alias()

static alias (   $request)
static

Parse a request to find an alias match

Parameters
string$requestThe request to parse
Returns
string the real request

Definition at line 842 of file request.class.php.

◆ analyseRequest()

static analyseRequest (   $request,
  $alias = true 
)
static

Analyse a request. If some element are empty, the default is replaced

Parameters
string$requestThe requested string
bool$aliasIndicate if alias should be used
Returns
array Array with the key lang, module, action, param, text and out

Definition at line 800 of file request.class.php.

◆ avlLang()

static avlLang (   $withName = false)
static

Get the available langs

Parameters
bool$withNameIf the language name are needed
Returns
array

Definition at line 942 of file request.class.php.

◆ createParam()

static createParam (   $param,
  $urlify = true 
)
static

Create the param string

Parameters
array | string$param
Returns
string

Definition at line 325 of file request.class.php.

◆ execModule()

static execModule ( )
static

Execute the action requested

Returns
mixed Return from the executed action

Definition at line 911 of file request.class.php.

◆ extractGet()

static extractGet ( $request,
  $affectGet = false 
)
static

Analyse a request to extract the get information (after the ?) The $request variable will be modified to remove the get information

Parameters
string$request
bool$affectGetAffect the information found to the $_GET array
Returns
array

Definition at line 774 of file request.class.php.

◆ fixFiles()

static fixFiles ( )
staticprivate

Fix the arraye $_FILES with multiple uploads

Definition at line 261 of file request.class.php.

◆ forceSecure()

static forceSecure ( )
static

Force the request to be secure, by redirting to the same url with https

Definition at line 359 of file request.class.php.

◆ forward()

static forward (   $request)
static

USed to forward the actual request to an other

Parameters
string$requestThe new request
Returns
mixed The executed action return

Definition at line 350 of file request.class.php.

◆ get()

static get (   $get = null)
static

Element requested

Parameters
null|stringget Element you want. Possible value:
  • uri
  • pathUri
  • rootUri
  • secure
  • protocol
  • controller
  • domain
  • path
  • pathWithController
  • request
  • lang
  • module
  • action
  • param
  • paramA
  • text
  • out
Returns
array|mixed uriInfo if $get parameter is null, the whole array

Definition at line 387 of file request.class.php.

◆ getCfg()

static getCfg (   $key = null)
static

Get a request config or the whole config array

Parameters
string | null$keyKey to retrieve or null to retrieve the array
Returns
mixed

Definition at line 426 of file request.class.php.

◆ getDefaultLang()

static getDefaultLang ( )
static

Get the default lang defined

Returns
string The default lang

Definition at line 953 of file request.class.php.

◆ getIp()

static getIp ( )
static

Get the IP address of the user

Returns
string

Definition at line 662 of file request.class.php.

◆ getModule()

static getModule ( )
static

Get the module requested

Returns
module_abstract

Definition at line 901 of file request.class.php.

◆ getPathControllerUri()

static getPathControllerUri (   $forceController = false)
static

Get the URL part between the domain and the request, with the controller name if it's on the current request

Parameters
bool$forceControllerForce the Controller script name on the return
Returns
string

Definition at line 461 of file request.class.php.

◆ getPrm()

static getPrm (   $key,
  $default = null 
)
static

Get a request parameter

Parameters
string$keyParameter name
mixed$defaultDefault value if not defined
Returns
mixed

Definition at line 450 of file request.class.php.

◆ getRequested()

static getRequested (   $get = null)
static

Get an element requested in the url

Parameters
null | string$get
Returns
array|mixed
See also
get

Definition at line 409 of file request.class.php.

◆ getResponseName()

static getResponseName ( )
static

Get the reponse name associate to the request out

Returns
string

Definition at line 972 of file request.class.php.

◆ hasPrm()

static hasPrm (   $key)
static

Check if the current request has the $key parameter

Parameters
string$keyparameter name
Returns
bool

Definition at line 439 of file request.class.php.

◆ init()

static init ( )
static

Initialize the request object Call by the init function from nyro class

Definition at line 92 of file request.class.php.

◆ initModule()

static initModule ( )
staticprivate

Init the module requested

Definition at line 867 of file request.class.php.

◆ isAbsolutizeAllUris()

static isAbsolutizeAllUris ( )
static

Indicates if it's configured to absolutiez all URIs

Returns
boolean

Definition at line 653 of file request.class.php.

◆ isAjax()

static isAjax ( )
static

Check if the current request is an Ajax

Returns
bool

Definition at line 689 of file request.class.php.

◆ isLang()

static isLang (   $lang)
static

Check if it's an available lang

Parameters
string$lang
Returns
bool

Definition at line 932 of file request.class.php.

◆ isLocal()

static isLocal ( )
static

Check if the request is local

Returns
bool

Definition at line 680 of file request.class.php.

◆ isMobile()

static isMobile (   $test = null)
static

Check if the current request is mobile

Parameters
null | string | array$test3 differents options:
  • null: no more test are done
  • string: the mobileStatus has to be the same
  • array: mobileStatus has to be in this array
Returns
boolean

Definition at line 702 of file request.class.php.

◆ isOut()

static isOut (   $out)
static

Check if it's an available out

Parameters
string$out
Returns
bool

Definition at line 963 of file request.class.php.

◆ isPost()

static isPost ( )
static

Check if informations are posted

Returns
bool

Definition at line 671 of file request.class.php.

◆ isScaffolded()

static isScaffolded ( )
static

Check if the module requested was scaffolded

Returns
bool

Definition at line 762 of file request.class.php.

◆ parseParam()

static parseParam (   $param)
static

Extract the param

Parameters
string$param
Returns
array Parameters in array

Definition at line 306 of file request.class.php.

◆ publishModule()

static publishModule ( )
static

Publish the module requested

Returns
string The module published

Definition at line 921 of file request.class.php.

◆ removeLangOutUrl()

static removeLangOutUrl (   $request)
static

Get the translated

Parameters
unknown_type$request
Returns
unknown

Definition at line 859 of file request.class.php.

◆ uploadedUri()

static uploadedUri (   $file,
array  $prm = array() 
)
static

Make a valid URI for an uploaded File

Parameters
string$fileThe filepath
array$prmArray to overwritte default uri construction
Returns
string The valid URI

Definition at line 561 of file request.class.php.

◆ uri()

static uri (   $prm = array())
static

Create an URI starting with /, regarding the current request By default, the controller will stay the same

Parameters
string | array$prmURL Parameters:
  • bool absolute If the url should be absolute
  • string sep Seperator if needed (default: cfg config empty)
  • strong controller
  • string lang (if not valid it will be ignored)
  • string module
  • string action
  • array paramA
  • string param (using only if paramA doesn't exist)
  • string text
  • string out (if not valid it will be ignored)
Returns
string the URL

Definition at line 483 of file request.class.php.

◆ uriDef()

static uriDef ( array  $prm = array(),
array  $use = array('lang', 'module', 'action', 'param', 'out') 
)
static

Create an array to create an uri with the requested value by default, overwritten by $prm

Parameters
array$prmArray to use in the uri
array$useElement to use by default in the uri
Returns
string the uri
See also
uri

Definition at line 579 of file request.class.php.

◆ uriString()

static uriString (   $uri)
static

Convert a string uri to an array usuable for request::uri. Starting with // will remove the controller. Starting with /// will remove the controller and absolutize the URI.

Parameters
string$uri
Returns
array

Definition at line 596 of file request.class.php.

◆ webUri()

static webUri (   $uri,
  $absolute = false 
)
static

Create a Web uri from a string (starting at the www folder)

Parameters
string$uri
boolean$absolute
Returns
string

Definition at line 644 of file request.class.php.

Field Documentation

◆ $cfg

$cfg
staticprivate

Definition at line 18 of file request.class.php.

◆ $mobileStatus

$mobileStatus = false
staticprivate

Definition at line 81 of file request.class.php.

◆ $module

$module
staticprivate

Definition at line 67 of file request.class.php.

◆ $requestedUriInfo

$requestedUriInfo
staticprivate

Definition at line 39 of file request.class.php.

◆ $scaffold

$scaffold
staticprivate

Definition at line 74 of file request.class.php.

◆ $uriInfo

$uriInfo
staticprivate

Definition at line 60 of file request.class.php.


The documentation for this class was generated from the following file:
Generated on Sun Oct 15 2017 22:25:21 for nyroFwk by doxygen 1.8.13