mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-04-14 01:21:51 +02:00
Moves thumbTypes to config.js.
This commit is contained in:
parent
9f10e92175
commit
ba3e61c1d0
@ -34,6 +34,8 @@ h5ai is provided under the terms of the [MIT License](http://github.com/lrsjng/h
|
||||
* updates es translation
|
||||
* custom headers/footers are now optional and disabled by default
|
||||
* fixes problems with folder recognition in the JS version
|
||||
* fixes include problems in PHP version
|
||||
* fixes path problems on servers running on Windows in PHP version
|
||||
|
||||
|
||||
### v0.17 - *2011-11-28*
|
||||
|
@ -106,6 +106,7 @@ var H5AI_CONFIG = {
|
||||
* Show thumbnails for image files.
|
||||
*/
|
||||
"showThumbs": true,
|
||||
"thumbTypes": ["bmp", "gif", "ico", "image", "jpg", "png", "tiff"],
|
||||
|
||||
/*
|
||||
* Requires PHP on the server.
|
||||
|
@ -12,9 +12,8 @@ $H5AI_CONFIG = array();
|
||||
/*
|
||||
* This configuration assumes that h5ai is installed
|
||||
* in the webroot directory of the Apache server.
|
||||
* Assumed to end with a slash.
|
||||
*/
|
||||
$H5AI_CONFIG["ROOT_ABS_PATH"] = dirname(dirname(str_replace('\\', '/', __FILE__)));
|
||||
$H5AI_CONFIG["ROOT_ABS_PATH"] = safe_dirname(safe_dirname(__FILE__));
|
||||
|
||||
/*
|
||||
* Files/folders that should not be listed. Specified
|
||||
|
@ -11,7 +11,7 @@ class Crumb {
|
||||
$this->parts = array();
|
||||
|
||||
$href = $h5ai->getAbsHref();
|
||||
while ($href !== "/" && $href !== "//") {
|
||||
while ($href !== "/") {
|
||||
$this->parts[] = $href;
|
||||
$href = safe_dirname($href, true);
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ require_h5ai("/php/inc/Thumbnail.php");
|
||||
|
||||
class Entry {
|
||||
|
||||
private $h5ai, $label, $absPath, $absHref, $date, $isFolder, $type, $size, $thumbTypes;
|
||||
private $h5ai, $label, $absPath, $absHref, $date, $isFolder, $type, $size;
|
||||
|
||||
|
||||
public function __construct($h5ai, $absPath, $absHref, $type = null, $label = null) {
|
||||
@ -25,8 +25,6 @@ class Entry {
|
||||
$this->type = $type !== null ? $type : $this->h5ai->getType($this->absPath);
|
||||
$this->size = filesize($this->absPath);
|
||||
}
|
||||
|
||||
$this->thumbTypes = array("bmp", "gif", "ico", "image", "jpg", "png", "tiff");
|
||||
}
|
||||
|
||||
|
||||
@ -59,7 +57,7 @@ class Entry {
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($this->h5ai->showThumbs() && in_array($this->type, $this->thumbTypes)) {
|
||||
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();
|
||||
@ -138,7 +136,7 @@ class Extended {
|
||||
}
|
||||
|
||||
|
||||
public function generateHeaders() {
|
||||
private function generateHeaders() {
|
||||
|
||||
$html = "\t<li class='header'>\n";
|
||||
$html .= "\t\t<a class='icon'></a>\n";
|
||||
|
@ -126,24 +126,27 @@ class H5ai {
|
||||
}
|
||||
|
||||
|
||||
public function normalizePath($path, $endWithSlash) {
|
||||
|
||||
return preg_match("#^(\w:)?/$#", $path) ? $path : (preg_replace('#/$#', '', $path) . ($endWithSlash ? "/" : ""));
|
||||
}
|
||||
|
||||
|
||||
public function getAbsHref($absPath = null, $endWithSlash = true) {
|
||||
|
||||
if ($absPath === null) {
|
||||
return $this->absHref;
|
||||
}
|
||||
|
||||
$absPath=substr($absPath, strlen($this->rootAbsPath));
|
||||
$absPath = substr($absPath, strlen($this->rootAbsPath));
|
||||
|
||||
$parts = explode("/", $absPath);
|
||||
$encodedParts = array();
|
||||
foreach ($parts as $part) {
|
||||
$encodedParts[] = rawurlencode($part);
|
||||
}
|
||||
$endodedAbsHref = implode("/", $encodedParts);
|
||||
|
||||
$endodedAbsHref = $this->rootAbsHref . $endodedAbsHref;
|
||||
|
||||
return $this->normalizePath($endodedAbsHref, $endWithSlash);
|
||||
return $this->normalizePath($this->rootAbsHref . implode("/", $encodedParts), $endWithSlash);
|
||||
}
|
||||
|
||||
|
||||
@ -153,7 +156,7 @@ class H5ai {
|
||||
return $this->absPath;
|
||||
}
|
||||
|
||||
$absHref=substr($absHref, strlen($this->rootAbsHref));
|
||||
$absHref = substr($absHref, strlen($this->rootAbsHref));
|
||||
|
||||
return $this->normalizePath($this->rootAbsPath . "/" . rawurldecode($absHref), false);
|
||||
}
|
||||
@ -165,6 +168,12 @@ class H5ai {
|
||||
}
|
||||
|
||||
|
||||
public function getThumbTypes() {
|
||||
|
||||
return $this->options["thumbTypes"];
|
||||
}
|
||||
|
||||
|
||||
public function getTitle() {
|
||||
|
||||
$title = $this->domain . rawurldecode($this->absHref);
|
||||
@ -233,12 +242,6 @@ class H5ai {
|
||||
}
|
||||
|
||||
|
||||
public function normalizePath($path, $endWithSlash) {
|
||||
|
||||
return $path === "/" ? "/" : (preg_replace('#/$#', '', $path) . ($endWithSlash ? "/" : ""));
|
||||
}
|
||||
|
||||
|
||||
public function startsWith($sequence, $start) {
|
||||
|
||||
return strcasecmp(substr($sequence, 0, strlen($start)), $start) === 0;
|
||||
|
@ -78,7 +78,7 @@ class Image {
|
||||
public function releaseDest() {
|
||||
|
||||
if (!is_null($this->dest)) {
|
||||
imagedestroy($this->dest);
|
||||
@imagedestroy($this->dest);
|
||||
$this->dest = null;
|
||||
}
|
||||
}
|
||||
@ -87,7 +87,7 @@ class Image {
|
||||
public function releaseSource() {
|
||||
|
||||
if (!is_null($this->source)) {
|
||||
imagedestroy($this->source);
|
||||
@imagedestroy($this->source);
|
||||
$this->sourceFile = null;
|
||||
$this->source = null;
|
||||
$this->width = null;
|
||||
|
Loading…
x
Reference in New Issue
Block a user