コード例 #1
0
ファイル: View.php プロジェクト: robtuley/knotwerk
 /**
  * Create view.
  *
  * @param string $dir  directory
  * @param string $file  filename
  * @param string $ext  file extension
  */
 function __construct($dir, $file, $ext)
 {
     parent::__construct($dir, $file, $ext);
     if (!$this->exists()) {
         throw new T_Exception_File(parent::__toString(), 'does not exist');
     }
 }
コード例 #2
0
ファイル: PathUrl.php プロジェクト: robtuley/knotwerk
 /**
  * Specify path.
  *
  * @param string $web_root dir for web root
  * @param string $rel_dir  rel dir from web root
  * @param string $file  filename
  * @param string $ext  extension
  */
 function __construct($web_root, $rel_dir, $file, $ext)
 {
     // split relative path into path sub-sections
     $rel_dir = trim(trim($rel_dir, '/'), DIRECTORY_SEPARATOR);
     if (strcmp('/', DIRECTORY_SEPARATOR) !== 0) {
         $this->url_path = preg_split('#[' . preg_quote('/' . DIRECTORY_SEPARATOR) . ']#', $rel_dir);
     } else {
         $this->url_path = explode('/', $rel_dir);
     }
     // concatenate dirs and exe parent
     $dir = rtrim(rtrim($web_root, '/'), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $rel_dir;
     parent::__construct($dir, $file, $ext);
 }