10 defined(
'JPATH_PLATFORM') or die;
32 protected static $body = array();
39 protected static $cachable =
false;
46 protected static $headers = array();
60 public static function allowCache($allow = null)
79 public static function setHeader($name, $value, $replace =
false)
92 public static function getHeaders()
105 public static function clearHeaders()
118 public static function sendHeaders()
135 public static function setBody($content)
150 public static function prependBody($content)
165 public static function appendBody($content)
180 public static function getBody($toArray =
false)
195 public static function toString($compress =
false)
214 protected static function compress($data)
216 $encoding = self::clientEncoding();
223 if (!extension_loaded(
'zlib') || ini_get(
'zlib.output_compression'))
233 if (connection_status() !== 0)
252 $gzdata = gzencode($data, $level);
254 self::setHeader(
'Content-Encoding', $encoding);
259 self::setHeader(
'X-Content-Encoded-By',
'Joomla! ' . JVERSION);
274 protected static function clientEncoding()
276 if (!isset($_SERVER[
'HTTP_ACCEPT_ENCODING']))
283 if (
false !== strpos($_SERVER[
'HTTP_ACCEPT_ENCODING'],
'gzip'))
288 if (
false !== strpos($_SERVER[
'HTTP_ACCEPT_ENCODING'],
'x-gzip'))
290 $encoding =
'x-gzip';