aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
authorewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-10-30 22:13:41 +0000
committerewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-10-30 22:13:41 +0000
commit1e8b0564c84537c9d82d8e0c645e162bf0e1fc0e (patch)
tree83bcb3d9afd7577c871f94ee257c137e63c5fb9e /engine/lib
parent42d890455ae7b6a61a566d174f9980b8faee782f (diff)
downloadelgg-1e8b0564c84537c9d82d8e0c645e162bf0e1fc0e.tar.gz
elgg-1e8b0564c84537c9d82d8e0c645e162bf0e1fc0e.tar.bz2
Fixes #2598: Added elgg_get_site_url()
git-svn-id: http://code.elgg.org/elgg/trunk@7144 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/elgglib.php23
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'] . "://";