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


PHP dir::folders方法代码示例

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


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

示例1: getUnInstalled

 public function getUnInstalled()
 {
     $installed = (array) $this->getInstalled();
     $folders = dir::folders(ZPATH_MODULES, '.', false);
     $folders = array_diff($folders, array_keys($installed));
     $modules = array();
     foreach ($folders as $folder) {
         $modulePath = ZPATH_MODULES . DS . $folder;
         $moduleUrl = url::modules() . '/' . $folder;
         $moduleFile = $modulePath . DS . 'module.php';
         if (file::exists($moduleFile)) {
             $m = (include $moduleFile);
             $m['path'] = '$modules/' . $folder;
             $m['url'] = '$modules/' . $folder;
             if (!isset($m['icon'])) {
                 if (!file::exists($modulePath . '/icon.png')) {
                     $m['icon'] = url::theme() . '/image/skin/none.png';
                 } else {
                     $m['icon'] = $moduleUrl . '/icon.png';
                 }
             }
             $modules[$m['id']] = $m;
         }
     }
     return $modules;
 }
开发者ID:dalinhuang,项目名称:zotop,代码行数:26,代码来源:module.php

示例2: getUnInstalled

 public function getUnInstalled()
 {
     $installed = (array) $this->getInstalled();
     $folders = dir::folders(ZOTOP_PATH_MODULES, '.', false);
     $modules = array();
     foreach ($folders as $folder) {
         $modulePath = ZOTOP_PATH_MODULES . DS . $folder;
         $moduleUrl = '$modules/' . $folder;
         $moduleFile = $modulePath . DS . 'module.php';
         $m = @(include $moduleFile);
         if (is_array($m) && isset($m['id']) && !in_array($m['id'], array_keys($installed))) {
             $m['path'] = '$modules/' . $folder;
             $m['url'] = '$modules/' . $folder;
             if (!isset($m['icon'])) {
                 if (file::exists($modulePath . '/icon.png')) {
                     $m['icon'] = $moduleUrl . '/icon.png';
                 }
             }
             $modules[$m['id']] = $m;
         }
     }
     return $modules;
 }
开发者ID:dalinhuang,项目名称:zotop,代码行数:23,代码来源:module.php

示例3: notInstalled

 public function notInstalled()
 {
     $datalist = (array) $this->datalist();
     $folders = dir::folders(ZOTOP_MODULES, '.', false);
     $folders = array_diff($folders, array_keys($datalist));
     $modules = array();
     foreach ($folders as $folder) {
         $modulePath = ZOTOP_MODULES . DS . $folder;
         $moduleUrl = url::modules() . '/' . $folder;
         $moduleFile = $modulePath . DS . 'module.php';
         if (file::exists($moduleFile)) {
             $m = (include $moduleFile);
             if (!isset($m['icon'])) {
                 $m['icon'] = $moduleUrl . '/icon.gif';
                 if (!file::exists($m['icon'])) {
                     $m['icon'] = url::theme() . '/image/icon/module.gif';
                 }
             }
             $modules[$m['id']] = $m;
         }
     }
     return $modules;
 }
开发者ID:dalinhuang,项目名称:zotop,代码行数:23,代码来源:module.php

示例4: actionIndex

 public function actionIndex($dir = '')
 {
     $dir = url::clean($dir);
     $path = ZOTOP_PATH_ROOT . DS . trim($dir, DS);
     $path = path::clean($path);
     //获取当前目录的子目录及子文件
     $folders = (array) dir::folders($path);
     $files = (array) dir::files($path);
     $position = '<a href="' . zotop::url('webftp/index/index') . '">wwwroot</a>';
     $dirs = arr::dirpath($dir, '/');
     foreach ($dirs as $d) {
         $position .= ' / <a href="' . zotop::url('webftp/index/index', array('dir' => rawurlencode($d[1]))) . '">' . $d[0] . '</a>';
     }
     $page = new page();
     $page->title = '文件管理器';
     $page->set('position', $position);
     $page->set('navbar', $this->navbar($dir));
     $page->set('folders', $folders);
     $page->set('files', $files);
     $page->set('path', $path);
     $page->set('dir', $dir);
     $page->display();
 }
开发者ID:dalinhuang,项目名称:zotop,代码行数:23,代码来源:index.php

