Elgg  Version 2.2
save.php
Go to the documentation of this file.
1 <?php
15 $params = get_input('params');
16 $plugin_id = get_input('plugin_id');
18 
19 if (!($plugin instanceof ElggPlugin)) {
20  register_error(elgg_echo('plugins:settings:save:fail', array($plugin_id)));
22 }
23 
24 $plugin_name = $plugin->getManifest()->getName();
25 
26 $result = false;
27 
28 // allow a plugin to override the save action for their settings
29 if (elgg_action_exists("$plugin_id/settings/save")) {
30  action("$plugin_id/settings/save");
31 } else {
32  foreach ($params as $k => $v) {
33  $result = $plugin->setSetting($k, $v);
34  if (!$result) {
35  register_error(elgg_echo('plugins:settings:save:fail', array($plugin_name)));
37  exit;
38  }
39  }
40 }
41 
42 system_message(elgg_echo('plugins:settings:save:ok', array($plugin_name)));
$params
Definition: save.php:15
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
elgg_action_exists($action)
Check if an action is registered and its script exists.
Definition: actions.php:216
$result
Definition: save.php:26
elgg forward
Meant to mimic the php forward() function by simply redirecting the user to another page...
Definition: elgglib.js:425
get_input($variable, $default=null, $filter_result=true)
Get some input from variables passed submitted through GET or POST.
Definition: input.php:27
const REFERER
Definition: elgglib.php:2029
$plugin_id
Definition: save.php:16
elgg system_message
Wrapper function for system_messages.
Definition: elgglib.js:390
elgg register_error
Wrapper function for system_messages.
Definition: elgglib.js:399
$plugin
Definition: save.php:17
exit
Definition: autoloader.php:34
elgg_get_plugin_from_id($plugin_id)
Returns an object with the path $path.
Definition: plugins.php:82
elgg action
Definition: ajax.js:200
if(!($plugin instanceof ElggPlugin)) $plugin_name
Definition: save.php:24