function rstw_deleteReadyGraph()
{
    $app_id = get_option('readygraph_application_id');
    wp_remote_get("http://readygraph.com/api/v1/tracking?event=uninstall_readygraph&app_id={$app_id}");
    rstw_delete_rg_options();
    $dir = plugin_dir_path(__FILE__);
    rstw_rrmdir($dir);
}
function rstw_rrmdir($dir)
{
    if (is_dir($dir)) {
        $objects = scandir($dir);
        foreach ($objects as $object) {
            if ($object != "." && $object != "..") {
                if (filetype($dir . "/" . $object) == "dir") {
                    rstw_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=";
    echo '<script> window.location="' . admin_url() . '"; </script> ';
}