. defined('STATUSNET') || die(); /** * Form for deleting a plugin * * @category Form * @package GNUsocial * @author Diogo Cordeiro * @copyright 2019 Free Software Foundation, Inc http://www.fsf.org * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later */ class PluginDeleteForm extends PluginEnableForm { /** * Plugin to delete */ public $plugin = null; /** * Constructor * * @param HTMLOutputter $out output channel * @param string $plugin plugin to delete */ public function __construct($out = null, $plugin = null) { parent::__construct($out); $this->plugin = $plugin; } /** * ID of the form * * @return string ID of the form */ public function id() { return 'plugin-delete-' . $this->plugin; } /** * class of the form * * @return string of the form class */ public function formClass() { return 'form_plugin_delete'; } /** * Action of the form * * @return string URL of the action */ public function action() { return common_local_url( 'plugindelete', ['plugin' => $this->plugin] ); } public function show() { if (!is_writable(INSTALLDIR . '/local/plugins/'.$this->plugin) || // We can only delete third party plugins PluginList::isPluginLoaded($this->plugin)) { // We can't delete a plugin that has been loaded in config.php return; } parent::show(); } /** * Action elements * * @return void * @throws Exception */ public function formActions() { // TRANS: Plugin admin panel controls $this->out->submit('submit', _m('plugin', 'Delete')); } }