Пример #1
0
 protected function _initAutoload()
 {
     $autoloader = new Zend_Application_Module_Autoloader(array('namespace' => 'Tweetist_', 'basePath' => APPLICATION_PATH));
     Zend_Controller_Action_HelperBroker::addPrefix('Tweetist_Controllers_Helpers');
     Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH . '/controllers/helpers');
     return $autoloader;
 }
Пример #2
0
 protected function _initAutoload()
 {
     Zend_Loader_Autoloader::getInstance()->registerNamespace('PHPExcel');
     Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH . '/helpers');
     $autoloader = new Zend_Loader_Autoloader_Resource(array('namespace' => 'Default', 'basePath' => APPLICATION_PATH, 'resourceTypes' => array('form' => array('path' => 'forms', 'namespace' => 'Form'), 'model' => array('path' => 'models', 'namespace' => 'Model'), 'service' => array('path' => 'services', 'namespace' => 'Service'))));
     return $autoloader;
 }
Пример #3
0
 public function init()
 {
     $registry = Zend_Registry::getInstance();
     $config = $registry->get("config");
     $sysCache = $registry->get("sysCache");
     $cacheFiles = new Ml_Cache_Files($sysCache);
     Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH . '/controllers/helpers');
     $frontController = $this->getBootstrap()->getResource('FrontController');
     $dispatcher = $frontController->getDispatcher();
     $request = $frontController->getRequest();
     $router = $frontController->getRouter();
     $router->removeDefaultRoutes();
     $compat = new Zend_Controller_Router_Route_Module(array(), $dispatcher, $request);
     $router->addRoute(HOST_MODULE, $compat);
     $routerConfig = $cacheFiles->getConfigIni(APPLICATION_PATH . '/configs/' . HOST_MODULE . 'Routes.ini');
     $router->addConfig($routerConfig, "apiroutes");
     Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH . '/modules/' . HOST_MODULE . '/controllers/helpers');
     $loadOauthStore = Zend_Controller_Action_HelperBroker::getStaticHelper("LoadOauthstore");
     $loadOauthStore->setinstance();
     $loadOauthStore->preloadServer();
     $frontController->setBaseUrl($config['apiroot'])->setParam('noViewRenderer', true)->addModuleDirectory(APPLICATION_PATH . '/modules')->addControllerDirectory(APPLICATION_PATH . '/modules/' . HOST_MODULE . '/controllers');
     $response = new Zend_Controller_Response_Http();
     if (filter_input(INPUT_GET, "responseformat", FILTER_UNSAFE_RAW) == 'json') {
         $contentType = 'application/json';
     } else {
         $contentType = 'text/xml';
     }
     $response->setHeader('Content-Type', $contentType . '; charset=utf-8', true);
     $frontController->setResponse($response);
 }
Пример #4
0
 public function init()
 {
     $path = APPLICATION_PATH . '/application/modules/SocialConnect/Controller/Action/Helper/';
     $prefix = 'SocialConnect_Controller_Action_Helper_';
     $this->view->addScriptPath(APPLICATION_PATH . '/application/modules/User/views/scripts');
     Zend_Controller_Action_HelperBroker::addPath($path, $prefix);
 }
 public function routeStartup(Zend_Controller_Request_Abstract $request)
 {
     $front = Zend_Controller_Front::getInstance();
     $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
     if (!isset($viewRenderer->view)) {
         $viewRenderer->initView();
     }
     $view = $viewRenderer->view;
     foreach ($front->getControllerDirectory() as $moduleName => $controllerPath) {
         $loader = new Zend_Application_Module_Autoloader(array('namespace' => ucfirst($moduleName), 'basePath' => dirname($controllerPath)));
         $loader->addResourceType('controller', 'controllers', 'Controller');
         $loader->addResourceType('constant', 'constants', 'Constant');
         $loader->addResourceType('php', 'phps', 'Php');
         $loader->addResourceType('validate', 'validates', 'Validate');
         $loader->addResourceType('module_helper', 'helpers', 'Helper');
         $loader->addResourceType('helper', 'controllers/helpers', 'Controller_Helper');
         Zend_Controller_Action_HelperBroker::addPath($controllerPath . DS . 'helpers', ucfirst($moduleName) . '_Controller_Helper_');
         $viewHelpers = array('View' => dirname($controllerPath) . DS . 'views' . DS . 'helpers', 'Display' => dirname($controllerPath) . DS . 'display' . DS . 'helpers');
         foreach ($viewHelpers as $directory => $viewHelper) {
             if (is_dir($viewHelper)) {
                 $view->addHelperPath($viewHelper);
                 $prefix = ucfirst($moduleName) . '_' . $directory . '_Helper';
                 $view->addHelperPath($viewHelper, $prefix);
             }
         }
     }
 }
