You are here

protected function ProfileStatSender::getClientUrl in Brainstorm profile 8

Builds site URL.

Return value

string Current site URL.

1 call to ProfileStatSender::getClientUrl()
ProfileStatSender::fetchData in module/custom/profile_stat_sender/src/ProfileStatSender.php
Fetches data about site into associative array.

File

module/custom/profile_stat_sender/src/ProfileStatSender.php, line 100
This file contains ProfileStatSender service implementation.

Class

ProfileStatSender
Provides ProfileStatSender service implementation.

Namespace

Drupal\profile_stat_sender

Code

protected function getClientUrl() {
  $is_https = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on';
  $http_protocol = $is_https ? 'https' : 'http';
  $url = $http_protocol . '://' . $_SERVER['HTTP_HOST'];
  if ($dir = rtrim(dirname($_SERVER['SCRIPT_NAME']), '\\/')) {
    $url .= $dir;
  }
  return $url;
}