-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php /** @noinspection PhpRedundantClosingTagInspection */ | ||
|
||
wp_tarteaucitron_uninstall(); | ||
|
||
/** | ||
* @since 1.0.0 | ||
* | ||
* @return void | ||
*/ | ||
function wp_tarteaucitron_uninstall(): void { | ||
try { | ||
wordpress_plugin_uninstall_called(); | ||
delete_options(); | ||
} catch( Exception $exception ) { | ||
exit( $exception->getMessage() ); | ||
} | ||
} | ||
|
||
/** | ||
* @since 1.0.0 | ||
* | ||
* @throws Exception | ||
* | ||
* @return bool | ||
*/ | ||
function wordpress_plugin_uninstall_called(): bool { | ||
if ( defined( 'WP_UNINSTALL_PLUGIN' ) ) { | ||
return true; | ||
} else { | ||
$exception = new Exception( 'Improper plugin uninstall call' ); | ||
error_log( $exception->getMessage() ); | ||
throw $exception; | ||
} | ||
} | ||
|
||
/** | ||
* @since 1.0.0 | ||
* | ||
* @throws Exception | ||
* | ||
* @return void | ||
*/ | ||
function delete_options(): void { | ||
delete_option( 'wp_plugintemplate_dummy' ); | ||
} | ||
|
||
?> |