Completed
Pull Request — master (#2337)
by
unknown
46s
created
stripe/helpers/FrmStrpLiteUrlParamHelper.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,10 +23,10 @@  discard block
 block discarded – undo
23 23
 	 * @return array|false
24 24
 	 */
25 25
 	public static function get_details_for_form( $form_id ) {
26
-		if ( ! isset( self::$details_by_form_id[ $form_id ] ) ) {
26
+		if ( ! isset( self::$details_by_form_id[$form_id] ) ) {
27 27
 			self::set_details_for_form( (int) $form_id );
28 28
 		}
29
-		return isset( self::$details_by_form_id[ $form_id ] ) ? self::$details_by_form_id[ $form_id ] : false;
29
+		return isset( self::$details_by_form_id[$form_id] ) ? self::$details_by_form_id[$form_id] : false;
30 30
 	}
31 31
 
32 32
 	/**
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 			return;
88 88
 		}
89 89
 
90
-		self::$details_by_form_id[ $form_id ] = array(
90
+		self::$details_by_form_id[$form_id] = array(
91 91
 			'entry'   => $entry,
92 92
 			'intent'  => $intent,
93 93
 			'payment' => $payment,
Please login to merge, or discard this patch.
classes/helpers/FrmCurrencyHelper.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,10 +16,10 @@
 block discarded – undo
16 16
 	public static function get_currency( $currency ) {
17 17
 		$currency   = strtoupper( $currency );
18 18
 		$currencies = self::get_currencies();
19
-		if ( isset( $currencies[ $currency ] ) ) {
20
-			$currency = $currencies[ $currency ];
21
-		} elseif ( isset( $currencies[ strtolower( $currency ) ] ) ) {
22
-			$currency = $currencies[ strtolower( $currency ) ];
19
+		if ( isset( $currencies[$currency] ) ) {
20
+			$currency = $currencies[$currency];
21
+		} elseif ( isset( $currencies[strtolower( $currency )] ) ) {
22
+			$currency = $currencies[strtolower( $currency )];
23 23
 		} else {
24 24
 			$currency = $currencies['USD'];
25 25
 		}
Please login to merge, or discard this patch.
stripe/models/FrmTransLitePayment.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -126,11 +126,11 @@
 block discarded – undo
126 126
 		foreach ( $payments as $payment ) {
127 127
 			list( $amount, $currency ) = FrmTransLiteAppHelper::get_amount_and_currency_from_payment( $payment );
128 128
 
129
-			if ( ! isset( $data[ $currency ] ) ) {
130
-				$data[ $currency ] = 0;
129
+			if ( ! isset( $data[$currency] ) ) {
130
+				$data[$currency] = 0;
131 131
 			}
132 132
 
133
-			$data[ $currency ] += floatval( $amount );
133
+			$data[$currency] += floatval( $amount );
134 134
 		}
135 135
 
136 136
 		return $data;
Please login to merge, or discard this patch.
classes/helpers/FrmEmailSummaryHelper.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -236,11 +236,11 @@  discard block
 block discarded – undo
236 236
 	 */
237 237
 	public static function get_last_sent_date( $type ) {
238 238
 		$options = self::get_options();
239
-		if ( empty( $options[ 'last_' . $type ] ) ) {
239
+		if ( empty( $options['last_' . $type] ) ) {
240 240
 			return false;
241 241
 		}
242 242
 
243
-		return $options[ 'last_' . $type ];
243
+		return $options['last_' . $type];
244 244
 	}
245 245
 
246 246
 	/**
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 	public static function set_last_sent_date( $type, $value = null ) {
253 253
 		$options = self::get_options();
254 254
 
255
-		$options[ 'last_' . $type ] = null === $value ? self::get_date_from_today() : '';
255
+		$options['last_' . $type] = null === $value ? self::get_date_from_today() : '';
256 256
 		self::save_options( $options );
257 257
 	}
258 258
 
Please login to merge, or discard this patch.
stripe/helpers/FrmStrpLiteConnectHelper.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 			'user_id'               => get_current_user_id(),
109 109
 			'frm_strp_connect_mode' => $mode,
110 110
 		);
111
-		$data            = self::post_to_connect_server( 'initialize', $additional_body );
111
+		$data = self::post_to_connect_server( 'initialize', $additional_body );
112 112
 
113 113
 		if ( is_string( $data ) ) {
114 114
 			return $data;
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	 * @return object|string
144 144
 	 */
145 145
 	private static function post_to_connect_server( $action, $additional_body = array() ) {
146
-		$body    = array(
146
+		$body = array(
147 147
 			'frm_strp_connect_action' => $action,
148 148
 			'frm_strp_connect_mode'   => FrmStrpLiteAppHelper::active_mode(),
149 149
 		);
Please login to merge, or discard this patch.
classes/views/frm-fields/front-end/checkbox-field.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -87,6 +87,6 @@
 block discarded – undo
87 87
 
88 88
 		?></div>
89 89
 <?php
90
-		++$option_index;
90
+		++ $option_index;
91 91
 	}//end foreach
92 92
 }//end if
Please login to merge, or discard this patch.
classes/views/frm-fields/front-end/combo-field/combo-field.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 			$sub_field_class   = "frm_form_field form-field frm_form_subfield-{$name} {$sub_field['wrapper_classes']}";
42 42
 			$sub_field_desc    = FrmField::get_option( $field, $name . '_desc' );
43 43
 
44
-			if ( isset( $errors[ 'field' . $field_id . '-' . $name ] ) ) {
44
+			if ( isset( $errors['field' . $field_id . '-' . $name] ) ) {
45 45
 				$sub_field_class .= ' frm_blank_field';
46 46
 			}
47 47
 			?>
@@ -61,10 +61,10 @@  discard block
 block discarded – undo
61 61
 						<input
62 62
 							type="<?php echo esc_attr( $sub_field['type'] ); ?>"
63 63
 							id="<?php echo esc_attr( $html_id . '_' . $name ); ?>"
64
-							value="<?php echo esc_attr( isset( $field_value[ $name ] ) ? $field_value[ $name ] : '' ); ?>"
64
+							value="<?php echo esc_attr( isset( $field_value[$name] ) ? $field_value[$name] : '' ); ?>"
65 65
 							<?php
66
-							if ( ! empty( $field_value[ $name ] ) ) {
67
-								echo 'data-frmval="' . esc_attr( $field_value[ $name ] ) . '" ';
66
+							if ( ! empty( $field_value[$name] ) ) {
67
+								echo 'data-frmval="' . esc_attr( $field_value[$name] ) . '" ';
68 68
 							}
69 69
 							if ( empty( $args['remove_names'] ) ) {
70 70
 								echo 'name="' . esc_attr( $field_name ) . '[' . esc_attr( $name ) . ']" ';
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
 				}
82 82
 
83 83
 				// Don't show individual field errors when there is a combo field error.
84
-				if ( ! empty( $errors ) && isset( $errors[ 'field' . $field_id . '-' . $name ] ) && ! isset( $errors[ 'field' . $field_id ] ) ) {
84
+				if ( ! empty( $errors ) && isset( $errors['field' . $field_id . '-' . $name] ) && ! isset( $errors['field' . $field_id] ) ) {
85 85
 					?>
86
-					<div class="frm_error" role="alert"><?php echo esc_html( $errors[ 'field' . $field_id . '-' . $name ] ); ?></div>
86
+					<div class="frm_error" role="alert"><?php echo esc_html( $errors['field' . $field_id . '-' . $name] ); ?></div>
87 87
 				<?php } ?>
88 88
 			</div>
89 89
 			<?php
Please login to merge, or discard this patch.
classes/controllers/FrmSettingsController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 				$section['function'] = $original;
159 159
 			}
160 160
 
161
-			$sections[ $key ] = $section;
161
+			$sections[$key] = $section;
162 162
 		}//end foreach
163 163
 
164 164
 		return $sections;
@@ -170,11 +170,11 @@  discard block
 block discarded – undo
170 170
 
171 171
 		$section  = FrmAppHelper::get_post_param( 'tab', '', 'sanitize_text_field' );
172 172
 		$sections = self::get_settings_tabs();
173
-		if ( ! isset( $sections[ $section ] ) ) {
173
+		if ( ! isset( $sections[$section] ) ) {
174 174
 			wp_die();
175 175
 		}
176 176
 
177
-		$section = $sections[ $section ];
177
+		$section = $sections[$section];
178 178
 
179 179
 		if ( isset( $section['class'] ) ) {
180 180
 			call_user_func( array( $section['class'], $section['function'] ) );
Please login to merge, or discard this patch.
classes/models/FrmEntryValidate.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -145,7 +145,8 @@
 block discarded – undo
145 145
 
146 146
 		if ( $posted_field->required == '1' && FrmAppHelper::is_empty_value( $value ) ) {
147 147
 			$errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' );
148
-		} elseif ( ! isset( $_POST['item_name'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
148
+		} elseif ( ! isset( $_POST['item_name'] ) ) {
149
+// phpcs:ignore WordPress.Security.NonceVerification.Missing
149 150
 			self::maybe_add_item_name( $value, $posted_field );
150 151
 		}
151 152
 
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 			return $errors;
28 28
 		}
29 29
 
30
-		if ( FrmAppHelper::is_admin() && is_user_logged_in() && ( ! isset( $values[ 'frm_submit_entry_' . $values['form_id'] ] ) || ! wp_verify_nonce( $values[ 'frm_submit_entry_' . $values['form_id'] ], 'frm_submit_entry_nonce' ) ) ) {
30
+		if ( FrmAppHelper::is_admin() && is_user_logged_in() && ( ! isset( $values['frm_submit_entry_' . $values['form_id']] ) || ! wp_verify_nonce( $values['frm_submit_entry_' . $values['form_id']], 'frm_submit_entry_nonce' ) ) ) {
31 31
 			$frm_settings   = FrmAppHelper::get_settings();
32 32
 			$errors['form'] = $frm_settings->admin_permission;
33 33
 		}
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 		$args = wp_parse_args( $args, $defaults );
131 131
 
132 132
 		if ( empty( $args['parent_field_id'] ) ) {
133
-			$value = isset( $values['item_meta'][ $args['id'] ] ) ? $values['item_meta'][ $args['id'] ] : '';
133
+			$value = isset( $values['item_meta'][$args['id']] ) ? $values['item_meta'][$args['id']] : '';
134 134
 		} else {
135 135
 			// value is from a nested form
136 136
 			$value = $values;
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 		}
152 152
 
153 153
 		if ( $posted_field->required == '1' && FrmAppHelper::is_empty_value( $value ) ) {
154
-			$errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' );
154
+			$errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' );
155 155
 		} elseif ( ! isset( $_POST['item_name'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
156 156
 			self::maybe_add_item_name( $value, $posted_field );
157 157
 		}
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 		$values['value'] = $value;
271 271
 		FrmFieldsHelper::prepare_new_front_field( $values, $field_object );
272 272
 
273
-		$map_callback = function ( $option ) {
273
+		$map_callback = function( $option ) {
274 274
 			return is_array( $option ) ? $option['value'] : $option;
275 275
 		};
276 276
 
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 			$pattern = self::phone_format( $field );
339 339
 
340 340
 			if ( ! preg_match( $pattern, $value ) ) {
341
-				$errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $field, 'invalid' );
341
+				$errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $field, 'invalid' );
342 342
 			}
343 343
 		}
344 344
 	}
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 	 */
452 452
 	private static function form_is_in_progress( $values ) {
453 453
 		return FrmAppHelper::pro_is_installed() &&
454
-			( isset( $values[ 'frm_page_order_' . $values['form_id'] ] ) || FrmAppHelper::get_post_param( 'frm_next_page' ) ) &&
454
+			( isset( $values['frm_page_order_' . $values['form_id']] ) || FrmAppHelper::get_post_param( 'frm_next_page' ) ) &&
455 455
 			FrmField::get_all_types_in_form( $values['form_id'], 'break' );
456 456
 	}
457 457
 
@@ -697,9 +697,9 @@  discard block
 block discarded – undo
697 697
 			foreach ( $datas['missing_keys'] as $key_index => $key ) {
698 698
 				$found = self::is_akismet_guest_info_value( $key, $value, $field_id, $datas['name_field_ids'], $values );
699 699
 				if ( $found ) {
700
-					$datas[ $key ]             = $value;
700
+					$datas[$key]             = $value;
701 701
 					$datas['frm_duplicated'][] = $field_id;
702
-					unset( $datas['missing_keys'][ $key_index ] );
702
+					unset( $datas['missing_keys'][$key_index] );
703 703
 				}
704 704
 			}
705 705
 		}//end foreach
@@ -742,11 +742,11 @@  discard block
 block discarded – undo
742 742
 					if ( 'Name' !== $field->name ) {
743 743
 						continue;
744 744
 					}
745
-					if ( isset( $fields[ $index + 1 ] ) && 'Last' === $fields[ $index + 1 ]->name ) {
746
-						if ( empty( $values[ absint( $fields[ $index + 1 ]->id ) ] ) ) {
745
+					if ( isset( $fields[$index + 1] ) && 'Last' === $fields[$index + 1]->name ) {
746
+						if ( empty( $values[absint( $fields[$index + 1]->id )] ) ) {
747 747
 							continue;
748 748
 						}
749
-						$value .= ' ' . $values[ $fields[ $index + 1 ]->id ];
749
+						$value .= ' ' . $values[$fields[$index + 1]->id];
750 750
 						return true;
751 751
 					}
752 752
 				}
@@ -765,13 +765,13 @@  discard block
 block discarded – undo
765 765
 	 */
766 766
 	private static function get_name_text_fields( $form_id ) {
767 767
 		$name_text_fields_is_initialized = is_array( self::$name_text_fields );
768
-		if ( $name_text_fields_is_initialized && isset( self::$name_text_fields[ $form_id ] ) ) {
769
-			return self::$name_text_fields[ $form_id ];
768
+		if ( $name_text_fields_is_initialized && isset( self::$name_text_fields[$form_id] ) ) {
769
+			return self::$name_text_fields[$form_id];
770 770
 		}
771 771
 		if ( ! $name_text_fields_is_initialized ) {
772 772
 			self::$name_text_fields = array();
773 773
 		}
774
-		self::$name_text_fields[ $form_id ] = FrmDb::get_results(
774
+		self::$name_text_fields[$form_id] = FrmDb::get_results(
775 775
 			'frm_fields',
776 776
 			array(
777 777
 				'form_id' => $form_id,
@@ -782,7 +782,7 @@  discard block
 block discarded – undo
782 782
 			array( 'order_by' => 'field_order ASC' )
783 783
 		);
784 784
 
785
-		return self::$name_text_fields[ $form_id ];
785
+		return self::$name_text_fields[$form_id];
786 786
 	}
787 787
 
788 788
 	private static function add_server_values_to_akismet( &$datas ) {
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 
792 792
 			// Send any potentially useful $_SERVER vars, but avoid sending junk we don't need.
793 793
 			if ( $include_value ) {
794
-				$datas[ $key ] = $value;
794
+				$datas[$key] = $value;
795 795
 			}
796 796
 			unset( $key, $value );
797 797
 		}
@@ -808,10 +808,10 @@  discard block
 block discarded – undo
808 808
 	private static function add_comment_content_to_akismet( &$datas, $values ) {
809 809
 		if ( isset( $datas['frm_duplicated'] ) ) {
810 810
 			foreach ( $datas['frm_duplicated'] as $index ) {
811
-				if ( isset( $values['item_meta'][ $index ] ) ) {
812
-					unset( $values['item_meta'][ $index ] );
811
+				if ( isset( $values['item_meta'][$index] ) ) {
812
+					unset( $values['item_meta'][$index] );
813 813
 				} else {
814
-					unset( $values[ $index ] );
814
+					unset( $values[$index] );
815 815
 				}
816 816
 			}
817 817
 			unset( $datas['frm_duplicated'] );
@@ -830,14 +830,14 @@  discard block
 block discarded – undo
830 830
 	private static function skip_adding_values_to_akismet( &$values ) {
831 831
 		$skipped_fields = self::get_akismet_skipped_field_ids( $values );
832 832
 		foreach ( $skipped_fields as $skipped_field ) {
833
-			if ( ! isset( $values['item_meta'][ $skipped_field->id ] ) ) {
833
+			if ( ! isset( $values['item_meta'][$skipped_field->id] ) ) {
834 834
 				continue;
835 835
 			}
836 836
 
837 837
 			if ( self::should_really_skip_field( $skipped_field, $values ) ) {
838
-				unset( $values['item_meta'][ $skipped_field->id ] );
839
-				if ( isset( $values['item_meta']['other'][ $skipped_field->id ] ) ) {
840
-					unset( $values['item_meta']['other'][ $skipped_field->id ] );
838
+				unset( $values['item_meta'][$skipped_field->id] );
839
+				if ( isset( $values['item_meta']['other'][$skipped_field->id] ) ) {
840
+					unset( $values['item_meta']['other'][$skipped_field->id] );
841 841
 				}
842 842
 			}
843 843
 		}
@@ -873,14 +873,14 @@  discard block
 block discarded – undo
873 873
 		}
874 874
 
875 875
 		// If a choice field has Other option, but Other is not selected.
876
-		if ( empty( $values['item_meta']['other'][ $field_data->id ] ) ) {
876
+		if ( empty( $values['item_meta']['other'][$field_data->id] ) ) {
877 877
 			return true;
878 878
 		}
879 879
 
880 880
 		// Check if submitted value is same as one of field option.
881 881
 		foreach ( $field_data->options as $option ) {
882 882
 			$option_value = ! is_array( $option ) ? $option : ( isset( $option['value'] ) ? $option['value'] : '' );
883
-			if ( $values['item_meta']['other'][ $field_data->id ] === $option_value ) {
883
+			if ( $values['item_meta']['other'][$field_data->id] === $option_value ) {
884 884
 				return true;
885 885
 			}
886 886
 		}
@@ -951,7 +951,7 @@  discard block
 block discarded – undo
951 951
 
952 952
 			// Convert name array to string.
953 953
 			if ( isset( $value['first'] ) && isset( $value['last'] ) ) {
954
-				$values['item_meta'][ $field_id ] = trim( implode( ' ', $value ) );
954
+				$values['item_meta'][$field_id] = trim( implode( ' ', $value ) );
955 955
 				$values['name_field_ids'][]       = $field_id;
956 956
 				continue;
957 957
 			}
@@ -972,8 +972,8 @@  discard block
 block discarded – undo
972 972
 						continue;
973 973
 					}
974 974
 
975
-					if ( ! isset( $values['item_meta'][ $subsubindex ] ) ) {
976
-						$values['item_meta'][ $subsubindex ] = array();
975
+					if ( ! isset( $values['item_meta'][$subsubindex] ) ) {
976
+						$values['item_meta'][$subsubindex] = array();
977 977
 					}
978 978
 
979 979
 					// Convert name array to string.
@@ -983,13 +983,13 @@  discard block
 block discarded – undo
983 983
 						$values['name_field_ids'][] = $subsubindex;
984 984
 					}
985 985
 
986
-					if ( is_array( $values['item_meta'][ $subsubindex ] ) ) {
987
-						$values['item_meta'][ $subsubindex ][] = $subsubvalue;
986
+					if ( is_array( $values['item_meta'][$subsubindex] ) ) {
987
+						$values['item_meta'][$subsubindex][] = $subsubvalue;
988 988
 					}
989 989
 				}
990 990
 			}//end foreach
991 991
 
992
-			unset( $values['item_meta'][ $field_id ] );
992
+			unset( $values['item_meta'][$field_id] );
993 993
 		}//end foreach
994 994
 
995 995
 		return $form_ids;
Please login to merge, or discard this patch.