Elgg  Version 2.3
tools.php
Go to the documentation of this file.
1 <?php
9 // Only logged in users
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 
$title
Definition: save.php:22
register_error($error)
Display an error on next page load.
Definition: elgglib.php:464
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:1375
const REFERER
Definition: elgglib.php:2123
forward($location="", $reason='system')
Forward to $location.
Definition: elgglib.php:94
elgg_get_plugin_from_id($plugin_id)
Returns an \ElggPlugin object with the path $path.
Definition: plugins.php:82
elgg_language_key_exists($key, $language='en')
Check if a given language key exists.
Definition: languages.php:133
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
elgg_view_layout($layout_name, $vars=array())
Displays a layout with optional parameters.
Definition: views.php:689
elgg_view_page($title, $body, $page_shell='default', $vars=array())
Assembles and outputs a full page.
Definition: views.php:447
elgg_view_form($action, $form_vars=array(), $body_vars=array())
Definition: views.php:1345
elgg_push_breadcrumb($title, $link=null)
Adds a breadcrumb to the breadcrumbs stack.
Definition: navigation.php:255
elgg_gatekeeper()
Used at the top of a page to mark it as logged in users only.
Definition: pagehandler.php:58
elgg_get_page_owner_entity()
Gets the owner entity for the current page.
Definition: pageowner.php:56
$vars['entity']
$username
Definition: tools.php:38
$body
Definition: tools.php:49
$content
Definition: tools.php:43
if((!elgg_get_page_owner_entity())||(!elgg_get_page_owner_entity() ->canEdit())) $plugin_id
Definition: tools.php:18
if(empty($plugin_id)) $plugin
Definition: tools.php:25
$params
Definition: tools.php:45