Elgg  Version 1.11
sites.php
Go to the documentation of this file.
1 <?php
18 function elgg_get_site_entity($site_guid = 0) {
19  global $CONFIG;
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 
45  global $CONFIG;
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) {
59  global $CONFIG;
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) {
84  global $CONFIG;
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 };
$params
Definition: login.php:72
$type
Definition: add.php:8
$guid
Removes an admin notice.
$row
sanitise_string($string)
Wrapper function for alternate English spelling (.
Definition: database.php:150
get_data_row($query, $callback="")
Retrieve a single row from the database.
Definition: database.php:66
get_entity($guid)
Loads and returns an entity object from a guid.
Definition: entities.php:382
$url
Definition: exceptions.php:24
$value
Definition: longtext.php:26
global $CONFIG
get_site_entity_as_row($guid)
Return the site specific details of a site by a row.
Definition: sites.php:44
_elgg_sites_test($hook, $type, $value, $params)
Unit tests for sites.
Definition: sites.php:83
get_site_by_url($url)
Return the site via a url.
Definition: sites.php:58
elgg_get_site_entity($site_guid=0)
Get an \ElggSite entity (default is current site)
Definition: sites.php:18