Elgg  Version 1.11
placeholder.php
Go to the documentation of this file.
1 <?php
2 
3 $menus_present = (array) elgg_get_config("lazy_hover:menus");
4 
5 $user = elgg_extract("entity", $vars);
6 if (!elgg_instanceof($user, "user")) {
7  return;
8 }
9 
10 $guid = (int) $user->getGUID();
13 $input = (array) elgg_get_config("input");
14 
15 // generate MAC so we don't have to trust the client's choice of contexts
17 $mac = elgg_build_hmac($data)->getToken();
18 
19 $attrs = [
20  "rel" => $mac,
21  "class" => "elgg-menu elgg-menu-hover elgg-ajax-loader",
22 ];
23 
24 if (empty($menus_present[$mac])) {
25  $attrs["data-elgg-menu-data"] = json_encode([
26  "g" => $guid,
27  "pog" => $page_owner_guid,
28  "c" => $contexts,
29  "m" => $mac,
30  "i" => $input,
31  ]);
32 
33  $menus_present[$mac] = true;
34  elgg_set_config("lazy_hover:menus", $menus_present);
35 }
36 
elgg_get_config($name, $site_guid=0)
Get an Elgg configuration value.
if(!elgg_instanceof($user,"user")) $guid
Definition: placeholder.php:10
$page_owner_guid
Definition: placeholder.php:11
$menus_present
Definition: placeholder.php:3
$data
Definition: placeholder.php:16
elgg_extract($key, array $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:1246
$attrs
Definition: placeholder.php:19
$contexts
Definition: placeholder.php:12
elgg_format_element($tag_name, array $attributes=array(), $text= '', array $options=array())
Format an HTML element.
Definition: output.php:215
$input
Definition: placeholder.php:13
elgg_instanceof($entity, $type=null, $subtype=null, $class=null)
Checks if $entity is an and optionally for type and subtype.
Definition: entities.php:922
$user
Definition: placeholder.php:5
elgg_set_config($name, $value)
Set an Elgg configuration value.
elgg_build_hmac($data)
Get an HMAC token builder/validator object.
Definition: actions.php:107
elgg echo
Translates a string.
Definition: languages.js:43
elgg_get_context_stack()
Get the entire context stack (e.g.
Definition: pageowner.php:260
$mac
Definition: placeholder.php:17
elgg_get_page_owner_guid($guid=0)
Gets the guid of the entity that owns the current page.
Definition: pageowner.php:18
if(file_exists($welcome)) $vars
Definition: upgrade.php:93