Elgg  Version 2.3
deactivate.php
Go to the documentation of this file.
1 <?php
14 $plugin_guids = get_input('plugin_guids');
15 
16 if (!is_array($plugin_guids)) {
18 }
19 
20 foreach ($plugin_guids as $guid) {
21  $plugin = get_entity($guid);
22 
23  if (!($plugin instanceof ElggPlugin)) {
24  register_error(elgg_echo('admin:plugins:deactivate:no', array($guid)));
25  continue;
26  }
27 
28  if ($plugin->deactivate()) {
29  //system_message(elgg_echo('admin:plugins:deactivate:yes', array($plugin->getManifest()->getName())));
30  } else {
31  $msg = $plugin->getError();
32  $string = ($msg) ? 'admin:plugins:deactivate:no_with_msg' : 'admin:plugins:deactivate:no';
33  register_error(elgg_echo($string, array($plugin->getFriendlyName(), $plugin->getError())));
34  }
35 }
36 
37 // don't regenerate the simplecache because the plugin won't be
38 // loaded until next run. Just invalidate and let it regnerate as needed
40 
41 if (count($plugin_guids) == 1) {
42  $url = 'admin/plugins';
43  $query = (string)parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY);
44  if ($query) {
45  $url .= "?$query";
46  }
48  $id = preg_replace('/[^a-z0-9-]/i', '-', $plugin->getID());
49  $url = "$url#$id";
50  return elgg_ok_response('', '', $url);
51 } else {
53 }
$plugin
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
$guid
Removes an admin notice.
elgg parse_url
Parse a URL into its parts.
Definition: elgglib.js:450
elgg forward
Meant to mimic the php forward() function by simply redirecting the user to another page...
Definition: elgglib.js:425
$url
Definition: exceptions.php:24
$string
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:2123
$plugin_guids
Definition: deactivate.php:14
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:399
if(!$collection_name) $id
Definition: add.php:17
elgg_flush_caches()
Flush all the registered caches.
Definition: cache.php:225
get_entity($guid)
Loads and returns an entity object from a guid.
Definition: entities.php:204