You are here

public static function mo_saml_visualTour::genArray in SAML SP 2.0 Single Sign On (SSO) - SAML Service Provider 8

1 call to mo_saml_visualTour::genArray()
Utilities::visual_tour_start in src/Utilities.php

File

src/mo_saml_visualTour.php, line 6

Class

mo_saml_visualTour

Namespace

Drupal\miniorange_saml

Code

public static function genArray($overAllTour = 'tabTour') {
  $link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
  $exploded = explode('/', $link);
  $getPageName = end($exploded);
  $Tour_Token = \Drupal::config('miniorange_saml.settings')
    ->get('mo_saml_tourTaken_' . $getPageName);
  if ($overAllTour == 'overAllTour') {
    $getPageName = 'overAllTour';
  }
  $https = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 'https' : 'http';
  $request_scheme = isset($_SERVER['REQUEST_SCHEME']) ? $_SERVER['REQUEST_SCHEME'] : $https;
  $moTourArr = array(
    'pageID' => $getPageName,
    'tourData' => mo_saml_visualTour::getTourData($getPageName),
    'tourTaken' => 'CustomCertificate' === $getPageName || 'Licensing' === $getPageName ? TRUE : $Tour_Token,
    'addID' => mo_saml_visualTour::addID(),
    'pageURL' => $request_scheme . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'],
  );
  \Drupal::configFactory()
    ->getEditable('miniorange_saml.settings')
    ->set('mo_saml_tourTaken_' . $getPageName, TRUE)
    ->save();
  $moTour = json_encode($moTourArr);
  return $moTour;
}