Elgg  Version 2.3
sites.php
Go to the documentation of this file.
1 <?php
18 function elgg_get_site_entity($site_guid = 0) {
20 
21  if ($site_guid == 0) {
22  return $CONFIG->site;
23  }
24 
25  $site = _elgg_services()->entityTable->get($site_guid);
26  if (!$site instanceof \ElggSite) {
27  return false;
28  }
29 
30  return $site;
31 }
32 
43 
44  $guid = (int)$guid;
45  return get_data_row("SELECT * FROM {$CONFIG->dbprefix}sites_entity WHERE guid = $guid");
46 }
47 
55 function get_site_by_url($url) {
57 
59 
60  $row = get_data_row("SELECT * from {$CONFIG->dbprefix}sites_entity where url='$url'");
61 
62  if ($row) {
63  return get_entity($row->guid);
64  }
65 
66  return false;
67 }
68 
80 function _elgg_sites_test($hook, $type, $value, $params) {
82  $value[] = "{$CONFIG->path}engine/tests/ElggSiteTest.php";
83  return $value;
84 }
85 
86 return function(\Elgg\EventsService $events, \Elgg\HooksRegistrationService $hooks) {
87  $hooks->registerHandler('unit_test', 'system', '_elgg_sites_test');
88 };
elgg_get_site_entity($site_guid=0)
Get an entity (default is current site)
Definition: sites.php:18
$value
Definition: longtext.php:42
$guid
Removes an admin notice.
get_site_by_url($url)
Return the site via a url.
Definition: sites.php:55
$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:41
$params
Definition: login.php:72
get_data_row($query, $callback=null, array $params=[])
Retrieve a single row from the database.
Definition: database.php:72
global $CONFIG
sanitise_string($string)
Alias of sanitize_string.
Definition: database.php:166
elgg global
Pointer to the global context.
Definition: elgglib.js:12
_elgg_services(\Elgg\Di\ServiceProvider $services=null)
Get the global service provider.
Definition: autoloader.php:17
$row
_elgg_sites_test($hook, $type, $value, $params)
Unit tests for sites.
Definition: sites.php:80
get_entity($guid)
Loads and returns an entity object from a guid.
Definition: entities.php:204
if(!$display_name) $type
Definition: delete.php:27