Completed
Branch 3.0 (1aee71)
by Stephanie
03:09
created
classes/models/fields/FrmFieldType.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	protected function set_type( $type ) {
77 77
 		if ( empty( $this->type ) ) {
78
-			$this->type = $this->get_field_column('type');
78
+			$this->type = $this->get_field_column( 'type' );
79 79
 			if ( empty( $this->type ) && ! empty( $type ) ) {
80 80
 				$this->type = $type;
81 81
 			}
@@ -91,8 +91,8 @@  discard block
 block discarded – undo
91 91
 		$field_val = '';
92 92
 		if ( is_object( $this->field ) ) {
93 93
 			$field_val = $this->field->{$column};
94
-		} elseif ( is_array( $this->field ) && isset( $this->field[ $column ] ) ) {
95
-			$field_val = $this->field[ $column ];
94
+		} elseif ( is_array( $this->field ) && isset( $this->field[$column] ) ) {
95
+			$field_val = $this->field[$column];
96 96
 		}
97 97
 		return $field_val;
98 98
 	}
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 		if ( is_object( $this->field ) ) {
106 106
 			$this->field->{$column} = $value;
107 107
 		} elseif ( is_array( $this->field ) ) {
108
-			$this->field[ $column ] = $value;
108
+			$this->field[$column] = $value;
109 109
 		}
110 110
 	}
111 111
 
@@ -197,16 +197,16 @@  discard block
 block discarded – undo
197 197
 	}
198 198
 
199 199
 	protected function builder_text_field() {
200
-		return '<input type="text" name="' . esc_attr( $this->html_name() ) . '" id="' . esc_attr( $this->html_id() ) . '" value="' . esc_attr( $this->get_field_column('default_value') ) . '" class="dyn_default_value" />';
200
+		return '<input type="text" name="' . esc_attr( $this->html_name() ) . '" id="' . esc_attr( $this->html_id() ) . '" value="' . esc_attr( $this->get_field_column( 'default_value' ) ) . '" class="dyn_default_value" />';
201 201
 	}
202 202
 
203 203
 	protected function html_name( $name = '' ) {
204 204
 		$prefix = empty( $name ) ? 'item_meta' : $name;
205
-		return $prefix . '[' . $this->get_field_column('id') . ']';
205
+		return $prefix . '[' . $this->get_field_column( 'id' ) . ']';
206 206
 	}
207 207
 
208 208
 	protected function html_id( $plus = '' ) {
209
-		return apply_filters( 'frm_field_get_html_id', 'field_' . $this->get_field_column('field_key') . $plus, $this->field );
209
+		return apply_filters( 'frm_field_get_html_id', 'field_' . $this->get_field_column( 'field_key' ) . $plus, $this->field );
210 210
     }
211 211
 
212 212
 	public function display_field_settings() {
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 	}
297 297
 
