diff options
Diffstat (limited to 'engine/lib/elgglib.php')
-rw-r--r-- | engine/lib/elgglib.php | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 60c4e11ad..fe4f4ea03 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -1260,6 +1260,27 @@ function callpath_gatekeeper($path, $include_subdirs = true, $strict_mode = fals } /** + * Get the URL for the current (or specified) site + * + * @param int $site_guid The GUID of the site whose URL we want to grab + * @return string + */ +function elgg_get_site_url($site_guid = 0) { + if ($site_guid == 0) { + global $CONFIG; + return $CONFIG->wwwroot; + } + + $site = get_entity($site_guid); + + if (!$site instanceof ElggSite) { + return false; + } + + return $site->url; +} + +/** * Returns the current page's complete URL. * * The current URL is assembled using the network's wwwroot and the request URI @@ -1271,7 +1292,7 @@ function callpath_gatekeeper($path, $include_subdirs = true, $strict_mode = fals function current_page_url() { global $CONFIG; - $url = parse_url($CONFIG->wwwroot); + $url = parse_url(elgg_get_site_url()); $page = $url['scheme'] . "://"; |