commit dd6cb86ccf385c9a935e77462f5da3aa017ab518
parent f6aa26b316026d92d64bf64862463ca79fafc85c
Author: markseu <mark2011@mayberg.se>
Date: Mon, 28 Jan 2019 11:37:49 +0100
added support for shared content folder
Diffstat:
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/system/config/config.ini b/system/config/config.ini
@@ -32,6 +32,7 @@ TrashDir: system/trash/
ContentDir: content/
ContentRootDir: default/
ContentHomeDir: home/
+ContentSharedDir: shared/
ContentPagination: page
ContentDefaultFile: page.md
ContentExtension: .md
diff --git a/system/plugins/core.php b/system/plugins/core.php
@@ -56,6 +56,7 @@ class YellowCore {
$this->config->setDefault("contentDir", "content/");
$this->config->setDefault("contentRootDir", "default/");
$this->config->setDefault("contentHomeDir", "home/");
+ $this->config->setDefault("contentSharedDir", "shared/");
$this->config->setDefault("contentPagination", "page");
$this->config->setDefault("contentDefaultFile", "page.md");
$this->config->setDefault("contentExtension", ".md");
@@ -415,7 +416,7 @@ class YellowPage {
$this->parser = null;
$this->parserData = "";
$this->safeMode = intval($this->yellow->config->get("safeMode"));
- $this->available = true;
+ $this->available = $this->yellow->lookup->isAvailableLocation($this->location, $this->fileName);
$this->visible = $this->yellow->lookup->isVisibleLocation($this->location, $this->fileName);
$this->active = $this->yellow->lookup->isActiveLocation($this->location, $this->yellow->page->location);
$this->cacheable = $cacheable;
@@ -2247,6 +2248,17 @@ class YellowLookup {
return $nested;
}
+ // Check if location is available
+ public function isAvailableLocation($location, $fileName) {
+ $available = true;
+ $pathBase = $this->yellow->config->get("contentDir");
+ if (substru($fileName, 0, strlenu($pathBase))==$pathBase) {
+ $sharedLocation = $this->yellow->pages->getHomeLocation($location).$this->yellow->config->get("contentSharedDir");
+ if (substru($location, 0, strlenu($sharedLocation))==$sharedLocation) $available = false;
+ }
+ return $available;
+ }
+
// Check if location is visible
public function isVisibleLocation($location, $fileName) {
$visible = true;