<?php

if ( !class_exists( 'googlyzer_uninstall' ) ) {

	// googlyzer class
	class googlyzer_uninstall {
		
		// public constructor method
		function googlyzer_uninstall() { 
			$this->__construct();
		}
		
		// hidden constructor method
		function __construct() {
			// verify administrative rights
			if ( is_admin() ) {
				
				if ( !defined( 'ABSPATH' ) && !defined( 'WP_UNINSTALL_PLUGIN' ) ) {
					exit();
				}
				// remove googlyzer settings from wordpress database
				$settings = array( 'googlyzer-composites', 'googlyzer-ga_tracking', 'googlyzer-linecharts', 'googlyzer-options', 'googlyzer-piecharts', 'googlyzer-tables' );
				foreach ( $settings as $key => $value ) {
					// remove options from WordPress database
					delete_option( $value );
				}
			}
		} // end method __construct()
		
	} // end class googlyzer_uninstall
	
} // end if class exists

// instantiate new googlyzer_uninstall object
if ( class_exists( 'googlyzer_uninstall' ) ) {
	new googlyzer_uninstall();
}

?>