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


PHP Folder::create方法代码示例

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


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

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

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

示例3: init

 /**
  * Initialize theme.
  */
 public function init()
 {
     $gantry = static::gantry();
     $gantry['streams']->register();
     $gantry->register(new ErrorServiceProvider());
     /** @var Platform $patform */
     $patform = $gantry['platform'];
     // Initialize theme cache stream.
     $cachePath = $patform->getCachePath() . '/' . $this->name;
     Folder::create($cachePath);
     /** @var UniformResourceLocator $locator */
     $locator = $gantry['locator'];
     $locator->addPath('gantry-cache', 'theme', [$cachePath], true, true);
     $gantry['file.yaml.cache.path'] = $locator->findResource('gantry-cache://theme/compiled/yaml', true, true);
 }
开发者ID:pensesmart,项目名称:gantry5,代码行数:18,代码来源:ThemeTrait.php

示例4: init

 /**
  * Initialize theme.
  */
 public function init()
 {
     $gantry = static::gantry();
     $gantry['streams']->register();
     // Only add error service if development or debug mode has been enabled or user is admin.
     if (!$gantry['global']->get('production', 0) || $gantry->debug() || $gantry->admin()) {
         $gantry->register(new ErrorServiceProvider());
     }
     /** @var Platform $patform */
     $patform = $gantry['platform'];
     // Initialize theme cache stream.
     $cachePath = $patform->getCachePath() . '/' . $this->name;
     Folder::create($cachePath);
     /** @var UniformResourceLocator $locator */
     $locator = $gantry['locator'];
     $locator->addPath('gantry-cache', 'theme', [$cachePath], true, true);
     $gantry['file.yaml.cache.path'] = $locator->findResource('gantry-cache://theme/compiled/yaml', true, true);
 }
开发者ID:austbot,项目名称:gantry5-composer,代码行数:21,代码来源:ThemeTrait.php

示例5: upload

 public function upload()
 {
     /** @var UniformResourceLocator $locator */
     $locator = $this->container['locator'];
     $path = implode('/', func_get_args());
     if (base64_decode($path, true) !== false) {
         $path = base64_decode($path);
     }
     $stream = explode('://', $path);
     $scheme = $stream[0];
     $isStream = $locator->schemeExists($scheme);
     if ($isStream) {
         $targetPath = dirname($locator->findResource($path, true, true));
     } else {
         $targetPath = dirname(GANTRY5_ROOT . '/' . $path);
     }
     if (!isset($_FILES['file']['error']) || is_array($_FILES['file']['error'])) {
         throw new \RuntimeException('No file sent', 400);
     }
     // Check $_FILES['file']['error'] value.
     switch ($_FILES['file']['error']) {
         case UPLOAD_ERR_OK:
             break;
         case UPLOAD_ERR_NO_FILE:
             throw new \RuntimeException('No file sent', 400);
         case UPLOAD_ERR_INI_SIZE:
         case UPLOAD_ERR_FORM_SIZE:
             throw new \RuntimeException('Exceeded filesize limit.', 400);
         default:
             throw new \RuntimeException('Unkown errors', 400);
     }
     $maxSize = $this->returnBytes(min(ini_get('post_max_size'), ini_get('upload_max_filesize')));
     if ($_FILES['file']['size'] > $maxSize) {
         throw new \RuntimeException('Exceeded filesize limit. File is ' . $_FILES['file']['size'] . ', maximum allowed is ' . $maxSize, 400);
     }
     // Check extension
     $fileParts = pathinfo($_FILES['file']['name']);
     $fileExt = strtolower($fileParts['extension']);
     // TODO: check if download is of supported type.
     // Upload it
     $destination = sprintf('%s/%s', $targetPath, $_FILES['file']['name']);
     $destination = preg_replace('#//#', '/', $destination);
     Folder::create($targetPath);
     if (!move_uploaded_file($_FILES['file']['tmp_name'], $destination)) {
         throw new \RuntimeException('Failed to move uploaded file.', 500);
     }
     $finfo = new \stdClass();
     $this->attachData($finfo, new \SplFileInfo($destination));
     return new JsonResponse(['success' => 'File uploaded successfully', 'finfo' => $finfo, 'url' => $path]);
 }
开发者ID:naka211,项目名称:myloyal,代码行数:50,代码来源:Filepicker.php

示例6: cleanup

 public function cleanup()
 {
     $name = $this->extension->name;
     $path = JPATH_SITE . '/templates/' . $name;
     // Remove compiled CSS files if they exist.
     $cssPath = $path . '/custom/css-compiled';
     if (is_dir($cssPath)) {
         \JFolder::delete($cssPath);
     } elseif (is_file($cssPath)) {
         \JFile::delete($cssPath);
     }
     // Remove wrongly named file if it exists.
     $md5path = $path . '/MD5SUM';
     if (is_file($md5path)) {
         \JFile::delete($md5path);
     }
     // Restart Gantry and initialize it.
     $gantry = Gantry::restart();
     $gantry['theme.name'] = $name;
     $gantry['streams']->register();
     // Only add error service if debug mode has been enabled.
     if ($gantry->debug()) {
         $gantry->register(new ErrorServiceProvider());
     }
     /** @var Platform $patform */
     $patform = $gantry['platform'];
     /** @var UniformResourceLocator $locator */
     $locator = $gantry['locator'];
     // Initialize theme stream.
     $details = new ThemeDetails($name);
     $locator->addPath('gantry-theme', '', $details->getPaths(), false, true);
     // Initialize theme cache stream and clear theme cache.
     $cachePath = $patform->getCachePath() . '/' . $name;
     if (is_dir($cachePath)) {
         Folder::delete($cachePath);
     }
     Folder::create($cachePath);
     $locator->addPath('gantry-cache', 'theme', [$cachePath], true, true);
     $gantry['file.yaml.cache.path'] = $locator->findResource('gantry-cache://theme/compiled/yaml', true, true);
     /** @var Outlines $outlines */
     $outlines = $gantry['configurations'];
     // Update positions in manifest file.
     $positions = $outlines->positions();
     $manifest = new Manifest($name);
     $manifest->setPositions(array_keys($positions));
     $manifest->save();
 }
开发者ID:legutierr,项目名称:gantry5,代码行数:47,代码来源:TemplateInstaller.php


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