298 298
 	protected function default_invalid_msg() {
299
-		$field_name = $this->get_field_column('name');
299
+		$field_name = $this->get_field_column( 'name' );
300 300
 		if ( $field_name == '' ) {
301 301
 			$invalid = __( 'This field is invalid', 'formidable' );
302 302
 		} else {
@@ -312,8 +312,8 @@  discard block
 block discarded – undo
312 312
 		$fields = FrmField::field_selection();
313 313
 		$fields = array_merge( $fields, FrmField::pro_field_selection() );
314 314
 
315
-		if ( isset( $fields[ $this->type ] ) ) {
316
-			$name = is_array( $fields[ $this->type ] ) ? $fields[ $this->type ]['name'] : $fields[ $this->type ];
315
+		if ( isset( $fields[$this->type] ) ) {
316
+			$name = is_array( $fields[$this->type] ) ? $fields[$this->type]['name'] : $fields[$this->type];
317 317
 		}
318 318
 
319 319
 		return $name;
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 	}
419 419
 
420 420
 	public function get_label_class() {
421
-		return $this->get_field_column('label');
421
+		return $this->get_field_column( 'label' );
422 422
 	}
423 423
 
424 424
 	/**
@@ -480,8 +480,8 @@  discard block
 block discarded – undo
480 480
 
481 481
 	protected function fill_display_field_values( $args = array() ) {
482 482
 		$defaults = array(
483
-			'field_name'    => 'item_meta[' . $this->get_field_column('id') . ']',
484
-			'field_id'      => $this->get_field_column('id'),
483
+			'field_name'    => 'item_meta[' . $this->get_field_column( 'id' ) . ']',
484
+			'field_id'      => $this->get_field_column( 'id' ),
485 485
 			'field_plus_id' => '',
486 486
 			'section_id'    => '',
487 487
 		);
@@ -518,8 +518,8 @@  discard block
 block discarded – undo
518 518
 		$value = $this->prepare_display_value( $value, $atts );
519 519
 
520 520
 		if ( is_array( $value ) ) {
521
-			if ( isset( $atts['show'] ) && $atts['show'] && isset( $value[ $atts['show'] ] ) ) {
522
-				$value = $value[ $atts['show'] ];
521
+			if ( isset( $atts['show'] ) && $atts['show'] && isset( $value[$atts['show']] ) ) {
522
+				$value = $value[$atts['show']];
523 523
 			} elseif ( ! isset( $atts['return_array'] ) || ! $atts['return_array'] ) {
524 524
 				$sep = isset( $atts['sep'] ) ? $atts['sep'] : ', ';
525 525
 				$value = implode( $sep, $value );
@@ -578,8 +578,8 @@  discard block
 block discarded – undo
578 578
 		$saved_entries = $atts['ids'];
579 579
 		$new_value = array();
580 580
 		foreach ( (array) $value as $old_child_id ) {
581
-			if ( isset( $saved_entries[ $old_child_id ] ) ) {
582
-				$new_value[] = $saved_entries[ $old_child_id ];
581
+			if ( isset( $saved_entries[$old_child_id] ) ) {
582
+				$new_value[] = $saved_entries[$old_child_id];
583 583
 			}
584 584
 		}
585 585
 
Please login to merge, or discard this patch.
classes/models/FrmFieldFormHtml.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
 	 * @param array $atts
42 42
 	 */
43 43
 	private function _set( $param, $atts ) {
44
-		if ( isset( $atts[ $param ] ) ) {
45
-			$this->{$param} = $atts[ $param ];
44
+		if ( isset( $atts[$param] ) ) {
45
+			$this->{$param} = $atts[$param];
46 46
 		}
47 47
 	}
48 48
 
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
 		$exclude = array( 'field_obj', 'html' );
75 75
 		
76 76
 		foreach ( $exclude as $ex ) {
77
-			if ( isset( $atts[ $ex ] ) ) {
78
-				unset( $this->pass_args[ $ex ] );
77
+			if ( isset( $atts[$ex] ) ) {
78
+				unset( $this->pass_args[$ex] );
79 79
 			}
80 80
 		}
81 81
 	}
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 	 * @param array $set
88 88
 	 */
89 89
 	private function set_from_field( $atts, $set ) {
90
-		if ( isset( $atts[ $set['param'] ] ) ) {
91
-			$this->{$set['param']} = $atts[ $set['param'] ];
90
+		if ( isset( $atts[$set['param']] ) ) {
91
+			$this->{$set['param']} = $atts[$set['param']];
92 92
 		} else {
93 93
 			$this->{$set['param']} = $this->field_obj->get_field_column( $set['default'] );
94 94
 		}
@@ -133,17 +133,17 @@  discard block
 block discarded – undo
133 133
 		$this->html = str_replace( 'field_[key]', $this->html_id, $this->html );
134 134
 
135 135
 		//replace [key]
136
-		$this->html = str_replace( '[key]', $this->field_obj->get_field_column('field_key'), $this->html );
136
+		$this->html = str_replace( '[key]', $this->field_obj->get_field_column( 'field_key' ), $this->html );
137 137
 
138 138
 		//replace [field_name]
139
-		$this->html = str_replace('[field_name]', $this->field_obj->get_field_column('name'), $this->html );
139
+		$this->html = str_replace( '[field_name]', $this->field_obj->get_field_column( 'name' ), $this->html );
140 140
 	}
141 141
 
142 142
 	/**
143 143
 	 * @since 3.0
144 144
 	 */
145 145
 	private function replace_required_label_shortcode() {
146
-		$required = FrmField::is_required( $this->field_obj->get_field() ) ? $this->field_obj->get_field_column('required_indicator') : '';
146
+		$required = FrmField::is_required( $this->field_obj->get_field() ) ? $this->field_obj->get_field_column( 'required_indicator' ) : '';
147 147
 		FrmShortcodeHelper::remove_inline_conditions( ! empty( $required ), 'required_label', $required, $this->html );
148 148
 	}
149 149
 
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	 * @since 3.0
152 152
 	 */
153 153
 	private function replace_description_shortcode() {
154
-		$description = $this->field_obj->get_field_column('description');
154
+		$description = $this->field_obj->get_field_column( 'description' );
155 155
 		FrmShortcodeHelper::remove_inline_conditions( ( $description && $description != '' ), 'description', $description, $this->html );
156 156
 	}
157 157
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 	 * @since 3.0
160 160
 	 */
161 161
 	private function replace_error_shortcode() {
162
-		$error = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? $this->pass_args['errors'][ 'field' . $this->field_id ] : false;
162
+		$error = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? $this->pass_args['errors']['field' . $this->field_id] : false;
163 163
 		FrmShortcodeHelper::remove_inline_conditions( ! empty( $error ), 'error', $error, $this->html );
164 164
 	}
165 165
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 		$this->html .= "\n";
196 196
 
197 197
 		//Return html if conf_field to prevent loop
198
-		if ( $this->field_obj->get_field_column('conf_field') == 'stop' ) {
198
+		if ( $this->field_obj->get_field_column( 'conf_field' ) == 'stop' ) {
199 199
 			return;
200 200
 		}
201 201
 
@@ -231,10 +231,10 @@  discard block
 block discarded – undo
231 231
 	 * @since 3.0
232 232
 	 */
233 233
 	private function replace_shortcodes_with_atts() {
234
-		preg_match_all("/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $this->html, $shortcodes, PREG_PATTERN_ORDER);
234
+		preg_match_all( "/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $this->html, $shortcodes, PREG_PATTERN_ORDER );
235 235
 
236 236
 		foreach ( $shortcodes[0] as $short_key => $tag ) {
237
-			$shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] );
237
+			$shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][$short_key] );
238 238
 			$tag = FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key, array( 'conditional' => false, 'conditional_check' => false ) );
239 239
 
240 240
 			$replace_with = '';
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 				$replace_with = $this->replace_input_shortcode( $shortcode_atts );
246 246
 			}
247 247
 
248
-			$this->html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $this->html );
248
+			$this->html = str_replace( $shortcodes[0][$short_key], $replace_with, $this->html );
249 249
 		}
250 250
 	}
