Jelix 1.6.37

jCmdLineRequest extends jRequest
in package

a request object for scripts used in a command line

Tags
subpackage

core_request

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 data processing of $HTTP_RAW_POST_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/
$onlyDefaultAction  : mixed
$_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.
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 = ''

$authorizedResponseClass

public string $authorizedResponseClass = 'jResponseCmdline'

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

$defaultResponseType

the type of the default response

public string $defaultResponseType = 'cmdline'

$params

request parameters could set from $_GET, $_POST, or from data processing of $HTTP_RAW_POST_DATA

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

$urlPathInfo

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

public string $urlPathInfo

$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

$urlScriptName

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

public string $urlScriptName

$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

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 ]) : mixed
Parameters
$onlyDefaultAction : bool = false
Return values
mixed

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
Return values
string

the ip

getModuleAction()

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

public getModuleAction() : mixed
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 ""

Return values
mixed

the request parameter value

getPort()

return the server port of the application

public getPort([mixed $forceHttps = null ]) : string
Parameters
$forceHttps : 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([mixed $forceHttps = null ]) : string
Parameters
$forceHttps : mixed = null
Tags
since
1.2.4
Return values
string

the serveur uri

header()

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

init()

initialize the request : analyse of http request etc.

public init() : mixed

.

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

Return values
bool

true if the given class is allowed for the current request

isHttps()

public isHttps() : bool
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
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
Return values
mixed

_initUrlData()

init the url* properties

protected _initUrlData() : mixed
Return values
mixed

_generateHeaders()

private _generateHeaders() : mixed
Return values
mixed

Search results