当前位置: 首页>>代码示例>>PHP>>正文


PHP FilesystemInterface::addPlugin方法代码示例

本文整理汇总了PHP中League\Flysystem\FilesystemInterface::addPlugin方法的典型用法代码示例。如果您正苦于以下问题:PHP FilesystemInterface::addPlugin方法的具体用法?PHP FilesystemInterface::addPlugin怎么用?PHP FilesystemInterface::addPlugin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在League\Flysystem\FilesystemInterface的用法示例。


在下文中一共展示了FilesystemInterface::addPlugin方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: init

 /**
  * Prepare driver before mount volume.
  * Return true if volume is ready.
  *
  * @return bool
  **/
 protected function init()
 {
     $this->fs = $this->options['filesystem'];
     if (!$this->fs instanceof FilesystemInterface) {
         return $this->setError('A filesystem instance is required');
     }
     // flysystem cache object instance (cached adapter dose not have method like a `getCache()`.
     if (isset($this->options['fscache']) && interface_exists('\\League\\Flysystem\\Cached\\CacheInterface', false)) {
         if ($this->options['fscache'] instanceof \League\Flysystem\Cached\CacheInterface) {
             $this->fscache = $this->options['fscache'];
         }
     }
     $this->fs->addPlugin(new GetUrl());
     $this->fs->addPlugin(new HasDir());
     $this->options['icon'] = $this->options['icon'] ?: $this->getIcon();
     $this->root = $this->options['path'];
     if ($this->options['glideURL']) {
         $this->urlBuilder = UrlBuilderFactory::create($this->options['glideURL'], $this->options['glideKey']);
     }
     if ($this->options['imageManager']) {
         $this->imageManager = $this->options['imageManager'];
     } else {
         $this->imageManager = new ImageManager();
     }
     return true;
 }
开发者ID:hectorgarcia83,项目名称:plataforma_eliana,代码行数:32,代码来源:Driver.php

示例2: init

 /**
  * Prepare driver before mount volume.
  * Return true if volume is ready.
  *
  * @return bool
  **/
 protected function init()
 {
     $this->fs = $this->options['filesystem'];
     if (!$this->fs instanceof FilesystemInterface) {
         return $this->setError('A filesystem instance is required');
     }
     $this->fs->addPlugin(new GetUrl());
     $this->options['icon'] = $this->options['icon'] ?: $this->getIcon();
     $this->root = $this->options['path'];
     if ($this->options['glideURL']) {
         $this->urlBuilder = UrlBuilderFactory::create($this->options['glideURL'], $this->options['glideKey']);
     }
     if ($this->options['imageManager']) {
         $this->imageManager = $this->options['imageManager'];
     } else {
         $this->imageManager = new ImageManager();
     }
     return true;
 }
开发者ID:quepasso,项目名称:dashboard,代码行数:25,代码来源:ElFinderVolumeFlysystem.php

示例3: createFromFilesystem

 /**
  * Creates a Memory adapter from a Flysystem filesystem.
  *
  * @param FilesystemInterface $filesystem The Flysystem filesystem.
  *
  * @return self A new memory adapter.
  */
 public static function createFromFilesystem(FilesystemInterface $filesystem)
 {
     $filesystem->addPlugin(new ListWith());
     $adapter = new static();
     $config = new Config();
     foreach ($filesystem->listWith(['timestamp', 'visibility'], '', true) as $meta) {
         if ($meta['type'] === 'dir') {
             $adapter->createDir($meta['path'], $config);
             continue;
         }
         $adapter->write($meta['path'], (string) $filesystem->read($meta['path']), $config);
         $adapter->setVisibility($meta['path'], $meta['visibility']);
         $adapter->setTimestamp($meta['path'], $meta['timestamp']);
     }
     return $adapter;
 }
开发者ID:twistor,项目名称:flysystem-memory-adapter,代码行数:23,代码来源:MemoryAdapter.php

