You are here

function google_analytics_counter_construct_content in Google Analytics Counter 7

Same name and namespace in other branches
  1. 6.2 google_analytics_counter.module \google_analytics_counter_construct_content()
  2. 6 google_analytics_counter.module \google_analytics_counter_construct_content()

@todo Please document this function.

See also

http://drupal.org/node/1354

2 calls to google_analytics_counter_construct_content()
google_analytics_counter_display in ./google_analytics_counter.module
@todo Please document this function.
google_analytics_counter_gac_get_count in ./google_analytics_counter.module
@todo Please document this function.

File

./google_analytics_counter.module, line 603

Code

function google_analytics_counter_construct_content($sumarray) {
  $result = '';
  $sum_of_pageviews = '';

  // If debugger is on, and if the user has admin rights for Google Analytics Counter.
  $debuggeron = GOOGLE_ANALYTICS_COUNTER_DEBUG;
  if (user_access('administer google analytics counter')) {
    if ($debuggeron == 1) {
      $titlemsg = $sumarray[3];
    }
  }
  $sum_of_pageviews .= @$sumarray[0];
  if (@$sumarray[0] == 0 and $debuggeron != 1) {

    // If $sumarray[2] is zero, it means nothing was fetched (cache expired but there was concurrency and new data could not be retrieved). We will return nothing -- until new value can be retrieved.

    //$result = '***'.$countdays.'***';
    $result = '';
  }
  else {
    $result .= $sum_of_pageviews;

    // If debugger is on, and if the user has admin rights for Google Analytics Counter.
    if (user_access('administer google analytics counter')) {
      if ($debuggeron == 1) {
        $result .= '<br/><font color="teal">' . $titlemsg . '</font>';
      }
    }
  }
  return $result;
}