3.3) { require_once ABSPATH.'/wp-admin/includes/plugin.php'; deactivate_plugins(__file__); wp_die("Sorry, this Wordpress module will only run on PHP versions 5.3 and above and on Wordpress version 3.3 and higher. If you are unsure please ask your hosting company. The addon has been deactivated. You are free to navigate back to the main admin area."); } include_once ("config.php"); //Loop through all files in folders and include them in main file foreach (\Config\Configuration::total_files() as $file) { if (is_admin()) { // require only in admin require_once ($file); } } // delete database tables when addon is deleted register_uninstall_hook(__FILE__, 'ah_unistall'); // recursively delete all directory contents and then the directory function ah_deleteDir($path) { return is_file($path) ? @unlink($path) : array_map(__FUNCTION__, glob($path.'/*')) == @rmdir($path); } function ah_unistall() { $sql1 = "DROP table if exists ".AH_FEED_DETAILS_TABLE; $sql2 = "DROP table if exists ".AH_TOTAL_FEEDS_TABLES; global $wpdb; $wpdb->query($sql1); $wpdb->query($sql2); delete_option('affiliate_hoover_plugin_options'); $ah_uploads = wp_upload_dir(); ah_deleteDir($ah_uploads['basedir'].DIRECTORY_SEPARATOR.'affiliate-hoover'); }