You are here

function _google_analytics_counter_path_aliases in Google Analytics Counter 6

Same name and namespace in other branches
  1. 6.2 google_analytics_counter.module \_google_analytics_counter_path_aliases()
  2. 7.3 google_analytics_counter_data.inc \_google_analytics_counter_path_aliases()
  3. 7 google_analytics_counter.module \_google_analytics_counter_path_aliases()
  4. 7.2 google_analytics_counter_data.inc \_google_analytics_counter_path_aliases()
1 call to _google_analytics_counter_path_aliases()
_google_analytics_counter_path_filter in ./google_analytics_counter.module

File

./google_analytics_counter.module, line 467

Code

function _google_analytics_counter_path_aliases($node_path = NULL) {

  // Default path is the current path.
  if ($node_path == NULL) {
    $node_path = $_GET['q'];
  }

  // Get the normal node path if it is a node.
  $node_path = drupal_get_normal_path($node_path);

  // Grab all aliases.
  $aliases = array(
    $node_path,
  );
  $result = db_query("SELECT * FROM {url_alias} WHERE src = '%s'", $node_path);
  while ($row = db_fetch_array($result)) {
    $aliases[] = $row['dst'];
  }

  // If this is the front page, add the base path too, and index.php for good measure.
  // There may be other ways that the user is accessing the front page but we can't
  // account for them all.
  if ($node_path == drupal_get_normal_path(variable_get('site_frontpage', 'node'))) {
    $aliases[] = '';
    $aliases[] = 'index.php';
  }
  return $aliases;
}