當前位置: 首頁>>代碼示例>>PHP>>正文


PHP FilesystemInterface::getVisibility方法代碼示例

本文整理匯總了PHP中League\Flysystem\FilesystemInterface::getVisibility方法的典型用法代碼示例。如果您正苦於以下問題:PHP FilesystemInterface::getVisibility方法的具體用法?PHP FilesystemInterface::getVisibility怎麽用?PHP FilesystemInterface::getVisibility使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在League\Flysystem\FilesystemInterface的用法示例。


在下文中一共展示了FilesystemInterface::getVisibility方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getVisibility

 /**
  * Get the visibility for the given path.
  *
  * @param  string  $path
  * @return string
  */
 public function getVisibility($path)
 {
     if ($this->driver->getVisibility($path) == AdapterInterface::VISIBILITY_PUBLIC) {
         return FilesystemContract::VISIBILITY_PUBLIC;
     }
     return FilesystemContract::VISIBILITY_PRIVATE;
 }
開發者ID:Ceciceciceci,項目名稱:MySJSU-Class-Registration,代碼行數:13,代碼來源:FilesystemAdapter.php

示例2: handle

 public function handle($path)
 {
     $files = [];
     $folders = [];
     $list = $this->filesystem->listContents($path);
     $ignored = ['.', '..', '.DS_Store', '.gitignore', '.htaccess'];
     foreach ($list as $entry) {
         if (in_array($entry['basename'], $ignored)) {
             continue;
         }
         if (!$this->filesystem->authorized($entry['path'])) {
             continue;
         }
         if ($entry['type'] === 'file') {
             try {
                 $url = $this->filesystem->url($entry['path']);
             } catch (\Exception $e) {
                 $url = $entry['path'];
             }
             // Ugh, for some reason the foldername for the theme is included twice. Why?
             // For now we 'fix' this with an ugly hack, replacing it. :-/
             // TODO: dig into Filesystem and figure out why this happens.
             $pathsegments = explode('/', $entry['path']);
             if (!empty($pathsegments[0])) {
                 $url = str_replace('/' . $pathsegments[0] . '/' . $pathsegments[0] . '/', '/' . $pathsegments[0] . '/', $url);
             }
             $files[$entry['path']] = ['path' => $entry['dirname'], 'filename' => $entry['basename'], 'newpath' => $entry['path'], 'relativepath' => $entry['path'], 'writable' => true, 'readable' => false, 'type' => isset($entry['extension']) ? $entry['extension'] : '', 'filesize' => Lib::formatFilesize($entry['size']), 'modified' => date("Y/m/d H:i:s", $entry['timestamp']), 'permissions' => 'public', 'url' => $url];
             /* **** Extra checks for files that can be resolved via PHP urlopen functions **** */
             try {
                 $files[$entry['path']]['permissions'] = $this->filesystem->getVisibility($entry['path']);
             } catch (\Exception $e) {
                 // Computer says "No!"
             }
             $fullfilename = $this->filesystem->getAdapter()->applyPathPrefix($entry['path']);
             if (is_readable($fullfilename)) {
                 $files[$entry['path']]['readable'] = true;
                 if (!empty($entry['extension']) && in_array($entry['extension'], ['gif', 'jpg', 'png', 'jpeg'])) {
                     $size = getimagesize($fullfilename);
                     $files[$entry['path']]['imagesize'] = sprintf("%s × %s", $size[0], $size[1]);
                 }
                 $files[$entry['path']]['permissions'] = util::full_permissions($fullfilename);
             }
         }
         if ($entry['type'] == 'dir') {
             $folders[$entry['path']] = ['path' => $entry['dirname'], 'foldername' => $entry['basename'], 'newpath' => $entry['path'], 'modified' => date("Y/m/d H:i:s", $entry['timestamp']), 'writable' => true];
             $fullfilename = $this->filesystem->getAdapter()->applyPathPrefix($entry['path']);
             /* **** Extra checks for files that can be resolved via PHP urlopen functions **** */
             if (is_readable($fullfilename)) {
                 if (!is_writable($fullfilename)) {
                     $folders[$entry['path']]['writable'] = false;
                 }
             }
         }
     }
     ksort($files);
     ksort($folders);
     return [$files, $folders];
 }
開發者ID:Twiebie,項目名稱:bolt,代碼行數:58,代碼來源:Browse.php

示例3: getVisibility

 /**
  * @override
  * @inheritDoc
  */
 public function getVisibility($path = '')
 {
     try {
         return $this->fs->getVisibility($path);
     } catch (Error $ex) {
     } catch (Exception $ex) {
     }
     throw new ReadException("File {$path} visibility could not be determined.", $ex);
 }
開發者ID:kraken-php,項目名稱:framework,代碼行數:13,代碼來源:Filesystem.php

示例4: getVisibility

 /**
  * Get a file's visibility.
  *
  * @param string $path The path to the file.
  *
  * @throws FileNotFoundException
  *
  * @return string|false The visibility (public|private) or false on failure.
  */
 public function getVisibility($path)
 {
     return $this->fileSystem->getVisibility($path);
 }
開發者ID:graze,項目名稱:data-file,代碼行數:13,代碼來源:FilesystemWrapper.php


注:本文中的League\Flysystem\FilesystemInterface::getVisibility方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。