Elgg  Version 3.0
deactivate.php
Go to the documentation of this file.
1 <?php
11 $plugin_guids = get_input('plugin_guids');
12 
13 if (!is_array($plugin_guids)) {
15 }
16 
18 foreach ($plugin_guids as $guid) {
19  $plugin = get_entity($guid);
20 
21  if (!($plugin instanceof ElggPlugin)) {
22  register_error(elgg_echo('admin:plugins:deactivate:no', [$guid]));
23  continue;
24  }
25 
26  if (!$plugin->deactivate()) {
27  $msg = $plugin->getError();
28  $string = ($msg) ? 'admin:plugins:deactivate:no_with_msg' : 'admin:plugins:deactivate:no';
29  register_error(elgg_echo($string, [$plugin->getDisplayName(), $msg]));
30  continue;
31  }
32 
34 }
35 
36 if (empty($deactivated_plugins)) {
37  return elgg_error_response();
38 }
39 
40 if (count($deactivated_plugins) == 1) {
42 
44  'path' => 'admin/plugins',
45  'query' => parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY),
46  'fragment' => preg_replace('/[^a-z0-9-]/i', '-', $plugin->getID()),
47  ]);
48 
49  return elgg_ok_response('', '', $url);
50 }
51 
52 return elgg_ok_response();
$plugin
if(!is_array($plugin_guids)) $deactivated_plugins
Definition: deactivate.php:17
$guid
Removes an admin notice.
elgg parse_url
Parse a URL into its parts.
Definition: elgglib.js:442
elgg_echo($message_key, array $args=[], $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
get_input($variable, $default=null, $filter_result=true)
Get some input from variables passed submitted through GET or POST.
Definition: input.php:27
elgg_error_response($error= '', $forward_url=REFERRER, $status_code=ELGG_HTTP_OK)
Prepare an error response to be returned by a page or an action handler.
$plugin_guids
Deactivate a plugin or plugins.
Definition: deactivate.php:11
$url
Definition: default.php:33
elgg_ok_response($content= '', $message= '', $forward_url=null, $status_code=ELGG_HTTP_OK)
Prepares a successful response to be returned by a page or an action handler.
elgg register_error
Wrapper function for system_messages.
Definition: elgglib.js:391
elgg_http_build_url(array $parts, $html_encode=true)
Builds a URL from the a parts array like one returned by parse_url().
Definition: elgglib.php:859
get_entity($guid)
Loads and returns an entity object from a guid.
Definition: entities.php:87