Mercurial > SimpleWebPresenter
view Page.inc @ 83:ff5fc61aa5ea
Throw only specific exceptions, eg. non of type Exception base.
| author | Tom Fredrik "BFG" Klaussen <bfg@blenning.no> |
|---|---|
| date | Mon, 15 Oct 2012 16:52:28 +0200 |
| parents | 7c68015b211a |
| children | 88904282b888 |
line wrap: on
line source
<? include_once 'ScriptIncludeCache.inc'; /// @cond $baseDir = dirname(__FILE__); $cache = ScriptIncludeCache::instance(__FILE__); $cache->includeOnce('Options.inc', dirname(__FILE__)); /// @endcond /** * Functionality for generating a page */ class Page { private $cache; function __construct($cache) { $this->setCache($cache); } protected function setCache($cache) { $this->cache = $cache; } protected function getCache() { return $this->cache; } function mayCompress() { return (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')); } function startCompression() { ob_start("ob_gzhandler"); } function genPage() { if ($this->cacheCheck()) { $this->cache->CheckHttpModified(); } $res = $this->generateContent(); if ($this->mayCompress()) { $this->startCompression(); } print $res; } } ?>
