Elgg  Version 4.3
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\Hook $hook) {
22  if (!elgg_get_config('subresource_integrity_enabled')) {
23  return;
24  }
25 
26  $return = $hook->getValue();
27 
28  $data = _elgg_services()->serverCache->load('sri') ?? [];
29 
30  $return['sri'] = $data['js'] ?? [];
31 
32  return $return;
33  }
34 }
__invoke(\Elgg\Hook $hook)
Add SRI information from cached data.
if(elgg_trigger_plugin_hook('usersettings:save', 'user', $hooks_params, true)) foreach($request->validation() ->all() as $item) $data
Definition: save.php:53
Models an event passed to hook handlers.
Definition: Hook.php:11
Adds SRI information to js elgg.data object.
_elgg_services()
Get the global service provider.
Definition: elgglib.php:638
elgg_get_config($name, $default=null)
Get an Elgg configuration value.