示例5: folders

 /**
  * 返回目录下的全部文件夹的数组
  * @param string $path 路径
  * @param array $filter 
  * @param bool|int $recurse 子目录,或者子目录级数
  * @param bool $fullpath 全路径或者仅仅获取文件名称
  * @param array $ignore 忽略的文件夹名称
  * @return array
  */
 public static function folders($path, $filter = '.', $recurse = false, $fullpath = false, $ignore = array('.svn', 'CVS', '.DS_Store', '__MACOSX'))
 {
     $folders = array();
     $path = path::clean($path);
     if (!is_dir($path)) {
         return false;
     }
     $handle = opendir($path);
     while (($file = readdir($handle)) !== false) {
         $f = $path . DS . $file;
         if ($file != '.' && $file != '..' && !in_array($file, $ignore) && is_dir($f)) {
             if (preg_match("/{$filter}/", $file)) {
                 if ($fullpath) {
                     $folders[] = $f;
                 } else {
                     $folders[] = $file;
                 }
             }
             if ($recurse) {
                 if (is_integer($recurse)) {
                     $recurse--;
                 }
                 $subfolders = dir::folders($f, $filter, $recurse, $fullpath, $ignore);
                 $folders = array_merge($folders, $subfolders);
             }
         }
     }
     closedir($handle);
     return $folders;
 }
开发者ID:dalinhuang,项目名称:zotop,代码行数:39,代码来源:dir.php

示例6: onDefault

 public function onDefault($dir = '')
 {
     $path = ROOT . DS . trim($dir, DS);
     $path = path::clean($path);
     $folders = dir::folders($path);
     $files = dir::files($path);
     $fileext = array('php', 'css', 'js', 'jpg', 'jpeg', 'gif', 'png', 'bmp', 'psd', 'html', 'htm', 'tpl', 'rar', 'zip', 'mp3');
     $page['title'] = '文件管理器';
     page::header($page);
     page::add('<div id="page" class="clearfix">');
     page::add('<div id="main">');
     page::add('<div id="main-inner">');
     page::top();
     page::navbar($this->navbar(), 'default');
     $column = array();
     $column['select'] = '';
     $column['name'] = '名称';
     $column['type'] = '类型';
     $column['size w60'] = '大小';
     $column['atime w120'] = '创建时间';
     $column['mtime w120'] = '修改时间';
     $column['manage rename w80'] = '重命名';
     $column['manage edit w80'] = '编辑';
     $column['manage delete'] = '删除';
     table::header('list', $column);
     foreach ($folders as $folder) {
         $column = array();
         $column['select w20 center'] = html::image(url::theme() . '/image/fileext/folder.gif');
         $column['name'] = '<a href="' . zotop::url('filemanager/index/default', array('dir' => $dir . DS . $folder)) . '"><b>' . $folder . '</b></a>';
         $column['type w60'] = '文件夹';
         $column['size w60'] = '--';
         $column['atime w120'] = time::format(@fileatime($path . DS . $folder));
         $column['mtime w120'] = time::format(@filemtime($path . DS . $folder));
         $column['manage rename w80'] = '<a>重命名</a>';
         $column['manage edit w80'] = '<a class="disabled">编辑</a>';
         $column['manage delete'] = '<a>删除</a>';
         table::row($column);
     }
     foreach ($files as $file) {
         $column = array();
         $column['select w20 center'] = in_array(file::ext($file), $fileext) ? html::image(url::theme() . '/image/fileext/' . file::ext($file) . '.gif') : html::image(url::theme() . '/image/fileext/unknown.gif');
         $column['name'] = '<a href="' . zotop::url('filemanager/index/default', array('dir' => $dir . DS . $file)) . '"><b>' . $file . '</b></a>';
         $column['type w60'] = '文件';
         $column['size w60'] = format::byte(@filesize($path . DS . $file));
         $column['atime w120'] = time::format(@fileatime($path . DS . $file));
         $column['mtime w120'] = time::format(@filemtime($path . DS . $file));
         $column['manage rename w80'] = '<a>重命名</a>';
         $column['manage edit w80'] = '<a href="' . zotop::url('filemanager/file/edit', array('filename' => $dir . DS . $file, 'dir' => '***')) . '">编辑</a>';
         $column['manage delete'] = '<a>删除</a>';
         table::row($column);
     }
     table::footer();
     page::bottom();
     page::add('</div>');
     page::add('</div>');
     page::add('<div id="side">');
     block::header('快捷操作');
     echo '<ul class="list">';
     echo '<li class="file"><a href="' . zotop::url('zotop/file/newfile') . '" class="dialog">新建文件</a></li>';
     echo '<li class="folder"><a href="' . zotop::url('zotop/file/newfolder') . '" class="dialog">新建文件夹</a></li>';
     echo '<li class="folder"><a href="' . zotop::url('zotop/file/upload') . '" class="dialog">文件上传</a></li>';
     echo '</ul>';
     block::footer();
     block::header('其他位置');
     echo '<ul class="list">';
     echo '<li class="root"><a>根目录</a></li>';
     echo '<li class="root"><a>模板目录</a></li>';
     echo '<li class="root"><a>模块目录</a></li>';
     echo '<li class="root"><a>缓存目录</a></li>';
     echo '</ul>';
     block::footer();
     page::add('</div>');
     page::add('</div>');
     page::footer();
 }
开发者ID:dalinhuang,项目名称:zotop,代码行数:75,代码来源:index.php


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