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


PHP Folder::all方法代码示例

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


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

示例1: getThemes

 /**
  * @return array
  */
 public static function getThemes()
 {
     $gantry = Gantry::instance();
     /** @var UniformResourceLocator $locator */
     $locator = $gantry['locator'];
     $files = Folder::all('gantry-themes://', ['recursive' => false]);
     /** @var array|ThemeDetails[] $list */
     $list = [];
     ksort($files);
     foreach ($files as $theme) {
         if (!is_dir($theme)) {
             continue;
         }
         if ($locator('gantry-themes://' . $theme . '/gantry/theme.yaml')) {
             $details = new ThemeDetails($theme);
             // Stream needs to be valid URL.
             $streamName = 'gantry-themes-' . preg_replace('|[^a-z\\d+.-]|ui', '-', $theme);
             if (!$locator->schemeExists($streamName)) {
                 $locator->addPath($streamName, '', $details->getPaths());
             }
             $details['name'] = $theme;
             $details['title'] = $details['details.name'];
             $details['preview_url'] = $locator('gantry-themes://' . $theme);
             // FIXME:
             $details['admin_url'] = 'FIXME';
             $details['params'] = [];
             $list[$details->name] = $details;
         }
     }
     // Add Thumbnails links after adding all the paths to the locator.
     foreach ($list as $details) {
         $details['thumbnail'] = $details->getUrl("details.images.thumbnail");
     }
     return $list;
 }
开发者ID:rishiv3,项目名称:gantry5,代码行数:38,代码来源:ThemeList.php

示例2: getThemes

 /**
  * @return array
  */
 public static function getThemes()
 {
     $gantry = Gantry::instance();
     /** @var UniformResourceLocator $locator */
     $locator = $gantry['locator'];
     $files = Folder::all('gantry-themes://', ['recursive' => false]);
     /** @var array|ThemeDetails[] $list */
     $list = [];
     ksort($files);
     foreach ($files as $theme) {
         if (file_exists(PRIME_ROOT . '/themes/' . $theme . '/gantry/theme.yaml')) {
             $details = new ThemeDetails($theme);
             if (!$locator->schemeExists('gantry-theme-' . $theme)) {
                 $locator->addPath('gantry-themes-' . $theme, '', $details->getPaths());
             }
             $details['name'] = $theme;
             $details['title'] = $details['details.name'];
             $details['preview_url'] = rtrim(PRIME_URI, '/') . '/' . $theme;
             $details['admin_url'] = rtrim(PRIME_URI, '/') . '/' . $theme . '/admin/configurations/styles';
             $details['params'] = [];
             $list[$details->name] = $details;
         }
     }
     // Add Thumbnails links after adding all the paths to the locator.
     foreach ($list as $details) {
         $details['thumbnail'] = $details->getUrl("details.images.thumbnail");
     }
     return $list;
 }
开发者ID:Acidburn0zzz,项目名称:gantry5,代码行数:32,代码来源:ThemeList.php

示例3: getStyles

 /**
  * @return array
  */
 public static function getStyles()
 {
     $gantry = Gantry::instance();
     /** @var UniformResourceLocator $locator */
     $locator = $gantry['locator'];
     $files = Folder::all('gantry-themes://', ['recursive' => false]);
     $list = array();
     foreach ($files as $theme) {
         if (file_exists($locator('gantry-themes://' . $theme . '/default/gantry/theme.yaml'))) {
             $details = new ThemeDetails($theme);
             if (!$locator->schemeExists('gantry-theme-' . $theme)) {
                 $locator->addPath('gantry-themes-' . $theme, '', $details->getPaths());
             }
             $details['name'] = $theme;
             $details['title'] = ucfirst($theme);
             $details['preview_url'] = '/' . $theme;
             $details['admin_url'] = '/' . $theme . '/admin';
             $details['params'] = [];
             $list[$details->name] = $details;
         }
     }
     // Add Thumbnails links.
     foreach ($list as $details) {
         $details['thumbnail'] = self::getImage($locator, $details, 'thumbnail');
     }
     return $list;
 }
开发者ID:Acidburn0zzz,项目名称:gantry5,代码行数:30,代码来源:ThemeList.php

示例4: index

 public function index()
 {
     throw new \Exception('Deprecated');
     $options = ['compare' => 'Filename', 'pattern' => '|\\.json|', 'filters' => ['key' => '|\\.json|'], 'key' => 'SubPathname', 'value' => 'Pathname'];
     /** @var UniformResourceLocator $locator */
     $locator = $this->container['locator'];
     $files = Folder::all($locator->findResource('gantry-theme://layouts/presets'), $options);
     $response = ['layouts'];
     foreach ($files as $name => $structure) {
         $content = JsonFile::instance($structure)->content();
         $response['layouts'][$name] = $content;
     }
     $response['html'] = $this->container['admin.theme']->render('@gantry-admin/layouts/picker.html.twig', ['presets' => $response]);
     return new JsonResponse($response);
 }
开发者ID:naka211,项目名称:myloyal,代码行数:15,代码来源:Layouts.php

示例5: detectAll

 /**
  * Detects all plugins with a configuration file and returns them with last modification time.
  *
  * @param  string $folder   Location to look up from.
  * @param  string $pattern  Pattern to match the file. Pattern will also be removed from the key.
  * @param  int    $levels   Maximum number of recursive directories.
  * @return array
  * @internal
  */
 protected function detectAll($folder, $pattern, $levels)
 {
     $path = trim(Folder::getRelativePath($folder), '/');
     if (is_dir($folder)) {
         // Find all system and user configuration files.
         $options = ['levels' => $levels, 'compare' => 'Filename', 'pattern' => $pattern, 'filters' => ['pre-key' => $this->base, 'key' => $pattern, 'value' => function (\RecursiveDirectoryIterator $file) use($path) {
             return ["{$path}/{$file->getSubPathname()}" => $file->getMTime()];
         }], 'key' => 'SubPathname'];
         $list = Folder::all($folder, $options);
         ksort($list);
     } else {
         $list = [];
     }
     return $list;
 }
开发者ID:ericssonm,项目名称:JusCuzCustoms,代码行数:24,代码来源:ConfigFileFinder.php


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