move getAvailableLanguages() and getLanguages() from translator

This commit is contained in:
Uwe Steinmann 2025-10-29 15:43:10 +01:00
parent 73ee5781dd
commit a976d0bd22

View File

@ -431,17 +431,14 @@ class Settings { /* {{{ */
echo "Your configuration contains errors.";
exit;
}
// if (!is_null($this->_maxExecutionTime))
// ini_set("max_execution_time", $this->_maxExecutionTime);
} /* }}} */
/**
* Check if a variable has the string 'true', 'on', 'yes' or 'y'
* and returns true.
* Check if the passed parameter equals to 'true', 'on', 'yes' or 'y'
* and returns true, if it does.
*
* @param string $var value
* @return true/false
* @return boolean true if $var is 'true', 'on', 'yes' or 'y', otherwise false
*/
protected static function boolVal($var) { /* {{{ */
$var = strtolower(strval($var));
@ -459,10 +456,10 @@ class Settings { /* {{{ */
} /* }}} */
/**
* Return ';' seperated string from array
* Create ';' seperated string from array
*
* @param array $value
*
* @return string
*/
function arrayToString($value) { /* {{{ */
return implode(";", $value);
@ -472,14 +469,14 @@ class Settings { /* {{{ */
* Return array from ';' seperated string
*
* @param string $value
*
* @return array
*/
function stringToArray($value) { /* {{{ */
return explode(";", $value);
} /* }}} */
/**
* set $_viewOnlineFileTypes
* Set $_viewOnlineFileTypes
*
* @param string $stringValue string value
*
@ -489,7 +486,7 @@ class Settings { /* {{{ */
} /* }}} */
/**
* get $_viewOnlineFileTypes in a string value
* Get $_viewOnlineFileTypes in a string value
*
* @return string value
*
@ -499,7 +496,7 @@ class Settings { /* {{{ */
} /* }}} */
/**
* set $_editOnlineFileTypes
* Set $_editOnlineFileTypes
*
* @param string $stringValue string value
*
@ -509,7 +506,7 @@ class Settings { /* {{{ */
} /* }}} */
/**
* get $_editOnlineFileTypes in a string value
* Get $_editOnlineFileTypes in a string value
*
* @return string value
*
@ -522,8 +519,7 @@ class Settings { /* {{{ */
* Load config file
*
* @param string $configFilePath config file path
*
* @return true/false
* @return boolean true, if loading was successful, otherwise false
*/
public function load($configFilePath) { /* {{{ */
$contents = file_get_contents($configFilePath);
@ -1304,7 +1300,7 @@ class Settings { /* {{{ */
// Save
return $xml->asXML($configFilePath);
} /* }}} */
} /* }}} */
/**
* search and return Config File Path
@ -1855,5 +1851,33 @@ class Settings { /* {{{ */
return $this->getBaseUrl().$this->_httpRoot;
} /* }}} */
public function getAvailableLanguages() { /* {{{ */
$languages = array();
$path = $this->_rootDir . "languages/";
$handle = opendir($path);
while ($entry = readdir($handle) )
{
if ($entry == ".." || $entry == ".") {
continue;
} elseif (is_dir($path . $entry)) {
array_push($languages, $entry);
}
}
closedir($handle);
asort($languages);
return $languages;
} /* }}} */
function getLanguages() { /* {{{ */
if($this->_availablelanguages) {
return $this->_availablelanguages;
}
return getAvailableLanguages();
} /* }}} */
} /* }}} */