當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。