本文整理汇总了PHP中Zend_Config_Ini类的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Config_Ini类的具体用法?PHP Zend_Config_Ini怎么用?PHP Zend_Config_Ini使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Zend_Config_Ini类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadApplicationConfig
function loadApplicationConfig()
{
require_once 'Zend/Config/Ini.php';
$default = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', APPLICATION_ENV, array('allowModifications' => true));
$options = $default->toArray();
return $options;
}
示例2: _initConfig
/**
* Initialize module config options
*
* @return void
*/
protected function _initConfig()
{
// load ini file
$config = new Zend_Config_Ini(MODULES_PATH . '/' . $this->_module['folder'] . '/configs/module.ini', APPLICATION_ENV);
$this->setOptions($config->toArray());
Zend_Registry::set($this->_module['folder'] . 'Config', $this->_config = $config);
}
示例3: __construct
private function __construct() {
$pathToFile = APPLICATION_PATH . '/configs/xhprof.ini';
if (file_exists($pathToFile)) {
$xhprofIni = new Zend_Config_Ini($pathToFile);
if (null == ($config = $xhprofIni->get(APPLICATION_ENV)) && null == ($config = $xhprofIni->get('default'))) {
require_once 'Zend/Application/Exception.php';
throw new Zend_Application_Exception("Błędne ustawienia dla XHprof w pliku xhprof.ini");
}
$this->_xhprofConfigData = $config;
if (null !== $this->_xhprofConfigData && $this->_xhprofConfigData->count() >= 1) {
$dbAdapter = new Zend_Db_Adapter_Pdo_Pgsql(array(
'host' => $this->_xhprofConfigData->get('xhprof')->db->host,
'username' => $this->_xhprofConfigData->get('xhprof')->db->username,
'password' => $this->_xhprofConfigData->get('xhprof')->db->password,
'dbname' => $this->_xhprofConfigData->get('xhprof')->db->dbname,
'port' => $this->_xhprofConfigData->get('xhprof')->db->port
));
$this->_dbAdapter = $dbAdapter;
}
}
}
示例4: postUpgrade
/** Post database upgrade. */
public function postUpgrade()
{
/** @var SettingModel $settingModel */
$settingModel = MidasLoader::loadModel('Setting');
$configPath = LOCAL_CONFIGS_PATH . DIRECTORY_SEPARATOR . $this->moduleName . '.local.ini';
if (file_exists($configPath)) {
$config = new Zend_Config_Ini($configPath, 'global');
$settingModel->setConfig(DICOMEXTRACTOR_DCM2XML_COMMAND_KEY, $config->get('dcm2xml', DICOMEXTRACTOR_DCM2XML_COMMAND_DEFAULT_VALUE), $this->moduleName);
$settingModel->setConfig(DICOMEXTRACTOR_DCMJ2PNM_COMMAND_KEY, $config->get('dcmj2pnm', DICOMEXTRACTOR_DCMJ2PNM_COMMAND_DEFAULT_VALUE), $this->moduleName);
$settingModel->setConfig(DICOMEXTRACTOR_DCMFTEST_COMMAND_KEY, $config->get('dcmftest', DICOMEXTRACTOR_DCMFTEST_COMMAND_DEFAULT_VALUE), $this->moduleName);
$settingModel->setConfig(DICOMEXTRACTOR_DCMDICTPATH_KEY, $config->get('dcmdictpath', DICOMEXTRACTOR_DCMDICTPATH_DEFAULT_VALUE), $this->moduleName);
$config = new Zend_Config_Ini($configPath, null, true);
unset($config->global->dcm2xml);
unset($config->global->dcmj2pnm);
unset($config->global->dcmftest);
unset($config->global->dcmdictpath);
$writer = new Zend_Config_Writer_Ini();
$writer->setConfig($config);
$writer->setFilename($configPath);
$writer->write();
} else {
$settingModel->setConfig(DICOMEXTRACTOR_DCM2XML_COMMAND_KEY, DICOMEXTRACTOR_DCM2XML_COMMAND_DEFAULT_VALUE, $this->moduleName);
$settingModel->setConfig(DICOMEXTRACTOR_DCMJ2PNM_COMMAND_KEY, DICOMEXTRACTOR_DCMJ2PNM_COMMAND_DEFAULT_VALUE, $this->moduleName);
$settingModel->setConfig(DICOMEXTRACTOR_DCMFTEST_COMMAND_KEY, DICOMEXTRACTOR_DCMFTEST_COMMAND_DEFAULT_VALUE, $this->moduleName);
$settingModel->setConfig(DICOMEXTRACTOR_DCMDICTPATH_KEY, DICOMEXTRACTOR_DCMDICTPATH_DEFAULT_VALUE, $this->moduleName);
}
}
示例5: postUpgrade
/** Post database upgrade. */
public function postUpgrade()
{
/** @var RandomComponent $randomComponent */
$randomComponent = MidasLoader::loadComponent('Random');
$securityKey = $randomComponent->generateString(32);
/** @var SettingModel $settingModel */
$settingModel = MidasLoader::loadModel('Setting');
$configPath = LOCAL_CONFIGS_PATH . DIRECTORY_SEPARATOR . $this->moduleName . '.local.ini';
if (file_exists($configPath)) {
$config = new Zend_Config_Ini($configPath, 'global');
$settingModel->setConfig(MIDAS_REMOTEPROCESSING_SECURITY_KEY_KEY, $config->get('securitykey', $securityKey), $this->moduleName);
$showButton = $config->get('showbutton');
if ($showButton === 'true') {
$showButton = 1;
} elseif ($showButton === 'false') {
$showButton = 0;
} else {
$showButton = MIDAS_REMOTEPROCESSING_SHOW_BUTTON_DEFAULT_VALUE;
}
$settingModel->setConfig(MIDAS_REMOTEPROCESSING_SHOW_BUTTON_KEY, $showButton, $this->moduleName);
$config = new Zend_Config_Ini($configPath, null, true);
unset($config->securitykey->securitykey);
unset($config->showbutton->showbutton);
$writer = new Zend_Config_Writer_Ini();
$writer->setConfig($config);
$writer->setFilename($configPath);
$writer->write();
} else {
$settingModel->setConfig(MIDAS_REMOTEPROCESSING_SECURITY_KEY_KEY, $securityKey, $this->moduleName);
$settingModel->setConfig(MIDAS_REMOTEPROCESSING_SHOW_BUTTON_KEY, MIDAS_REMOTEPROCESSING_SHOW_BUTTON_DEFAULT_VALUE, $this->moduleName);
}
}
示例6: init_plugins
/**
* Initialize plugins hook system
*/
function init_plugins()
{
include APPPATH . 'config/cache.php';
$feEngine = $config['plugins_frontend_engine'];
$feOptions = $config['plugins_frontend'];
$beEngine = $config['plugins_backend_engine'];
$beOptions = $config['plugins_backend'];
if (isset($beOptions['cache_dir']) && !file_exists($beOptions['cache_dir'])) {
mkdir($beOptions['cache_dir']);
chmod($beOptions['cache_dir'], 0777);
}
$cache = Zend_Cache::factory($feEngine, $beEngine, $feOptions, $beOptions);
$pluginsConfigArray = $cache->load('pluginsConfig');
if (!$pluginsConfigArray) {
$pluginsConfigArray = array();
$pluginConfDirHandler = opendir(APPPATH . 'config/plugins');
while (false !== ($pluginConfigFile = readdir($pluginConfDirHandler))) {
if (preg_match('~^.*?\\.ini$~si', $pluginConfigFile)) {
try {
$pluginConfig = new Zend_Config_Ini(APPPATH . 'config/plugins/' . $pluginConfigFile, 'plugins');
$pluginsConfigArray = array_merge_recursive($pluginsConfigArray, $pluginConfig->toArray());
} catch (Exception $e) {
}
}
}
closedir($pluginConfDirHandler);
$cache->save($pluginsConfigArray, 'pluginsConfig');
}
Zend_Registry::getInstance()->set('pluginsConfig', new Zend_Config($pluginsConfigArray));
}
示例7: loadErrors
protected static function loadErrors()
{
if (!is_array(self::$errors)) {
$config = new \Zend_Config_Ini(APPLICATION_PATH . '/configs/errors.ini');
self::$errors = $config->get('errors')->toArray();
}
}
示例8: postUpgrade
/** Post database upgrade. */
public function postUpgrade()
{
/** @var SettingModel $settingModel */
$settingModel = MidasLoader::loadModel('Setting');
$configPath = LOCAL_CONFIGS_PATH . DIRECTORY_SEPARATOR . $this->moduleName . '.local.ini';
if (file_exists($configPath)) {
$config = new Zend_Config_Ini($configPath, 'global');
$settingModel->setConfig(MIDAS_THUMBNAILCREATOR_PROVIDER_KEY, MIDAS_THUMBNAILCREATOR_PROVIDER_PHMAGICK, $this->moduleName);
$settingModel->setConfig(MIDAS_THUMBNAILCREATOR_FORMAT_KEY, MIDAS_THUMBNAILCREATOR_FORMAT_JPG, $this->moduleName);
$settingModel->setConfig(MIDAS_THUMBNAILCREATOR_IMAGE_MAGICK_KEY, $config->get('imagemagick', MIDAS_THUMBNAILCREATOR_IMAGE_MAGICK_DEFAULT_VALUE), $this->moduleName);
$settingModel->setConfig(MIDAS_THUMBNAILCREATOR_USE_THUMBNAILER_KEY, $config->get('useThumbnailer', MIDAS_THUMBNAILCREATOR_USE_THUMBNAILER_DEFAULT_VALUE), $this->moduleName);
$settingModel->setConfig(MIDAS_THUMBNAILCREATOR_THUMBNAILER_KEY, $config->get('thumbnailer', MIDAS_THUMBNAILCREATOR_THUMBNAILER_DEFAULT_VALUE), $this->moduleName);
$config = new Zend_Config_Ini($configPath, null, true);
unset($config->global->imageFormats);
unset($config->global->imagemagick);
unset($config->global->thumbnailer);
unset($config->global->useThumbnailer);
$writer = new Zend_Config_Writer_Ini();
$writer->setConfig($config);
$writer->setFilename($configPath);
$writer->write();
} else {
$settingModel->setConfig(MIDAS_THUMBNAILCREATOR_PROVIDER_KEY, MIDAS_THUMBNAILCREATOR_PROVIDER_DEFAULT_VALUE, $this->moduleName);
$settingModel->setConfig(MIDAS_THUMBNAILCREATOR_FORMAT_KEY, MIDAS_THUMBNAILCREATOR_FORMAT_DEFAULT_VALUE, $this->moduleName);
$settingModel->setConfig(MIDAS_THUMBNAILCREATOR_IMAGE_MAGICK_KEY, MIDAS_THUMBNAILCREATOR_IMAGE_MAGICK_DEFAULT_VALUE, $this->moduleName);
$settingModel->setConfig(MIDAS_THUMBNAILCREATOR_USE_THUMBNAILER_KEY, MIDAS_THUMBNAILCREATOR_USE_THUMBNAILER_DEFAULT_VALUE, $this->moduleName);
$settingModel->setConfig(MIDAS_THUMBNAILCREATOR_THUMBNAILER_KEY, MIDAS_THUMBNAILCREATOR_THUMBNAILER_DEFAULT_VALUE, $this->moduleName);
}
}
示例9: _initSession
protected function _initSession()
{
$configSession = new Zend_Config_Ini(APPLICATION_PATH . '/configs/session.ini', APPLICATION_ENV);
if (!$this->_request->isInstalling()) {
$config = array('name' => 'session', 'primary' => 'session_id', 'modifiedColumn' => 'modified', 'dataColumn' => 'data', 'lifetimeColumn' => 'lifetime', 'lifetime' => $configSession->gc_maxlifetime);
Zend_Session::setSaveHandler(new Zend_Session_SaveHandler_DbTable($config));
}
if (!$this->_request->isInstalling() or is_writable(Core_Model_Directory::getSessionDirectory(true))) {
$types = array();
$options = $configSession->toArray();
if (isset($options['types'])) {
$types = $options['types'];
unset($options['types']);
}
Zend_Session::start($options);
$session_type = $this->_request->isApplication() ? 'mobile' : 'front';
$session = new Core_Model_Session($session_type);
foreach ($types as $type => $class) {
$session->addType($type, $class);
}
$language_session = new Core_Model_Session('language');
if (!$language_session->current_language) {
$language_session->current_language = null;
}
Core_Model_Language::setSession($language_session);
Core_View_Default::setSession($session);
Core_Controller_Default::setSession($session);
}
}
示例10: postUpgrade
/** Post database upgrade. */
public function postUpgrade()
{
/** @var SettingModel $settingModel */
$settingModel = MidasLoader::loadModel('Setting');
$configPath = LOCAL_CONFIGS_PATH . DIRECTORY_SEPARATOR . $this->moduleName . '.local.ini';
if (file_exists($configPath)) {
$config = new Zend_Config_Ini($configPath, 'global');
$piwikUrl = isset($config->piwik->url) ? $config->piwik->url : STATISTICS_PIWIK_URL_DEFAULT_VALUE;
$settingModel->setConfig(STATISTICS_PIWIK_URL_KEY, $piwikUrl, $this->moduleName);
$piwikId = isset($config->piwik->id) ? $config->piwik->id : STATISTICS_PIWIK_SITE_ID_DEFAULT_VALUE;
$settingModel->setConfig(STATISTICS_PIWIK_SITE_ID_KEY, $piwikId, $this->moduleName);
$piwikApiKey = isset($config->piwik->apikey) ? $config->piwik->apikey : STATISTICS_PIWIK_API_KEY_DEFAULT_VALUE;
$settingModel->setConfig(STATISTICS_PIWIK_API_KEY_KEY, $piwikApiKey, $this->moduleName);
$ipInfoDbApiKey = isset($config->ipinfodb->apikey) ? $config->ipinfodb->apikey : STATISTICS_IP_INFO_DB_API_KEY_DEFAULT_VALUE;
$settingModel->setConfig(STATISTICS_IP_INFO_DB_API_KEY_KEY, $ipInfoDbApiKey, $this->moduleName);
$settingModel->setConfig(STATISTICS_SEND_DAILY_REPORTS_KEY, $config->get('report', STATISTICS_SEND_DAILY_REPORTS_DEFAULT_VALUE), $this->moduleName);
$config = new Zend_Config_Ini($configPath, null, true);
unset($config->global->piwik->url);
unset($config->global->piwik->id);
unset($config->global->piwik->pikey);
unset($config->global->ipinfodb->apikey);
unset($config->global->report);
$writer = new Zend_Config_Writer_Ini();
$writer->setConfig($config);
$writer->setFilename($configPath);
$writer->write();
} else {
$settingModel->setConfig(STATISTICS_PIWIK_URL_KEY, STATISTICS_PIWIK_URL_DEFAULT_VALUE, $this->moduleName);
$settingModel->setConfig(STATISTICS_PIWIK_SITE_ID_KEY, STATISTICS_PIWIK_SITE_ID_DEFAULT_VALUE, $this->moduleName);
$settingModel->setConfig(STATISTICS_PIWIK_API_KEY_KEY, STATISTICS_PIWIK_API_KEY_DEFAULT_VALUE, $this->moduleName);
$settingModel->setConfig(STATISTICS_IP_INFO_DB_API_KEY_KEY, STATISTICS_IP_INFO_DB_API_KEY_DEFAULT_VALUE, $this->moduleName);
$settingModel->setConfig(STATISTICS_SEND_DAILY_REPORTS_KEY, STATISTICS_SEND_DAILY_REPORTS_DEFAULT_VALUE, $this->moduleName);
}
}
示例11: getApplication
/**
*
* @return Zend_Application
*/
public static function getApplication()
{
$application = new Zend_Application(APPLICATION_ENV);
$applicationini = new Zend_Config_Ini(APPLICATION_PATH . "/configs/application.ini", APPLICATION_ENV);
$options = $applicationini->toArray();
foreach (self::$_ini as $value) {
$iniFile = APPLICATION_PATH . self::$_pathConfig . $value;
if (is_readable($iniFile)) {
$config = new Zend_Config_Ini($iniFile);
$options = $application->mergeOptions($options, $config->toArray());
} else {
throw new Zend_Exception('error en la configuracion de los .ini');
}
}
// foreach (self::$_ini as $value) {
// $iniFile = APPLICATION_PATH . self::$_pathConfig . $value;
//
// if (is_readable($iniFile)) {
// $config = new Zend_Config_Ini($iniFile);
// $options = $application->mergeOptions($options,
// $config->toArray());
// } else {
// throw new Zend_Exception('error en la configuracion de los .ini');
// }
// }
Zend_Registry::set('config', $options);
$a = $application->setOptions($options);
return $application;
}
示例12: _initSession
protected function _initSession()
{
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/sessions.ini', 'development');
Zend_Session::setOptions($config->toArray());
// start session
Zend_Session::start();
}
示例13: postUpgrade
/** Post database upgrade. */
public function postUpgrade()
{
/** @var SettingModel $settingModel */
$settingModel = MidasLoader::loadModel('Setting');
$config = new Zend_Config_Ini(APPLICATION_CONFIG, 'global');
$settingModel->setConfig('address_verification', $config->get('verifyemail', 0), 'mail');
if ($config->get('smtpfromaddress')) {
$fromAddress = $config->get('smtpfromaddress');
} elseif (ini_get('sendmail_from')) {
$fromAddress = ini_get('sendmail_from');
} else {
$fromAddress = 'no-reply@example.org';
// RFC2606
}
$settingModel->setConfig('from_address', $fromAddress, 'mail');
if ($config->get('smtpserver')) {
$components = parse_url($config->get('smtpserver'));
if (isset($components['host'])) {
$settingModel->setConfig('smtp_host', $components['host'], 'mail');
}
if (isset($components['port'])) {
$settingModel->setConfig('smtp_port', $components['port'], 'mail');
if ($components['port'] === 587) {
$settingModel->setConfig('smtp_use_ssl', 1, 'mail');
}
}
if (isset($components['user'])) {
$settingModel->setConfig('smtp_username', $components['user'], 'mail');
}
if (isset($components['pass'])) {
$settingModel->setConfig('smtp_password', $components['pass'], 'mail');
}
}
if ($config->get('smtpuser')) {
$settingModel->setConfig('smtp_username', $config->get('smtpuser'), 'mail');
}
if ($config->get('smtppassword')) {
$settingModel->setConfig('smtp_password', $config->get('smtppassword'), 'mail');
}
if ($settingModel->getValueByName('smtp_host', 'mail')) {
$provider = 'smtp';
} else {
$provider = 'mail';
}
$settingModel->setConfig('provider', $provider, 'mail');
/** @var UtilityComponent $utilityComponent */
$utilityComponent = MidasLoader::loadComponent('Utility');
$utilityComponent->installModule('mail');
$config = new Zend_Config_Ini(APPLICATION_CONFIG, null, true);
unset($config->global->smtpfromaddress);
unset($config->global->smtpserver);
unset($config->global->smtpuser);
unset($config->global->smtppassword);
unset($config->global->verifyemail);
$writer = new Zend_Config_Writer_Ini();
$writer->setConfig($config);
$writer->setFilename(APPLICATION_CONFIG);
$writer->write();
}
示例14: setUp
public function setUp()
{
parent::setUp();
$config = new Zend_Config_Ini(dirname(__FILE__) . "/KAsyncCaptureThumbTest.ini");
$testConfig = $config->get('config');
$this->outputFolder = dirname(__FILE__) . '/' . $testConfig->outputFolder;
$this->testsConfig = $config->get('tests');
}
示例15: getRecipients
private static function getRecipients($docid, $rec_num = -1)
{
$db = Zend_Db_Table_Abstract::getDefaultAdapter();
$sql = "select AV.VAL\r\nfrom V_ADD_VALUES AV\r\nwhere AV.NODEID = ?\r\nand AV.FIELDNAME = '_ADD_RECIPIENTS'";
$rec = $db->fetchOne($sql, $docid);
$rec = new Zend_Config_Ini('data://,' . $rec);
return $rec->toArray();
}