aboutsummaryrefslogtreecommitdiff
path: root/engine/classes/ElggSite.php
diff options
context:
space:
mode:
Diffstat (limited to 'engine/classes/ElggSite.php')
-rw-r--r--engine/classes/ElggSite.php33
1 files changed, 22 insertions, 11 deletions
diff --git a/engine/classes/ElggSite.php b/engine/classes/ElggSite.php
index 3ccb146fb..49616f1be 100644
--- a/engine/classes/ElggSite.php
+++ b/engine/classes/ElggSite.php
@@ -21,6 +21,10 @@
* @package Elgg.Core
* @subpackage DataMode.Site
* @link http://docs.elgg.org/DataModel/Sites
+ *
+ * @property string $name The name or title of the website
+ * @property string $description A motto, mission statement, or description of the website
+ * @property string $url The root web address for the site, including trailing slash
*/
class ElggSite extends ElggEntity {
@@ -53,8 +57,8 @@ class ElggSite extends ElggEntity {
* - A URL as stored in ElggSite->url
* - A DB result object with a guid property
*
- * @param mixed $guid If an int, load that GUID. If a db row then will attempt
- * to load the rest of the data.
+ * @param mixed $guid If an int, load that GUID. If a db row then will
+ * load the rest of the data.
*
* @throws IOException If passed an incorrect guid
* @throws InvalidParameterException If passed an Elgg* Entity that isn't an ElggSite
@@ -66,15 +70,15 @@ class ElggSite extends ElggEntity {
$this->initialise_attributes(false);
if (!empty($guid)) {
- // Is $guid is a DB row - either a entity row, or a site table row.
+ // Is $guid is a DB entity table row
if ($guid instanceof stdClass) {
// Load the rest
- if (!$this->load($guid->guid)) {
+ if (!$this->load($guid)) {
$msg = elgg_echo('IOException:FailedToLoadGUID', array(get_class(), $guid->guid));
throw new IOException($msg);
}
- // Is $guid is an ElggSite? Use a copy constructor
+ // Is $guid is an ElggSite? Use a copy constructor
} else if ($guid instanceof ElggSite) {
elgg_deprecated_notice('This type of usage of the ElggSite constructor was deprecated. Please use the clone method.', 1.7);
@@ -82,18 +86,18 @@ class ElggSite extends ElggEntity {
$this->attributes[$key] = $value;
}
- // Is this is an ElggEntity but not an ElggSite = ERROR!
+ // Is this is an ElggEntity but not an ElggSite = ERROR!
} else if ($guid instanceof ElggEntity) {
throw new InvalidParameterException(elgg_echo('InvalidParameterException:NonElggSite'));
- // See if this is a URL
+ // See if this is a URL
} else if (strpos($guid, "http") !== false) {
$guid = get_site_by_url($guid);
foreach ($guid->attributes as $key => $value) {
$this->attributes[$key] = $value;
}
- // We assume if we have got this far, $guid is an int
+ // Is it a GUID
} else if (is_numeric($guid)) {
if (!$this->load($guid)) {
throw new IOException(elgg_echo('IOException:FailedToLoadGUID', array(get_class(), $guid)));
@@ -107,7 +111,7 @@ class ElggSite extends ElggEntity {
/**
* Loads the full ElggSite when given a guid.
*
- * @param int $guid Guid of ElggSite entity
+ * @param mixed $guid GUID of ElggSite entity or database row object
*
* @return bool
* @throws InvalidClassException
@@ -118,6 +122,11 @@ class ElggSite extends ElggEntity {
return false;
}
+ // Only work with GUID from here
+ if ($guid instanceof stdClass) {
+ $guid = $guid->guid;
+ }
+
// Check the type
if ($this->attributes['type'] != 'site') {
$msg = elgg_echo('InvalidClassException:NotValidElggStar', array($guid, get_class()));
@@ -192,7 +201,7 @@ class ElggSite extends ElggEntity {
*
* @note You cannot disable the current site.
*
- * @param string $reason Optional reason for disabling
+ * @param string $reason Optional reason for disabling
* @param bool $recursive Recursively disable all contained entities?
*
* @return bool
@@ -215,7 +224,7 @@ class ElggSite extends ElggEntity {
* accepted by elgg_get_entities(). Common parameters
* include 'limit', and 'offset'.
* Note: this was $limit before version 1.8
- * @param int $offset Offset @deprecated parameter
+ * @param int $offset Offset @deprecated parameter
*
* @todo remove $offset in 2.0
*
@@ -231,6 +240,7 @@ class ElggSite extends ElggEntity {
}
$defaults = array(
+ 'site_guids' => ELGG_ENTITIES_ANY_VALUE,
'relationship' => 'member_of_site',
'relationship_guid' => $this->getGUID(),
'inverse_relationship' => TRUE,
@@ -254,6 +264,7 @@ class ElggSite extends ElggEntity {
*/
public function listMembers($options = array()) {
$defaults = array(
+ 'site_guids' => ELGG_ENTITIES_ANY_VALUE,
'relationship' => 'member_of_site',
'relationship_guid' => $this->getGUID(),
'inverse_relationship' => TRUE,