コード例 #1
0
ファイル: Standard.php プロジェクト: nextframework/next
 /**
  * Find the Template View File from FileSpec
  *
  * @return string
  *   Template View FilePath from defined FileSpec
  *
  * @see
  *   Next\Controller\Router\Router::getController()
  *   Next\Controller\Router\Router::getAction()
  */
 private function findFileBySpec()
 {
     // Known Replacements
     $application = $this->_application->getApplicationDirectory();
     $controller = $this->_application->getRouter()->getController();
     $action = $this->_application->getRouter()->getAction();
     /**
      * @internal
      * Finding Default SubPath
      *
      * Default SubPath is built by removing:
      *
      * - Application Directory,
      * - 'Controller' Keyword
      * - Controller ClassName
      *
      * from Controllers Name
      */
     $subpath = str_replace(array($application, self::CONTROLLERS_KEYWORD, basename($controller)), '', $controller);
     // Windows, Windows, Windows... <_<
     $subpath = str_replace('\\\\', '\\', $subpath);
     $subpath = trim($subpath, '\\');
     // Cleaning Controller Class to find its "Real Name"
     $controller = str_replace('Controller', '', basename($controller));
     // Cleaning known Action suffixes
     $action = str_replace(array(self::ACTION_METHOD_SUFFIX_VIEW, self::ACTION_METHOD_SUFFIX_ACTION), '', $action);
     // Replacing known matches
     $spec = trim(str_replace(array(self::APPLICATION, self::CONTROLLER, self::ACTION, self::SUBPATH), array($application, $controller, $action, $subpath), $this->_fileSpec), '/');
     $spec = Tools::cleanAndInvertPath($spec);
     return sprintf('%s.%s', strtolower($spec), $this->_extension);
 }
コード例 #2
0
ファイル: Request.php プロジェクト: nextframework/next
 /**
  * Set BasePath
  *
  * @param string $basepath
  *   Request Base Path
  *
  * @return Next\HTTP\Request
  *   Request Object (Fluent Interface)
  */
 public function setBasepath($basepath)
 {
     $this->basepath = Tools::cleanAndInvertPath($basepath);
     return $this;
 }
コード例 #3
0
ファイル: File.php プロジェクト: nextframework/next
 /**
  * Clean Cached Data
  *
  * @param string|optional $mode
  *   Cleaning Mode
  *
  * @return boolean
  *   TRUE on success and FALSE otherwise
  *
  * @throws Next\Cache\Backend\BackendException
  *   Trying to clean old or user caches, which is not supported
  *   by File Backend
  */
 public function clean($mode = self::CLEAN_USER)
 {
     clearstatcache();
     switch ($mode) {
         case parent::CLEAN_OLD:
             throw BackendException::cleanOldCache();
             break;
         case parent::CLEAN_USER:
             throw BackendException::cleanUserCache();
             break;
         case parent::CLEAN_ALL:
         default:
             return Tools::delete($this->options->outputDirectory);
             break;
     }
 }