public function init() { $paths = array(get_include_path(), BASEPATH . '../application/third_party/zend/library'); set_include_path(implode(PATH_SEPARATOR, $paths)); require_once 'Zend/Loader/Autoloader.php'; Zend_Loader_Autoloader::getInstance(); }
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; }
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); } }
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'); } }
/** * _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; }
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; }
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)); }
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'); }
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); }
/** * 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); }
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'); }
protected function setupApplication($namespace, $title, array $javascripts = array(), array $css = array()) { Gecko_Model::setDefaultNamespace($namespace); $loader = Zend_Loader_Autoloader::getInstance(); $autoloaders = $loader->getAutoloaders(); foreach ($autoloaders as $loader) { $loader->addResourceType('row', 'models/Rows', 'Model_Row'); //$loader->addResourceType('service', 'services', 'Service'); } $this->bootstrap('view'); $View = $this->getResource('view'); $View->addHelperPath('ZendX/JQuery/View/Helper/', 'ZendX_JQuery_View_Helper'); $View->addHelperPath(APPLICATION_PATH . '/views/helpers/', $namespace . '_View_Helper'); $View->addHelperPath('Gecko/View/Helper/', 'Gecko_View_Helper'); $View->doctype('HTML5'); $View->headTitle($title)->setSeparator(' > '); $View->headMeta()->appendName('Content-type', 'text/html; charset=utf-8')->appendName('viewport', 'width=device-width, initial-scale=1'); $View->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=utf-8'); $defaultCss = array('/css/normalize.css'); $css = array_merge($defaultCss, $css); foreach ($css as $cssPath) { $View->headLink()->appendStylesheet($cssPath); } $defaultJavascript = array(); $javascripts = array_merge($defaultJavascript, $javascripts); $View->jQuery()->setLocalPath('/js/jquery-1.11.1.min.js'); foreach ($javascripts as $jsPath) { $View->jQuery()->addJavascriptFile($jsPath); } }
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; }
public static function prepare() { self::setupEnvironment(); Zend_Loader_Autoloader::getInstance()->setFallbackAutoloader(true); self::setupFrontController(); self::session(); }
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); } }
/** * 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; }
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); } }
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); }
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); } }
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(); }
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; }
protected function _initCustomUrls() { $this->bootstrap('frontController'); Zend_Loader_Autoloader::getInstance()->registerNamespace('Customurl')->registerNamespace('Customurl'); $plugin = new Customurl_ControllerPlugin(); $this->getResource('frontController')->registerPlugin($plugin); }
/** * 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; }
/** * 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; }
/** * 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))); }
protected function _initAutoloader() { $autoloader = Zend_Loader_Autoloader::getInstance(); $autoloader->registerNamespace('PHPExcel_'); $autoloader->registerNamespace('PHPExcel'); return $autoloader; }
protected function _initLoader() { require_once 'Zend/Loader/Autoloader.php'; $autoloader = Zend_Loader_Autoloader::getInstance(); $autoloader->registerNamespace(array('Axis')); return $autoloader; }
/** * * 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']); }
/** * @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); } }
public function prepareAutoloader() { require_once 'Zend/Loader/Autoloader.php'; $autoloader = Zend_Loader_Autoloader::getInstance(); $autoloader->registerNamespace('Application'); return $this; }