h5ai = $h5ai; $this->label = $label !== null ? $label : $this->h5ai->getLabel($absHref); $this->absPath = $this->h5ai->normalizePath($absPath, false); $this->isFolder = is_dir($this->absPath); $this->absHref = $this->h5ai->normalizePath($absHref, $this->isFolder); $this->date = filemtime($this->absPath); if ($this->isFolder) { $this->type = $type !== null ? $type : "folder"; $this->size = ""; } else { $this->type = $type !== null ? $type : $this->h5ai->getType($this->absPath); $this->size = filesize($this->absPath); } } public function isFolder() { return $this->isFolder; } public function toHtml() { $classes = "entry " . ($this->isFolder ? "folder " : "file ") . $this->type; $imgClass = ""; $img = $this->type; $smallImg = $this->h5ai->icon($this->type); $bigImg = $this->h5ai->icon($this->type, true); $hint = ""; if ($this->isFolder && $this->type !== "folder-parent") { $code = $this->h5ai->getHttpCode($this->absHref); $classes .= " checkedHttpCode"; if ($code !== "h5ai") { if ($code === 200) { $img = "folder-page"; $smallImg = $this->h5ai->icon("folder-page"); $bigImg = $this->h5ai->icon("folder-page", true); } else { $classes .= " error"; $hint = " " . $code . " "; } } } if ($this->h5ai->showThumbs() && in_array($this->type, $this->h5ai->getThumbTypes())) { $imgClass = " class='thumb' "; $thumbnail = new Thumbnail($this->h5ai, $this->absHref, "square", 16, 16); $thumbnail->create(); $smallImg = file_exists($thumbnail->getPath()) ? $thumbnail->getHref() : $thumbnail->getLiveHref(); $thumbnail = new Thumbnail($this->h5ai,$this->absHref, "rational", 96, 46); $thumbnail->create(); $bigImg = file_exists($thumbnail->getPath()) ? $thumbnail->getHref() : $thumbnail->getLiveHref(); } $html = "\t
  • \n"; $html .= "\t\t\n"; $html .= "\t\t\t" . $img . "\n"; $html .= "\t\t\t" . $img . "\n"; $html .= "\t\t\t" . $this->label . $hint . "\n"; $html .= "\t\t\t\n"; $html .= "\t\t\t" . $this->size . "\n"; $html .= "\t\t\n"; $html .= "\t
  • \n"; return $html; } } class Extended { private $h5ai, $parent, $content; public function __construct($h5ai) { $this->h5ai = $h5ai; $this->parent = null; $this->content = array(); $this->loadContent(); } private function loadContent() { if ($this->h5ai->getAbsHref() !== "/") { $options = $this->h5ai->getOptions(); $parentPath = safe_dirname($this->h5ai->getAbsPath()); $parentHref = safe_dirname($this->h5ai->getAbsHref(), true); $label = $options["setParentFolderLabels"] === true ? $this->h5ai->getLabel($parentHref) : "Parent Directory"; $this->parent = new Entry($this->h5ai, $parentPath, $parentHref, "folder-parent", $label); } $this->content = array(); $files = $this->h5ai->readDir($this->h5ai->getAbsPath()); foreach ($files as $file) { $absPath = $this->h5ai->getAbsPath() . "/" . $file; $absHref = $this->h5ai->getAbsHref() . rawurlencode($file); $this->content[$absPath] = new Entry($this->h5ai, $absPath, $absHref); } } public function toHtml() { $html = "
    \n"; $html .= "\n"; if (count($this->content) === 0) { $html .= "
    empty
    "; } $html .="
    "; return $html; } private function generateHeaders() { $html = "\t
  • \n"; $html .= "\t\t\n"; $html .= "\t\tName\n"; $html .= "\t\tLast modified\n"; $html .= "\t\tSize\n"; $html .= "\t
  • \n"; return $html; } } ?>