Elgg  Version 3.0
save.php
Go to the documentation of this file.
1 <?php
13 $params = get_input('params');
14 $flush_cache = get_input('flush_cache');
15 $plugin_id = get_input('plugin_id');
17 
18 if (!$plugin) {
19  return elgg_error_response(elgg_echo('plugins:settings:save:fail', [$plugin_id]));
20 }
21 
22 $plugin_name = $plugin->getDisplayName();
23 
24 $result = false;
25 
26 foreach ($params as $k => $v) {
27  $result = $plugin->setSetting($k, $v);
28  if (!$result) {
29  return elgg_error_response(elgg_echo('plugins:settings:save:fail', [$plugin_name]));
30  }
31 }
32 
33 if ($flush_cache) {
35 }
36 
37 return elgg_ok_response('', elgg_echo('plugins:settings:save:ok', [$plugin_name]));
$params
Saves global plugin settings.
Definition: save.php:13
if(!empty($_SERVER['HTTP_REFERER'])) $result
Definition: save.php:77
elgg_echo($message_key, array $args=[], $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
get_input($variable, $default=null, $filter_result=true)
Get some input from variables passed submitted through GET or POST.
Definition: input.php:27
$plugin_id
Definition: save.php:15
elgg_error_response($error= '', $forward_url=REFERRER, $status_code=ELGG_HTTP_OK)
Prepare an error response to be returned by a page or an action handler.
elgg_ok_response($content= '', $message= '', $forward_url=null, $status_code=ELGG_HTTP_OK)
Prepares a successful response to be returned by a page or an action handler.
if(!$plugin) $plugin_name
Definition: save.php:22
$plugin
Definition: save.php:16
$flush_cache
Definition: save.php:14
elgg_flush_caches()
Flush all the registered caches.
Definition: cache.php:234
elgg_get_plugin_from_id($plugin_id)
Returns an object with the path $path.
Definition: plugins.php:28