Beispiel #1
0
 public function beforeAction()
 {
     // clear cache when post data arrives
     if ($this->controller instanceof AdminController) {
         if ($this->controller->request->isPost()) {
             $this->clear();
         }
         return true;
     }
     if ($this->controller->UserLogin->loggedin() || Registry::get('DEBUG') > DEBUG_PRODUCTION) {
         return true;
     }
     if (!isset($this->config[$this->controller->name][$this->controller->action])) {
         return true;
     }
     if ($this->controller->request->isGet()) {
         $ttl = $this->config[$this->controller->name][$this->controller->action];
         $id = $this->controller->name . '_' . $this->controller->layout . '_' . $this->controller->action . '_' . md5($this->controller->action . http_build_query($this->controller->params) . I18n::locale());
         $this->filename = CACHE_DIR . 'views/' . $id . '.html';
         if (file_exists($this->filename)) {
             // read from cache
             if (filemtime($this->filename) + $ttl > time()) {
                 $rendered = file_get_contents($this->filename);
                 // replace MD5
                 $rendered = preg_replace('@md5" value="[\\w\\d]+"@', 'md5" value="' . md5($this->controller->request->host . SALT) . '"', $rendered);
                 $rendered = str_replace('</body>', '<!-- cached ' . ephFrame::compileTime() . ' --></body>', $rendered);
                 echo $rendered;
                 die;
             }
         }
     }
     return true;
 }
Beispiel #2
0
					<li><?php 
echo $HTML->link('http://www.codinghorror.com/', 'Coding Horror', array('rel' => 'external'));
?>
</li>
				</ul>
			</section>
		</aside>
		<footer>
			<q><?php 
echo $theme;
?>
</q> HTML5 <?php 
echo $HTML->link('http://code.marceleichner.de/project/harrison', 'Harrison');
?>
 Theme (<a href="http://validator.w3.org/check/referer" rel="external" title="Validate this page’s source">Validate Source</a>), © 2010 by <?php 
echo $HTML->link('http://www.marceleichner.de', 'Ephigenia M. Eichner');
?>
		</footer>
	</div>
	<?php 
// Javascript
if (isset($JavaScript)) {
    echo $JavaScript->addFiles(array('http://html5shiv.googlecode.com/svn/trunk/html5.js', 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js', 'jquery.placeholder/jquery.placeholder.js', 'js.class.core.js', 'controller', 'app'));
}
?>
<!-- <?php 
echo ephFrame::compileTime(4);
?>
 -->
</body>
</html>