comparison Page.inc @ 93:8aadd7a23b68

Moved some functionality from common-functions into Http class. Reorganized Validator into a class hierarchy. Added functionality for validating with a buffer in addition to URLs.
author Tom Fredrik "BFG" Klaussen <bfg@blenning.no>
date Thu, 18 Oct 2012 16:44:48 +0200
parents 1d4c980f4255
children 2370f4450983
comparison
equal deleted inserted replaced
92:f468365813c9 93:8aadd7a23b68
2 include_once 'ScriptIncludeCache.inc'; 2 include_once 'ScriptIncludeCache.inc';
3 3
4 /// @cond 4 /// @cond
5 $baseDir = dirname(__FILE__); 5 $baseDir = dirname(__FILE__);
6 $cache = ScriptIncludeCache::instance(__FILE__); 6 $cache = ScriptIncludeCache::instance(__FILE__);
7 $cache->includeOnce('OnlineBufferValidator.inc', $baseDir);
7 $cache->includeOnce('Options.inc', $baseDir); 8 $cache->includeOnce('Options.inc', $baseDir);
8 $cache->includeOnce('Validator.inc', $baseDir);
9 /// @endcond 9 /// @endcond
10 10
11 class PageContent 11 class PageContent
12 { 12 {
13 public $headers = array(); 13 public $headers = array();
137 if ($this->cacheCheck()) { 137 if ($this->cacheCheck()) {
138 $this->cache->CheckHttpModified(); 138 $this->cache->CheckHttpModified();
139 } 139 }
140 $res = $this->generateContent(); 140 $res = $this->generateContent();
141 if ($this->mayValidate()) { 141 if ($this->mayValidate()) {
142 /*
142 $request = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; 143 $request = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
143 $validator = new Validator($request); 144 $validator = new OnlineUriValidator($request);
145 */
146 $validator = new OnlineBufferValidator($res);
144 if (!$validator->check()) 147 if (!$validator->check())
145 throw new LogicException('The page could be generated, but contained errors'); 148 throw new LogicException('The page could be generated, but contained errors');
146 } 149 }
147 if ($this->mayCompress()) { 150 if ($this->mayCompress()) {
148 $this->startCompression(); 151 $this->startCompression();