Esempio n. 1
0
 public function loadData()
 {
     if (empty($this->settings)) {
         return;
     }
     $dirReader = new FolderReader($this->settings);
     $this->key = isset($_GET['key']) ? $_GET['key'] : array_keys($this->settings)[0];
     $this->selected = isset($_GET['file']) ? $_GET['file'] : 0;
     $this->page = isset($_GET['p']) ? $_GET['p'] : 0;
     $this->position = isset($_GET['pos']) ? $_GET['pos'] : 0;
     $this->lines = isset($_GET['lines']) ? $_GET['lines'] : 15;
     $this->files = $dirReader->readDirs();
 }
Esempio n. 2
0
<?php

require_once 'src/class/filebrowser.php';
require_once 'src/class/FolderReader.php';
require_once 'src/class/ItemIterator.php';
$reader = new FolderReader('nbproject');
$reader->setExtensionFilter(array("ico", "xml"));
if ($reader->readFolder()) {
    // print_r($reader->getAllFiles());
    $itemIterator = new ItemIterator($reader->getAllFiles("files"));
}
$itemIterator1 = new ItemIterator($reader->getAllFiles("folders"));
//print_r($itemIterator);
while ($itemIterator1->valid()) {
    echo "Folder: " . $itemIterator1->current()->getName() . "<br>";
    $itemIterator1->next();
}
while ($itemIterator->valid()) {
    echo "File: " . $itemIterator->current()->getName() . "<br>";
    $itemIterator->next();
}
/*
 * Add your filebrowser definition code here
 */
//function read_all_files($root = '.') {
//    $files = array('files' => array(), 'dirs' => array());
//    $directories = array();
//    $last_letter = $root[strlen($root) - 1];
//    $root = ($last_letter == '\\' || $last_letter == '/') ? $root : $root . DIRECTORY_SEPARATOR;
//
//    $directories[] = $root;
Esempio n. 3
0
 /**
  * Get files using currently-defined object properties
  * @return array Array of files within the current directory
  */
 function Get()
 {
     if (is_null($this->currentPath)) {
         $reader = new FolderReader($this->rootPath);
     } else {
         $reader = new FolderReader($this->currentPath);
     }
     $reader->setExtensionFilter($this->extensionFilter);
     $reader->readFolder();
     return $reader->getAllFiles();
 }