# firebox/1.0.7/Inc/Core/Admin/PluginUninstall.php

FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin &amp; Cart Abandonment, version 1.0.7. 61 lines.

- Page: https://pluginprobe.com/plugins/firebox/1.0.7/code/Inc/Core/Admin/PluginUninstall.php
- Raw: https://pluginprobe.com/plugins/firebox/1.0.7/raw/Inc/Core/Admin/PluginUninstall.php
- Modified: 2021-11-25T12:05:14+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/firebox/1.0.7/code/Inc/Core/Admin/PluginUninstall.php#L10-L20`.

```php
<?php
/**
 * @package         FireBox
 * @version         1.0.7 Free
 * 
 * @author          FirePlugins <info@fireplugins.com>
 * @link            https://www.fireplugins.com
 * @copyright       Copyright © 2021 FirePlugins All Rights Reserved
 * @license         GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/

namespace FireBox\Core\Admin;

if (!defined('ABSPATH'))
{
	exit; // Exit if accessed directly.
}

require_once FBOX_PLUGIN_DIR . '/Inc/Framework/Inc/Admin/Includes/Uninstall.php';

class PluginUninstall extends \Uninstall
{
	/**
	 * Runs once we uninstall the plugin.
	 * 
	 * @return  void
	 */
	public function start()
	{
		if (!$settings = get_option('firebox_settings'))
		{
			return;
		}

		if (isset($settings['keep_data_on_uninstall']) && $settings['keep_data_on_uninstall'] == '1')
		{
			return;
		}

		// remove all db tables
		$this->pluginUninstall();

		// de-register post type
		unregister_post_type('firebox');

		// remove all custom post types data
		$items = get_posts(['post_type' => 'firebox', 'post_status' => 'any', 'numberposts' => -1, 'fields' => 'ids']);

		if ($items)
		{
			foreach ($items as $item)
			{
				wp_delete_post($item, true);
			}
		}

		// remove all options
		delete_option('firebox_version');
		delete_option('firebox_settings');
	}
}
```
