Joomla CMS  3.10.11 (avec JPlatform 13.1 inclus)
Documentation des API du CMS Joomla en version 3.10.11 et du framework Joomla Platform intégré
Référence de la classe WebApplication
+ Graphe d'héritage de WebApplication:

Fonctions membres publiques

 __construct (Input $input=null, Registry $config=null, \JApplicationWebClient $client=null)
 
 initialise ($session=null, $document=null, $language=null, $dispatcher=null)
 
 execute ()
 
 redirect ($url, $status=303)
 
 loadConfiguration ($data)
 
 allowCache ($allow=null)
 
 setHeader ($name, $value, $replace=false)
 
 getHeaders ()
 
 clearHeaders ()
 
 sendHeaders ()
 
 setBody ($content)
 
 prependBody ($content)
 
 appendBody ($content)
 
 getBody ($asArray=false)
 
 getDocument ()
 
 getLanguage ()
 
 getSession ()
 
 flushAssets ()
 
 isSSLConnection ()
 
 loadDocument (\JDocument $document=null)
 
 loadLanguage (\JLanguage $language=null)
 
 loadSession (\JSession $session=null)
 
 afterSessionStart ()
 
- Fonctions membres publiques hérités de BaseApplication
 __construct (Input $input=null, Registry $config=null)
 
 getIdentity ()
 
 registerEvent ($event, $handler)
 
 triggerEvent ($event, array $args=null)
 
 loadDispatcher (\JEventDispatcher $dispatcher=null)
 
 loadIdentity (\JUser $identity=null)
 
- Fonctions membres publiques hérités de AbstractApplication
 __construct (Input $input=null, Registry $config=null)
 
 close ($code=0)
 
 execute ()
 
 get ($key, $default=null)
 
 getLogger ()
 
 set ($key, $value=null)
 
 setConfiguration (Registry $config)
 
 setLogger (LoggerInterface $logger)
 

Fonctions membres publiques statiques

static getInstance ($name=null)
 

Champs de données

 $charSet = 'utf-8'
 
 $mimeType = 'text/html'
 
 $modifiedDate
 
 $client
 
- Champs de données hérités de AbstractApplication
 $input
 

Fonctions membres protégées

 render ()
 
 compress ()
 
 respond ()
 
 isRedirectState ($state)
 
 getHttpStatusValue ($value)
 
 checkConnectionAlive ()
 
 checkHeadersSent ()
 
 detectRequestUri ()
 
 fetchConfigurationData ($file='', $class='\JConfig')
 
 header ($string, $replace=true, $code=null)
 
 loadSystemUris ($requestUri=null)
 
- Fonctions membres protégées hérités de BaseApplication
 doExecute ()
 
- Fonctions membres protégées hérités de AbstractApplication
 doExecute ()
 
 initialise ()
 

Attributs protégés

 $document
 
 $language
 
 $session
 
 $response
 
- Attributs protégés hérités de BaseApplication
 $dispatcher
 
 $identity
 
- Attributs protégés hérités de AbstractApplication
 $config
 

Attributs protégés statiques

static $instance
 

Attributs privés

 $responseMap
 
 $singleValueResponseHeaders
 

Description détaillée

Base class for a Joomla! Web application.

Depuis
2.5.0
Note
As of 4.0 this class will be abstract

Documentation des constructeurs et destructeur

◆ __construct()

__construct ( Input  $input = null,
Registry  $config = null,
\JApplicationWebClient  $client = null 
)

Class constructor.

Paramètres
Input$inputAn optional argument to provide dependency injection for the application's input object. If the argument is a object that object will become the application's input object, otherwise a default input object is created.
Registry$configAn optional argument to provide dependency injection for the application's config object. If the argument is a Registry object that object will become the application's config object, otherwise a default config object is created.
\JApplicationWebClient$clientAn optional argument to provide dependency injection for the application's client object. If the argument is a object that object will become the application's client object, otherwise a default client object is created.
Depuis
1.7.3

