Zend_Config PHP Class Code Examples

This page contains top rated real world PHP examples of class Zend_Config extracted from open source projects. You can rate examples to help us improve the quality of examples

Example #1
Show file File: JDownloader.php Project: google-code-backups/vlc-shares
0
 function __construct(Zend_Config $options = null)
 {
     if ($options == null) {
         $options = new Zend_Config(array('ip' => 'localhost', 'port' => '10025', 'timeout' => '1', 'nightly' => false));
     }
     $this->options = $options;
 }
Example #2
Show file File: Hulu.php Project: google-code-backups/vlc-shares
0
 function __construct(Zend_Config $options = null)
 {
     if ($options == null) {
         $options = new Zend_Config(array('username' => '', 'password' => '', 'plus' => false, 'cdn' => 'limelight', 'quality' => '400_h264'));
     }
     $this->options = $options;
 }
Example #3
Show file File: IndexControllerTest.php Project: belapp/opus4-application
0
 public function testFacetSortForYearInverted()
 {
     // manipulate application configuration
     $oldConfig = Zend_Registry::get('Zend_Config');
     $config = Zend_Registry::get('Zend_Config');
     if (isset($config->searchengine->solr->sortcrit->year_inverted)) {
         $config->searchengine->solr->sortcrit->year_inverted = 'lexi';
     } else {
         $config = new Zend_Config(array('searchengine' => array('solr' => array('sortcrit' => array('year_inverted' => 'lexi')))), true);
         // Include the above made configuration changes in the application configuration.
         $config->merge(Zend_Registry::get('Zend_Config'));
     }
     if (isset($config->searchengine->solr->facets)) {
         $config->searchengine->solr->facets = 'year_inverted,doctype,author_facet,language,has_fulltext,belongs_to_bibliography,subject,institute';
     } else {
         $config = new Zend_Config(array('searchengine' => array('solr' => array('facets' => 'year_inverted,doctype,author_facet,language,has_fulltext,belongs_to_bibliography,subject,institute'))), true);
         // Include the above made configuration changes in the application configuration.
         $config->merge(Zend_Registry::get('Zend_Config'));
     }
     Zend_Registry::set('Zend_Config', $config);
     $this->dispatch('/solrsearch/index/search/searchtype/all');
     // undo configuration manipulation
     Zend_Registry::set('Zend_Config', $oldConfig);
     $searchStrings = array('2013', '2012', '2011', '2010', '2009', '2008', '2007', '2005', '2004', '2003');
     $this->assertPositions($this->getResponse()->getBody(), $searchStrings, 'id="year_facet"');
     $this->resetResponse();
     $this->dispatch('/solrsearch/index/search/searchtype/all');
     $searchStrings = array('2011', '2009', '2010', '1978', '2008', '2012', '1979', '1962', '1963', '1975');
     // Wenn es hier bei den Tests Probleme gibt AssumptionChecker für die Diagnose verwenden (in tests/support).
     $this->assertPositions($this->getResponse()->getBody(), $searchStrings, 'id="year_facet"');
 }
Example #4
Show file File: Web.php Project: xiaoguizhidao/koala-framework
0
 /**
  * Diesen Merge sollte eigentlich das Zend machen, aber das merged nicht so
  * wie wir das erwarten. Beispiel:
  *
  * Main Config:
  * bla.blubb[] = x
  * bla.blubb[] = y
  * bla.blubb[] = z
  *
  * Merge Config:
  * bla.blubb[] = a
  * bla.blubb[] = b
  *
  * Nach den Config-Section regeln würde man erwarten, dass nach dem mergen nur mehr
  * a und b drin steht. Tatsächlich merget Zend aber so, dass a, b, z überbleibt.
  * Zend überschreibt die Werte, was wir nicht wollen, deshalb dieses
  * händische mergen hier.
  */
 public static function mergeConfigs(Zend_Config $main, Zend_Config $merge)
 {
     // check if all keys are of type 'integer' and if so, only use merge config
     $everyKeyIsInteger = true;
     foreach ($merge as $key => $item) {
         if (!is_int($key)) {
             $everyKeyIsInteger = false;
             break;
         }
     }
     if ($everyKeyIsInteger) {
         return $merge;
     }
     foreach ($merge as $key => $item) {
         if (isset($main->{$key})) {
             if ($item instanceof Zend_Config && $main->{$key} instanceof Zend_Config) {
                 $main->{$key} = Kwf_Config_Web::mergeConfigs($main->{$key}, new Zend_Config($item->toArray(), !$main->readOnly()));
             } else {
                 $main->{$key} = $item;
             }
         } else {
             if ($item instanceof Zend_Config) {
                 $main->{$key} = new Zend_Config($item->toArray(), !$main->readOnly());
             } else {
                 $main->{$key} = $item;
             }
         }
     }
     return $main;
 }
