src/CarteBlanche/App/Config.php
protected function _parseConfigRecursive(&$value, $key = null, $stack_name = 'global')
    {
        if (!is_string($value)) return;

        // escape any '\%'
        $hash = 'XH'.uniqid();
        $value = str_replace('\%', $hash, $value);

        // configuration value notation : %name%
        while (is_string($value) && 0!=preg_match('/^(.*)\%(.*)\%(.*)$/i', $value, $matches) && count($matches)>1) {
            $_cf = $matches[2];
            if ($_cfg_val = $this->get($_cf, self::NOT_FOUND_GRACEFULLY, null, $stack_name)) {
                if (is_array($_cfg_val)) {
                    $value = $_cfg_val;
                } else {
                    $value = $matches[1].$_cfg_val.$matches[3];
                }
            }
            $matches = array();
        }

        // un-escape any '\%'
        if (is_string($value)) {
            $value = str_replace($hash, '%', $value);
        }

        // configuration stack notation : {name}
        if (is_string($value) && 0!=preg_match('/^\{(.*)\}$/i', $value, $matches)) {
            $_cf = $matches[1];
            if (substr(trim($_cf), 0, strlen('function'))!=='function') {
                $_cf = 'function(){ '.$_cf.'; }';
            }
            @eval("\$_cfg_closure = $_cf;");
            if ($_cfg_closure && is_callable($_cfg_closure)) {
                $value = call_user_func($_cfg_closure);
            }
        }
    }
protected function _parseConfigRecursive(&$value, $key = null, $stack_name = 'global')
    {
        if (!is_string($value)) return;

        // escape any '\%'
        $hash = 'XH'.uniqid();
        $value = str_replace('\%', $hash, $value);

        // configuration value notation : %name%
        while (is_string($value) && 0!=preg_match('/^(.*)\%(.*)\%(.*)$/i', $value, $matches) && count($matches)>1) {
            $_cf = $matches[2];
            if ($_cfg_val = $this->get($_cf, self::NOT_FOUND_GRACEFULLY, null, $stack_name)) {
                if (is_array($_cfg_val)) {
                    $value = $_cfg_val;
                } else {
                    $value = $matches[1].$_cfg_val.$matches[3];
                }
            }
            $matches = array();
        }

        // un-escape any '\%'
        if (is_string($value)) {
            $value = str_replace($hash, '%', $value);
        }

        // configuration stack notation : {name}
        if (is_string($value) && 0!=preg_match('/^\{(.*)\}$/i', $value, $matches)) {
            $_cf = $matches[1];
            if (substr(trim($_cf), 0, strlen('function'))!=='function') {
                $_cf = 'function(){ '.$_cf.'; }';
            }
            @eval("\$_cfg_closure = $_cf;");
            if ($_cfg_closure && is_callable($_cfg_closure)) {
                $value = call_user_func($_cfg_closure);
            }
        }
    }
Parse a configuration stack array recursively

@param   mixed       $value
@param   null/string $key
@param   string      $stack_name
@return  void        As the value is set by reference, nothing is returned but the original array is modified