Références $client, $config, et $input.

Documentation des fonctions membres

◆ afterSessionStart()

afterSessionStart ( )

After the session has been started we need to populate it with some default values.

Renvoie
void
Depuis
3.0.1

◆ allowCache()

allowCache (   $allow = null)

Set/get cachable state for the response. If $allow is set, sets the cachable state of the response. Always returns the current state.

Paramètres
boolean$allowTrue to allow browser caching.
Renvoie
boolean
Depuis
1.7.3

Références null.

◆ appendBody()

appendBody (   $content)

Append content to the body content

Paramètres
string$contentThe content to append to the response body.
Renvoie
WebApplication Instance of $this to allow chaining.
Depuis
1.7.3

Références $content.

◆ checkConnectionAlive()

checkConnectionAlive ( )
protected

Method to check the current client connection status to ensure that it is alive. We are wrapping this to isolate the connection_status() function from our code base for testing reasons.

Renvoie
boolean True if the connection is valid and normal.
Voir également
connection_status()
Depuis
1.7.3

◆ checkHeadersSent()

checkHeadersSent ( )
protected

Method to check to see if headers have already been sent. We are wrapping this to isolate the headers_sent() function from our code base for testing reasons.

Renvoie
boolean True if the headers have already been sent.
Voir également
headers_sent()
Depuis
1.7.3

◆ clearHeaders()

clearHeaders ( )

Method to clear any set response headers.

Renvoie
WebApplication Instance of $this to allow chaining.
Depuis
1.7.3

◆ compress()

compress ( )
protected

Checks the accept encoding of the browser and compresses the data before sending it to the client if possible.

Renvoie
void
Depuis
1.7.3

Références $data.

◆ detectRequestUri()

detectRequestUri ( )
protected

Method to detect the requested URI from server environment variables.

Renvoie
string The requested URI
Depuis
1.7.3

Références $uri, et elseif.

◆ execute()

execute ( )

Execute the application.

Renvoie
void
Depuis
1.7.3

◆ fetchConfigurationData()

fetchConfigurationData (   $file = '',
  $class = '\JConfig' 
)
protected

Method to load a PHP configuration class file based on convention and return the instantiated data object. You will extend this method in child classes to provide configuration data from whatever data source is relevant for your specific application.

Paramètres
string$fileThe path and filename of the configuration file. If not provided, configuration.php in JPATH_CONFIGURATION will be used.
string$classThe class name to instantiate.
Renvoie
mixed Either an array or object to be loaded into the configuration object.
Depuis
1.7.3
Exceptions

Références $class, $config, $file, JPATH_CONFIGURATION, et JLoader\register().

◆ flushAssets()

flushAssets ( )

Flush the media version to refresh versionable assets

Renvoie
void
Depuis
3.2

Références $version.

◆ getBody()

getBody (   $asArray = false)

Return the body content

Paramètres
boolean$asArrayTrue to return the body as an array of strings.
Renvoie
mixed The response body either as an array or concatenated string.
Depuis
1.7.3

◆ getDocument()

getDocument ( )

Method to get the application document object.

Renvoie
The document object
Depuis
1.7.3

Références $document.

◆ getHeaders()

getHeaders ( )

Method to get the array of response headers to be sent when the response is sent to the client.

Renvoie
array *
Depuis
1.7.3

◆ getHttpStatusValue()

getHttpStatusValue (   $value)
protected

Check if a given value can be successfully mapped to a valid http status value

Paramètres
string$valueThe given status as int or string
Renvoie
string
Depuis
3.8.0

Références $value.

◆ getInstance()

static getInstance (   $name = null)
static

Returns a reference to the global WebApplication object, only creating it if it doesn't already exist.

This method must be invoked as: $web = WebApplication::getInstance();

