mirror of
https://github.com/voc/streaming-website
synced 2024-09-20 06:22:03 +00:00
1cd3e2b60b
PHP8 deprecated, that class member variables can be created outside the class definition or constructor, which prevented the code to run at all. Additionally the error handling has changed, which has lead to multiple other errors during the runtime. Finally, strftime was deprecated in PHP 8.1.
43 lines
613 B
PHP
43 lines
613 B
PHP
<?php
|
|
|
|
// Version 1.2
|
|
|
|
if(!function_exists('h'))
|
|
{
|
|
function h($s)
|
|
{
|
|
return htmlspecialchars($s);
|
|
}
|
|
}
|
|
|
|
class PhpTemplate
|
|
{
|
|
private $data = array();
|
|
public $file;
|
|
|
|
public function __construct($file)
|
|
{
|
|
$this->file = $file;
|
|
$this->data["naked"] = false;
|
|
}
|
|
|
|
public function set($___data = array())
|
|
{
|
|
$this->data = array_merge($this->data, $___data);
|
|
}
|
|
|
|
public function render($___data = array())
|
|
{
|
|
extract(array_merge($this->data, $___data));
|
|
unset($___data);
|
|
|
|
ob_start();
|
|
require($this->file);
|
|
return ob_get_clean();
|
|
}
|
|
|
|
public function __tostring()
|
|
{
|
|
return $this->render();
|
|
}
|
|
}
|