$data ) { if ( 'maple-parcel' === ( $data['TextDomain'] ?? '' ) && dirname( $file ) !== $self_dir ) { return true; } } return false; } } if ( ! function_exists( 'bbmmp_uninstall_cleanup' ) ) { /** * Deletes the options and transients Maple Parcel created, including the * stored Canada Post keys and the cached OAuth token. */ function bbmmp_uninstall_cleanup(): void { global $wpdb; // The folder this file sits in (includes/) belongs to the copy being uninstalled. if ( bbmmp_other_edition_installed( basename( dirname( __DIR__ ) ) ) ) { return; } // Our own options (bbmmp_health and any added later). // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- one-off cleanup on uninstall. $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->options} WHERE option_name LIKE %s", $wpdb->esc_like( 'bbmmp_' ) . '%' ) ); // The store-wide settings and per-zone instance settings belong to the shipping method ID. // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- one-off cleanup on uninstall. $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->options} WHERE option_name LIKE %s", $wpdb->esc_like( 'woocommerce_bbmmp_canada_post_' ) . '%' ) ); // The free build's Pro notice, dismissed per user. delete_metadata( 'user', 0, 'bbmmp_pro_notice_dismissed', '', true ); // Tokens and rate quotes are transients with variable names. // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- one-off cleanup on uninstall. $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->options} WHERE option_name LIKE %s OR option_name LIKE %s", $wpdb->esc_like( '_transient_bbmmp_' ) . '%', $wpdb->esc_like( '_transient_timeout_bbmmp_' ) . '%' ) ); } }