Completed
Pull Request — master (#1580)
by Stephanie
47s
created
classes/helpers/FrmFieldsHelper.php 2 patches
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -185,7 +185,8 @@  discard block
 block discarded – undo
185 185
 	 * @param mixed  $value
186 186
 	 */
187 187
 	private static function get_posted_field_setting( $setting, &$value ) {
188
-		if ( ! isset( $_POST['field_options'][ $setting ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
188
+		if ( ! isset( $_POST['field_options'][ $setting ] ) ) {
189
+// phpcs:ignore WordPress.Security.NonceVerification.Missing
189 190
 			return;
190 191
 		}
191 192
 
@@ -1144,7 +1145,8 @@  discard block
 block discarded – undo
1144 1145
 
1145 1146
 		// Check posted vals before checking saved values
1146 1147
 		// For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero
1147
-		if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
1148
+		if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) {
1149
+// phpcs:ignore WordPress.Security.NonceVerification.Missing
1148 1150
 			if ( FrmField::is_field_with_multiple_values( $field ) ) {
1149 1151
 				// phpcs:ignore WordPress.Security.NonceVerification.Missing
1150 1152
 				$other_val = isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ) : '';
@@ -1154,7 +1156,8 @@  discard block
 block discarded – undo
1154 1156
 
1155 1157
 			return $other_val;
1156 1158
 
1157
-		} elseif ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
1159
+		} elseif ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) {
1160
+// phpcs:ignore WordPress.Security.NonceVerification.Missing
1158 1161
 			// For normal fields
1159 1162
 
1160 1163
 			if ( FrmField::is_field_with_multiple_values( $field ) ) {
Please login to merge, or discard this patch.
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 			if ( in_array( $type, array( 'data', 'lookup' ), true ) ) {
32 32
 				$values['field_options']['data_type'] = $setting;
33 33
 			} else {
34
-				$values['field_options'][ $setting ] = 1;
34
+				$values['field_options'][$setting] = 1;
35 35
 			}
36 36
 		}
37 37
 
@@ -138,10 +138,10 @@  discard block
 block discarded – undo
138 138
 		}
139 139
 
140 140
 		foreach ( $defaults as $opt => $default ) {
141
-			$values[ $opt ] = isset( $field->field_options[ $opt ] ) ? $field->field_options[ $opt ] : $default;
141
+			$values[$opt] = isset( $field->field_options[$opt] ) ? $field->field_options[$opt] : $default;
142 142
 
143 143
 			if ( $check_post ) {
144
-				self::get_posted_field_setting( $opt . '_' . $field->id, $values[ $opt ] );
144
+				self::get_posted_field_setting( $opt . '_' . $field->id, $values[$opt] );
145 145
 			}
146 146
 
147 147
 			unset( $opt, $default );
@@ -217,18 +217,18 @@  discard block
 block discarded – undo
217 217
 	 * @param mixed  $value
218 218
 	 */
219 219
 	private static function get_posted_field_setting( $setting, &$value ) {
220
-		if ( ! isset( $_POST['field_options'][ $setting ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
220
+		if ( ! isset( $_POST['field_options'][$setting] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
221 221
 			return;
222 222
 		}
223 223
 
224 224
 		if ( strpos( $setting, 'html' ) !== false ) {
225 225
 			// Strip slashes from HTML but not regex or script tags.
226
-			$value = wp_unslash( $_POST['field_options'][ $setting ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing
226
+			$value = wp_unslash( $_POST['field_options'][$setting] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing
227 227
 		} elseif ( strpos( $setting, 'format_' ) === 0 ) {
228 228
 			// TODO: Remove stripslashes on output, and use on input only.
229
-			$value = sanitize_text_field( $_POST['field_options'][ $setting ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.NonceVerification.Missing
229
+			$value = sanitize_text_field( $_POST['field_options'][$setting] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.NonceVerification.Missing
230 230
 		} else {
231
-			$value = wp_unslash( $_POST['field_options'][ $setting ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing
231
+			$value = wp_unslash( $_POST['field_options'][$setting] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing
232 232
 			FrmAppHelper::sanitize_value( 'wp_kses_post', $value );
233 233
 		}
234 234
 	}
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 		$values['default_value'] = FrmAppHelper::maybe_json_encode( $field->default_value );
302 302
 
303 303
 		foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) {
304
-			$values[ $col ] = $field->{$col};
304
+			$values[$col] = $field->{$col};
305 305
 		}
306 306
 	}
307 307
 
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 		);
341 341
 
342 342
 		$msg = FrmField::get_option( $field, $error );
343
-		$msg = empty( $msg ) ? $defaults[ $error ]['part'] : $msg;
343
+		$msg = empty( $msg ) ? $defaults[$error]['part'] : $msg;
344 344
 		$msg = do_shortcode( $msg );
345 345
 
346 346
 		$msg = self::maybe_replace_substrings_with_field_name( $msg, $error, $field );
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
 		$base_name = 'default_value_' . $field['id'];
516 516
 		$html_id   = isset( $field['html_id'] ) ? $field['html_id'] : self::get_html_id( $field );
517 517
 
518
-		$default_type          = self::get_default_value_type( $field );
518
+		$default_type = self::get_default_value_type( $field );
519 519
 
520 520
 		foreach ( $field['options'] as $opt_key => $opt ) {
521 521
 			$field_val = self::get_value_from_array( $opt, $opt_key, $field );
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
 				continue;
844 844
 			}
845 845
 
846
-			$atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][ $short_key ] );
846
+			$atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][$short_key] );
847 847
 			$tag  = FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key );
848 848
 
849 849
 			$atts['entry'] = $entry;
@@ -853,7 +853,7 @@  discard block
 block discarded – undo
853 853
 			if ( $replace_with !== null ) {
854 854
 				$replace_with = self::trigger_shortcode_atts( $replace_with, $atts );
855 855
 				self::sanitize_embedded_shortcodes( compact( 'entry' ), $replace_with );
856
-				$content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content );
856
+				$content = str_replace( $shortcodes[0][$short_key], $replace_with, $content );
857 857
 			}
858 858
 
859 859
 			unset( $atts, $replace_with );
@@ -871,7 +871,7 @@  discard block
 block discarded – undo
871 871
 		$supported_atts = array( 'remove_accents', 'sanitize', 'sanitize_url' );
872 872
 		$included_atts  = array_intersect( $supported_atts, array_keys( $atts ) );
873 873
 		foreach ( $included_atts as $included_att ) {
874
-			if ( '0' === $atts[ $included_att ] ) {
874
+			if ( '0' === $atts[$included_att] ) {
875 875
 				// Skip any option that uses 0 so sanitize_url=0 does not encode.
876 876
 				continue;
877 877
 			}
@@ -944,8 +944,8 @@  discard block
 block discarded – undo
944 944
 
945 945
 		$dynamic_default = array( 'admin_email', 'siteurl', 'frmurl', 'sitename', 'get' );
946 946
 
947
-		if ( isset( $shortcode_values[ $atts['tag'] ] ) ) {
948
-			$replace_with = $shortcode_values[ $atts['tag'] ];
947
+		if ( isset( $shortcode_values[$atts['tag']] ) ) {
948
+			$replace_with = $shortcode_values[$atts['tag']];
949 949
 		} elseif ( in_array( $atts['tag'], $dynamic_default ) ) {
950 950
 			$replace_with = self::dynamic_default_values( $atts['tag'], $atts );
951 951
 		} elseif ( $clean_tag === 'user_agent' ) {
@@ -1156,8 +1156,8 @@  discard block
 block discarded – undo
1156 1156
 			self::field_types_for_input( $single_input, $field_selection, $field_types );
1157 1157
 		} elseif ( in_array( $type, $multiple_input ) ) {
1158 1158
 			self::field_types_for_input( $multiple_input, $field_selection, $field_types );
1159
-		} elseif ( isset( $field_selection[ $type ] ) ) {
1160
-			$field_types[ $type ] = $field_selection[ $type ];
1159
+		} elseif ( isset( $field_selection[$type] ) ) {
1160
+			$field_types[$type] = $field_selection[$type];
1161 1161
 		}
1162 1162
 
1163 1163
 		$field_types = apply_filters( 'frm_switch_field_types', $field_types, compact( 'type', 'field_selection' ) );
@@ -1190,7 +1190,7 @@  discard block
 block discarded – undo
1190 1190
 
1191 1191
 	private static function field_types_for_input( $inputs, $fields, &$field_types ) {
1192 1192
 		foreach ( $inputs as $input ) {
1193
-			$field_types[ $input ] = $fields[ $input ];
1193
+			$field_types[$input] = $fields[$input];
1194 1194
 			unset( $input );
1195 1195
 		}
1196 1196
 	}
@@ -1222,7 +1222,7 @@  discard block
 block discarded – undo
1222 1222
 			'parent'  => false,
1223 1223
 			'pointer' => false,
1224 1224
 		);
1225
-		$args     = wp_parse_args( $args, $defaults );
1225
+		$args = wp_parse_args( $args, $defaults );
1226 1226
 
1227 1227
 		$opt_key   = $args['opt_key'];
1228 1228
 		$field     = $args['field'];
@@ -1238,24 +1238,24 @@  discard block
 block discarded – undo
1238 1238
 
1239 1239
 		// Check posted vals before checking saved values
1240 1240
 		// For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero
1241
-		if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
1241
+		if ( $parent && isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
1242 1242
 			if ( FrmField::is_field_with_multiple_values( $field ) ) {
1243 1243
 				// phpcs:ignore WordPress.Security.NonceVerification.Missing
1244
-				$other_val = isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ) : '';
1244
+				$other_val = isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']][$opt_key] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']][$opt_key] ) ) : '';
1245 1245
 			} else {
1246
-				$other_val = sanitize_text_field( wp_unslash( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
1246
+				$other_val = sanitize_text_field( wp_unslash( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
1247 1247
 			}
1248 1248
 
1249 1249
 			return $other_val;
1250 1250
 
1251
-		} elseif ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
1251
+		} elseif ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][$field['id']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
1252 1252
 			// For normal fields
1253 1253
 
1254 1254
 			if ( FrmField::is_field_with_multiple_values( $field ) ) {
1255 1255
 				// phpcs:ignore WordPress.Security.NonceVerification.Missing
1256
-				$other_val = isset( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ) : '';
1256
+				$other_val = isset( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ) : '';
1257 1257
 			} else {
1258
-				$other_val = sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][ $field['id'] ] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
1258
+				$other_val = sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][$field['id']] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
1259 1259
 			}
1260 1260
 
1261 1261
 			return $other_val;
@@ -1265,8 +1265,8 @@  discard block
 block discarded – undo
1265 1265
 		if ( $field['type'] === 'checkbox' && is_array( $field['value'] ) ) {
1266 1266
 			// Check if there is an "other" val in saved value and make sure the
1267 1267
 			// "other" val is not equal to the Other checkbox option
1268
-			if ( isset( $field['value'][ $opt_key ] ) && $field['options'][ $opt_key ] != $field['value'][ $opt_key ] ) {
1269
-				$other_val = $field['value'][ $opt_key ];
1268
+			if ( isset( $field['value'][$opt_key] ) && $field['options'][$opt_key] != $field['value'][$opt_key] ) {
1269
+				$other_val = $field['value'][$opt_key];
1270 1270
 			}
1271 1271
 		} else {
1272 1272
 			/**
@@ -1278,8 +1278,8 @@  discard block
 block discarded – undo
1278 1278
 				// Multi-select dropdowns - key is not preserved
1279 1279
 				if ( is_array( $field['value'] ) ) {
1280 1280
 					$o_key = array_search( $temp_val, $field['value'] );
1281
-					if ( isset( $field['value'][ $o_key ] ) ) {
1282
-						unset( $field['value'][ $o_key ], $o_key );
1281
+					if ( isset( $field['value'][$o_key] ) ) {
1282
+						unset( $field['value'][$o_key], $o_key );
1283 1283
 					}
1284 1284
 				} elseif ( $temp_val == $field['value'] ) {
1285 1285
 					// For radio and regular dropdowns
@@ -1321,7 +1321,7 @@  discard block
 block discarded – undo
1321 1321
 			return $other_args;
1322 1322
 		}
1323 1323
 
1324
-		$other_opt  = true;
1324
+		$other_opt = true;
1325 1325
 
1326 1326
 		self::set_other_name( $args, $other_args );
1327 1327
 		self::set_other_value( $args, $other_args );
@@ -1489,7 +1489,7 @@  discard block
 block discarded – undo
1489 1489
 		if ( is_array( $val ) ) {
1490 1490
 			foreach ( $val as $k => $v ) {
1491 1491
 				if ( is_string( $v ) ) {
1492
-					$val[ $k ] = str_replace( $replace, $replace_with, $v );
1492
+					$val[$k] = str_replace( $replace, $replace_with, $v );
1493 1493
 					unset( $k, $v );
1494 1494
 				}
1495 1495
 			}
@@ -1842,7 +1842,7 @@  discard block
 block discarded – undo
1842 1842
 			$countries['class'] = 'frm-countries-opts';
1843 1843
 		}
1844 1844
 
1845
-		$prepop[ __( 'Countries', 'formidable' ) ] = $countries;
1845
+		$prepop[__( 'Countries', 'formidable' )] = $countries;
1846 1846
 
1847 1847
 		// State abv.
1848 1848
 		$states    = self::get_us_states();
@@ -1852,7 +1852,7 @@  discard block
 block discarded – undo
1852 1852
 			$state_abv['class'] = 'frm-state-abv-opts';
1853 1853
 		}
1854 1854
 
1855
-		$prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv;
1855
+		$prepop[__( 'U.S. State Abbreviations', 'formidable' )] = $state_abv;
1856 1856
 
1857 1857
 		// States.
1858 1858
 		$states = array_values( $states );
@@ -1861,7 +1861,7 @@  discard block
 block discarded – undo
1861 1861
 			$states['class'] = 'frm-states-opts';
1862 1862
 		}
1863 1863
 
1864
-		$prepop[ __( 'U.S. States', 'formidable' ) ] = $states;
1864
+		$prepop[__( 'U.S. States', 'formidable' )] = $states;
1865 1865
 		unset( $state_abv, $states );
1866 1866
 
1867 1867
 		// Age.
@@ -1879,7 +1879,7 @@  discard block
 block discarded – undo
1879 1879
 			$ages['class'] = 'frm-age-opts';
1880 1880
 		}
1881 1881
 
1882
-		$prepop[ __( 'Age', 'formidable' ) ] = $ages;
1882
+		$prepop[__( 'Age', 'formidable' )] = $ages;
1883 1883
 
1884 1884
 		// Satisfaction.
1885 1885
 		$satisfaction = array(
@@ -1894,7 +1894,7 @@  discard block
 block discarded – undo
1894 1894
 			$satisfaction['class'] = 'frm-satisfaction-opts';
1895 1895
 		}
1896 1896
 
1897
-		$prepop[ __( 'Satisfaction', 'formidable' ) ] = $satisfaction;
1897
+		$prepop[__( 'Satisfaction', 'formidable' )] = $satisfaction;
1898 1898
 
1899 1899
 		// Importance.
1900 1900
 		$importance = array(
@@ -1909,7 +1909,7 @@  discard block
 block discarded – undo
1909 1909
 			$importance['class'] = 'frm-importance-opts';
1910 1910
 		}
1911 1911
 
1912
-		$prepop[ __( 'Importance', 'formidable' ) ] = $importance;
1912
+		$prepop[__( 'Importance', 'formidable' )] = $importance;
1913 1913
 
1914 1914
 		// Agreement.
1915 1915
 		$agreement = array(
@@ -1924,7 +1924,7 @@  discard block
 block discarded – undo
1924 1924
 			$agreement['class'] = 'frm-agreement-opts';
1925 1925
 		}
1926 1926
 
1927
-		$prepop[ __( 'Agreement', 'formidable' ) ] = $agreement;
1927
+		$prepop[__( 'Agreement', 'formidable' )] = $agreement;
1928 1928
 
1929 1929
 		// Likely.
1930 1930
 		$likely = array(
@@ -1939,7 +1939,7 @@  discard block
 block discarded – undo
1939 1939
 			$likely['class'] = 'frm-likely-opts';
1940 1940
 		}
1941 1941
 
1942
-		$prepop[ __( 'Likely', 'formidable' ) ] = $likely;
1942
+		$prepop[__( 'Likely', 'formidable' )] = $likely;
1943 1943
 
1944 1944
 		$prepop = apply_filters( 'frm_bulk_field_choices', $prepop );
1945 1945
 	}
@@ -2156,16 +2156,16 @@  discard block
 block discarded – undo
2156 2156
 	 */
2157 2157
 	private static function fill_image_setting_options( $options, &$args ) {
2158 2158
 		foreach ( $options as $key => $option ) {
2159
-			$args['options'][ $key ] = $option;
2159
+			$args['options'][$key] = $option;
2160 2160
 
2161 2161
 			if ( ! empty( $option['addon'] ) ) {
2162
-				$args['options'][ $key ]['custom_attrs'] = self::fill_image_setting_addon_link( $option );
2162
+				$args['options'][$key]['custom_attrs'] = self::fill_image_setting_addon_link( $option );
2163 2163
 			}
2164 2164
 
2165
-			unset( $args['options'][ $key ]['addon'] );
2165
+			unset( $args['options'][$key]['addon'] );
2166 2166
 			$fill = array( 'upgrade', 'message', 'content' );
2167 2167
 			foreach ( $fill as $f ) {
2168
-				unset( $args['options'][ $key ][ $f ], $f );
2168
+				unset( $args['options'][$key][$f], $f );
2169 2169
 			}
2170 2170
 		}
2171 2171
 	}
@@ -2186,8 +2186,8 @@  discard block
 block discarded – undo
2186 2186
 
2187 2187
 		$fill = array( 'upgrade', 'message', 'content' );
2188 2188
 		foreach ( $fill as $f ) {
2189
-			if ( isset( $option[ $f ] ) ) {
2190
-				$custom_attrs[ 'data-' . $f ] = $option[ $f ];
2189
+			if ( isset( $option[$f] ) ) {
2190
+				$custom_attrs['data-' . $f] = $option[$f];
2191 2191
 			}
2192 2192
 		}
2193 2193
 
Please login to merge, or discard this patch.
classes/models/FrmEntryValidate.php 2 patches
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 			return $errors;
21 21
 		}
22 22
 
23
-		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' ) ) ) {
23
+		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' ) ) ) {
24 24
 			$frm_settings   = FrmAppHelper::get_settings();
25 25
 			$errors['form'] = $frm_settings->admin_permission;
26 26
 		}
@@ -120,10 +120,10 @@  discard block
 block discarded – undo
120 120
 			'exclude'         => array(),
121 121
 
122 122
 		);
123
-		$args     = wp_parse_args( $args, $defaults );
123
+		$args = wp_parse_args( $args, $defaults );
124 124
 
125 125
 		if ( empty( $args['parent_field_id'] ) ) {
126
-			$value = isset( $values['item_meta'][ $args['id'] ] ) ? $values['item_meta'][ $args['id'] ] : '';
126
+			$value = isset( $values['item_meta'][$args['id']] ) ? $values['item_meta'][$args['id']] : '';
127 127
 		} else {
128 128
 			// value is from a nested form
129 129
 			$value = $values;
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 		}
145 145
 
146 146
 		if ( $posted_field->required == '1' && FrmAppHelper::is_empty_value( $value ) ) {
147
-			$errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' );
147
+			$errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' );
148 148
 		} elseif ( ! isset( $_POST['item_name'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
149 149
 			self::maybe_add_item_name( $value, $posted_field );
150 150
 		}
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 			$pattern = self::phone_format( $field );
223 223
 
224 224
 			if ( ! preg_match( $pattern, $value ) ) {
225
-				$errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $field, 'invalid' );
225
+				$errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $field, 'invalid' );
226 226
 			}
227 227
 		}
228 228
 	}
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 	 */
333 333
 	private static function form_is_in_progress( $values ) {
334 334
 		return FrmAppHelper::pro_is_installed() &&
335
-			( isset( $values[ 'frm_page_order_' . $values['form_id'] ] ) || FrmAppHelper::get_post_param( 'frm_next_page' ) ) &&
335
+			( isset( $values['frm_page_order_' . $values['form_id']] ) || FrmAppHelper::get_post_param( 'frm_next_page' ) ) &&
336 336
 			FrmField::get_all_types_in_form( $values['form_id'], 'break' );
337 337
 	}
338 338
 
@@ -576,9 +576,9 @@  discard block
 block discarded – undo
576 576
 			foreach ( $datas['missing_keys'] as $key_index => $key ) {
577 577
 				$found = self::is_akismet_guest_info_value( $key, $value, $field_id, $datas['name_field_ids'] );
578 578
 				if ( $found ) {
579
-					$datas[ $key ]             = $value;
579
+					$datas[$key]             = $value;
580 580
 					$datas['frm_duplicated'][] = $field_id;
581
-					unset( $datas['missing_keys'][ $key_index ] );
581
+					unset( $datas['missing_keys'][$key_index] );
582 582
 				}
583 583
 			}
584 584
 		}//end foreach
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
 
625 625
 			// Send any potentially useful $_SERVER vars, but avoid sending junk we don't need.
626 626
 			if ( $include_value ) {
627
-				$datas[ $key ] = $value;
627
+				$datas[$key] = $value;
628 628
 			}
629 629
 			unset( $key, $value );
630 630
 		}
@@ -641,10 +641,10 @@  discard block
 block discarded – undo
641 641
 	private static function add_comment_content_to_akismet( &$datas, $values ) {
642 642
 		if ( isset( $datas['frm_duplicated'] ) ) {
643 643
 			foreach ( $datas['frm_duplicated'] as $index ) {
644
-				if ( isset( $values['item_meta'][ $index ] ) ) {
645
-					unset( $values['item_meta'][ $index ] );
644
+				if ( isset( $values['item_meta'][$index] ) ) {
645
+					unset( $values['item_meta'][$index] );
646 646
 				} else {
647
-					unset( $values[ $index ] );
647
+					unset( $values[$index] );
648 648
 				}
649 649
 			}
650 650
 			unset( $datas['frm_duplicated'] );
@@ -665,14 +665,14 @@  discard block
 block discarded – undo
665 665
 	private static function skip_adding_values_to_akismet( &$values ) {
666 666
 		$skipped_fields = self::get_akismet_skipped_field_ids( $values );
667 667
 		foreach ( $skipped_fields as $skipped_field ) {
668
-			if ( ! isset( $values['item_meta'][ $skipped_field->id ] ) ) {
668
+			if ( ! isset( $values['item_meta'][$skipped_field->id] ) ) {
669 669
 				continue;
670 670
 			}
671 671
 
672 672
 			if ( self::should_really_skip_field( $skipped_field, $values ) ) {
673
-				unset( $values['item_meta'][ $skipped_field->id ] );
674
-				if ( isset( $values['item_meta']['other'][ $skipped_field->id ] ) ) {
675
-					unset( $values['item_meta']['other'][ $skipped_field->id ] );
673
+				unset( $values['item_meta'][$skipped_field->id] );
674
+				if ( isset( $values['item_meta']['other'][$skipped_field->id] ) ) {
675
+					unset( $values['item_meta']['other'][$skipped_field->id] );
676 676
 				}
677 677
 			}
678 678
 		}
@@ -708,14 +708,14 @@  discard block
 block discarded – undo
708 708
 		}
709 709
 
710 710
 		// If a choice field has Other option, but Other is not selected.
711
-		if ( empty( $values['item_meta']['other'][ $field_data->id ] ) ) {
711
+		if ( empty( $values['item_meta']['other'][$field_data->id] ) ) {
712 712
 			return true;
713 713
 		}
714 714
 
715 715
 		// Check if submitted value is same as one of field option.
716 716
 		foreach ( $field_data->options as $option ) {
717 717
 			$option_value = ! is_array( $option ) ? $option : ( isset( $option['value'] ) ? $option['value'] : '' );
718
-			if ( $values['item_meta']['other'][ $field_data->id ] === $option_value ) {
718
+			if ( $values['item_meta']['other'][$field_data->id] === $option_value ) {
719 719
 				return true;
720 720
 			}
721 721
 		}
@@ -786,7 +786,7 @@  discard block
 block discarded – undo
786 786
 
787 787
 			// Convert name array to string.
788 788
 			if ( isset( $value['first'] ) && isset( $value['last'] ) ) {
789
-				$values['item_meta'][ $field_id ] = trim( implode( ' ', $value ) );
789
+				$values['item_meta'][$field_id] = trim( implode( ' ', $value ) );
790 790
 				$values['name_field_ids'][]       = $field_id;
791 791
 				continue;
792 792
 			}
@@ -807,8 +807,8 @@  discard block
 block discarded – undo
807 807
 						continue;
808 808
 					}
809 809
 
810
-					if ( ! isset( $values['item_meta'][ $subsubindex ] ) ) {
811
-						$values['item_meta'][ $subsubindex ] = array();
810
+					if ( ! isset( $values['item_meta'][$subsubindex] ) ) {
811
+						$values['item_meta'][$subsubindex] = array();
812 812
 					}
813 813
 
814 814
 					// Convert name array to string.
@@ -818,11 +818,11 @@  discard block
 block discarded – undo
818 818
 						$values['name_field_ids'][] = $subsubindex;
819 819
 					}
820 820
 
821
-					$values['item_meta'][ $subsubindex ][] = $subsubvalue;
821
+					$values['item_meta'][$subsubindex][] = $subsubvalue;
822 822
 				}
823 823
 			}//end foreach
824 824
 
825
-			unset( $values['item_meta'][ $field_id ] );
825
+			unset( $values['item_meta'][$field_id] );
826 826
 		}//end foreach
827 827
 
828 828
 		return $form_ids;
Please login to merge, or discard this patch.
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.
classes/models/FrmApplicationTemplate.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 		 *
38 38
 		 * @param array $keys
39 39
 		 */
40
-		self::$keys             = apply_filters(
40
+		self::$keys = apply_filters(
41 41
 			'frm_application_data_keys',
42 42
 			array( 'key', 'name', 'description', 'link', 'categories', 'views', 'forms' )
43 43
 		);
@@ -115,17 +115,17 @@  discard block
 block discarded – undo
115 115
 	public function as_js_object() {
116 116
 		$application = array();
117 117
 		foreach ( self::$keys as $key ) {
118
-			if ( ! isset( $this->api_data[ $key ] ) ) {
118
+			if ( ! isset( $this->api_data[$key] ) ) {
119 119
 				continue;
120 120
 			}
121 121
 
122
-			$value = $this->api_data[ $key ];
122
+			$value = $this->api_data[$key];
123 123
 
124 124
 			if ( 'icon' === $key ) {
125 125
 				// Icon is an array. The first array item is the image URL.
126
-				$application[ $key ] = reset( $value );
126
+				$application[$key] = reset( $value );
127 127
 			} elseif ( 'categories' === $key ) {
128
-				$application[ $key ] = array_values(
128
+				$application[$key] = array_values(
129 129
 					array_filter(
130 130
 						$value,
131 131
 						function( $category ) {
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 					// Strip off the " Template" text at the end of the name as it takes up space.
145 145
 					$value = substr( $value, 0, -9 );
146 146
 				}
147
-				$application[ $key ] = $value;
147
+				$application[$key] = $value;
148 148
 			}//end if
149 149
 		}//end foreach
150 150
 
Please login to merge, or discard this patch.
classes/models/FrmFormAction.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -208,9 +208,9 @@  discard block
 block discarded – undo
208 208
 		$groups = FrmFormActionsController::form_action_groups();
209 209
 		$group  = 'misc';
210 210
 
211
-		if ( isset( $action_options['group'] ) && isset( $groups[ $action_options['group'] ] ) ) {
211
+		if ( isset( $action_options['group'] ) && isset( $groups[$action_options['group']] ) ) {
212 212
 			$group = $action_options['group'];
213
-		} elseif ( isset( $groups[ $this->id_base ] ) ) {
213
+		} elseif ( isset( $groups[$this->id_base] ) ) {
214 214
 			$group = $this->id_base;
215 215
 		} else {
216 216
 			foreach ( $groups as $name => $check_group ) {
@@ -221,8 +221,8 @@  discard block
 block discarded – undo
221 221
 			}
222 222
 		}
223 223
 
224
-		$groups[ $group ]['id'] = $group;
225
-		return $groups[ $group ];
224
+		$groups[$group]['id'] = $group;
225
+		return $groups[$group];
226 226
 	}
227 227
 
228 228
 	/**
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 	 * @return integer $post_id
334 334
 	 */
335 335
 	public function maybe_create_action( $action, $forms ) {
336
-		if ( isset( $action['ID'] ) && is_numeric( $action['ID'] ) && isset( $forms[ $action['menu_order'] ] ) && $forms[ $action['menu_order'] ] == 'updated' ) {
336
+		if ( isset( $action['ID'] ) && is_numeric( $action['ID'] ) && isset( $forms[$action['menu_order']] ) && $forms[$action['menu_order']] == 'updated' ) {
337 337
 			// Update action only
338 338
 			$action['post_content'] = FrmAppHelper::maybe_json_decode( $action['post_content'] );
339 339
 			$post_id                = $this->save_settings( $action );
@@ -356,18 +356,18 @@  discard block
 block discarded – undo
356 356
 		$switch             = $this->get_global_switch_fields();
357 357
 
358 358
 		foreach ( (array) $action->post_content as $key => $val ) {
359
-			if ( is_numeric( $val ) && isset( $frm_duplicate_ids[ $val ] ) ) {
360
-				$action->post_content[ $key ] = $frm_duplicate_ids[ $val ];
359
+			if ( is_numeric( $val ) && isset( $frm_duplicate_ids[$val] ) ) {
360
+				$action->post_content[$key] = $frm_duplicate_ids[$val];
361 361
 			} elseif ( ! is_array( $val ) ) {
362
-				$action->post_content[ $key ] = FrmFieldsHelper::switch_field_ids( $val );
363
-			} elseif ( isset( $switch[ $key ] ) && is_array( $switch[ $key ] ) ) {
362
+				$action->post_content[$key] = FrmFieldsHelper::switch_field_ids( $val );
363
+			} elseif ( isset( $switch[$key] ) && is_array( $switch[$key] ) ) {
364 364
 				// loop through each value if empty
365
-				if ( empty( $switch[ $key ] ) ) {
366
-					$switch[ $key ] = array_keys( $val );
365
+				if ( empty( $switch[$key] ) ) {
366
+					$switch[$key] = array_keys( $val );
367 367
 				}
368 368
 
369
-				foreach ( $switch[ $key ] as $subkey ) {
370
-					$action->post_content[ $key ] = $this->duplicate_array_walk( $action->post_content[ $key ], $subkey, $val );
369
+				foreach ( $switch[$key] as $subkey ) {
370
+					$action->post_content[$key] = $this->duplicate_array_walk( $action->post_content[$key], $subkey, $val );
371 371
 				}
372 372
 			}
373 373
 
@@ -385,20 +385,20 @@  discard block
 block discarded – undo
385 385
 			foreach ( $subkey as $subkey2 ) {
386 386
 				foreach ( (array) $val as $ck => $cv ) {
387 387
 					if ( is_array( $cv ) ) {
388
-						$action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey2, $cv );
389
-					} elseif ( isset( $cv[ $subkey ] ) && is_numeric( $cv[ $subkey ] ) && isset( $frm_duplicate_ids[ $cv[ $subkey ] ] ) ) {
390
-						$action[ $ck ][ $subkey ] = $frm_duplicate_ids[ $cv[ $subkey ] ];
388
+						$action[$ck] = $this->duplicate_array_walk( $action[$ck], $subkey2, $cv );
389
+					} elseif ( isset( $cv[$subkey] ) && is_numeric( $cv[$subkey] ) && isset( $frm_duplicate_ids[$cv[$subkey]] ) ) {
390
+						$action[$ck][$subkey] = $frm_duplicate_ids[$cv[$subkey]];
391 391
 					}
392 392
 				}
393 393
 			}
394 394
 		} else {
395 395
 			foreach ( (array) $val as $ck => $cv ) {
396 396
 				if ( is_array( $cv ) ) {
397
-					$action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey, $cv );
398
-				} elseif ( $ck == $subkey && isset( $frm_duplicate_ids[ $cv ] ) ) {
399
-					$action[ $ck ] = $frm_duplicate_ids[ $cv ];
397
+					$action[$ck] = $this->duplicate_array_walk( $action[$ck], $subkey, $cv );
398
+				} elseif ( $ck == $subkey && isset( $frm_duplicate_ids[$cv] ) ) {
399
+					$action[$ck] = $frm_duplicate_ids[$cv];
400 400
 				} elseif ( $ck == $subkey ) {
401
-					$action[ $ck ] = $this->maybe_switch_field_ids( $action[ $ck ] );
401
+					$action[$ck] = $this->maybe_switch_field_ids( $action[$ck] );
402 402
 				}
403 403
 			}
404 404
 		}//end if
@@ -422,10 +422,10 @@  discard block
 block discarded – undo
422 422
 		}
423 423
 
424 424
 		// phpcs:ignore WordPress.Security.NonceVerification.Missing
425
-		if ( isset( $_POST[ $this->option_name ] ) && is_array( $_POST[ $this->option_name ] ) ) {
425
+		if ( isset( $_POST[$this->option_name] ) && is_array( $_POST[$this->option_name] ) ) {
426 426
 			// Sanitizing removes scripts and <email> type of values.
427 427
 			// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing
428
-			$settings = wp_unslash( $_POST[ $this->option_name ] );
428
+			$settings = wp_unslash( $_POST[$this->option_name] );
429 429
 		} else {
430 430
 			return;
431 431
 		}
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 		foreach ( $settings as $number => $new_instance ) {
436 436
 			$this->_set( $number );
437 437
 
438
-			$old_instance = isset( $all_instances[ $number ] ) ? $all_instances[ $number ] : array();
438
+			$old_instance = isset( $all_instances[$number] ) ? $all_instances[$number] : array();
439 439
 
440 440
 			if ( ! isset( $new_instance['post_status'] ) ) {
441 441
 				$new_instance['post_status'] = 'draft';
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
 			$instance['post_content'] = apply_filters( 'frm_before_save_' . $this->id_base . '_action', $instance['post_content'], $instance, $new_instance, $old_instance, $this );
474 474
 
475 475
 			if ( false !== $instance ) {
476
-				$all_instances[ $number ] = $instance;
476
+				$all_instances[$number] = $instance;
477 477
 			}
478 478
 
479 479
 			$action_ids[] = $this->save_settings( $instance );
@@ -555,12 +555,12 @@  discard block
 block discarded – undo
555 555
 			// some plugins/themes are formatting the post_excerpt
556 556
 			$action->post_excerpt = sanitize_title( $action->post_excerpt );
557 557
 
558
-			if ( ! isset( $action_controls[ $action->post_excerpt ] ) ) {
558
+			if ( ! isset( $action_controls[$action->post_excerpt] ) ) {
559 559
 				continue;
560 560
 			}
561 561
 
562
-			$action                  = $action_controls[ $action->post_excerpt ]->prepare_action( $action );
563
-			$settings[ $action->ID ] = $action;
562
+			$action                  = $action_controls[$action->post_excerpt]->prepare_action( $action );
563
+			$settings[$action->ID] = $action;
564 564
 
565 565
 			if ( count( $settings ) >= $limit ) {
566 566
 				break;
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
 			'limit'       => 99,
594 594
 			'post_status' => $default_status,
595 595
 		);
596
-		$args     = wp_parse_args( $args, $defaults );
596
+		$args = wp_parse_args( $args, $defaults );
597 597
 	}
598 598
 
599 599
 	/**
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
 
660 660
 			$action = $this->prepare_action( $action );
661 661
 
662
-			$settings[ $action->ID ] = $action;
662
+			$settings[$action->ID] = $action;
663 663
 		}
664 664
 
665 665
 		if ( 1 === $limit ) {
@@ -702,10 +702,10 @@  discard block
 block discarded – undo
702 702
 
703 703
 		foreach ( $default_values as $k => $vals ) {
704 704
 			if ( is_array( $vals ) && ! empty( $vals ) ) {
705
-				if ( 'event' === $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[ $k ] ) ) {
705
+				if ( 'event' === $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[$k] ) ) {
706 706
 					continue;
707 707
 				}
708
-				$action->post_content[ $k ] = wp_parse_args( $action->post_content[ $k ], $vals );
708
+				$action->post_content[$k] = wp_parse_args( $action->post_content[$k], $vals );
709 709
 			}
710 710
 		}
711 711
 
@@ -788,14 +788,14 @@  discard block
 block discarded – undo
788 788
 	 * Migrate settings from form->options into new action.
789 789
 	 */
790 790
 	public function migrate_to_2( $form, $update = 'update' ) {
791
-		$action        = $this->prepare_new( $form->id );
791
+		$action = $this->prepare_new( $form->id );
792 792
 		FrmAppHelper::unserialize_or_decode( $form->options );
793 793
 
794 794
 		// fill with existing options
795 795
 		foreach ( $action->post_content as $name => $val ) {
796
-			if ( isset( $form->options[ $name ] ) ) {
797
-				$action->post_content[ $name ] = $form->options[ $name ];
798
-				unset( $form->options[ $name ] );
796
+			if ( isset( $form->options[$name] ) ) {
797
+				$action->post_content[$name] = $form->options[$name];
798
+				unset( $form->options[$name] );
799 799
 			}
800 800
 		}
801 801
 
@@ -861,7 +861,7 @@  discard block
 block discarded – undo
861 861
 				$stop = $stop ? false : true;
862 862
 			}
863 863
 
864
-			$met[ $stop ] = $stop;
864
+			$met[$stop] = $stop;
865 865
 		}//end foreach
866 866
 
867 867
 		if ( $notification['conditions']['any_all'] == 'all' && ! empty( $met ) && isset( $met[0] ) && isset( $met[1] ) ) {
@@ -915,8 +915,8 @@  discard block
 block discarded – undo
915 915
 	private static function get_value_from_entry( $entry, $field_id ) {
916 916
 		$observed_value = '';
917 917
 
918
-		if ( isset( $entry->metas[ $field_id ] ) ) {
919
-			$observed_value = $entry->metas[ $field_id ];
918
+		if ( isset( $entry->metas[$field_id] ) ) {
919
+			$observed_value = $entry->metas[$field_id];
920 920
 		} elseif ( $entry->post_id && FrmAppHelper::pro_is_installed() ) {
921 921
 			$field          = FrmField::getOne( $field_id );
922 922
 			$observed_value = FrmProEntryMetaHelper::get_post_or_meta_value(
Please login to merge, or discard this patch.
classes/models/FrmEmailStats.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 	 * @param array $stats Statistics section data.
141 141
 	 */
142 142
 	protected function add_payments_data( &$stats ) {
143
-		$payment_data  = FrmEmailSummaryHelper::get_payments_data( $this->from_date, $this->to_date );
143
+		$payment_data = FrmEmailSummaryHelper::get_payments_data( $this->from_date, $this->to_date );
144 144
 		$stats['payments_count'] = array(
145 145
 			'label'   => __( 'Payments collected', 'formidable' ),
146 146
 			'count'   => $payment_data['count'],
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 
150 150
 		// Build total for each currency.
151 151
 		foreach ( $payment_data['total'] as $currency => $amount ) {
152
-			$stats[ 'payments_total_' . $currency ] = array(
152
+			$stats['payments_total_' . $currency] = array(
153 153
 				// translators: currency name.
154 154
 				'label'   => sprintf( __( 'Total %s', 'formidable' ), strtoupper( $currency ) ),
155 155
 				'count'   => $amount,
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 		}
160 160
 
161 161
 		if ( $this->has_comparison ) {
162
-			$prev_payment_data  = FrmEmailSummaryHelper::get_payments_data( $this->prev_from_date, $this->prev_to_date );
162
+			$prev_payment_data = FrmEmailSummaryHelper::get_payments_data( $this->prev_from_date, $this->prev_to_date );
163 163
 
164 164
 			if ( ! $payment_data['count'] && ! $prev_payment_data['count'] ) {
165 165
 				// Maybe this site doesn't collect payment, hide these sections.
@@ -171,23 +171,23 @@  discard block
 block discarded – undo
171 171
 
172 172
 			// Compare total for each currency.
173 173
 			foreach ( $payment_data['total'] as $currency => $amount ) {
174
-				if ( ! isset( $prev_payment_data['total'][ $currency ] ) ) {
175
-					$stats[ 'payments_total_' . $currency ]['compare'] = 1;
174
+				if ( ! isset( $prev_payment_data['total'][$currency] ) ) {
175
+					$stats['payments_total_' . $currency]['compare'] = 1;
176 176
 					continue;
177 177
 				}
178 178
 
179
-				$stats[ 'payments_total_' . $currency ]['compare'] = $this->get_compare_diff( $amount, $prev_payment_data['total'][ $currency ] );
180
-				unset( $prev_payment_data['total'][ $currency ] );
179
+				$stats['payments_total_' . $currency]['compare'] = $this->get_compare_diff( $amount, $prev_payment_data['total'][$currency] );
180
+				unset( $prev_payment_data['total'][$currency] );
181 181
 			}
182 182
 
183 183
 			// If prev month has more currencies.
184 184
 			foreach ( $prev_payment_data['total'] as $currency => $amount ) {
185
-				$stats[ 'payments_total_' . $currency ] = array(
185
+				$stats['payments_total_' . $currency] = array(
186 186
 					// translators: currency name.
187 187
 					'label'   => sprintf( __( 'Total %s', 'formidable' ), strtoupper( $currency ) ),
188 188
 					'count'   => 0,
189 189
 					'display' => $this->get_formatted_price( 0, $currency ),
190
-					'compare' => -1,
190
+					'compare' => - 1,
191 191
 				);
192 192
 			}
193 193
 		}//end if
Please login to merge, or discard this patch.
classes/models/FrmFieldFormHtml.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
 	 * @param array  $atts
45 45
 	 */
46 46
 	private function _set( $param, $atts ) {
47
-		if ( isset( $atts[ $param ] ) ) {
48
-			$this->{$param} = $atts[ $param ];
47
+		if ( isset( $atts[$param] ) ) {
48
+			$this->{$param} = $atts[$param];
49 49
 		}
50 50
 	}
51 51
 
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
 
90 90
 		$exclude = array( 'field_obj', 'html' );
91 91
 		foreach ( $exclude as $ex ) {
92
-			if ( isset( $atts[ $ex ] ) ) {
93
-				unset( $this->pass_args[ $ex ] );
92
+			if ( isset( $atts[$ex] ) ) {
93
+				unset( $this->pass_args[$ex] );
94 94
 			}
95 95
 		}
96 96
 	}
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
 	 * @param array $set
103 103
 	 */
104 104
 	private function set_from_field( $atts, $set ) {
105
-		if ( isset( $atts[ $set['param'] ] ) ) {
106
-			$this->{$set['param']} = $atts[ $set['param'] ];
105
+		if ( isset( $atts[$set['param']] ) ) {
106
+			$this->{$set['param']} = $atts[$set['param']];
107 107
 		} else {
108 108
 			$this->{$set['param']} = $this->field_obj->get_field_column( $set['default'] );
109 109
 		}
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 	 */
231 231
 	private function replace_error_shortcode() {
232 232
 		$this->maybe_add_error_id();
233
-		$error = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? $this->pass_args['errors'][ 'field' . $this->field_id ] : false;
233
+		$error = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? $this->pass_args['errors']['field' . $this->field_id] : false;
234 234
 
235 235
 		if ( ! empty( $error ) && false === strpos( $this->html, 'role="alert"' ) && FrmAppHelper::should_include_alert_role_on_field_errors() ) {
236 236
 			$error_body = self::get_error_body( $this->html );
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 	 * @since 3.06.02
272 272
 	 */
273 273
 	private function maybe_add_error_id() {
274
-		if ( ! isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ) {
274
+		if ( ! isset( $this->pass_args['errors']['field' . $this->field_id] ) ) {
275 275
 			return;
276 276
 		}
277 277
 
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 		preg_match_all( "/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $this->html, $shortcodes, PREG_PATTERN_ORDER );
352 352
 
353 353
 		foreach ( $shortcodes[0] as $short_key => $tag ) {
354
-			$shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] );
354
+			$shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][$short_key] );
355 355
 			$tag            = FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key );
356 356
 
357 357
 			$replace_with = '';
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
 				$replace_with = $this->replace_input_shortcode( $shortcode_atts );
363 363
 			}
364 364
 
365
-			$this->html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $this->html );
365
+			$this->html = str_replace( $shortcodes[0][$short_key], $replace_with, $this->html );
366 366
 		}
367 367
 	}
368 368
 
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 			unset( $shortcode_atts['class'] );
395 395
 		}
396 396
 
397
-		$shortcode_atts['aria-invalid'] = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? 'true' : 'false';
397
+		$shortcode_atts['aria-invalid'] = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? 'true' : 'false';
398 398
 
399 399
 		$this->field_obj->set_field_column( 'shortcodes', $shortcode_atts );
400 400
 
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
 	 */
447 447
 	private function get_field_div_classes() {
448 448
 		// Add error class
449
-		$classes = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? ' frm_blank_field' : '';
449
+		$classes = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? ' frm_blank_field' : '';
450 450
 
451 451
 		// Add label position class
452 452
 		$settings = $this->field_obj->display_field_settings();
Please login to merge, or discard this patch.
classes/models/fields/FrmFieldNumber.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 
71 71
 		// Validate the number format.
72 72
 		if ( ! is_numeric( $args['value'] ) && '' !== $args['value'] ) {
73
-			$errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' );
73
+			$errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' );
74 74
 		}
75 75
 
76 76
 		// validate number settings
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
 			if ( $frm_settings->use_html && $maxnum !== '' && $minnum !== '' ) {
83 83
 				$value = (float) $args['value'];
84 84
 				if ( $value < $minnum ) {
85
-					$errors[ 'field' . $args['id'] ] = __( 'Please select a higher number', 'formidable' );
85
+					$errors['field' . $args['id']] = __( 'Please select a higher number', 'formidable' );
86 86
 				} elseif ( $value > $maxnum ) {
87
-					$errors[ 'field' . $args['id'] ] = __( 'Please select a lower number', 'formidable' );
87
+					$errors['field' . $args['id']] = __( 'Please select a lower number', 'formidable' );
88 88
 				}
89 89
 			}
90 90
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 * @return void
106 106
 	 */
107 107
 	private function validate_step( &$errors, $args ) {
108
-		if ( isset( $errors[ 'field' . $args['id'] ] ) ) {
108
+		if ( isset( $errors['field' . $args['id']] ) ) {
109 109
 			// Don't need to check if value is invalid before.
110 110
 			return;
111 111
 		}
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 			return;
121 121
 		}
122 122
 
123
-		$errors[ 'field' . $args['id'] ] = sprintf(
123
+		$errors['field' . $args['id']] = sprintf(
124 124
 			// Translators: %1$s: the first nearest value; %2$s: the second nearest value.
125 125
 			__( 'Please enter a valid value. Two nearest valid values are %1$s and %2$s', 'formidable' ),
126 126
 			floatval( $result[0] ),
Please login to merge, or discard this patch.
classes/models/FrmForm.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 			}
210 210
 
211 211
 			if ( $new_val !== $value ) {
212
-				$new_values[ $key ] = $new_val;
212
+				$new_values[$key] = $new_val;
213 213
 			}
214 214
 		}//end foreach
215 215
 
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 
241 241
 		foreach ( $values as $value_key => $value ) {
242 242
 			if ( $value_key && in_array( $value_key, $form_fields ) ) {
243
-				$new_values[ $value_key ] = $value;
243
+				$new_values[$value_key] = $value;
244 244
 			}
245 245
 		}
246 246
 
@@ -323,15 +323,15 @@  discard block
 block discarded – undo
323 323
 		$existing_keys = array_keys( $values['item_meta'] );
324 324
 		foreach ( $all_fields as $fid ) {
325 325
 			if ( ! in_array( $fid->id, $existing_keys ) && ( isset( $values['frm_fields_submitted'] ) && in_array( $fid->id, $values['frm_fields_submitted'] ) ) || isset( $values['options'] ) ) {
326
-				$values['item_meta'][ $fid->id ] = '';
326
+				$values['item_meta'][$fid->id] = '';
327 327
 			}
328
-			$field_array[ $fid->id ] = $fid;
328
+			$field_array[$fid->id] = $fid;
329 329
 		}
330 330
 		unset( $all_fields );
331 331
 
332 332
 		foreach ( $values['item_meta'] as $field_id => $default_value ) {
333
-			if ( isset( $field_array[ $field_id ] ) ) {
334
-				$field = $field_array[ $field_id ];
333
+			if ( isset( $field_array[$field_id] ) ) {
334
+				$field = $field_array[$field_id];
335 335
 			} else {
336 336
 				$field = FrmField::getOne( $field_id );
337 337
 			}
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 				continue;
341 341
 			}
342 342
 
343
-			$is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options'][ 'custom_html_' . $field_id ] ) );
343
+			$is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options']['custom_html_' . $field_id] ) );
344 344
 			if ( $is_settings_page ) {
345 345
 				self::get_settings_page_html( $values, $field );
346 346
 
@@ -356,22 +356,22 @@  discard block
 block discarded – undo
356 356
 			$update_options = apply_filters( 'frm_field_options_to_update', $update_options );
357 357
 
358 358
 			foreach ( $update_options as $opt => $default ) {
359
-				$field->field_options[ $opt ] = isset( $values['field_options'][ $opt . '_' . $field_id ] ) ? $values['field_options'][ $opt . '_' . $field_id ] : $default;
360
-				self::sanitize_field_opt( $opt, $field->field_options[ $opt ] );
359
+				$field->field_options[$opt] = isset( $values['field_options'][$opt . '_' . $field_id] ) ? $values['field_options'][$opt . '_' . $field_id] : $default;
360
+				self::sanitize_field_opt( $opt, $field->field_options[$opt] );
361 361
 			}
362 362
 
363 363
 			$field->field_options = apply_filters( 'frm_update_field_options', $field->field_options, $field, $values );
364 364
 
365 365
 			$new_field = array(
366 366
 				'field_options' => $field->field_options,
367
-				'default_value' => isset( $values[ 'default_value_' . $field_id ] ) ? FrmAppHelper::maybe_json_encode( $values[ 'default_value_' . $field_id ] ) : '',
367
+				'default_value' => isset( $values['default_value_' . $field_id] ) ? FrmAppHelper::maybe_json_encode( $values['default_value_' . $field_id] ) : '',
368 368
 			);
369 369
 
370
-			if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options'][ 'options_' . $field_id ] ) && is_array( $values['field_options'][ 'options_' . $field_id ] ) ) {
371
-				foreach ( $values['field_options'][ 'options_' . $field_id ] as $option_key => $option ) {
370
+			if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options']['options_' . $field_id] ) && is_array( $values['field_options']['options_' . $field_id] ) ) {
371
+				foreach ( $values['field_options']['options_' . $field_id] as $option_key => $option ) {
372 372
 					if ( is_array( $option ) ) {
373 373
 						foreach ( $option as $key => $item ) {
374
-							$values['field_options'][ 'options_' . $field_id ][ $option_key ][ $key ] = FrmAppHelper::kses( $item, 'all' );
374
+							$values['field_options']['options_' . $field_id][$option_key][$key] = FrmAppHelper::kses( $item, 'all' );
375 375
 						}
376 376
 					}
377 377
 				}
@@ -401,8 +401,8 @@  discard block
 block discarded – undo
401 401
 	 */
402 402
 	private static function maybe_update_max_option( $field, $values, &$new_field ) {
403 403
 		if ( $field->type === 'textarea' &&
404
-			! empty( $values['field_options'][ 'type_' . $field->id ] ) &&
405
-			in_array( $values['field_options'][ 'type_' . $field->id ], array( 'text', 'email', 'url', 'password', 'phone' ), true ) ) {
404
+			! empty( $values['field_options']['type_' . $field->id] ) &&
405
+			in_array( $values['field_options']['type_' . $field->id], array( 'text', 'email', 'url', 'password', 'phone' ), true ) ) {
406 406
 
407 407
 			$new_field['field_options']['max'] = '';
408 408
 
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 			 * Update posted field setting so that new 'max' option is displayed after form is saved and page reloads.
411 411
 			 * FrmFieldsHelper::fill_default_field_opts populates field options by calling self::get_posted_field_setting.
412 412
 			 */
413
-			$_POST['field_options'][ 'max_' . $field->id ] = '';
413
+			$_POST['field_options']['max_' . $field->id] = '';
414 414
 		}
415 415
 	}
416 416
 
@@ -486,11 +486,11 @@  discard block
 block discarded – undo
486 486
 	 * Updating the settings page
487 487
 	 */
488 488
 	private static function get_settings_page_html( $values, &$field ) {
489
-		if ( isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ) {
489
+		if ( isset( $values['field_options']['custom_html_' . $field->id] ) ) {
490 490
 			$prev_opts     = array();
491 491
 			$fallback_html = isset( $field->field_options['custom_html'] ) ? $field->field_options['custom_html'] : FrmFieldsHelper::get_default_html( $field->type );
492 492
 
493
-			$field->field_options['custom_html'] = isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ? $values['field_options'][ 'custom_html_' . $field->id ] : $fallback_html;
493
+			$field->field_options['custom_html'] = isset( $values['field_options']['custom_html_' . $field->id] ) ? $values['field_options']['custom_html_' . $field->id] : $fallback_html;
494 494
 		} elseif ( $field->type == 'hidden' || $field->type == 'user_id' ) {
495 495
 			$prev_opts = $field->field_options;
496 496
 		}
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
 		foreach ( $field_cols as $col => $default ) {
517 517
 			$default = ( $default === '' ) ? $field->{$col} : $default;
518 518
 
519
-			$new_field[ $col ] = isset( $values['field_options'][ $col . '_' . $field->id ] ) ? $values['field_options'][ $col . '_' . $field->id ] : $default;
519
+			$new_field[$col] = isset( $values['field_options'][$col . '_' . $field->id] ) ? $values['field_options'][$col . '_' . $field->id] : $default;
520 520
 		}
521 521
 
522 522
 		// Don't save the template option.
@@ -941,8 +941,8 @@  discard block
 block discarded – undo
941 941
 			self::maybe_get_form( $form );
942 942
 		}
943 943
 
944
-		if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][ $form->id ] ) ) {
945
-			return $frm_vars['form_params'][ $form->id ];
944
+		if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][$form->id] ) ) {
945
+			return $frm_vars['form_params'][$form->id];
946 946
 		}
947 947
 
948 948
 		$action_var = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; // phpcs:ignore WordPress.Security.NonceVerification.Missing
@@ -971,15 +971,15 @@  discard block
 block discarded – undo
971 971
 			// If there are two forms on the same page, make sure not to submit both.
972 972
 			foreach ( $default_values as $var => $default ) {
973 973
 				if ( $var == 'action' ) {
974
-					$values[ $var ] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' );
974
+					$values[$var] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' );
975 975
 				} else {
976
-					$values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
976
+					$values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
977 977
 				}
978 978
 				unset( $var, $default );
979 979
 			}
980 980
 		} else {
981 981
 			foreach ( $default_values as $var => $default ) {
982
-				$values[ $var ] = $default;
982
+				$values[$var] = $default;
983 983
 				unset( $var, $default );
984 984
 			}
985 985
 		}
@@ -1005,7 +1005,7 @@  discard block
 block discarded – undo
1005 1005
 			'sdir'     => '',
1006 1006
 		);
1007 1007
 		foreach ( $defaults as $var => $default ) {
1008
-			$values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
1008
+			$values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
1009 1009
 		}
1010 1010
 
1011 1011
 		return $values;
@@ -1033,7 +1033,7 @@  discard block
 block discarded – undo
1033 1033
 			'keep_post' => '',
1034 1034
 		);
1035 1035
 		foreach ( $defaults as $var => $default ) {
1036
-			$values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
1036
+			$values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
1037 1037
 		}
1038 1038
 
1039 1039
 		return $values;
@@ -1136,7 +1136,7 @@  discard block
 block discarded – undo
1136 1136
 		$form = $atts['form'];
1137 1137
 		$default = isset( $atts['default'] ) ? $atts['default'] : '';
1138 1138
 
1139
-		return isset( $form->options[ $atts['option'] ] ) ? $form->options[ $atts['option'] ] : $default;
1139
+		return isset( $form->options[$atts['option']] ) ? $form->options[$atts['option']] : $default;
1140 1140
 	}
1141 1141
 
1142 1142
 	/**
Please login to merge, or discard this patch.
classes/models/FrmFormTemplateApi.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 
6 6
 class FrmFormTemplateApi extends FrmFormApi {
7 7
 
8
-	protected static $code_option_name  = 'frm_free_license_code';
8
+	protected static $code_option_name = 'frm_free_license_code';
9 9
 
10 10
 	private static $base_api_url = 'https://formidableforms.com/wp-json/form-templates/v1/';
11 11
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 
90 90
 		$templates    = $this->get_api_info();
91 91
 		$contact_form = 20872734;
92
-		return isset( $templates[ $contact_form ] ) && ! empty( $templates[ $contact_form ]['url'] );
92
+		return isset( $templates[$contact_form] ) && ! empty( $templates[$contact_form]['url'] );
93 93
 	}
94 94
 
95 95
 	/**
@@ -164,15 +164,15 @@  discard block
 block discarded – undo
164 164
 					continue;
165 165
 				}
166 166
 
167
-				$data['urlByKey'][ $template['key'] ] = $template['url'];
167
+				$data['urlByKey'][$template['key']] = $template['url'];
168 168
 			}
169 169
 
170
-			if ( ! isset( $data['urlByKey'][ $key ] ) ) {
170
+			if ( ! isset( $data['urlByKey'][$key] ) ) {
171 171
 				$error = new WP_Error( 400, 'We were unable to retrieve the template' );
172 172
 				wp_send_json_error( $error );
173 173
 			}
174 174
 
175
-			$data['url'] = $data['urlByKey'][ $key ];
175
+			$data['url'] = $data['urlByKey'][$key];
176 176
 		}//end if
177 177
 
178 178
 		wp_send_json_success( $data );
Please login to merge, or discard this patch.