Elgg  Version 2.2
 All Classes Namespaces Files Functions Variables Pages
tools.php
Go to the documentation of this file.
1 <?php
9 // Only logged in users
10 elgg_gatekeeper();
11 
12 // Make sure we don't open a security hole ...
13 if ((!elgg_get_page_owner_entity()) || (!elgg_get_page_owner_entity()->canEdit())) {
14  register_error(elgg_echo('noaccess'));
15  forward('/');
16 }
17 
18 $plugin_id = elgg_extract("plugin_id", $vars);
19 
20 if (empty($plugin_id)) {
21  register_error(elgg_echo('ElggPlugin:MissingID'));
23 }
24 
26 
27 if (!$plugin) {
28  register_error(elgg_echo('PluginException:InvalidID', array($plugin_id)));
30 }
31 
32 if (elgg_language_key_exists($plugin_id . ':usersettings:title')) {
33  $title = elgg_echo($plugin_id . ':usersettings:title');
34 } else {
35  $title = $plugin->getManifest()->getName();
36 }
37 
38 $username = elgg_extract('username', $vars);
39 
40 elgg_push_breadcrumb(elgg_echo('settings'), "settings/user/$username");
41 elgg_push_breadcrumb(elgg_echo('usersettings:plugins:opt:linktext'));
42 
43 $content = elgg_view_form('plugins/usersettings/save', array(), array('entity' => $plugin));
44 
45 $params = array(
46  'content' => $content,
47  'title' => $title,
48 );
49 $body = elgg_view_layout('one_sidebar', $params);
50 
elgg_language_key_exists($key, $language= 'en')
Check if a given language key exists.
Definition: languages.php:133
$username
Definition: tools.php:38
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
elgg_view_form($action, $form_vars=array(), $body_vars=array())
Definition: views.php:1302
$params
Definition: tools.php:45
elgg_view_layout($layout_name, $vars=array())
Displays a layout with optional parameters.
Definition: views.php:679
$body
Definition: tools.php:49
$vars['entity']
$title
Definition: save.php:22
register_error($error)
Display an error on next page load.
Definition: elgglib.php:452
if(empty($plugin_id)) $plugin
Definition: tools.php:25
if((!elgg_get_page_owner_entity())||(!elgg_get_page_owner_entity() ->canEdit())) $plugin_id
Definition: tools.php:18
$content
Definition: tools.php:43
const REFERER
Definition: elgglib.php:2029
elgg_get_page_owner_entity()
Gets the owner entity for the current page.
Definition: pageowner.php:56
elgg_extract($key, $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:1310
forward($location="", $reason= 'system')
Forward to $location.
Definition: elgglib.php:93
elgg_get_plugin_from_id($plugin_id)
Returns an object with the path $path.
Definition: plugins.php:82
elgg_view_page($title, $body, $page_shell= 'default', $vars=array())
Assembles and outputs a full page.
Definition: views.php:437