private static function _getFileInfo($base, $action, $format = 'html') { // go see what templates are available $dirPrefixPatterns = [APP_DIR, CORE_DIR]; $fileNamePatterns = [$action . '.' . $format, $action]; $fileTypes = ['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 = Ajde_Fs_Find::findFile($prefixedBase . TEMPLATE_DIR . $layoutDir, $filePattern)) { return ['filename' => $fileMatch, 'parser' => $parserType]; } } if ($fileMatch = Ajde_Fs_Find::findFile($prefixedBase . TEMPLATE_DIR, $filePattern)) { return ['filename' => $fileMatch, 'parser' => $parserType]; } } } } return false; }
public function getCacheStatus() { $hash = $this->getHash(); $fileTimePattern = $hash['fileName'] . '.' . $hash['fileTime'] . '.' . $this->getType(); if ($fileName = Ajde_Fs_Find::findFile($this->getBase(), $fileTimePattern)) { return ['status' => self::CACHE_STATUS_EXIST, 'fileName' => $fileName]; } $fileNamePattern = $hash['fileName'] . '.*.' . $this->getType(); if ($fileName = Ajde_Fs_Find::findFile($this->getBase(), $fileNamePattern)) { return ['status' => self::CACHE_STATUS_UPDATE, 'fileName' => $fileName]; } return ['status' => self::CACHE_STATUS_NOT_EXIST, 'fileName' => '']; }