Пример #6
0
 public function init()
 {
     $registry = Zend_Registry::getInstance();
     $config = $registry->get("config");
     $sysCache = $registry->get("sysCache");
     $cacheFiles = new Ml_Cache_Files($sysCache);
     Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH . '/controllers/helpers');
     $frontController = $this->getBootstrap()->getResource('FrontController');
     $dispatcher = $frontController->getDispatcher();
     $request = $frontController->getRequest();
     $router = $frontController->getRouter();
     $router->removeDefaultRoutes();
     //@todo remove this patched route module and use the original instead ASAP
     $compat = new Ml_Controller_Router_Route_Module(array(), $dispatcher, $request);
     $router->addRoute("default", $compat);
     $routerConfig = $cacheFiles->getConfigIni(APPLICATION_PATH . '/configs/' . HOST_MODULE . 'Routes.ini');
     $router->addConfig($routerConfig, "routes");
     $frontController->registerPlugin(new Ml_Plugins_ReservedUsernames());
     Zend_Controller_Action_HelperBroker::getStaticHelper("Redirector")->setPrependBase(false);
     $frontController->setBaseUrl($config['webroot']);
     $loader = new Zend_Loader_PluginLoader();
     $loader->addPrefixPath('Zend_View_Helper', EXTERNAL_LIBRARY_PATH . '/Zend/View/Helper/')->addPrefixPath('Ml_View_Helper', APPLICATION_PATH . '/views/helpers');
     $classFileIncCache = CACHE_PATH . '/PluginDefaultLoaderCache.php';
     if (file_exists($classFileIncCache)) {
         require $classFileIncCache;
     }
     Zend_Loader_PluginLoader::setIncludeFileCache($classFileIncCache);
     $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
     $viewRenderer->initView();
 }
Пример #7
0
 /**
  * Initialize Init Helper and Layout Plugin
  */
 protected function _initHelper()
 {
     $initHelper = new App_Controller_Plugin_Helper_Init();
     Zend_Controller_Action_HelperBroker::addHelper($initHelper);
     Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH . '/controllers/helpers');
     //$front = Zend_Controller_Front::getInstance();
     //$front->registerPlugin(new App_Controller_Plugin_SelectLayout());
 }
Пример #8
0
 private static function _initLibrary()
 {
     // Register the ZFE controller plugins as helpers
     Zend_Controller_Action_HelperBroker::addPath(ZFE_Environment::getLibraryPath() . '/Controller/Helpers', 'ZFE_Controller_Helper');
     // Load the ZFE_Plugin_ActiveModule plugin
     self::$bootstrap->bootstrap('FrontController');
     $front = self::$bootstrap->getResource('FrontController');
     $front->registerPlugin(new ZFE_Plugin_ActiveModule());
 }
Пример #9
0
 /**
  * Load essential Garp Helpers
  *
  * @return void
  */
 protected function _initEssentialGarpHelpers()
 {
     // Action helpers
     Zend_Controller_Action_HelperBroker::addPath(GARP_APPLICATION_PATH . '/../library/Garp/Controller/Helper', 'Garp_Controller_Helper');
     Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH . '/../library/App/Controller/Helper', 'App_Controller_Helper');
     // View helpers
     $this->bootstrap('View');
     $this->getResource('View')->addHelperPath(GARP_APPLICATION_PATH . '/modules/g/views/helpers', 'G_View_Helper');
     $this->getResource('View')->addHelperPath(APPLICATION_PATH . '/modules/default/views/helpers', 'App_View_Helper');
 }
Пример #10
0
 public function _initLoadHelper()
 {
     Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH . '/modules/front/views/helpers');
     Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH . '/modules/danhsach/views/helpers');
     Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH . '/modules/hethong/views/helpers');
     Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH . '/modules/canhan/views/helpers');
     Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH . '/modules/tochuccanbo/views/helpers');
     Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH . '/modules/front/controllers/helpers');
     Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH . '/helpers', '');
 }
 protected function _initActionHelpers()
 {
     // path for module-specific controller helpers
     Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH . '/modules/auth/controllers/helpers', 'Auth_Controller_Helper_');
     // initialize the event helper with entity manager
     $this->bootstrap('autoload');
     $application = $this->getApplication();
     $application->bootstrap('doctrine');
     if (isset($application->_registry->doctrine->_em)) {
         Auth_Controller_Helper_Event::$defaultEntityManager = $application->_registry->doctrine->_em;
     }
 }
