| 1 |
<?php |
| 2 |
/** |
| 3 |
* Fired when the plugin is uninstalled. |
| 4 |
* |
| 5 |
* When populating this file, consider the following flow |
| 6 |
* of control: |
| 7 |
* |
| 8 |
* - This method should be static |
| 9 |
* - Check if the $_REQUEST content actually is the plugin name |
| 10 |
* - Run an Admin referrer check to make sure it goes through authentication |
| 11 |
* - Verify the output of $_GET makes sense |
| 12 |
* - Repeat with other user roles. Best directly by using the links/query string parameters. |
| 13 |
* - Repeat things for multisite. Once for a single site in the network, once sitewide. |
| 14 |
* |
| 15 |
* This file may be updated more in future version of the Boilerplate; however, this is the |
| 16 |
* general skeleton and outline for how the file should work. |
| 17 |
* |
| 18 |
* For more information, see the following discussion: |
| 19 |
* https://github.com/tommcfarlin/WordPress-Plugin-Boilerplate/pull/123#issuecomment-28541913 |
| 20 |
* |
| 21 |
* @link https://vcore.au |
| 22 |
* @since 1.0.0 |
| 23 |
* @package CF_Images |
| 24 |
*/ |
| 25 |
|
| 26 |
// If uninstall not called from WordPress, then exit. |
| 27 |
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
| 28 |
exit; |
| 29 |
} |
| 30 |
|
| 31 |
delete_site_option( 'cf-images-version' ); |
| 32 |
delete_site_option( 'cf-images-hash' ); |
| 33 |
delete_site_option( 'cf-images-hide-sidebar' ); |
| 34 |
delete_site_option( 'cf-images-hide-eluxo' ); |
| 35 |
delete_site_option( 'cf-images-account-id' ); |
| 36 |
delete_site_option( 'cf-images-api-token' ); |
| 37 |
delete_site_option( 'cf-images-network-wide' ); |
| 38 |
delete_site_option( 'cf-images-browser-ttl' ); |
| 39 |
delete_option( 'cf-images-custom-domain' ); |
| 40 |
delete_option( 'cf-images-setup-done' ); |
| 41 |
delete_option( 'cf-images-config-written' ); |
| 42 |
delete_option( 'cf-images-stats' ); |
| 43 |
delete_option( 'cf-images-auth-error' ); |
| 44 |
delete_option( 'cf-image-ai-api-key' ); |
| 45 |
delete_option( 'cf-images-settings' ); |
| 46 |
delete_option( 'cf-images-custom-path' ); |
| 47 |
delete_option( 'cf-images-cdn-enabled' ); |
| 48 |
delete_option( 'cf-images-integrations' ); |
| 49 |
|
| 50 |
|
| 51 |
/** |
| 52 |
* These have been removed since version 1.4.0. |
| 53 |
* Keep this just in case we need to clean an old installation. |
| 54 |
*/ |
| 55 |
delete_option( 'cf-images-auto-offload' ); |
| 56 |
delete_option( 'cf-images-auto-resize' ); |
| 57 |
delete_option( 'cf-images-custom-id' ); |
| 58 |
delete_option( 'cf-images-disable-async' ); |
| 59 |
delete_option( 'cf-images-disable-generation' ); |
| 60 |
delete_option( 'cf-images-full-offload' ); |
| 61 |
delete_option( 'cf-images-image-ai' ); |
| 62 |
delete_option( 'cf-images-page-parser' ); |
| 63 |
delete_option( 'cf-images-image-compress' ); |
| 64 |
|
| 65 |
// Remove defines from wp-config.php file. |
| 66 |
require_once __DIR__ . '/app/traits/trait-ajax.php'; |
| 67 |
require_once __DIR__ . '/app/traits/trait-helpers.php'; |
| 68 |
require_once __DIR__ . '/app/traits/trait-stats.php'; |
| 69 |
require_once __DIR__ . '/app/class-settings.php'; |
| 70 |
$settings = new CF_Images\App\Settings(); |
| 71 |
$settings->write_config( 'CF_IMAGES_ACCOUNT_ID' ); |
| 72 |
$settings->write_config( 'CF_IMAGES_KEY_TOKEN' ); |
| 73 |
|
| 74 |
require_once __DIR__ . '/app/modules/class-module.php'; |
| 75 |
require_once __DIR__ . '/app/modules/class-cdn.php'; |
| 76 |
CF_Images\App\Modules\CDN::remove_cron(); |
| 77 |
|