PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.5
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.5
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
formidable / stripe / controllers / FrmStrpLiteAppController.php

FrmStrpLiteAppController.php in Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More 6.5, at stripe/controllers/FrmStrpLiteAppController.php

96 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 die( 'You are not allowed to call this page directly.' );
4 }
5
6 class FrmStrpLiteAppController {
7
8 /**
9 * Install required tables.
10 *
11 * @param mixed $old_db_version
12 * @return void
13 */
14 public static function install( $old_db_version = false ) {
15 FrmTransLiteAppController::install( $old_db_version );
16 }
17
18 /**
19 * Remove Stripe database items after uninstall.
20 *
21 * @since 6.5, introduced in v2.07 of the Stripe add on.
22 *
23 * @return void
24 */
25 public static function uninstall() {
26 if ( ! current_user_can( 'administrator' ) ) {
27 $frm_settings = FrmAppHelper::get_settings();
28 wp_die( esc_html( $frm_settings->admin_permission ) );
29 }
30
31 $options_to_delete = array(
32 FrmStrpLiteEventsController::$events_to_skip_option_name,
33 'frm_strp_options',
34 );
35
36 $modes = array( 'test', 'live' );
37 $option_name_keys = array( 'account_id', 'client_password', 'server_password', 'details_submitted' );
38 foreach ( $modes as $mode ) {
39 foreach ( $option_name_keys as $key ) {
40 $options_to_delete[] = 'frm_strp_connect_' . $key . '_' . $mode;
41 }
42 }
43
44 foreach ( $options_to_delete as $option_name ) {
45 delete_option( $option_name );
46 }
47 }
48
49 /**
50 * Redirect to Stripe settings when payments are not yet installed
51 * and the payments page is accessed by its URL.
52 *
53 * @return void
54 */
55 public static function maybe_redirect_to_stripe_settings() {
56 if ( ! FrmAppHelper::is_admin_page( 'formidable-payments' ) || self::payments_are_installed() ) {
57 return;
58 }
59
60 wp_safe_redirect( admin_url( 'admin.php?page=formidable-settings&t=stripe_settings' ) );
61 die();
62 }
63
64 /**
65 * @return bool
66 */
67 private static function payments_are_installed() {
68 $db = new FrmTransLiteDb();
69 $option = get_option( $db->db_opt_name );
70 return false !== $option;
71 }
72
73 /**
74 * Add the gateway for compatibility with the Payments submodule.
75 * This adds the Stripe checkbox option to the list of gateways.
76 *
77 * @param array $gateways
78 * @return array
79 */
80 public static function add_gateway( $gateways ) {
81 $gateways['stripe'] = array(
82 'label' => 'Stripe',
83 'user_label' => __( 'Payment', 'formidable' ),
84 'class' => 'StrpLite',
85 'recurring' => true,
86 'include' => array(
87 'billing_first_name',
88 'billing_last_name',
89 'credit_card',
90 'billing_address',
91 ),
92 );
93 return $gateways;
94 }
95 }
96