Пример #12
0
 private static function setupController()
 {
     // setup controller
     $frontController = Zend_Controller_Front::getInstance();
     $frontController->throwExceptions(true);
     $frontController->setControllerDirectory('./application/controllers');
     $baseURL = substr($_SERVER['PHP_SELF'], 0, strpos($_SERVER['PHP_SELF'], '/index.php'));
     $frontController->setbaseUrl($baseURL);
     Zend_Controller_Action_HelperBroker::addPath('helpers', 'MyActionHelpers');
     // run!
     $frontController->dispatch();
 }
Пример #13
0
 protected function _initView()
 {
     // Initialize view
     $view = new Zend_View();
     $view->doctype('XHTML1_STRICT');
     $view->setEncoding('utf-8');
     $view->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=utf-8');
     // Add it to the ViewRenderer
     $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
     $viewRenderer->setView($view);
     Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH . '/controllers/helpers');
     // Return it, so that it can be stored by the bootstrap
     return $view;
 }
Пример #14
0
 public function init()
 {
     $this->_initDbHelper();
     $this->_initViewRenderer();
     $this->_initResponseContexts();
     // The ACL helper should not be loaded during REST API requests.
     // Otherwise, Omeka may attempt to redirect to users/login when it
     // appears that a controller/action combination is protected.
     $front = Zend_Controller_Front::getInstance();
     if (!$front->getParam('api')) {
         $this->_initAclHelper();
     }
     Zend_Controller_Action_HelperBroker::addPath(APP_DIR . '/controllers/helpers', 'Omeka_Controller_Action_Helper');
 }
Пример #15
0
 protected function _initFrontController()
 {
     $frontController = Zend_Controller_Front::getInstance();
     $frontController->setControllerDirectory(APPLICATION_PATH . '/controllers');
     $frontController->setParam('env', APPLICATION_ENV);
     //$frontController->setParam('config',$this->_config);
     $frontController->setRequest(new Zend_Controller_Request_Http());
     // action helpers
     Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH . '/controllers/helpers');
     $actionStack = Zend_Controller_Action_HelperBroker::getStaticHelper('actionStack');
     $actionStack->actionToStack('zoneHeaderOut', 'zone');
     $actionStack->actionToStack('navigation', 'global');
     $actionStack->actionToStack('banner', 'global', '');
     $actionStack->actionToStack('zoneHeaderIn', 'zone');
     //        Zend_Debug::dump($actionStack);
 }
Пример #16
0
 protected function _initFrontController()
 {
     Zend_Controller_Action_HelperBroker::addPath("Khcn/Controller/Action/Helper/", 'Khcn_Controller_Action_Helper');
     $frontController = Zend_Controller_Front::getInstance();
     $frontController->setDefaultModule('default')->setParam('viewSuffix', 'phtml')->setParam('prefixDefaultModule', 'true');
     // Add our special path for action helpers
     $this->initActionHelperPath();
     // Our virtual index hack confuses the request class, this other hack will
     // make it think it's in the root folder
     $request = new Zend_Controller_Request_Http();
     $script = $_SERVER['SCRIPT_NAME'];
     $_SERVER['SCRIPT_NAME'] = str_replace('/application/', '/', $script);
     $frontController->setBaseUrl($request->getBaseUrl());
     $_SERVER['SCRIPT_NAME'] = $script;
     // Save to registy and local container
     Zend_Registry::set('Zend_Controller_Front', $frontController);
     return $frontController;
 }
