web-base/core/Documents/Document404.class.php

65 lines
1.4 KiB
PHP
Raw Normal View History

2020-02-10 12:32:53 +01:00
<?php
namespace Documents {
2020-04-03 15:56:04 +02:00
use Documents\Document404\Body404;
use Documents\Document404\Head404;
use Elements\Document;
class Document404 extends Document {
2020-06-19 16:51:41 +02:00
public function __construct($user, ?string $view = NULL) {
parent::__construct($user, Head404::class, Body404::class, $view);
2020-02-10 12:32:53 +01:00
}
}
}
namespace Documents\Document404 {
2020-04-03 15:56:04 +02:00
use Elements\Head;
2020-06-22 19:09:02 +02:00
use Elements\SimpleBody;
2020-04-04 01:15:59 +02:00
use Views\View404;
2020-04-03 15:56:04 +02:00
class Head404 extends Head {
2020-02-10 12:32:53 +01:00
public function __construct($document) {
parent::__construct($document);
}
protected function initSources() {
}
2021-04-02 21:58:06 +02:00
protected function initMetas(): array {
2020-02-10 12:32:53 +01:00
return array(
array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1.0'),
array('name' => 'format-detection', 'content' => 'telephone=yes'),
array('charset' => 'utf-8'),
array("http-equiv" => 'expires', 'content' => '0'),
array("name" => 'robots', 'content' => 'noarchive'),
);
}
2021-04-02 21:58:06 +02:00
protected function initRawFields(): array {
2020-02-10 12:32:53 +01:00
return array();
}
2021-04-02 21:58:06 +02:00
protected function initTitle(): string {
2020-02-10 12:32:53 +01:00
return "WebBase - Not Found";
}
}
2020-06-22 19:09:02 +02:00
class Body404 extends SimpleBody {
2020-02-10 12:32:53 +01:00
public function __construct($document) {
parent::__construct($document);
}
2020-06-20 15:53:27 +02:00
public function loadView() {
http_response_code(404);
}
2021-04-02 21:58:06 +02:00
protected function getContent(): string {
2020-06-22 19:09:02 +02:00
return $this->load(View404::class);
2020-02-10 12:32:53 +01:00
}
}
}