diff --git a/inc/inc.ClassSettings.php b/inc/inc.ClassSettings.php index 35ed72a4b..e63d0202b 100644 --- a/inc/inc.ClassSettings.php +++ b/inc/inc.ClassSettings.php @@ -418,7 +418,7 @@ class Settings { /* {{{ */ * * @return true/false */ - function load($configFilePath) { /* {{{ */ + public function load($configFilePath) { /* {{{ */ $contents = file_get_contents($configFilePath); if(!$contents) { return false; @@ -714,6 +714,9 @@ class Settings { /* {{{ */ foreach($extensions as $extension) { $tmp = $extension->attributes(); $extname = strval($tmp['name']); + if(isset($tmp['disable'])) + $disabled = strval($tmp['disable']); + $this->_extensions[$extname]['__disable__'] = $disabled=='1' || $disabled == 'true' ? true : false; foreach($extension->children() as $parameter) { $tmp2 = $parameter->attributes(); $this->_extensions[$extname][strval($tmp2['name'])] = strval($parameter); @@ -733,7 +736,7 @@ class Settings { /* {{{ */ * * @return true/false */ - function setXMLAttributValue($node, $attributName, $attributValue) { /* {{{ */ + protected function setXMLAttributValue($node, $attributName, $attributValue) { /* {{{ */ if (is_bool($attributValue)) { if ($attributValue) $attributValue = "true"; @@ -757,7 +760,7 @@ class Settings { /* {{{ */ * * @return SimpleXMLElement */ - function getXMLNode($rootNode, $parentNodeName, $name) { /* {{{ */ + protected function getXMLNode($rootNode, $parentNodeName, $name) { /* {{{ */ $node = $rootNode->xpath($parentNodeName . '/' . $name); if (empty($node)) { @@ -777,7 +780,7 @@ class Settings { /* {{{ */ * * @return true/false */ - function save($configFilePath=NULL) { /* {{{ */ + public function save($configFilePath=NULL) { /* {{{ */ if (is_null($configFilePath)) $configFilePath = $this->_configFilePath; @@ -1050,6 +1053,7 @@ class Settings { /* {{{ */ // search XML node $extnode = $extnodes->addChild('extension'); $this->setXMLAttributValue($extnode, 'name', $name); + $this->setXMLAttributValue($extnode, 'disable', $extension['__disable__'] ? 'true' : 'false'); /* New code saves all parameters of the extension which have been set * in configuration form. */ @@ -1082,7 +1086,7 @@ class Settings { /* {{{ */ * search and return Config File Path * @return NULL|string Config File Path */ - function searchConfigFilePath() { /* {{{ */ + protected function searchConfigFilePath() { /* {{{ */ $configFilePath = null; if($configDir = Settings::getConfigDir()) { @@ -1139,7 +1143,7 @@ class Settings { /* {{{ */ * * @return string */ - function curPageURL() { /* {{{ */ + protected function curPageURL() { /* {{{ */ $pageURL = 'http'; if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") { @@ -1164,7 +1168,7 @@ class Settings { /* {{{ */ * @param string $file name of file to search * @return string path where file was found */ - function findInIncPath($file) { /* {{{ */ + protected function findInIncPath($file) { /* {{{ */ $incarr = explode(PATH_SEPARATOR, ini_get('include_path')); $found = ''; foreach($incarr as $path) { @@ -1180,7 +1184,7 @@ class Settings { /* {{{ */ * * @return array */ - function check($minversion) { /* {{{ */ + public function check($minversion) { /* {{{ */ // suggestion rootdir if (file_exists("../inc/inc.Settings.php")) $rootDir = realpath ("../inc/inc.Settings.php"); @@ -1425,7 +1429,7 @@ class Settings { /* {{{ */ * @return array * */ - function checkSystem() { /* {{{ */ + public function checkSystem() { /* {{{ */ // result $result = array(); @@ -1512,6 +1516,43 @@ class Settings { /* {{{ */ return $result; } /* }}} */ + /** + * Check if extension is disabled + * + * @param string $extname name of extension + * @return true if extension is disabled + */ + public function extensionIsDisabled($extname) { /* {{{ */ + if(array_key_exists($extname, $this->_extensions)) + return $this->_extensions[$extname]['__disable__']; + + return false; + } /* }}} */ + + /** + * Set extension enabled + * + * @param string $extname name of extension + * @return + */ + public function enableExtension($extname) { /* {{{ */ + if(!array_key_exists($extname, $this->_extensions)) + $this->_extensions[$extname] = array(); + $this->_extensions[$extname]['__disable__'] = false; + } /* }}} */ + + /** + * Set extension enabled + * + * @param string $extname name of extension + * @return + */ + public function disableExtension($extname) { /* {{{ */ + if(!array_key_exists($extname, $this->_extensions)) + $this->_extensions[$extname] = array(); + $this->_extensions[$extname]['__disable__'] = true; + } /* }}} */ + } /* }}} */ ?>