private static function _getFileInfo($base, $action, $format = 'html') { // go see what templates are available $dirPrefixPatterns = array(APP_DIR, CORE_DIR); $fileNamePatterns = array($action . '.' . $format, $action); $fileTypes = array('phtml' => 'Phtml', 'xhtml' => 'Xhtml'); foreach ($dirPrefixPatterns as $dirPrefixPattern) { $prefixedBase = $dirPrefixPattern . $base; foreach ($fileNamePatterns as $fileNamePattern) { foreach ($fileTypes as $fileType => $parserType) { $filePattern = $fileNamePattern . '.' . $fileType; if (!substr_count($prefixedBase, DIRECTORY_SEPARATOR . 'layout' . DIRECTORY_SEPARATOR)) { $layoutDir = 'layout.' . Ajde::app()->getDocument()->getLayout()->getName() . DIRECTORY_SEPARATOR; if ($fileMatch = Find::findFile($prefixedBase . TEMPLATE_DIR . $layoutDir, $filePattern)) { return array('filename' => $fileMatch, 'parser' => $parserType); } } if ($fileMatch = Find::findFile($prefixedBase . TEMPLATE_DIR, $filePattern)) { return array('filename' => $fileMatch, 'parser' => $parserType); } } } } return false; }
public function getCacheStatus() { $hash = $this->getHash(); $fileTimePattern = $hash['fileName'] . '.' . $hash['fileTime'] . '.' . $this->getType(); if ($fileName = Find::findFile($this->getBase(), $fileTimePattern)) { return array('status' => self::CACHE_STATUS_EXIST, 'fileName' => $fileName); } $fileNamePattern = $hash['fileName'] . '.*.' . $this->getType(); if ($fileName = Find::findFile($this->getBase(), $fileNamePattern)) { return array('status' => self::CACHE_STATUS_UPDATE, 'fileName' => $fileName); } return array('status' => self::CACHE_STATUS_NOT_EXIST, 'fileName' => ''); }