46 lines
No EOL
753 B
PHP
Executable file
46 lines
No EOL
753 B
PHP
Executable file
<?php
|
|
/**
|
|
* Frontend handler
|
|
*/
|
|
class ZAPController {
|
|
/**
|
|
* String mode
|
|
*/
|
|
private $mode;
|
|
|
|
/**
|
|
* Parsable content object
|
|
*/
|
|
private $action;
|
|
|
|
/**
|
|
* Class prefix
|
|
*/
|
|
private $prefix = 'ZAP';
|
|
|
|
/**
|
|
* Constructor
|
|
*/
|
|
public function __construct($mode = 'home') {
|
|
$mode = trim(strip_tags($mode));
|
|
$this->mode = ucfirst($mode);
|
|
$clazz = $this->prefix . $this->mode;
|
|
if (!class_exists($clazz)) {
|
|
http_response_code(404);
|
|
include getZAPTemplate('404');
|
|
die();
|
|
}
|
|
$this->action = new $clazz();
|
|
}
|
|
|
|
/**
|
|
* @return string content
|
|
*/
|
|
public function fetch() {
|
|
if (!($this->action instanceof ZAPHandler)) {
|
|
die('Handler does not implement ZAPHandler interface');
|
|
}
|
|
return $this->action->getContent();
|
|
}
|
|
}
|
|
?>
|