add mode switch to cfg script

This commit is contained in:
norb 2022-11-23 08:10:40 +01:00
commit 097ca9444f
2 changed files with 26 additions and 13 deletions

View file

@ -96,6 +96,9 @@ class Settings implements \Iterator
// addModes() {{{
/** {{{
* Adds modes to the default modes programmatically.
* Modes can and should be configured in the default configurration File
* @param Array $modes an array with the modes to add. 'index' => 'prefix'
*///}}}
public function addModes( array $modes )
{
@ -143,6 +146,7 @@ class Settings implements \Iterator
// throw new FileNotFoundException();
}
// add modes from the drfault config file (no modes from other files are added)
if (isset($this->settings['modes'])) {
$this->addModes($this->settings['modes']);
}
@ -152,12 +156,11 @@ class Settings implements \Iterator
$localConf = false;
if (file_exists($conf)) $localConf = require($conf);
if (! isset($this->mode))
{ // if a localConf Mode is set use it, or take the default conf mode
// if a mode was set in the constructor do not overwrite it
if (! isset($this->mode)) {
// if a localConf Mode is set use it, or take the default conf mode
$this->mode = (isset($localConf['mode'])) ? $localConf['mode'] : $this->settings['mode'];
}
else
{
} else {
$this->settings['mode'] = $this->mode;
}
@ -340,7 +343,6 @@ class Settings implements \Iterator
}
// }}}
}
/* jEdit buffer local properties {{{