You are here

function apps_servers in Apps 7

Returns all app servers configured to work for the current site.

Parameters

string $server_name: Optional. The name of a specific server to return

Return value

array An array of servers, or one server array if $server_name has a valid value

13 calls to apps_servers()
apps_apps in ./apps.manifest.inc
Retrieve apps from the server manifest.
apps_apps_all in ./apps.manifest.inc
Retrieve apps from all servers.
apps_app_find_conflicts in ./apps.module
Find the apps that this app is in conflict with.
apps_block_info in ./apps.module
Implements hook_block_info().
apps_block_view in ./apps.module
Implements hook_block_view().

... See full list

File

./apps.manifest.inc, line 69
Handles pulling and processing of app data from the server

Code

function apps_servers($server_name = FALSE) {
  $servers_cache = cache_get('apps_servers');
  $servers = $servers_cache ? $servers_cache->data : FALSE;
  if (!$servers) {
    $profile = drupal_get_profile();

    // Get apps servers from profile.
    $servers = ($s = module_invoke($profile, 'apps_servers_info')) ? $s : array();

    // Allow modules to add apps servers as well.
    $servers += module_invoke_all('apps_servers_info');
    drupal_alter('apps_servers', $servers);
    foreach ($servers as $name => $server) {
      $servers[$name]['name'] = $name;
    }
  }

  // If we have the dev console turned on add it as a server.
  if (variable_get('apps_enable_dev_console', FALSE)) {
    $servers['development'] = array(
      'name' => 'development',
      'description' => 'Local Apps in Development',
      'title' => 'Development',
      'manifest' => FALSE,
      'featured app' => FALSE,
    );
  }
  cache_set('apps_servers', $servers);
  if ($server_name) {
    if (isset($servers[$server_name])) {
      return $servers[$server_name];
    }
  }
  else {
    return $servers;
  }
  return FALSE;
}