function _hosting_site_url in Hostmaster (Aegir) 6
Get site's URL.
2 calls to _hosting_site_url()
- hosting_cron_queue in modules/
hosting/ cron/ hosting_cron.module - Implementation of hosting_QUEUE_TYPE_queue().
- hosting_site_goto in modules/
hosting/ site/ hosting_site.module - Menu callback to go to your site.
File
- modules/
hosting/ site/ hosting_site.module, line 150
Code
function _hosting_site_url($node) {
$schema = 'http';
$port = null;
$url = strtolower(trim($node->title));
$platform = node_load($node->platform);
$server = node_load($platform->web_server);
if ($server->services['http']
->has_port()) {
$port = $server->services['http']->port;
if ($port == 80) {
$port = null;
}
}
/**
* This is part of the ssl feature, but is better to implement here.
*/
if (isset($node->ssl_enabled) && $node->ssl_enabled == 2) {
// this is a bit of a magic number, because we cant rely on the constant being available yet.
// 2 == Only SSL is enabled.
$schema = 'https';
if ($server->services['http']
->has_port()) {
$port = $server->services['http']->ssl_port;
if ($port == 443) {
$port = null;
}
}
}
if (is_numeric($port)) {
return "{$schema}://{$url}:{$port}";
}
return "{$schema}://{$url}";
}