| @@ -1,15 +1,43 @@ | ||
| 1 | 1 | <?php |
| 2 | + if ( ! defined( 'ABSPATH' ) ) | |
| 3 | + exit; | |
| 4 | + | |
| 5 | +function xyz_ihs_network_uninstall($networkwide) { | |
| 6 | + global $wpdb; | |
| 2 | 7 | |
| 8 | + if (function_exists('is_multisite') && is_multisite()) { | |
| 9 | + // check if it is a network activation - if so, run the activation function for each blog id | |
| 10 | + if ($networkwide) { | |
| 11 | + $old_blog = $wpdb->blogid; | |
| 12 | + // Get all blog ids | |
| 13 | + $blogids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs"); | |
| 14 | + foreach ($blogids as $blog_id) { | |
| 15 | + switch_to_blog($blog_id); | |
| 16 | + xyz_ihs_uninstall(); | |
| 17 | + } | |
| 18 | + switch_to_blog($old_blog); | |
| 19 | + return; | |
| 20 | + } | |
| 21 | + } | |
| 22 | + xyz_ihs_uninstall(); | |
| 23 | +} | |
| 24 | + | |
| 3 | 25 | function xyz_ihs_uninstall(){ |
| 4 | 26 | |
| 5 | 27 | global $wpdb; |
| 6 | - | |
| 28 | +delete_option("xyz_ihs_sort_order"); | |
| 29 | +delete_option("xyz_ihs_sort_field_name"); | |
| 7 | 30 | delete_option("xyz_ihs_limit"); |
| 8 | - | |
| 31 | +delete_option("xyz_ihs_installed_date"); | |
| 32 | +delete_option('xyz_ihs_credit_dismiss'); | |
| 33 | +delete_option('xyz_ihs_premium_version_ads'); | |
| 34 | +delete_option('xyz_ihs_exec_in_editor'); | |
| 35 | +delete_option('xyz_ihs_free_version'); | |
| 36 | +delete_option('xyz_ihs_sync_needed'); | |
| 37 | +delete_option('xyz_ihs_show_snippet_usage'); | |
| 9 | 38 | /* table delete*/ |
| 10 | 39 | $wpdb->query("DROP TABLE ".$wpdb->prefix."xyz_ihs_short_code"); |
| 11 | - | |
| 12 | - | |
| 40 | +$wpdb->query("DROP TABLE ".$wpdb->prefix."xyz_ihs_usage"); | |
| 13 | 41 | } |
| 14 | -register_uninstall_hook(XYZ_INSERT_HTML_PLUGIN_FILE,'xyz_ihs_uninstall'); | |
| 15 | -?> | |
| 42 | +register_uninstall_hook( XYZ_INSERT_HTML_PLUGIN_FILE, 'xyz_ihs_network_uninstall' ); | |
| 43 | +?> | |