Completed
Push — master ( 738060...facbef )
by Stephanie
03:35
created
classes/models/FrmField.php 1 patch
Spacing   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined('ABSPATH') ) {
2
+if ( ! defined( 'ABSPATH' ) ) {
3 3
 	die( 'You are not allowed to call this page directly.' );
4 4
 }
5 5
 
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 	static $transient_size = 200;
9 9
 
10 10
 	public static function field_selection() {
11
-		$fields = apply_filters('frm_available_fields', array(
11
+		$fields = apply_filters( 'frm_available_fields', array(
12 12
 			'text'      => __( 'Single Line Text', 'formidable' ),
13 13
 			'textarea'  => __( 'Paragraph Text', 'formidable' ),
14 14
 			'checkbox'  => __( 'Checkboxes', 'formidable' ),
@@ -17,13 +17,13 @@  discard block
 block discarded – undo
17 17
 			'email'     => __( 'Email Address', 'formidable' ),
18 18
 			'url'       => __( 'Website/URL', 'formidable' ),
19 19
 			'captcha'   => __( 'reCAPTCHA', 'formidable' ),
20
-		));
20
+		) );
21 21
 
22 22
 		return $fields;
23 23
 	}
24 24
 
25 25
 	public static function pro_field_selection() {
26
-		return apply_filters('frm_pro_available_fields', array(
26
+		return apply_filters( 'frm_pro_available_fields', array(
27 27
 			'end_divider' => array(
28 28
 				'name'  => __( 'End Section', 'formidable' ),
29 29
 				'switch_from' => 'divider',
@@ -49,36 +49,36 @@  discard block
 block discarded – undo
49 49
 			//'city_selector' => 'US State/County/City selector',
50 50
 			//'full_name' => 'First and Last Name',
51 51
 			//'quiz'    => 'Question and Answer' // for captcha alternative
52
-		));
52
+		) );
53 53
 	}
54 54
 
55 55
     public static function create( $values, $return = true ) {
56 56
         global $wpdb, $frm_duplicate_ids;
57 57
 
58 58
         $new_values = array();
59
-        $key = isset($values['field_key']) ? $values['field_key'] : $values['name'];
60
-        $new_values['field_key'] = FrmAppHelper::get_unique_key($key, $wpdb->prefix .'frm_fields', 'field_key');
59
+        $key = isset( $values['field_key'] ) ? $values['field_key'] : $values['name'];
60
+        $new_values['field_key'] = FrmAppHelper::get_unique_key( $key, $wpdb->prefix . 'frm_fields', 'field_key' );
61 61
 
62 62
 		foreach ( array( 'name', 'description', 'type', 'default_value' ) as $col ) {
63
-			$new_values[ $col ] = $values[ $col ];
63
+			$new_values[$col] = $values[$col];
64 64
         }
65 65
 
66 66
         $new_values['options'] = $values['options'];
67 67
 
68
-        $new_values['field_order'] = isset($values['field_order']) ? (int) $values['field_order'] : null;
69
-        $new_values['required'] = isset($values['required']) ? (int) $values['required'] : 0;
70
-        $new_values['form_id'] = isset($values['form_id']) ? (int) $values['form_id'] : null;
68
+        $new_values['field_order'] = isset( $values['field_order'] ) ? (int) $values['field_order'] : null;
69
+        $new_values['required'] = isset( $values['required'] ) ? (int) $values['required'] : 0;
70
+        $new_values['form_id'] = isset( $values['form_id'] ) ? (int) $values['form_id'] : null;
71 71
         $new_values['field_options'] = $values['field_options'];
72
-        $new_values['created_at'] = current_time('mysql', 1);
72
+        $new_values['created_at'] = current_time( 'mysql', 1 );
73 73
 
74 74
 		if ( isset( $values['id'] ) ) {
75
-			$frm_duplicate_ids[ $values['field_key'] ] = $new_values['field_key'];
76
-            $new_values = apply_filters('frm_duplicated_field', $new_values);
75
+			$frm_duplicate_ids[$values['field_key']] = $new_values['field_key'];
76
+            $new_values = apply_filters( 'frm_duplicated_field', $new_values );
77 77
         }
78 78
 
79 79
 		foreach ( $new_values as $k => $v ) {
80 80
             if ( is_array( $v ) ) {
81
-				$new_values[ $k ] = serialize( $v );
81
+				$new_values[$k] = serialize( $v );
82 82
 			}
83 83
             unset( $k, $v );
84 84
         }
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         //if(isset($values['id']) and is_numeric($values['id']))
87 87
         //    $new_values['id'] = $values['id'];
88 88
 
89
-        $query_results = $wpdb->insert( $wpdb->prefix .'frm_fields', $new_values );
89
+        $query_results = $wpdb->insert( $wpdb->prefix . 'frm_fields', $new_values );
90 90
 		$new_id = 0;
91 91
 		if ( $query_results ) {
92 92
 			self::delete_form_transient( $new_values['form_id'] );
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 
100 100
 		if ( $query_results ) {
101 101
 			if ( isset( $values['id'] ) ) {
102
-				$frm_duplicate_ids[ $values['id'] ] = $new_id;
102
+				$frm_duplicate_ids[$values['id']] = $new_id;
103 103
 			}
104 104
 			return $new_id;
105 105
 		} else {
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
 		$fields = self::getAll( $where, 'field_order', '', $blog_id );
115 115
 
116 116
         foreach ( (array) $fields as $field ) {
117
-            $new_key = ($copy_keys) ? $field->field_key : '';
118
-            if ( $copy_keys && substr($field->field_key, -1) == 2 ) {
119
-                $new_key = rtrim($new_key, 2);
117
+            $new_key = ( $copy_keys ) ? $field->field_key : '';
118
+            if ( $copy_keys && substr( $field->field_key, -1 ) == 2 ) {
119
+                $new_key = rtrim( $new_key, 2 );
120 120
             }
121 121
 
122 122
             $values = array();
@@ -139,11 +139,11 @@  discard block
 block discarded – undo
139 139
 				$values['form_id'] = $new_repeat_form_id;
140 140
 			}
141 141
 
142
-            $values = apply_filters('frm_duplicated_field', $values);
143
-            $new_id = self::create($values);
144
-            $frm_duplicate_ids[ $field->id ] = $new_id;
145
-            $frm_duplicate_ids[ $field->field_key ] = $new_id;
146
-            unset($field);
142
+            $values = apply_filters( 'frm_duplicated_field', $values );
143
+            $new_id = self::create( $values );
144
+            $frm_duplicate_ids[$field->id] = $new_id;
145
+            $frm_duplicate_ids[$field->field_key] = $new_id;
146
+            unset( $field );
147 147
         }
148 148
     }
149 149
 
@@ -153,10 +153,10 @@  discard block
 block discarded – undo
153 153
 		$id = absint( $id );
154 154
 
155 155
 		if ( isset( $values['field_key'] ) ) {
156
-            $values['field_key'] = FrmAppHelper::get_unique_key($values['field_key'], $wpdb->prefix .'frm_fields', 'field_key', $id);
156
+            $values['field_key'] = FrmAppHelper::get_unique_key( $values['field_key'], $wpdb->prefix . 'frm_fields', 'field_key', $id );
157 157
 		}
158 158
 
159
-        if ( isset($values['required']) ) {
159
+        if ( isset( $values['required'] ) ) {
160 160
             $values['required'] = (int) $values['required'];
161 161
         }
162 162
 
@@ -164,29 +164,29 @@  discard block
 block discarded – undo
164 164
 
165 165
 		// serialize array values
166 166
 		foreach ( array( 'default_value', 'field_options', 'options' ) as $opt ) {
167
-			if ( isset( $values[ $opt ] ) && is_array( $values[ $opt ] ) ) {
168
-				$values[ $opt ] = serialize( $values[ $opt ] );
167
+			if ( isset( $values[$opt] ) && is_array( $values[$opt] ) ) {
168
+				$values[$opt] = serialize( $values[$opt] );
169 169
 			}
170 170
 		}
171 171
 
172
-        $query_results = $wpdb->update( $wpdb->prefix .'frm_fields', $values, array( 'id' => $id ) );
172
+        $query_results = $wpdb->update( $wpdb->prefix . 'frm_fields', $values, array( 'id' => $id ) );
173 173
 
174 174
         $form_id = 0;
175 175
 		if ( isset( $values['form_id'] ) ) {
176 176
             $form_id = absint( $values['form_id'] );
177 177
 		} else {
178
-            $field = self::getOne($id);
178
+            $field = self::getOne( $id );
179 179
             if ( $field ) {
180 180
                 $form_id = $field->form_id;
181 181
             }
182
-            unset($field);
182
+            unset( $field );
183 183
         }
184
-        unset($values);
184
+        unset( $values );
185 185
 
186 186
 		if ( $query_results ) {
187 187
             wp_cache_delete( $id, 'frm_field' );
188 188
             if ( $form_id ) {
189
-                self::delete_form_transient($form_id);
189
+                self::delete_form_transient( $form_id );
190 190
             }
191 191
         }
192 192
 
@@ -224,21 +224,21 @@  discard block
 block discarded – undo
224 224
 
225 225
 	public static function delete_form_transient( $form_id ) {
226 226
 		$form_id = absint( $form_id );
227
-		delete_transient( 'frm_form_fields_'. $form_id .'excludeinclude' );
228
-		delete_transient( 'frm_form_fields_'. $form_id .'includeinclude' );
229
-		delete_transient( 'frm_form_fields_'. $form_id .'includeexclude' );
230
-		delete_transient( 'frm_form_fields_'. $form_id .'excludeexclude' );
227
+		delete_transient( 'frm_form_fields_' . $form_id . 'excludeinclude' );
228
+		delete_transient( 'frm_form_fields_' . $form_id . 'includeinclude' );
229
+		delete_transient( 'frm_form_fields_' . $form_id . 'includeexclude' );
230
+		delete_transient( 'frm_form_fields_' . $form_id . 'excludeexclude' );
231 231
 
232 232
 		global $wpdb;
233
-		$wpdb->query( $wpdb->prepare( 'DELETE FROM '. $wpdb->options .' WHERE option_name LIKE %s OR option_name LIKE %s OR option_name LIKE %s OR option_name LIKE %s', '_transient_timeout_frm_form_fields_' . $form_id .'ex%', '_transient_frm_form_fields_' . $form_id .'ex%', '_transient_timeout_frm_form_fields_' . $form_id .'in%', '_transient_frm_form_fields_' . $form_id .'in%' ) );
233
+		$wpdb->query( $wpdb->prepare( 'DELETE FROM ' . $wpdb->options . ' WHERE option_name LIKE %s OR option_name LIKE %s OR option_name LIKE %s OR option_name LIKE %s', '_transient_timeout_frm_form_fields_' . $form_id . 'ex%', '_transient_frm_form_fields_' . $form_id . 'ex%', '_transient_timeout_frm_form_fields_' . $form_id . 'in%', '_transient_frm_form_fields_' . $form_id . 'in%' ) );
234 234
 
235 235
 		$cache_key = serialize( array( 'fi.form_id' => $form_id ) ) . 'field_orderlb';
236
-        wp_cache_delete($cache_key, 'frm_field');
236
+        wp_cache_delete( $cache_key, 'frm_field' );
237 237
 
238 238
 		// this cache key is autogenerated in FrmDb::get_var
239 239
 		wp_cache_delete( '(__fi.form_id=%d_OR_fr.parent_form_id=%d_)__' . $form_id . '_' . $form_id . '_ORDER_BY_field_orderfi.*__fr.name_as_form_name_results', 'frm_field' );
240 240
 
241
-        $form = FrmForm::getOne($form_id);
241
+        $form = FrmForm::getOne( $form_id );
242 242
         if ( $form && $form->parent_form_id ) {
243 243
             self::delete_form_transient( $form->parent_form_id );
244 244
         }
@@ -260,16 +260,16 @@  discard block
 block discarded – undo
260 260
 
261 261
         global $wpdb;
262 262
 
263
-        $where = is_numeric($id) ? 'id=%d' : 'field_key=%s';
264
-        $query = $wpdb->prepare('SELECT * FROM '. $wpdb->prefix .'frm_fields WHERE '. $where, $id);
263
+        $where = is_numeric( $id ) ? 'id=%d' : 'field_key=%s';
264
+        $query = $wpdb->prepare( 'SELECT * FROM ' . $wpdb->prefix . 'frm_fields WHERE ' . $where, $id );
265 265
 
266 266
         $results = FrmAppHelper::check_cache( $id, 'frm_field', $query, 'get_row', 0 );
267 267
 
268
-        if ( empty($results) ) {
268
+        if ( empty( $results ) ) {
269 269
             return $results;
270 270
         }
271 271
 
272
-        if ( is_numeric($id) ) {
272
+        if ( is_numeric( $id ) ) {
273 273
             wp_cache_set( $results->field_key, $results, 'frm_field' );
274 274
         } else if ( $results ) {
275 275
             wp_cache_set( $results->id, $results, 'frm_field' );
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 
278 278
 		self::prepare_options( $results );
279 279
 
280
-        return stripslashes_deep($results);
280
+        return stripslashes_deep( $results );
281 281
     }
282 282
 
283 283
     /**
@@ -310,20 +310,20 @@  discard block
 block discarded – undo
310 310
                     continue;
311 311
                 }
312 312
 
313
-				$fields[ $result->id ] = $result;
314
-                $count++;
313
+				$fields[$result->id] = $result;
314
+                $count ++;
315 315
                 if ( $limit == 1 ) {
316 316
                     $fields = $result;
317 317
                     break;
318 318
                 }
319 319
 
320
-                if ( ! empty($limit) && $count >= $limit ) {
320
+                if ( ! empty( $limit ) && $count >= $limit ) {
321 321
                     break;
322 322
                 }
323 323
 
324
-                unset($result);
324
+                unset( $result );
325 325
             }
326
-            return stripslashes_deep($fields);
326
+            return stripslashes_deep( $fields );
327 327
         }
328 328
 
329 329
         self::$use_cache = false;
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 		self::maybe_include_repeating_fields( $inc_sub, $where );
333 333
 		$results = self::getAll( $where, 'field_order', $limit );
334 334
         self::$use_cache = true;
335
-        self::include_sub_fields($results, $inc_sub, $type);
335
+        self::include_sub_fields( $results, $inc_sub, $type );
336 336
 
337 337
         return $results;
338 338
     }
@@ -344,15 +344,15 @@  discard block
 block discarded – undo
344 344
 
345 345
 		$results = self::get_fields_from_transients( $form_id, array( 'inc_embed' => $inc_embed, 'inc_repeat' => $inc_repeat ) );
346 346
 		if ( ! empty( $results ) ) {
347
-            if ( empty($limit) ) {
347
+            if ( empty( $limit ) ) {
348 348
 				return $results;
349 349
             }
350 350
 
351 351
             $fields = array();
352 352
             $count = 0;
353 353
             foreach ( $results as $result ) {
354
-				$fields[ $result->id ] = $result;
355
-                if ( ! empty($limit) && $count >= $limit ) {
354
+				$fields[$result->id] = $result;
355
+                if ( ! empty( $limit ) && $count >= $limit ) {
356 356
                     break;
357 357
                 }
358 358
             }
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
 
371 371
 		self::include_sub_fields( $results, $inc_embed, 'all' );
372 372
 
373
-        if ( empty($limit) ) {
373
+        if ( empty( $limit ) ) {
374 374
 			self::set_field_transient( $results, $form_id, 0, array( 'inc_embed' => $inc_embed, 'inc_repeat' => $inc_repeat ) );
375 375
         }
376 376
 
@@ -399,32 +399,32 @@  discard block
 block discarded – undo
399 399
         $form_fields = $results;
400 400
 		$index_offset = 1;
401 401
         foreach ( $form_fields as $k => $field ) {
402
-            if ( 'form' != $field->type || ! isset($field->field_options['form_select']) ) {
402
+            if ( 'form' != $field->type || ! isset( $field->field_options['form_select'] ) ) {
403 403
                 continue;
404 404
             }
405 405
 
406 406
             if ( $type == 'all' ) {
407 407
                 $sub_fields = self::get_all_for_form( $field->field_options['form_select'] );
408 408
             } else {
409
-                $sub_fields = self::get_all_types_in_form($field->form_id, $type);
409
+                $sub_fields = self::get_all_types_in_form( $field->form_id, $type );
410 410
             }
411 411
 
412
-            if ( ! empty($sub_fields) ) {
412
+            if ( ! empty( $sub_fields ) ) {
413 413
 				$index = $k + $index_offset;
414 414
 				$index_offset += count( $sub_fields );
415
-				array_splice($results, $index, 0, $sub_fields);
415
+				array_splice( $results, $index, 0, $sub_fields );
416 416
             }
417
-            unset($field, $sub_fields);
417
+            unset( $field, $sub_fields );
418 418
         }
419 419
     }
420 420
 
421 421
 	public static function getAll( $where = array(), $order_by = '', $limit = '', $blog_id = false ) {
422
-        $cache_key = maybe_serialize($where) . $order_by .'l'. $limit .'b'. $blog_id;
422
+        $cache_key = maybe_serialize( $where ) . $order_by . 'l' . $limit . 'b' . $blog_id;
423 423
         if ( self::$use_cache ) {
424 424
             // make sure old cache doesn't get saved as a transient
425
-            $results = wp_cache_get($cache_key, 'frm_field');
425
+            $results = wp_cache_get( $cache_key, 'frm_field' );
426 426
             if ( false !== $results ) {
427
-                return stripslashes_deep($results);
427
+                return stripslashes_deep( $results );
428 428
             }
429 429
         }
430 430
 
@@ -433,32 +433,32 @@  discard block
 block discarded – undo
433 433
         if ( $blog_id && is_multisite() ) {
434 434
             global $wpmuBaseTablePrefix;
435 435
             if ( $wpmuBaseTablePrefix ) {
436
-                $prefix = $wpmuBaseTablePrefix . $blog_id .'_';
436
+                $prefix = $wpmuBaseTablePrefix . $blog_id . '_';
437 437
             } else {
438 438
                 $prefix = $wpdb->get_blog_prefix( $blog_id );
439 439
             }
440 440
 
441
-            $table_name = $prefix .'frm_fields';
442
-            $form_table_name = $prefix .'frm_forms';
441
+            $table_name = $prefix . 'frm_fields';
442
+            $form_table_name = $prefix . 'frm_forms';
443 443
 		} else {
444
-            $table_name = $wpdb->prefix .'frm_fields';
445
-            $form_table_name = $wpdb->prefix .'frm_forms';
444
+            $table_name = $wpdb->prefix . 'frm_fields';
445
+            $form_table_name = $wpdb->prefix . 'frm_forms';
446 446
         }
447 447
 
448 448
 		if ( ! empty( $order_by ) && strpos( $order_by, 'ORDER BY' ) === false ) {
449
-            $order_by = ' ORDER BY '. $order_by;
449
+            $order_by = ' ORDER BY ' . $order_by;
450 450
 		}
451 451
 
452
-        $limit = FrmAppHelper::esc_limit($limit);
452
+        $limit = FrmAppHelper::esc_limit( $limit );
453 453
 
454 454
         $query = "SELECT fi.*, fr.name as form_name  FROM {$table_name} fi LEFT OUTER JOIN {$form_table_name} fr ON fi.form_id=fr.id";
455 455
         $query_type = ( $limit == ' LIMIT 1' || $limit == 1 ) ? 'row' : 'results';
456 456
 
457
-        if ( is_array($where) ) {
457
+        if ( is_array( $where ) ) {
458 458
             $results = FrmDb::get_var( $table_name . ' fi LEFT OUTER JOIN ' . $form_table_name . ' fr ON fi.form_id=fr.id', $where, 'fi.*, fr.name as form_name', array( 'order_by' => $order_by, 'limit' => $limit ), '', $query_type );
459 459
 		} else {
460 460
 			// if the query is not an array, then it has already been prepared
461
-            $query .= FrmAppHelper::prepend_and_or_where(' WHERE ', $where) . $order_by . $limit;
461
+            $query .= FrmAppHelper::prepend_and_or_where( ' WHERE ', $where ) . $order_by . $limit;
462 462
 
463 463
 			$function_name = ( $query_type == 'row' ) ? 'get_row' : 'get_results';
464 464
 			$results = $wpdb->$function_name( $query );
@@ -481,9 +481,9 @@  discard block
 block discarded – undo
481 481
 				wp_cache_set( $result->id, $result, 'frm_field' );
482 482
 				wp_cache_set( $result->field_key, $result, 'frm_field' );
483 483
 
484
-				$results[ $r_key ]->field_options = maybe_unserialize( $result->field_options );
485
-				$results[ $r_key ]->options = maybe_unserialize( $result->options );
486
-				$results[ $r_key ]->default_value = maybe_unserialize( $result->default_value );
484
+				$results[$r_key]->field_options = maybe_unserialize( $result->field_options );
485
+				$results[$r_key]->options = maybe_unserialize( $result->options );
486
+				$results[$r_key]->default_value = maybe_unserialize( $result->default_value );
487 487
 
488 488
 				unset( $r_key, $result );
489 489
 			}
@@ -502,8 +502,8 @@  discard block
 block discarded – undo
502 502
 	private static function prepare_options( &$results ) {
503 503
 		$results->field_options = maybe_unserialize( $results->field_options );
504 504
 
505
-		$results->options = maybe_unserialize($results->options);
506
-		$results->default_value = maybe_unserialize($results->default_value);
505
+		$results->options = maybe_unserialize( $results->options );
506
+		$results->default_value = maybe_unserialize( $results->default_value );
507 507
 	}
508 508
 
509 509
 	/**
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
 
531 531
 			if ( count( $next_fields ) >= self::$transient_size ) {
532 532
 				// if this transient is full, check for another
533
-				$next++;
533
+				$next ++;
534 534
 				self::get_next_transient( $fields, $base_name, $next );
535 535
 			}
536 536
 		}
@@ -556,24 +556,24 @@  discard block
 block discarded – undo
556 556
 				return;
557 557
 			}
558 558
 
559
-			$next++;
559
+			$next ++;
560 560
 		}
561 561
 	}
562 562
 
563 563
 	public static function getIds( $where = '', $order_by = '', $limit = '' ) {
564 564
 		_deprecated_function( __FUNCTION__, '2.0' );
565 565
         global $wpdb;
566
-        if ( ! empty($order_by) && ! strpos($order_by, 'ORDER BY') !== false ) {
567
-            $order_by = ' ORDER BY '. $order_by;
566
+        if ( ! empty( $order_by ) && ! strpos( $order_by, 'ORDER BY' ) !== false ) {
567
+            $order_by = ' ORDER BY ' . $order_by;
568 568
         }
569 569
 
570
-        $query = 'SELECT fi.id  FROM '. $wpdb->prefix .'frm_fields fi ' .
571
-                 'LEFT OUTER JOIN '. $wpdb->prefix .'frm_forms fr ON fi.form_id=fr.id' .
572
-                 FrmAppHelper::prepend_and_or_where(' WHERE ', $where) . $order_by . $limit;
570
+        $query = 'SELECT fi.id  FROM ' . $wpdb->prefix . 'frm_fields fi ' .
571
+                 'LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_forms fr ON fi.form_id=fr.id' .
572
+                 FrmAppHelper::prepend_and_or_where( ' WHERE ', $where ) . $order_by . $limit;
573 573
 
574 574
         $method = ( $limit == ' LIMIT 1' || $limit == 1 ) ? 'get_var' : 'get_col';
575
-        $cache_key = 'getIds_'. maybe_serialize($where) . $order_by . $limit;
576
-        $results = FrmAppHelper::check_cache($cache_key, 'frm_field', $query, $method);
575
+        $cache_key = 'getIds_' . maybe_serialize( $where ) . $order_by . $limit;
576
+        $results = FrmAppHelper::check_cache( $cache_key, 'frm_field', $query, $method );
577 577
 
578 578
         return $results;
579 579
     }
@@ -600,9 +600,9 @@  discard block
 block discarded – undo
600 600
 		}
601 601
 
602 602
 		if ( is_array( $field ) ) {
603
-			return $field['type'] == 'checkbox' || ( $field['type'] == 'data' && isset($field['data_type']) && $field['data_type'] == 'checkbox' ) || self::is_multiple_select( $field );
603
+			return $field['type'] == 'checkbox' || ( $field['type'] == 'data' && isset( $field['data_type'] ) && $field['data_type'] == 'checkbox' ) || self::is_multiple_select( $field );
604 604
 		} else {
605
-			return $field->type == 'checkbox' || ( $field->type == 'data' && isset( $field->field_options['data_type'] ) && $field->field_options['data_type'] == 'checkbox' ) || self::is_multiple_select($field);
605
+			return $field->type == 'checkbox' || ( $field->type == 'data' && isset( $field->field_options['data_type'] ) && $field->field_options['data_type'] == 'checkbox' ) || self::is_multiple_select( $field );
606 606
 		}
607 607
 	}
608 608
 
@@ -614,9 +614,9 @@  discard block
 block discarded – undo
614 614
 	 */
615 615
 	public static function is_multiple_select( $field ) {
616 616
 		if ( is_array( $field ) ) {
617
-			return self::is_option_true( $field, 'multiple' ) && ( ( $field['type'] == 'select' || ( $field['type'] == 'data' && isset( $field['data_type'] ) && $field['data_type'] == 'select') ) );
617
+			return self::is_option_true( $field, 'multiple' ) && ( ( $field['type'] == 'select' || ( $field['type'] == 'data' && isset( $field['data_type'] ) && $field['data_type'] == 'select' ) ) );
618 618
 		} else {
619
-			return self::is_option_true( $field, 'multiple' ) && ( ( $field->type == 'select' || ( $field->type == 'data' && isset($field->field_options['data_type'] ) && $field->field_options['data_type'] == 'select') ) );
619
+			return self::is_option_true( $field, 'multiple' ) && ( ( $field->type == 'select' || ( $field->type == 'data' && isset( $field->field_options['data_type'] ) && $field->field_options['data_type'] == 'select' ) ) );
620 620
 		}
621 621
 	}
622 622
 
@@ -661,23 +661,23 @@  discard block
 block discarded – undo
661 661
 	}
662 662
 
663 663
 	public static function is_option_true_in_array( $field, $option ) {
664
-		return isset( $field[ $option ] ) && $field[ $option ];
664
+		return isset( $field[$option] ) && $field[$option];
665 665
 	}
666 666
 
667 667
 	public static function is_option_true_in_object( $field, $option ) {
668
-		return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ];
668
+		return isset( $field->field_options[$option] ) && $field->field_options[$option];
669 669
 	}
670 670
 
671 671
 	public static function is_option_empty_in_array( $field, $option ) {
672
-		return ! isset( $field[ $option ] ) || empty( $field[ $option ] );
672
+		return ! isset( $field[$option] ) || empty( $field[$option] );
673 673
 	}
674 674
 
675 675
 	public static function is_option_empty_in_object( $field, $option ) {
676
-		return ! isset( $field->field_options[ $option ] ) || empty( $field->field_options[ $option ] );
676
+		return ! isset( $field->field_options[$option] ) || empty( $field->field_options[$option] );
677 677
 	}
678 678
 
679 679
 	public static function is_option_value_in_object( $field, $option ) {
680
-		return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ] != '';
680
+		return isset( $field->field_options[$option] ) && $field->field_options[$option] != '';
681 681
 	}
682 682
 
683 683
 	/**
@@ -693,11 +693,11 @@  discard block
 block discarded – undo
693 693
 	}
694 694
 
695 695
 	public static function get_option_in_array( $field, $option ) {
696
-		return $field[ $option ];
696
+		return $field[$option];
697 697
 	}
698 698
 
699 699
 	public static function get_option_in_object( $field, $option ) {
700
-		return isset( $field->field_options[ $option ] ) ? $field->field_options[ $option ] : '';
700
+		return isset( $field->field_options[$option] ) ? $field->field_options[$option] : '';
701 701
 	}
702 702
 
703 703
 	/**
Please login to merge, or discard this patch.