File indexing completed on 2024-12-22 05:33:30

0001 <?php
0002 /**
0003  *  ocs-webserver
0004  *
0005  *  Copyright 2016 by pling GmbH.
0006  *
0007  *    This file is part of ocs-webserver.
0008  *
0009  *    This program is free software: you can redistribute it and/or modify
0010  *    it under the terms of the GNU Affero General Public License as
0011  *    published by the Free Software Foundation, either version 3 of the
0012  *    License, or (at your option) any later version.
0013  *
0014  *    This program is distributed in the hope that it will be useful,
0015  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
0016  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0017  *    GNU Affero General Public License for more details.
0018  *
0019  *    You should have received a copy of the GNU Affero General Public License
0020  *    along with this program.  If not, see <http://www.gnu.org/licenses/>.
0021  **/
0022 
0023 class Backend_Bootstrap extends Zend_Application_Module_Bootstrap
0024 {
0025 
0026     protected function _initAutoloader()
0027     {
0028         $autoloader = new Zend_Application_Module_Autoloader(array(
0029             'namespace' => 'Backend',
0030             'basePath' => realpath(dirname(__FILE__)),
0031         ));
0032         $autoloader
0033             ->addResourceType('element', 'forms/elements', 'Form_Element')
0034             ->addResourceType('other', 'forms/other', 'Form_Other')
0035             ->addResourceType('commands', 'library/backend/commands', 'Commands')
0036         ;
0037         return $autoloader;
0038     }
0039 
0040     protected function _initPluginLoader()
0041     {
0042         $pluginLoader = new Zend_Loader_PluginLoader();
0043         $pluginLoader->addPrefixPath('Backend_Form_Element', APPLICATION_PATH . '/modules/backend/forms/elements/');
0044         return $pluginLoader;
0045     }
0046 
0047     /**
0048      * @return false|mixed|Zend_Config
0049      * @throws Zend_Exception
0050      * @todo: When the storm is over let's check if we really need this. In usual cases we don't need this.
0051      */
0052 //    protected function _initConfig()
0053 //    {
0054 //      if (Zend_Registry::isRegistered('cache')) {
0055 //        /** @var Zend_Cache_Core $cache */
0056 //        $cache = Zend_Registry::get('cache');
0057 //
0058 //        if (false == ($config = $cache->load('application_config'))) {
0059 //          $config = new Zend_Config($this->getOptions(), true);
0060 //          $cache->save($config, 'application_config', array(), 14400);
0061 //        }
0062 //      } else {
0063 //        $config = new Zend_Config($this->getOptions(), true);
0064 //      }
0065 //
0066 //      Zend_Registry::set('config', $config);
0067 //      return $config;
0068 //    }
0069 
0070     protected function _initIncludePath () {
0071         set_include_path(implode(PATH_SEPARATOR, array(
0072             dirname(__FILE__) . '/library',
0073             get_include_path(),
0074         )));
0075     }
0076     
0077 }
0078