You are here

public function InstapageCmsPluginDrupal7Connector::checkHomepage in Instapage plugin 8.3

Same name and namespace in other branches
  1. 7.3 core/connectors/InstapageCmsPluginDrupal7Connector.php \InstapageCmsPluginDrupal7Connector::checkHomepage()

Checks (and displays) if a landing page marked as homepage should be displayed instead of normal CMS homepage.

@uses InstapageCmsPluginDrupal7Connector::checkPage()

1 call to InstapageCmsPluginDrupal7Connector::checkHomepage()
InstapageCmsPluginDrupal7Connector::initPlugin in core/connectors/InstapageCmsPluginDrupal7Connector.php
Initiates Instapage plugin's DB structure and loads plugin's classes.

File

core/connectors/InstapageCmsPluginDrupal7Connector.php, line 648

Class

InstapageCmsPluginDrupal7Connector
Class that utilizes native Drupal 7 functions to perform actions like remote requests and DB operations.

Code

public function checkHomepage() {
  $homeUrl = str_replace(array(
    'http://',
    'https://',
  ), '', rtrim($this
    ->getHomeURL(), '/'));
  $homeUrlSegments = explode('/', $homeUrl);
  $uriSegments = explode('?', $_SERVER['REQUEST_URI']);
  $uriSegments = explode('/', rtrim($uriSegments[0], '/'));
  if (count($uriSegments) !== count($homeUrlSegments) || count($homeUrlSegments) > 1 && $homeUrlSegments[1] != $uriSegments[1]) {
    return false;
  }
  $this
    ->checkPage('home');
  return true;
}