Completed
Push — master ( a3b404...bd734d )
by Jamie
02:47
created
classes/models/FrmField.php 1 patch
Indentation   +202 added lines, -202 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 }
5 5
 
6 6
 class FrmField {
7
-    static $use_cache = true;
7
+	static $use_cache = true;
8 8
 	static $transient_size = 200;
9 9
 
10 10
 	public static function field_selection() {
@@ -51,39 +51,39 @@  discard block
 block discarded – undo
51 51
 		));
52 52
 	}
53 53
 
54
-    public static function create( $values, $return = true ) {
55
-        global $wpdb, $frm_duplicate_ids;
54
+	public static function create( $values, $return = true ) {
55
+		global $wpdb, $frm_duplicate_ids;
56 56
 
57
-        $new_values = array();
58
-        $key = isset($values['field_key']) ? $values['field_key'] : $values['name'];
57
+		$new_values = array();
58
+		$key = isset($values['field_key']) ? $values['field_key'] : $values['name'];
59 59
 		$new_values['field_key'] = FrmAppHelper::get_unique_key( $key, $wpdb->prefix . 'frm_fields', 'field_key' );
60 60
 
61 61
 		foreach ( array( 'name', 'description', 'type', 'default_value' ) as $col ) {
62 62
 			$new_values[ $col ] = $values[ $col ];
63
-        }
63
+		}
64 64
 
65
-        $new_values['options'] = $values['options'];
65
+		$new_values['options'] = $values['options'];
66 66
 
67
-        $new_values['field_order'] = isset($values['field_order']) ? (int) $values['field_order'] : null;
68
-        $new_values['required'] = isset($values['required']) ? (int) $values['required'] : 0;
69
-        $new_values['form_id'] = isset($values['form_id']) ? (int) $values['form_id'] : null;
70
-        $new_values['field_options'] = $values['field_options'];
71
-        $new_values['created_at'] = current_time('mysql', 1);
67
+		$new_values['field_order'] = isset($values['field_order']) ? (int) $values['field_order'] : null;
68
+		$new_values['required'] = isset($values['required']) ? (int) $values['required'] : 0;
69
+		$new_values['form_id'] = isset($values['form_id']) ? (int) $values['form_id'] : null;
70
+		$new_values['field_options'] = $values['field_options'];
71
+		$new_values['created_at'] = current_time('mysql', 1);
72 72
 
73 73
 		if ( isset( $values['id'] ) ) {
74 74
 			$frm_duplicate_ids[ $values['field_key'] ] = $new_values['field_key'];
75
-            $new_values = apply_filters('frm_duplicated_field', $new_values);
76
-        }
75
+			$new_values = apply_filters('frm_duplicated_field', $new_values);
76
+		}
77 77
 
78 78
 		foreach ( $new_values as $k => $v ) {
79
-            if ( is_array( $v ) ) {
79
+			if ( is_array( $v ) ) {
80 80
 				$new_values[ $k ] = serialize( $v );
81 81
 			}
82
-            unset( $k, $v );
83
-        }
82
+			unset( $k, $v );
83
+		}
84 84
 
85
-        //if(isset($values['id']) and is_numeric($values['id']))
86
-        //    $new_values['id'] = $values['id'];
85
+		//if(isset($values['id']) and is_numeric($values['id']))
86
+		//    $new_values['id'] = $values['id'];
87 87
 
88 88
 		$query_results = $wpdb->insert( $wpdb->prefix . 'frm_fields', $new_values );
89 89
 		$new_id = 0;
@@ -104,22 +104,22 @@  discard block
 block discarded – undo
104 104
 		} else {
105 105
 			return false;
106 106
 		}
107
-    }
107
+	}
108 108
 
