Ejemplo n.º 1
0
 private function render($page, $response)
 {
     if ($action = $page->action()) {
         include fs::normalize($action);
         action($this, $response);
     }
     if ($template = $page->template()) {
         return $this->render_template($template);
     } else {
         return null;
     }
 }
Ejemplo n.º 2
0
 function import($filename, $params = array())
 {
     fs::exists($filename) or runtime_error('XSL stylesheet not found: ' . $filename);
     $xsl = new DOMDocument();
     $xsl->load(fs::normalize($filename));
     $import = $xsl->createElementNS('http://www.w3.org/1999/XSL/Transform', 'xsl:import');
     $href = $xsl->createAttribute('href');
     $href->value = dirname(__FILE__) . '/xpath.xsl';
     $import->appendChild($href);
     $xsl->firstChild->insertBefore($import, $xsl->firstChild->firstChild);
     $xsl->xinclude();
     $this->xslt->importStylesheet($xsl);
     foreach ($this->params as $name => $value) {
         $this->xslt->removeParameter('', $name);
     }
     $this->params = $params;
     $this->xslt->setParameter('', $params);
 }
Ejemplo n.º 3
0
 static function crc32($filename)
 {
     fs::exists($filename) or runtime_error('File not found: ' . $filename);
     return hash_file('crc32', fs::normalize($filename));
 }
Ejemplo n.º 4
0
 static function load($filename)
 {
     fs::exists($filename) or runtime_error('XML document not found: ' . $filename);
     $xml = new DOMDocument();
     $xml->load(fs::normalize($filename));
     $xml->xinclude();
     return new xml($xml);
 }