Elgg  Version 2.2
 All Classes Namespaces Files Functions Variables Pages
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)));
action($action, $forwarder="")
Perform an action.
Definition: actions.php:47
$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
register_error($error)
Display an error on next page load.
Definition: elgglib.php:452
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
forward($location="", $reason= 'system')
Forward to $location.
Definition: elgglib.php:93
$plugin
Definition: save.php:17
exit
Definition: autoloader.php:34
system_message($message)
Display a system message on next page load.
Definition: elgglib.php:438
elgg_get_plugin_from_id($plugin_id)
Returns an object with the path $path.
Definition: plugins.php:82
if(!($plugin instanceof ElggPlugin)) $plugin_name
Definition: save.php:24