From af09b49e8a21d668d44e06c4ef8d43f9d7aa7dd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Wed, 15 Jan 2020 00:50:55 +0100 Subject: [PATCH] WebApps --- www/internals/books.php | 2 +- www/internals/euler.php | 2 +- www/internals/programs.php | 2 +- www/internals/webapp.php | 20 +++++++++++++++----- www/internals/website.php | 21 ++++++++++++++------- 5 files changed, 32 insertions(+), 15 deletions(-) diff --git a/www/internals/books.php b/www/internals/books.php index 01fcddd..7265e58 100644 --- a/www/internals/books.php +++ b/www/internals/books.php @@ -14,7 +14,7 @@ class Books private function load() { - $all = require (__DIR__ . '/../statics/blog/__all.php'); + $all = require (__DIR__ . '/../statics/books/__all.php'); $this->staticData = array_map(function($a){return self::readSingle($a);}, $all); } diff --git a/www/internals/euler.php b/www/internals/euler.php index 66b4b13..8c9f7b3 100644 --- a/www/internals/euler.php +++ b/www/internals/euler.php @@ -14,7 +14,7 @@ class Euler private function load() { - $all = require (__DIR__ . '/../statics/blog/__all.php'); + $all = require (__DIR__ . '/../statics/euler/__all.php'); $this->staticData = array_map(function($a){return self::readSingle($a);}, $all); } diff --git a/www/internals/programs.php b/www/internals/programs.php index d4e8eab..83bea9d 100644 --- a/www/internals/programs.php +++ b/www/internals/programs.php @@ -43,7 +43,7 @@ class Programs private function load() { - $all = require (__DIR__ . '/../statics/blog/__all.php'); + $all = require (__DIR__ . '/../statics/programs/__all.php'); $this->staticData = array_map(function($a){return self::readSingle($a);}, $all); } diff --git a/www/internals/webapp.php b/www/internals/webapp.php index e5b8754..b310749 100644 --- a/www/internals/webapp.php +++ b/www/internals/webapp.php @@ -1,22 +1,32 @@ load(); + } + + private function load() { $all = require (__DIR__ . '/../statics/webapps/__all.php'); - return array_map('self::readSingle', $all); + $this->staticData = array_map(function($a){return self::readSingle($a);}, $all); } - public static function readSingle($a) + private static function readSingle($a) { return $a; } - public static function listAllNewestFirst() + public function listAllNewestFirst() { - $data = self::listAll(); + $data = $this->staticData; usort($data, function($a, $b) { return strcasecmp($b['date'], $a['date']); }); return $data; } diff --git a/www/internals/website.php b/www/internals/website.php index e564c62..f608e9d 100644 --- a/www/internals/website.php +++ b/www/internals/website.php @@ -22,6 +22,7 @@ class Website /** @var Programs|null */ private $programs = null; /** @var AlephNoteStatistics|null */ private $anstats = null; /** @var UpdatesLog|null */ private $updateslog = null; + /** @var WebApps|null */ private $webapps = null; public function init() { @@ -165,48 +166,54 @@ class Website return $this->database; } - public function AdventOfCode() + public function AdventOfCode(): AdventOfCode { if ($this->adventOfCode === null) { require_once 'adventofcode.php'; $this->adventOfCode = new AdventOfCode(); } return $this->adventOfCode; } - public function Blog() + public function Blog(): Blog { if ($this->blog === null) { require_once 'blog.php'; $this->blog = new Blog(); } return $this->blog; } - public function Books() + public function Books(): Books { if ($this->books === null) { require_once 'books.php'; $this->books = new Books(); } return $this->books; } - public function Euler() + public function Euler(): Euler { if ($this->euler === null) { require_once 'euler.php'; $this->euler = new Euler(); } return $this->euler; } - public function Programs() + public function Programs(): Programs { if ($this->programs === null) { require_once 'programs.php'; $this->programs = new Programs(); } return $this->programs; } - public function AlephNoteStatistics() + public function AlephNoteStatistics(): AlephNoteStatistics { if ($this->anstats === null) { require_once 'alephnoteStatistics.php'; $this->anstats = new AlephNoteStatistics($this); } return $this->anstats; } - public function UpdatesLog() + public function UpdatesLog(): UpdatesLog { if ($this->updateslog === null) { require_once 'updateslog.php'; $this->updateslog = new UpdatesLog($this); } return $this->updateslog; } + public function WebApps(): WebApps + { + if ($this->webapps === null) { require_once 'webapp.php'; $this->webapps = new WebApps(); } + return $this->webapps; + } + /** * @return bool */