You are here

function _google_analytics_counter_path_aliases in Google Analytics Counter 7.2

Same name and namespace in other branches
  1. 6.2 google_analytics_counter.module \_google_analytics_counter_path_aliases()
  2. 6 google_analytics_counter.module \_google_analytics_counter_path_aliases()
  3. 7.3 google_analytics_counter_data.inc \_google_analytics_counter_path_aliases()
  4. 7 google_analytics_counter.module \_google_analytics_counter_path_aliases()

Return a list of paths that are aliased with the given path (including the given path).

1 call to _google_analytics_counter_path_aliases()
google_analytics_counter_get_sum_per_path in ./google_analytics_counter_data.inc
Calculate pageviews for one path (with any aliases).

File

./google_analytics_counter_data.inc, line 305
Parsing and writing the fetched data.

Code

function _google_analytics_counter_path_aliases($node_path) {

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

  //dpm('nodepath: '.$node_path);

  // Grab all aliases.
  $aliases = array(
    $node_path,
  );
  $result = db_query("SELECT * FROM {url_alias} WHERE source = :source", array(
    ':source' => $node_path,
  ));
  foreach ($result as $row) {
    $aliases[] = $row->alias;
  }

  // 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 == variable_get('site_frontpage', 'node')) {
    $aliases[] = '';
    $aliases[] = '/';
    $aliases[] = 'index.php';
  }
  return $aliases;
}