psm_get_conf(): auto-load config if it hasnt been loaded yet
parent
77e295a465
commit
4d92e9c0c1
|
@ -111,7 +111,6 @@ function psm_get_langs() {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a setting from the config.
|
* Get a setting from the config.
|
||||||
* The config must have been loaded first using psm_load_conf()
|
|
||||||
*
|
*
|
||||||
* @param string $key
|
* @param string $key
|
||||||
* @param mixed $alt if not set, return this alternative
|
* @param mixed $alt if not set, return this alternative
|
||||||
|
@ -119,6 +118,9 @@ function psm_get_langs() {
|
||||||
* @see psm_load_conf()
|
* @see psm_load_conf()
|
||||||
*/
|
*/
|
||||||
function psm_get_conf($key, $alt = null) {
|
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;
|
$result = (isset($GLOBALS['sm_config'][$key])) ? $GLOBALS['sm_config'][$key] : $alt;
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
|
Loading…
Reference in New Issue