mirror of
https://github.com/voc/streaming-website
synced 2024-11-10 14:44:21 +00:00
41 lines
566 B
PHP
41 lines
566 B
PHP
<?php
|
|
|
|
// Version 1.2
|
|
|
|
if(!function_exists('h'))
|
|
{
|
|
function h($s)
|
|
{
|
|
return htmlspecialchars($s);
|
|
}
|
|
}
|
|
|
|
class PhpTemplate
|
|
{
|
|
private $data = array();
|
|
|
|
public function __construct($file)
|
|
{
|
|
$this->file = $file;
|
|
}
|
|
|
|
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();
|
|
}
|
|
}
|