Jelix 1.8.8

jCmdLineRequest extends jRequest
in package

a request object for scripts used in a command line.

Tags
subpackage

core_request

deprecated

Table of Contents

$action  : string
the action name ("controller:method").
$authorizedResponseClass  : string
$defaultResponseType  : string
the type of the default response.
$module  : string
the module name.
$params  : array<string|int, mixed>
request parameters could set from $_GET, $_POST, or from php://input data.
$type  : string
the request type code.
$urlPathInfo  : string
the pathinfo part of the url if the url is /foo/index.php/bar, its value is /bar.
$urlScript  : string
the path to the entry point in the url if the url is /foo/index.php/bar, its value is /foo/index.php.
$urlScriptName  : string
the name of the entry point if the url is /foo/index.php/bar, its value is index.php.
$urlScriptPath  : string
the path of the entry point in the url (basePath included) if the url is /foo/index.php/bar, its value is /foo/.
$_rawBody  : mixed
$onlyDefaultAction  : mixed
$startAction  : mixed
$startModule  : mixed
$urlMapper  : UrlActionMapper
$_headers  : mixed
__construct()  : mixed
If you want to have a CLI script dedicated to the default action, tell it by given true, so you haven't to indicate the action on the command line. It means of course you couldn't execute any other actions with this script.
getBody()  : string
Get the raw content of the request body (from php://input).
getDomainName()  : string
return the application domain name.
getErrorResponse()  : jResponse
getIP()  : string
return the ip address of the user.
getModuleAction()  : mixed
retrieve module and action fills also $module and $action properties.
getParam()  : mixed
Gets the value of a request parameter. If not defined, gets its default value.
getPort()  : string
return the server port of the application.
getProtocol()  : string
return the protocol.
getServerURI()  : string
return the server URI of the application (protocol + server name + port).
header()  : mixed
headers()  : mixed
init()  : mixed
initialize the request : analyse of http request etc.
isAjax()  : bool
says if this is an ajax request.
isAllowedResponse()  : bool
isHttps()  : bool
isPostMethod()  : bool
Says if the request method is POST.
parseMultipartBody()  : mixed
readHttpBody()  : mixed
call it when you want to read the content of the body of a request when the method is not GET or POST.
_initParams()  : mixed
analyse the http request and sets the params property.
_initUrlData()  : mixed
init the url* properties.
_generateHeaders()  : mixed

Properties

$action

the action name ("controller:method").

public string $action = ''
Tags

$authorizedResponseClass

public string $authorizedResponseClass = 'jResponseCmdline'

the name of the base class for an allowed response for the current request

Tags

$defaultResponseType

the type of the default response.

public string $defaultResponseType = 'cmdline'
Tags

$params

request parameters could set from $_GET, $_POST, or from php://input data.

public array<string|int, mixed> $params = array()
Tags

$urlPathInfo

the pathinfo part of the url if the url is /foo/index.php/bar, its value is /bar.

public string $urlPathInfo
Tags

$urlScript

the path to the entry point in the url if the url is /foo/index.php/bar, its value is /foo/index.php.

public string $urlScript

Warning: if the app is behind a proxy, the path includes the backendBasePath, not the basePath. Use urlScriptPath and urlScriptName to have the "public" url, as needed for the frontend HTTP server.

Tags

$urlScriptName

the name of the entry point if the url is /foo/index.php/bar, its value is index.php.

public string $urlScriptName
Tags

$urlScriptPath

the path of the entry point in the url (basePath included) if the url is /foo/index.php/bar, its value is /foo/.

public string $urlScriptPath
Tags

Methods

__construct()

If you want to have a CLI script dedicated to the default action, tell it by given true, so you haven't to indicate the action on the command line. It means of course you couldn't execute any other actions with this script.

public __construct([bool $onlyDefaultAction = false ][, string $module = '' ][, string $action = '' ]) : mixed
Parameters
$onlyDefaultAction : bool = false
$module : string = ''

module for the default action

$action : string = ''

action for the default action

Tags
Return values
mixed

getBody()

Get the raw content of the request body (from php://input).

public getBody() : string
Tags
since
1.7
Return values
string

getDomainName()

return the application domain name.

public getDomainName() : string
Tags
since
1.2.3
Return values
string

getIP()

return the ip address of the user.

public getIP() : string
Tags
Return values
string

the ip

getModuleAction()

retrieve module and action fills also $module and $action properties.

public getModuleAction() : mixed
Tags
Return values
mixed

getParam()

Gets the value of a request parameter. If not defined, gets its default value.

public getParam(string $name[, mixed $defaultValue = null ][, bool $useDefaultIfEmpty = false ]) : mixed
Parameters
$name : string

the name of the request parameter

$defaultValue : mixed = null

the default returned value if the parameter doesn't exists

$useDefaultIfEmpty : bool = false

true: says to return the default value if the parameter value is ""

Tags
Return values
mixed

the request parameter value

getPort()

return the server port of the application.

public getPort([null|mixed $forceHttps = null ]) : string
Parameters
$forceHttps : null|mixed = null
Tags
since
1.2.4
Return values
string

the ":port" or empty string

getProtocol()

return the protocol.

public getProtocol() : string
Tags
since
1.2
Return values
string

http:// or https://

getServerURI()

return the server URI of the application (protocol + server name + port).

public getServerURI([null|mixed $forceHttps = null ]) : string
Parameters
$forceHttps : null|mixed = null
Tags
since
1.2.4
Return values
string

the serveur uri

header()

public header(mixed $name) : mixed
Parameters
$name : mixed
Tags
Return values
mixed

headers()

public headers() : mixed
Tags
Return values
mixed

isAjax()

says if this is an ajax request.

public isAjax() : bool
Tags
since
1.3a1
Return values
bool

true if it is an ajax request

isAllowedResponse()

public isAllowedResponse(mixed $response) : bool
Parameters
$response : mixed

the response

Tags
Return values
bool

true if the given class is allowed for the current request

isHttps()

public isHttps() : bool
Tags
Return values
bool

true if the request is made with HTTPS

isPostMethod()

Says if the request method is POST.

public isPostMethod() : bool
Tags
since
1.6.17
Return values
bool

parseMultipartBody()

public static parseMultipartBody(mixed $contentType, mixed $input) : mixed
Parameters
$contentType : mixed
$input : mixed
Tags
Return values
mixed

readHttpBody()

call it when you want to read the content of the body of a request when the method is not GET or POST.

public readHttpBody() : mixed
Tags
since
1.2
Return values
mixed

array of parameters or a single string when the content-type is unknown

_initParams()

analyse the http request and sets the params property.

protected _initParams() : mixed
Tags
Return values
mixed

_initUrlData()

init the url* properties.

protected _initUrlData() : mixed
Tags
Return values
mixed

_generateHeaders()

private _generateHeaders() : mixed
Tags
Return values
mixed

Search results