コード例 #1
0
ファイル: template.php プロジェクト: dalinhuang/zotop
 public function actionSelect($field = '', $dir = '')
 {
     $dir = empty($dir) ? zotop::get('dir') : $dir;
     $dir = trim(url::decode($dir), '/');
     $path = site::template();
     $path = $path . DS . str_replace('/', DS, $dir);
     $path = path::clean($path);
     $folders = folder::folders($path);
     $files = folder::files($path);
     $position = '<a href="' . zotop::url('system/template/select') . '">' . zotop::t('根目录') . '</a><em> : //</em> ';
     if (!empty($dir)) {
         $dirs = arr::dirpath($dir, '/');
         foreach ($dirs as $d) {
             $position .= '<a href="' . zotop::url('system/template/select', array('dir' => rawurlencode($d[1]))) . '">' . $d[0] . '</a> <em>/</em>';
         }
     }
     $page = new dialog();
     $page->title = zotop::t('模板管理');
     $page->set('field', $field);
     $page->set('dir', $dir);
     $page->set('position', $position);
     $page->set('folders', $folders);
     $page->set('files', $files);
     $page->display();
 }
コード例 #2
0
ファイル: index.php プロジェクト: dalinhuang/zotop
 public function actionIndex($dir = '')
 {
     $dir = empty($dir) ? zotop::get('dir') : $dir;
     $dir = url::decode($dir);
     $path = ZOTOP_PATH_ROOT . DS . trim($dir, DS);
     $path = path::clean($path);
     //获取当前目录的子目录及子文件
     $folders = (array) folder::folders($path);
     $files = (array) folder::files($path);
     $position = '<a href="' . zotop::url('webftp/index/index') . '">root</a>';
     $dirs = arr::dirpath($dir, '/');
     foreach ($dirs as $d) {
         $position .= ' <em>/</em> <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();
 }
コード例 #3
0
ファイル: file.php プロジェクト: dalinhuang/zotop
 /**
  * 返回目录下的全部文件的数组,当level为0时候返回全部子文件夹目录
  * @param string $path 路径
  * @param array $ext 特定的文件格式,如只获取jpg,png格式
  * @param bool|int $recurse 子目录,或者子目录级数
  * @param bool $fullpath 全路径或者仅仅获取文件名称
  * @param array $ignore 忽略的文件夹名称
  * @return array
  */
 public static function brower($path, $ext = '', $recurse = false, $fullpath = false, $ignore = array('.svn', 'CVS', '.DS_Store', '__MACOSX'))
 {
     return folder::files($path, $recurse, $fullpath, $ext, $ignore);
 }
コード例 #4
0
ファイル: folder.php プロジェクト: dalinhuang/zotop
 /**
  * 返回目录下的全部文件的数组
  * @param string $path 路径
  * @param array $ext 特定的文件格式,如只获取jpg,png格式
  * @param bool|int $recurse 子目录,或者子目录级数
  * @param bool $fullpath 全路径或者仅仅获取文件名称
  * @param array $ignore 忽略的文件夹名称
  * @return array
  */
 public static function files($path, $ext = '', $recurse = false, $fullpath = false, $ignore = array('.svn', 'CVS', '.DS_Store', '__MACOSX'))
 {
     $files = array();
     $path = path::clean($path);
     if (!is_dir($path)) {
         return false;
     }
     $handle = opendir($path);
     while (($file = readdir($handle)) !== false) {
         if ($file != '.' && $file != '..' && !in_array($file, $ignore)) {
             $f = $path . DS . $file;
             if (is_dir($f)) {
                 if ($recurse) {
                     if (is_bool($recurse)) {
                         $subfiles = folder::files($f, $recurse, $fullpath, $ext);
                     } else {
                         $subfiles = folder::files($f, $recurse - 1, $fullpath, $ext);
                     }
                     if (is_array($subfiles)) {
                         $files = array_merge($files, $subfiles);
                     }
                 }
             } else {
                 if (!empty($ext)) {
                     if (is_array($ext) && in_array(file::ext($file), $ext)) {
                         $files[] = $fullpath ? $f : $file;
                     }
                 } else {
                     $files[] = $fullpath ? $f : $file;
                 }
             }
         }
     }
     closedir($handle);
     return $files;
 }
コード例 #5
0
ファイル: theme.php プロジェクト: dalinhuang/zotop
 public function files($path = '')
 {
     $files = folder::files($path, false, true);
     return $files;
 }