PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.22.3
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.22.3
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
← All changes | stripe/controllers/FrmTransLiteAppController.php +46 -6 6.5.1 → 6.22.3 View file →
@@ -15,8 +15,22 @@
15 15 $db->upgrade( $old_db_version );
16 16 }
17 17
18 18 /**
19 + * This is called on the frm_after_install hook that is called when Lite migrations have run.
20 + *
21 + * @return void
22 + */
23 + public static function on_after_install() {
24 + if ( ! FrmTransLiteAppHelper::payments_table_exists() ) {
25 + return;
26 + }
27 +
28 + $db = new FrmTransLiteDb();
29 + $db->upgrade();
30 + }
31 +
32 + /**
19 33 * Schedule the payment cron if it is not already scheduled.
20 34 *
21 35 * @return void
22 36 */
@@ -44,12 +58,15 @@
44 58 $frm_sub = new FrmTransLiteSubscription();
45 59 $frm_payment = new FrmTransLitePayment();
46 60
47 61 $overdue_subscriptions = $frm_sub->get_overdue_subscriptions();
48 - FrmTransLiteLog::log_message( 'Stripe Cron Message', count( $overdue_subscriptions ) . ' subscriptions found to be processed.' );
62 + FrmTransLiteLog::log_message( 'Stripe Cron Message', count( $overdue_subscriptions ) . ' subscriptions found to be processed.', false );
49 63
50 64 foreach ( $overdue_subscriptions as $sub ) {
51 65 $last_payment = $frm_payment->get_one_by( $sub->id, 'sub_id' );
66 + if ( ! $last_payment ) {
67 + continue;
68 + }
52 69
53 70 $log_message = 'Subscription #' . $sub->id . ': ';
54 71 if ( $sub->status === 'future_cancel' ) {
55 72 FrmTransLiteSubscriptionsController::change_subscription_status(
@@ -74,13 +91,13 @@
74 91 } elseif ( $new_payment ) {
75 92 $status = $last_payment->status;
76 93 self::update_sub_for_new_payment( $sub, $last_payment );
77 94 } elseif ( $last_payment->expire_date < gmdate( 'Y-m-d' ) ) {
78 - // the payment has expired, and no new payment was made
95 + // The payment has expired, and no new payment was made.
79 96 $status = 'failed';
80 97 self::add_one_fail( $sub );
81 98 } else {
82 - // don't run any triggers
99 + // Don't run any triggers.
83 100 $last_payment = false;
84 101 }
85 102
86 103 $log_message .= $status . ' triggers run ';
@@ -86,9 +103,9 @@
86 103 $log_message .= $status . ' triggers run ';
87 104 if ( $last_payment ) {
88 105 $log_message .= 'on payment #' . $last_payment->id;
89 106 }
90 - }
107 + }//end if
91 108
92 109 FrmTransLiteLog::log_message( 'Stripe Cron Message', $log_message );
93 110
94 111 self::maybe_trigger_changes(
@@ -98,9 +115,9 @@
98 115 )
99 116 );
100 117
101 118 unset( $sub );
102 - }
119 + }//end foreach
103 120 }
104 121
105 122 /**
106 123 * @param object $sub
@@ -113,9 +130,9 @@
113 130 if ( $last_payment->status === 'complete' ) {
114 131 $frm_sub->update(
115 132 $sub->id,
116 133 array(
117 - 'fail_count' => 0,
134 + 'fail_count' => 0,
118 135 'next_bill_date' => $last_payment->expire_date,
119 136 )
120 137 );
121 138 } elseif ( $last_payment->status === 'failed' ) {
@@ -152,7 +169,30 @@
152 169 */
153 170 private static function maybe_trigger_changes( $atts ) {
154 171 if ( $atts['payment'] ) {
155 172 FrmTransLiteActionsController::trigger_payment_status_change( $atts );
173 + }
174 + }
175 +
176 + /**
177 + * This is called when the Payments submodule is active.
178 + * It ensures that the hidden repeater cadence input exists even when another add-on is handling the settings.
179 + *
180 + * @since 6.22
181 + *
182 + * @param array $args
183 + * @return void
184 + */
185 + public static function add_repeat_cadence_value( $args ) {
186 + $action = $args['form_action'];
187 + if ( ! empty( $action->post_content['repeat_cadence'] ) ) {
188 + $params = array(
189 + 'type' => 'hidden',
190 + 'class' => 'frm-repeat-cadence-value',
191 + 'value' => $action->post_content['repeat_cadence'],
192 + );
193 + echo '<input ';
194 + FrmAppHelper::array_to_html_params( $params, true );
195 + echo ' />';
156 196 }
157 197 }
158 198 }