Elgg  Version master
remove.php
Go to the documentation of this file.
1 <?php
8 $plugin_id = get_input('plugin_id');
9 if (empty($plugin_id)) {
10  return elgg_error_response(elgg_echo('error:missing_data'));
11 }
12 
14 if (!$plugin instanceof \ElggPlugin) {
15  return elgg_error_response(elgg_echo('PluginException:InvalidID', [$plugin_id]));
16 }
17 
18 if (!$plugin->canEdit()) {
19  return elgg_error_response(elgg_echo('actionunauthorized'));
20 }
21 
22 if (!$plugin->unsetAllEntityAndPluginSettings()) {
23  return elgg_error_response(elgg_echo('plugins:settings:remove:fail', [$plugin->getDisplayName()]));
24 }
25 
26 return elgg_ok_response('', elgg_echo('plugins:settings:remove:ok', [$plugin->getDisplayName()]));
Plugin class containing helper functions for plugin activation/deactivation, dependency checking capa...
Definition: ElggPlugin.php:17
elgg_get_plugin_from_id(string $plugin_id)
Elgg plugins library Contains functions for managing plugins.
Definition: plugins.php:15
elgg_ok_response($content= '', string|array $message= '', string $forward_url=null, int $status_code=ELGG_HTTP_OK)
Prepares a successful response to be returned by a page or an action handler.
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
Definition: languages.php:17
$plugin_id
Remove all user and plugin settings from the give plugin ID.
Definition: remove.php:8
get_input(string $variable, $default=null, bool $filter_result=true)
Parameter input functions.
Definition: input.php:20
elgg_error_response(string|array $message= '', string $forward_url=REFERRER, int $status_code=ELGG_HTTP_BAD_REQUEST)
Prepare an error response to be returned by a page or an action handler.
if(empty($plugin_id)) $plugin
Definition: remove.php:13