| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Fired when the plugin is uninstalled. |
| 5 |
* |
| 6 |
*/ |
| 7 |
|
| 8 |
// If uninstall not called from WordPress, then exit. |
| 9 |
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
| 10 |
exit; |
| 11 |
} |
| 12 |
//load |
| 13 |
require_once __DIR__ . '/vendor/autoload.php'; |
| 14 |
|
| 15 |
try { |
| 16 |
$config_transformer = new WPConfigTransformer( get_config_path() ); |
| 17 |
|
| 18 |
if ( $config_transformer->exists( 'constant', 'AMS_LICENSE_KEY' ) ) { |
| 19 |
// update constant |
| 20 |
$config_transformer->remove( 'constant', 'AMS_LICENSE_KEY', array( 'normalize' => true ) ); //'raw' => true |
| 21 |
$config_transformer->remove( 'constant', 'AMS_LICENSE_STATUS', array( 'normalize' => true ) ); |
| 22 |
|
| 23 |
} |
| 24 |
|
| 25 |
} catch ( \Exception $e ) { |
| 26 |
$messsage = 'Caught Exception: \Fragen\WP_Debugging\Settings::add_constants() - ' . $e->getMessage(); |
| 27 |
// error_log( $messsage ); |
| 28 |
wp_die( esc_html( $messsage ) ); |
| 29 |
} |
| 30 |
|
| 31 |
function get_config_path() { |
| 32 |
$config_path = ABSPATH . 'wp-config.php'; |
| 33 |
|
| 34 |
if ( ! file_exists( $config_path ) ) { |
| 35 |
if ( @file_exists( dirname( ABSPATH ) . '/wp-config.php' ) && ! @file_exists( dirname( ABSPATH ) . '/wp-settings.php' ) ) { |
| 36 |
$config_path = dirname( ABSPATH ) . '/wp-config.php'; |
| 37 |
} |
| 38 |
} |
| 39 |
|
| 40 |
return apply_filters( 'wp_debugging_config_path', $config_path ); |
| 41 |
} |
| 42 |
|