You are here

function boost_get_base_urls in Boost 6

Get all base url's where this node can appear

Parameters

$node: node object

$reset: A boolean flag to clear the static variable if necessary.

Return value

array array(0 => array(0 => $base_url . '/'))

3 calls to boost_get_base_urls()
boost_expire_node in ./boost.module
Expires a node from the cache; including related pages.
_boost_cache_insert in ./boost.module
Shutdown function, gets called at the very end of node creation.
_boost_views_runit in ./boost.module

File

./boost.module, line 1225
Provides static file caching for Drupal text output. Pages, Feeds, ect...

Code

function boost_get_base_urls(&$node, $reset = FALSE) {
  global $base_url, $base_path;

  // Get list of URL's if using domain access
  $base_urls = array();
  $domains = array();
  if (module_exists('domain') && isset($node->domains)) {

    // Get domains from node object
    foreach ($node->domains as $key => $domain_id) {
      if ($key != $domain_id) {
        continue;
      }
      $domains[$domain_id] = $domain_id;
    }

    // Get domains from database
    foreach (boost_get_domains($node) as $domain_id) {
      $domains[$domain_id] = $domain_id;
    }

    // Get aliases and set base url
    foreach ($domains as $domain_id) {
      $domain = domain_lookup($domain_id, NULL, $reset);
      if ($domain['valid'] == 1) {
        if (isset($domain['path'])) {
          $base_urls[$domain_id][] = $domain['path'];
        }
        if (is_array($domain['aliases'])) {
          foreach ($domain['aliases'] as $alias) {
            $alias['pattern'] = trim($alias['pattern']);
            if ($alias['redirect'] != 1 && !empty($alias['pattern'])) {
              $temp_domain = array(
                'scheme' => $domain['scheme'],
                'subdomain' => $alias['pattern'],
              );
              $base_urls[$domain_id][] = domain_get_path($temp_domain);
            }
          }
        }
      }
    }
  }
  else {
    $base_urls[0][] = $base_url . '/';
  }
  return $base_urls;
}