24     $libraries = $config->get(
'libraries');
 
   25     if ($libraries === 
null) {
 
   28     $libraries[
$name] = $location;
 
   29     $config->set(
'libraries', $libraries);
 
   44     static $loaded_libraries = array();
 
   46     if (in_array(
$name, $loaded_libraries)) {
 
   52     if (!isset($libraries[
$name])) {
 
   53         $error = 
"$name is not a registered library";
 
   54         throw new \InvalidParameterException(
$error);
 
   57     if (!include_once($libraries[
$name])) {
 
   58         $error = 
"Could not load the $name library from {$libraries[$name]}";
 
   59         throw new \InvalidParameterException(
$error);
 
   62     $loaded_libraries[] = 
$name;
 
   80 function forward($location = 
"", $reason = 
'system') {
 
   81     if (!headers_sent($file, $line)) {
 
   94             header(
"Location: {$location}");
 
   98         throw new \SecurityException(
"Redirect could not be issued due to headers already being sent. Halting execution for security. " 
   99             . 
"Output started in file $file at line $line. Search http://learn.elgg.org/ for more information.");
 
  161     if (isset($config[
'deps']) || isset($config[
'exports'])) {
 
  340     if ($handle = opendir($directory)) {
 
  341         while (($file = readdir($handle)) !== 
false) {
 
  342             if (!is_file($directory . $file) || in_array($file, $exceptions)) {
 
  348                     $list[] = $directory . $file;
 
  351                 $list[] = $directory . $file;
 
  373     $path = preg_replace(
"/([^:])\/\//", 
"$1/", 
$path);
 
  534     return _elgg_services()->events->unregisterHandler($event, $object_type, $callback);
 
  612         \
Elgg\EventsService::OPTION_STOPPABLE => 
false,
 
  632         \
Elgg\EventsService::OPTION_DEPRECATION_MESSAGE => 
$message,
 
  633         \
Elgg\EventsService::OPTION_DEPRECATION_VERSION => 
$version,
 
  718     _elgg_services()->hooks->unregisterHandler($hook, $entity_type, $callback);
 
  798     error_log(
"Exception #$timestamp: $exception");
 
  804     header(
"Cache-Control: no-cache, must-revalidate", 
true);
 
  805     header(
'Expires: Fri, 05 Feb 1982 00:00:00 -0500', 
true);
 
  816         if (!empty(
$CONFIG->exception_include) && is_file(
$CONFIG->exception_include)) {
 
  818             include 
$CONFIG->exception_include;
 
  819             $exception_output = ob_get_clean();
 
  823             if (!empty($exception_output)) {
 
  824                 echo $exception_output;
 
  851     } 
catch (Exception 
$e) {
 
  854         echo 
"Fatal error in exception handler. Check log for Exception #$timestamp";
 
  855         error_log(
"Exception #$timestamp : fatal error in exception handler : $message");
 
  884     $error = date(
"Y-m-d H:i:s (T)") . 
": \"$errmsg\" in file $filename (line $linenum)";
 
  888             error_log(
"PHP ERROR: $error");
 
  892             throw new \Exception(
$error);
 
  896         case E_USER_WARNING :
 
  897         case E_RECOVERABLE_ERROR: 
 
  900             if (error_reporting()) {
 
  901                 error_log(
"PHP WARNING: $error");
 
  908                 error_log(
"PHP NOTICE: $error");
 
  934     static $levels = array(
 
  942     if ($level == 
'DEBUG') {
 
  946     $level = $levels[$level];
 
  983             if (!include(
$CONFIG->path . 
"version.php")) {
 
 1007     $backtrace_level += 1;
 
 1008     return _elgg_services()->deprecation->sendNotice($msg, $dep_version, $backtrace_level);
 
 1026     $scheme = isset($parts[
'scheme']) ? 
"{$parts['scheme']}://" : 
'';
 
 1027     $host = isset($parts[
'host']) ? 
"{$parts['host']}" : 
'';
 
 1028     $port = isset($parts[
'port']) ? 
":{$parts['port']}" : 
'';
 
 1029     $path = isset($parts[
'path']) ? 
"{$parts['path']}" : 
'';
 
 1030     $query = isset($parts[
'query']) ? 
"?{$parts['query']}" : 
'';
 
 1031     $fragment = isset($parts[
'fragment']) ? 
"#{$parts['fragment']}" : 
'';
 
 1033     $string = $scheme . $host . $port . 
$path . $query . $fragment;
 
 1061     $components = parse_url(
$url);
 
 1063     if (isset($components[
'query'])) {
 
 1069     if (isset($query[
'__elgg_ts']) && isset($query[
'__elgg_token'])) {
 
 1074     $query[
'__elgg_ts'] = time();
 
 1076     $components[
'query'] = http_build_query($query);
 
 1108     $url_array = parse_url(
$url);
 
 1110     if (isset($url_array[
'query'])) {
 
 1116     foreach ($elements as $k => $v) {
 
 1127     if ($query || empty($url_array[
'path'])) {
 
 1128         $url_array[
'query'] = http_build_query($query);
 
 1130         unset($url_array[
'query']);
 
 1157     if ($url1 == $url2) {
 
 1161     $url1_info = parse_url($url1);
 
 1162     $url2_info = parse_url($url2);
 
 1164     if (isset($url1_info[
'path'])) {
 
 1165         $url1_info[
'path'] = trim($url1_info[
'path'], 
'/');
 
 1167     if (isset($url2_info[
'path'])) {
 
 1168         $url2_info[
'path'] = trim($url2_info[
'path'], 
'/');
 
 1172     $parts = array(
'scheme', 
'host', 
'path');
 
 1174     foreach ($parts as $part) {
 
 1175         if ((isset($url1_info[$part]) && isset($url2_info[$part]))
 
 1176         && $url1_info[$part] != $url2_info[$part]) {
 
 1178         } elseif (isset($url1_info[$part]) && !isset($url2_info[$part])) {
 
 1180         } elseif (!isset($url1_info[$part]) && isset($url2_info[$part])) {
 
 1186     if (isset($url1_info[
'query']) && isset($url2_info[
'query'])
 
 1187     && $url1_info[
'query'] == $url2_info[
'query']) {
 
 1192     $url1_params = array();
 
 1193     $url2_params = array();
 
 1195     if (isset($url1_info[
'query'])) {
 
 1196         if ($url1_info[
'query'] = html_entity_decode($url1_info[
'query'])) {
 
 1201     if (isset($url2_info[
'query'])) {
 
 1202         if ($url2_info[
'query'] = html_entity_decode($url2_info[
'query'])) {
 
 1208     foreach ($ignore_params as $param) {
 
 1209         if (isset($url1_params[$param])) {
 
 1210             unset($url1_params[$param]);
 
 1212         if (isset($url2_params[$param])) {
 
 1213             unset($url2_params[$param]);
 
 1222     $diff_count = count(array_diff_assoc($url1_params, $url2_params));
 
 1223     $diff_count += count(array_diff_assoc($url2_params, $url1_params));
 
 1224     if ($diff_count > 0) {
 
 1247     if (!is_array($array)) {
 
 1279 $sort_type = SORT_LOCALE_STRING) {
 
 1283     foreach ($array as $v) {
 
 1284         if (isset($v[$element])) {
 
 1285             $sort[] = strtolower($v[$element]);
 
 1291     return array_multisort(
$sort, $sort_order, $sort_type, $array);
 
 1305     $temp = strtolower(ini_get($ini_get_arg));
 
 1307     if ($temp == 
'1' || $temp == 
'on' || $temp == 
'true') {
 
 1326     $val = ini_get($setting);
 
 1329     $last = strtolower($val[strlen($val) - 1]);
 
 1377     foreach ($singulars as $singular) {
 
 1378         $plural = $singular . 
's';
 
 1380         if (array_key_exists($singular, 
$options)) {
 
 1385                 if (!is_array(
$options[$singular])) {
 
 1421         $uri = 
_elgg_services()->request->server->get(
'REQUEST_URI', 
'CLI');
 
 1423         elgg_log(
"Page {$uri} generated in $time seconds", 
'INFO');
 
 1424     } 
catch (Exception 
$e) {
 
 1425         $message = 
'Error: ' . get_class(
$e) . 
' thrown within the shutdown handler. ';
 
 1426         $message .= 
"Message: '{$e->getMessage()}' in file {$e->getFile()} (line {$e->getLine()})";
 
 1428         error_log(
"Exception trace stack: {$e->getTraceAsString()}");
 
 1432     session_write_close();
 
 1470     if (is_array($page) && 
sizeof($page)) {
 
 1473         $view = implode(
'/', $page);
 
 1476         if (!array_key_exists(
$view, $allowed_views)) {
 
 1477             header(
'HTTP/1.1 403 Forbidden');
 
 1487         if (isset(
$vars[
'guid'])) {
 
 1494                 header(
"Content-Type: text/javascript");
 
 1497                 header(
"Content-Type: text/css");
 
 1519     if (!isset($page[0])) {
 
 1536     header(
"HTTP/1.1 404 Not Found", 
true, 404);
 
 1538     header(
'Expires: ' . gmdate(
'D, d M Y H:i:s \G\M\T', strtotime(
"+1 week")), 
true);
 
 1539     header(
"Pragma: public", 
true);
 
 1540     header(
"Cache-Control: public", 
true);
 
 1564             $content_type = 
'text/javascript';
 
 1568             $content_type = 
'text/css';
 
 1583         $page = implode(
'/', $page);
 
 1584         $regex = 
'|(.+?)\.\w+$|';
 
 1585         if (!preg_match($regex, $page, $matches)) {
 
 1588         $view = 
"$type/{$matches[1]}";
 
 1594         header(
"Content-type: $content_type");
 
 1620     $order_by = strtolower($order_by);
 
 1622     if (strpos($order_by, 
' asc') !== 
false) {
 
 1623         $return = str_replace(
' asc', 
' desc', $order_by);
 
 1624     } elseif (strpos($order_by, 
' desc') !== 
false) {
 
 1625         $return = str_replace(
' desc', 
' asc', $order_by);
 
 1628         $return = $order_by . 
' desc';
 
 1647     return $object->enable() ? true : 
false;
 
 1661     return $object->disable() ? true : 
false;
 
 1675     return $object->delete() ? true : 
false;
 
 1700             $metadata_required = array(
 
 1701                 'metadata_owner_guid', 
'metadata_owner_guids',
 
 1702                 'metadata_name', 
'metadata_names',
 
 1703                 'metadata_value', 
'metadata_values' 
 1706             $required = array_merge($required, $metadata_required);
 
 1711             $annotations_required = array(
 
 1712                 'annotation_owner_guid', 
'annotation_owner_guids',
 
 1713                 'annotation_name', 
'annotation_names',
 
 1714                 'annotation_value', 
'annotation_values' 
 1717             $required = array_merge($required, $annotations_required);
 
 1724     foreach ($required as 
$key) {
 
 1749         'class' => 
'elgg-walledgarden-double',
 
 1750         'id' => 
'elgg-walledgarden-login',
 
 1769         'content' => 
elgg_view(
"core/walled_garden/$view"),
 
 1770         'class' => 
'elgg-walledgarden-single hidden',
 
 1771         'id' => str_replace(
'_', 
'-', 
"elgg-walledgarden-$view"),
 
 1800         $CONFIG->site->checkWalledGarden();
 
 1835     set_error_handler(
'_elgg_php_error_handler');
 
 1836     set_exception_handler(
'_elgg_php_exception_handler');
 
 1877         $resource = new \Elgg\Http\WebAppManifestResource(
$site);
 
 1878         header(
'Content-Type: application/json');
 
 1879         echo json_encode($resource->get());
 
 1884         $result[
'links'][
'manifest'] = [
 
 1885             'rel' => 
'manifest',
 
 1893     elgg_register_js(
'jquery.ui.autocomplete.html', 
'vendors/jquery/jquery.ui.autocomplete.html.js');
 
 1896         'src' => 
'/vendors/jquery/jquery.ui.autocomplete.html.js',
 
 1897         'deps' => array(
'jquery.ui')
 
 1904     elgg_register_js(
'jquery.imgareaselect', 
'vendors/jquery/jquery.imgareaselect/scripts/jquery.imgareaselect.min.js');
 
 1907     elgg_register_css(
'jquery.imgareaselect', 
'vendors/jquery/jquery.imgareaselect/css/imgareaselect-deprecated.css');
 
 1910     register_shutdown_function(
'_elgg_shutdown_hook');
 
 1915     $CONFIG->wordblacklist = array();
 
 1918         foreach (
$list as $l) {
 
 1919             $CONFIG->wordblacklist[] = trim($l);
 
 1938     $value[] = 
$CONFIG->path . 
'engine/tests/ElggTravisInstallTest.php';
 
 1939     $value[] = 
$CONFIG->path . 
'engine/tests/ElggCoreHelpersTest.php';
 
 1940     $value[] = 
$CONFIG->path . 
'engine/tests/ElggCoreRegressionBugsTest.php';
 
 1941     $value[] = 
$CONFIG->path . 
'engine/tests/ElggBatchTest.php';
 
 1953 define(
'ACCESS_DEFAULT', -1);
 
 1954 define(
'ACCESS_PRIVATE', 0);
 
 1955 define(
'ACCESS_LOGGED_IN', 1);
 
 1956 define(
'ACCESS_PUBLIC', 2);
 
 1957 define(
'ACCESS_FRIENDS', -2);
 
 1967 define(
'ELGG_ENTITIES_ANY_VALUE', 
null);
 
 1976 define(
'ELGG_ENTITIES_NO_VALUE', 0);
 
 1985 define(
'REFERRER', -1);
 
 1995 define(
'REFERER', -1);
 
 1998     $events->registerHandler(
'init', 
'system', 
'_elgg_init');
 
 1999     $events->registerHandler(
'boot', 
'system', 
'_elgg_engine_boot', 1);
 
 2000     $hooks->registerHandler(
'unit_test', 
'system', 
'_elgg_api_test');
 
 2002     $events->registerHandler(
'init', 
'system', 
'_elgg_walled_garden_init', 1000);
 
$content
Set robots.txt action.
if(! $owner||!($owner instanceof ElggUser)||! $owner->canEdit()) $error
generate_action_token($timestamp)
Generate an action token.
elgg_is_xhr()
Checks whether the request was requested via ajax.
elgg_register_action($action, $filename="", $access='logged_in')
Registers an action.
if($guid==elgg_get_logged_in_user_guid()) $name
_elgg_load_autoload_cache()
Load cached data into the autoload system.
elgg_get_simplecache_url($type, $view)
elgg_get_config($name, $site_guid=0)
Get an Elgg configuration value.
_elgg_load_site_config()
Loads configuration related to this site.
_elgg_load_application_config()
Loads configuration related to Elgg as an application.
elgg_http_remove_url_query_element($url, $element)
Removes an element from a URL's query string.
const ELGG_ENTITIES_ANY_VALUE
register_error($error)
Display an error on next page load.
elgg_trigger_event($event, $object_type, $object=null)
elgg_extract($key, array $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
_elgg_cacheable_view_page_handler($page, $type)
Serves a JS or CSS view with headers for caching.
elgg_http_url_is_identical($url1, $url2, $ignore_params=array('offset', 'limit'))
Test if two URLs are functionally identical.
elgg_define_js($name, $config)
Defines a JS lib as an AMD module.
elgg_log($message, $level='NOTICE')
Display or log a message.
_elgg_php_exception_handler($exception)
Intercepts, logs, and displays uncaught exceptions.
elgg_register_css($name, $url, $priority=null)
Register a CSS file for inclusion in the HTML head.
elgg_register_library($name, $location)
Register a PHP file as a library.
_elgg_init()
Elgg's main init.
_elgg_css_page_handler($page)
Serve CSS.
elgg_require_js($name)
Request that Elgg load an AMD module onto the page.
sanitise_filepath($path, $append_slash=true)
Sanitise file paths ensuring that they begin and end with slashes etc.
_elgg_normalize_plural_options_array($options, $singulars)
Normalise the singular keys in an options array to plural keys.
_elgg_sql_reverse_order_by_clause($order_by)
Reverses the ordering in an ORDER BY clause.
elgg_load_css($name)
Load a CSS file for this page.
_elgg_walled_garden_remove_public_access($hook, $type, $accesses)
Remove public access for walled gardens.
elgg_register_plugin_hook_handler($hook, $type, $callback, $priority=500)
elgg_get_file_list($directory, $exceptions=array(), $list=array(), $extensions=null)
Returns a list of files in $directory.
elgg_unregister_js($name)
Unregister a JavaScript file.
elgg_get_ini_setting_in_bytes($setting)
Returns a PHP INI setting in bytes.
elgg_register_js($name, $url, $location='head', $priority=null)
Register a JavaScript file for inclusion.
elgg_trigger_after_event($event, $object_type, $object=null)
Trigger an "After event" indicating a process has finished.
elgg_get_loaded_js($location='head')
Get the JavaScript URLs that are loaded.
system_message($message)
Display a system message on next page load.
elgg_http_build_url(array $parts, $html_encode=true)
Builds a URL from the a parts array like one returned by parse_url().
system_messages($message=null, $register="success", $count=false)
Queues a message to be displayed.
elgg_get_version($human_readable=false)
Get the current Elgg version information.
_elgg_walled_garden_init()
Checks the status of the Walled Garden and forwards to a login page if required.
elgg_http_add_url_query_elements($url, array $elements)
Sets elements in a URL's query string.
elgg_sort_3d_array_by_value(&$array, $element, $sort_order=SORT_ASC, $sort_type=SORT_LOCALE_STRING)
Sorts a 3d array by specific element.
elgg_register_external_file($type, $name, $url, $location, $priority=500)
Core registration function for external files.
_elgg_js_page_handler($page)
Serve javascript pages.
is_not_null($string)
Returns true is string is not empty, false, or null.
elgg_unregister_plugin_hook_handler($hook, $entity_type, $callback)
Unregister a callback as a plugin hook.
elgg_unregister_event_handler($event, $object_type, $callback)
Unregisters a callback for an event.
elgg_load_external_file($type, $name)
Load an external resource for use on this page.
elgg_register_event_handler($event, $object_type, $callback, $priority=500)
_elgg_php_error_handler($errno, $errmsg, $filename, $linenum, $vars)
Intercepts catchable PHP errors.
elgg_trigger_deprecated_event($event, $object_type, $object=null, $message, $version)
Trigger an event normally, but send a notice about deprecated use if any handlers are registered.
elgg_trigger_plugin_hook($hook, $type, $params=null, $returnvalue=null)
_elgg_is_valid_options_for_batch_operation($options, $type)
Checks if there are some constraints on the options array for potentially dangerous operations.
elgg_trigger_before_event($event, $object_type, $object=null)
Trigger a "Before event" indicating a process is about to begin.
ini_get_bool($ini_get_arg)
Return the state of a php.ini setting as a bool.
count_messages($register="")
Counts the number of messages, either globally or in a particular register.
_elgg_ajax_page_handler($page)
Serve individual views for Ajax.
elgg_get_loaded_external_files($type, $location)
Get external resource descriptors.
_elgg_shutdown_hook()
Emits a shutdown:system event upon PHP shutdown, but before database connections are dropped.
elgg_deprecated_notice($msg, $dep_version, $backtrace_level=1)
Log a notice about deprecated use of a function, view, etc.
_elgg_walled_garden_ajax_handler($page)
Serve walled garden sections.
elgg_unregister_external_file($type, $name)
Unregister an external file.
_elgg_engine_boot()
Boots the engine.
elgg_load_library($name)
Load a PHP library.
elgg_dump($value, $to_screen=true)
Logs or displays $value.
elgg_batch_enable_callback($object)
Enable objects with an enable() method.
elgg_unregister_css($name)
Unregister a CSS file.
elgg_batch_delete_callback($object)
Delete objects with a delete() method.
elgg_load_js($name)
Load a JavaScript resource on this page.
_elgg_walled_garden_index()
Intercepts the index page when Walled Garden mode is enabled.
forward($location="", $reason='system')
Forward to $location.
elgg_get_loaded_css()
Get the loaded CSS URLs.
_elgg_favicon_page_handler($segments)
Handle requests for /favicon.ico.
elgg_batch_disable_callback($object)
Disable objects with a disable() method.
elgg_add_action_tokens_to_url($url, $html_encode=false)
Adds action tokens to URL.
_elgg_api_test($hook, $type, $value, $params)
Adds unit tests for the general API.
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
global $START_MICROTIME
The time with microseconds when the Elgg engine was started.
get_entity($guid)
Loads and returns an entity object from a guid.
elgg_parse_str($str)
Parses a string using mb_parse_str() if available.
elgg_format_url($url)
Handles formatting of ampersands in urls.
elgg_register_page_handler($identifier, $function)
Registers a page handler for a particular identifier.
elgg_is_admin_logged_in()
Returns whether or not the viewer is currently logged in and an admin user.
_elgg_session_boot()
Initializes the session and checks for the remember me cookie.
elgg_get_site_entity($site_guid=0)
Get an \ElggSite entity (default is current site)
if(file_exists($welcome)) $vars
if($composer===null) if(!isset($composer->version)) $release
clearfix elgg elgg elgg elgg page header
elgg_view_layout($layout_name, $vars=array())
Displays a layout with optional parameters.
elgg_view_page($title, $body, $page_shell='default', $vars=array())
Assembles and outputs a full page.
elgg_view($view, $vars=array(), $bypass=false, $ignored=false, $viewtype='')
Return a parsed view.
elgg_set_viewtype($viewtype="")
Manually set the viewtype.
elgg_view_exists($view, $viewtype='', $recurse=true)
Returns whether the specified view exists.
elgg_register_external_view($view, $cacheable=false)
Registers a view as being available externally (i.e.