Completed
Pull Request — master (#2570)
by
unknown
44s
created
classes/views/frm-fields/back-end/settings.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 				?>
107 107
 				<div class="frm_form_field">
108 108
 					<label for="frm_uniq_field_<?php echo esc_attr( $field['id'] ); ?>" class="frm_help frm-mb-0 <?php echo esc_attr( $pro_is_installed ? '' : 'frm_show_upgrade' ); ?>" title="<?php esc_attr_e( 'Unique: Do not allow the same response multiple times. For example, if one user enters \'Joe\', then no one else will be allowed to enter the same name.', 'formidable' ); ?>" data-trigger="hover">
109
-						<input <?php FrmAppHelper::array_to_html_params(self::get_unique_element_atts( $field, $pro_is_installed, $no_allow ), true ); ?> />
109
+						<input <?php FrmAppHelper::array_to_html_params( self::get_unique_element_atts( $field, $pro_is_installed, $no_allow ), true ); ?> />
110 110
 						<?php esc_html_e( 'Unique', 'formidable' ); ?>
111 111
 					</label>
112 112
 				</div>
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 						if ( FrmAppHelper::pro_is_connected() && ! is_callable( array( 'FrmProHtmlHelper', 'echo_radio_group' ) ) ) {
219 219
 							switch ( $type ) {
220 220
 								case 'calc':
221
-									$default_value_type['data']  = array(
221
+									$default_value_type['data'] = array(
222 222
 										'show'    => '#calc-for-{id}',
223 223
 										'disable' => '#default-value-for-{id}',
224 224
 									);
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 						);
246 246
 
247 247
 						foreach ( $default_value_type['data'] as $data_key => $data_value ) {
248
-							$toggle_args['input_html'][ 'data-' . $data_key ] = $data_value . ( substr( $data_value, -1 ) === '-' ? $field['id'] : '' );
248
+							$toggle_args['input_html']['data-' . $data_key] = $data_value . ( substr( $data_value, -1 ) === '-' ? $field['id'] : '' );
249 249
 						}
250 250
 
251 251
 						?>
Please login to merge, or discard this patch.
classes/controllers/FrmFieldsController.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 		$_GET['page'] = 'formidable';
27 27
 
28
-		$values     = array(
28
+		$values = array(
29 29
 			'id'         => FrmAppHelper::get_post_param( 'form_id', '', 'absint' ),
30 30
 			'doing_ajax' => true,
31 31
 		);
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
 			ob_start();
50 50
 			self::load_single_field( $field, $values );
51
-			$field_html[ absint( $field->id ) ] = ob_get_contents();
51
+			$field_html[absint( $field->id )] = ob_get_contents();
52 52
 			ob_end_clean();
53 53
 		}
54 54
 
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 			foreach ( $opts as $opt_key => $opt ) {
285 285
 				if ( strpos( $opt, '|' ) !== false ) {
286 286
 					$vals             = explode( '|', $opt );
287
-					$opts[ $opt_key ] = array(
287
+					$opts[$opt_key] = array(
288 288
 						'label' => trim( $vals[0] ),
289 289
 						'value' => trim( $vals[1] ),
290 290
 					);
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 			$other_array = array();
300 300
 			foreach ( $field['options'] as $opt_key => $opt ) {
301 301
 				if ( FrmFieldsHelper::is_other_opt( $opt_key ) ) {
302
-					$other_array[ $opt_key ] = $opt;
302
+					$other_array[$opt_key] = $opt;
303 303
 				}
304 304
 				unset( $opt_key, $opt );
305 305
 			}
@@ -343,18 +343,18 @@  discard block
 block discarded – undo
343 343
 		$frm_settings         = FrmAppHelper::get_settings();
344 344
 		$field_types          = FrmFieldTypeOptionData::get_field_types( $field['type'] );
345 345
 
346
-		if ( ! isset( $all_field_types[ $field['type'] ] ) ) {
346
+		if ( ! isset( $all_field_types[$field['type']] ) ) {
347 347
 			// Add fallback for an add-on field type that has been deactivated.
348
-			$all_field_types[ $field['type'] ] = array(
348
+			$all_field_types[$field['type']] = array(
349 349
 				'name' => ucfirst( $field['type'] ),
350 350
 				'icon' => 'frm_icon_font frm_pencil_icon',
351 351
 			);
352
-		} elseif ( ! is_array( $all_field_types[ $field['type'] ] ) ) {
352
+		} elseif ( ! is_array( $all_field_types[$field['type']] ) ) {
353 353
 			// Fallback for fields added in a more basic way.
354
-			FrmFormsHelper::prepare_field_type( $all_field_types[ $field['type'] ] );
354
+			FrmFormsHelper::prepare_field_type( $all_field_types[$field['type']] );
355 355
 		}
356 356
 
357
-		$type_name = $all_field_types[ $field['type'] ]['name'];
357
+		$type_name = $all_field_types[$field['type']]['name'];
358 358
 		if ( $field['type'] === 'divider' && FrmField::is_option_true( $field, 'repeat' ) ) {
359 359
 			$type_name = $all_field_types['divider|repeat']['name'];
360 360
 		}
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 		$no_allow         = ! $pro_is_installed ? 'frm_noallow' : '';
372 372
 
373 373
 		if ( ! $pro_is_installed ) {
374
-			$show_upsell_for_unique_value          = in_array(
374
+			$show_upsell_for_unique_value = in_array(
375 375
 				$field['type'],
376 376
 				array( 'address', 'checkbox', 'email', 'name', 'number', 'phone', 'radio', 'text', 'textarea', 'url' ),
377 377
 				true
@@ -500,14 +500,14 @@  discard block
 block discarded – undo
500 500
 
501 501
 		if ( FrmAppHelper::pro_is_connected() ) {
502 502
 			foreach ( $settings as $type ) {
503
-				if ( ! empty( $field[ $type ] ) ) {
503
+				if ( ! empty( $field[$type] ) ) {
504 504
 					$active = $type;
505 505
 				}
506 506
 			}
507 507
 		}
508 508
 
509
-		$types[ $active ]['class']  .= ' current';
510
-		$types[ $active ]['current'] = true;
509
+		$types[$active]['class']  .= ' current';
510
+		$types[$active]['current'] = true;
511 511
 
512 512
 		return $types;
513 513
 	}
@@ -526,8 +526,8 @@  discard block
 block discarded – undo
526 526
 			'website' => 'url',
527 527
 			'image'   => 'url',
528 528
 		);
529
-		if ( isset( $type_switch[ $type ] ) ) {
530
-			$type = $type_switch[ $type ];
529
+		if ( isset( $type_switch[$type] ) ) {
530
+			$type = $type_switch[$type];
531 531
 		}
532 532
 
533 533
 		$pro_fields = FrmField::pro_field_selection();
@@ -692,11 +692,11 @@  discard block
 block discarded – undo
692 692
 		// include "col" for valid html
693 693
 		$unit = trim( preg_replace( '/[0-9]+/', '', $field['size'] ) );
694 694
 
695
-		if ( ! isset( $calc[ $unit ] ) ) {
695
+		if ( ! isset( $calc[$unit] ) ) {
696 696
 			return;
697 697
 		}
698 698
 
699
-		$size = (float) str_replace( $unit, '', $field['size'] ) / $calc[ $unit ];
699
+		$size = (float) str_replace( $unit, '', $field['size'] ) / $calc[$unit];
700 700
 
701 701
 		$add_html['cols'] = 'cols="' . absint( $size ) . '"';
702 702
 	}
@@ -946,11 +946,11 @@  discard block
 block discarded – undo
946 946
 	private static function get_form_for_js_validation( $field ) {
947 947
 		global $frm_vars;
948 948
 		if ( ! empty( $frm_vars['js_validate_forms'] ) ) {
949
-			if ( isset( $frm_vars['js_validate_forms'][ $field['form_id'] ] ) ) {
950
-				return $frm_vars['js_validate_forms'][ $field['form_id'] ];
949
+			if ( isset( $frm_vars['js_validate_forms'][$field['form_id']] ) ) {
950
+				return $frm_vars['js_validate_forms'][$field['form_id']];
951 951
 			}
952
-			if ( ! empty( $field['parent_form_id'] ) && isset( $frm_vars['js_validate_forms'][ $field['parent_form_id'] ] ) ) {
953
-				return $frm_vars['js_validate_forms'][ $field['parent_form_id'] ];
952
+			if ( ! empty( $field['parent_form_id'] ) && isset( $frm_vars['js_validate_forms'][$field['parent_form_id']] ) ) {
953
+				return $frm_vars['js_validate_forms'][$field['parent_form_id']];
954 954
 			}
955 955
 		}
956 956
 		return false;
@@ -1041,13 +1041,13 @@  discard block
 block discarded – undo
1041 1041
 		foreach ( $field['shortcodes'] as $k => $v ) {
1042 1042
 			if ( isset( $field['subfield_name'] ) && 0 === strpos( $k, 'aria-invalid' ) ) {
1043 1043
 				$subfield_name = $field['subfield_name'];
1044
-				if ( ! isset( $field['shortcodes'][ 'aria-invalid-' . $subfield_name ] ) ) {
1044
+				if ( ! isset( $field['shortcodes']['aria-invalid-' . $subfield_name] ) ) {
1045 1045
 					continue;
1046 1046
 				}
1047 1047
 				// Change the key to the correct aria-invalid value so that $add_html is set correctly for the current subfield of a combo field.
1048 1048
 				$k = 'aria-invalid';
1049
-				$v = $field['shortcodes'][ 'aria-invalid-' . $subfield_name ];
1050
-				unset( $field['shortcodes'][ 'aria-invalid-' . $subfield_name ] );
1049
+				$v = $field['shortcodes']['aria-invalid-' . $subfield_name];
1050
+				unset( $field['shortcodes']['aria-invalid-' . $subfield_name] );
1051 1051
 			}
1052 1052
 			if ( 'opt' === $k || ! self::should_allow_input_attribute( $k ) ) {
1053 1053
 				continue;
@@ -1055,10 +1055,10 @@  discard block
 block discarded – undo
1055 1055
 
1056 1056
 			if ( is_numeric( $k ) && strpos( $v, '=' ) ) {
1057 1057
 				$add_html[] = $v;
1058
-			} elseif ( ! empty( $k ) && isset( $add_html[ $k ] ) ) {
1059
-				$add_html[ $k ] = str_replace( $k . '="', $k . '="' . $v, $add_html[ $k ] );
1058
+			} elseif ( ! empty( $k ) && isset( $add_html[$k] ) ) {
1059
+				$add_html[$k] = str_replace( $k . '="', $k . '="' . $v, $add_html[$k] );
1060 1060
 			} else {
1061
-				$add_html[ $k ] = $k . '="' . esc_attr( $v ) . '"';
1061
+				$add_html[$k] = $k . '="' . esc_attr( $v ) . '"';
1062 1062
 			}
1063 1063
 
1064 1064
 			unset( $k, $v );
Please login to merge, or discard this patch.