| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
use Beyondwords\Wordpress\Core\Uninstaller; |
| 6 |
|
| 7 |
/** |
| 8 |
* Uninstall script for BeyondWords. |
| 9 |
* |
| 10 |
* Executed when BeyondWords is uninstalled via built-in WordPress commands. |
| 11 |
* |
| 12 |
* @since 3.7.0 |
| 13 |
* |
| 14 |
* @SuppressWarnings(PHPMD.ExitExpression) |
| 15 |
*/ |
| 16 |
function beyondwords_uninstall() |
| 17 |
{ |
| 18 |
if ( |
| 19 |
! defined('WP_UNINSTALL_PLUGIN') || |
| 20 |
! WP_UNINSTALL_PLUGIN || |
| 21 |
dirname(WP_UNINSTALL_PLUGIN) !== dirname(plugin_basename(__FILE__)) |
| 22 |
) { |
| 23 |
status_header(404); |
| 24 |
exit; // phpcs:ignore |
| 25 |
} |
| 26 |
|
| 27 |
if (! defined('BEYONDWORDS__PLUGIN_DIR')) { |
| 28 |
define('BEYONDWORDS__PLUGIN_DIR', plugin_dir_path(__FILE__)); |
| 29 |
} |
| 30 |
|
| 31 |
require BEYONDWORDS__PLUGIN_DIR . 'vendor/autoload.php'; |
| 32 |
|
| 33 |
Uninstaller::cleanupPluginTransients(); |
| 34 |
Uninstaller::cleanupPluginOptions(); |
| 35 |
Uninstaller::cleanupCustomFields(); |
| 36 |
} |
| 37 |
|
| 38 |
// phpcs:disable |
| 39 |
beyondwords_uninstall(); |
| 40 |
// phpcs:enable |
| 41 |
|