109
-    public static function duplicate( $old_form_id, $form_id, $copy_keys = false, $blog_id = false ) {
110
-        global $frm_duplicate_ids;
109
+	public static function duplicate( $old_form_id, $form_id, $copy_keys = false, $blog_id = false ) {
110
+		global $frm_duplicate_ids;
111 111
 
112 112
 		$where = array( array( 'or' => 1, 'fi.form_id' => $old_form_id, 'fr.parent_form_id' => $old_form_id ) );
113 113
 		$fields = self::getAll( $where, 'field_order', '', $blog_id );
114 114
 
115
-        foreach ( (array) $fields as $field ) {
116
-            $new_key = ($copy_keys) ? $field->field_key : '';
117
-            if ( $copy_keys && substr($field->field_key, -1) == 2 ) {
118
-                $new_key = rtrim($new_key, 2);
119
-            }
115
+		foreach ( (array) $fields as $field ) {
116
+			$new_key = ($copy_keys) ? $field->field_key : '';
117
+			if ( $copy_keys && substr($field->field_key, -1) == 2 ) {
118
+				$new_key = rtrim($new_key, 2);
119
+			}
120 120
 
121
-            $values = array();
122
-            FrmFieldsHelper::fill_field( $values, $field, $form_id, $new_key );
121
+			$values = array();
122
+			FrmFieldsHelper::fill_field( $values, $field, $form_id, $new_key );
123 123
 
124 124
 			// If this is a repeating section, create new form
125 125
 			if ( self::is_repeating_field( $field ) ) {
@@ -138,16 +138,16 @@  discard block
 block discarded – undo
138 138
 				$values['form_id'] = $new_repeat_form_id;
139 139
 			}
140 140
 
141
-            $values = apply_filters('frm_duplicated_field', $values);
142
-            $new_id = self::create($values);
143
-            $frm_duplicate_ids[ $field->id ] = $new_id;
144
-            $frm_duplicate_ids[ $field->field_key ] = $new_id;
145
-            unset($field);
146
-        }
147
-    }
141
+			$values = apply_filters('frm_duplicated_field', $values);
142
+			$new_id = self::create($values);
143
+			$frm_duplicate_ids[ $field->id ] = $new_id;
144
+			$frm_duplicate_ids[ $field->field_key ] = $new_id;
145
+			unset($field);
146
+		}
147
+	}
148 148
 
149 149
 	public static function update( $id, $values ) {
150
-        global $wpdb;
150
+		global $wpdb;
151 151
 
152 152
 		$id = absint( $id );
153 153
 
@@ -155,9 +155,9 @@  discard block
 block discarded – undo
155 155
 			$values['field_key'] = FrmAppHelper::get_unique_key( $values['field_key'], $wpdb->prefix . 'frm_fields', 'field_key', $id );
156 156
 		}
157 157
 
158
-        if ( isset($values['required']) ) {
159
-            $values['required'] = (int) $values['required'];
160
-        }
158
+		if ( isset($values['required']) ) {
159
+			$values['required'] = (int) $values['required'];
160
+		}
161 161
 
162 162
 		self::preserve_format_option_backslashes( $values );
163 163
 
@@ -174,41 +174,41 @@  discard block
 block discarded – undo
174 174
 
175 175
 		$query_results = $wpdb->update( $wpdb->prefix . 'frm_fields', $values, array( 'id' => $id ) );
176 176
 
177
-        $form_id = 0;
177
+		$form_id = 0;
178 178
 		if ( isset( $values['form_id'] ) ) {
179
-            $form_id = absint( $values['form_id'] );
179
+			$form_id = absint( $values['form_id'] );
180 180
 		} else {
181
-            $field = self::getOne($id);
182
-            if ( $field ) {
183
-                $form_id = $field->form_id;
184
-            }
185
-            unset($field);
186
-        }
187
-        unset($values);
181
+			$field = self::getOne($id);
182
+			if ( $field ) {
183
+				$form_id = $field->form_id;
184
+			}
185
+			unset($field);
186
+		}
187
+		unset($values);
188 188
 
189 189
 		if ( $query_results ) {
190
-            wp_cache_delete( $id, 'frm_field' );
191
-            if ( $form_id ) {
192
-                self::delete_form_transient( $form_id );
193
-            }
194
-        }
190
+			wp_cache_delete( $id, 'frm_field' );
191
+			if ( $form_id ) {
192
+				self::delete_form_transient( $form_id );
193
+			}
194
+		}
195 195
 
196
-        return $query_results;
197
-    }
196
+		return $query_results;
197
+	}
198 198
 
199 199
 	/**
200
-	* Keep backslashes in the phone format option
201
-	*
202
-	* @since 2.0.8
203
-	* @param $values array - pass by reference
204
-	*/
200
+	 * Keep backslashes in the phone format option
201
+	 *
202
+	 * @since 2.0.8
203
+	 * @param $values array - pass by reference
204
+	 */
205 205
 	private static function preserve_format_option_backslashes( &$values ) {
206 206
 		if ( isset( $values['field_options']['format'] ) ) {
207 207
 			$values['field_options']['format'] = FrmAppHelper::preserve_backslashes( $values['field_options']['format'] );
208 208
 		}
209 209
 	}
