Inventory_Presser_Uninstaller::detect_query_vars()


Source Source

File: includes/class-uninstaller.php

	public function detect_query_vars() {
		// Is this a GET request?
		if ( 'GET' != $_SERVER['REQUEST_METHOD'] ) {
			return;
		}

		if ( empty( $_GET['_wpnonce'] ) || empty( $_GET[ self::QUERY_VAR_DELETE_VEHICLES ] ) ) {
			return;
		}

		if ( ! wp_verify_nonce( $_GET['_wpnonce'], self::QUERY_VAR_DELETE_VEHICLES ) ) {
			return;

		}

		// dispatch the delete all vehicles call
		INVP::delete_all_inventory();

		// redirect to a URL that won't cause more deletes on page reloads
		wp_redirect( admin_url( 'plugins.php' ) );
		exit;
	}