Elgg  Version 1.9
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)));
get_input($variable, $default=null, $filter_result=true)
Get some input from variables passed submitted through GET or POST.
Definition: input.php:27
$params
Definition: save.php:15
elgg_action_exists($action)
Check if an action is registered and its script exists.
Definition: actions.php:227
$result
Definition: save.php:26
exit
Definition: reorder.php:12
elgg forward
Meant to mimic the php forward() function by simply redirecting the user to another page...
Definition: elgglib.js:419
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
const REFERER
Definition: elgglib.php:2162
$plugin_id
Definition: save.php:16
elgg system_message
Wrapper function for system_messages.
Definition: elgglib.js:374
elgg register_error
Wrapper function for system_messages.
Definition: elgglib.js:383
$plugin
Definition: save.php:17
elgg_get_plugin_from_id($plugin_id)
Returns an ElggPlugin object with the path $path.
Definition: plugins.php:204
elgg action
Definition: ajax.js:178
if(!($plugin instanceof ElggPlugin)) $plugin_name
Definition: save.php:24