210 210
 
211
-    public static function destroy( $id ) {
211
+	public static function destroy( $id ) {
212 212
 		global $wpdb;
213 213
 
214 214
 		do_action( 'frm_before_destroy_field', $id );
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 
224 224
 		$wpdb->query( $wpdb->prepare( 'DELETE FROM ' . $wpdb->prefix . 'frm_item_metas WHERE field_id=%d', $id ) );
225 225
 		return $wpdb->query( $wpdb->prepare( 'DELETE FROM ' . $wpdb->prefix . 'frm_fields WHERE id=%d', $id ) );
226
-    }
226
+	}
227 227
 
228 228
 	public static function delete_form_transient( $form_id ) {
229 229
 		$form_id = absint( $form_id );
@@ -237,11 +237,11 @@  discard block
 block discarded – undo
237 237
 
238 238
 		FrmAppHelper::cache_delete_group( 'frm_field' );
239 239
 
240
-        $form = FrmForm::getOne($form_id);
241
-        if ( $form && $form->parent_form_id && $form->parent_form_id != $form_id ) {
242
-            self::delete_form_transient( $form->parent_form_id );
243
-        }
244
-    }
240
+		$form = FrmForm::getOne($form_id);
241
+		if ( $form && $form->parent_form_id && $form->parent_form_id != $form_id ) {
242
+			self::delete_form_transient( $form->parent_form_id );
243
+		}
244
+	}
245 245
 
246 246
 	/**
247 247
 	 * If $field is numeric, get the field object
@@ -257,131 +257,131 @@  discard block
 block discarded – undo
257 257
 			return;
258 258
 		}
259 259
 
260
-        global $wpdb;
260
+		global $wpdb;
261 261
 
262
-        $where = is_numeric($id) ? 'id=%d' : 'field_key=%s';
262
+		$where = is_numeric($id) ? 'id=%d' : 'field_key=%s';
263 263
 		$query = $wpdb->prepare( 'SELECT * FROM ' . $wpdb->prefix . 'frm_fields WHERE ' . $where, $id );
264 264
 
265
-        $results = FrmAppHelper::check_cache( $id, 'frm_field', $query, 'get_row', 0 );
265
+		$results = FrmAppHelper::check_cache( $id, 'frm_field', $query, 'get_row', 0 );
266 266
 
267
-        if ( empty($results) ) {
268
-            return $results;
269
-        }
267
+		if ( empty($results) ) {
268
+			return $results;
269
+		}
270 270
 
271
-        if ( is_numeric($id) ) {
271
+		if ( is_numeric($id) ) {
272 272
 			FrmAppHelper::set_cache( $results->field_key, $results, 'frm_field' );
273
-        } else if ( $results ) {
273
+		} else if ( $results ) {
274 274
 			FrmAppHelper::set_cache( $results->id, $results, 'frm_field' );
275
-        }
275
+		}
276 276
 
277 277
 		self::prepare_options( $results );
278 278
 
279
-        return stripslashes_deep($results);
280
-    }
279
+		return stripslashes_deep($results);
280
+	}
281 281
 
282
-    /**
283
-     * Get the field type by key or id
284
-     * @param int|string The field id or key
282
+	/**
283
+	 * Get the field type by key or id
284
+	 * @param int|string The field id or key
285 285
 	 * @param mixed $col The name of the column in the fields database table
286
-     */
287
-    public static function &get_type( $id, $col = 'type' ) {
288
-        $field = FrmAppHelper::check_cache( $id, 'frm_field' );
289
-        if ( $field ) {
290
-            $type = $field->{$col};
291
-        } else {
292
-            $type = FrmDb::get_var( 'frm_fields', array( 'or' => 1, 'id' => $id, 'field_key' => $id ), $col );
293
-        }
294
-
295
-        return $type;
296
-    }
286
+	 */
287
+	public static function &get_type( $id, $col = 'type' ) {
288
+		$field = FrmAppHelper::check_cache( $id, 'frm_field' );
289
+		if ( $field ) {
290
+			$type = $field->{$col};
291
+		} else {
292
+			$type = FrmDb::get_var( 'frm_fields', array( 'or' => 1, 'id' => $id, 'field_key' => $id ), $col );
293
+		}
294
+
295
+		return $type;
296
+	}
297 297
 
