You are here

public static function GoogleAnalyticsCounterFeed::currentUrl in Google Analytics Counter 7.3

Get the current page url

Return value

String

2 calls to GoogleAnalyticsCounterFeed::currentUrl()
google_analytics_counter_auth_admin in ./google_analytics_counter_auth.inc
Menu callback - admin form for OAuth and other settings.
google_analytics_counter_auth_admin_submit in ./google_analytics_counter_auth.inc
Submit handler.

File

./google_analytics_counter_oauth2.lib.inc, line 79
Provides the Google Analytics Counter Feed object type and associated methods. Most of the Google Analytics authentication process is taken over from http://drupal.org/project/google_analytics_reports because all we need here is its Google Analytics…

Class

GoogleAnalyticsCounterFeed
GoogleAnalyticsCounterFeed class to authorize access to and request data from the Google Analytics Core Reporting API.

Code

public static function currentUrl() {
  if (!empty($_SERVER['HTTPS'])) {
    $https = $_SERVER['HTTPS'] == 'on';
  }
  else {
    $https = FALSE;
  }
  $url = $https ? 'https://' : 'http://';
  $url .= $_SERVER['SERVER_NAME'];
  if (!$https && $_SERVER['SERVER_PORT'] != '80' || $https && $_SERVER['SERVER_PORT'] != '443') {
    $url .= ':' . $_SERVER['SERVER_PORT'];
  }
  return $url . $_SERVER['REQUEST_URI'];
}