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


PHP Folder::all方法代码示例

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


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

示例1: findBlueprints

 private function findBlueprints($paths)
 {
     $options = ['compare' => 'Filename', 'pattern' => '|\\.yaml$|', 'filters' => ['key' => '|\\.yaml$|'], 'key' => 'SubPathName', 'value' => 'PathName'];
     foreach ((array) $paths as $path) {
         return Folder::all($path, $options);
     }
 }
开发者ID:clee03,项目名称:metal,代码行数:7,代码来源:Types.php

示例2: scanTemplates

 public function scanTemplates($path)
 {
     $options = ['compare' => 'Filename', 'pattern' => '|\\.html\\.twig$|', 'filters' => ['value' => '|\\.html\\.twig$|'], 'value' => 'Filename', 'recursive' => false];
     foreach (Folder::all($path, $options) as $type) {
         $this->register($type);
     }
     if (file_exists($path . 'modular/')) {
         foreach (Folder::all($path . 'modular/', $options) as $type) {
             $this->register('modular/' . $type);
         }
     }
 }
开发者ID:qbi,项目名称:datenknoten.me,代码行数:12,代码来源:Types.php

示例3: detectConfig

 /**
  * Detects all plugins with a configuration file and returns last modification time.
  *
  * @param  string $lookup Location to look up from.
  * @param  bool $blueprints
  * @return array
  * @internal
  */
 protected function detectConfig($lookup = SYSTEM_DIR, $blueprints = false)
 {
     $location = $blueprints ? 'blueprintFiles' : 'configFiles';
     $path = trim(Folder::getRelativePath($lookup), '/');
     if (isset($this->{$location}[$path])) {
         return [$path => $this->{$location}[$path]];
     }
     if (is_dir($lookup)) {
         // Find all system and user configuration files.
         $options = ['compare' => 'Filename', 'pattern' => '|\\.yaml$|', 'filters' => ['key' => '|\\.yaml$|', 'value' => function (\RecursiveDirectoryIterator $file) use($path) {
             return ['file' => "{$path}/{$file->getSubPathname()}", 'modified' => $file->getMTime()];
         }], 'key' => 'SubPathname'];
         $list = Folder::all($lookup, $options);
     } else {
         $list = [];
     }
     $this->{$location}[$path] = $list;
     return [$path => $list];
 }
开发者ID:locii,项目名称:corporation-documentation,代码行数:27,代码来源:Blueprints.php

示例4: getNextOrderInFolder

 /**
  * Get the next available ordering number in a folder
  *
  * @param $path
  *
  * @return string the correct order string to prepend
  */
 private function getNextOrderInFolder($path)
 {
     $files = Folder::all($path, ['recursive' => false]);
     $highestOrder = 0;
     foreach ($files as $file) {
         preg_match(PAGE_ORDER_PREFIX_REGEX, $file, $order);
         if (isset($order[0])) {
             $theOrder = intval(trim($order[0], '.'));
         } else {
             $theOrder = 0;
         }
         if ($theOrder >= $highestOrder) {
             $highestOrder = $theOrder;
         }
     }
     $orderOfNewFolder = $highestOrder + 1;
     if ($orderOfNewFolder < 10) {
         $orderOfNewFolder = '0' . $orderOfNewFolder;
     }
     return $orderOfNewFolder;
 }
开发者ID:getgrav,项目名称:grav-plugin-admin,代码行数:28,代码来源:admincontroller.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:clee03,项目名称:metal,代码行数:24,代码来源:ConfigFileFinder.php

示例6: build

 /**
  * Build a list of configuration files with their timestamps. Used for loading settings and caching them.
  *
  * @return array
  * @internal
  */
 protected function build()
 {
     // Find all plugins with default configuration options.
     $plugins = array();
     $iterator = new \DirectoryIterator(PLUGINS_DIR);
     /** @var \DirectoryIterator $plugin */
     foreach ($iterator as $plugin) {
         $name = $plugin->getBasename();
         $file = $plugin->getPathname() . DS . $name . YAML_EXT;
         if (!is_file($file)) {
             continue;
         }
         $modified = filemtime($file);
         $plugins["plugins/{$name}"] = $modified;
     }
     // Find all system and user configuration files.
     $options = array('compare' => 'Filename', 'pattern' => '|\\.yaml$|', 'filters' => array('key' => '|\\.yaml$|'), 'key' => 'SubPathname', 'value' => 'MTime');
     $system = Folder::all(SYSTEM_DIR . 'config', $options);
     $user = Folder::all(USER_DIR . 'config', $options);
     return array('system' => $system, 'plugins' => $plugins, 'user' => $user);
 }
