Skip to content

Commit

Permalink
Added ability to set configuration from PHP.
Browse files Browse the repository at this point in the history
  • Loading branch information
justmoon committed Dec 25, 2009
1 parent efab47d commit a82082d
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions class.krumo.php
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,11 @@
}

// -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

/**
* Configuration array.
*/
static $_config = array();

/**
* Returns values from Krumo's configuration
Expand All @@ -633,22 +638,23 @@
* @static
*/
Private Static Function _config($group, $name, $fallback=null) {

static $_config = array();

// not loaded ?
//
if (empty($_config)) {
$_config = (array) @parse_ini_file(
if (empty(self::$_config)) {
self::$_config = (array) @parse_ini_file(
KRUMO_DIR . 'krumo.ini',
true);
}

// exists ?
//
return (isset($_config[$group][$name]))
? $_config[$group][$name]
return (isset(self::$_config[$group][$name]))
? self::$_config[$group][$name]
: $fallback;
}

Public Static Function setConfig($config) {
self::$_config = $config;
}

// -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Expand Down Expand Up @@ -1301,4 +1307,4 @@

//////////////////////////////////////////////////////////////////////////////

?>
?>

0 comments on commit a82082d

Please sign in to comment.