1: <?php
2:
3: namespace Genetsis\core;
4:
5: 6: 7: 8: 9: 10: 11: 12:
13: class OauthTemplate
14: {
15:
16: protected $vars = array();
17:
18: private $tpl_file = '';
19:
20: 21: 22: 23: 24: 25:
26: public function __construct($template)
27: {
28: $this->tpl_file = $template;
29: }
30:
31: 32: 33: 34: 35:
36: public function render()
37: {
38: $html = $this->tpl_file;
39: $html = str_replace("'", "\'", $html);
40: $html = preg_replace('#\{([a-z0-9\-_]*?)\}#is', "' . $\\1 . '", $html);
41: reset($this->vars);
42: while (list($key, $val) = each($this->vars)) {
43: $$key = $val;
44: }
45: eval("\$html = '$html';");
46: reset($this->vars);
47: while (list($key, $val) = each($this->vars)) {
48: unset($$key);
49: }
50: $html = str_replace("\'", "'", $html);
51: return $html;
52: }
53:
54: public function __get($name)
55: {
56: return $this->vars[$name];
57: }
58:
59: public function __set($name, $value)
60: {
61: $this->vars[$name] = $value;
62: }
63: }