本文整理汇总了PHP中Zend_Application::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Application::__construct方法的具体用法?PHP Zend_Application::__construct怎么用?PHP Zend_Application::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Application
的用法示例。
在下文中一共展示了Zend_Application::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @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);
}
}
示例2: __construct
public function __construct($environment, $options)
{
$optConfig = static::$optConfig;
if (isset($options['optrules'])) {
$optConfig = array_merge($optConfig, $options['optrules']);
unset($options['optrules']);
}
$this->opts = new Zend_Console_Getopt($optConfig);
$module = $this->getModule();
if ($module !== 'default') {
$options['config'][] = APPLICATION_PATH . '/modules/' . $module . '/configs/module.ini';
}
parent::__construct($environment, $options);
try {
$this->opts->parse();
} catch (Zend_Console_Getopt_Exception $e) {
$this->error("Error parsing command line options: {$e->getMessage()}");
exit(1);
}
if ($this->opts->h) {
$this->usage();
exit(0);
}
Zend_Registry::set('CliApplication', $this);
}
示例3: __construct
/**
* @description Constructor
* @param string $environment
* @param string|array $options
* @param string $useCache
* @param null|Zend_Cache_Core $configCache
* @author Se#
* @version 0.0.1
*/
public function __construct($environment, $options = null, $useCache = 'production', Zend_Cache_Core $configCache = null)
{
if ($useCache && empty($configCache)) {
$configCache = $this->_defaultConfigCache($useCache);
}
$this->_configCache = $configCache;
parent::__construct($environment, $options);
}
示例4: __construct
/**
* Constructor
*
* @param string $environment
* @param null|string|array $options
*/
public function __construct($environment, $options = null)
{
if (is_array($options) && isset($options['configFile'])) {
if (isset($options['cacheOptions'])) {
$this->_cacheOptions = $options['cacheOptions'];
}
$options = $options['configFile'];
}
parent::__construct($environment, $options);
}
示例5: __construct
/**
* Constructor
*
* Initialize application. Potentially initializes include_paths, PHP
* settings, and bootstrap class.
*
* @param $environment string
* @param $options string|array|Zend_Config
* String path to configuration file, or array/Zend_Config of
* configuration options
* @throws Zend_Application_Exception When invalid options are provided
* @return void
*/
public function __construct($environment, $options = null)
{
$this->initCache();
parent::__construct($environment, $options);
//Zend_Loader_Autoloader::getInstance()->setDefaultAutoloader(array('MIIS_Bootstrap', 'autoload'));
//$auth_cookie = $this->getOption('miis_app');
//if(isset($auth_cookie['auth']['use_cookie']) && $auth_cookie['auth']['use_cookie']){
// Zend_Auth::getInstance()->setStorage(new MIIS_Auth_Storage_Cookie())->getStorage()->setDomain($auth_cookie['cookie']['domain'])->setExpiration(0);
//}
}
示例6: __construct
/**
* Constructor
*
* Initialize application. Potentially initializes include_paths, PHP
* settings, and bootstrap class.
*
* @param string $environment
* @param string|array|Zend_Config $optionsOrRootDir String path to configuration file, or array/Zend_Config of configuration options
* @throws Zend_Application_Exception When invalid options are provided
* @return void
*/
public function __construct($environment, $optionsOrRootDir = null)
{
if (is_string($optionsOrRootDir) && is_dir($optionsOrRootDir)) {
$this->rootDir = $optionsOrRootDir;
parent::__construct($environment, $this->rootDir . self::$configDir . '/application.common.ini');
} else {
parent::__construct($environment, $optionsOrRootDir);
}
$this->getAutoloader()->registerNamespace('System_');
Zend_Registry::set(self::APPLICATION, $this);
}
示例7: __construct
/**
* Initialize the application.
*
* @param string $environment The environment name.
* @param string|array|Zend_Config $options Application configuration.
*/
public function __construct($environment, $options = null)
{
// Add functions to the global scope.
require_once 'globals.php';
// Set the configuration file if not passed.
if (!$options) {
$options = CONFIG_DIR . '/application.ini';
}
parent::__construct($environment, $options);
Zend_Registry::set('bootstrap', $this->getBootstrap());
}
示例8: __construct
/**
* Constructor
*
* Initialize application. Potentially initializes include_paths, PHP
* settings, and bootstrap class.
*
* When $options is an array with a key of configFile, this will tell the
* class to cache the configuration using the default options or cacheOptions
* passed in.
*
* @param string $environment
* @param string|array|Zend_Config $options String path to configuration file, or array/Zend_Config of configuration options
* @throws Zend_Application_Exception When invalid options are provided
* @return void
*/
public function __construct($environment, $options = null)
{
if (is_array($options) && isset($options['configFile'])) {
$this->_cacheConfig = true;
// First, let's check to see if there are any cache options
if (isset($options['cacheOptions'])) {
$this->_cacheOptions = array_merge($this->_cacheOptions, $options['cacheOptions']);
}
$options = $options['configFile'];
}
parent::__construct($environment, $options);
}
示例9: __construct
/**
* Переопределенный конструктор класса. Загружает либо конфиг из файла, либо из кеша.
*
* @param $environment Окружение приложения.
* @param null|array $options Массив опций.
*/
public function __construct($environment, $options = null)
{
$configPath = $options;
if (isset($options['cachedConfigPath']) && isset($options['configPath'])) {
$configPath = $this->_loadCachedConfig($options['configPath'], $options['cachedConfigPath']);
}
if (isset($options['pluginCache']) && !empty($options['pluginCache'])) {
$this->_initPluginCache($options['pluginCache']);
}
parent::__construct($environment, $configPath);
if (isset($options['cachedConfigPath']) && $configPath != $options['cachedConfigPath']) {
$this->_saveCache($options['cachedConfigPath']);
}
}
示例10: __construct
/**
* Initialize the application.
*
* @param string $environment The environment name.
* @param string|array|Zend_Config $options Application configuration.
*/
public function __construct($environment, $options = null)
{
// Add functions to the global scope.
require_once 'globals.php';
// Add CG35 functions to the global scope.
require_once MASTER_PATH . '/application/libraries/cg35.php';
// Add CG35 PDF class to the global scope.
require_once MASTER_PATH . '/application/libraries/Omeka/Pdf.php';
// Set the configuration file if not passed.
if (!$options) {
$options = CONFIG_DIR . '/application.ini';
}
parent::__construct($environment, $options);
Zend_Registry::set('bootstrap', $this->getBootstrap());
}
示例11: __construct
/**
* Constructor
*
* Initialize application. Potentially initializes include_paths, PHP
* settings, and bootstrap class.
*
* It also loads the default config file for the HausDesign CMS.
*
* @param string $environment
* @param string|array|Zend_Config $options String path to configuration file, or array/Zend_Config
* of configuration options
* @throws Zend_Application_Exception When invalid options are provided
* @throws HausDesign_Application_Exception When invalid general options are provided
* @return void
*/
public function __construct($environment, $options = null)
{
parent::__construct($environment, $options);
$this->_parseUrl();
define('CUR_APPLICATION_PATH', realpath(APPLICATION_PATH . '' . DIRECTORY_SEPARATOR . '' . $this->_application . '' . DIRECTORY_SEPARATOR));
// Get the application specific file
// Normally located at /application/*application name*/configs/application.ini
$applicationOptions = array();
$applicationConfigFile = CUR_APPLICATION_PATH . '' . DIRECTORY_SEPARATOR . 'configs' . DIRECTORY_SEPARATOR . 'application.ini';
if (file_exists($applicationConfigFile)) {
$applicationOptions = $this->_loadConfig($applicationConfigFile);
}
// Merge the options and force them into Zend_Application
$this->setOptions($this->mergeOptions($this->getOptions(), $applicationOptions));
// Add the options to the Zend Registry
Zend_Registry::set('config', $this->getOptions());
// FIX FOR IIS CACHE FOLDER START
$config = new Zend_Config_Ini($applicationConfigFile, $environment);
$cache = Zend_Cache::factory('Core', 'File', $config->resources->cachemanager->administrator->frontend->options->toArray(), $config->resources->cachemanager->administrator->backend->options->toArray());
Zend_Locale::setCache($cache);
}
示例12: __construct
/**
* Constructor
*
* @return void
*/
public function __construct()
{
// Call Zend_Application constructor
parent::__construct(APPLICATION_ENV, $this->_getOptions());
}
示例13: __construct
/**
* {@inheritdoc}
*
* Generate the path to the application settings based on the current
* application environment.
*
* @param string $environment
* @param string|array|Zend_Config $options Array/Zend_Config of configuration options
* @throws Zend_Application_Exception When invalid options are provided
* @return void
*/
public function __construct($environment, $options = null)
{
\Zend_Loader_Autoloader::getInstance()->registerNamespace('Epixa\\')->registerNamespace('Zend_');
$options = array('config' => APPLICATION_ROOT . '/config/settings/' . APPLICATION_ENV . '.php');
parent::__construct($environment, $options);
}
示例14: __construct
public function __construct($environment, $options, Zend_Cache_Core $configCache, $useCache)
{
$this->_configCache = $configCache;
$this->_useCache = $useCache;
parent::__construct($environment, $options);
}
示例15: __construct
/**
* 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
* @throws Zend_Application_Exception When invalid options are provided
* @return void
*/
public function __construct($environment, $options = null)
{
$this->_debug = $environment == 'development' ? true : false;
$this->_rootDir = $this->getRootDir();
$this->_name = preg_replace('/[^a-zA-Z0-9_]+/', '', basename($this->_rootDir));
$this->_classes = array();
parent::__construct($environment, $options);
}