298 298
 	public static function get_all_types_in_form( $form_id, $type, $limit = '', $inc_sub = 'exclude' ) {
299
-        if ( ! $form_id ) {
300
-            return array();
301
-        }
299
+		if ( ! $form_id ) {
300
+			return array();
301
+		}
302 302
 
303 303
 		$results = self::get_fields_from_transients( $form_id, array( 'inc_embed' => $inc_sub, 'inc_repeat' => $inc_sub ) );
304 304
 		if ( ! empty( $results ) ) {
305
-            $fields = array();
306
-            $count = 0;
307
-            foreach ( $results as $result ) {
308
-                if ( $type != $result->type ) {
309
-                    continue;
310
-                }
305
+			$fields = array();
306
+			$count = 0;
307
+			foreach ( $results as $result ) {
308
+				if ( $type != $result->type ) {
309
+					continue;
310
+				}
311 311
 
312 312
 				$fields[ $result->id ] = $result;
313
-                $count++;
314
-                if ( $limit == 1 ) {
315
-                    $fields = $result;
316
-                    break;
317
-                }
313
+				$count++;
314
+				if ( $limit == 1 ) {
315
+					$fields = $result;
316
+					break;
317
+				}
318 318
 
319
-                if ( ! empty($limit) && $count >= $limit ) {
320
-                    break;
321
-                }
319
+				if ( ! empty($limit) && $count >= $limit ) {
320
+					break;
321
+				}
322 322
 
323
-                unset($result);
324
-            }
325
-            return stripslashes_deep($fields);
326
-        }
323
+				unset($result);
324
+			}
325
+			return stripslashes_deep($fields);
326
+		}
327 327
 
328
-        self::$use_cache = false;
328
+		self::$use_cache = false;
329 329
 
330 330
 		$where = array( 'fi.form_id' => (int) $form_id, 'fi.type' => $type );
331 331
 		self::maybe_include_repeating_fields( $inc_sub, $where );
332 332
 		$results = self::getAll( $where, 'field_order', $limit );
333
-        self::$use_cache = true;
334
-        self::include_sub_fields($results, $inc_sub, $type);
333
+		self::$use_cache = true;
334
+		self::include_sub_fields($results, $inc_sub, $type);
335 335
 
336
-        return $results;
337
-    }
336
+		return $results;
337
+	}
338 338
 
339 339
 	public static function get_all_for_form( $form_id, $limit = '', $inc_embed = 'exclude', $inc_repeat = 'include' ) {
340
-        if ( ! (int) $form_id ) {
341
-            return array();
342
-        }
340
+		if ( ! (int) $form_id ) {
341
+			return array();
342
+		}
343 343
 
344 344
 		$results = self::get_fields_from_transients( $form_id, array( 'inc_embed' => $inc_embed, 'inc_repeat' => $inc_repeat ) );
345 345
 		if ( ! empty( $results ) ) {
346
-            if ( empty($limit) ) {
346
+			if ( empty($limit) ) {
347 347
 				return $results;
348
-            }
348
+			}
349 349
 
350
-            $fields = array();
351
-            $count = 0;
352
-            foreach ( $results as $result ) {
350
+			$fields = array();
351
+			$count = 0;
352
+			foreach ( $results as $result ) {
353 353
 				$fields[ $result->id ] = $result;
354
-                if ( ! empty($limit) && $count >= $limit ) {
355
-                    break;
356
-                }
357
-            }
354
+				if ( ! empty($limit) && $count >= $limit ) {
355
+					break;
356
+				}
357
+			}
358 358
 
359 359
 			return $fields;
360
-        }
360
+		}
361 361
 
362
-        self::$use_cache = false;
362
+		self::$use_cache = false;
363 363
 
364 364
 		$where = array( 'fi.form_id' => absint( $form_id ) );
365 365
 		self::maybe_include_repeating_fields( $inc_repeat, $where );
366 366
 		$results = self::getAll( $where, 'field_order', $limit );
367 367
 
368
-        self::$use_cache = true;
368
+		self::$use_cache = true;
369 369
 
370 370
 		self::include_sub_fields( $results, $inc_embed, 'all' );
371 371
 
372
-        if ( empty($limit) ) {
372
+		if ( empty($limit) ) {
373 373
 			self::set_field_transient( $results, $form_id, 0, array( 'inc_embed' => $inc_embed, 'inc_repeat' => $inc_repeat ) );
374
-        }
374
+		}
375 375
 
376 376
 		return $results;
377
-    }
377
+	}
378 378
 
