check() === true) { add_action('init', array($b2sLoad, 'load')); } else { require_once(B2S_PLUGIN_DIR . 'includes/Notice.php'); add_action('admin_notices', array('B2S_Notice', 'sytemNotice')); } function uninstallPlugin() { require_once(plugin_dir_path(__FILE__) . 'includes/Tools.php'); require_once(plugin_dir_path(__FILE__) . 'includes/System.php'); $b2sCheck = new B2S_System(); if ($b2sCheck->check() === true) { global $wpdb; if (is_multisite()) { $sql = "SELECT blog_id FROM {$wpdb->base_prefix}blogs"; $blog_ids = $wpdb->get_results($sql, ARRAY_A); if (is_array($blog_ids) && !empty($blog_ids)) { $union = ""; foreach ($blog_ids as $key => $blog_data) { $blog_prefix = $wpdb->get_blog_prefix($blog_data['blog_id']); if (!empty($blog_prefix)) { $existsTable = $wpdb->get_results('SHOW TABLES LIKE "' . $blog_prefix . 'b2s_user"'); if (is_array($existsTable) && !empty($existsTable)) { if (!empty($union)) { $union .= " UNION ALL "; } $union .= " SELECT token,blog_user_id FROM {$blog_prefix}b2s_user "; } } } if (!empty($union)) { $sql = "SELECT * FROM ( " . $union . " ) as all_tokens"; $data = $wpdb->get_results($sql, ARRAY_A); if (!empty($data) && is_array($data)) { require_once (plugin_dir_path(__FILE__) . 'includes/B2S/Api/Post.php'); B2S_Api_Post::post('https://developer.blog2social.com/wp/v3/', array('action' => 'uninstallPlugin', 'blog_url' => get_option('home'), 'data' => serialize($data), 'is_multisite' => true)); } } } } else { $sql = "SELECT token,blog_user_id FROM `{$wpdb->prefix}b2s_user`"; $data = $wpdb->get_results($sql, ARRAY_A); if (!empty($data) && is_array($data)) { require_once (plugin_dir_path(__FILE__) . 'includes/B2S/Api/Post.php'); B2S_Api_Post::post('https://developer.blog2social.com/wp/v3/', array('action' => 'uninstallPlugin', 'blog_url' => get_option('home'), 'data' => serialize($data), 'is_multisite' => false)); } } } //global $wpdb; //update_option('b2s_plugin_version', '0'); //$wpdb->query('DROP TABLE IF EXISTS `b2s_posts`'); //$wpdb->query('DROP TABLE IF EXISTS `b2s_user`'); //$wpdb->query('DROP TABLE IF EXISTS `b2s_filter`'); //$wpdb->query('DROP TABLE IF EXISTS `b2s_posts_network_details`'); //$wpdb->query('DROP TABLE IF EXISTS `b2s_posts_sched_details`'); //$wpdb->query('DROP TABLE IF EXISTS `b2s_user_network_settings`'); //$wpdb->query('DROP TABLE IF EXISTS `b2s_user_contact`'); }