当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Config类代码示例

本文整理汇总了PHP中Zend_Config的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Config类的具体用法?PHP Zend_Config怎么用?PHP Zend_Config使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Zend_Config类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: config

 /**
  * @param array $config
  */
 public function config($config = [])
 {
     $settings = null;
     // check for an initial configuration template
     // used eg. by the demo installer
     $configTemplatePath = PIMCORE_CONFIGURATION_DIRECTORY . "/system.template.php";
     if (file_exists($configTemplatePath)) {
         try {
             $configTemplate = new \Zend_Config(include $configTemplatePath);
             if ($configTemplate->general) {
                 // check if the template contains a valid configuration
                 $settings = $configTemplate->toArray();
                 // unset database configuration
                 unset($settings["database"]["params"]["host"]);
                 unset($settings["database"]["params"]["port"]);
             }
         } catch (\Exception $e) {
         }
     }
     // set default configuration if no template is present
     if (!$settings) {
         // write configuration file
         $settings = ["general" => ["timezone" => "Europe/Berlin", "language" => "en", "validLanguages" => "en", "debug" => "1", "debugloglevel" => "debug", "custom_php_logfile" => "1", "extjs6" => "1"], "database" => ["adapter" => "Mysqli", "params" => ["username" => "root", "password" => "", "dbname" => ""]], "documents" => ["versions" => ["steps" => "10"], "default_controller" => "default", "default_action" => "default", "error_pages" => ["default" => "/"], "createredirectwhenmoved" => "", "allowtrailingslash" => "no", "generatepreview" => "1"], "objects" => ["versions" => ["steps" => "10"]], "assets" => ["versions" => ["steps" => "10"]], "services" => [], "cache" => ["excludeCookie" => ""], "httpclient" => ["adapter" => "Zend_Http_Client_Adapter_Socket"]];
     }
     $settings = array_replace_recursive($settings, $config);
     // create initial /website/var folder structure
     // @TODO: should use values out of startup.php (Constants)
     $varFolders = ["areas", "assets", "backup", "cache", "classes", "config", "email", "log", "plugins", "recyclebin", "search", "system", "tmp", "versions", "webdav"];
     foreach ($varFolders as $folder) {
         \Pimcore\File::mkdir(PIMCORE_WEBSITE_VAR . "/" . $folder);
     }
     $configFile = \Pimcore\Config::locateConfigFile("system.php");
     File::putPhpFile($configFile, to_php_data_file_format($settings));
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:37,代码来源:Setup.php

示例2: _initConfig

 /**
  * Combine the static info found in application.ini with the
  * dynamic info found in the Info table.
  *
  * @return void
  */
 protected function _initConfig()
 {
     $this->bootstrap('db');
     $this->bootstrap('locale');
     if (!class_exists('Model_Info')) {
         return;
     }
     try {
         $staticConfig = Zend_Registry::get('config');
         $infoModel = $this->_getInfoModel();
         $dynamicConfig = $infoModel->fetchAsConfig(null, APPLICATION_ENV);
         // Very sneakily bypass 'readOnly'
         if ($staticConfig->readOnly()) {
             $staticConfig = new Zend_Config($staticConfig->toArray(), APPLICATION_ENV, true);
         }
         $staticConfig->merge($dynamicConfig);
         $staticConfig->setReadOnly();
         Zend_Registry::set('config', $staticConfig);
     } catch (Exception $e) {
         $msg = $e->getMessage();
         if (strpos($msg, 'Unknown database') === false && strpos($msg, "doesn't exist") === false) {
             throw $e;
         }
     }
 }
开发者ID:grrr-amsterdam,项目名称:garp3,代码行数:31,代码来源:Bootstrap.php

示例3: setup

 /**
  * Setup db
  *
  */
 public function setup(Zend_Config $config)
 {
     $sessionConfig = $config->get('config');
     $configArray = $sessionConfig->toArray();
     // save_path handler
     $configArray = $this->_prependSavePath($configArray);
     // name handler
     $configArray = $this->_parseName($configArray);
     // Setup config
     Zend_Session::setOptions($configArray);
     // Setup save handling?
     $saveHandlerConfig = $config->get('save_handler');
     if ($className = $saveHandlerConfig->get('class_name')) {
         if ($args = $saveHandlerConfig->get('constructor_args')) {
             if ($args instanceof Zend_Config) {
                 $args = $args->toArray();
             } else {
                 $args = (array) $args;
             }
         } else {
             $args = array();
         }
         require_once 'Zend/Loader.php';
         Zend_Loader::loadClass($className);
         $saveHandler = new ReflectionClass($className);
         $saveHandler = $saveHandler->newInstanceArgs($args);
         Zend_Session::setSaveHandler($saveHandler);
     }
     // Autostart session?
     if ($config->get('auto_start')) {
         // Start session
         Zend_Session::start();
     }
 }
开发者ID:BGCX262,项目名称:zym-svn-to-git,代码行数:38,代码来源:Session.php

示例4: setup

 /**
  * Setup Doctrine
  *
  * @return void
  */
 public function setup(Zend_Config $config)
 {
     if (is_array($config->path_config)) {
         $this->setPathConfig($config->path_config);
     } elseif ($config->path_config instanceof Zend_Config) {
         $this->setPathConfig($config->path_config->toArray());
     }
     if ($charset = $config->get('charset')) {
         $listener = new Zym_App_Resource_Doctrine_ConnectionListener();
         $listener->setCharset($charset);
         Doctrine_Manager::getInstance()->addListener($listener);
     }
     // determine if config is for a single-db or a multi-db site
     $connections = $config->connection instanceof Zend_Config ? $config->connection->toArray() : (array) $config->connection;
     // add connection(s) to doctrine
     foreach ($connections as $name => $connection) {
         if ($connection instanceof Zend_Config) {
             $connection = $connection->toArray();
         }
         if (is_string($name)) {
             Doctrine_Manager::connection($connection, $name);
         } else {
             Doctrine_Manager::connection($connection);
         }
     }
 }
开发者ID:BGCX262,项目名称:zym-svn-to-git,代码行数:31,代码来源:Doctrine.php

示例5: _initConfig

 /**
  * Инициализация конфигурации
  */
 protected function _initConfig()
 {
     $path = APPLICATION_PATH . '/../library/Zkernel/Application/configs';
     $config = new Zend_Config(array(), true);
     $it = new DirectoryIterator($path);
     foreach ($it as $file) {
         if ($file->isFile()) {
             $fullpath = $path . '/' . $file;
             switch (substr(trim(strtolower($fullpath)), -3)) {
                 case 'ini':
                     $cfg = new Zend_Config_Ini($fullpath, $this->getEnvironment());
                     break;
                 case 'xml':
                     $cfg = new Zend_Config_Xml($fullpath, $this->getEnvironment());
                     break;
                 default:
                     throw new Zend_Config_Exception('Invalid format for config file');
                     break;
             }
             $config->merge($cfg);
         }
     }
     $config->merge(new Zend_Config($this->getOptions()));
     $this->setOptions($config->toArray());
 }
开发者ID:s-kalaus,项目名称:zkernel,代码行数:28,代码来源:Bootstrap.php

示例6: getArgConfig

 /**
  * @param Zend_Config $testConfig
  * @param ReflectionParameter $arg
  * @throws Exception
  * @throws KalturaTestException
  * @return Ambigous
  */
 protected function getArgConfig(Zend_Config $testConfig, ReflectionParameter $arg)
 {
     $argName = $arg->getName();
     $argConfig = $testConfig->get($argName);
     KalturaLog::debug("Tests data [{$argName}] config [" . print_r($argConfig, true) . "]");
     if (!$argConfig) {
         if (!$arg->allowsNull()) {
             throw new Exception("Argument [{$argName}] can't be null for test [" . $this->getName() . "]");
         }
         return null;
     }
     if (is_string($argConfig)) {
         return $argConfig;
     }
     switch ($argConfig->objectType) {
         case 'dependency':
             throw new KalturaTestException("Argument [{$argName}] taken from dependency");
         case 'array':
             return $this->populateArray($argConfig);
         case 'native':
             return $argConfig->value;
         case 'file':
             return $argConfig->path;
         default:
             return $this->populateObject($argConfig);
     }
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:34,代码来源:KalturaTestCaseApiBase.php

示例7: mapSlavesConfig

 /**
  * @param $databaseConfig
  * @param $masterParams
  * @return array
  */
 private function mapSlavesConfig(Zend_Config $databaseConfig, $masterParams)
 {
     $slaves = $databaseConfig->get('slaves');
     if (!$slaves || !$slaves instanceof Zend_Config || $slaves->count() === 0) {
         $slaves = array();
     }
     $slavesParams = array();
     foreach ($slaves as $slaveId) {
         $slaveConfig = $databaseConfig->get($slaveId);
         if (!$slaveConfig || !$slaveConfig instanceof Zend_Config) {
             $this->logger->warning(sprintf("Listed slave '%s' has no configuration. Skipping candidate slave.", $slaveId));
             continue;
         }
         $slaveParams = $this->getParamsFromConfig($slaveConfig);
         if ($slaveParams['driver'] !== $masterParams['driver']) {
             $this->logger->warning(sprintf("Listed slave '%s' has different driver ('%s') than master ('%s'). This is not supported. " . 'Skipping candidate slave.', $slaveId, $slaveParams['driver'], $masterParams['driver']));
             continue;
         }
         $slavesParams[] = $slaveParams;
     }
     if (empty($slavesParams)) {
         $this->logger->warning('No (properly) configured slaves, using master as slave.');
         $slavesParams[] = $masterParams;
     }
     return $slavesParams;
 }
开发者ID:WebSpider,项目名称:OpenConext-engineblock,代码行数:31,代码来源:ConfigMapper.php

示例8: getTransport

    /**
     * Get transport
     *
     * @param Zend_Config $config
     * @return Zend_Mail_Transport_Sendmail
     */
    public static function getTransport(Zend_Config $config = null)
    {
        $host        = isset($config->host) ? $config->get('host') : null;
        $otherConfig = ($config instanceof Zend_Config) ? $config->toArray() : null;

        return new Zend_Mail_Transport_Smtp($host, $otherConfig);
    }
开发者ID:BGCX262,项目名称:zym-svn-to-git,代码行数:13,代码来源:Smtp.php

示例9: __construct

 /**
  * Constructor.
  * @param array $options
  */
 public function __construct(Zend_Config $config = null)
 {
     $defaultConfig = new Zend_Config(array('style' => array('itemClass' => 'Item', 'titleClass' => 'Title', 'descriptionClass' => 'Description', 'tagContainerClass' => 'TagList', 'tagClass' => 'Tag', 'iconClass' => 'Icon', 'iconWidth' => 16, 'iconHeight' => 16, 'dateClass' => 'Date')), true);
     if (!is_null($config)) {
         $defaultConfig->merge($config);
     }
     $this->_config = $defaultConfig;
 }
开发者ID:polycaster,项目名称:Polycast_Stalker,代码行数:12,代码来源:Abstract.php

示例10: _init

 /**
  * Pseudo-constructor (the actual constructor must be final).
  * @param Zend_Config $config
  * @return void
  */
 protected function _init(Zend_Config $config)
 {
     $defaultConfig = new Zend_Config(array('url' => null, 'cacheLifetime' => 7200, 'cacheDir' => './cache', 'limit' => 5, 'items' => array()), true);
     if (!isset($config->url)) {
         throw new Polycast_Stalker_Provider_Exception('No feed url given');
     }
     $this->_config = $defaultConfig->merge($config);
 }
开发者ID:polycaster,项目名称:Polycast_Stalker,代码行数:13,代码来源:Feed.php

示例11: testSetOptionsSkipsCallsToSetOptionsAndSetConfig

 public function testSetOptionsSkipsCallsToSetOptionsAndSetConfig()
 {
     $options = $this->getOptions();
     $config = new Zend_Config($options);
     $options['config'] = $config;
     $options['options'] = $config->toArray();
     $this->form->setOptions($options);
 }
开发者ID:lortnus,项目名称:zf1,代码行数:8,代码来源:FormTest.php

示例12: setup

 /**
  * Setup navigation
  *
  * @return void
  */
 public function setup(Zend_Config $config)
 {
     // determine registry key
     $confKey = $config->get('registry_key');
     $key = is_string($confKey) && strlen($confKey) ? $confKey : self::DEFAULT_REGISTRY_KEY;
     $nav = new Zym_Navigation($config->get('pages'));
     Zend_Registry::set($key, $nav);
 }
开发者ID:BGCX262,项目名称:zym-svn-to-git,代码行数:13,代码来源:Navigation.php

示例13: __construct

 /**
  * Sets filter options
  *
  * @param  string|array|Zend_Config $options
  * @return void
  */
 public function __construct($options = null)
 {
     if ($options instanceof Zend_Config) {
         $this->_options = $options->toArray();
     } else {
         $this->_options = (array) $options;
     }
 }
开发者ID:slkxmail,项目名称:App,代码行数:14,代码来源:Url.php

示例14: setQuotaModuleEnableDev

 /**
  * @param boolean $enableDev
  */
 protected function setQuotaModuleEnableDev($enableDev)
 {
     $config = Registry::getConfig();
     $newConfig = new \Zend_Config($config->toArray(), true);
     $newConfig->quota->module->enableDev = $enableDev;
     $newConfig->setReadOnly();
     Registry::setConfig($newConfig);
 }
开发者ID:rukzuk,项目名称:rukzuk,代码行数:11,代码来源:AbstractImportQuotaTestCase.php

示例15: fromZendConfig

 /**
  * 
  * Creates a new test configuration from Zend_Config
  */
 public static function fromZendConfig(Zend_Config $config)
 {
     $newConfig = new KalturaTestConfig();
     $dataArray = $config->toArray();
     foreach ($dataArray as $key => $value) {
         $newConfig->{$key} = $value;
     }
     return $newConfig;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:13,代码来源:KalturaTestConfig.php


注:本文中的Zend_Config类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。