PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / trunk
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More vtrunk
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 +51 -5 6.29 → trunk View file →
@@ -44,14 +44,25 @@
44 44 }
45 45 }
46 46
47 47 /**
48 - * Remove the cron when the plugin is deactivated.
48 + * Remove the payment cron when all gateways are disconnected.
49 49 *
50 + * @since 6.32.1
51 + *
52 + * @param string $gateway 'stripe', 'square', or 'paypal'.
53 + * @param string $mode 'test' or 'live'.
54 + *
50 55 * @return void
51 56 */
52 - public static function remove_cron() {
53 - wp_clear_scheduled_hook( 'frm_payment_cron' );
57 + public static function maybe_remove_payment_cron( $gateway, $mode ) {
58 + $stripe_connected = FrmStrpLiteConnectHelper::at_least_one_mode_is_setup();
59 + $square_connected = FrmSquareLiteConnectHelper::at_least_one_mode_is_setup();
60 + $paypal_connected = FrmPayPalLiteConnectHelper::at_least_one_mode_is_setup();
61 +
62 + if ( ! $stripe_connected && ! $square_connected && ! $paypal_connected ) {
63 + wp_clear_scheduled_hook( 'frm_payment_cron' );
64 + }
54 65 }
55 66
56 67 /**
57 68 * Process overdue subscriptions.
@@ -61,10 +72,15 @@
61 72 public static function run_payment_cron() {
62 73 $frm_sub = new FrmTransLiteSubscription();
63 74 $frm_payment = new FrmTransLitePayment();
64 75 $overdue_subscriptions = $frm_sub->get_overdue_subscriptions();
65 - FrmTransLiteLog::log_message( 'Stripe Cron Message', count( $overdue_subscriptions ) . ' subscriptions found to be processed.', false );
66 76
77 + if ( ! $overdue_subscriptions && ! $frm_sub->get_active_subscriptions() ) {
78 + return;
79 + }
80 +
81 + FrmTransLiteLog::log_message( 'Overdue Subscription Cron Message', count( $overdue_subscriptions ) . ' subscriptions found to be processed.', false );
82 +
67 83 foreach ( $overdue_subscriptions as $sub ) {
68 84 $last_payment = $frm_payment->get_one_by( $sub->id, 'sub_id' );
69 85
70 86 if ( ! $last_payment ) {
@@ -111,9 +127,9 @@
111 127 $log_message .= 'on payment #' . $last_payment->id;
112 128 }
113 129 }//end if
114 130
115 - FrmTransLiteLog::log_message( 'Stripe Cron Message', $log_message );
131 + FrmTransLiteLog::log_message( 'Overdue Subscription Cron Message', $log_message );
116 132
117 133 self::maybe_trigger_changes(
118 134 array(
119 135 'status' => $status,
@@ -206,6 +222,36 @@
206 222 );
207 223 echo '<input ';
208 224 FrmAppHelper::array_to_html_params( $params, true );
209 225 echo ' />';
226 + }
227 +
228 + /**
229 + * Gateway fields are included for add-on compatibility but we do not want it to be visible.
230 + * They do however need to be visible when the payments submodule is active.
231 + *
232 + * @since 6.30
233 + *
234 + * @return void
235 + */
236 + public static function hide_gateway_fields_in_builder() {
237 + wp_add_inline_style(
238 + 'formidable-admin',
239 + '
240 + #frm_builder_page li[data-ftype="gateway"] { display: none; }
241 + .frm_field_box:has(li[data-ftype="gateway"]:only-child) { display: none; }
242 + '
243 + );
244 + }
245 +
246 + /**
247 + * Remove the cron when the plugin is deactivated.
248 + *
249 + * @deprecated 6.32.1
250 + *
251 + * @return void
252 + */
253 + public static function remove_cron() {
254 + _deprecated_function( __METHOD__, '6.32.1' );
255 + wp_clear_scheduled_hook( 'frm_payment_cron' );
210 256 }
211 257 }