瀏覽代碼

added support for shared content folder

markseu 6 年之前
父節點
當前提交
dd6cb86ccf
共有 2 個文件被更改,包括 14 次插入1 次删除
  1. 1 0
      system/config/config.ini
  2. 13 1
      system/plugins/core.php

+ 1 - 0
system/config/config.ini

@@ -32,6 +32,7 @@ TrashDir: system/trash/
 ContentDir: content/
 ContentDir: content/
 ContentRootDir: default/
 ContentRootDir: default/
 ContentHomeDir: home/
 ContentHomeDir: home/
+ContentSharedDir: shared/
 ContentPagination: page
 ContentPagination: page
 ContentDefaultFile: page.md
 ContentDefaultFile: page.md
 ContentExtension: .md
 ContentExtension: .md

+ 13 - 1
system/plugins/core.php

@@ -56,6 +56,7 @@ class YellowCore {
         $this->config->setDefault("contentDir", "content/");
         $this->config->setDefault("contentDir", "content/");
         $this->config->setDefault("contentRootDir", "default/");
         $this->config->setDefault("contentRootDir", "default/");
         $this->config->setDefault("contentHomeDir", "home/");
         $this->config->setDefault("contentHomeDir", "home/");
+        $this->config->setDefault("contentSharedDir", "shared/");
         $this->config->setDefault("contentPagination", "page");
         $this->config->setDefault("contentPagination", "page");
         $this->config->setDefault("contentDefaultFile", "page.md");
         $this->config->setDefault("contentDefaultFile", "page.md");
         $this->config->setDefault("contentExtension", ".md");
         $this->config->setDefault("contentExtension", ".md");
@@ -415,7 +416,7 @@ class YellowPage {
         $this->parser = null;
         $this->parser = null;
         $this->parserData = "";
         $this->parserData = "";
         $this->safeMode = intval($this->yellow->config->get("safeMode"));
         $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->visible = $this->yellow->lookup->isVisibleLocation($this->location, $this->fileName);
         $this->active = $this->yellow->lookup->isActiveLocation($this->location, $this->yellow->page->location);
         $this->active = $this->yellow->lookup->isActiveLocation($this->location, $this->yellow->page->location);
         $this->cacheable = $cacheable;
         $this->cacheable = $cacheable;
@@ -2247,6 +2248,17 @@ class YellowLookup {
         return $nested;
         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
     // Check if location is visible
     public function isVisibleLocation($location, $fileName) {
     public function isVisibleLocation($location, $fileName) {
         $visible = true;
         $visible = true;