Пример #17
0
 public function __construct($configSection)
 {
     $rootDir = dirname(dirname(__FILE__));
     define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
     define('APPLICATION_ENV', getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production');
     set_include_path(implode(PATH_SEPARATOR, array(realpath(APPLICATION_PATH . '/../library'), realpath(APPLICATION_PATH . '/../library/Swift/lib/classes'), realpath(APPLICATION_PATH . '/../data'), get_include_path())) . ":" . realpath(APPLICATION_PATH . '/models') . ":" . realpath(APPLICATION_PATH . '/forms'));
     include_once 'Zend/Loader/Autoloader.php';
     $loader = Zend_Loader_Autoloader::getInstance();
     $loader->setFallbackAutoloader(true);
     $loader->suppressNotFoundWarnings(false);
     // start using session
     Zend_Session::start();
     // Initialise Zend_Layout's MVC helpers
     Zend_Layout::startMvc(array('layoutPath' => APPLICATION_PATH . '/layouts/scripts'));
     // load configuration
     Zend_Registry::set('configSection', $configSection);
     $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', $configSection);
     Zend_Registry::set('config', $config);
     Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH . '/controllers/helpers');
     $view = new Zend_View();
     $view->addHelperPath(APPLICATION_PATH . '/views/helpers');
     date_default_timezone_set($config->date_default_timezone);
     // set up database
     //$db = Zend_Db::factory ( $config->resources->db->adapter, $config->resources->db->params->toArray () );
     //Zend_Db_Table::setDefaultAdapter ( $db );
     //Zend_Registry::set ( 'db', $db );
     //$db->query ( "SET NAMES utf8" );
     $options = array(Zend_Db::ALLOW_SERIALIZATION => false);
     $params = array('host' => $config->resources->db->params->hostname, 'username' => $config->resources->db->params->username, 'password' => $config->resources->db->params->password, 'dbname' => $config->resources->db->params->dbname, 'charset' => $config->resources->db->params->charset, 'options' => $options);
     $db = Zend_Db::factory($config->resources->db->adapter, $params);
     Zend_Db_Table::setDefaultAdapter($db);
     Zend_Registry::set('db', $db);
     $db->query("SET NAMES utf8");
     $languageFile = '../application/configs/cn_form.php';
     Zend_Registry::set('languageFile', $languageFile);
 }
Пример #18
0
 protected function _initFront()
 {
     Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH . '/controllers/helpers');
     $front = Zend_Controller_Front::getInstance();
     $router = $front->getRouter();
     //set the language route url (the default also)
     $routeLang = new Zend_Controller_Router_Route(':language/:controller/:action/*', array('language' => null, 'controller' => 'index', 'action' => 'index'));
     $routeWoeid = new Zend_Controller_Router_Route(':language/woeid/:woeid/:ad_type/*', array('language' => null, 'controller' => 'ad', 'action' => 'list'));
     $routeProfile = new Zend_Controller_Router_Route(':language/profile/:id', array('language' => null, 'controller' => 'user', 'action' => 'profile'));
     $routeAd = new Zend_Controller_Router_Route(':language/ad/:id/*', array('language' => null, 'controller' => 'ad', 'action' => 'show'));
     $routeAdAll = new Zend_Controller_Router_Route(':language/ad/listall/*', array('language' => null, 'controller' => 'ad', 'action' => 'listall'));
     $routeAdListUSer = new Zend_Controller_Router_Route(':language/ad/listuser/*', array('language' => null, 'controller' => 'ad', 'action' => 'listuser'));
     $routeAdCreate = new Zend_Controller_Router_Route(':language/ad/create/*', array('language' => null, 'controller' => 'ad', 'action' => 'create'));
     $routeAdEdit = new Zend_Controller_Router_Route(':language/ad/edit/*', array('language' => null, 'controller' => 'ad', 'action' => 'edit'));
     $routeAdDelete = new Zend_Controller_Router_Route(':language/ad/delete/*', array('language' => null, 'controller' => 'ad', 'action' => 'delete'));
     $routeMessageReply = new Zend_Controller_Router_Route(':language/message/reply/:id/*', array('language' => null, 'controller' => 'message', 'action' => 'reply'));
     $routeMessageShow = new Zend_Controller_Router_Route(':language/message/show/:id/*', array('language' => null, 'controller' => 'message', 'action' => 'show'));
     $routeMessageList = new Zend_Controller_Router_Route(':language/message/list/*', array('language' => null, 'controller' => 'message', 'action' => 'list'));
     $routeMessageDelete = new Zend_Controller_Router_Route(':language/message/delete/:id/*', array('language' => null, 'controller' => 'message', 'action' => 'delete'));
     $router->addRoute('default', $routeLang);
     //important, put the default route first!
     $router->addRoute('woeid/woeid/ad_type', $routeWoeid);
     $router->addRoute('profile/id', $routeProfile);
     $router->addRoute('ad/id', $routeAd);
     $router->addRoute('ad/listall', $routeAdAll);
     $router->addRoute('ad/listuser', $routeAdListUSer);
     $router->addRoute('ad/create', $routeAdCreate);
     $router->addRoute('ad/edit', $routeAdEdit);
     $router->addRoute('ad/delete', $routeAdDelete);
     $router->addRoute('message/reply', $routeMessageReply);
     $router->addRoute('message/show', $routeMessageShow);
     $router->addRoute('message/list', $routeMessageList);
     $router->addRoute('message/delete', $routeMessageDelete);
     $front->setRouter($router);
     return $front;
 }
