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


PHP dir::read方法代码示例

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


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

示例1: __construct

 public function __construct($params = array())
 {
     $defaults = array('page' => page(), 'headline' => 'Mentions');
     if (is_a($params, 'Page')) {
         $params = array('page' => $params);
     } else {
         if (is_string($params)) {
             $params = array('headline' => $params);
         }
     }
     $this->options = array_merge($defaults, $params);
     $this->page = $this->options['page'];
     $this->root = $this->page->root() . DS . '.webmentions';
     $this->headline = new Field($this->page, 'headline', $this->options['headline']);
     if (!is_dir($this->root)) {
         return;
     }
     $files = dir::read($this->root);
     // flip direction
     rsort($files);
     foreach ($files as $file) {
         // skip the pings cache
         if ($file == 'pings.json') {
             continue;
         }
         // register a new webmention
         try {
             $mention = new Mention($this->page, $this->root . DS . $file);
             $this->append($mention->id(), $mention);
         } catch (Exception $e) {
         }
     }
 }
开发者ID:aizlewood,项目名称:2016,代码行数:33,代码来源:mentions.php

示例2: read

 public function read($url = '', $recursive = false, $format = 'flat')
 {
     if (substr($url, -1) !== Application::DS) {
         $url .= Application::DS;
     }
     if ($this->ignore('find', $url)) {
         return array();
     }
     $list = array();
     $cwd = getcwd();
     chdir($url);
     if ($handle = opendir($url)) {
         while (false !== ($entry = readdir($handle))) {
             $recursiveList = array();
             if ($entry == '.' || $entry == '..') {
                 continue;
             }
             $file = new stdClass();
             $file->url = $url . $entry;
             if (is_dir($file->url)) {
                 $file->url .= Application::DS;
                 $file->type = 'dir';
             }
             if ($this->ignore('find', $file->url)) {
                 continue;
             }
             $file->name = $entry;
             if (isset($file->type)) {
                 if (!empty($recursive)) {
                     $directory = new dir();
                     $directory->ignore('list', $this->ignore());
                     $recursiveList = $directory->read($file->url, $recursive, $format);
                     if ($format !== 'flat') {
                         $file->list = $recursiveList;
                         unset($recursiveList);
                     }
                 }
             } else {
                 $file->type = 'file';
             }
             if (is_link($entry)) {
                 $file->link = true;
             }
             /* absolute url is_link wont work probably the targeting type
             			if(is_link($file->url)){
             				$file->link = true;
             			}
             			*/
             $list[] = $file;
             if (!empty($recursiveList)) {
                 foreach ($recursiveList as $recursive_nr => $recursive_file) {
                     $list[] = $recursive_file;
                 }
             }
         }
     }
     closedir($handle);
     return $list;
 }
开发者ID:remco-pc,项目名称:System,代码行数:59,代码来源:Dir.class.php

示例3: custom

 public function custom()
 {
     $kirby = kirby();
     $root = $kirby->roots()->widgets();
     foreach (dir::read($root) as $dir) {
         $kirby->registry->set('widget', $dir, $root . DS . $dir, true);
     }
 }
开发者ID:nsteiner,项目名称:kdoc,代码行数:8,代码来源:widgets.php

示例4: testClean

 public function testClean()
 {
     dir::make($this->tmpDir);
     f::write($this->tmpDir . DS . 'testfile.txt', '');
     $this->assertTrue(dir::clean($this->tmpDir));
     $files = dir::read($this->tmpDir);
     $this->assertEquals(0, count($files));
     dir::remove($this->tmpDir);
 }
开发者ID:LucasFyl,项目名称:korakia,代码行数:9,代码来源:DirTest.php

示例5: runTests

 public function runTests($result)
 {
     $root = TEST_ROOT_ETC . DS . 'kirbytext';
     $dirs = dir::read($root);
     foreach ($dirs as $dir) {
         $testFile = $root . DS . $dir . DS . 'test.txt';
         $expectedFile = $root . DS . $dir . DS . 'expected.html';
         $this->assertEquals(f::read($expectedFile), $result(f::read($testFile)), 'test: ' . $dir);
     }
 }
开发者ID:LucasFyl,项目名称:korakia,代码行数:10,代码来源:KirbytextTest.php

示例6: custom

 public function custom()
 {
     $root = kirby()->roots()->widgets();
     foreach (dir::read($root) as $dir) {
         // add missing widgets to the order array
         if (!array_key_exists($dir, $this->order)) {
             $this->order[$dir] = true;
         }
         $this->load($dir, $root . DS . $dir . DS . $dir . '.php');
     }
 }
开发者ID:LucasFyl,项目名称:korakia,代码行数:11,代码来源:widgets.php

示例7: __construct

 public function __construct()
 {
     $root = kirby::instance()->roots()->accounts();
     foreach (dir::read($root) as $file) {
         // skip invalid account files
         if (f::extension($file) != 'php') {
             continue;
         }
         $user = new User(f::name($file));
         $this->append($user->username(), $user);
     }
 }
开发者ID:aoimedia,项目名称:kosmonautensofa,代码行数:12,代码来源:users.php

