function __autoload($class) { require_once 'util.php'; include __DIR__ . '/../config.php'; if (substr($class, -5) == 'Model') { $slug = class_to_underscore(substr($class, strlen($class), -5)); include $zombie_root . '/model/' . $slug . '.php'; } else { $slug = class_to_underscore($class); include $zombie_root . '/apps/' . $slug . '/' . $slug . '.php'; } }
public function render() { if ($this->format == 'json') { $errors = get_error_array(); if (is_array($errors)) { if (isset($this->json['errors'])) { $this->json['errors'] = array_merge($this->json['errors'], $errors); } else { $this->json['errors'] = $errors; } } $this->render_json(); } else { $file = $this->app_root . "/" . class_to_underscore(get_class($this)) . "/views/" . $this->view . ".php"; if (file_exists($file)) { foreach (get_object_vars($this) as $var => $val) { ${$var} = $val; } if ($this->is_page) { if (!method_exists($menu, 'run')) { require_once $this->app_root . '/menu/menu.php'; $menu = new Menu(); } if (isset($token)) { $token = $this->get_csrf_token(); } include $this->app_root . "/home/views/open.php"; include $file; include $this->app_root . "/home/views/close.php"; } else { include $file; } } render_errors_js(); } }