Jelix 1.7.18

jServer
in package

Static class providing some utilities to retrieve informations about the server.

Tags
subpackage

core

since
1.3.2

Table of Contents

$domainPortCache  : mixed
getDomainName()  : string
return the application domain name.
getDomainPortFromServer()  : array<string|int, mixed>
Return the domain and the port from the server parameters.
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).
isCLI()  : bool
tells if we are in a CLI (Command Line Interface) context or not.
isHttps()  : bool
Indicate if the request is done or should be done with HTTPS,.
isHttpsFromServer()  : mixed
Indicate if the request is done with HTTPS, as indicated by the server parameters.

Properties

Methods

getDomainName()

return the application domain name.

public static getDomainName() : string
Tags
since
1.6.30
Return values
string

getDomainPortFromServer()

Return the domain and the port from the server parameters.

public static getDomainPortFromServer([bool $cache = true ]) : array<string|int, mixed>
Parameters
$cache : bool = true
Tags
since
1.6.34
Return values
array<string|int, mixed>

the domain and the port number

getPort()

return the server port of the application.

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

the ":port" or empty string

getProtocol()

return the protocol.

public static getProtocol() : string
Tags
since
1.6.30
Return values
string

http:// or https://

getServerURI()

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

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

the serveur uri

isCLI()

tells if we are in a CLI (Command Line Interface) context or not.

public static isCLI() : bool

If this is the case, fills some missing $_SERVER variables when cgi is used.

Return values
bool

true if we are in a CLI context

isHttps()

Indicate if the request is done or should be done with HTTPS,.

public static isHttps() : bool

It takes care about the Jelix configuration, else from the server parameters.

Tags
todo

support Forwarded and X-Forwarded-Proto headers

since
1.6.30
Return values
bool

true if the request is done or should be done with HTTPS

isHttpsFromServer()

Indicate if the request is done with HTTPS, as indicated by the server parameters.

public static isHttpsFromServer() : mixed
Tags
since
1.6.34
Return values
mixed

Search results