function InsertView($name, $vars = array()) { $template = new \phalanx\views\View($name); foreach ($vars as $key => $value) { $template->vars()->Set($key, $value); } return $template->Render(); }
if (!file_exists($path)) { phalanx\events\EventPump::Pump()->RaiseEvent(new StandardErrorEvent('Could not load event ' . $name)); } require_once $path; return phalanx\base\UnderscoreToCamelCase($name) . 'Event'; }); // Register bypass rules. $dispatcher->AddBypassRule('', 'home'); $dispatcher->AddBypassRule('list', 'list_bug'); $dispatcher->AddBypassRule('new', 'new_bug'); $dispatcher->AddBypassRule('view', 'view_bug'); $dispatcher->AddBypassRule('login', 'login_user'); $dispatcher->AddBypassRule('logout', 'logout_user'); // Transform the event name into a template name. phalanx\views\View::set_template_path(dirname(__FILE__) . '/templates/%s.tpl'); phalanx\views\View::set_cache_path(dirname(__FILE__) . '/cache'); $view_handler->set_template_loader(function ($event_class) { $name = preg_replace('/Event$/', '', $event_class); return phalanx\base\CamelCaseToUnderscore($name); }); // Read the configuration file. $config_path = BUGDAR_ROOT . '/includes/config.php'; if (!file_exists($config_path) || !is_readable($config_path)) { throw new CoreException('Could not read configuration file'); } $config = new phalanx\base\KeyDescender(require $config_path); // Setup common functionality. Bugdar::BootstrapDatabase($config); Bugdar::BootstrapAuthentication($config); Bugdar::LoadSettings(); // Finally, begin processing events.