commit 44024d27aadd73b305f72f95d47009f746ddf332
parent aef76ab614d72be19735698406d2385f3f1ceec5
Author: markseu <mark2011@mayberg.se>
Date: Fri, 29 Mar 2024 21:02:16 +0100
Refactored code
Diffstat:
4 files changed, 30 insertions(+), 30 deletions(-)
diff --git a/system/extensions/core.php b/system/extensions/core.php
@@ -2,7 +2,7 @@
// Core extension, https://github.com/annaesvensson/yellow-core
class YellowCore {
- const VERSION = "0.8.126";
+ const VERSION = "0.8.127";
const RELEASE = "0.8.23";
public $content; // content files
public $media; // media files
@@ -371,19 +371,17 @@ class YellowContent {
if ($absoluteLocation) $location = substru($location, strlenu($this->yellow->page->base));
foreach ($this->scanLocation($this->getParentLocation($location)) as $page) {
if ($page->location==$location) {
- if (!$this->yellow->lookup->isRootLocation($page->location)) {
- $found = true;
- break;
- }
+ $found = true;
+ break;
}
}
return $found ? $page : null;
}
// Return page collection with all pages
- public function index($showInvisible = false, $multiLanguage = false, $levelMax = 0) {
+ public function index($showInvisible = false, $multiLanguage = false) {
$rootLocation = $multiLanguage ? "" : $this->getRootLocation($this->yellow->page->location);
- return $this->getChildrenRecursive($rootLocation, $showInvisible, $levelMax);
+ return $this->getChildrenRecursive($rootLocation, $showInvisible);
}
// Return page collection with top-level navigation
@@ -431,7 +429,7 @@ class YellowContent {
foreach ($this->scanLocation("") as $page) {
if ($content = $this->find(substru($page->location, 4).$locationEnd)) {
if ($content->isAvailable() && ($content->isVisible() || $showInvisible)) {
- if (!$this->yellow->lookup->isRootLocation($content->location)) $pages->append($content);
+ $pages->append($content);
}
}
}
@@ -448,7 +446,9 @@ class YellowContent {
$languages = array();
if ($this->yellow->system->get("coreMultiLanguageMode")) {
foreach ($this->scanLocation("") as $page) {
- if ($page->isAvailable() && ($page->isVisible() || $showInvisible)) array_push($languages, $page->get("language"));
+ if ($page->isAvailable() && ($page->isVisible() || $showInvisible)) {
+ array_push($languages, $page->get("language"));
+ }
}
}
return $languages;
@@ -459,7 +459,7 @@ class YellowContent {
$pages = new YellowPageCollection($this->yellow);
foreach ($this->scanLocation($location) as $page) {
if ($page->isAvailable() && ($page->isVisible() || $showInvisible)) {
- if (!$this->yellow->lookup->isRootLocation($page->location) && is_readable($page->fileName)) $pages->append($page);
+ $pages->append($page);
}
}
return $pages;
@@ -471,7 +471,7 @@ class YellowContent {
$pages = new YellowPageCollection($this->yellow);
foreach ($this->scanLocation($location) as $page) {
if ($page->isAvailable() && ($page->isVisible() || $showInvisible)) {
- if (!$this->yellow->lookup->isRootLocation($page->location) && is_readable($page->fileName)) $pages->append($page);
+ $pages->append($page);
}
if (!$this->yellow->lookup->isFileLocation($page->location) && $levelMax!=0) {
$pages->merge($this->getChildrenRecursive($page->location, $showInvisible, $levelMax));
@@ -567,18 +567,16 @@ class YellowMedia {
if ($absoluteLocation) $location = substru($location, strlenu($this->yellow->system->get("coreServerBase")));
foreach ($this->scanLocation($this->getParentLocation($location)) as $file) {
if ($file->location==$location) {
- if ($this->yellow->lookup->isFileLocation($file->location)) {
- $found = true;
- break;
- }
+ $found = true;
+ break;
}
}
return $found ? $file : null;
}
// Return page collection with all media files
- public function index($showInvisible = false, $multiPass = false, $levelMax = 0) {
- return $this->getChildrenRecursive("", $showInvisible, $levelMax);
+ public function index($showInvisible = false, $multiPass = false) {
+ return $this->getChildrenRecursive("", $showInvisible);
}
// Return page collection that's empty
@@ -591,7 +589,7 @@ class YellowMedia {
$files = new YellowPageCollection($this->yellow);
foreach ($this->scanLocation($location) as $file) {
if ($file->isAvailable() && ($file->isVisible() || $showInvisible)) {
- if ($this->yellow->lookup->isFileLocation($file->location)) $files->append($file);
+ $files->append($file);
}
}
return $files;
@@ -603,7 +601,7 @@ class YellowMedia {
$files = new YellowPageCollection($this->yellow);
foreach ($this->scanLocation($location) as $file) {
if ($file->isAvailable() && ($file->isVisible() || $showInvisible)) {
- if ($this->yellow->lookup->isFileLocation($file->location)) $files->append($file);
+ $files->append($file);
}
if (!$this->yellow->lookup->isFileLocation($file->location) && $levelMax!=0) {
$files->merge($this->getChildrenRecursive($file->location, $showInvisible, $levelMax));
@@ -2989,13 +2987,15 @@ 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->get("status")=="unlisted") $this->visible = false;
+ if ($this->yellow->lookup->isRootLocation($this->location) || !is_readable($this->fileName)) $this->available = false;
if ($this->get("status")=="shared") $this->available = false;
+ if ($this->get("status")=="unlisted") $this->visible = false;
} else {
$this->set("size", filesize($this->fileName));
$this->set("type", $this->yellow->toolbox->getFileType($this->fileName));
$this->set("group", $this->yellow->toolbox->getFileGroup($this->fileName, $this->yellow->system->get("coreMediaDirectory")));
$this->set("modified", date("Y-m-d H:i:s", $this->yellow->toolbox->getFileModified($this->fileName)));
+ if (!$this->yellow->lookup->isFileLocation($this->location)) $this->available = false;
}
foreach ($this->yellow->extension->data as $key=>$value) {
if (method_exists($value["object"], "onParseMetaData")) $value["object"]->onParseMetaData($this);
diff --git a/system/extensions/generate.php b/system/extensions/generate.php
@@ -2,7 +2,7 @@
// Generate extension, https://github.com/annaesvensson/yellow-generate
class YellowGenerate {
- const VERSION = "0.8.53";
+ const VERSION = "0.8.54";
public $yellow; // access to API
public $files; // number of files
public $errors; // number of errors
@@ -130,7 +130,7 @@ class YellowGenerate {
// Generate static file
public function generateStaticFile($path, $location, $analyse = false, $probe = false, $error = false) {
- $this->yellow->content = new YellowContent($this->yellow);
+ $this->yellow->content->pages = array();
$this->yellow->page = new YellowPage($this->yellow);
$this->yellow->page->fileName = substru($location, 1);
if (!is_readable($this->yellow->page->fileName)) {
diff --git a/system/extensions/update-available.ini b/system/extensions/update-available.ini
@@ -148,14 +148,14 @@ system/themes/copenhagen.css: copenhagen.css, create, update, careful
system/themes/copenhagen.png: copenhagen.png, create
Extension: Core
-Version: 0.8.126
+Version: 0.8.127
Description: Core functionality of your website.
Developer: Anna Svensson
Tag: feature
DownloadUrl: https://github.com/annaesvensson/yellow-core/archive/refs/heads/main.zip
DocumentationUrl: https://github.com/annaesvensson/yellow-core
DocumentationLanguage: en, de, sv
-Published: 2024-03-15 13:36:26
+Published: 2024-03-29 20:32:14
Status: available
system/extensions/core.php: core.php, create, update
system/layouts/default.html: default.html, create, update, careful
@@ -304,14 +304,14 @@ system/extensions/gallery-default-skin.svg: gallery-default-skin.svg, create, up
system/extensions/gallery-preloader.gif: gallery-preloader.gif, create, update
Extension: Generate
-Version: 0.8.53
+Version: 0.8.54
Description: Generate a static website.
Developer: Anna Svensson
Tag: feature
DownloadUrl: https://github.com/annaesvensson/yellow-generate/archive/refs/heads/main.zip
DocumentationUrl: https://github.com/annaesvensson/yellow-generate
DocumentationLanguage: en, de, sv
-Published: 2024-03-23 09:23:38
+Published: 2024-03-29 20:45:42
Status: available
system/extensions/generate.php: generate.php, create, update
diff --git a/system/extensions/update-current.ini b/system/extensions/update-current.ini
@@ -1,14 +1,14 @@
# Datenstrom Yellow update settings for installed extensions
Extension: Core
-Version: 0.8.126
+Version: 0.8.127
Description: Core functionality of your website.
Developer: Anna Svensson
Tag: feature
DownloadUrl: https://github.com/annaesvensson/yellow-core/archive/refs/heads/main.zip
DocumentationUrl: https://github.com/annaesvensson/yellow-core
DocumentationLanguage: en, de, sv
-Published: 2024-03-15 13:36:26
+Published: 2024-03-29 20:32:14
Status: available
system/extensions/core.php: core.php, create, update
system/layouts/default.html: default.html, create, update, careful
@@ -36,14 +36,14 @@ system/extensions/edit.woff: edit.woff, delete
content/shared/page-new-default.md: page-new-default.md, create, optional
Extension: Generate
-Version: 0.8.53
+Version: 0.8.54
Description: Generate a static website.
Developer: Anna Svensson
Tag: feature
DownloadUrl: https://github.com/annaesvensson/yellow-generate/archive/refs/heads/main.zip
DocumentationUrl: https://github.com/annaesvensson/yellow-generate
DocumentationLanguage: en, de, sv
-Published: 2024-03-23 09:23:38
+Published: 2024-03-29 20:45:42
Status: available
system/extensions/generate.php: generate.php, create, update