Elgg  Version 5.1
AddSRIConfig.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Javascript;
4 
11 class AddSRIConfig {
12 
21  public function __invoke(\Elgg\Event $event) {
22  if (!elgg_get_config('subresource_integrity_enabled')) {
23  return;
24  }
25 
26  $return = $event->getValue();
27 
28  $data = _elgg_services()->serverCache->load('sri') ?? [];
29 
30  $return['sri'] = $data['js'] ?? [];
31 
32  return $return;
33  }
34 }
elgg_get_config(string $name, $default=null)
Get an Elgg configuration value.
__invoke(\Elgg\Event $event)
Add SRI information from cached data.
if(!$entity instanceof\ElggUser) $data
Definition: attributes.php:13
Adds SRI information to js elgg.data object.
_elgg_services()
Get the global service provider.
Definition: elgglib.php:346
Models an event passed to event handlers.
Definition: Event.php:11