예제 #1
0
 public static function getInstance()
 {
     if (null === self::$_instance) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
예제 #2
0
 public static function setupFrontController()
 {
     $zmax_context = self::getRegistry()->get("zmax_context");
     $config = $zmax_context->config;
     $app_dir = self::getRoot() . 'application' . DIRECTORY_SEPARATOR;
     self::$frontController = Zmax_Controller_Front::getInstance();
     // Keep the front controller from sending exceptions
     self::$frontController->throwExceptions(false);
     // This tells where the controllers code can be found
     self::$frontController->setControllerDirectory(array('default' => $app_dir . 'controllers' . DIRECTORY_SEPARATOR, 'admin' => $app_dir . 'admin' . DIRECTORY_SEPARATOR . 'controllers' . DIRECTORY_SEPARATOR));
     // Set the error handler
     // PR: does not work, because it shows a warning when used
     // with Zend View and Zend_Layout ....
     if ($config->view->zmax_view_system == "phplib") {
         set_error_handler(array(self::$frontController, "errorHandler"));
     }
     // Change the error handler plugin, to forward exceptions
     // to the 'stalled' action of the index controller
     $eh = new Zend_Controller_Plugin_ErrorHandler();
     $eh->setErrorHandlerController('index')->setErrorHandlerAction('stalled');
     self::$frontController->registerPlugin($eh);
     // Remove all automatic escaping
     self::$frontController->normalizeHTTP();
     // Set the base url
     self::$frontController->setBaseUrl();
 }
예제 #3
0
 function baseUrl()
 {
     $fc = Zmax_Controller_Front::getInstance();
     return $fc->getBaseUrl();
 }