Function Reference: geodir_claim_listing_uninstall

Summary

This function has not been documented yet.

Source Code

function geodir_claim_listing_uninstall(){
	
	if ( ! isset($_REQUEST['verify-delete-adon']) ) 
	{
		$plugins = isset( $_REQUEST['checked'] ) ? (array) $_REQUEST['checked'] : array();
			//$_POST = from the plugin form; $_GET = from the FTP details screen.
			
			wp_enqueue_script('jquery');
					if (!defined('GD_TESTING_MODE')) {
						require_once(ABSPATH . 'wp-admin/admin-header.php');
					}
					printf( '<h2>%s</h2>' ,__( 'Warning!!' , 'geodirclaim') );
					printf( '%s<br/><strong>%s</strong><br /><br />%s <a href="http://wpgeodirectory.com">%s</a>.' , __('You are about to delete a Geodirectory Addon which has important option and custom data associated to it.' ,'geodirclaim') ,__('Deleting this and activating another version, will be treated as a new installation of plugin, so all the data will be lost.', 'geodirclaim'), __('If you have any problem in upgrading the plugin please contact Geodirectory', 'geodirclaim') , __('support' ,'geodirclaim') ) ;
					
	?><br /><br />
		<form method="post" action="<?php echo esc_url($_SERVER&#91;'REQUEST_URI'&#93;); ?>" style="display:inline;">
						<input type="hidden" name="verify-delete" value="1" />
						<input type="hidden" name="action" value="delete-selected" />
						<input type="hidden" name="verify-delete-adon" value="1" />
						<?php
							foreach ( (array) $plugins as $plugin )
								echo '<input type="hidden" name="checked&#91;&#93;" value="' . esc_attr($plugin) . '" />';
						?>
						<?php wp_nonce_field('bulk-plugins') ?>
						<?php submit_button(  __( 'Delete plugin files only' , 'geodirclaim' ), 'button', 'submit', false ); ?>
					</form>
					<form method="post" action="<?php echo esc_url($_SERVER&#91;'REQUEST_URI'&#93;); ?>" style="display:inline;">
						<input type="hidden" name="verify-delete" value="1" />
						<input type="hidden" name="action" value="delete-selected" />
                        <input type="hidden" name="verify-delete-adon" value="1" />
						<input type="hidden" name="verify-delete-adon-data" value="1" />
						<?php
							foreach ( (array) $plugins as $plugin )
								echo '<input type="hidden" name="checked&#91;&#93;" value="' . esc_attr($plugin) . '" />';
						?>
						<?php wp_nonce_field('bulk-plugins') ?>
						<?php submit_button(  __( 'Delete both plugin files and data' , 'geodirclaim') , 'button', 'submit', false ); ?>
					</form>
					
	<?php
		if (!defined('GD_TESTING_MODE')) {
			require_once(ABSPATH . 'wp-admin/admin-footer.php');
		}
		gd_die();
	}
	
	
	if ( isset($_REQUEST&#91;'verify-delete-adon-data'&#93;) ) 
	{
	
		global $wpdb,$plugin_prefix;
		
		$post_types = geodir_get_posttypes();
		
		if(!empty($post_types)){
		
			foreach($post_types as $post_type){
				
				$table = $plugin_prefix.$post_type.'_detail';
				
				$wpdb->query("UPDATE ".$table." SET claimed=''");
				
			}	
			
		}
		
		$wpdb->query("DROP TABLE ".$plugin_prefix.'claim');
		
		
		/* --- delete notification options --- */
		
		$notifications = geodir_claim_notifications();
		
		if(!empty($notifications)){
			foreach($notifications as $value){
				if(isset($value['id']) && $value['id'] != '')
					delete_option($value['id'], '');
			}
		}
		
		/* --- delete default options --- */
		
		$default_options = geodir_claim_default_options();
		
		if(!empty($default_options)){
			foreach($default_options as $value){
				if(isset($value['id']) && $value['id'] != '')
					delete_option($value['id'], '');
			}
		}
	}
}