public function InstapageCmsPluginWPConnector::checkHomepage in Instapage plugin 7.3
Same name and namespace in other branches
- 8.3 core/connectors/InstapageCmsPluginWPConnector.php \InstapageCmsPluginWPConnector::checkHomepage()
Checks (and displays) if a landing page marked as homepage should be displayed instead of normal CMS homepage.
@uses InstapageCmsPluginWPConnector::checkPage()
File
- core/
connectors/ InstapageCmsPluginWPConnector.php, line 568
Class
- InstapageCmsPluginWPConnector
- Class that utilizes native WordPress 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;
}