PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.8.1
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.8.1
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 +7 -69 6.32 → 6.8.1 View file →
@@ -5,12 +5,8 @@
5 5
6 6 class FrmTransLiteAppController {
7 7
8 8 /**
9 - * Install or upgrade database structures.
10 - *
11 - * @param mixed $old_db_version Previous database version, or false on fresh install.
12 - *
13 9 * @return void
14 10 */
15 11 public static function install( $old_db_version = false ) {
16 12 self::maybe_schedule_cron();
@@ -58,27 +54,18 @@
58 54 *
59 55 * @return void
60 56 */
61 57 public static function run_payment_cron() {
62 - $frm_sub = new FrmTransLiteSubscription();
63 - $frm_payment = new FrmTransLitePayment();
58 + $frm_sub = new FrmTransLiteSubscription();
59 + $frm_payment = new FrmTransLitePayment();
60 +
64 61 $overdue_subscriptions = $frm_sub->get_overdue_subscriptions();
62 + FrmTransLiteLog::log_message( 'Stripe Cron Message', count( $overdue_subscriptions ) . ' subscriptions found to be processed.' );
65 63
66 - if ( ! $overdue_subscriptions && ! $frm_sub->get_active_subscriptions() ) {
67 - return;
68 - }
69 -
70 - FrmTransLiteLog::log_message( 'Overdue Subscription Cron Message', count( $overdue_subscriptions ) . ' subscriptions found to be processed.', false );
71 -
72 64 foreach ( $overdue_subscriptions as $sub ) {
73 65 $last_payment = $frm_payment->get_one_by( $sub->id, 'sub_id' );
74 66
75 - if ( ! $last_payment ) {
76 - continue;
77 - }
78 -
79 67 $log_message = 'Subscription #' . $sub->id . ': ';
80 -
81 68 if ( $sub->status === 'future_cancel' ) {
82 69 FrmTransLiteSubscriptionsController::change_subscription_status(
83 70 array(
84 71 'status' => 'canceled',
@@ -90,9 +77,9 @@
90 77 $log_message .= 'Failed triggers run on canceled subscription. ';
91 78 } else {
92 79 // Get the most recent payment after the gateway has a chance to create one.
93 80 $check_payment = $frm_payment->get_one_by( $sub->id, 'sub_id' );
94 - $new_payment = (int) $check_payment->id !== (int) $last_payment->id;
81 + $new_payment = $check_payment->id != $last_payment->id;
95 82 $last_payment = $check_payment;
96 83 $status = 'no';
97 84
98 85 if ( ! $last_payment ) {
@@ -110,15 +97,14 @@
110 97 $last_payment = false;
111 98 }
112 99
113 100 $log_message .= $status . ' triggers run ';
114 -
115 101 if ( $last_payment ) {
116 102 $log_message .= 'on payment #' . $last_payment->id;
117 103 }
118 104 }//end if
119 105
120 - FrmTransLiteLog::log_message( 'Overdue Subscription Cron Message', $log_message );
106 + FrmTransLiteLog::log_message( 'Stripe Cron Message', $log_message );
121 107
122 108 self::maybe_trigger_changes(
123 109 array(
124 110 'status' => $status,
@@ -137,14 +123,13 @@
137 123 * @return void
138 124 */
139 125 private static function update_sub_for_new_payment( $sub, $last_payment ) {
140 126 $frm_sub = new FrmTransLiteSubscription();
141 -
142 127 if ( $last_payment->status === 'complete' ) {
143 128 $frm_sub->update(
144 129 $sub->id,
145 130 array(
146 - 'fail_count' => 0,
131 + 'fail_count' => 0,
147 132 'next_bill_date' => $last_payment->expire_date,
148 133 )
149 134 );
150 135 } elseif ( $last_payment->status === 'failed' ) {
@@ -156,9 +141,8 @@
156 141 * Add to the fail count.
157 142 * If the subscription has failed > 3 times, set it to canceled.
158 143 *
159 144 * @param object $sub
160 - *
161 145 * @return void
162 146 */
163 147 private static function add_one_fail( $sub ) {
164 148 $frm_sub = new FrmTransLiteSubscription();
@@ -177,9 +161,8 @@
177 161 }
178 162
179 163 /**
180 164 * @param array $atts
181 - *
182 165 * @return void
183 166 */
184 167 private static function maybe_trigger_changes( $atts ) {
185 168 if ( $atts['payment'] ) {
@@ -184,51 +167,6 @@
184 167 private static function maybe_trigger_changes( $atts ) {
185 168 if ( $atts['payment'] ) {
186 169 FrmTransLiteActionsController::trigger_payment_status_change( $atts );
187 170 }
188 - }
189 -
190 - /**
191 - * This is called when the Payments submodule is active.
192 - * It ensures that the hidden repeater cadence input exists even when another add-on is handling the settings.
193 - *
194 - * @since 6.22
195 - *
196 - * @param array $args
197 - *
198 - * @return void
199 - */
200 - public static function add_repeat_cadence_value( $args ) {
201 - $action = $args['form_action'];
202 -
203 - if ( empty( $action->post_content['repeat_cadence'] ) ) {
204 - return;
205 - }
206 -
207 - $params = array(
208 - 'type' => 'hidden',
209 - 'class' => 'frm-repeat-cadence-value',
210 - 'value' => $action->post_content['repeat_cadence'],
211 - );
212 - echo '<input ';
213 - FrmAppHelper::array_to_html_params( $params, true );
214 - echo ' />';
215 - }
216 -
217 - /**
218 - * Gateway fields are included for add-on compatibility but we do not want it to be visible.
219 - * They do however need to be visible when the payments submodule is active.
220 - *
221 - * @since 6.30
222 - *
223 - * @return void
224 - */
225 - public static function hide_gateway_fields_in_builder() {
226 - wp_add_inline_style(
227 - 'formidable-admin',
228 - '
229 - #frm_builder_page li[data-ftype="gateway"] { display: none; }
230 - .frm_field_box:has(li[data-ftype="gateway"]:only-child) { display: none; }
231 - '
232 - );
233 171 }
234 172 }