Пример #19
0
 /**
  * Adds the action helper path for this module to the front controller
  */
 public function initActionHelperPath()
 {
     // Set up path
     $path = $this->getModulePath() . '/Controller/Action/Helper/';
     $prefix = ucfirst($this->getModuleName()) . '_Controller_Action_Helper_';
     Zend_Controller_Action_HelperBroker::addPath($path, $prefix);
 }
Пример #20
0
 /**
  * Initialize Front Controller
  *
  * @return Zend_Controller_Front
  * @throws Zend_Application_Exception
  */
 public function init()
 {
     $front = $this->getFrontController();
     foreach ($this->getOptions() as $key => $value) {
         switch (strtolower($key)) {
             case 'controllerdirectory':
                 if (is_string($value)) {
                     $front->setControllerDirectory($value);
                 } elseif (is_array($value)) {
                     foreach ($value as $module => $directory) {
                         $front->addControllerDirectory($directory, $module);
                     }
                 }
                 break;
             case 'modulecontrollerdirectoryname':
                 $front->setModuleControllerDirectoryName($value);
                 break;
             case 'moduledirectory':
                 if (is_string($value)) {
                     $front->addModuleDirectory($value);
                 } elseif (is_array($value)) {
                     foreach ($value as $moduleDir) {
                         $front->addModuleDirectory($moduleDir);
                     }
                 }
                 break;
             case 'defaultcontrollername':
                 $front->setDefaultControllerName($value);
                 break;
             case 'defaultaction':
                 $front->setDefaultAction($value);
                 break;
             case 'defaultmodule':
                 $front->setDefaultModule($value);
                 break;
             case 'baseurl':
                 if (!empty($value)) {
                     $front->setBaseUrl($value);
                 }
                 break;
             case 'params':
                 $front->setParams($value);
                 break;
             case 'plugins':
                 foreach ((array) $value as $pluginClass) {
                     $stackIndex = null;
                     if (is_array($pluginClass)) {
                         $pluginClass = array_change_key_case($pluginClass, CASE_LOWER);
                         if (isset($pluginClass['class'])) {
                             if (isset($pluginClass['stackindex'])) {
                                 $stackIndex = $pluginClass['stackindex'];
                             }
                             $pluginClass = $pluginClass['class'];
                         }
                     }
                     $plugin = new $pluginClass();
                     $front->registerPlugin($plugin, $stackIndex);
                 }
                 break;
             case 'returnresponse':
                 $front->returnResponse((bool) $value);
                 break;
             case 'throwexceptions':
                 $front->throwExceptions((bool) $value);
                 break;
             case 'actionhelperpaths':
                 if (is_array($value)) {
                     foreach ($value as $helperPrefix => $helperPath) {
                         Zend_Controller_Action_HelperBroker::addPath($helperPath, $helperPrefix);
                     }
                 }
                 break;
             case 'dispatcher':
                 if (!isset($value['class'])) {
                     // require_once 'Zend/Application/Exception.php';
                     throw new Zend_Application_Exception('You must specify both ');
                 }
                 if (!isset($value['params'])) {
                     $value['params'] = array();
                 }
                 $dispatchClass = $value['class'];
                 if (!class_exists($dispatchClass)) {
                     // require_once 'Zend/Application/Exception.php';
                     throw new Zend_Application_Exception('Dispatcher class not found!');
                 }
                 $front->setDispatcher(new $dispatchClass((array) $value['params']));
                 break;
             default:
                 $front->setParam($key, $value);
                 break;
         }
     }
     if (null !== ($bootstrap = $this->getBootstrap())) {
         $this->getBootstrap()->frontController = $front;
     }
     return $front;
 }
Пример #21
0
 public function testHelperPathStackIsLifo()
 {
     Zend_Controller_Action_HelperBroker::addPath(dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'Helpers', 'MyApp');
     $urlHelper = Zend_Controller_Action_HelperBroker::getStaticHelper('url');
     $this->assertTrue($urlHelper instanceof MyApp_Url);
 }
