Permalink
Browse files

* added proper plugin uninstall

git-svn-id: http://plugins.svn.wordpress.org/amazon-widgets-shortcodes/trunk@141928 b8457f37-d9ea-0310-8a92-e5e31aec5664
  • Loading branch information...
1 parent 5dd7b15 commit 80d8143c848d5301666cf9df9f33ba17a2216ac3 oncletom committed Aug 1, 2009
Showing with 20 additions and 25 deletions.
  1. +0 −25 lib/AmazonWidgetsShortcodePlugin.class.php
  2. +20 −0 uninstall.php
@@ -24,11 +24,6 @@ function bootstrap($plugin_home_path)
register_activation_hook($filename, array($class, 'executeActivation'));
add_filter('plugin_action_links_'.$pluginfile, array($class, 'executeFilterPluginActionLinks'));
- if (function_exists('register_uninstall_hook'))
- {
- register_uninstall_hook($filename, array($class, 'executeUninstall'));
- }
-
define('AWS_PLUGIN_BASEPATH', dirname($filename));
}
@@ -127,26 +122,6 @@ function executeFilterPluginActionLinks($action_links)
}
/**
- * Removes all data set by the plugin, including custom settings
- *
- * Note : in use if the function `register_uninstall_hook` is implemented
- * Either in a case of a plugin or Core WP files
- *
- * @static
- * @author oncletom
- * @version 2.0
- * @since 1.3
- * @return null
- */
- function executeUninstall()
- {
- foreach (array_keys(AmazonWidgetsShortcodes::getRegisteredOptions()) as $option_id)
- {
- delete_option($option_id);
- }
- }
-
- /**
* Register shortcode class & syntax
*
* @author oncletom
View
@@ -0,0 +1,20 @@
+<?php
+/*
+ * Basic security
+ * @todo check the plugin dir+filename
+ */
+if (!defined('ABSPATH') || !defined('WP_UNINSTALL_PLUGIN'))
+{
+ exit('Invalid deletion.');
+}
+
+//bootstraps the plugin ; heavy but working
+require_once dirname(__FILE__).'/amazon-widgets-shortcodes.php';
+
+/*
+ * 1) deleting known options
+ */
+foreach (array_keys(AmazonWidgetsShortcodeConfiguration::getOptions()) as $option_id)
+{
+ delete_option($option_id);
+}

0 comments on commit 80d8143

Please sign in to comment.