- commit
- e1b9fdadb13308ff2020ca09deea42d945b87a36
- parent
- 911eeb26c67579e4c2ed64d51d5a22ec21887a14
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2018-10-14 10:43
cache content
Diffstat
| M | index.php | 22 | +++++++++++++++++++--- |
1 files changed, 19 insertions, 3 deletions
diff --git a/index.php b/index.php
@@ -62,6 +62,7 @@ class Pupupu 62 62 $loader = new Twig_Loader_Filesystem($srcDir . '/_templates'); 63 63 $this->twig = new Twig_Environment($loader); 64 64 -1 65 $this->cache = array(); 65 66 } 66 67 67 68 public function get($path, $name) @@ -87,19 +88,34 @@ class Pupupu 87 88 rrmdir($this->targetDir . $path); 88 89 } 89 90 -1 91 protected function getYml($path, $name) -1 92 { -1 93 $key = "yml:$path:$name"; -1 94 if (!in_array($key, $this->cache)) { -1 95 $v = Yaml::parse($this->get($path, 'index.yml')); -1 96 $this->cache[$key] = $v; -1 97 } -1 98 return $this->cache[$key]; -1 99 } -1 100 90 101 public function getBody($path) 91 102 {92 -1 return $this->parsedown->text($this->get($path, 'index.md'));-1 103 $key = "body:$path"; -1 104 if (!in_array($key, $this->cache)) { -1 105 $v = $this->parsedown->text($this->get($path, 'index.md')); -1 106 $this->cache[$key] = $v; -1 107 } -1 108 return $this->cache[$key]; 93 109 } 94 110 95 111 public function getPage($path) 96 112 {97 -1 return Yaml::parse($this->get($path, 'index.yml'));-1 113 return $this->getYml($path, 'index.yml'); 98 114 } 99 115 100 116 public function getSite() 101 117 {102 -1 return Yaml::parse($this->get('', 'site.yml'));-1 118 return $this->getYml('', 'site.yml'); 103 119 } 104 120 105 121 public function getSubpages($path)