PluginProbe
Stripe Payment Forms by WP Simple Pay – Accept Credit Card Payments + Subscriptions with Stripe / 4.7.8
Stripe Payment Forms by WP Simple Pay – Accept Credit Card Payments + Subscriptions with Stripe v4.7.8
4.17.3 trunk 2.2.0 2.3.0 2.3.1 2.3.2 2.3.3 2.4.0 2.4.1 2.5.0 2.5.1 2.5.2 2.5.3 2.6.0 2.6.1 2.6.2 2.6.3 4.10.0 4.11.1 4.12.2 4.14.1 4.14.2 4.14.3 4.15.0 4.16.0 All 59 releases
stripe / uninstall.php

uninstall.php in Stripe Payment Forms by WP Simple Pay – Accept Credit Card Payments + Subscriptions with Stripe 4.7.8, at uninstall.php

54 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Uninstall
4 *
5 * Runs when WP Simple Pay is deleted if "Save Settings" is unchecked in
6 * "Settings > General > Advanced"
7 *
8 * @package SimplePay
9 * @copyright Copyright (c) 2021, Sandhills Development, LLC
10 * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
11 * @since unknown
12 */
13
14 // Exit if not uninstalling from WordPress.
15 if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
16 exit;
17 }
18
19 // Do nothing if settings should be saved.
20 $settings = get_option( 'simpay_settings' );
21 $save_settings = isset( $settings[ 'save_settings' ] )
22 ? $settings['save_settings']
23 : 'yes';
24
25 if ( 'yes' === $save_settings ) {
26 return;
27 }
28
29 global $wpdb;
30
31 // Delete pages.
32 $success_page = isset( $settings['success_page'] )
33 ? $settings['success_page']
34 : '';
35
36 $failure_page = isset( $settings['failure_page'] )
37 ? $settings['failure_page']
38 : '';
39
40 $cancelled_page = isset( $settings['cancelled_page'] )
41 ? $settings['cancelled_page']
42 : '';
43
44 wp_delete_post( $success_page, true );
45 wp_delete_post( $failure_page, true );
46 wp_delete_post( $cancelled_page, true );
47
48 // Delete options.
49 $wpdb->query( "DELETE FROM {$wpdb->options} WHERE option_name LIKE 'simpay\_%'" );
50
51 // Delete Payment Forms.
52 $wpdb->query( "DELETE FROM {$wpdb->posts} WHERE post_type = 'simple-pay'" );
53 $wpdb->query( "DELETE meta FROM {$wpdb->postmeta} meta LEFT JOIN {$wpdb->posts} posts ON posts.ID = meta.post_id WHERE posts.ID IS NULL;" );
54