37 parent::initializeAttributes();
39 $this->attributes[
'type'] =
"site";
40 $this->attributes[
'name'] = null;
41 $this->attributes[
'description'] = null;
42 $this->attributes[
'url'] = null;
43 $this->tables_split = 2;
65 if (
$row instanceof stdClass) {
68 $msg =
"Failed to load new " . get_class() .
" for GUID:" .
$row->guid;
73 elgg_deprecated_notice(
'This type of usage of the ElggSite constructor was deprecated. Please use the clone method.', 1.7);
77 }
else if (strpos(
$row,
"http") !==
false) {
84 }
else if (is_numeric(
$row)) {
88 throw new IOException(
"Failed to load new " . get_class() .
" from GUID:" .
$row);
106 $attr_loader->requires_access_control = !($this instanceof
ElggPlugin);
107 $attr_loader->secondary_loader =
'get_site_entity_as_row';
109 $attrs = $attr_loader->getRequiredAttributes(
$guid);
114 $this->attributes =
$attrs;
115 $this->tables_loaded = 2;
128 $guid = parent::create();
134 $query =
"INSERT into {$CONFIG->dbprefix}sites_entity 135 (guid, name, description, url) values ($guid, '$name', '$description', '$url')";
146 $this->
getDatabase()->updateData(
"UPDATE {$CONFIG->dbprefix}entities 147 SET site_guid = $guid WHERE guid = $guid");
159 if (!parent::update()) {
163 $guid = (int)$this->guid;
168 $query =
"UPDATE {$CONFIG->dbprefix}sites_entity 169 SET name='$name', description='$description', url='$url' WHERE guid=$guid";
171 return $this->
getDatabase()->updateData($query) !==
false;
182 public function delete() {
202 public function disable($reason =
"", $recursive =
true) {
209 return parent::disable($reason, $recursive);
232 $this->name = $displayName;
259 'relationship' =>
'member_of_site',
260 'relationship_guid' => $this->
getGUID(),
261 'inverse_relationship' =>
true,
282 elgg_deprecated_notice(
'ElggSite::listMembers() is deprecated. Use elgg_list_entities_from_relationship()', 1.9);
285 'relationship' =>
'member_of_site',
286 'relationship_guid' => $this->
getGUID(),
287 'inverse_relationship' =>
true,
339 $options[
'relationship'] =
'member_of_site';
341 $options[
'inverse_relationship'] =
true;
456 return array_merge(parent::getExportableValues(), array(
471 return $breakdown[
'host'];
486 if (PHP_SAPI ===
'cli') {
490 if ($CONFIG->walled_garden) {
495 'access:collections:write',
497 '_elgg_walled_garden_remove_public_access',
532 if ($pos = strpos(
$url,
'?')) {
551 'ajax/view/js/languages',
555 'cache/[0-9]+/\w+/js|css/.*',
565 $pattern =
"`^{$CONFIG->url}$public/*$`i";
566 if (preg_match($pattern,
$url)) {
remove_site_user($site_guid, $user_guid)
Remove a user from a site.
getDatabase()
Provides a pointer to the database object.
elgg_is_logged_in()
Returns whether or not the user is currently logged in.
elgg_is_xhr()
Checks whether the request was requested via ajax.
remove_site_object($site_guid, $object_guid)
Remove an object from a site.
__construct($row=null)
Create a new ElggSite.
get_site_objects($site_guid, $subtype="", $limit=10, $offset=0)
Get the objects belonging to a site.
loadAdditionalSelectValues(array $data)
Stores non-attributes from the loading of the entity as volatile data.
removeEntity($entity)
Removes an entity from this site.
get_site_collections($site_guid, $subtype="", $limit=10, $offset=0)
Get the collections belonging to a site.
add_entity_relationship($guid_one, $relationship, $guid_two)
Create a relationship between two entities.
if($guid==elgg_get_logged_in_user_guid()) $name
addObject($object_guid)
Adds an object to the site.
remove_entity_relationship($guid_one, $relationship, $guid_two)
Delete a relationship between two entities.
checkWalledGarden()
Halts bootup and redirects to the site front page if site is in walled garden mode, no user is logged in, and the URL is not a public page.
$CONFIG site_guid
The guid of the current site object.
getObjects($subtype="", $limit=10, $offset=0)
Returns an array of ElggObject entities that belong to the site.
removeUser($user_guid)
Removes a user from the site.
add_site_object($site_guid, $object_guid)
Add an object to a site.
if($screenshots) $description
addUser($user_guid)
Adds a user to the site.
getGUID()
Returns the guid.
$guid
Removes an admin notice.
elgg parse_url
Parse a URL into its parts.
add_site_user($site_guid, $user_guid)
Add a user to a site.
elgg forward
Meant to mimic the php forward() function by simply redirecting the user to another page...
get_site_by_url($url)
Return the site via a url.
elgg_register_plugin_hook_handler($hook, $type, $callback, $priority=500)
Register a callback as a plugin hook handler.
listMembers($options=array())
List the members of this site.
sanitize_string($string)
Sanitize a string for database use.
disable($reason="", $recursive=true)
Disable the site.
elgg_instanceof($entity, $type=null, $subtype=null, $class=null)
Checks if $entity is an ElggEntity and optionally for type and subtype.
setDisplayName($displayName)
{}
isPublicPage($url= '')
Returns if a URL is public for this site when in Walled Garden mode.
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
getCollections($subtype="", $limit=10, $offset=0)
Get the collections associated with a site.
addEntity(ElggEntity $entity)
Adds an entity to the site.
elgg menu widget elgg menu item delete
initialise_attributes($pre18_api=true)
Initialise the attributes array.
const ELGG_ENTITIES_ANY_VALUE
elgg_trigger_plugin_hook($hook, $type, $params=null, $returnvalue=null)
Trigger a Plugin Hook and run all handler callbacks registered to that hook:type. ...
elgg_register_page_handler($identifier, $function)
Registers a page handler for a particular identifier.
elgg_deprecated_notice($msg, $dep_version, $backtrace_level=1)
Sends a notice about deprecated use of a function, view, etc.
elgg global
Pointer to the global context.
elgg_get_site_url($site_guid=0)
Get the URL for the current (or specified) site.
load($guid)
Loads the full ElggSite when given a guid.
elgg_list_entities_from_relationship(array $options=array())
Returns a viewable list of entities by relationship.
getURL()
Returns the URL for this site.
$CONFIG url
The full URL where Elgg is installed.
elgg register_error
Wrapper function for system_messages.
getExportableValues()
Return an array of fields which can be exported.
getMembers($options=array(), $offset=0)
Gets an array of ElggUser entities who are members of the site.
elgg_get_entities_from_relationship($options)
Return entities matching a given query joining against a relationship.
$user_guid
Avatar remove action.
getDomain()
Get the domain for this site.
removeObject($object_guid)
Remvoes an object from the site.
_elgg_cache_entity(ElggEntity $entity)
Cache an entity.
getEntities(array $options=array())
Get an array of entities that belong to the site.
initializeAttributes()
Initialize the attributes array.