示例4: init

 /**
  * Prepare driver before mount volume.
  * Return true if volume is ready.
  *
  * @return bool
  **/
 protected function init()
 {
     $this->fs = $this->options['filesystem'];
     if (!$this->fs instanceof FilesystemInterface) {
         return $this->setError('A filesystem instance is required');
     }
     if ($this->fs instanceof Filesystem) {
         $adapter = $this->fs->getAdapter();
         // If the Flysystem adapter already is a cache, try to determine the cache.
         if ($adapter instanceof CachedAdapter) {
             // Try to get the cache (method doesn't exist in all versions)
             if (method_exists($adapter, 'getCache')) {
                 $this->fscache = $adapter->getCache();
             } elseif ($this->options['fscache'] instanceof CacheInterface) {
                 $this->fscache = $this->options['fscache'];
             }
         } elseif ($this->options['cache']) {
             switch ($this->options['cache']) {
                 case 'session':
                     $this->fscache = new SessionStore($this->session, 'fls_cache_' . $this->id);
                     break;
                 case 'memory':
                     $this->fscache = new MemoryStore();
                     break;
             }
             if ($this->fscache) {
                 $adapter = new CachedAdapter($adapter, $this->fscache);
                 $this->fs = new Filesystem($adapter);
             }
         }
     }
     $this->fs->addPlugin(new GetUrl());
     $this->options['icon'] = $this->options['icon'] ?: (empty($this->options['rootCssClass']) ? $this->getIcon() : '');
     $this->root = $this->options['path'];
     if ($this->options['glideURL']) {
         $this->urlBuilder = UrlBuilderFactory::create($this->options['glideURL'], $this->options['glideKey']);
     }
     if ($this->options['imageManager']) {
         $this->imageManager = $this->options['imageManager'];
     } else {
         $this->imageManager = new ImageManager();
     }
     return true;
 }
开发者ID:barryvdh,项目名称:elfinder-flysystem-driver,代码行数:50,代码来源:Driver.php

示例5: register

 public static function register(FilesystemInterface $outerFileSystem, $secondArgument)
 {
     foreach (["addPathToIndex", "removePathFromIndex", "getMetadataFromIndex"] as $method) {
         $outerFileSystem->addPlugin(new static($method, $secondArgument));
     }
 }
开发者ID:petrknap,项目名称:php-filestorage,代码行数:6,代码来源:AbstractIndexPlugin.php

示例6: ListWith

 /**
  * @param FilesystemInterface $filesystem
  */
 function __construct(FilesystemInterface $filesystem)
 {
     $this->filesystem = $filesystem;
     $this->filesystem->addPlugin(new ListWith());
 }
开发者ID:roelvanduijnhoven,项目名称:backup-email-check,代码行数:8,代码来源:Assert.php

示例7: registerPlugins

 /**
  * Registers plugins on the filesystem.
  *
  * @param string              $protocol
  * @param FilesystemInterface $filesystem
  */
 protected static function registerPlugins($protocol, FilesystemInterface $filesystem)
 {
     $filesystem->addPlugin(new ForcedRename());
     $filesystem->addPlugin(new Mkdir());
     $filesystem->addPlugin(new Rmdir());
     $stat = new Stat(static::$config[$protocol]['permissions'], static::$config[$protocol]['metadata']);
     $filesystem->addPlugin($stat);
     $filesystem->addPlugin(new Touch());
 }
开发者ID:twistor,项目名称:flysystem-stream-wrapper,代码行数:15,代码来源:FlysystemStreamWrapper.php

示例8: addPlugin

 /**
  * Register a plugin.
  *
  * @param PluginInterface $plugin The plugin to register.
  *
  * @return $this
  */
 public function addPlugin(PluginInterface $plugin)
 {
     return $this->fileSystem->addPlugin($plugin);
 }
开发者ID:graze,项目名称:data-file,代码行数:11,代码来源:FilesystemWrapper.php


注:本文中的League\Flysystem\FilesystemInterface::addPlugin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。