Exemplo n.º 1
0
 /**
  * @brief Get a particular observer's config variable given the category
  * name ($family) and a key.
  *
  * Get a particular observer's config value from the given category ($family)
  * and the $key from a cached storage in App::$config[$xchan].
  *
  * Returns false if not set.
  *
  * @param string $xchan
  *  The observer's hash
  * @param string $family
  *  The category of the configuration value
  * @param string $key
  *  The configuration key to query
  * @return mixed Stored $value or false if it does not exist
  */
 public static function Get($xchan, $family, $key)
 {
     if (!$xchan) {
         return false;
     }
     if (!array_key_exists($xchan, \App::$config)) {
         load_xconfig($xchan);
     }
     if (!array_key_exists($family, \App::$config[$xchan]) || !array_key_exists($key, \App::$config[$xchan][$family])) {
         return false;
     }
     return !is_array(\App::$config[$xchan][$family][$key]) && preg_match('|^a:[0-9]+:{.*}$|s', \App::$config[$xchan][$family][$key]) ? unserialize(\App::$config[$xchan][$family][$key]) : \App::$config[$xchan][$family][$key];
 }
Exemplo n.º 2
0
function load_aconfig($account_id)
{
    load_xconfig('a_' . $account_id);
}
Exemplo n.º 3
0
Arquivo: config.php Projeto: Mauru/red
function get_xconfig($xchan, $family, $key)
{
    global $a;
    if (!$xchan) {
        return false;
    }
    if (!array_key_exists($xchan, $a->config)) {
        load_xconfig($xchan);
    }
    if (!array_key_exists($family, $a->config[$xchan]) || !array_key_exists($key, $a->config[$xchan][$family])) {
        return false;
    }
    return !is_array($a->config[$xchan][$family][$key]) && preg_match('|^a:[0-9]+:{.*}$|s', $a->config[$xchan][$family][$key]) ? unserialize($a->config[$xchan][$family][$key]) : $a->config[$xchan][$family][$key];
}