379 379
 	/**
380
-	* If repeating fields should be included, adjust $where accordingly
381
-	*
382
-	* @param string $inc_repeat
383
-	* @param array $where - pass by reference
384
-	*/
380
+	 * If repeating fields should be included, adjust $where accordingly
381
+	 *
382
+	 * @param string $inc_repeat
383
+	 * @param array $where - pass by reference
384
+	 */
385 385
 	private static function maybe_include_repeating_fields( $inc_repeat, &$where ) {
386 386
 		if ( $inc_repeat == 'include' ) {
387 387
 			$form_id = $where['fi.form_id'];
@@ -392,77 +392,77 @@  discard block
 block discarded – undo
392 392
 
393 393
 	public static function include_sub_fields( &$results, $inc_embed, $type = 'all' ) {
394 394
 		if ( 'include' != $inc_embed || empty( $results ) ) {
395
-            return;
396
-        }
395
+			return;
396
+		}
397 397
 
398
-        $form_fields = $results;
398
+		$form_fields = $results;
399 399
 		$index_offset = 1;
400
-        foreach ( $form_fields as $k => $field ) {
401
-            if ( 'form' != $field->type || ! isset($field->field_options['form_select']) ) {
402
-                continue;
403
-            }
404
-
405
-            if ( $type == 'all' ) {
406
-                $sub_fields = self::get_all_for_form( $field->field_options['form_select'] );
407
-            } else {
408
-                $sub_fields = self::get_all_types_in_form($field->form_id, $type);
409
-            }
410
-
411
-            if ( ! empty($sub_fields) ) {
400
+		foreach ( $form_fields as $k => $field ) {
401
+			if ( 'form' != $field->type || ! isset($field->field_options['form_select']) ) {
402
+				continue;
403
+			}
404
+
405
+			if ( $type == 'all' ) {
406
+				$sub_fields = self::get_all_for_form( $field->field_options['form_select'] );
407
+			} else {
408
+				$sub_fields = self::get_all_types_in_form($field->form_id, $type);
409
+			}
410
+
411
+			if ( ! empty($sub_fields) ) {
412 412
 				$index = $k + $index_offset;
413 413
 				$index_offset += count( $sub_fields );
414 414
 				array_splice($results, $index, 0, $sub_fields);
415
-            }
416
-            unset($field, $sub_fields);
417
-        }
418
-    }
415
+			}
416
+			unset($field, $sub_fields);
417
+		}
418
+	}
419 419
 
420 420
 	public static function getAll( $where = array(), $order_by = '', $limit = '', $blog_id = false ) {
421 421
 		$cache_key = maybe_serialize( $where ) . $order_by . 'l' . $limit . 'b' . $blog_id;
422
-        if ( self::$use_cache ) {
423
-            // make sure old cache doesn't get saved as a transient
424
-            $results = wp_cache_get($cache_key, 'frm_field');
425
-            if ( false !== $results ) {
426
-                return stripslashes_deep($results);
427
-            }
428
-        }
429
-
430
-        global $wpdb;
431
-
432
-        if ( $blog_id && is_multisite() ) {
433
-            global $wpmuBaseTablePrefix;
434
-            if ( $wpmuBaseTablePrefix ) {
422
+		if ( self::$use_cache ) {
423
+			// make sure old cache doesn't get saved as a transient
424
+			$results = wp_cache_get($cache_key, 'frm_field');
425
+			if ( false !== $results ) {
426
+				return stripslashes_deep($results);
427
+			}
428
+		}
429
+
430
+		global $wpdb;
431
+
432
+		if ( $blog_id && is_multisite() ) {
433
+			global $wpmuBaseTablePrefix;
434
+			if ( $wpmuBaseTablePrefix ) {
435 435
 				$prefix = $wpmuBaseTablePrefix . $blog_id . '_';
436
-            } else {
437
-                $prefix = $wpdb->get_blog_prefix( $blog_id );
438
-            }
436
+			} else {
437
+				$prefix = $wpdb->get_blog_prefix( $blog_id );
438
+			}
439 439
 
440 440
 			$table_name = $prefix . 'frm_fields';
441 441
 			$form_table_name = $prefix . 'frm_forms';
442 442
 		} else {
443 443
 			$table_name = $wpdb->prefix . 'frm_fields';
444 444
 			$form_table_name = $wpdb->prefix . 'frm_forms';
445
-        }
445
+		}
446 446
 
447 447
 		if ( ! empty( $order_by ) && strpos( $order_by, 'ORDER BY' ) === false ) {
448 448
 			$order_by = ' ORDER BY ' . $order_by;
449 449
 		}
450 450
 
451
-        $limit = FrmAppHelper::esc_limit($limit);
451
+		$limit = FrmAppHelper::esc_limit($limit);
452 452
 
453
-        $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";
454
-        $query_type = ( $limit == ' LIMIT 1' || $limit == 1 ) ? 'row' : 'results';
453
+		$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";
454
+		$query_type = ( $limit == ' LIMIT 1' || $limit == 1 ) ? 'row' : 'results';
455 455
 
456
-        if ( is_array($where) ) {
457
-            $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 );
456
+		if ( is_array($where) ) {
457
+			$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 );
458 458
 		} else {
459 459
 			// if the query is not an array, then it has already been prepared
460
-            $query .= FrmAppHelper::prepend_and_or_where(' WHERE ', $where) . $order_by . $limit;
460
+			$query .= FrmAppHelper::prepend_and_or_where(' WHERE ', $where) . $order_by . $limit;
461 461
 
462 462
 			$function_name = ( $query_type == 'row' ) ? 'get_row' : 'get_results';
463 463
 			$results = $wpdb->$function_name( $query );
464
-        }
465
-        unset( $where );
464
+		}
465
+		unset( $where );
466 466
 
