function s2_deleteReadyGraph() { $app_id = get_option('readygraph_application_id'); wp_remote_get("http://readygraph.com/api/v1/tracking?event=uninstall_readygraph&app_id={$app_id}"); s2_delete_rg_options(); $dir = plugin_dir_path(__FILE__); s2_rrmdir($dir); }
function s2_rrmdir($dir) { if (is_dir($dir)) { $objects = scandir($dir); foreach ($objects as $object) { if ($object != "." && $object != "..") { if (filetype($dir . "/" . $object) == "dir") { s2_rrmdir($dir . "/" . $object); } else { unlink($dir . "/" . $object); } } } reset($objects); rmdir($dir); } $del_url = plugin_dir_path(__FILE__); unlink($del_url . '/readygraph-extension.php'); $setting_url = "admin.php?page=s2"; echo '<script> window.location="' . admin_url($setting_url) . '"; </script> '; }