PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 5.2.02
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v5.2.02
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 | classes/models/FrmAntiSpam.php +20 -27 6.25.15.2.02 View file →
@@ -20,10 +20,8 @@
20 20 }
21 21
22 22 /**
23 23 * @param int $form_id
24 - *
25 - * @return void
26 24 */
27 25 public static function maybe_init( $form_id ) {
28 26 $antispam = new self( $form_id );
29 27 if ( $antispam->run_antispam() ) {
@@ -34,10 +32,8 @@
34 32 /**
35 33 * Initialise the actions for the Anti-spam.
36 34 *
37 35 * @since 4.11
38 - *
39 - * @return void
40 36 */
41 37 public function init() {
42 38 add_filter( 'frm_form_attributes', array( $this, 'add_token_to_form' ), 10, 1 );
43 39 add_filter( 'frm_form_div_attributes', array( $this, 'add_token_to_form' ), 10, 1 );
@@ -106,12 +102,10 @@
106 102 // cache time can extend this. A user with a shorter cache time can remove times.
107 103 $valid_token_times_before = apply_filters(
108 104 'frm_form_token_check_before_today',
109 105 array(
110 - // Two days ago.
111 - 2 * DAY_IN_SECONDS,
112 - // One day ago.
113 - 1 * DAY_IN_SECONDS,
106 + ( 2 * DAY_IN_SECONDS ), // Two days ago.
107 + ( 1 * DAY_IN_SECONDS ), // One day ago.
114 108 )
115 109 );
116 110
117 111 // Mostly to catch edge cases like the form page loading and submitting on two different days.
@@ -118,10 +112,9 @@
118 112 // This probably won't be filtered by users too much, but they could extend it.
119 113 $valid_token_times_after = apply_filters(
120 114 'frm_form_token_check_after_today',
121 115 array(
122 - // Add in 45 minutes past today to catch some midnight edge cases.
123 - 45 * MINUTE_IN_SECONDS,
116 + ( 45 * MINUTE_IN_SECONDS ), // Add in 45 minutes past today to catch some midnight edge cases.
124 117 )
125 118 );
126 119
127 120 // Built up our valid tokens.
@@ -176,10 +169,8 @@
176 169 }
177 170
178 171 /**
179 172 * @param int $form_id
180 - *
181 - * @return void
182 173 */
183 174 public static function maybe_echo_token( $form_id ) {
184 175 $antispam = new self( $form_id );
185 176 if ( $antispam->run_antispam() ) {
@@ -225,8 +216,24 @@
225 216 return $this->process_antispam_filter( true );
226 217 }
227 218
228 219 /**
220 + * @return bool True if saving a draft.
221 + */
222 + private function is_saving_a_draft() {
223 + global $frm_vars;
224 + if ( empty( $frm_vars['form_params'] ) ) {
225 + return false;
226 + }
227 + $form_params = $frm_vars['form_params'];
228 + if ( ! isset( $form_params[ $this->form_id ] ) ) {
229 + return false;
230 + }
231 + $this_form_params = $form_params[ $this->form_id ];
232 + return ! empty( $this_form_params['action'] ) && 'update' === $this_form_params['action'];
233 + }
234 +
235 + /**
229 236 * Helper to run our filter on all the responses for the antispam checks.
230 237 *
231 238 * @since 4.11
232 239 *
@@ -273,9 +280,9 @@
273 280 return '';
274 281 }
275 282
276 283 // If the user is an admin, return text with a link to support.
277 - // We add a space here to separate the sentences, but outside of the localized
284 + // We add a space here to seperate the sentences, but outside of the localized
278 285 // text to avoid it being removed.
279 286 return ' ' . sprintf(
280 287 // translators: %1$s start link, %2$s end link.
281 288 esc_html__( 'Please check out our %1$stroubleshooting guide%2$s for details on resolving this issue.', 'formidable' ),
@@ -285,10 +292,8 @@
285 292 }
286 293
287 294 /**
288 295 * Clear third party cache plugins to avoid data-tokens missing or appearing when the antispam setting is changed.
289 - *
290 - * @return void
291 296 */
292 297 public static function clear_caches() {
293 298 self::clear_w3_total_cache();
294 299 self::clear_wp_fastest_cache();
@@ -295,11 +300,8 @@
295 300 self::clear_wp_super_cache();
296 301 self::clear_wp_optimize();
297 302 }
298 303
299 - /**
300 - * @return void
301 - */
302 304 private static function clear_w3_total_cache() {
303 305 if ( is_callable( 'w3tc_flush_all' ) ) {
304 306 w3tc_flush_all();
305 307 }
@@ -304,18 +306,12 @@
304 306 w3tc_flush_all();
305 307 }
306 308 }
307 309
308 - /**
309 - * @return void
310 - */
311 310 private static function clear_wp_fastest_cache() {
312 311 do_action( 'wpfc_clear_all_cache' );
313 312 }
314 313
315 - /**
316 - * @return void
317 - */
318 314 private static function clear_wp_super_cache() {
319 315 if ( function_exists( 'wp_cache_clean_cache' ) ) {
320 316 global $file_prefix;
321 317 wp_cache_clean_cache( $file_prefix, true );
@@ -321,11 +317,8 @@
321 317 wp_cache_clean_cache( $file_prefix, true );
322 318 }
323 319 }
324 320
325 - /**
326 - * @return void
327 - */
328 321 private static function clear_wp_optimize() {
329 322 if ( class_exists( 'WP_Optimize' ) ) {
330 323 WP_Optimize()->get_page_cache()->purge();
331 324 }