is_file() public method

Tells whether the filename is a regular file
public is_file ( string $path ) : boolean
$path string
return boolean
示例#1
0
 /**
  * @param string $identifier
  * @return array
  * @SuppressWarnings(PHPMD.Superglobals)
  */
 public function getDetails($identifier)
 {
     $details = [];
     $details['size'] = $this->sftp->size($identifier);
     $details['atime'] = $this->sftp->fileatime($identifier);
     $details['mtime'] = $this->sftp->filemtime($identifier);
     // ctime is not returned by phpseclinb so we just use mtime
     // because it will mostly be the same.
     // @see http://www.linux-faqs.info/general/difference-between-mtime-ctime-and-atime
     $details['ctime'] = $details['mtime'];
     $mimeType = false;
     if ($this->sftp->is_file($identifier)) {
         $fileExtMapping = $GLOBALS['TYPO3_CONF_VARS']['SYS']['FileInfo']['fileExtensionToMimeType'];
         $lcFileExtension = strtolower(substr($identifier, strrpos($identifier, '.') + 1));
         if (!empty($fileExtMapping[$lcFileExtension])) {
             $mimeType = $fileExtMapping[$lcFileExtension];
         }
     }
     if (false === $mimeType && isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][FileInfo::class]['mimeTypeGuessers']) && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][FileInfo::class]['mimeTypeGuesser'])) {
         $mimeTypeGuessers = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][FileInfo::class]['mimeTypeGuesser'];
         foreach ($mimeTypeGuessers as $mimeTypeGuesser) {
             $hookParameters = ['mimeType' => &$mimeType];
             GeneralUtility::callUserFunction($mimeTypeGuesser, $hookParameters, $this);
         }
     }
     $details['mimetype'] = $mimeType;
     return $details;
 }
 /**
  * {@inheritdoc}
  */
 public function isFile($remoteFilename)
 {
     if ($this->isConnected()) {
         return $this->connection->is_file($remoteFilename);
     }
     return false;
 }
示例#3
0
 /**
  * @param null|string $Name
  *
  * @return SFTP\Directory[]|SFTP\File[]
  */
 public function listDirectory($Name = null)
 {
     $this->persistConnection();
     if (null === $Name) {
         $Name = $this->Connection->pwd();
     }
     $List = $this->Connection->rawlist($Name);
     $Return = array();
     foreach ($List as $Item => $Attributes) {
         if ($this->Connection->is_dir($Item)) {
             $Return[$Item] = new Directory($this, $Attributes);
         }
         if ($this->Connection->is_file($Item)) {
             $Return[$Item] = new File($this, $Attributes);
         }
     }
     return $Return;
 }