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


PHP rex::getConfig方法代码示例

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


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

示例1: testRexConfig

 public function testRexConfig()
 {
     $key = 'aTestKey';
     // initial test on empty config
     $this->assertFalse(rex::hasConfig($key), 'the key does not exists at first');
     $this->assertNull(rex::getConfig($key), 'getting non existing key returns null');
     $this->assertEquals(rex::getConfig($key, 'defVal'), 'defVal', 'getting non existing key returns a given default');
     $this->assertFalse(rex::removeConfig($key), 'remove non existing key returns false');
     // test after setting a value
     $this->assertFalse(rex::setConfig($key, 'aVal'), 'setting non-existant value returns false');
     $this->assertEquals(rex::getConfig($key, 'defVal'), 'aVal', 'getting existing key returns its value');
     $this->assertTrue(rex::hasConfig($key), 'setted value exists');
     // test after re-setting a value
     $this->assertTrue(rex::setConfig($key, 'aOtherVal'), 're-setting a value returns true');
     $this->assertEquals(rex::getConfig($key, 'defaOtherVal'), 'aOtherVal', 'getting existing key returns its value');
     // test after cleanup
     $this->assertTrue(rex::removeConfig($key), 'remove a existing key returns true');
     $this->assertFalse(rex::hasConfig($key), 'the key does not exists after removal');
     $this->assertNull(rex::getConfig($key), 'getting non existing key returns null');
     $this->assertEquals(rex::getConfig($key, 'defVal'), 'defVal', 'getting non existing key returns a given default');
 }
开发者ID:staabm,项目名称:redaxo,代码行数:21,代码来源:rex_test.php

示例2: updateFromPrevious

 public static function updateFromPrevious()
 {
     // ----- vorhandenen seite updaten
     $err_msg = '';
     if ($err_msg == '') {
         $version = rex::getVersion();
         rex::setProperty('version', rex::getConfig('version'));
         try {
             include rex_path::core('update.php');
         } catch (rex_functional_exception $e) {
             $err_msg .= $e->getMessage();
         } catch (rex_sql_exception $e) {
             $err_msg .= 'SQL error: ' . $e->getMessage();
         }
         rex::setProperty('version', $version);
     }
     if ($err_msg == '') {
         $err_msg .= self::installAddons();
     }
     return $err_msg;
 }
开发者ID:DECAF,项目名称:redaxo,代码行数:21,代码来源:import.php

示例3: initialize

 /**
  * Initializes all packages.
  */
 public static function initialize($dbExists = true)
 {
     if ($dbExists) {
         $config = rex::getConfig('package-config', []);
     } else {
         $config = [];
         foreach (rex::getProperty('setup_addons') as $addon) {
             $config[$addon]['install'] = false;
         }
     }
     $addons = self::$addons;
     self::$addons = [];
     foreach ($config as $addonName => $addonConfig) {
         $addon = isset($addons[$addonName]) ? $addons[$addonName] : new self($addonName);
         $addon->setProperty('install', isset($addonConfig['install']) ? $addonConfig['install'] : false);
         $addon->setProperty('status', isset($addonConfig['status']) ? $addonConfig['status'] : false);
         self::$addons[$addonName] = $addon;
         if (!$dbExists && is_array($plugins = $addon->getProperty('system_plugins'))) {
             foreach ($plugins as $plugin) {
                 $config[$addonName]['plugins'][$plugin]['install'] = false;
             }
         }
         if (isset($config[$addonName]['plugins']) && is_array($config[$addonName]['plugins'])) {
             $plugins = $addon->plugins;
             $addon->plugins = [];
             foreach ($config[$addonName]['plugins'] as $pluginName => $pluginConfig) {
                 $plugin = isset($plugins[$pluginName]) ? $plugins[$pluginName] : new rex_plugin($pluginName, $addon);
                 $plugin->setProperty('install', isset($pluginConfig['install']) ? $pluginConfig['install'] : false);
                 $plugin->setProperty('status', isset($pluginConfig['status']) ? $pluginConfig['status'] : false);
                 $addon->plugins[$pluginName] = $plugin;
             }
         }
     }
 }
开发者ID:staabm,项目名称:redaxo,代码行数:37,代码来源:addon.php

示例4: synchronizeWithFileSystem

 /**
  * Synchronizes the packages with the file system.
  */
 public static function synchronizeWithFileSystem()
 {
     $config = rex::getConfig('package-config');
     $addons = self::readPackageFolder(rex_path::src('addons'));
     $registeredAddons = array_keys(rex_addon::getRegisteredAddons());
     foreach (array_diff($registeredAddons, $addons) as $addonName) {
         $manager = rex_addon_manager::factory(rex_addon::get($addonName));
         $manager->_delete(true);
         unset($config[$addonName]);
     }
     foreach ($addons as $addonName) {
         if (!rex_addon::exists($addonName)) {
             $config[$addonName]['install'] = false;
             $config[$addonName]['status'] = false;
             $registeredPlugins = [];
         } else {
             $addon = rex_addon::get($addonName);
             $config[$addonName]['install'] = $addon->isInstalled();
             $config[$addonName]['status'] = $addon->isAvailable();
             $registeredPlugins = array_keys($addon->getRegisteredPlugins());
         }
         $plugins = self::readPackageFolder(rex_path::addon($addonName, 'plugins'));
         foreach (array_diff($registeredPlugins, $plugins) as $pluginName) {
             $manager = rex_plugin_manager::factory(rex_plugin::get($addonName, $pluginName));
             $manager->_delete(true);
             unset($config[$addonName]['plugins'][$pluginName]);
         }
         foreach ($plugins as $pluginName) {
             $plugin = rex_plugin::get($addonName, $pluginName);
             $config[$addonName]['plugins'][$pluginName]['install'] = $plugin->isInstalled();
             $config[$addonName]['plugins'][$pluginName]['status'] = $plugin->getProperty('status');
         }
         if (isset($config[$addonName]['plugins']) && is_array($config[$addonName]['plugins'])) {
             ksort($config[$addonName]['plugins']);
         }
     }
     ksort($config);
     rex::setConfig('package-config', $config);
     rex_addon::initialize();
 }
开发者ID:DECAF,项目名称:redaxo,代码行数:43,代码来源:manager.php

示例5: array_keys

<?php

/**
 * Packages loading.
 *
 * @package redaxo5
 */
rex_addon::initialize(!rex::isSetup());
if (rex::isSetup() || rex::isSafeMode()) {
    $packageOrder = array_keys(rex_package::getSetupPackages());
} else {
    $packageOrder = rex::getConfig('package-order', []);
}
// in the first run, we register all folders for class- and fragment-loading,
// so it is transparent in which order the addons are included afterwards.
foreach ($packageOrder as $packageId) {
    $package = rex_package::get($packageId);
    $folder = $package->getPath();
    // add addon path for i18n
    if (is_readable($folder . 'lang')) {
        rex_i18n::addDirectory($folder . 'lang');
    }
    // add package path for fragment loading
    if (is_readable($folder . 'fragments')) {
        rex_fragment::addDirectory($folder . 'fragments' . DIRECTORY_SEPARATOR);
    }
    // add addon path for class-loading
    if (is_readable($folder . 'lib')) {
        rex_autoload::addDirectory($folder . 'lib');
    }
    if (is_readable($folder . 'vendor')) {
开发者ID:staabm,项目名称:redaxo,代码行数:31,代码来源:packages.php


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