1
0
This commit is contained in:
Mike Schwörer 2020-01-15 00:50:55 +01:00
parent f904691006
commit af09b49e8a
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
5 changed files with 32 additions and 15 deletions

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -1,22 +1,32 @@
<?php
require_once 'website.php';
class WebApps
{
public static function listAll()
/** @var array */
private $staticData;
public function __construct()
{
$this->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;
}

View File

@ -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
*/