JOOMLA中国
  • Joomla中国首页
  • 社区
  • 教程
  • 应用市场
  • B计划
Joomla! Framework TM
  • Namespace
  • Class
  • Tree
  • Deprecated

Namespaces

  • Composer
    • Autoload
  • Joomla
    • Application
      • Cli
        • Output
          • Processor
      • Web
    • Data
    • DI
      • Exception
    • Event
    • Filter
    • Input
    • Ldap
    • Registry
      • Format
    • Session
      • Storage
    • String
    • Uri
    • Utilities
  • None
  • PasswordCompat
    • binary
  • PHP
  • Psr
    • Log
  • Symfony
    • Component
      • Yaml
        • Exception
    • Polyfill
      • Util

Classes

  • AbstractApplication
  • AbstractCliApplication
  • AbstractDaemonApplication
  • AbstractWebApplication

Class AbstractWebApplication

Base class for a Joomla! Web application.

Joomla\Application\AbstractApplication implements Psr\Log\LoggerAwareInterface
Extended by Joomla\Application\AbstractWebApplication
Abstract
Namespace: Joomla\Application
Since: 1.0
Located at vendor/joomla/application/src/AbstractWebApplication.php

Methods summary

public
# __construct( Joomla\Input\Input $input = null, Joomla\Registry\Registry $config = null, Joomla\Application\Web\WebClient $client = null )

Class constructor.

Class constructor.

Parameters

$input
Joomla\Input\Input - $input An optional argument to provide dependency injection for the application's input object. If the argument is an Input object that object will become the application's input object, otherwise a default input object is created.
$config
Joomla\Registry\Registry - $config An 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.
$client
Joomla\Application\Web\WebClient - $client An optional argument to provide dependency injection for the application's client object. If the argument is a Web\WebClient object that object will become the application's client object, otherwise a default client object is created.

Since

1.0

Overrides

Joomla\Application\AbstractApplication::__construct
public
# execute( )

Execute the application.

Execute the application.

Since

1.0

Overrides

Joomla\Application\AbstractApplication::execute
protected
# compress( )

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

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

Since

1.0
protected
# respond( )

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

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

Since

1.0
public
# redirect( string $url, integer $status = 303 )

Redirect to another URL.

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.

Parameters

$url
string - $url The URL to redirect to. Can only be http/https URL
$status
integer - $status The HTTP 1.1 status code to be provided. 303 is assumed by default.

Throws

InvalidArgumentException

Since

1.0
public boolean
# allowCache( boolean $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.

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

Parameters

$allow
boolean - $allow True to allow browser caching.

Returns

boolean

Since

1.0
public Joomla\Application\AbstractWebApplication
# setHeader( string $name, string $value, boolean $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.

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.

Parameters

$name
string - $name The name of the header to set.
$value
string - $value The value of the header to set.
$replace
boolean - $replace True to replace any headers with the same name.

Returns

Joomla\Application\AbstractWebApplication - Instance of $this to allow chaining.

Since

1.0
public array
# getHeaders( )

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

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

Returns

array

Since

1.0
public Joomla\Application\AbstractWebApplication
# clearHeaders( )

Method to clear any set response headers.

Method to clear any set response headers.

Returns

Joomla\Application\AbstractWebApplication - Instance of $this to allow chaining.

Since

1.0
public Joomla\Application\AbstractWebApplication
# sendHeaders( )

Send the response headers.

Send the response headers.

Returns

Joomla\Application\AbstractWebApplication - Instance of $this to allow chaining.

Since

1.0
public Joomla\Application\AbstractWebApplication
# setBody( string $content )

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

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

Parameters

$content
string - $content The content to set as the response body.

Returns

Joomla\Application\AbstractWebApplication - Instance of $this to allow chaining.

Since

1.0
public Joomla\Application\AbstractWebApplication
# prependBody( string $content )

Prepend content to the body content

Prepend content to the body content

Parameters

$content
string - $content The content to prepend to the response body.

Returns

Joomla\Application\AbstractWebApplication - Instance of $this to allow chaining.

Since

1.0
public Joomla\Application\AbstractWebApplication
# appendBody( string $content )

Append content to the body content

Append content to the body content

Parameters

$content
string - $content The content to append to the response body.

Returns

Joomla\Application\AbstractWebApplication - Instance of $this to allow chaining.

Since

1.0
public mixed
# getBody( boolean $asArray = false )

Return the body content

Return the body content

Parameters

$asArray
boolean - $asArray True to return the body as an array of strings.

Returns

mixed - The response body either as an array or concatenated string.

Since

1.0
public Joomla\Session\Session
# getSession( )

Method to get the application session object.

Method to get the application session object.

Returns

Joomla\Session\Session - The session object

Since

1.0
protected boolean
# checkConnectionAlive( )

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

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

Returns

boolean - True if the connection is valid and normal.

Since

1.0

See

connection_status()

CodeCoverageIgnore

protected boolean
# checkHeadersSent( )

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.

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.

Returns

boolean - True if the headers have already been sent.

Since

1.0

See

headers_sent()

CodeCoverageIgnore

protected string
# detectRequestUri( )

Method to detect the requested URI from server environment variables.

Method to detect the requested URI from server environment variables.

Returns

string - The requested URI

Since

1.0
protected
# header( string $string, boolean $replace = true, integer $code = null )

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

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

Parameters

$string
string - $string The header string.
$replace
boolean - $replace The optional replace parameter indicates whether the header should replace a previous similar header, or add a second header of the same type.
$code
integer - $code Forces the HTTP response code to the specified value. Note that this parameter only has an effect if the string is not empty.

Since

1.0

See

Joomla\Application\AbstractWebApplication::header()

CodeCoverageIgnore

public boolean
# isSslConnection( )

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

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

Returns

boolean - True if using SSL, false if not.

Since

1.0
public Joomla\Application\AbstractWebApplication
# setSession( Joomla\Session\Session $session )

Sets the session for the application to use, if required.

Sets the session for the application to use, if required.

Parameters

$session
Joomla\Session\Session - $session A session object.

Returns

Joomla\Application\AbstractWebApplication - Returns itself to support chaining.

Since

1.0
protected
# loadSystemUris( string $requestUri = null )

Method to load the system URI strings for the application.

Method to load the system URI strings for the application.

Parameters

$requestUri
string - $requestUri An optional request URI to use instead of detecting one from the server environment variables.

Since

1.0
public boolean
# checkToken( string $method = 'post' )

Checks for a form token in the request.

Checks for a form token in the request.

Use in conjunction with getFormToken.

Parameters

$method
string - $method The request method in which to look for the token key.

Returns

boolean - True if found and valid, false otherwise.

Since

1.0
public string
# getFormToken( boolean $forceNew = false )

Method to determine a hash for anti-spoofing variable names

Method to determine a hash for anti-spoofing variable names

Parameters

$forceNew
boolean - $forceNew If true, force a new token to be created

Returns

string - Hashed var name

Since

1.0
public static boolean
# isAscii( string $str )

Tests whether a string contains only 7bit ASCII bytes.

Tests whether a string contains only 7bit ASCII bytes.

You might use this to conditionally check whether a string needs handling as UTF-8 or not, potentially offering performance benefits by using the native PHP equivalent if it's just ASCII e.g.;

Parameters

$str
string - $str The string to test.

Returns

boolean - True if the string is all ASCII

Since

1.4.0

Methods inherited from Joomla\Application\AbstractApplication

close(), doExecute(), get(), getLogger(), initialise(), set(), setConfiguration(), setLogger()

Magic methods summary

Properties summary

public string $charSet
#

Character encoding string.

Character encoding string.

Since

1.0
public string $mimeType
#

Response mime type.

Response mime type.

Since

1.0
public DateTime $modifiedDate
#

The body modified date for response headers.

The body modified date for response headers.

Since

1.0
public Joomla\Application\Web\WebClient $client
#

The application client object.

The application client object.

Since

1.0
protected object $response
#

The application response object.

The application response object.

Since

1.0

Properties inherited from Joomla\Application\AbstractApplication

$config, $input

Joomla! Framework TM API documentation generated by ApiGen 2.8.0
Joomla!® and Joomla! Framework™ are trademarks of Open Source Matters, Inc. in the United States and other countries.