/
j16000removeplugin.class.php
65 lines (56 loc) · 2.29 KB
/
j16000removeplugin.class.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
/**
* Core file.
*
* @author Vince Wooll <sales@jomres.net>
*
* @version Jomres 9.9.12
*
* @copyright 2005-2017 Vince Wooll
* Jomres (tm) PHP, CSS & Javascript files are released under both MIT and GPL2 licenses. This means that you can choose the license that best suits your project, and use it accordingly
**/
// ################################################################
defined('_JOMRES_INITCHECK') or die('');
// ################################################################
#[AllowDynamicProperties]
class j16000removeplugin
{
public function __construct()
{
// Must be in all minicomponents. Minicomponents with templates that can contain editable text should run $this->template_touch() else just return
$MiniComponents = jomres_singleton_abstract::getInstance('mcHandler');
if ($MiniComponents->template_touch) {
$this->template_touchable = false;
return;
}
$debugging = false;
$pluginName = jomresGetParam($_REQUEST, 'plugin', '');
$ajax_install = (bool)jomresGetParam($_REQUEST, 'ajax_install', false);
if ($pluginName == 'subsc<x>riptions') {
$pluginName = 'subscriptions';
}
if (!dropPlugin($pluginName)) {
echo 'Plugin could not be removed';
}
$registry = jomres_singleton_abstract::getInstance('minicomponent_registry');
unlink ( $registry->registry_file );
unlink ( JOMRES_TEMP_ABSPATH.'registry_classes.php' );
$registry = jomres_singleton_abstract::getInstance('minicomponent_registry');
$registry->regenerate_registry();
emptyDir(JOMRES_CACHE_ABSPATH);
if (!$debugging && !$ajax_install ) {
jomresRedirect(jomresURL(JOMRES_SITEPAGE_URL_ADMIN.'&task=showplugins#'.$pluginName));
} else {
ob_clean();
$this->retVals = array("success" => true );
$this->retVals ['install_button'] = '<a onclick="install_plugin(\''.$pluginName.'\');" class="btn btn-primary" id="install_button_content_'.$pluginName.'" >Install</a>';
$this->retVals ['uninstall_button'] = '';
echo json_encode($this->retVals);
}
}
// This must be included in every Event/Mini-component
public function getRetVals()
{
return null;
}
}