示例#1
0
 public function setUp()
 {
     phalanx\events\EventPump::set_pump(new \phalanx\events\EventPump());
     phalanx\events\EventPump::Pump()->set_output_handler(new phalanx\events\UnitTestOutputHandler());
     Bugdar::$auth = NULL;
 }
示例#2
0
 public function Fire()
 {
     phalanx\events\EventPump::Pump()->CancelDeferredEvents();
 }
示例#3
0
 public function Cleanup()
 {
     phalanx\events\EventPump::Pump()->StopPump();
 }
示例#4
0
 protected function _PerformLogin()
 {
     phalanx\events\EventPump::Pump()->RaiseEvent(new UserLoginEvent());
     phalanx\events\EventPump::Pump()->StopPump();
 }
示例#5
0
文件: index.php 项目: rsesek/Bugdar2
$pump = phalanx\events\EventPump::Pump();
// Use the Views system to render output.
// TODO: enable webservice and CLI.
$pump->set_output_handler($view_handler);
// Events are named in reverse order to be more human readable. Rather than
// user_register, it's register_user. After reversing the components, events
// are loaded from the events/ directory. The class name is the CammelCase
// version of the underscored name, suffixed by the word 'Event'.
$dispatcher->set_event_loader(function ($name) {
    $name = preg_replace('/[^a-z0-9_\\-\\.]/i', '', $name);
    $parts = explode('_', $name);
    $parts = array_reverse($parts);
    $name = implode('_', $parts);
    $path = "./events/{$name}.php";
    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) {
示例#6
0
 public function Fire()
 {
     header("Location: {$this->location}");
     phalanx\events\EventPump::Pump()->Terminate();
 }