55 $this->smarty->assign(array(
56 'site' => $this->site,
57 'page' => $this->page,
69 public function __call($function, $params) {
70 $key =
'Json.magic'.md5(serialize(array($function, $this->page->field[
'type'])));
71 $magic_file = $this->site->getCacheEntry($key);
72 if ($magic_file ===
null) {
74 "{$this->page->field['type']}/json.{$function}.php"
76 $types = explode(
'/', $this->page->field[
'type']);
77 while (array_pop($types)) {
79 $files[] = implode(
'/', $types) .
"/json.{$function}.php";
82 $files[] =
"json.{$function}.php";
83 foreach ($files as $file) {
84 if ($found = $this->site->getSiteFile($file)) {
86 $this->site->setCacheEntry($key, $magic_file);
92 if ($magic_file ===
null) {
93 $this->site->setCacheEntry($key,
'');
96 if (!file_exists($magic_file)) {
97 throw new BadMethodCallException(
'Invalid method', 0);
99 require_once $magic_file;
100 if (!function_exists($function)) {
101 throw new BadMethodCallException(
'Invalid method', 1);
103 return call_user_func($function, $this->site, $this->page, $this->auth, $this->smarty, $params);
112 return $GLOBALS[
'return'][
'error'];
122 $GLOBALS[
'return'][
'error'] = $error;
__call($function, $params)
__construct($site, $page, $auth, &$smarty)