diff InputParser.inc @ 78:7c68015b211a

Common source for all page generators. Support for compressed output.
author Tom Fredrik "BFG" Klaussen <bfg@blenning.no>
date Fri, 12 Oct 2012 16:43:26 +0200
parents dd4ddedca4c5
children f468365813c9
line wrap: on
line diff
--- a/InputParser.inc	Fri Oct 12 01:54:51 2012 +0200
+++ b/InputParser.inc	Fri Oct 12 16:43:26 2012 +0200
@@ -1,8 +1,15 @@
 <?php
+/// @cond
+$baseDir = dirname(__FILE__);
+$cache = ScriptIncludeCache::instance(__FILE__);
+$cache->includeOnce('Page.inc', dirname(__FILE__));
+/// @endcond
+
 /**
  * Functionality for translating an XML configuration document into a webpage
  */
-class InputParser {
+class InputParser extends Page
+{
   private $options;
   private $master;
 
@@ -18,6 +25,7 @@
     $this->master = new DOMDocument();
     $cache = new CacheTimeCheck($name);
     $cache->addParent($masterCache);
+    parent::setCache($cache);
     $this->master->load($name);
 
     $this->options = new Options($this->master);
@@ -56,17 +64,20 @@
 
   }
 
+  function cacheCheck()
+  {
+    return $this->options->getCacheable();
+  }
+
   /**
    * Generate an appropriate response for this page, eg. 302 NOT
    * MODIFIED or the actual page
    */
-  function genPage()
+  function generateContent()
   {
     //print_r($this->options->getCache()->cacheSet(1));
     //exit;
-    if (CACHING && $this->options->getCacheable())
-      $this->options->getCache()->CheckHttpModified();
-    print $this->master->saveXml($this->master);
+    return $this->master->saveXml($this->master);
   }
 
   /**