{ private $path; function loadView($view) { $path = base::expand($view, '/views'); Console::debugEx(LOG_BASIC, __CLASS__, "Attempting to invoke view from %s", $path); if (file_exists($path)) { Console::debugEx(LOG_BASIC, __CLASS__, "Invoking as Pure PHP View"); $this->path = $path; } else { throw new ViewNotFoundException("The view " . $view . " could not be found"); } } function display() { // TODO: Investigate the consequences of forcing HTTP/1.1 here as just "200" triggers a fatal error on some systems if (!headers_sent()) { header('HTTP/1.1 200 Content Follows', true); } $data = $this->getViewData(); extract($this->_data, EXTR_SKIP); include $this->path; } function import($view) { $path = base::appPath() . '/views/' . $view; include $path; } } ViewHandler::register('PlainViewHandler', '.*\\.php$');
$this->set('LEPTON_PLATFORM_ID', LEPTON_PLATFORM_ID); } else { throw new BaseException("Smarty view invoked but Smarty not found"); } } function loadView($template) { $this->template = $template; if ($this->smarty) { $def = get_defined_constants(true); foreach ($def['user'] as $key => $value) { $this->smarty->assign($key, $value); } $data = $this->getViewData(); foreach ($data as $key => $value) { $this->smarty->assign($key, $value); } } else { throw new BaseException("Smarty view loaded but Smarty not found"); } } function display() { if (!headers_sent()) { header('HTTP/1.1 200 Content Follows', true); } $this->smarty->display($this->template); } } ViewHandler::register('SmartyViewHandler', '.*\\.tpl$');