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


PHP Filesystem\Folder类代码示例

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


在下文中一共展示了Folder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: index

 public function index()
 {
     /** @var UniformResourceLocator $locator */
     $locator = $this->container['locator'];
     Folder::delete($locator('gantry-cache://'), false);
     return new JsonResponse(['html' => 'Cache was successfully cleared', 'title' => 'Cache Cleared']);
 }
开发者ID:Ettore495,项目名称:Ettore-Work,代码行数:7,代码来源:Cache.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: init

 /**
  * @see AbstractTheme::init()
  */
 protected function init()
 {
     $gantry = static::gantry();
     // Add particles, styles and defaults into DI.
     $gantry['particles'] = function ($c) {
         return new Particles($c);
     };
     $gantry['styles'] = function ($c) {
         return new Styles($c);
     };
     $gantry['defaults'] = function ($c) {
         /** @var UniformResourceLocator $locator */
         $locator = $c['locator'];
         $cache = $locator->findResource('gantry-cache://theme/compiled/config', true, true);
         $paths = $locator->findResources('gantry-config://default');
         $files = (new ConfigFileFinder())->locateFiles($paths);
         $config = new CompiledConfig($cache, $files, function () use($c) {
             return $c['blueprints'];
         });
         return $config->load(true);
     };
     // Initialize admin streams.
     /** @var Platform $patform */
     $patform = $gantry['platform'];
     /** @var UniformResourceLocator $locator */
     $locator = $gantry['locator'];
     $nucleus = $patform->getEnginePaths('nucleus')[''];
     $relpath = Folder::getRelativePath($this->path);
     $patform->set('streams.gantry-admin.prefixes', ['' => ['gantry-theme://admin', $relpath, $relpath . '/common', 'gantry-engine://admin'], 'assets/' => array_merge([$relpath, $relpath . '/common'], $nucleus, ['gantry-assets://'])]);
     // Add admin paths.
     foreach ($patform->get('streams.gantry-admin.prefixes') as $prefix => $paths) {
         $locator->addPath('gantry-admin', $prefix, $paths);
     }
 }
开发者ID:rastabrane,项目名称:gantry5,代码行数:37,代码来源:Theme.php

示例5: __construct

 public function __construct($path, $name = '')
 {
     $gantry = \Gantry\Framework\Gantry::instance();
     $relpath = Folder::getRelativePath($path);
     // Initialize admin streams.
     /** @var Platform $patform */
     $patform = $gantry['platform'];
     $nucleus = $patform->getEnginePaths('nucleus')[''];
     $patform->set('streams.gantry-admin.prefixes', ['' => ['gantry-theme://admin', $relpath, $relpath . '/common', 'gantry-engine://admin'], 'assets/' => array_merge([$relpath, $relpath . '/common'], $nucleus, ['gantry-assets://'])]);
     $gantry['particles'] = function ($c) {
         return new Particles($c);
     };
     $gantry['styles'] = function ($c) {
         return new Styles($c);
     };
     $gantry['defaults'] = function ($c) {
         /** @var UniformResourceLocator $locator */
         $locator = $c['locator'];
         $cache = $locator->findResource('gantry-cache://theme/compiled/config', true, true);
         $paths = $locator->findResources('gantry-config://default');
         $files = (new ConfigFileFinder())->locateFiles($paths);
         $config = new CompiledConfig($cache, $files, function () use($c) {
             return $c['blueprints'];
         });
         return $config->load(true);
     };
     parent::__construct($path, $name);
     $this->boot();
 }
开发者ID:naka211,项目名称:myloyal,代码行数:29,代码来源:Theme.php

示例6: updateCss

 /**
  * Update all CSS files in the theme.
  *
  * @param array $configurations
  * @return array List of CSS warnings.
  */
 public function updateCss(array $configurations = null)
 {
     $gantry = static::gantry();
     $compiler = $this->compiler();
     if (is_null($configurations)) {
         /** @var UniformResourceLocator $locator */
         $locator = $gantry['locator'];
         $path = $locator->findResource($compiler->getTarget(), true, true);
         // Make sure that all the CSS files get deleted.
         if (is_dir($path)) {
             Folder::delete($path, false);
         }
         $configurations = $gantry['configurations'];
     }
     // Make sure that PHP has the latest data of the files.
     clearstatcache();
     $warnings = [];
     foreach ($configurations as $configuration => $title) {
         $config = ConfigServiceProvider::load($gantry, $configuration);
         $compiler->reset()->setConfiguration($configuration)->setVariables($config->flatten('styles', '-'));
         $results = $compiler->compileAll()->getWarnings();
         if ($results) {
             $warnings[$configuration] = $results;
         }
     }
     return $warnings;
 }
开发者ID:sam-suresh,项目名称:gantry5,代码行数:33,代码来源:ThemeTrait.php

示例7: 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

