Elgg  Version 1.11
sites.php
Go to the documentation of this file.
1 <?php
18 function elgg_get_site_entity($site_guid = 0) {
20 
21  $result = false;
22 
23  if ($site_guid == 0) {
24  $site = $CONFIG->site;
25  } else {
26  $site = get_entity($site_guid);
27  }
28 
29  if ($site instanceof \ElggSite) {
30  $result = $site;
31  }
32 
33  return $result;
34 }
35 
46 
47  $guid = (int)$guid;
48  return get_data_row("SELECT * FROM {$CONFIG->dbprefix}sites_entity WHERE guid = $guid");
49 }
50 
58 function get_site_by_url($url) {
60 
62 
63  $row = get_data_row("SELECT * from {$CONFIG->dbprefix}sites_entity where url='$url'");
64 
65  if ($row) {
66  return get_entity($row->guid);
67  }
68 
69  return false;
70 }
71 
83 function _elgg_sites_test($hook, $type, $value, $params) {
85  $value[] = "{$CONFIG->path}engine/tests/ElggSiteTest.php";
86  return $value;
87 }
88 
89 return function(\Elgg\EventsService $events, \Elgg\HooksRegistrationService $hooks) {
90  $hooks->registerHandler('unit_test', 'system', '_elgg_sites_test');
91 };
elgg_get_site_entity($site_guid=0)
Get an entity (default is current site)
Definition: sites.php:18
get_data_row($query, $callback="")
Retrieve a single row from the database.
Definition: database.php:66
$value
Definition: longtext.php:26
$guid
Removes an admin notice.
get_site_by_url($url)
Return the site via a url.
Definition: sites.php:58
$url
Definition: exceptions.php:24
get_site_entity_as_row($guid)
Return the site specific details of a site by a row.
Definition: sites.php:44
$params
Definition: login.php:72
global $CONFIG
sanitise_string($string)
Wrapper function for alternate English spelling (.
Definition: database.php:150
elgg global
Pointer to the global context.
Definition: elgglib.js:12
$type
Definition: add.php:8
$row
_elgg_sites_test($hook, $type, $value, $params)
Unit tests for sites.
Definition: sites.php:83
get_entity($guid)
Loads and returns an entity object from a guid.
Definition: entities.php:382