public function InstapageCmsPluginDrupal7Connector::getSiteURL in Instapage plugin 8.3
Same name and namespace in other branches
- 7.3 core/connectors/InstapageCmsPluginDrupal7Connector.php \InstapageCmsPluginDrupal7Connector::getSiteURL()
Gets the site base URL.
Parameters
bool $protocol Value returned with protocol or not.:
Return value
string Site base URL. With protocol or not.
4 calls to InstapageCmsPluginDrupal7Connector::getSiteURL()
- InstapageCmsPluginDrupal7Connector::getAjaxURL in core/
connectors/ InstapageCmsPluginDrupal7Connector.php - Gets the AJAX URL.
- InstapageCmsPluginDrupal7Connector::getHomeURL in core/
connectors/ InstapageCmsPluginDrupal7Connector.php - Gets the site home URL.
- InstapageCmsPluginDrupal7Connector::getPostSlugs in core/
connectors/ InstapageCmsPluginDrupal7Connector.php - Gets the list of slugs used by Drupal 7 posts.
- InstapageCmsPluginDrupal7Connector::isProhibitedPostSlug in core/
connectors/ InstapageCmsPluginDrupal7Connector.php - Checks if given slug is prohibited in terms of publishing a landing page. If it's free - will return false. Otherwise an array with slug details will be returned
File
- core/
connectors/ InstapageCmsPluginDrupal7Connector.php, line 486
Class
- InstapageCmsPluginDrupal7Connector
- Class that utilizes native Drupal 7 functions to perform actions like remote requests and DB operations.
Code
public function getSiteURL($protocol = true) {
$url = $_SERVER['HTTP_HOST'];
if ($protocol) {
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') {
$url = 'https://' . $url;
}
else {
$url = 'http://' . $url;
}
}
if (isset($_SERVER['PHP_SELF'])) {
$directory = ltrim(dirname($_SERVER['PHP_SELF']), DIRECTORY_SEPARATOR);
if (!empty($directory)) {
$url .= $directory;
}
}
return $url;
}