isFile() 공개 정적인 메소드

Check is current path regular file
public static isFile ( string $path ) : boolean
$path string
리턴 boolean
예제 #1
0
파일: Cache.php 프로젝트: jbzoo/less
 /**
  * Check is current cache is expired
  */
 public function isExpired()
 {
     if (!FS::isFile($this->_resultFile)) {
         return true;
     }
     $fileAge = abs(time() - filemtime($this->_resultFile));
     if ($fileAge >= $this->_cache_ttl) {
         return true;
     }
     $firstLine = trim(FS::firstLine($this->_resultFile));
     $expected = trim($this->_getHeader());
     if ($expected === $firstLine) {
         return false;
     }
     return true;
 }
예제 #2
0
파일: Text.php 프로젝트: JBZoo/Image
 /**
  * Determine textbox size
  *
  * @param string $fontSize
  * @param int    $angle
  * @param string $fontFile
  * @param string $text
  * @return array
  *
  * @throws Exception
  */
 protected static function _getTextboxSize($fontSize, $angle, $fontFile, $text)
 {
     // Determine textbox size
     $fontPath = FS::clean($fontFile);
     if (!FS::isFile($fontPath)) {
         throw new Exception('Unable to load font: ' . $fontFile);
     }
     $box = imagettfbbox($fontSize, $angle, $fontFile, $text);
     $boxWidth = abs($box[6] - $box[2]);
     $boxHeight = abs($box[7] - $box[1]);
     return array($boxWidth, $boxHeight);
 }
예제 #3
0
파일: UrlHelper.php 프로젝트: UnionCMS/Core
 /**
  * Adds a timestamp to a file based resource based on the value of `Asset.timestamp` in  Configure.
  *
  * @param string $path
  * @return null|string
  */
 public function assetTimestamp($path)
 {
     if ($this->_timeStampEnable() && strpos($path, '?') === false) {
         $Path = $this->_View->getPath();
         if ($Path->isVirtual($path)) {
             $path = $Path->get($path);
         }
         if (FS::isFile($path)) {
             //@codingStandardsIgnoreStart
             return $path . '?' . @filemtime($path);
             //@codingStandardsIgnoreEnd
         }
     }
     return $path;
 }
예제 #4
0
파일: Image.php 프로젝트: JBZoo/Image
 /**
  * Load an image
  *
  * @param string $filename Path to image file
  * @return $this
  *
  * @throws Exception
  */
 public function loadFile($filename)
 {
     $cleanFilename = FS::clean($filename);
     if (!FS::isFile($cleanFilename)) {
         throw new Exception('Image file not forund: ' . $filename);
     }
     $this->cleanup();
     $this->_filename = $cleanFilename;
     $this->_loadMeta();
     return $this;
 }
예제 #5
0
 /**
  * Preg replace callback url.
  *
  * @param $match
  * @return null|string
  */
 protected function _replaceUrlCallback($match)
 {
     $path = FS::clean($match[2], '/');
     if (isset($path[2]) && $path[2] == ':') {
         $path = ltrim($match[2], '/');
     }
     $url = null;
     if (FS::isFile($path)) {
         $url = $this->_path->url($path);
     }
     return $this->_getAssetUrl($url);
 }
예제 #6
0
 public function testIsFile()
 {
     isFalse(FS::isFile(__DIR__));
     isTrue(FS::isFile(__FILE__));
 }