domain_conf_variable_get

Versions
domain
domain_conf_variable_get($domain_id, $variable = '', $all = FALSE, $reset = FALSE)

Load a variable specific to a domain.

Parameters

$domain_id The unique domain ID that is being edited.

$variable The name of the variable you wish to get.

$all A boolean flag indicating whether to return the entire variable array.

$reset A boolean flag to reset the static variable array for the domain. Useful if you are changing variables during a page request.

Return value

The value of the variable for that domain, or NULL if not set, or an array of variables, in the case of $all.

Code

domain_conf/domain_conf.module, line 631

<?php
function domain_conf_variable_get($domain_id, $variable = '', $all = FALSE, $reset = FALSE) {
  global $_domain;
  static $settings, $base;
  if (empty($base)) {
    $base = _domain_conf_load_primary(FALSE);
  }
  if (!isset($settings[$domain_id]) || $reset) {
    // Get the current settings for this domain, if any.
    $data = domain_unserialize(db_result(db_query("SELECT settings FROM {domain_conf} WHERE domain_id = %d", $domain_id)));
    if (empty($data)) {
      $data = array();
    }
    $settings[$domain_id] = array_merge($base, $data);
  }
  if ($all) {
    return $settings[$domain_id];
  }
  if (isset($settings[$domain_id][$variable])) {
    return $settings[$domain_id][$variable];
  }
  return NULL;
}
?>

Contact

  • agentrickard [at] gmail [dot] com

Donations

My Amazon.com Wish List