Paramètres
string$nameThe name (optional) of the JApplicationWeb class to instantiate.
Renvoie
WebApplication
Depuis
1.7.3

Références $name.

◆ getLanguage()

getLanguage ( )

Method to get the application language object.

Renvoie
The language object
Depuis
1.7.3

Références $language.

◆ getSession()

getSession ( )

Method to get the application session object.

Renvoie
The session object
Depuis
1.7.3

◆ header()

header (   $string,
  $replace = true,
  $code = null 
)
protected

Method to send a header to the client. We are wrapping this to isolate the header() function from our code base for testing reasons.

Paramètres
string$stringThe header string.
boolean$replaceThe optional replace parameter indicates whether the header should replace a previous similar header, or add a second header of the same type.
integer$codeForces the HTTP response code to the specified value. Note that this parameter only has an effect if the string is not empty.
Renvoie
void
Voir également
header()
Depuis
1.7.3

Références null.

◆ initialise()

initialise (   $session = null,
  $document = null,
  $language = null,
  $dispatcher = null 
)

Initialise the application.

Paramètres
mixed$sessionAn optional argument to provide dependency injection for the application's session object. If the argument is a object that object will become the application's session object, if it is false then there will be no session object, and if it is null then the default session object will be created based on the application's loadSession() method.
mixed$documentAn optional argument to provide dependency injection for the application's document object. If the argument is a object that object will become the application's document object, if it is false then there will be no document object, and if it is null then the default document object will be created based on the application's loadDocument() method.
mixed$languageAn optional argument to provide dependency injection for the application's language object. If the argument is a object that object will become the application's language object, if it is false then there will be no language object, and if it is null then the default language object will be created based on the application's loadLanguage() method.
mixed$dispatcherAn optional argument to provide dependency injection for the application's event dispatcher. If the argument is a object that object will become the application's event dispatcher, if it is null then the default event dispatcher will be created based on the application's loadDispatcher() method.
Renvoie
WebApplication Instance of $this to allow chaining.
Obsolète:
4.0
Voir également
WebApplication::loadSession()
WebApplication::loadDocument()
WebApplication::loadLanguage()
WebApplication::loadDispatcher()
Depuis
1.7.3

Références $dispatcher, $document, et $language.

◆ isRedirectState()

isRedirectState (   $state)
protected

Checks if a state is a redirect state

Paramètres
integer$stateThe HTTP 1.1 status code.
Renvoie
boolean
Depuis
3.8.0

Références $state.

◆ isSSLConnection()

isSSLConnection ( )

Determine if we are using a secure (SSL) connection.

Renvoie
boolean True if using SSL, false if not.
Depuis
3.0.1

◆ loadConfiguration()

loadConfiguration (   $data)

Load an object or array into the application configuration object.

Paramètres
mixed$dataEither an array or object to be loaded into the configuration object.
Renvoie
WebApplication Instance of $this to allow chaining.
Depuis
1.7.3

Références $data, et elseif.

◆ loadDocument()

loadDocument ( \JDocument  $document = null)

Allows the application to load a custom or default document.

The logic and options for creating this object are adequately generic for default cases but for many applications it will make sense to override this method and create a document, if required, based on more specific needs.

Paramètres
\JDocument$documentAn optional document object. If omitted, the factory document is created.
Renvoie
WebApplication This method is chainable.
Depuis
1.7.3

Références $document, getDocument, et null.

◆ loadLanguage()

loadLanguage ( \JLanguage  $language = null)

Allows the application to load a custom or default language.

The logic and options for creating this object are adequately generic for default cases but for many applications it will make sense to override this method and create a language, if required, based on more specific needs.

Paramètres
\JLanguage$languageAn optional language object. If omitted, the factory language is created.
Renvoie
WebApplication This method is chainable.
Depuis
1.7.3

Références $language, language, et null.

◆ loadSession()

loadSession ( \JSession  $session = null)

Allows the application to load a custom or default session.