Example #5
Show file File: Megavideo.php Project: google-code-backups/vlc-shares
0
 function __construct(Zend_Config $options = null)
 {
     if ($options == null) {
         $options = new Zend_Config(array('username' => '', 'password' => '', 'premium' => false));
     }
     $this->options = $options;
 }
Example #6
Show file File: Bootstrap.php Project: arendasistemasintegrados/mateusleme
0
 /**
  * Configura o sistema
  *
  * @return Zend_Config
  */
 protected function _initConfig()
 {
     $aOpcaoConfiguracao = $this->getOptions();
     $oConfig = new Zend_Config($aOpcaoConfiguracao, TRUE);
     Zend_Registry::set('config', $oConfig);
     try {
         // Verifica se foi atualizado o sistema
         $sArquivoAtualizacao = APPLICATION_PATH . '/../versao.txt';
         if (file_exists($sArquivoAtualizacao)) {
             $sVersaoAtualizada = implode('', file($sArquivoAtualizacao));
             $aOpcaoConfiguracao['ecidadeonline2']['versao'] = trim($sVersaoAtualizada);
             $aOpcaoConfiguracao['settings']['application']['cache'] = trim($sVersaoAtualizada);
             Administrativo_Model_Versao::atualizaVersaoNfse($sVersaoAtualizada);
             $oConfig = new Zend_Config($aOpcaoConfiguracao, TRUE);
             Zend_Registry::set('config', $oConfig);
         }
         if (file_exists(APPLICATION_PATH . '/data/Ipx/webservice-ecidade.ini')) {
             $webservice = new Zend_Config_Ini(APPLICATION_PATH . '/data/Ipx/webservice-ecidade.ini', null, array('allowModifications' => TRUE));
             Zend_Registry::set('webservice.ecidade', $webservice);
         } else {
             throw new WebService_Lib_Exception(null, null, 'W03');
         }
     } catch (WebService_Lib_Exception $oErro) {
         DBSeller_Plugin_Notificacao::addErro($oErro->getCode(), $oErro->getMessage());
     }
     return $oConfig;
 }
Example #7
Show file File: Core.php Project: ingoratsdorf/Tine-2.0-Open-Source-Groupware-and-CRM
0
 /**
  * setups global config
  * 
  * NOTE a config object will be instantiated regardless of the existance of 
  *      the config file!
  *
  * @return void
  */
 public static function setupConfig()
 {
     if (self::configFileExists()) {
         $config = new Zend_Config(require self::getConfigFilePath());
     } else {
         $config = new Zend_Config(array());
     }
     self::set(self::CONFIG, $config);
 }
Example #8
Show file File: IndexController.php Project: sepano/open-social-media-monitoring
0
 public function processAction()
 {
     $error = array();
     $defaultNamespace = new Zend_Session_Namespace('Default');
     $options = array('authentication' => array('email' => $this->getRequest()->getParam('admin_email'), 'password' => $this->getRequest()->getParam('admin_password')), 'settings' => array('default_from' => $this->getRequest()->getParam('default_from'), 'keep_history' => $this->getRequest()->getParam('keep_history'), 'alchemy_api_key' => $this->getRequest()->getParam('alchemy_api_key')), 'resources' => array('db' => array('adapter' => 'PDO_MYSQL', 'params' => array('host' => $this->getRequest()->getParam('db_host'), 'username' => $this->getRequest()->getParam('db_user'), 'password' => $this->getRequest()->getParam('db_password'), 'dbname' => $this->getRequest()->getParam('db_name'), 'prefix' => $this->getRequest()->getParam('db_prefix')))), 'template' => $this->getRequest()->getParam('template'));
     $validator = new Zend_Validate_EmailAddress();
     if (!$validator->isValid($options['authentication']['email'])) {
         $error['admin_email'] = 'Administrator e-mail is invalid';
     }
     if (!trim($options['authentication']['password'])) {
         $error['admin_password'] = 'Administrator password can not be blank';
     }
     if (!$validator->isValid($options['settings']['default_from'])) {
         $error['default_from'] = 'Default "from" e-mail is invalid';
     }
     if (!trim($options['resources']['db']['params']['host'])) {
         $error['db_host'] = 'Database host can not be blank';
     }
     if (!trim($options['resources']['db']['params']['username'])) {
         $error['db_user'] = 'Database user can not be blank';
     }
     if (!trim($options['resources']['db']['params']['dbname'])) {
         $error['db_name'] = 'Database name can not be blank';
     }
     if ((int) $options['settings']['keep_history'] <= 0) {
         $error['keep_history'] = 'Timeline display length have to be positive integer';
     }
     if (!($db = new Zend_Db_Adapter_Pdo_Mysql(array('host' => $options['resources']['db']['params']['host'], 'username' => $options['resources']['db']['params']['username'], 'password' => $options['resources']['db']['params']['password'], 'dbname' => $options['resources']['db']['params']['dbname'])))) {
         $error[] = 'Incorrect database connection details';
     }
     if (count($error)) {
         /**
          * Redirect back
          */
         $defaultNamespace->error = $error;
         $defaultNamespace->options = $options;
         $this->_helper->redirector('index', 'index', 'install');
     } else {
         /**
          * Write .ini file
          */
         unset($defaultNamespace->options);
         /** @var $bootstrap Bootstrap */
         $bootstrap = $this->getInvokeArg('bootstrap');
         $options = new Zend_Config($options);
         $writer = new Zend_Config_Writer_Xml();
         $writer->write($bootstrap->getOption('local_config'), $options);
         $options = $bootstrap->getOptions();
         $options = new Zend_Config($options);
         $writer->write('application.xml', $options);
         $this->_helper->redirector('index', 'index', 'default');
     }
 }
Example #9
Show file File: Streamer.php Project: google-code-backups/vlc-shares
0
 public function __construct($options = array())
 {
     if (is_array($options)) {
         $options = new Zend_Config($options);
     }
     if (!$options instanceof Zend_Config) {
         $options = new Zend_Config(array());
     }
     $this->options = $options;
     // vlc streamer is not special
     // i had it here only for dev purpose
     // TODO move vlc streamer init away from here
     //$this->register(new X_Streamer_Engine_Vlc());
 }
Example #10
Show file File: FileAbstract.php Project: par-orillonsoft/Magento
0
 /**
  * Write configuration to file.
  *
  * @param string $filename
  * @param Zend_Config $config
  * @param bool $exclusiveLock
  * @return void
  */
 public function write($filename = null, Zend_Config $config = null, $exclusiveLock = null)
 {
     if ($filename !== null) {
         $this->setFilename($filename);
     }
     if ($config !== null) {
         $this->setConfig($config);
     }
     if ($exclusiveLock !== null) {
         $this->setExclusiveLock($exclusiveLock);
     }
     if ($this->_filename === null) {
         #require_once 'Zend/Config/Exception.php';
         throw new Zend_Config_Exception('No filename was set');
     }
     if ($this->_config === null) {
         #require_once 'Zend/Config/Exception.php';
         throw new Zend_Config_Exception('No config was set');
     }
     $configString = $this->render();
     $flags = 0;
     if ($this->_exclusiveLock) {
         $flags |= LOCK_EX;
     }
     $result = @file_put_contents($this->_filename, $configString, $flags);
     if ($result === false) {
         #require_once 'Zend/Config/Exception.php';
         throw new Zend_Config_Exception('Could not write to file "' . $this->_filename . '"');
     }
 }