251 251
 
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 	 */
267 267
 	private function prepare_input_shortcode_atts( $shortcode_atts ) {
268 268
 		if ( isset( $shortcode_atts['opt'] ) ) {
269
-			$shortcode_atts['opt']--;
269
+			$shortcode_atts['opt'] --;
270 270
 		}
271 271
 
272 272
 		$field_class = isset( $shortcode_atts['class'] ) ? $shortcode_atts['class'] : '';
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 	private function add_class_to_label() {
291 291
 		$label_class = $this->field_obj->get_label_class();
292 292
 		$this->html = str_replace( '[label_position]', $label_class, $this->html );
293
-		if ( $this->field_obj->get_field_column('label') == 'inside' && $this->field_obj->get_field_column('value') != '' ) {
293
+		if ( $this->field_obj->get_field_column( 'label' ) == 'inside' && $this->field_obj->get_field_column( 'value' ) != '' ) {
294 294
 			$this->html = str_replace( 'frm_primary_label', 'frm_primary_label frm_visible', $this->html );
295 295
 		}
296 296
 	}
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 	private function add_field_div_classes() {
314 314
 		$classes = $this->get_field_div_classes();
315 315
 
316
-		if ( $this->field_obj->get_field_column('type') == 'html' && strpos( $this->html, '[error_class]' ) === false ) {
316
+		if ( $this->field_obj->get_field_column( 'type' ) == 'html' && strpos( $this->html, '[error_class]' ) === false ) {
317 317
 			// there is no error_class shortcode for HTML fields
318 318
 			$this->html = str_replace( 'class="frm_form_field', 'class="frm_form_field ' . $classes, $this->html );
319 319
 		}
@@ -330,15 +330,15 @@  discard block
 block discarded – undo
330 330
 	 */
331 331
 	private function get_field_div_classes() {
332 332
 		// Add error class
333
-		$classes = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? ' frm_blank_field' : '';
333
+		$classes = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? ' frm_blank_field' : '';
334 334
 
335 335
 		// Add label position class
336
-		$classes .= ' frm_' . $this->field_obj->get_field_column('label') . '_container';
336
+		$classes .= ' frm_' . $this->field_obj->get_field_column( 'label' ) . '_container';
337 337
 
338 338
 		// Add CSS layout classes
339
-		$extra_classes = $this->field_obj->get_field_column('classes');
339
+		$extra_classes = $this->field_obj->get_field_column( 'classes' );
340 340
 		if ( ! empty( $extra_classes ) ) {
341
-			if ( ! strpos( $this->html, 'frm_form_field ') ) {
341
+			if ( ! strpos( $this->html, 'frm_form_field ' ) ) {
342 342
 				$classes .= ' frm_form_field';
343 343
 			}
344 344
 			$classes .= ' ' . $extra_classes;
Please login to merge, or discard this patch.