示例8: find

 public function find($type)
 {
     $root = form::$root[$type];
     $dirs = dir::read($root);
     foreach ($dirs as $dir) {
         $name = strtolower($dir);
         $file = $root . DS . $name . DS . $name . '.php';
         if (file_exists($file)) {
             $this->{$type}[$name . 'field'] = $file;
         }
     }
 }
开发者ID:irenehilber,项目名称:kirby-base,代码行数:12,代码来源:plugins.php

示例9: index

 public function index()
 {
     $widgets = array();
     $wroot = c::get('root.site') . DS . 'widgets';
     $wdirs = dir::read($wroot);
     foreach ($wdirs as $dir) {
         $file = $wroot . DS . $dir . DS . $dir . '.php';
         if (file_exists($file)) {
             $widgets[$dir] = (require $file);
         }
     }
     return view('dashboard/index', array('topbar' => new Snippet('pages/topbar', array('breadcrumb' => new Snippet('breadcrumb'), 'search' => purl('pages/search/'))), 'history' => history::get(), 'site' => site(), 'widgets' => $widgets, 'user' => site()->user()));
 }
开发者ID:kompuser,项目名称:panel,代码行数:13,代码来源:dashboard.php

示例10: plugins

 static function plugins()
 {
     $root = c::get('root.plugins');
     $files = dir::read($root);
     if (!is_array($files)) {
         return false;
     }
     foreach ($files as $file) {
         if (f::extension($file) != 'php') {
             continue;
         }
         self::file($root . '/' . $file);
     }
 }
开发者ID:04x10,项目名称:04x10.com,代码行数:14,代码来源:load.php

示例11: all

 public static function all()
 {
     $files = dir::read(static::$root);
     $result = array_keys(kirby()->get('blueprint'));
     $home = kirby()->option('home', 'home');
     $error = kirby()->option('error', 'error');
     foreach ($files as $file) {
         $name = f::name($file);
         if ($name != 'site' and $name != $home and $name != $error) {
             $result[] = $name;
         }
     }
     return $result;
 }
开发者ID:nsteiner,项目名称:kdoc,代码行数:14,代码来源:blueprint.php

示例12: all

 public static function all()
 {
     $files = dir::read(static::$root);
     $result = array();
     $home = site()->homePage()->uid();
     $error = site()->errorPage()->uid();
     foreach ($files as $file) {
         $name = f::name($file);
         if ($name != 'site' and $name != $home and $name != $error) {
             $result[] = $name;
         }
     }
     return $result;
 }
开发者ID:kompuser,项目名称:panel,代码行数:14,代码来源:blueprint.php

示例13: index

 public function index()
 {
     $site = site();
     $widgets = array();
     $wroot = kirby()->roots()->widgets();
     $wdirs = dir::read($wroot);
     // fetch all top-level pages in the right order
     $blueprint = blueprint::find($site);
     $pages = api::subpages($site->children(), $blueprint);
     foreach ($wdirs as $dir) {
         $file = $wroot . DS . $dir . DS . $dir . '.php';
         if (file_exists($file)) {
             $widgets[$dir] = (require $file);
         }
     }
     return view('dashboard/index', array('topbar' => new Snippet('pages/topbar', array('breadcrumb' => new Snippet('breadcrumb'), 'search' => purl('pages/search/'))), 'history' => history::get(), 'site' => $site, 'pages' => $pages, 'addbutton' => !api::maxPages($site, $blueprint->pages()->max()), 'widgets' => $widgets, 'user' => site()->user(), 'license' => panel()->license()));
 }
开发者ID:madebypost,项目名称:Gulp-Neat-KirbyCMS,代码行数:17,代码来源:dashboard.php

示例14: find

 public function find()
 {
     $kirby = kirby();
     // store all fields coming from plugins and load
     // them between the default fields and the custom fields
     $pluginfields = $kirby->get('field');
     // load the default panel fields first, because they can be overwritten
     foreach (dir::read(form::$root['default']) as $name) {
         $kirby->set('field', $name, form::$root['default'] . DS . $name);
     }
     // load the plugin fields again. A bit hacky, but works
     foreach ($pluginfields as $name => $field) {
         $kirby->set('field', $name, $field->root());
     }
     // load all custom fields, which can overwrite all the others
     foreach (dir::read(form::$root['custom']) as $name) {
         $kirby->set('field', $name, form::$root['custom'] . DS . $name);
     }
 }
开发者ID:robinandersen,项目名称:robin,代码行数:19,代码来源:plugins.php

示例15: plugins

 static function plugins($folder = false)
 {
     $root = c::get('root.plugins');
     $folder = $folder ? $folder : $root;
     $files = dir::read($folder);
     if (!is_array($files)) {
         return false;
     }
     foreach ($files as $file) {
         if (is_dir($folder . '/' . $file) && $folder == $root) {
             self::plugins($folder . '/' . $file);
             continue;
         }
         if (f::extension($file) != 'php') {
             continue;
         }
         self::file($folder . '/' . $file);
     }
 }
开发者ID:nilshendriks,项目名称:kirbycms,代码行数:19,代码来源:load.php


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