Пример #22
0
 /**
  * Initialize action helpers
  *
  * @return void
  */
 public function initHelpers()
 {
     // register the default action helpers
     Zend_Controller_Action_HelperBroker::addPath('../application/default/helpers', 'Zend_Controller_Action_Helper');
 }
Пример #23
0
 protected function _initActionHelperBrokers()
 {
     Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH . '/modules/document/controllers/helpers', 'Document_Controller_Action_Helper_');
 }
Пример #24
0
 public function testCanLoadNamespacedHelper()
 {
     if (version_compare(PHP_VERSION, '5.3.0') === -1) {
         $this->markTestSkipped('Namespaces not available in PHP < 5.3.0');
     }
     $this->front->setControllerDirectory(dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . '_files')->setResponse(new Zend_Controller_Response_Cli())->returnResponse(true);
     $path = dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . '_files/Helpers';
     Zend_Controller_Action_HelperBroker::addPath($path, 'MyApp\\Controller\\Action\\Helper\\');
     $request = new Zend_Controller_Request_Http('http://framework.zend.com/helper-broker/test-can-load-namespaced-helper/');
     $response = $this->front->dispatch($request);
     $this->assertEquals('MyApp\\Controller\\Action\\Helper\\NamespacedHelper', $response->getBody());
 }
Пример #25
0
 /**
  * Set helper broker paths
  *
  * @param Zend_Config $paths
  */
 protected function _setHelperBrokerPaths(Zend_Config $paths)
 {
     foreach ($paths as $pathConfig) {
         $path = isset($pathConfig->path) ? $pathConfig->get('path') : null;
         $prefix = isset($pathConfig->prefix) ? $pathConfig->get('prefix') : null;
         if ($path === null) {
             continue;
         }
         if ($prefix === null) {
             Zend_Controller_Action_HelperBroker::addPath($path);
         } else {
             Zend_Controller_Action_HelperBroker::addPath($path, $prefix);
         }
     }
 }
Пример #26
0
 public function _initLoader()
 {
     Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH . '/controllers/helpers');
 }
Пример #27
0
 public function _initActionHelpers()
 {
     // register the OpenSKOS action helpers
     Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH . '/../library/OpenSKOS/Controller/Action/Helper', 'OpenSKOS_Controller_Action_Helper');
 }
Пример #28
0
 /**
  * init helper classes
  *
  * @return void
  */
 protected function _initHelper()
 {
     Zend_Controller_Action_HelperBroker::addPath(Zend_Registry::get('config')->helpers->path, 'Helper');
 }
Пример #29
0
Zend_Loader::loadClass('Zend_Controller_Action_Helper_Abstract');
Zend_Loader::loadClass('Zend_Controller_Action_HelperBroker');
Zend_Loader::loadClass('Zend_View_Helper_Abstract');
Zend_Loader::loadClass('Zend_View');
Zend_Loader::loadClass('Zend_Session');
Zend_Loader::loadClass('Zend_Session_Namespace');
Zend_Loader::loadClass('Zend_Layout');
Zend_Loader::loadClass('Zend_File_Transfer_Adapter_Http');
//StartMVC
$mvc_options = array('layout' => 'default', 'layoutPath' => '../app/views/layouts');
$layout = Zend_Layout::startMvc($mvc_options);
//Set up DB factory Config
$config = new Zend_Config(array('database' => array('adapter' => 'Mysqli', 'params' => array('host' => 'localhost', 'dbname' => 'project_manager', 'username' => 'root', 'password' => 'root'))));
//Start Session
Zend_Session::start();
//Set Database
$db = Zend_Db::factory($config->database);
Zend_DB_Table_Abstract::setDefaultAdapter($db);
//Register Helpers with Brokers
Zend_Controller_Action_HelperBroker::addPath('../app/helpers/actions', 'Helper_');
//Set View Helpers
$view = new Zend_View();
$view->addHelperPath('../app/helpers/views/', 'View_Helper_');
$renderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
$renderer->setView($view);
//Get Front Controller
$front = Zend_Controller_Front::getInstance();
//Set Controllers
$front->setControllerDirectory('../app/controllers');
$front->throwExceptions(false);
$front->dispatch();
Пример #30
0
 public function routeShutdown(Zend_Controller_Request_Abstract $request)
 {
     if ($request->module == 'processes') {
         Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH . '/modules/processes/controllers/helpers', 'Processes_Controller_Action_Helper_');
     }
 }