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 | classes/models/FrmEntryValidate.php +12 -11 6.28 → trunk View file →
@@ -90,13 +90,15 @@
90 90 * @return void
91 91 */
92 92 private static function set_item_key( &$values ) {
93 93 // phpcs:ignore Universal.Operators.StrictComparisons
94 - if ( ! isset( $values['item_key'] ) || $values['item_key'] == '' ) {
95 - global $wpdb;
96 - $values['item_key'] = FrmAppHelper::get_unique_key( '', $wpdb->prefix . 'frm_items', 'item_key' );
97 - $_POST['item_key'] = $values['item_key'];
94 + if ( isset( $values['item_key'] ) && $values['item_key'] != '' ) {
95 + return;
98 96 }
97 +
98 + global $wpdb;
99 + $values['item_key'] = FrmAppHelper::get_unique_key( '', $wpdb->prefix . 'frm_items', 'item_key' );
100 + $_POST['item_key'] = $values['item_key'];
99 101 }
100 102
101 103 /**
102 104 * @param array $values
@@ -147,9 +149,9 @@
147 149 'exclude' => array(),
148 150
149 151 );
150 152 $args = wp_parse_args( $args, $defaults );
151 - $value = empty( $args['parent_field_id'] ) ? ( $values['item_meta'][ $args['id'] ] ?? '' ) : $values;
153 + $value = ! empty( $args['parent_field_id'] ) ? $values : ( $values['item_meta'][ $args['id'] ] ?? '' );
152 154
153 155 // Check for values in "Other" fields
154 156 FrmEntriesHelper::maybe_set_other_validation( $posted_field, $value, $args );
155 157
@@ -400,9 +402,9 @@
400 402 }
401 403
402 404 if ( false !== $item_name ) {
403 405 // Item name has a max length of 255 characters so truncate it so it doesn't fail to save in the database.
404 - $_POST['item_name'] = substr( $item_name, 0, 255 );
406 + $_POST['item_name'] = FrmAppHelper::truncate( $item_name, 255, 1, '', true );
405 407 }
406 408 }
407 409
408 410 /**
@@ -527,12 +529,12 @@
527 529 $parts = explode( '\?', $pattern );
528 530 $pattern = '';
529 531
530 532 foreach ( $parts as $part ) {
531 - if ( ! $pattern ) {
533 + if ( $pattern ) {
534 + $pattern .= '(' . $part . ')?';
535 + } else {
532 536 $pattern .= $part;
533 - } else {
534 - $pattern .= '(' . $part . ')?';
535 537 }
536 538 }
537 539 }
538 540
@@ -623,10 +625,9 @@
623 625 /**
624 626 * @return bool
625 627 */
626 628 private static function is_spam_bot() {
627 - $ip = FrmAppHelper::get_ip_address();
628 - return empty( $ip );
629 + return ! FrmAppHelper::get_ip_address();
629 630 }
630 631
631 632 /**
632 633 * @param array $values