mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-28 14:04:45 -04:00
Semantics. Refactorings. Make it PHP 5.3 compatible.
This commit is contained in:
parent
848e40da9c
commit
330523e2b0
3 changed files with 35 additions and 34 deletions
|
@ -2,10 +2,10 @@
|
||||||
modulejs.define('view/items', ['_', '$', 'core/settings', 'core/resource', 'core/format', 'core/event', 'core/location'], function (_, $, allsettings, resource, format, event, location) {
|
modulejs.define('view/items', ['_', '$', 'core/settings', 'core/resource', 'core/format', 'core/event', 'core/location'], function (_, $, allsettings, resource, format, event, location) {
|
||||||
|
|
||||||
var settings = _.extend({
|
var settings = _.extend({
|
||||||
setParentFolderLabels: false,
|
binaryPrefix: false,
|
||||||
hideParentFolderLinks: false,
|
|
||||||
hideFolders: false,
|
hideFolders: false,
|
||||||
binaryPrefix: false
|
hideParentFolder: false,
|
||||||
|
setParentFolderLabels: false
|
||||||
}, allsettings.view),
|
}, allsettings.view),
|
||||||
|
|
||||||
itemTemplate = '<li class="item">' +
|
itemTemplate = '<li class="item">' +
|
||||||
|
@ -96,7 +96,7 @@ modulejs.define('view/items', ['_', '$', 'core/settings', 'core/resource', 'core
|
||||||
|
|
||||||
$items.find('.item').remove();
|
$items.find('.item').remove();
|
||||||
|
|
||||||
if (item.parent && !settings.hideParentFolderLinks) {
|
if (item.parent && !settings.hideParentFolder) {
|
||||||
$items.append(update(item.parent, true));
|
$items.append(update(item.parent, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,55 +10,55 @@ Options
|
||||||
Spacing of the main content.
|
Spacing of the main content.
|
||||||
|
|
||||||
Left and right will be added to a minimum of 30px. Top and bottom
|
Left and right will be added to a minimum of 30px. Top and bottom
|
||||||
are calculated relative to the top and bottom bar heights.
|
are added to the top and bottom bar heights.
|
||||||
*/
|
*/
|
||||||
"spacing": {
|
"spacing": {
|
||||||
"maxWidth": 960,
|
|
||||||
"top": 50,
|
|
||||||
"right": "auto",
|
|
||||||
"bottom": 50,
|
"bottom": 50,
|
||||||
"left": "auto"
|
"left": "auto",
|
||||||
|
"maxWidth": 960,
|
||||||
|
"right": "auto",
|
||||||
|
"top": 50
|
||||||
},
|
},
|
||||||
|
|
||||||
/*
|
/*
|
||||||
General view options.
|
General view options.
|
||||||
|
|
||||||
|
- binaryPrefix: set to true uses 1024B=1KiB when formatting file sizes (see http://en.wikipedia.org/wiki/Binary_prefix)
|
||||||
|
- extInNewWindow: open non-h5ai links in new window/tab
|
||||||
|
- hidden: don't list items matching these regular expressions
|
||||||
|
- hideFolders: hide all folders in the main view
|
||||||
|
- hideIf403: hide files and folders that are not readable by the server
|
||||||
|
- hideParentFolder: hide parent folder links in the main view
|
||||||
|
- indexFiles: consider folder with those files as non {{pkg.name}} folders
|
||||||
- modes: array, subset of ["details", "grid", "icons"]
|
- modes: array, subset of ["details", "grid", "icons"]
|
||||||
the first value indicates the default view mode. If only one value
|
the first value indicates the default view mode. If only one value
|
||||||
is given the view mode is fixed and the selector buttons are hidden.
|
is given the view mode is fixed and the selector buttons are hidden.
|
||||||
The user selected view mode is also stored local in modern browsers
|
The user selected view mode is also stored local in modern browsers
|
||||||
so that it will be persistent.
|
so that it will be persistent.
|
||||||
|
- setParentFolderLabels: set parent folder labels to real folder names
|
||||||
- sizes: array, subset of [16, 24, 32, 48, 64, 96, 128, 192, 256, 384]
|
- sizes: array, subset of [16, 24, 32, 48, 64, 96, 128, 192, 256, 384]
|
||||||
the first value indicates the default view mode. If only one value
|
the first value indicates the default view mode. If only one value
|
||||||
is given the view mode is fixed and the selector buttons are hidden.
|
is given the view mode is fixed and the selector buttons are hidden.
|
||||||
The user selected view mode is also stored local in modern browsers
|
The user selected view mode is also stored local in modern browsers
|
||||||
so that it will be persistent.
|
so that it will be persistent.
|
||||||
- setParentFolderLabels: set parent folder labels to real folder names
|
|
||||||
- hideParentFolderLinks: hide parent folder links in the main view
|
|
||||||
- hideFolders: hide all folders in the main view
|
|
||||||
- binaryPrefix: set to true uses 1024B=1KiB when formatting file sizes (see http://en.wikipedia.org/wiki/Binary_prefix)
|
|
||||||
- indexFiles: consider folder with those files as non {{pkg.name}} folders
|
|
||||||
- ignore: don't list items matching these regular expressions
|
|
||||||
- smartBrowsing: use History API if available (no need to reload the whole page)
|
- smartBrowsing: use History API if available (no need to reload the whole page)
|
||||||
- extInNewWindow: open non-h5ai links in new window/tab
|
|
||||||
- hideIf403: hide files and folders that are not readable by the server
|
|
||||||
- theme: name of one of the folders in "_h5ai/client/themes", defaults to "fallback"
|
- theme: name of one of the folders in "_h5ai/client/themes", defaults to "fallback"
|
||||||
*/
|
*/
|
||||||
"view": {
|
"view": {
|
||||||
"modes": ["details", "grid", "icons"],
|
|
||||||
"sizes": [48, 24, 96],
|
|
||||||
"setParentFolderLabels": true,
|
|
||||||
"hideParentFolderLinks": false,
|
|
||||||
"hideFolders": false,
|
|
||||||
"binaryPrefix": false,
|
"binaryPrefix": false,
|
||||||
"indexFiles": ["index.html", "index.htm", "index.php"],
|
|
||||||
"ignore": ["^\\.", "^_{{pkg.name}}"],
|
|
||||||
"smartBrowsing": true,
|
|
||||||
"extInNewWindow": false,
|
"extInNewWindow": false,
|
||||||
|
"hidden": ["^\\.", "^_{{pkg.name}}"],
|
||||||
|
"hideFolders": false,
|
||||||
"hideIf403": true,
|
"hideIf403": true,
|
||||||
// "theme": "fallback"
|
"hideParentFolder": false,
|
||||||
|
"indexFiles": ["index.html", "index.htm", "index.php"],
|
||||||
|
"modes": ["details", "grid", "icons"],
|
||||||
|
"setParentFolderLabels": true,
|
||||||
|
"sizes": [48, 24, 96],
|
||||||
|
"smartBrowsing": true,
|
||||||
"theme": "evolvere"
|
"theme": "evolvere"
|
||||||
// "theme": "faenza"
|
// "theme": "faenza"
|
||||||
|
// "theme": "fallback"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,9 +23,10 @@ class App {
|
||||||
|
|
||||||
public function get_setup() {
|
public function get_setup() {
|
||||||
|
|
||||||
$consts = get_defined_constants(true)["user"];
|
$consts = get_defined_constants(true);
|
||||||
$consts["PHP_VERSION"] = PHP_VERSION;
|
$consts_user = $consts["user"];
|
||||||
return $consts;
|
$consts_user["PHP_VERSION"] = PHP_VERSION;
|
||||||
|
return $consts_user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -89,14 +90,14 @@ class App {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function is_ignored($name) {
|
public function is_hidden($name) {
|
||||||
|
|
||||||
// always ignore
|
// always hide
|
||||||
if ($name === "." || $name === "..") {
|
if ($name === "." || $name === "..") {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($this->options["view"]["ignore"] as $re) {
|
foreach ($this->options["view"]["hidden"] as $re) {
|
||||||
$re = App::$RE_DELIMITER . str_replace(App::$RE_DELIMITER, '\\' . App::$RE_DELIMITER, $re) . App::$RE_DELIMITER;
|
$re = App::$RE_DELIMITER . str_replace(App::$RE_DELIMITER, '\\' . App::$RE_DELIMITER, $re) . App::$RE_DELIMITER;
|
||||||
if (preg_match($re, $name)) {
|
if (preg_match($re, $name)) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -114,8 +115,8 @@ class App {
|
||||||
if ($dir = opendir($path)) {
|
if ($dir = opendir($path)) {
|
||||||
while (($name = readdir($dir)) !== false) {
|
while (($name = readdir($dir)) !== false) {
|
||||||
if (
|
if (
|
||||||
$this->is_ignored($name)
|
$this->is_hidden($name)
|
||||||
|| $this->is_ignored($this->to_url($path) . $name)
|
|| $this->is_hidden($this->to_url($path) . $name)
|
||||||
|| (!is_readable($path .'/'. $name) && $this->options["view"]["hideIf403"])
|
|| (!is_readable($path .'/'. $name) && $this->options["view"]["hideIf403"])
|
||||||
) {
|
) {
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue