function onEnablePlugin($pluginID) { $sm =& $this->_pluginAPI->getSmarty(); $plugM =& $this->_pluginAPI->getPluginManager(); $t =& $this->_pluginAPI->getI18NManager(); $plugin = $plugM->getPlugin($pluginID); if (!$plugin->isInstalled($this->_pluginAPI)) { $plugin->install($this->_pluginAPI); } $cm =& $this->_pluginAPI->getConfigManager(); $a = new configItem('/extplugs/' . $pluginID, BOOL); $a->setValue(true); $cm->addOption($a); $this->_pluginAPI->addMessage($t->translate('Plugin is enabled'), NOTICE); $this->_pluginAPI->writeConfigFile($cm); $this->_pluginAPI->executePreviousAction(); }
/** * Loads all items from an array * * @param $array (mixed array) * @public */ function loadConfigArray($array) { foreach ($array as $name => $value) { $type = guessType($value); if (!isError($type)) { $item = new configItem($name, $type); $item->setValue($value); $this->addOption($item); } else { return $type; } } }
function testGetArrayItem() { $this->configurator->loadConfigFile('core/tests/options.php'); $string = new configItem('/anArray/aString', STRING); $string->setValue('anArrayString'); $real = new configItem('/anArray/aReal', REAL); $real->setValue(2.1); $a = $this->configurator->getArrayItem('/anArray'); $this->assertEquals(array('aString' => $string, 'aReal' => $real), $a); }
/** * Adds a user setting to the configmanager. * A user setting is defined a setting that can be changed * from GET, COOKIE or a default value * * * @public * @return (string) The initial value * @since 0.3 */ function addUserSetting($name, $type, $defaultValue = null) { $fullname = '/user/' . $name; if ($this->existsItem($fullname)) { return new Error('CONFIGURATOR_OPTION_EXISTS', $name); } $setting = new configItem($fullname, $type); $setting->setDefaultValue($defaultValue); if (array_key_exists($name, $_GET)) { $setting->setValue($_GET[$name]); setcookie($name, $_GET[$name]); } elseif (array_key_exists($name, $_COOKIE)) { $setting->setValue($_COOKIE[$name]); } $this->allUserItems['/' . $type . $fullname] = $setting; return $setting->getCurrentValue(); }