Source for file response.php
Documentation is available at response.php
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
JLog::add('JResponse is deprecated.', JLog::WARNING, 'deprecated');
* This class serves to provide the Joomla Platform with a common interface to access
* response variables. This includes header and body.
* @deprecated 4.0 Use JApplicationWeb instead
protected static $body =
array();
protected static $cachable =
false;
protected static $headers =
array();
* Set/get cachable state for the response.
* If $allow is set, sets the cachable state of the response. Always returns current state.
* @param boolean $allow True to allow browser caching.
* @return boolean True if browser caching should be allowed
* @deprecated 4.0 Use JApplicationWeb::allowCache() instead
* If $replace is true, replaces any headers already defined with that $name.
* @param string $name The name of the header to set.
* @param string $value The value of the header to set.
* @param boolean $replace True to replace any existing headers by name.
* @deprecated 4.0 Use JApplicationWeb::setHeader() instead
public static function setHeader($name, $value, $replace =
false)
* Return array of headers.
* @deprecated 4.0 Use JApplicationWeb::getHeaders() instead
* @deprecated 4.0 Use JApplicationWeb::clearHeaders() instead
* @deprecated 4.0 Use JApplicationWeb::sendHeaders() instead
* If body content already defined, this will replace it.
* @param string $content The content to set to the response body.
* @deprecated 4.0 Use JApplicationWeb::setBody() instead
public static function setBody($content)
* Prepend content to the body content
* @param string $content The content to prepend to the response body.
* @deprecated 4.0 Use JApplicationWeb::prependBody() instead
* Append content to the body content
* @param string $content The content to append to the response body.
* @deprecated 4.0 Use JApplicationWeb::appendBody() instead
* Return the body content
* @param boolean $toArray Whether or not to return the body content as an array of strings or as a single string; defaults to false.
* @deprecated 4.0 Use JApplicationWeb::getBody() instead
public static function getBody($toArray =
false)
* Sends all headers prior to returning the string
* @param boolean $compress If true, compress the data
* @deprecated 4.0 Use JApplicationCms::toString() instead
public static function toString($compress =
false)
* Checks the accept encoding of the browser and compresses the data before
* sending it to the client.
* @param string $data Content to compress for output.
* @return string compressed data
* @note Replaces _compress method in 11.1
* @deprecated 4.0 Use JApplicationWeb::compress() instead
protected static function compress($data)
$encoding =
self::clientEncoding();
$gzdata = "\x1f\x8b\x08\x00\x00\x00\x00\x00";
$gzdata .= gzcompress($data, $level);
$gzdata = substr($gzdata, 0, strlen($gzdata) - 4);
$gzdata .= pack("V",$crc) . pack("V", $size);
self::setHeader('Content-Encoding', $encoding);
// Header will be removed at 4.0
self::setHeader('X-Content-Encoded-By', 'Joomla! ' .
JVERSION);
* Check, whether client supports compressed data
* @note Replaces _clientEncoding method from 11.1
* @deprecated 4.0 Use JApplicationWebClient instead
if (!isset
($_SERVER['HTTP_ACCEPT_ENCODING']))
if (false !==
strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip'))
if (false !==
strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'x-gzip'))
Documentation generated on Tue, 19 Nov 2013 15:11:53 +0100 by phpDocumentor 1.4.3