Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Application bootstrap
- *
- * @uses Zend_Application_Bootstrap_Bootstrap
- * @package QuickStart
- */
- class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
- {
- /**
- * Bootstrap autoloader for application resources
- *
- * @return Zend_Application_Module_Autoloader
- */
- protected function _initAutoload ()
- {
- $autoloader = new Zend_Application_Module_Autoloader(array('namespace' => 'Default' , 'supressNotFoundWarnings' => false , 'basePath' => dirname(__FILE__)));
- return $autoloader;
- }
- /**
- * Bootstrap the view doctype
- *
- * @return void
- */
- protected function _initDoctype ()
- {
- $this->bootstrap('view');
- $view = $this->getResource('view');
- $view->doctype('HTML5');
- }
- public function _initRoutes ()
- {
- $front = Zend_Controller_Front::getInstance();
- $router = $front->getRouter();
- $route1 = new Zend_Controller_Router_Route('ads/:subject', array('controller' => 'ads' , 'action' => 'index'));
- $route2 = new Zend_Controller_Router_Route('ads/:subject/:province', array('controller' => 'ads' , 'action' => 'index'));
- $route3 = new Zend_Controller_Router_Route('ads/:subject/:province/:city', array('controller' => 'ads' , 'action' => 'index'));
- $route10 = new Zend_Controller_Router_Route_Static('ads/sign', array('controller' => 'ads' , 'action' => 'sign'));
- $adspages = new Zend_Controller_Router_Route('ads/:page', array('controller' => 'ads' , 'action' => 'index'), array('page' => '[0-9]'));
- $router->addRoute('subject', $route1);
- $router->addRoute('province', $route2);
- $router->addRoute('city', $route3);
- $router->addRoute('ads', $route10);
- $router->addRoute('adspages', $adspages);
- }
- protected function _initZFDebug ()
- {
- if (APPLICATION_ENV == "development") {
- $autoloader = Zend_Loader_Autoloader::getInstance();
- $autoloader->registerNamespace('ZFDebug');
- $options = array('plugins' => array('Variables' , 'File' => array('base_path' => 'APPLICATION_PATH') , 'Memory' , 'Time' , 'Registry' , 'Exception'));
- # Instantiate the database adapter and setup the plugin.
- # Alternatively just add the plugin like above and rely on the autodiscovery feature.
- if ($this->hasPluginResource('db')) {
- $this->bootstrap('db');
- $db = $this->getPluginResource('db')->getDbAdapter();
- $options['plugins']['Database']['adapter'] = $db;
- }
- # Setup the cache plugin
- if ($this->hasPluginResource('cache')) {
- $this->bootstrap('cache');
- $cache = $this->getPluginResource('cache')->getDbAdapter();
- $options['plugins']['Cache']['backend'] = $cache->getBackend();
- }
- $debug = new ZFDebug_Controller_Plugin_Debug($options);
- $this->bootstrap('frontController');
- $frontController = $this->getResource('frontController');
- $frontController->registerPlugin($debug);
- }
- }
- protected function _initViewHelpers ()
- {
- $this->bootstrap('view');
- $view = $this->getResource('view');
- $view->addHelperPath('ZendX/JQuery/View/Helper', 'ZendX_Jquery_View_Helper');
- }
- }
Add Comment
Please, Sign In to add comment