commit bfbddf87b45da3b9fd2a531af8f7dfb2ca46bdf5
parent c51cd8eda15534a4703a6c3f500a4343b96a1c57
Author: markseu <mark2011@mayberg.se>
Date: Mon, 14 Aug 2017 13:54:30 +0200
System update (better navigation, better numbers)
Diffstat:
1 file changed, 16 insertions(+), 12 deletions(-)
diff --git a/system/plugins/core.php b/system/plugins/core.php
@@ -482,7 +482,6 @@ class YellowPage
if(!$this->isExisting("titleContent")) $this->set("titleContent", $this->get("title"));
if(!$this->isExisting("titleNavigation")) $this->set("titleNavigation", $this->get("title"));
if(!$this->isExisting("titleHeader")) $this->set("titleHeader", $titleHeader);
- if(!$this->isExisting("status") && !is_readable($this->fileName)) $this->set("status", "ignore");
if($this->get("status")=="hidden") $this->available = false;
$this->set("pageRead", $this->yellow->lookup->normaliseUrl(
$this->yellow->config->get("serverScheme"),
@@ -1387,15 +1386,7 @@ class YellowPages
function top($showInvisible = false)
{
$rootLocation = $this->getRootLocation($this->yellow->page->location);
- $pages = new YellowPageCollection($this->yellow);
- foreach($this->scanLocation($rootLocation) as $page)
- {
- if($page->isAvailable() && ($page->isVisible() || $showInvisible))
- {
- if(is_readable($page->fileName)) $pages->append($page);
- }
- }
- return $pages;
+ return $this->getChildren($rootLocation, $showInvisible);
}
// Return page collection with path ancestry
@@ -1460,7 +1451,7 @@ class YellowPages
{
if($page->isAvailable() && ($page->isVisible() || $showInvisible))
{
- if(!$this->yellow->lookup->isRootLocation($page->location)) $pages->append($page);
+ if(!$this->yellow->lookup->isRootLocation($page->location) && is_readable($page->fileName)) $pages->append($page);
}
}
return $pages;
@@ -1475,7 +1466,7 @@ class YellowPages
{
if($page->isAvailable() && ($page->isVisible() || $showInvisible))
{
- if(!$this->yellow->lookup->isRootLocation($page->location)) $pages->append($page);
+ if(!$this->yellow->lookup->isRootLocation($page->location) && is_readable($page->fileName)) $pages->append($page);
if(!$this->yellow->lookup->isFileLocation($page->location) && $levelMax!=0)
{
$pages->merge($this->getChildrenRecursive($page->location, $showInvisible, $levelMax));
@@ -2946,6 +2937,19 @@ class YellowToolbox
return $contentType;
}
+ // Return number of bytes
+ function getNumberBytes($string)
+ {
+ $bytes = intval($string);
+ switch(strtoupperu(substru($string, -1)))
+ {
+ case 'G': $bytes *= 1024*1024*1024; break;
+ case 'M': $bytes *= 1024*1024; break;
+ case 'K': $bytes *= 1024; break;
+ }
+ return $bytes;
+ }
+
// Return files and directories
function getDirectoryEntries($path, $regex = "/.*/", $sort = true, $directories = true, $includePath = true)
{