• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Zend_Config类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: __construct

 /**
  * Constructor.
  * @param Zend_Config $config
  */
 public function __construct(Zend_Config $config = null)
 {
     $defaultConfig = new Zend_Config(array('providers' => array(), 'style' => array('id' => 'Stalker', 'class' => 'Stalker')), true);
     $defaultConfig->merge($config);
     $this->_config = $defaultConfig;
     foreach ($this->_config->providers as $name => $providerConfig) {
         $this->addProvider(Polycast_Stalker_Provider::factory($providerConfig), $name);
     }
 }
开发者ID:polycaster,项目名称:Polycast_Stalker,代码行数:13,代码来源:Stalker.php


示例17: loadFromMultiFiles

 public function loadFromMultiFiles(array $files, $ns, $save = true)
 {
     $conf = new Zend_Config(array(), true);
     foreach ($files as $file) {
         $fileConf = $this->_loadConfigFromFile($file);
         $conf->merge($fileConf);
     }
     return $this->processConfigFile($conf, $ns, $save);
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:9,代码来源:Abstract.php


示例18: createFromConfig

 public static function createFromConfig(Zend_Config $config)
 {
     if (!isset($config->host) || $config->host == '') {
         throw new EngineBlock_Exception('No Grouper Host specified! Please set "grouper.host" in your application configuration.');
     }
     $url = $config->protocol . '://' . $config->user . ':' . $config->password . '@' . $config->host . (isset($config->port) ? ':' . $config->port : '') . $config->path . '/' . $config->version . '/';
     $grouper = new self($url, $config->toArray());
     return $grouper;
 }
开发者ID:newlongwhitecloudy,项目名称:OpenConext-engineblock,代码行数:9,代码来源:Rest.php


示例19: setOptions

 /**
  * @return X_SopCast
  */
 public function setOptions($options)
 {
     if (is_array($options)) {
         $options = new Zend_Config($options);
     }
     if ($options instanceof Zend_Config) {
         $this->setPath($options->get('path', null));
     }
     return $this;
 }
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:13,代码来源:SopCast.php


示例20: getPlugin

 /**
  * Return errorHandler
  *
  * @param  Zend_Config $config
  * @return Zym_Controller_Plugin_ErrorHandler
  */
 public function getPlugin(Zend_Config $config = null)
 {
     if ($config instanceof Zend_Config) {
         $options = $config->toArray();
     } else {
         $options = array();
     }
     $plugin = new Zym_Controller_Plugin_ErrorHandler($options);
     return $plugin;
 }
开发者ID:BGCX262,项目名称:zym-svn-to-git,代码行数:16,代码来源:ErrorHandler.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Zend_Config_Ini类代码示例发布时间:2022-05-23
下一篇:
PHP Zend_CodeGenerator_Php_Parameter类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap