Exemple #1
0
 public function testConstructorUsesExistingPluginWhenPresent()
 {
     $plugin = new \Zend\Controller\Plugin\ActionStack();
     $this->front->registerPlugin($plugin);
     $helper = new Helper\ActionStack();
     $this->assertTrue($this->front->hasPlugin('Zend\\Controller\\Plugin\\ActionStack'));
     $registered = $this->front->getPlugin('Zend\\Controller\\Plugin\\ActionStack');
     $this->assertSame($plugin, $registered);
 }
Exemple #2
0
 /**
  * init plugins
  * @return void
  */
 protected function _initPlugins()
 {
     # only embed the debugging plugin if application status is development or testing
     if ($this->applicationStatus == "development") {
         # embed the ZFDebug Plugin/console
         $debug = new ZFDebug_Controller_Plugin_Debug(array('jquery_path' => '', 'plugins' => array('Variables', 'File' => array('basePath' => APPLICATION_PATH), 'Memory', 'Time', 'Html', 'Exception')));
         $this->frontController->registerPlugin($debug);
     }
     # init error handler
     $this->frontController->throwExceptions(false);
     $errorhandler = new Zend_Controller_Plugin_ErrorHandler();
     $errorhandler->setErrorHandler(array('module' => 'cms', 'controller' => 'error', 'action' => 'error'));
     $this->frontController->registerPlugin($errorhandler);
     # gadget plugin
     $gadgetPlugin = new FansubCMS_Controller_Plugin_Gadget();
     $this->frontController->registerPlugin($gadgetPlugin);
     # not-logged-in-so-go-to-login plugin
     $aclPlugin = new FansubCMS_Controller_Plugin_Acl(Zend_Auth::getInstance()->setStorage(new FansubCMS_Auth_Storage_DoctrineSession()));
     $this->frontController->registerPlugin($aclPlugin);
     # check if install or update is needed
     $installPlugin = new FansubCMS_Controller_Plugin_InstallCheck();
     $this->frontController->registerPlugin($installPlugin);
     # the navigation plugin
     $navPlugin = new FansubCMS_Controller_Plugin_Navigation();
     $this->frontController->registerPlugin($navPlugin);
 }
Exemple #3
0
 /**
  * Initialize plugins
  *
  * @return void
  */
 public function initPlugins()
 {
     $this->_front->registerPlugin(new UGD_Login_Plugin());
     $layoutController = new Util_Layout();
     $layoutController->registerModuleLayout('admin', $this->_root . '/application/admin/layouts', 'admin');
     $this->_front->registerPlugin($layoutController, -999);
 }
 public function testUsingFrontController()
 {
     $controller = new Zend_Controller_Front();
     $controller->setControllerDirectory(dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . '_files');
     $request = new Zend_Controller_Request_Http('http://framework.zend.com/empty');
     $controller->setResponse(new Zend_Controller_Response_Cli());
     $controller->setRouter(new Zend_Controller_Router());
     $plugin = new Zend_Controller_Plugin_BrokerTest_TestPlugin();
     $controller->registerPlugin($plugin);
     $response = $controller->dispatch($request);
     $this->assertEquals('123456', $response->getBody());
     $this->assertEquals('123456', $plugin->getResponse()->getBody());
 }
 public function run()
 {
     $this->init();
     foreach ($this->config['plugins'] as $name => $config) {
         include_once $name . '.php';
         $plugin = new $name($config);
         $this->frontController->registerPlugin($plugin);
     }
     try {
         $__start = getmicrotime();
         $this->frontController->dispatch();
         za()->recordStat('za::dispatch', getmicrotime() - $__start);
     } catch (Exception $e) {
         // record the current _GET and _POST variables
         $this->logger->err("Dispatch failed for " . current_url() . ": " . $e->getMessage() . ", get and post to follow");
         $this->logger->err(print_r($_REQUEST, true));
         throw $e;
     }
 }
Exemple #6
0
 public function registerFriendlyurlsPlugin()
 {
     $this->frontController->registerPlugin(new Sydney_Controller_Plugin_Friendlyurls());
 }
Exemple #7
0
 /**
  * Initialize plugins 
  * 
  * @return void
  */
 public function initPlugins()
 {
     /* Modular Models Directory plugin */
     $this->_front->registerPlugin(new ModularModelsDirectory());
 }
Exemple #8
0
 /**
  * Initialize plugins
  *
  * @return void
  */
 public function initPlugins()
 {
     $this->_front->registerPlugin(new ZFB_Controller_Plugin_ViewSetup());
     $this->_front->registerPlugin(new ZFB_Controller_Plugin_ActionStack());
 }