The logic and options for creating this object are adequately generic for default cases but for many applications it will make sense to override this method and create a session, if required, based on more specific needs.

Paramètres
\JSession$sessionAn optional session object. If omitted, the session is created.
Renvoie
WebApplication This method is chainable.
Depuis
1.7.3

Références $name, $options, et null.

◆ loadSystemUris()

loadSystemUris (   $requestUri = null)
protected

Method to load the system URI strings for the application.

Paramètres
string$requestUriAn optional request URI to use instead of detecting one from the server environment variables.
Renvoie
void
Depuis
1.7.3

Références $path, et $uri.

◆ prependBody()

prependBody (   $content)

Prepend content to the body content

Paramètres
string$contentThe content to prepend to the response body.
Renvoie
WebApplication Instance of $this to allow chaining.
Depuis
1.7.3

Références $content.

◆ redirect()

redirect (   $url,
  $status = 303 
)

Redirect to another URL.

If the headers have not been sent the redirect will be accomplished using a "301 Moved Permanently" or "303 See Other" code in the header pointing to the new location. If the headers have already been sent this will be accomplished using a JavaScript statement.

Paramètres
string$urlThe URL to redirect to. Can only be http/https URL.
integer$statusThe HTTP 1.1 status code to be provided. 303 is assumed by default.
Renvoie
void
Depuis
1.7.3

Références $html, $parts, $path, $prefix, $uri, $url, et json_encode.

◆ render()

render ( )
protected

Rendering is the process of pushing the document buffers into the template placeholders, retrieving data from the document and pushing it into the application response buffer.

Renvoie
void
Depuis
1.7.3

Références $data, $options, JPATH_BASE, et JPATH_THEMES.

◆ respond()

respond ( )
protected

Method to send the application response to the client. All headers will be sent prior to the main application output data.

Renvoie
void
Depuis
1.7.3

◆ sendHeaders()

sendHeaders ( )

Send the response headers.

Renvoie
WebApplication Instance of $this to allow chaining.
Depuis
1.7.3

◆ setBody()

setBody (   $content)

Set body content. If body content already defined, this will replace it.

Paramètres
string$contentThe content to set as the response body.
Renvoie
WebApplication Instance of $this to allow chaining.
Depuis
1.7.3

Références $content.

◆ setHeader()

setHeader (   $name,
  $value,
  $replace = false 
)

Method to set a response header. If the replace flag is set then all headers with the given name will be replaced by the new one. The headers are stored in an internal array to be sent when the site is sent to the browser.

Paramètres
string$nameThe name of the header to set.
string$valueThe value of the header to set.
boolean$replaceTrue to replace any headers with the same name.
Renvoie
WebApplication Instance of $this to allow chaining.
Depuis
1.7.3

Références $key, $name, $names, et $value.

Documentation des champs

◆ $charSet

$charSet = 'utf-8'

◆ $client

$client

◆ $document

$document
protected

◆ $instance

$instance
staticprotected

◆ $language

$language
protected

◆ $mimeType

$mimeType = 'text/html'

◆ $modifiedDate

$modifiedDate

◆ $response

$response
protected

◆ $responseMap

$responseMap
private

◆ $session

$session
protected

◆ $singleValueResponseHeaders

$singleValueResponseHeaders
private
Valeur initiale :
= array(
'status',
'content-length',
'host',
'content-type',
'content-location',
'date',
'location',
'retry-after',
'server',
'mime-version',
'last-modified',
'etag',
'accept-ranges',
'content-range',
'age',
'expires',
'clear-site-data',
'pragma',
'strict-transport-security',
'content-security-policy',
'content-security-policy-report-only',
'x-frame-options',
'x-xss-protection',
'x-content-type-options',
'referrer-policy',
'expect-ct',
'feature-policy',
'permissions-policy',
)

La documentation de cette classe a été générée à partir du fichier suivant :