Example #11
Show file File: FileAbstract.php Project: kobmaki/icingaweb2
0
 /**
  * Write configuration to file.
  *
  * @param string $filename
  * @param Zend_Config $config
  * @param bool $exclusiveLock
  * @return void
  */
 public function write($filename = null, Zend_Config $config = null, $exclusiveLock = null)
 {
     if ($filename !== null) {
         $this->setFilename($filename);
     }
     if ($config !== null) {
         $this->setConfig($config);
     }
     if ($exclusiveLock !== null) {
         $this->setExclusiveLock($exclusiveLock);
     }
     if ($this->_filename === null) {
         throw new Zend_Config_Exception('No filename was set');
     }
     if ($this->_config === null) {
         throw new Zend_Config_Exception('No config was set');
     }
     $configString = $this->render();
     $flags = 0;
     if ($this->_exclusiveLock) {
         $flags |= LOCK_EX;
     }
     $result = @file_put_contents($this->_filename, $configString, $flags);
     if ($result === false) {
         throw new Zend_Config_Exception('Could not write to file "' . $this->_filename . '"');
     }
 }
Example #12
Show file File: Regex.php Project: kobmaki/icingaweb2
0
 /**
  * Instantiates route based on passed Zend_Config structure
  *
  * @param Zend_Config $config Configuration object
  * @return Zend_Controller_Router_Route_Regex
  */
 public static function getInstance(Zend_Config $config)
 {
     $defs = $config->defaults instanceof Zend_Config ? $config->defaults->toArray() : array();
     $map = $config->map instanceof Zend_Config ? $config->map->toArray() : array();
     $reverse = isset($config->reverse) ? $config->reverse : null;
     return new self($config->route, $defs, $map, $reverse);
 }
Example #13
Show file File: Hostname.php Project: dragonlet/clearhealth
0
 /**
  * Instantiates route based on passed Zend_Config structure
  *
  * @param Zend_Config $config Configuration object
  */
 public static function getInstance(Zend_Config $config)
 {
     $reqs = $config->reqs instanceof Zend_Config ? $config->reqs->toArray() : array();
     $defs = $config->defaults instanceof Zend_Config ? $config->defaults->toArray() : array();
     $scheme = isset($config->scheme) ? $config->scheme : null;
     return new self($config->route, $defs, $reqs, $scheme);
 }
Example #14
Show file File: JavaClientGenerator.php Project: DBezemer/server
0
 function __construct($xmlPath, Zend_Config $config, $sourcePath = "sources/java")
 {
     parent::__construct($xmlPath, $sourcePath, $config);
     $this->_usePrivateAttributes = isset($config->usePrivateAttributes) ? $config->usePrivateAttributes : false;
     $this->_doc = new KDOMDocument();
     $this->_doc->load($this->_xmlFile);
 }
Example #15
Show file File: Inflector.php Project: sonicmaster/RPG
0
 /**
  * Use Zend_Config object to set object state
  *
  * @param  Zend_Config $config
  * @return Zend_Filter_Inflector
  */
 public function setConfig(Zend_Config $config)
 {
     foreach ($config as $key => $value) {
         switch ($key) {
             case 'target':
                 $this->setTarget($value);
                 break;
             case 'filterPrefixPath':
                 if (is_scalar($value)) {
                     break;
                 }
                 $paths = $value->toArray();
                 foreach ($paths as $prefix => $path) {
                     $this->addFilterPrefixPath($prefix, $path);
                 }
                 break;
             case 'throwTargetExceptionsOn':
                 $this->setThrowTargetExceptionsOn($value);
                 break;
             case 'targetReplacementIdentifier':
                 $this->setTargetReplacementIdentifier($value);
                 break;
             case 'rules':
                 $this->addRules($value->toArray());
                 break;
             default:
                 break;
         }
     }
     return $this;
 }