psm_get_conf(): auto-load config if it hasnt been loaded yet

This commit is contained in:
Pepijn Over 2014-07-31 16:06:20 +02:00
parent 77e295a465
commit 4d92e9c0c1
1 changed files with 3 additions and 1 deletions

View File

@ -111,7 +111,6 @@ function psm_get_langs() {
/**
* Get a setting from the config.
* The config must have been loaded first using psm_load_conf()
*
* @param string $key
* @param mixed $alt if not set, return this alternative
@ -119,6 +118,9 @@ function psm_get_langs() {
* @see psm_load_conf()
*/
function psm_get_conf($key, $alt = null) {
if(!isset($GLOBALS['sm_config'])) {
psm_load_conf();
}
$result = (isset($GLOBALS['sm_config'][$key])) ? $GLOBALS['sm_config'][$key] : $alt;
return $result;