开发者ID:miguelramos,项目名称:grav,代码行数:27,代码来源:Config.php

示例7: detectRecursive

 /**
  * Detects all plugins with a configuration file and returns them with last modification time.
  *
  * @param  string $folder Location to look up from.
  * @return array
  * @internal
  */
 protected function detectRecursive($folder)
 {
     $path = trim(Folder::getRelativePath($folder), '/');
     if (is_dir($folder)) {
         // Find all system and user configuration files.
         $options = ['compare' => 'Filename', 'pattern' => '|\\.yaml$|', 'filters' => ['key' => '|\\.yaml$|', 'value' => function (\RecursiveDirectoryIterator $file) use($path) {
             return ['file' => "{$path}/{$file->getSubPathname()}", 'modified' => $file->getMTime()];
         }], 'key' => 'SubPathname'];
         $list = Folder::all($folder, $options);
     } else {
         $list = [];
     }
     return [$path => $list];
 }
开发者ID:gabykode,项目名称:tf,代码行数:21,代码来源:ConfigFinder.php

示例8: findBlueprints

    private function findBlueprints($path)
    {
        $options = [
            'compare' => 'Filename',
            'pattern' => '|\.yaml$|',
            'filters' => [
                'key' => '|\.yaml$|'
                ],
            'key' => 'SubPathName',
            'value' => 'PathName',
        ];

        return Folder::all($path, $options);
    }
开发者ID:notklaatu,项目名称:grav,代码行数:14,代码来源:Types.php

示例9: findBlueprints

 private function findBlueprints($uri)
 {
     $options = ['compare' => 'Filename', 'pattern' => '|\\.yaml$|', 'filters' => ['key' => '|\\.yaml$|'], 'key' => 'SubPathName', 'value' => 'PathName'];
     /** @var UniformResourceLocator $locator */
     $locator = Grav::instance()['locator'];
     if ($locator->isStream($uri)) {
         $options['value'] = 'Url';
     }
     $list = Folder::all($uri, $options);
     return $list;
 }
开发者ID:indigo423,项目名称:blog.no42.org,代码行数:11,代码来源:Types.php

示例10: taskSaveNewFolder

 /**
  * Handles creating an empty page folder (without markdown file)
  *
  * @return bool True if the action was performed.
  */
 public function taskSaveNewFolder()
 {
     if (!$this->authorizeTask('save', $this->dataPermissions())) {
         return;
     }
     $data = $this->post;
     if ($data['route'] == '/') {
         $path = $this->grav['locator']->findResource('page://');
     } else {
         $path = $page = $this->grav['page']->find($data['route'])->path();
     }
     $files = Folder::all($path, ['recursive' => false]);
     $highestOrder = 0;
     foreach ($files as $file) {
         preg_match(PAGE_ORDER_PREFIX_REGEX, $file, $order);
         if (isset($order[0])) {
             $theOrder = intval(trim($order[0], '.'));
         } else {
             $theOrder = 0;
         }
         if ($theOrder >= $highestOrder) {
             $highestOrder = $theOrder;
         }
     }
     $orderOfNewFolder = $highestOrder + 1;
     if ($orderOfNewFolder < 10) {
         $orderOfNewFolder = '0' . $orderOfNewFolder;
     }
     Folder::mkdir($path . '/' . $orderOfNewFolder . '.' . $data['folder']);
     $this->admin->setMessage($this->admin->translate('PLUGIN_ADMIN.SUCCESSFULLY_SAVED'), 'info');
     $multilang = $this->isMultilang();
     $admin_route = $this->grav['config']->get('plugins.admin.route');
     $redirect_url = '/' . ($multilang ? $this->grav['session']->admin_lang : '') . $admin_route . '/' . $this->view;
     $this->setRedirect($redirect_url);
     return true;
 }
开发者ID:jeremycherfas,项目名称:grav-blog,代码行数:41,代码来源:controller.php


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