]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
added a function for getting current site entity
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Thu, 2 Dec 2010 11:54:15 +0000 (11:54 +0000)
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Thu, 2 Dec 2010 11:54:15 +0000 (11:54 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@7495 36083f99-b078-4883-b0ff-0f9b5a30f544

engine/lib/sites.php

index a348d166ba369f55805f4f2ce5a1f777dc7af720..97398d7f2d43237b4beeabbe5e552dc036903673 100644 (file)
@@ -7,6 +7,24 @@
  * @subpackage DataModel.Site
  */
 
+/**
+ * Get an ElggSite entity (default is current site)
+ *
+ * @param int $site_guid Optional. Site GUID.
+ *
+ * @return ElggSite
+ * @since 1.8.0
+ */
+function elgg_get_site_entity($site_guid = 0) {
+       global $CONFIG;
+
+       if ($site_guid == 0) {
+               return $CONFIG->site;
+       }
+
+       return get_entity($site_guid);
+}
+
 /**
  * Return the site specific details of a site by a row.
  *