示例8: __construct

 public function __construct(Container $container)
 {
     $this->container = $container;
     //Make sure that cache folder exists, otherwise it will be removed from the lookup.
     $cachePath = $this->getCachePath();
     Folder::create($cachePath);
     $this->items = ['streams' => ['gantry-cache' => ['type' => 'Stream', 'force' => true, 'prefixes' => ['' => [$cachePath]]], 'gantry-themes' => ['type' => 'ReadOnlyStream', 'prefixes' => $this->getThemesPaths()], 'gantry-theme' => ['type' => 'ReadOnlyStream', 'prefixes' => $this->getThemePaths()], 'gantry-assets' => ['type' => 'ReadOnlyStream', 'prefixes' => $this->getAssetsPaths()], 'gantry-media' => ['type' => 'ReadOnlyStream', 'prefixes' => $this->getMediaPaths()], 'gantry-engines' => ['type' => 'ReadOnlyStream', 'prefixes' => $this->getEnginesPaths()], 'gantry-engine' => ['type' => 'ReadOnlyStream', 'prefixes' => $this->getEnginePaths()], 'gantry-layouts' => ['type' => 'ReadOnlyStream', 'prefixes' => ['' => ['gantry-theme://layouts', 'gantry-engine://layouts']]], 'gantry-particles' => ['type' => 'ReadOnlyStream', 'prefixes' => ['' => ['gantry-theme://particles', 'gantry-engine://particles']]], 'gantry-admin' => ['type' => 'ReadOnlyStream', 'prefixes' => []], 'gantry-blueprints' => ['type' => 'ReadOnlyStream', 'prefixes' => ['' => ['gantry-theme://blueprints', 'gantry-engine://blueprints'], 'particles' => ['gantry-particles://']]], 'gantry-config' => ['type' => 'ReadOnlyStream', 'prefixes' => ['' => ['gantry-theme://config']]]]];
 }
开发者ID:ericssonm,项目名称:JusCuzCustoms,代码行数:8,代码来源:Platform.php

示例9: boot

 protected function boot()
 {
     $gantry = \Gantry\Framework\Gantry::instance();
     $relpath = Folder::getRelativePath($this->path);
     /** @var Streams $streams */
     $streams = $gantry['streams'];
     $streams->add(['gantry-admin' => ['prefixes' => ['' => ['gantry-theme://admin', $relpath, $relpath . '/common'], 'assets/' => ['gantry-theme://admin', $relpath, $relpath . '/common']]]]);
     $streams->register();
 }
开发者ID:Acidburn0zzz,项目名称:gantry5,代码行数:9,代码来源:Theme.php

示例10: __construct

 public function __construct(Container $container)
 {
     parent::__construct($container);
     Folder::create(GANTRY5_ROOT . '/custom');
     // Initialize custom streams for Prime.
     $this->items['streams'] += ['gantry-prime' => ['type' => 'ReadOnlyStream', 'prefixes' => ['' => ['']]], 'gantry-custom' => ['type' => 'ReadOnlyStream', 'prefixes' => ['' => []]], 'gantry-pages' => ['type' => 'ReadOnlyStream', 'prefixes' => ['' => ['gantry-theme://overrides/pages', 'pages']]], 'gantry-positions' => ['type' => 'ReadOnlyStream', 'prefixes' => ['' => ['gantry-theme://overrides/positions', 'positions']]]];
     $this->items['streams']['gantry-layouts']['prefixes'][''][] = 'gantry-prime://layouts';
     $this->items['streams']['gantry-config']['prefixes'][''][] = 'gantry-prime://config';
 }
开发者ID:nmsde,项目名称:gantry5,代码行数:9,代码来源:Platform.php

示例11: delete

 public static function delete($id)
 {
     $gantry = Gantry::instance();
     /** @var UniformResourceLocator $locator */
     $locator = $gantry['locator'];
     $path = $locator->findResource('gantry-config://' . $id, true, true);
     if (is_dir($path)) {
         Folder::delete($path, true);
     }
 }
开发者ID:nmsde,项目名称:gantry5,代码行数:10,代码来源:StyleHelper.php

示例12: index

 public function index()
 {
     /** @var UniformResourceLocator $locator */
     $locator = $this->container['locator'];
     Folder::delete($locator('gantry-cache://theme'), false);
     Folder::delete($locator('gantry-cache://admin'), false);
     // Make sure that PHP has the latest data of the files.
     clearstatcache();
     return new JsonResponse(['html' => 'Cache was successfully cleared', 'title' => 'Cache Cleared']);
 }
开发者ID:ericssonm,项目名称:JusCuzCustoms,代码行数:10,代码来源:Cache.php

示例13: __construct

 public function __construct($path, $name = '')
 {
     $gantry = \Gantry\Framework\Gantry::instance();
     $relpath = Folder::getRelativePath($path);
     // Initialize admin streams.
     $gantry['platform']->set('streams.gantry-admin.prefixes', ['' => [$relpath, $relpath . '/common'], 'assets/' => [$relpath, $relpath . '/common']]);
     parent::__construct($path, $name);
     // FIXME:
     $this->url = '/templates/' . $this->name;
     $this->boot();
 }
开发者ID:nmsde,项目名称:gantry5,代码行数:11,代码来源:Theme.php

示例14: copy

 public static function copy($style, $old, $new)
 {
     $gantry = Gantry::instance();
     /** @var UniformResourceLocator $locator */
     $locator = $gantry['locator'];
     $oldPath = $locator->findResource('gantry-config://' . $old, true, true);
     $newPath = $locator->findResource('gantry-config://' . $new, true, true);
     if (file_exists($oldPath)) {
         Folder::copy($oldPath, $newPath);
     }
     $installer = new TemplateInstaller($style->extension_id);
     $installer->updateStyle($new, ['configuration' => $new]);
 }
开发者ID:Ettore495,项目名称:Ettore-Work,代码行数:13,代码来源:StyleHelper.php

示例15: 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


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