예제 #1
0
 protected function tearDown()
 {
     if (class_exists('Doctrine_Core')) {
         // empty account table
         Doctrine_Core::getTable('Account')->createQuery()->delete()->execute();
     }
     // unregister doctrine namespace
     $this->classLoader->unregisterNamespace('Doctrine_');
 }
예제 #2
0
 protected function tearDown()
 {
     if (class_exists('Doctrine_Core')) {
         // close sqlite connection
         Doctrine_Manager::connection()->close();
     }
     // unregister doctrine namespace
     $this->classLoader->unregisterNamespace('Doctrine_');
 }
 public function _initAutoloaderNamespaces()
 {
     require_once APPLICATION_PATH . '/../library/vendor/Doctrine/lib/vendor/doctrine-common/lib/Doctrine/Common/ClassLoader.php';
     $autoloader = \Zend_Loader_Autoloader::getInstance();
     $fmmAutoloader = new \Doctrine\Common\ClassLoader('Bisna');
     $autoloader->pushAutoloader(array($fmmAutoloader, 'loadClass'), 'Bisna');
 }
예제 #4
0
 public function init()
 {
     $options = $this->getOptions();
     if (isset($options['base_path'])) {
         $autoloader = Zend_Loader_Autoloader::getInstance();
         $autoloader->registerNamespace('ZFDebug');
         $options = array('plugins' => array('Variables', 'File' => array('base_path' => $options['base_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);
     }
 }
예제 #5
0
 protected function _initAutoload()
 {
     $moduleLoader = new Zend_Application_Module_Autoloader(array('namespace' => '', 'basePath' => APPLICATION_PATH));
     $loader = Zend_Loader_Autoloader::getInstance();
     $loader->registerNamespace(array('Flux_', 'Iste_', 'Spip_'));
     return $moduleLoader;
 }
예제 #6
0
 /**
  * _initAutoLoader
  *
  * @return Zend_Loader_Autoloader
  */
 public function _initAutoLoader()
 {
     $autoloader = Zend_Loader_Autoloader::getInstance();
     $resourceLoader = new Zend_Loader_Autoloader_Resource(array('basePath' => APPLICATION_PATH, 'namespace' => 'Application', 'resourceTypes' => array('plugin' => array('path' => 'plugins/', 'namespace' => 'Plugin'), 'form' => array('path' => 'forms/', 'namespace' => 'Form'), 'model' => array('path' => 'models/', 'namespace' => 'Model'))));
     $autoloader->pushAutoloader($resourceLoader);
     return $autoloader;
 }
예제 #7
0
 public static function run()
 {
     #echo get_include_path();
     #exit();
     try {
         // 設定ファイル読み込み
         $config = new Zend_Config_Ini(INSTALL_DIR . 'application/configs/config.ini', 'production');
         // Zend_Loader の設定(ファイル自動読み込み)
         require_once 'Zend/Loader/Autoloader.php';
         $loader = Zend_Loader_Autoloader::getInstance();
         $loader->setFallbackAutoloader(true);
         Zend_Registry::set($config->registry->config, $config);
         $view = new Tokyofr_View_Smarty($config->smarty->template_dir, $config->smarty->toArray());
         $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
         $viewRenderer->setView($view)->setViewBasePathSpec($view->getEngine()->template_dir[0]);
         $viewRenderer->setViewScriptPathSpec(':controller/:action.:suffix');
         $viewRenderer->setViewScriptPathNoControllerSpec(':action.:suffix');
         $viewRenderer->setViewSuffix('phtml');
         Tokyofr_Controller_Front::run($config->path->controller);
     } catch (Zend_Exception $e) {
         //var_dump($e->getMessage());
         exit("error.");
     } catch (Exception $e) {
         //var_dump($e->getMessage());
         exit('error02');
     }
 }
 /**
  * autoload
  * @author Cornelius Hansjakob <*****@*****.**>
  * @version 1.0
  */
 public static function autoload($class)
 {
     try {
         $sysConfig = Zend_Registry::get('SysConfig');
         $zooConfig = Zend_Registry::get('ZooConfig');
         $webConfig = Zend_Registry::get('WebConfig');
         if (strpos($class, 'Zend_') === false && strpos($class, 'ZendX_') === false) {
             /**
              * check if given $className exists and file exists
              */
             if (array_key_exists($class, self::$arrClasses)) {
                 if (file_exists(GLOBAL_ROOT_PATH . $sysConfig->path->root . self::$arrClasses[$class])) {
                     require_once GLOBAL_ROOT_PATH . $sysConfig->path->root . self::$arrClasses[$class];
                 }
             }
         } else {
             /**
              * load Zend Class
              */
             parent::autoload($class);
         }
         return $class;
     } catch (Exception $e) {
         return false;
     }
 }
예제 #9
0
 protected function _initDoctrine()
 {
     require_once LIBRARY_PATH . '/Doctrine/Common/ClassLoader.php';
     $autoloader = \Zend_Loader_Autoloader::getInstance();
     $fmmAutoloader = new \Doctrine\Common\ClassLoader();
     $autoloader->pushAutoloader(array($fmmAutoloader, 'loadClass'));
     $options = $this->getOptions();
     $config = new Doctrine\ORM\Configuration();
     $config->addCustomDatetimeFunction('YEAR', 'Doctrine\\Extensions\\Query\\Mysql\\Year');
     $config->addCustomDatetimeFunction('MONTH', 'Doctrine\\Extensions\\Query\\Mysql\\Month');
     $config->addCustomDatetimeFunction('DAY', 'Doctrine\\Extensions\\Query\\Mysql\\Day');
     $config->addCustomStringFunction('DATEDIFF', 'Doctrine\\Extensions\\Query\\Mysql\\DateDiff');
     $config->addCustomStringFunction('DATE_FORMAT', 'Doctrine\\Extensions\\Query\\Mysql\\DateFormat');
     $config->addCustomStringFunction('IF', 'Doctrine\\Extensions\\Query\\Mysql\\IfElse');
     $config->addCustomStringFunction('GROUP_CONCAT', 'Doctrine\\Extensions\\Query\\Mysql\\GroupConcat');
     $config->addCustomStringFunction('IFNULL', 'Doctrine\\Extensions\\Query\\Mysql\\IfNull');
     $config->setProxyDir($options['doctrine']['metadata']['proxyDir']);
     $config->setProxyNamespace('Doctrine\\Proxy');
     $config->setAutoGenerateProxyClasses(true);
     $config->setAutoGenerateProxyClasses(APPLICATION_ENV == 'development');
     //$driverImpl = $config->newDefaultAnnotationDriver($options['metadata']['entityDir']);
     $driverImpl = new Doctrine\ORM\Mapping\Driver\YamlDriver($options['doctrine']['metadata']['entityDir']);
     $config->setMetadataDriverImpl($driverImpl);
     $cache = new Doctrine\Common\Cache\ArrayCache();
     $config->setMetadataCacheImpl($cache);
     $config->setQueryCacheImpl($cache);
     $evm = new Doctrine\Common\EventManager();
     $em = Doctrine\ORM\EntityManager::create($options['doctrine']['db'], $config, $evm);
     Zend_Registry::set('doctrine', $em);
     return $em;
 }
예제 #10
0
 protected function _initCustomUrls()
 {
     $this->bootstrap('frontController');
     Zend_Loader_Autoloader::getInstance()->registerNamespace('Customurl')->registerNamespace('Customurl');
     $plugin = new Customurl_ControllerPlugin();
     $this->getResource('frontController')->registerPlugin($plugin);
 }
예제 #11
0
파일: DB.php 프로젝트: Maxlander/shixi
 public static function init($_host, $_user, $_pass, $dbname)
 {
     if (!isset($_host)) {
         $_host = SJB_System::getSystemSettings('DBHOST');
     }
     if (!isset($_user)) {
         $_user = SJB_System::getSystemSettings('DBUSER');
     }
     if (!isset($_pass)) {
         $_pass = SJB_System::getSystemSettings('DBPASSWORD');
     }
     if (!isset($dbname)) {
         $dbname = SJB_System::getSystemSettings('DBNAME');
     }
     $loader = Zend_Loader_Autoloader::getInstance();
     $loader->registerNamespace('Zend');
     $db = new Adapter(array('driver' => self::getDBAdapter(), 'host' => $_host, 'database' => $dbname, 'username' => $_user, 'password' => $_pass, 'options' => array('buffer_results' => true)));
     try {
         $connection = $db->driver->getConnection();
         $connection->connect();
         $sql = new Sql($db);
         Zend_Registry::set('db', $db);
         Zend_Registry::set('sql', $sql);
     } catch (Exception $ex) {
         die("Could not connect to database");
     }
     $db->createStatement("SET NAMES '" . SJB_System::getSystemSettings('MYSQL_CHARSET') . "'")->execute();
 }
예제 #12
0
파일: main.php 프로젝트: dreamsxin/Kellner
 public function __construct($addr = "127.0.0.1", $port = 8080)
 {
     $this->port = $port;
     $this->addr = $addr;
     // Setup basic stuff
     error_reporting(E_ALL & ~E_NOTICE);
     $base = realpath(dirname(__FILE__) . '/../');
     $paths = array('.', realpath($base . '/library'), get_include_path());
     $this->base = $base;
     // Setup autoloading ...
     set_include_path(implode(PATH_SEPARATOR, $paths));
     require_once 'Zend/Loader/Autoloader.php';
     $autoloader = Zend_Loader_Autoloader::getInstance();
     $autoloader->registerNamespace('EvHttp_');
     $resourceLoader = new Zend_Loader_Autoloader_Resource(array('basePath' => realpath($base . '/application'), 'namespace' => '', 'resourceTypes' => array('model' => array('namespace' => 'Model', 'path' => 'models/'), 'api' => array('namespace' => 'Service', 'path' => 'apis/'))));
     // Load config
     $this->config = new Zend_Config_Ini($this->base . '/deploy/config.ini', 'default');
     Zend_Registry::set('config', $this->config);
     // Connect database
     $dbType = $this->config->database->type;
     $params = $this->config->database->toArray();
     $db = Zend_Db::factory($dbType, $params);
     Zend_Db_Table::setDefaultAdapter($db);
     Zend_Registry::set('db', $db);
     // Setup Xml-Rpc Server
     $this->xmlrpc_server = new Zend_XmlRpc_Server();
     $this->xmlrpc_server->setClass('Service_Poll', 'poll');
     Zend_XmlRpc_Server_Fault::attachFaultException('Exception');
     // Setup Json-Rpc Server
     $this->jsonrpc_server = new Zend_Json_Server();
     $this->jsonrpc_server->setClass('Service_Poll', 'poll')->setAutoEmitResponse(false)->setTarget('/jsonrpc')->setEnvelope(Zend_Json_Server_Smd::ENV_JSONRPC_2);
 }
예제 #13
0
파일: Doctrine.php 프로젝트: jtietema/Fizzy
 /**
  * Initializes the Doctrine Resource. This is done in four steps:
  * <ul>
  *  <li>Register Doctrines own autoloader with the Zend_Loader stack</li>
  *  <li>Instantiate the Doctrine_Manager</li>
  *  <li>Open defined connections</li>
  *  <li>Load model paths</li>
  * </ul>
  * @return Doctrine_Manager
  */
 public function init()
 {
     // Get the Resource options
     $options = $this->getOptions();
     // Register the Doctrine autoloader
     require_once 'Doctrine.php';
     $autoloader = Zend_Loader_Autoloader::getInstance();
     $autoloader->pushAutoloader(array('Doctrine', 'autoload'));
     $autoloader->pushAutoloader(array('Doctrine_Core', 'modelsAutoload'));
     // Initialize the Doctrine Manager
     $this->_manager = Doctrine_Manager::getInstance();
     // Check for manager attributes in the options
     if (array_key_exists('manager', $options)) {
         $managerOptions = $options['manager'];
         if (array_key_exists('attributes', $managerOptions) && is_array($managerOptions['attributes'])) {
             $this->_setManagerAttributes($managerOptions['attributes']);
         }
     }
     // Open defined connections
     if (isset($options['connections']) && is_array($options['connections']) && !empty($options['connections'])) {
         foreach ($options['connections'] as $connectionName => $connectionOptions) {
             $this->_openConnection($connectionName, $connectionOptions);
         }
     }
     // Load models
     if (array_key_exists('paths', $options)) {
         $pathsOptions = $options['paths'];
         if (array_key_exists('models_path', $pathsOptions) && !empty($pathsOptions['models_path'])) {
             $this->_loadModels($pathsOptions['models_path']);
         }
     }
     return $this->_manager;
 }
예제 #14
0
 protected function _initZFDebug()
 {
     // Setup autoloader with namespace
     $autoloader = \Zend_Loader_Autoloader::getInstance();
     $autoloader->registerNamespace('ZFDebug');
     // Ensure the front controller is initialized
     $this->bootstrap('FrontController');
     // Retrieve the front controller from the bootstrap registry
     $front = $this->getResource('FrontController');
     // Only enable zfdebug if options have been specified for it
     if ($this->hasOption('zfdebug')) {
         // Create ZFDebug instance
         $zfDebug = new \ZFDebug\Controller\Plugin\Debug($this->getOption('zfdebug'));
         // Register ZFDebug with the front controller
         $front->registerPlugin($zfDebug);
     }
     // In application.ini do the following:
     //
     // [development : production]
     // zfdebug.plugins.Variables = null
     // zfdebug.plugins.Time = null
     // zfdebug.plugins.Memory = null
     // ...
     // Plugins that take objects as parameters like Database and Cache
     // need to be registered manually:
     $zfDebug->registerPlugin(new \ZFDebug\Controller\Plugin\Debug\Plugin\Database($db));
     // Alternative configuration without application.ini
     $options = ['plugins' => ['variables', 'database', 'file' => ['basePath' => '/Library/WebServer/Documents/budget', 'myLibrary' => 'Scienta'], 'memory', 'time', 'registry', 'exception']];
     $zfDebug = new \ZFDebug\Controller\Plugin\Debug($options);
     // Register ZFDebug with the front controller
     $front->registerPlugin($zfDebug);
 }
예제 #15
0
 public function bootstrap($env)
 {
     putenv('RUN_CLI_MODE=true');
     define('RUN_CLI_MODE', true);
     defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../../../../../application'));
     // Define application environment
     defined('APPLICATION_ENV') || define('APPLICATION_ENV', getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : $env);
     // bootstrap include_path and constants
     require realpath(APPLICATION_PATH . '/../library/library.php');
     /** Zend_Application */
     require_once 'Zend/Application.php';
     require_once 'Centurion/Application.php';
     require_once 'Zend/Loader/Autoloader.php';
     $autoloader = Zend_Loader_Autoloader::getInstance()->registerNamespace('Centurion_')->setDefaultAutoloader(create_function('$class', "include str_replace('_', '/', \$class) . '.php';"));
     $classFileIncCache = realpath(APPLICATION_PATH . '/../data/cache') . '/pluginLoaderCache.tmp';
     if (file_exists($classFileIncCache)) {
         $fp = fopen($classFileIncCache, 'r');
         flock($fp, LOCK_SH);
         $data = file_get_contents($classFileIncCache);
         flock($fp, LOCK_UN);
         fclose($fp);
         $data = @unserialize($data);
         if ($data !== false) {
             Centurion_Loader_PluginLoader::setStaticCachePlugin($data);
         }
     }
     Centurion_Loader_PluginLoader::setIncludeFileCache($classFileIncCache);
     // Create application, bootstrap, and run
     $this->_application = new Centurion_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/');
     $this->_application->bootstrap('db');
     $this->_application->bootstrap('FrontController');
     $this->_application->bootstrap('contrib');
 }
예제 #16
0
 /**
  * Initialize
  */
 public function init()
 {
     $doctrineConfig = $this->getOptions();
     if (isset($doctrineConfig['compiled']) && $doctrineConfig['compiled'] == true && file_exists(APPLICATION_PATH . '/../library/Doctrine.compiled.php')) {
         require_once 'Doctrine.compiled.php';
     } else {
         require_once 'Doctrine.php';
     }
     $loader = Zend_Loader_Autoloader::getInstance();
     $loader->pushAutoloader(array('Doctrine', 'autoload'), 'Doctrine');
     $manager = Doctrine_Manager::getInstance();
     // set models to be autoloaded and not included (Doctrine::MODEL_LOADING_AGGRESSIVE)
     $manager->setAttribute(Doctrine::ATTR_MODEL_LOADING, Doctrine::MODEL_LOADING_CONSERVATIVE);
     // enable ModelTable classes to be loaded automatically
     $manager->setAttribute(Doctrine::ATTR_AUTOLOAD_TABLE_CLASSES, true);
     // enable validation on save()
     $manager->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_ALL);
     // enable sql callbacks to make SoftDelete and other behaviours work transparently
     $manager->setAttribute(Doctrine::ATTR_USE_DQL_CALLBACKS, true);
     // enable automatic queries resource freeing
     $manager->setAttribute(Doctrine_Core::ATTR_AUTO_FREE_QUERY_OBJECTS, true);
     // connect to database
     $manager->openConnection($doctrineConfig['connection_string']);
     // set to utf8
     $manager->connection()->setCharset('utf8');
     if (isset($doctrineConfig['cache']) && $doctrineConfig['cache'] == true) {
         $cacheDriver = new Doctrine_Cache_Apc();
         $manager->setAttribute(Doctrine::ATTR_QUERY_CACHE, $cacheDriver);
     }
     return $manager;
 }
 public function __connect()
 {
     set_include_path(implode(PATH_SEPARATOR, array(WWW_ROOT . '/zend/library/', get_include_path())));
     require_once 'Zend/Loader/Autoloader.php';
     Zend_Loader_Autoloader::getInstance();
     $this->mail = new Zend_Mail_Storage_Imap(array('host' => $this->hostname, 'port' => $this->port, 'ssl' => $this->ssl, 'user' => $this->username, 'password' => $this->password));
 }
예제 #18
0
 protected function _initAutoloader()
 {
     $autoloader = Zend_Loader_Autoloader::getInstance();
     $autoloader->registerNamespace('PHPExcel_');
     $autoloader->registerNamespace('PHPExcel');
     return $autoloader;
 }
예제 #19
0
 /**
  * Constructor
  *
  * Initialize application. Potentially initializes include_paths, PHP
  * settings, and bootstrap class.
  *
  * @param  string                   $environment
  * @param  string|array|Zend_Config $options String path to configuration file, or array/Zend_Config of configuration options
  * @param bool $suppressNotFoundWarnings Should warnings be suppressed when a file is not found during autoloading?
  * @throws Zend_Application_Exception When invalid options are provided
  * @return void
  */
 public function __construct($environment, $options = null, $suppressNotFoundWarnings = null)
 {
     $this->_environment = (string) $environment;
     $this->_autoloader = Zend_Loader_Autoloader::getInstance();
     $this->_autoloader->suppressNotFoundWarnings($suppressNotFoundWarnings);
     if (null !== $options) {
         if (is_string($options)) {
             $options = $this->_loadConfig($options);
         } elseif ($options instanceof Zend_Config) {
             $options = $options->toArray();
         } elseif (!is_array($options)) {
             throw new Zend_Application_Exception('Invalid options provided; must be location of config file,' . ' a config object, or an array');
         }
         $this->setOptions($options);
     }
 }
예제 #20
0
파일: Bootstrap.php 프로젝트: knatorski/SMS
 /**
  *
  * Kilka dodatkowych statycznych inicjaliacji
  *
  */
 public function _initStatics()
 {
     $config = $this->getApplication()->getOptions();
     /**
      * Ustawienie konfigu na rejestrze dla kompatybilnosci z poprzednmi rozwiazaniami (resouce plugin dla ACL)
      */
     Zend_Registry::set('config', $config);
     if (isset($config['general']['pluginloader']) and $config['general']['pluginloader']) {
         $classFileIncCache = APPLICATION_PATH . '/../tmp/pluginLoaderCache.php';
         if (file_exists($classFileIncCache)) {
             include_once $classFileIncCache;
         }
         Zend_Loader_PluginLoader::setIncludeFileCache($classFileIncCache);
     }
     /**
      * Ustawienie fallback tak by klasy bez namespacu tez dzialaly
      */
     Zend_Loader_Autoloader::getInstance()->setFallbackAutoloader(true)->pushAutoloader(NULL, 'Smarty_');
     /**
      * Domyslny rozmiar strony paginatora
      */
     Zend_Paginator::setDefaultItemCountPerPage($config['paginator']['DefaultItemCountPerPage']);
     Zend_View_Helper_PaginationControl::setDefaultViewPartial('/common/paginator_footer.phtml');
     Zend_Controller_Action_HelperBroker::addPrefix('Base_Controller_Action_Helper');
     Zend_Markup::addRendererPath('Logic', 'Logic/');
     Base_Logic_Abstract::setUsePreexecuteHooks($config['general']['usepreexecutehooks']);
 }
예제 #21
0
 /**
  * Set adapter to use
  * 
  * @param  mixed $adapters 
  * @param  bool $force 
  * @return void
  */
 public static function setAdapter($adapters = null, $force = false)
 {
     $adapters = (array) $adapters;
     if (!$force) {
         $adapters = array_unique(array_merge($adapters, array(self::ADAPTER_GD, self::ADAPTER_IMAGEMAGICK)));
     }
     $name = null;
     foreach ($adapters as $adapter) {
         if (Zend_Loader_Autoloader::autoload($adapter)) {
             if (call_user_func($adapter . '::isAvailable')) {
                 $name = $adapter;
                 break;
             }
         } elseif (Zend_Loader_Autoloader::autoload('Zend_Image_Adapter_' . $adapter)) {
             if (call_user_func('Zend_Image_Adapter_' . $adapter . '::isAvailable')) {
                 $name = 'Zend_Image_Adapter_' . $adapter;
                 break;
             }
         } else {
             require_once 'Zend/Image/Exception.php';
             throw new Zend_Image_Exception("Could not find adapter '" . $adapter . "'");
         }
     }
     if ($name) {
         self::$_adapterToUse = $name;
         return $name;
     }
     require_once 'Zend/Image/Exception.php';
     throw new Zend_Image_Exception('Was not able to detect an available adapter');
 }
예제 #22
0
파일: ZFDebug.php 프로젝트: rickyfeng/wenda
 public function init()
 {
     //get ini file options
     $iniOptions = $this->getOptions();
     //set ZFDebug to autoload
     $autoloader = Zend_Loader_Autoloader::getInstance();
     $autoloader->registerNamespace('ZFDebug');
     //initialized Front Controller
     $bootstrap = $this->getBootstrap();
     $bootstrap->bootstrap('frontController');
     $frontController = $bootstrap->getResource('frontController');
     if (RFLib_Core::getIsDeveloperMode() && trim($iniOptions['enable'])) {
         //set ZFDebug options
         $options = array('plugins' => array('Variables', 'File' => array('basePath' => APPLICATION_PATH . '/..'), 'Memory', 'Time', 'Registry', 'Exception'));
         //add cache option if specified
         if ($bootstrap->hasPluginResource('cache')) {
             $bootstrap->bootstrap('cache');
             $cache = $bootstrap->getPluginResource('cache')->getBackend();
             $options['plugins']['Cache']['backend'] = $cache;
         }
         // add db option if specified
         if ($bootstrap->hasPluginResource('db')) {
             $bootstrap->bootstrap('db');
             $db = $bootstrap->getPluginResource('db')->getDbAdapter();
             $options['plugins']['Database']['adapter'] = $db;
         }
         $debug = new ZFDebug_Controller_Plugin_Debug($options);
         $frontController->registerPlugin($debug);
     }
 }
예제 #23
0
 /**
  * Get Zfdebug
  * 
  * @return ZFDebug_Controller_Plugin_Debug
  */
 public function getZfdebug()
 {
     if (null === $this->_zfdebug) {
         $this->getBootstrap()->bootstrap('Session');
         // Get Zfdebug configuration options from the application.ini file
         $zfdebugConfig = $this->getOptions();
         if ($zfdebugConfig['enabled']) {
             $autoloader = Zend_Loader_Autoloader::getInstance();
             $autoloader->registerNamespace('ZFDebug');
             $options = array('plugins' => $zfdebugConfig['plugins']);
             # Instantiate the database adapter and setup the plugin.
             # Alternatively just add the plugin like above and rely on the autodiscovery feature.
             if ($this->getBootstrap()->hasPluginResource('db')) {
                 $this->getBootstrap()->bootstrap('db');
                 $db = $this->getBootstrap()->getPluginResource('db')->getDbAdapter();
                 $options['plugins']['Database']['adapter'] = $db;
             }
             # Setup the cache plugin
             if ($this->getBootstrap()->hasPluginResource('cache')) {
                 $this->getBootstrap()->bootstrap('cache');
                 $cache = $this->getBootstrap()->getPluginResource('cache')->getDbAdapter();
                 $options['plugins']['Cache']['backend'] = $cache->getBackend();
             }
             $this->getBootstrap()->bootstrap('OSSAutoLoader');
             $this->getBootstrap()->bootstrap('Doctrine');
             $options['plugins']['OSS_ZFDebug_Controller_Plugin_Debug_Plugin_Doctrine']['manager'] = $this->getBootstrap()->getResource('Doctrine');
             $this->_zfdebug = new ZFDebug_Controller_Plugin_Debug($options);
             $this->getBootstrap()->bootstrap('FrontController');
             $frontController = $this->getBootstrap()->getResource('FrontController');
             $frontController->registerPlugin($this->_zfdebug);
         }
     }
     return $this->_zfdebug;
 }
예제 #24
0
 protected function _initZFDebug()
 {
     // Setup autoloader with namespace
     $autoloader = Zend_Loader_Autoloader::getInstance();
     $autoloader->registerNamespace('ZFDebug');
     // Ensure the front controller is initialized
     $this->bootstrap('FrontController');
     // Retrieve the front controller from the bootstrap registry
     $front = $this->getResource('FrontController');
     // Only enable zfdebug if options have been specified for it
     if ($this->hasOption('zfdebug')) {
         $options = $this->getOption('zfdebug');
         # 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;
         }
         //            $options['plugins']['File']['base_path'] = APPLICATION_PATH;
         # Setup the cache plugin
         if ($this->hasPluginResource('cachemanager')) {
             $this->bootstrap('cachemanager');
             $cache = $this->getPluginResource('cachemanager')->getCacheManager()->getCache('default');
             $options['plugins']['Cache']['backend'] = $cache->getBackend();
         }
         $zfdebug = new ZFDebug_Controller_Plugin_Debug($options);
         $zfdebug->registerPlugin(new ZFDebug_Controller_Plugin_Debug_Plugin_Auth(array('user' => 'name')));
         $zfdebug->registerPlugin(new ZFDebug_Controller_Plugin_Debug_Plugin_Session());
         $front->registerPlugin($zfdebug);
     }
 }
 /**
  * Attaches several plugins from a same path
  * $methods must contain:
  * '[method]' => '[Complete_Name_Of_Class]'
  *
  * @param array $methods
  * @param string $namespace
  */
 public static function attachPlugins(array $methods, $namespace)
 {
     foreach ($methods as $method => $class) {
         self::$_plugins[$method] = $class;
     }
     Zend_Loader_Autoloader::getInstance()->registerNamespace(current(explode('_', $namespace)));
 }
예제 #26
0
 protected function _initAutoload()
 {
     $autoloader = Zend_Loader_Autoloader::getInstance();
     $autoloader->registerNamespace('Cola_');
     $autoloader = new Zend_Application_Module_Autoloader(array('namespace' => 'Listmaker_', 'basePath' => dirname(__FILE__)));
     return $autoloader;
 }
예제 #27
0
 protected function _initLoader()
 {
     require_once 'Zend/Loader/Autoloader.php';
     $autoloader = Zend_Loader_Autoloader::getInstance();
     $autoloader->registerNamespace(array('Axis'));
     return $autoloader;
 }
예제 #28
0
 protected function _initZFDebug()
 {
     if (getenv('APPLICATION_ENV') != 'production' && $this->_config->appSettings->debugMode == 1) {
         $autoloader = Zend_Loader_Autoloader::getInstance();
         $autoloader->registerNamespace('ZFDebug');
         Zend_Session::start();
         $options = array('plugins' => array('Variables', 'File' => array('base_path' => '/path/to/project'), '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);
     }
 }
예제 #29
0
 /**
  * @see Zend_Application::setOptions()
  * @param  string                   $environment
  * @param  string|array|Zend_Config $options String path to configuration file, or array/Zend_Config of configuration options
  * @return void
  */
 public function __construct($environment, $options = null)
 {
     $cached = false;
     $cache = false;
     require_once 'Zend/Loader/Autoloader.php';
     $autoloader = Zend_Loader_Autoloader::getInstance();
     $autoloader->registerNamespace('Core');
     require_once 'Doctrine/Common/ClassLoader.php';
     $fmmAutoloader = new \Doctrine\Common\ClassLoader('Bisna');
     $autoloader->pushAutoloader(array($fmmAutoloader, 'loadClass'), 'Bisna');
     $fmmAutoloader = new \Doctrine\Common\ClassLoader('CrEOF');
     $autoloader->pushAutoloader(array($fmmAutoloader, 'loadClass'), 'CrEOF');
     if (is_string($options)) {
         $this->_filesRead[] = $options;
         if (self::hasCache()) {
             $cache = self::getCache();
             $idCache = 'SICAe_Main_Application_Config';
             $_options = self::_loadCache($idCache);
             if (count($_options)) {
                 $cached = true;
                 $options = $_options;
                 unset($_options);
             }
         }
     }
     parent::__construct($environment, $options);
     if (false === $cached && $cache) {
         $options = $this->getOptions();
         $data = array('options' => $options, 'filesRead' => array_unique($this->_filesRead));
         $cache->save($data, $idCache);
     }
 }
예제 #30
0
파일: Ztal.php 프로젝트: jo-m/ecamp3
 /**
  * Pre-dispatch hook to create and install a replacement View object.
  *
  * @param Zend_Controller_Request_Abstract $request The requst object.
  *
  * @return void
  */
 public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request)
 {
     // Unregister the built-in autoloader
     spl_autoload_unregister(array('PHPTAL', 'autoload'));
     // Register the autoloader through Zend
     Zend_Loader_Autoloader::getInstance()->pushAutoloader(array('PHPTAL', 'autoload'), 'PHPTAL');
     // We create an instance of our view wrapper and configure it
     // It extends Zend_View so we can configure it the same way
     $view = new Ztal_Tal_View($this->_options);
     if (Zend_Registry::isRegistered('Zend_Translate')) {
         //setup the translation facilities in PHPTal
         $translator = new Ztal_Tal_ZendTranslateTranslator($this->_options);
         $translator->useDomain($request->getControllerName());
         $view->getEngine()->setTranslator($translator);
     }
     // Call out to an overloadable method to pickup the paths for
     // templates for the current module
     foreach ($this->_currentModuleTemplatePaths($request) as $currentPath) {
         $view->addTemplateRepositoryPath($currentPath);
     }
     // We configure the view renderer in order to use our PHPTAL view
     $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
     $viewRenderer->setViewSuffix('phtml');
     $view->layout()->setViewSuffix('phtml');
     $viewRenderer->setView($view);
     Zend_Registry::set('Ztal_View', $view);
 }