467 467
 		self::format_field_results( $results );
468 468
 
@@ -561,21 +561,21 @@  discard block
 block discarded – undo
561 561
 
562 562
 	public static function getIds( $where = '', $order_by = '', $limit = '' ) {
563 563
 		_deprecated_function( __FUNCTION__, '2.0' );
564
-        global $wpdb;
565
-        if ( ! empty($order_by) && ! strpos($order_by, 'ORDER BY') !== false ) {
564
+		global $wpdb;
565
+		if ( ! empty($order_by) && ! strpos($order_by, 'ORDER BY') !== false ) {
566 566
 			$order_by = ' ORDER BY ' . $order_by;
567
-        }
567
+		}
568 568
 
569 569
 		$query = 'SELECT fi.id  FROM ' . $wpdb->prefix . 'frm_fields fi ' .
570 570
 			'LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_forms fr ON fi.form_id=fr.id' .
571 571
 			FrmAppHelper::prepend_and_or_where( ' WHERE ', $where ) . $order_by . $limit;
572 572
 
573
-        $method = ( $limit == ' LIMIT 1' || $limit == 1 ) ? 'get_var' : 'get_col';
573
+		$method = ( $limit == ' LIMIT 1' || $limit == 1 ) ? 'get_var' : 'get_col';
574 574
 		$cache_key = 'getIds_' . maybe_serialize( $where ) . $order_by . $limit;
575
-        $results = FrmAppHelper::check_cache($cache_key, 'frm_field', $query, $method);
575
+		$results = FrmAppHelper::check_cache($cache_key, 'frm_field', $query, $method);
576 576
 
577
-        return $results;
578
-    }
577
+		return $results;
578
+	}
579 579
 
580 580
 	public static function is_no_save_field( $type ) {
581 581
 		return in_array( $type, self::no_save_fields() );
@@ -718,8 +718,8 @@  discard block
 block discarded – undo
718 718
 	}
719 719
 
720 720
 	/**
721
-	* @since 2.0.09
722
-	*/
721
+	 * @since 2.0.09
722
+	 */
723 723
 	public static function is_repeating_field( $field ) {
724 724
 		if ( is_array( $field ) ) {
725 725
 			$is_repeating_field = ( 'divider' == $field['type'] );
@@ -729,14 +729,14 @@  discard block
 block discarded – undo
729 729
 		return ( $is_repeating_field && self::is_option_true( $field, 'repeat' ) );
730 730
 	}
731 731
 
732
-    /**
733
-     * @param string $key
734
-     * @return int field id
735
-     */
732
+	/**
733
+	 * @param string $key
734
+	 * @return int field id
735
+	 */
736 736
 	public static function get_id_by_key( $key ) {
737
-        $id = FrmDb::get_var( 'frm_fields', array( 'field_key' => sanitize_title( $key ) ) );
738
-        return $id;
739
-    }
737
+		$id = FrmDb::get_var( 'frm_fields', array( 'field_key' => sanitize_title( $key ) ) );
738
+		return $id;
739
+	}
740 740
 
741 741
 	/**
742 742
 	 * @param string $id
Please login to merge, or discard this patch.