You are here

function _jdrupal_resource_system_site_settings in jDrupal 7

Returns a collection of variables from the current Drupal site.

Return value

array Array of variables from the variable table.

1 string reference to '_jdrupal_resource_system_site_settings'
jdrupal_services_resources in ./jdrupal.services.inc
Defines function signatures for resources available to services.

File

./jdrupal.resource.inc, line 176
This file implements the jdrupal service resource call back functions.

Code

function _jdrupal_resource_system_site_settings() {

  // Grab column names from the variable table.
  $names = array(
    'admin_theme',
    'clean_url',
    'date_default_timezone',
    'site_name',
    'theme_default',
    'user_register',
  );
  $sql = "SELECT * FROM {variable} WHERE name IN (:names)";
  $result = db_query($sql, array(
    ':names' => $names,
  ));
  $settings = new stdClass();
  if ($result) {
    $settings->variable = new stdClass();
    $variables = $result
      ->fetchAll();
    foreach ($variables as $variable) {
      $name = $variable->name;
      $value = unserialize($variable->value);
      $settings->variable->{$name} = $value;
    }
  }

  // Add Drupal core verion into settings.
  $settings->variable->drupal_core = "7";
  return $settings;
}