Completed
Push — master ( fd7552...ca3d95 )
by Stephanie
02:56
created
classes/views/xml/forms_xml.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 if ( ! $item_ids ) {
4
-    return;
4
+	return;
5 5
 }
6 6
 
7 7
 // fetch 20 posts at a time rather than loading the entire table into memory
@@ -45,6 +45,6 @@  discard block
 block discarded – undo
45 45
 <?php	} ?>
46 46
 	</form>
47 47
 <?php
48
-    	unset( $fields );
48
+		unset( $fields );
49 49
 	}
50 50
 }
Please login to merge, or discard this patch.
classes/helpers/FrmTipsHelper.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -181,13 +181,13 @@
 block discarded – undo
181 181
 			),
182 182
 		);
183 183
 		$random = rand( 0, count( $tips ) - 1 );
184
-		$tip = $tips[ $random ];
184
+		$tip = $tips[$random];
185 185
 		$tip['num'] = $random;
186 186
 		return $tip;
187 187
 	}
188 188
 
189 189
 	public static function get_random_tip( $tips ) {
190 190
 		$random = rand( 0, count( $tips ) - 1 );
191
-		return $tips[ $random ];
191
+		return $tips[$random];
192 192
 	}
193 193
 }
Please login to merge, or discard this patch.
classes/models/FrmDb.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -308,7 +308,7 @@
 block discarded – undo
308 308
 	 *
309 309
 	 * @since 2.02.05
310 310
 	 * @param string $key
311
-	 * @param int|string $value
311
+	 * @param string $value
312 312
 	 * @param string $where
313 313
 	 */
314 314
     private static function add_query_placeholder( $key, $value, &$where ) {
Please login to merge, or discard this patch.
Indentation   +153 added lines, -153 removed lines patch added patch discarded remove patch
@@ -1,31 +1,31 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 class FrmDb {
4
-    public $fields;
5
-    public $forms;
6
-    public $entries;
7
-    public $entry_metas;
4
+	public $fields;
5
+	public $forms;
6
+	public $entries;
7
+	public $entry_metas;
8 8
 
9
-    public function __construct() {
9
+	public function __construct() {
10 10
 		if ( ! defined( 'ABSPATH' ) ) {
11 11
 			die( 'You are not allowed to call this page directly.' );
12 12
 		}
13 13
 
14 14
 		_deprecated_function( __METHOD__, '2.05.06', 'FrmMigrate' );
15
-        global $wpdb;
16
-        $this->fields         = $wpdb->prefix . 'frm_fields';
17
-        $this->forms          = $wpdb->prefix . 'frm_forms';
18
-        $this->entries        = $wpdb->prefix . 'frm_items';
19
-        $this->entry_metas    = $wpdb->prefix . 'frm_item_metas';
20
-    }
21
-
22
-    /**
23
-     * Change array into format $wpdb->prepare can use
15
+		global $wpdb;
16
+		$this->fields         = $wpdb->prefix . 'frm_fields';
17
+		$this->forms          = $wpdb->prefix . 'frm_forms';
18
+		$this->entries        = $wpdb->prefix . 'frm_items';
19
+		$this->entry_metas    = $wpdb->prefix . 'frm_item_metas';
20
+	}
21
+
22
+	/**
23
+	 * Change array into format $wpdb->prepare can use
24 24
 	 *
25 25
 	 * @param array $args
26 26
 	 * @param string $starts_with
27
-     */
28
-    public static function get_where_clause_and_values( &$args, $starts_with = ' WHERE ' ) {
27
+	 */
28
+	public static function get_where_clause_and_values( &$args, $starts_with = ' WHERE ' ) {
29 29
 		if ( empty( $args ) ) {
30 30
 			// add an arg to prevent prepare from failing
31 31
 			$args = array(
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 				'values' => array( 1 ),
34 34
 			);
35 35
 			return;
36
-        }
36
+		}
37 37
 
38 38
 		$where = '';
39 39
 		$values = array();
@@ -44,20 +44,20 @@  discard block
 block discarded – undo
44 44
 		}
45 45
 
46 46
 		$args = compact( 'where', 'values' );
47
-    }
47
+	}
48 48
 
49
-    /**
49
+	/**
50 50
 	 * @param array $args
51
-     * @param string $base_where
52
-     * @param string $where
51
+	 * @param string $base_where
52
+	 * @param string $where
53 53
 	 * @param array $values
54
-     */
55
-    public static function parse_where_from_array( $args, $base_where, &$where, &$values ) {
56
-        $condition = ' AND';
57
-        if ( isset( $args['or'] ) ) {
58
-            $condition = ' OR';
59
-            unset( $args['or'] );
60
-        }
54
+	 */
55
+	public static function parse_where_from_array( $args, $base_where, &$where, &$values ) {
56
+		$condition = ' AND';
57
+		if ( isset( $args['or'] ) ) {
58
+			$condition = ' OR';
59
+			unset( $args['or'] );
60
+		}
61 61
 
62 62
 		foreach ( $args as $key => $value ) {
63 63
 			$where .= empty( $where ) ? $base_where : $condition;
@@ -84,28 +84,28 @@  discard block
 block discarded – undo
84 84
 		}
85 85
 	}
86 86
 
87
-    /**
88
-     * @param string $key
87
+	/**
88
+	 * @param string $key
89 89
 	 * @param string|array $value
90
-     * @param string $where
90
+	 * @param string $where
91 91
 	 * @param array $values
92
-     */
93
-    private static function interpret_array_to_sql( $key, $value, &$where, &$values ) {
92
+	 */
93
+	private static function interpret_array_to_sql( $key, $value, &$where, &$values ) {
94 94
 		$key = trim( $key );
95 95
 
96 96
 		if ( strpos( $key, 'created_at' ) !== false || strpos( $key, 'updated_at' ) !== false ) {
97 97
 			$k = explode( ' ', $key );
98
-            $where .= ' DATE_FORMAT(' . reset( $k ) . ', %s) ' . str_replace( reset( $k ), '', $key );
99
-            $values[] = '%Y-%m-%d %H:%i:%s';
100
-        } else {
98
+			$where .= ' DATE_FORMAT(' . reset( $k ) . ', %s) ' . str_replace( reset( $k ), '', $key );
99
+			$values[] = '%Y-%m-%d %H:%i:%s';
100
+		} else {
101 101
 			$where .= ' ' . $key;
102
-        }
102
+		}
103 103
 
104 104
 		$lowercase_key = explode( ' ', strtolower( $key ) );
105 105
 		$lowercase_key = end( $lowercase_key );
106 106
 
107
-        if ( is_array( $value ) ) {
108
-            // translate array of values to "in"
107
+		if ( is_array( $value ) ) {
108
+			// translate array of values to "in"
109 109
 			if ( strpos( $lowercase_key, 'like' ) !== false ) {
110 110
 				$where = preg_replace( '/' . $key . '$/', '', $where );
111 111
 				$where .= '(';
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 				$where .= ' in (' . self::prepare_array_values( $value, '%s' ) . ')';
124 124
 				$values = array_merge( $values, $value );
125 125
 			}
126
-        } else if ( strpos( $lowercase_key, 'like' ) !== false ) {
126
+		} else if ( strpos( $lowercase_key, 'like' ) !== false ) {
127 127
 			/**
128 128
 			 * Allow string to start or end with the value
129 129
 			 * If the key is like% then skip the first % for starts with
@@ -143,9 +143,9 @@  discard block
 block discarded – undo
143 143
 			$where .= ' %s';
144 144
 			$values[] = $start . self::esc_like( $value ) . $end;
145 145
 
146
-        } else if ( $value === null ) {
147
-            $where .= ' IS NULL';
148
-        } else {
146
+		} else if ( $value === null ) {
147
+			$where .= ' IS NULL';
148
+		} else {
149 149
 			// allow a - to prevent = from being added
150 150
 			if ( substr( $key, -1 ) == '-' ) {
151 151
 				$where = rtrim( $where, '-' );
@@ -155,9 +155,9 @@  discard block
 block discarded – undo
155 155
 
156 156
 			self::add_query_placeholder( $key, $value, $where );
157 157
 
158
-            $values[] = $value;
159
-        }
160
-    }
158
+			$values[] = $value;
159
+		}
160
+	}
161 161
 
162 162
 	/**
163 163
 	 * Add %d, or %s to query
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 	 * @param int|string $value
168 168
 	 * @param string $where
169 169
 	 */
170
-    private static function add_query_placeholder( $key, $value, &$where ) {
170
+	private static function add_query_placeholder( $key, $value, &$where ) {
171 171
 		if ( is_numeric( $value ) && ( strpos( $key, 'meta_value' ) === false || strpos( $key, '+0' ) !== false ) ) {
172 172
 			$value = $value + 0; // switch string to number
173 173
 			$where .= is_float( $value ) ? '%f' : '%d';
@@ -176,16 +176,16 @@  discard block
 block discarded – undo
176 176
 		}
177 177
 	}
178 178
 
179
-    /**
180
-     * @param string $table
179
+	/**
180
+	 * @param string $table
181 181
 	 * @param array $where
182 182
 	 * @param array $args
183 183
 	 * @return int
184
-     */
185
-    public static function get_count( $table, $where = array(), $args = array() ) {
186
-        $count = self::get_var( $table, $where, 'COUNT(*)', $args );
187
-        return $count;
188
-    }
184
+	 */
185
+	public static function get_count( $table, $where = array(), $args = array() ) {
186
+		$count = self::get_var( $table, $where, 'COUNT(*)', $args );
187
+		return $count;
188
+	}
189 189
 
190 190
 	/**
191 191
 	 * @param string $table
@@ -196,17 +196,17 @@  discard block
 block discarded – undo
196 196
 	 * @param string $type
197 197
 	 * @return array|null|string|object
198 198
 	 */
199
-    public static function get_var( $table, $where = array(), $field = 'id', $args = array(), $limit = '', $type = 'var' ) {
200
-        $group = '';
201
-        self::get_group_and_table_name( $table, $group );
199
+	public static function get_var( $table, $where = array(), $field = 'id', $args = array(), $limit = '', $type = 'var' ) {
200
+		$group = '';
201
+		self::get_group_and_table_name( $table, $group );
202 202
 		self::convert_options_to_array( $args, '', $limit );
203 203
 
204 204
 		$query = self::generate_query_string_from_pieces( $field, $table, $where, $args );
205 205
 
206 206
 		$cache_key = self::generate_cache_key( $where, $args, $field, $type );
207 207
 		$results = self::check_cache( $cache_key, $group, $query, 'get_' . $type );
208
-        return $results;
209
-    }
208
+		return $results;
209
+	}
210 210
 
211 211
 	/**
212 212
 	 * Generate a cache key from the where query, field, type, and other arguments
@@ -232,44 +232,44 @@  discard block
 block discarded – undo
232 232
 		return $cache_key;
233 233
 	}
234 234
 
235
-    /**
236
-     * @param string $table
237
-     * @param array $where
235
+	/**
236
+	 * @param string $table
237
+	 * @param array $where
238 238
 	 * @param string $field
239 239
 	 * @param array $args
240 240
 	 * @param string $limit
241 241
 	 * @return mixed
242
-     */
243
-    public static function get_col( $table, $where = array(), $field = 'id', $args = array(), $limit = '' ) {
244
-        return self::get_var( $table, $where, $field, $args, $limit, 'col' );
245
-    }
246
-
247
-    /**
248
-     * @since 2.0
249
-     * @param string $table
242
+	 */
243
+	public static function get_col( $table, $where = array(), $field = 'id', $args = array(), $limit = '' ) {
244
+		return self::get_var( $table, $where, $field, $args, $limit, 'col' );
245
+	}
246
+
247
+	/**
248
+	 * @since 2.0
249
+	 * @param string $table
250 250
 	 * @param array $where
251 251
 	 * @param string $fields
252 252
 	 * @param array $args
253 253
 	 * @return mixed
254
-     */
255
-    public static function get_row( $table, $where = array(), $fields = '*', $args = array() ) {
256
-        $args['limit'] = 1;
257
-        return self::get_var( $table, $where, $fields, $args, '', 'row' );
258
-    }
259
-
260
-    /**
261
-     * Prepare a key/value array before DB call
254
+	 */
255
+	public static function get_row( $table, $where = array(), $fields = '*', $args = array() ) {
256
+		$args['limit'] = 1;
257
+		return self::get_var( $table, $where, $fields, $args, '', 'row' );
258
+	}
259
+
260
+	/**
261
+	 * Prepare a key/value array before DB call
262 262
 	 *
263
-     * @since 2.0
264
-     * @param string $table
263
+	 * @since 2.0
264
+	 * @param string $table
265 265
 	 * @param array $where
266 266
 	 * @param string $fields
267 267
 	 * @param array $args
268 268
 	 * @return mixed
269
-     */
270
-    public static function get_results( $table, $where = array(), $fields = '*', $args = array() ) {
271
-        return self::get_var( $table, $where, $fields, $args, '', 'results' );
272
-    }
269
+	 */
270
+	public static function get_results( $table, $where = array(), $fields = '*', $args = array() ) {
271
+		return self::get_var( $table, $where, $fields, $args, '', 'results' );
272
+	}
273 273
 
274 274
 	/**
275 275
 	 * Check for like, not like, in, not in, =, !=, >, <, <=, >=
@@ -306,56 +306,56 @@  discard block
 block discarded – undo
306 306
 		return '';
307 307
 	}
308 308
 
309
-    /**
310
-     * Get 'frm_forms' from wp_frm_forms or a longer table param that includes a join
311
-     * Also add the wpdb->prefix to the table if it's missing
312
-     *
313
-     * @param string $table
314
-     * @param string $group
315
-     */
316
-    private static function get_group_and_table_name( &$table, &$group ) {
309
+	/**
310
+	 * Get 'frm_forms' from wp_frm_forms or a longer table param that includes a join
311
+	 * Also add the wpdb->prefix to the table if it's missing
312
+	 *
313
+	 * @param string $table
314
+	 * @param string $group
315
+	 */
316
+	private static function get_group_and_table_name( &$table, &$group ) {
317 317
 		global $wpdb, $wpmuBaseTablePrefix;
318 318
 
319 319
 		$table_parts = explode( ' ', $table );
320 320
 		$group = reset( $table_parts );
321
-        $group = str_replace( $wpdb->prefix, '', $group );
321
+		$group = str_replace( $wpdb->prefix, '', $group );
322 322
 
323 323
 		$prefix = $wpmuBaseTablePrefix ? $wpmuBaseTablePrefix : $wpdb->base_prefix;
324 324
 		$group = str_replace( $prefix, '', $group );
325 325
 
326
-        if ( $group == $table ) {
327
-            $table = $wpdb->prefix . $table;
328
-        }
326
+		if ( $group == $table ) {
327
+			$table = $wpdb->prefix . $table;
328
+		}
329 329
 
330 330
 		// switch to singular group name
331 331
 		$group = rtrim( $group, 's' );
332
-    }
332
+	}
333 333
 
334
-    private static function convert_options_to_array( &$args, $order_by = '', $limit = '' ) {
334
+	private static function convert_options_to_array( &$args, $order_by = '', $limit = '' ) {
335 335
 		if ( ! is_array( $args ) ) {
336 336
 			$args = array( 'order_by' => $args );
337
-        }
337
+		}
338 338
 
339
-        if ( ! empty( $order_by ) ) {
340
-            $args['order_by'] = $order_by;
341
-        }
339
+		if ( ! empty( $order_by ) ) {
340
+			$args['order_by'] = $order_by;
341
+		}
342 342
 
343
-        if ( ! empty( $limit ) ) {
344
-            $args['limit'] = $limit;
345
-        }
343
+		if ( ! empty( $limit ) ) {
344
+			$args['limit'] = $limit;
345
+		}
346 346
 
347
-        $temp_args = $args;
348
-        foreach ( $temp_args as $k => $v ) {
349
-            if ( $v == '' ) {
347
+		$temp_args = $args;
348
+		foreach ( $temp_args as $k => $v ) {
349
+			if ( $v == '' ) {
350 350
 				unset( $args[ $k ] );
351
-                continue;
352
-            }
351
+				continue;
352
+			}
353 353
 
354
-            $db_name = strtoupper( str_replace( '_', ' ', $k ) );
355
-            if ( strpos( $v, $db_name ) === false ) {
354
+			$db_name = strtoupper( str_replace( '_', ' ', $k ) );
355
+			if ( strpos( $v, $db_name ) === false ) {
356 356
 				$args[ $k ] = $db_name . ' ' . $v;
357
-            }
358
-        }
357
+			}
358
+		}
359 359
 
360 360
 		// Make sure LIMIT is the last argument
361 361
 		if ( isset( $args['order_by'] ) && isset( $args['limit'] ) ) {
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 			unset( $args['limit'] );
364 364
 			$args['limit'] = $temp_limit;
365 365
 		}
366
-    }
366
+	}
367 367
 
368 368
 	/**
369 369
 	 * Get the associative array results for the given columns, table, and where query
@@ -435,25 +435,25 @@  discard block
 block discarded – undo
435 435
 		}
436 436
 	}
437 437
 
438
-    /**
439
-     * Added for < WP 4.0 compatability
440
-     *
441
-     * @since 2.05.06
442
-     *
443
-     * @param string $term The value to escape
444
-     * @return string The escaped value
445
-     */
438
+	/**
439
+	 * Added for < WP 4.0 compatability
440
+	 *
441
+	 * @since 2.05.06
442
+	 *
443
+	 * @param string $term The value to escape
444
+	 * @return string The escaped value
445
+	 */
446 446
 	public static function esc_like( $term ) {
447
-        global $wpdb;
448
-        if ( method_exists( $wpdb, 'esc_like' ) ) {
447
+		global $wpdb;
448
+		if ( method_exists( $wpdb, 'esc_like' ) ) {
449 449
 			// WP 4.0
450
-            $term = $wpdb->esc_like( $term );
451
-        } else {
452
-            $term = like_escape( $term );
453
-        }
450
+			$term = $wpdb->esc_like( $term );
451
+		} else {
452
+			$term = like_escape( $term );
453
+		}
454 454
 
455
-        return $term;
456
-    }
455
+		return $term;
456
+	}
457 457
 
458 458
 	/**
459 459
 	 * @since 2.05.06
@@ -523,10 +523,10 @@  discard block
 block discarded – undo
523 523
 		return ' LIMIT ' . $limit;
524 524
 	}
525 525
 
526
-    /**
527
-     * Get an array of values ready to go through $wpdb->prepare
528
-     * @since 2.05.06
529
-     */
526
+	/**
527
+	 * Get an array of values ready to go through $wpdb->prepare
528
+	 * @since 2.05.06
529
+	 */
530 530
 	public static function prepare_array_values( $array, $type = '%s' ) {
531 531
 		$placeholders = array_fill( 0, count( $array ), $type );
532 532
 		return implode( ', ', $placeholders );
@@ -597,17 +597,17 @@  discard block
 block discarded – undo
597 597
 		return $post;
598 598
 	}
599 599
 
600
-    /**
601
-     * Check cache before fetching values and saving to cache
602
-     *
603
-     * @since 2.05.06
604
-     *
605
-     * @param string $cache_key The unique name for this cache
606
-     * @param string $group The name of the cache group
607
-     * @param string $query If blank, don't run a db call
608
-     * @param string $type The wpdb function to use with this query
609
-     * @return mixed $results The cache or query results
610
-     */
600
+	/**
601
+	 * Check cache before fetching values and saving to cache
602
+	 *
603
+	 * @since 2.05.06
604
+	 *
605
+	 * @param string $cache_key The unique name for this cache
606
+	 * @param string $group The name of the cache group
607
+	 * @param string $query If blank, don't run a db call
608
+	 * @param string $type The wpdb function to use with this query
609
+	 * @return mixed $results The cache or query results
610
+	 */
611 611
 	public static function check_cache( $cache_key, $group = '', $query = '', $type = 'get_var', $time = 300 ) {
612 612
 		$results = wp_cache_get( $cache_key, $group );
613 613
 		if ( ! FrmAppHelper::is_empty_value( $results, false ) || empty( $query ) ) {
@@ -671,13 +671,13 @@  discard block
 block discarded – undo
671 671
 		wp_cache_delete( $cache_key, $group );
672 672
 	}
673 673
 
674
-    /**
675
-     * Delete all caching in a single group
676
-     *
677
-     * @since 2.05.06
678
-     *
679
-     * @param string $group The name of the cache group
680
-     */
674
+	/**
675
+	 * Delete all caching in a single group
676
+	 *
677
+	 * @since 2.05.06
678
+	 *
679
+	 * @param string $group The name of the cache group
680
+	 */
681 681
 	public static function cache_delete_group( $group ) {
682 682
 		$cached_keys = self::get_group_cached_keys( $group );
683 683
 
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -293,8 +293,8 @@  discard block
 block discarded – undo
293 293
 		);
294 294
 
295 295
 		$where_is = strtolower( $where_is );
296
-		if ( isset( $switch_to[ $where_is ] ) ) {
297
-			return ' ' . $switch_to[ $where_is ];
296
+		if ( isset( $switch_to[$where_is] ) ) {
297
+			return ' ' . $switch_to[$where_is];
298 298
 		}
299 299
 
300 300
 		// > and < need a little more work since we don't want them switched to >= and <=
@@ -347,13 +347,13 @@  discard block
 block discarded – undo
347 347
         $temp_args = $args;
348 348
         foreach ( $temp_args as $k => $v ) {
349 349
             if ( $v == '' ) {
350
-				unset( $args[ $k ] );
350
+				unset( $args[$k] );
351 351
                 continue;
352 352
             }
353 353
 
354 354
             $db_name = strtoupper( str_replace( '_', ' ', $k ) );
355 355
             if ( strpos( $v, $db_name ) === false ) {
356
-				$args[ $k ] = $db_name . ' ' . $v;
356
+				$args[$k] = $db_name . ' ' . $v;
357 357
             }
358 358
         }
359 359
 
@@ -424,13 +424,13 @@  discard block
 block discarded – undo
424 424
 	private static function esc_query_args( &$args ) {
425 425
 		foreach ( $args as $param => $value ) {
426 426
 			if ( $param == 'order_by' ) {
427
-				$args[ $param ] = self::esc_order( $value );
427
+				$args[$param] = self::esc_order( $value );
428 428
 			} elseif ( $param == 'limit' ) {
429
-				$args[ $param ] = self::esc_limit( $value );
429
+				$args[$param] = self::esc_limit( $value );
430 430
 			}
431 431
 
432
-			if ( $args[ $param ] == '' ) {
433
-				unset( $args[ $param ] );
432
+			if ( $args[$param] == '' ) {
433
+				unset( $args[$param] );
434 434
 			}
435 435
 		}
436 436
 	}
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
 		$limit = explode( ',', trim( $limit ) );
516 516
 		foreach ( $limit as $k => $l ) {
517 517
 			if ( is_numeric( $l ) ) {
518
-				$limit[ $k ] = $l;
518
+				$limit[$k] = $l;
519 519
 			}
520 520
 		}
521 521
 
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
 	 */
647 647
 	public static function add_key_to_group_cache( $key, $group ) {
648 648
 		$cached = self::get_group_cached_keys( $group );
649
-		$cached[ $key ] = $key;
649
+		$cached[$key] = $key;
650 650
 		wp_cache_set( 'cached_keys', $cached, $group, 300 );
651 651
 	}
652 652
 
Please login to merge, or discard this patch.
classes/controllers/FrmFormsController.php 4 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1082,7 +1082,8 @@
 block discarded – undo
1082 1082
 	private static function maybe_get_form_to_show( $id ) {
1083 1083
 		$form = false;
1084 1084
 
1085
-		if ( ! empty( $id ) ) { // no form id or key set
1085
+		if ( ! empty( $id ) ) {
1086
+// no form id or key set
1086 1087
 			$form = FrmForm::getOne( $id );
1087 1088
 			if ( ! $form || $form->parent_form_id || $form->status == 'trash' ) {
1088 1089
 				$form = false;
Please login to merge, or discard this patch.
Doc Comments   +8 added lines patch added patch discarded remove patch
@@ -870,6 +870,7 @@  discard block
 block discarded – undo
870 870
 	/**
871 871
 	 * Get an array of the helper shortcodes to display in the customization panel
872 872
 	 * @since 2.0.6
873
+	 * @param boolean $settings_tab
873 874
 	 */
874 875
 	private static function get_shortcode_helpers( $settings_tab ) {
875 876
 		$entry_shortcodes = array(
@@ -947,6 +948,9 @@  discard block
 block discarded – undo
947 948
         return $content;
948 949
     }
949 950
 
951
+	/**
952
+	 * @param boolean $entry
953
+	 */
950 954
 	private static function get_entry_by_param( &$entry ) {
951 955
 		if ( ! $entry || ! is_object( $entry ) ) {
952 956
 			if ( ! $entry || ! is_numeric( $entry ) ) {
@@ -1229,6 +1233,9 @@  discard block
 block discarded – undo
1229 1233
 		return $form;
1230 1234
     }
1231 1235
 
1236
+	/**
1237
+	 * @param string $id
1238
+	 */
1232 1239
 	private static function maybe_get_form_to_show( $id ) {
1233 1240
 		$form = false;
1234 1241
 
@@ -1635,6 +1642,7 @@  discard block
 block discarded – undo
1635 1642
 
1636 1643
 	/**
1637 1644
 	 * @since 2.0.8
1645
+	 * @param string $content
1638 1646
 	 */
1639 1647
 	private static function maybe_minimize_form( $atts, &$content ) {
1640 1648
 		// check if minimizing is turned on
Please login to merge, or discard this patch.
Indentation   +336 added lines, -336 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 class FrmFormsController {
4 4
 
5
-    public static function menu() {
5
+	public static function menu() {
6 6
 		$menu_label = __( 'Forms', 'formidable' );
7 7
 		if ( ! FrmAppHelper::pro_is_installed() ) {
8 8
 			$menu_label .= ' (Lite)';
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 		add_submenu_page( 'formidable', 'Formidable | ' . $menu_label, $menu_label, 'frm_view_forms', 'formidable', 'FrmFormsController::route' );
11 11
 
12 12
 		self::maybe_load_listing_hooks();
13
-    }
13
+	}
14 14
 
15 15
 	public static function maybe_load_listing_hooks() {
16 16
 		$action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );
@@ -24,13 +24,13 @@  discard block
 block discarded – undo
24 24
 		add_filter( 'manage_toplevel_page_formidable_sortable_columns', 'FrmFormsController::get_sortable_columns' );
25 25
 	}
26 26
 
27
-    public static function head() {
27
+	public static function head() {
28 28
 		wp_enqueue_script( 'formidable-editinplace' );
29 29
 
30
-        if ( wp_is_mobile() ) {
31
-    		wp_enqueue_script( 'jquery-touch-punch' );
32
-    	}
33
-    }
30
+		if ( wp_is_mobile() ) {
31
+			wp_enqueue_script( 'jquery-touch-punch' );
32
+		}
33
+	}
34 34
 
35 35
 	public static function register_widgets() {
36 36
 		require_once( FrmAppHelper::plugin_path() . '/classes/widgets/FrmShowForm.php' );
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 	public static function new_form( $values = array() ) {
62 62
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
63 63
 
64
-        global $frm_vars;
64
+		global $frm_vars;
65 65
 
66 66
 		$action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
67 67
 		$action = empty( $values ) ? FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ) : $values[ $action ];
@@ -72,17 +72,17 @@  discard block
 block discarded – undo
72 72
 		} else if ( $action == 'new' ) {
73 73
 			$frm_field_selection = FrmField::field_selection();
74 74
 			$values = FrmFormsHelper::setup_new_vars( $values );
75
-            $id = FrmForm::create( $values );
75
+			$id = FrmForm::create( $values );
76 76
 			$form = FrmForm::getOne( $id );
77 77
 
78 78
 			self::create_default_email_action( $form );
79 79
 
80 80
 			$all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' );
81 81
 
82
-            $values['id'] = $id;
82
+			$values['id'] = $id;
83 83
 			require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new.php' );
84
-        }
85
-    }
84
+		}
85
+	}
86 86
 
87 87
 	/**
88 88
 	 * Create the default email action
@@ -91,41 +91,41 @@  discard block
 block discarded – undo
91 91
 	 *
92 92
 	 * @param object $form
93 93
 	 */
94
-    private static function create_default_email_action( $form ) {
95
-    	$create_email = apply_filters( 'frm_create_default_email_action', true, $form );
94
+	private static function create_default_email_action( $form ) {
95
+		$create_email = apply_filters( 'frm_create_default_email_action', true, $form );
96 96
 
97
-	    if ( $create_email ) {
98
-		    $action_control = FrmFormActionsController::get_form_actions( 'email' );
99
-		    $action_control->create( $form->id );
100
-	    }
101
-    }
97
+		if ( $create_email ) {
98
+			$action_control = FrmFormActionsController::get_form_actions( 'email' );
99
+			$action_control->create( $form->id );
100
+		}
101
+	}
102 102
 
103 103
 	public static function create( $values = array() ) {
104 104
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
105 105
 
106
-        global $frm_vars;
107
-        if ( empty( $values ) ) {
108
-            $values = $_POST;
109
-        }
106
+		global $frm_vars;
107
+		if ( empty( $values ) ) {
108
+			$values = $_POST;
109
+		}
110 110
 
111
-        //Set radio button and checkbox meta equal to "other" value
112
-        if ( FrmAppHelper::pro_is_installed() ) {
113
-            $values = FrmProEntry::mod_other_vals( $values, 'back' );
114
-        }
111
+		//Set radio button and checkbox meta equal to "other" value
112
+		if ( FrmAppHelper::pro_is_installed() ) {
113
+			$values = FrmProEntry::mod_other_vals( $values, 'back' );
114
+		}
115 115
 
116 116
 		$id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
117 117
 
118
-        if ( ! current_user_can( 'frm_edit_forms' ) || ( $_POST && ( ! isset( $values['frm_save_form'] ) || ! wp_verify_nonce( $values['frm_save_form'], 'frm_save_form_nonce' ) ) ) ) {
119
-            $frm_settings = FrmAppHelper::get_settings();
120
-            $errors = array( 'form' => $frm_settings->admin_permission );
121
-        } else {
118
+		if ( ! current_user_can( 'frm_edit_forms' ) || ( $_POST && ( ! isset( $values['frm_save_form'] ) || ! wp_verify_nonce( $values['frm_save_form'], 'frm_save_form_nonce' ) ) ) ) {
119
+			$frm_settings = FrmAppHelper::get_settings();
120
+			$errors = array( 'form' => $frm_settings->admin_permission );
121
+		} else {
122 122
 			$errors = FrmForm::validate( $values );
123
-        }
123
+		}
124 124
 
125 125
 		if ( count( $errors ) > 0 ) {
126
-            $hide_preview = true;
126
+			$hide_preview = true;
127 127
 			$frm_field_selection = FrmField::field_selection();
128
-            $form = FrmForm::getOne( $id );
128
+			$form = FrmForm::getOne( $id );
129 129
 			$fields = FrmField::get_all_for_form( $id );
130 130
 
131 131
 			$values = FrmAppHelper::setup_edit_vars( $form, 'forms', '', true );
@@ -133,30 +133,30 @@  discard block
 block discarded – undo
133 133
 			$all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' );
134 134
 
135 135
 			require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new.php' );
136
-        } else {
137
-            FrmForm::update( $id, $values, true );
136
+		} else {
137
+			FrmForm::update( $id, $values, true );
138 138
 			$url = admin_url( 'admin.php?page=formidable&frm_action=settings&id=' . $id );
139 139
 			die( FrmAppHelper::js_redirect( $url ) ); // WPCS: XSS ok.
140
-        }
141
-    }
140
+		}
141
+	}
142 142
 
143
-    public static function edit( $values = false ) {
143
+	public static function edit( $values = false ) {
144 144
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
145 145
 
146 146
 		$id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
147 147
 		return self::get_edit_vars( $id );
148
-    }
148
+	}
149 149
 
150
-    public static function settings( $id = false, $message = '' ) {
150
+	public static function settings( $id = false, $message = '' ) {
151 151
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
152 152
 
153 153
 		if ( ! $id || ! is_numeric( $id ) ) {
154 154
 			$id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
155
-        }
155
+		}
156 156
 		return self::get_settings_vars( $id, array(), $message );
157
-    }
157
+	}
158 158
 
159
-    public static function update_settings() {
159
+	public static function update_settings() {
160 160
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
161 161
 
162 162
 		$id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
@@ -170,39 +170,39 @@  discard block
 block discarded – undo
170 170
 
171 171
 		FrmForm::update( $id, $_POST );
172 172
 
173
-        $message = __( 'Settings Successfully Updated', 'formidable' );
173
+		$message = __( 'Settings Successfully Updated', 'formidable' );
174 174
 		return self::get_settings_vars( $id, array(), $message );
175
-    }
175
+	}
176 176
 
177 177
 	public static function update( $values = array() ) {
178 178
 		if ( empty( $values ) ) {
179
-            $values = $_POST;
180
-        }
179
+			$values = $_POST;
180
+		}
181 181
 
182
-        //Set radio button and checkbox meta equal to "other" value
183
-        if ( FrmAppHelper::pro_is_installed() ) {
184
-            $values = FrmProEntry::mod_other_vals( $values, 'back' );
185
-        }
182
+		//Set radio button and checkbox meta equal to "other" value
183
+		if ( FrmAppHelper::pro_is_installed() ) {
184
+			$values = FrmProEntry::mod_other_vals( $values, 'back' );
185
+		}
186 186
 
187
-        $errors = FrmForm::validate( $values );
188
-        $permission_error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'frm_save_form', 'frm_save_form_nonce' );
189
-        if ( $permission_error !== false ) {
190
-            $errors['form'] = $permission_error;
191
-        }
187
+		$errors = FrmForm::validate( $values );
188
+		$permission_error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'frm_save_form', 'frm_save_form_nonce' );
189
+		if ( $permission_error !== false ) {
190
+			$errors['form'] = $permission_error;
191
+		}
192 192
 
193 193
 		$id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
194 194
 
195 195
 		if ( count( $errors ) > 0 ) {
196
-            return self::get_edit_vars( $id, $errors );
196
+			return self::get_edit_vars( $id, $errors );
197 197
 		} else {
198
-            FrmForm::update( $id, $values );
199
-            $message = __( 'Form was Successfully Updated', 'formidable' );
200
-            if ( defined( 'DOING_AJAX' ) ) {
198
+			FrmForm::update( $id, $values );
199
+			$message = __( 'Form was Successfully Updated', 'formidable' );
200
+			if ( defined( 'DOING_AJAX' ) ) {
201 201
 				wp_die( esc_html( $message ) );
202
-            }
202
+			}
203 203
 			return self::get_edit_vars( $id, array(), $message );
204
-        }
205
-    }
204
+		}
205
+	}
206 206
 
207 207
 	/**
208 208
 	 * Redirect to the url for creating from a template
@@ -224,30 +224,30 @@  discard block
 block discarded – undo
224 224
 		wp_die();
225 225
 	}
226 226
 
227
-    public static function duplicate() {
227
+	public static function duplicate() {
228 228
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
229 229
 
230 230
 		$params = FrmForm::list_page_params();
231
-        $form = FrmForm::duplicate( $params['id'], $params['template'], true );
232
-        $message = $params['template'] ? __( 'Form template was Successfully Created', 'formidable' ) : __( 'Form was Successfully Copied', 'formidable' );
233
-        if ( $form ) {
231
+		$form = FrmForm::duplicate( $params['id'], $params['template'], true );
232
+		$message = $params['template'] ? __( 'Form template was Successfully Created', 'formidable' ) : __( 'Form was Successfully Copied', 'formidable' );
233
+		if ( $form ) {
234 234
 			return self::get_edit_vars( $form, array(), $message, true );
235
-        } else {
235
+		} else {
236 236
 			return self::display_forms_list( $params, __( 'There was a problem creating the new template.', 'formidable' ) );
237
-        }
238
-    }
237
+		}
238
+	}
239 239
 
240
-    public static function page_preview() {
240
+	public static function page_preview() {
241 241
 		$params = FrmForm::list_page_params();
242
-        if ( ! $params['form'] ) {
243
-            return;
244
-        }
242
+		if ( ! $params['form'] ) {
243
+			return;
244
+		}
245 245
 
246
-        $form = FrmForm::getOne( $params['form'] );
246
+		$form = FrmForm::getOne( $params['form'] );
247 247
 		if ( $form ) {
248 248
 			return self::show_form( $form->id, '', true, true );
249 249
 		}
250
-    }
250
+	}
251 251
 
252 252
 	/**
253 253
 	 * @since 3.0
@@ -256,11 +256,11 @@  discard block
 block discarded – undo
256 256
 		echo self::page_preview(); // WPCS: XSS ok.
257 257
 	}
258 258
 
259
-    public static function preview() {
260
-        do_action( 'frm_wp' );
259
+	public static function preview() {
260
+		do_action( 'frm_wp' );
261 261
 
262
-        global $frm_vars;
263
-        $frm_vars['preview'] = true;
262
+		global $frm_vars;
263
+		$frm_vars['preview'] = true;
264 264
 
265 265
 		self::load_wp();
266 266
 
@@ -374,22 +374,22 @@  discard block
 block discarded – undo
374 374
 		require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/direct.php' );
375 375
 	}
376 376
 
377
-    public static function untrash() {
377
+	public static function untrash() {
378 378
 		self::change_form_status( 'untrash' );
379
-    }
379
+	}
380 380
 
381 381
 	public static function bulk_untrash( $ids ) {
382 382
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
383 383
 
384
-        $count = FrmForm::set_status( $ids, 'published' );
384
+		$count = FrmForm::set_status( $ids, 'published' );
385 385
 
386 386
 		$message = sprintf( _n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), 1 );
387
-        return $message;
388
-    }
387
+		return $message;
388
+	}
389 389
 
390
-    public static function trash() {
390
+	public static function trash() {
391 391
 		self::change_form_status( 'trash' );
392
-    }
392
+	}
393 393
 
394 394
 	/**
395 395
 	 * @param string $status
@@ -442,12 +442,12 @@  discard block
 block discarded – undo
442 442
 	public static function bulk_trash( $ids ) {
443 443
 		FrmAppHelper::permission_check( 'frm_delete_forms' );
444 444
 
445
-        $count = 0;
446
-        foreach ( $ids as $id ) {
447
-            if ( FrmForm::trash( $id ) ) {
448
-                $count++;
449
-            }
450
-        }
445
+		$count = 0;
446
+		foreach ( $ids as $id ) {
447
+			if ( FrmForm::trash( $id ) ) {
448
+				$count++;
449
+			}
450
+		}
451 451
 
452 452
 		$current_page = FrmAppHelper::get_simple_request(
453 453
 			array(
@@ -462,63 +462,63 @@  discard block
 block discarded – undo
462 462
 			'</a>'
463 463
 		);
464 464
 
465
-        return $message;
466
-    }
465
+		return $message;
466
+	}
467 467
 
468
-    public static function destroy() {
468
+	public static function destroy() {
469 469
 		FrmAppHelper::permission_check( 'frm_delete_forms' );
470 470
 
471 471
 		$params = FrmForm::list_page_params();
472 472
 
473
-        //check nonce url
473
+		//check nonce url
474 474
 		check_admin_referer( 'destroy_form_' . $params['id'] );
475 475
 
476
-        $count = 0;
477
-        if ( FrmForm::destroy( $params['id'] ) ) {
478
-            $count++;
479
-        }
476
+		$count = 0;
477
+		if ( FrmForm::destroy( $params['id'] ) ) {
478
+			$count++;
479
+		}
480 480
 
481 481
 		$message = sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count );
482 482
 
483 483
 		self::display_forms_list( $params, $message );
484
-    }
484
+	}
485 485
 
486 486
 	public static function bulk_destroy( $ids ) {
487 487
 		FrmAppHelper::permission_check( 'frm_delete_forms' );
488 488
 
489
-        $count = 0;
490
-        foreach ( $ids as $id ) {
491
-            $d = FrmForm::destroy( $id );
492
-            if ( $d ) {
493
-                $count++;
494
-            }
495
-        }
489
+		$count = 0;
490
+		foreach ( $ids as $id ) {
491
+			$d = FrmForm::destroy( $id );
492
+			if ( $d ) {
493
+				$count++;
494
+			}
495
+		}
496 496
 
497 497
 		$message = sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count );
498 498
 
499
-        return $message;
500
-    }
499
+		return $message;
500
+	}
501 501
 
502
-    private static function delete_all() {
503
-        //check nonce url
502
+	private static function delete_all() {
503
+		//check nonce url
504 504
 		$permission_error = FrmAppHelper::permission_nonce_error( 'frm_delete_forms', '_wpnonce', 'bulk-toplevel_page_formidable' );
505
-        if ( $permission_error !== false ) {
505
+		if ( $permission_error !== false ) {
506 506
 			self::display_forms_list( array(), '', array( $permission_error ) );
507
-            return;
508
-        }
507
+			return;
508
+		}
509 509
 
510 510
 		$count = FrmForm::scheduled_delete( time() );
511 511
 		$message = sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count );
512 512
 
513 513
 		self::display_forms_list( array(), $message );
514
-    }
514
+	}
515 515
 
516 516
 	/**
517
-	* Inserts Formidable button
518
-	* Hook exists since 2.5.0
519
-	*
520
-	* @since 2.0.15
521
-	*/
517
+	 * Inserts Formidable button
518
+	 * Hook exists since 2.5.0
519
+	 *
520
+	 * @since 2.0.15
521
+	 */
522 522
 	public static function insert_form_button() {
523 523
 		if ( current_user_can( 'frm_view_forms' ) ) {
524 524
 			$menu_name = FrmAppHelper::get_menu_name();
@@ -529,45 +529,45 @@  discard block
 block discarded – undo
529 529
 		}
530 530
 	}
531 531
 
532
-    public static function insert_form_popup() {
532
+	public static function insert_form_popup() {
533 533
 		$page = basename( FrmAppHelper::get_server_value( 'PHP_SELF' ) );
534 534
 		if ( ! in_array( $page, array( 'post.php', 'page.php', 'page-new.php', 'post-new.php' ) ) ) {
535
-            return;
536
-        }
535
+			return;
536
+		}
537 537
 
538
-        FrmAppHelper::load_admin_wide_js();
538
+		FrmAppHelper::load_admin_wide_js();
539 539
 
540
-        $shortcodes = array(
540
+		$shortcodes = array(
541 541
 			'formidable' => array(
542 542
 				'name'  => __( 'Form', 'formidable' ),
543 543
 				'label' => __( 'Insert a Form', 'formidable' ),
544 544
 			),
545
-        );
545
+		);
546 546
 
547 547
 		$shortcodes = apply_filters( 'frm_popup_shortcodes', $shortcodes );
548 548
 
549 549
 		include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/insert_form_popup.php' );
550
-    }
550
+	}
551 551
 
552
-    public static function get_shortcode_opts() {
552
+	public static function get_shortcode_opts() {
553 553
 		FrmAppHelper::permission_check( 'frm_view_forms' );
554
-        check_ajax_referer( 'frm_ajax', 'nonce' );
554
+		check_ajax_referer( 'frm_ajax', 'nonce' );
555 555
 
556 556
 		$shortcode = FrmAppHelper::get_post_param( 'shortcode', '', 'sanitize_text_field' );
557 557
 		if ( empty( $shortcode ) ) {
558
-            wp_die();
559
-        }
558
+			wp_die();
559
+		}
560 560
 
561 561
 		echo '<div id="sc-opts-' . esc_attr( $shortcode ) . '" class="frm_shortcode_option">';
562 562
 		echo '<input type="radio" name="frmsc" value="' . esc_attr( $shortcode ) . '" id="sc-' . esc_attr( $shortcode ) . '" class="frm_hidden" />';
563 563
 
564
-        $form_id = '';
565
-        $opts = array();
564
+		$form_id = '';
565
+		$opts = array();
566 566
 		switch ( $shortcode ) {
567
-            case 'formidable':
568
-                $opts = array(
567
+			case 'formidable':
568
+				$opts = array(
569 569
 					'form_id'       => 'id',
570
-                    //'key' => ',
570
+					//'key' => ',
571 571
 					'title'         => array(
572 572
 						'val'   => 1,
573 573
 						'label' => __( 'Display form title', 'formidable' ),
@@ -580,8 +580,8 @@  discard block
 block discarded – undo
580 580
 						'val'   => 1,
581 581
 						'label' => __( 'Minimize form HTML', 'formidable' ),
582 582
 					),
583
-                );
584
-        }
583
+				);
584
+		}
585 585
 		$opts = apply_filters( 'frm_sc_popup_opts', $opts, $shortcode );
586 586
 
587 587
 		if ( isset( $opts['form_id'] ) && is_string( $opts['form_id'] ) ) {
@@ -592,38 +592,38 @@  discard block
 block discarded – undo
592 592
 
593 593
 		include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/shortcode_opts.php' );
594 594
 
595
-        echo '</div>';
595
+		echo '</div>';
596 596
 
597
-        wp_die();
598
-    }
597
+		wp_die();
598
+	}
599 599
 
600 600
 	public static function display_forms_list( $params = array(), $message = '', $errors = array() ) {
601
-        FrmAppHelper::permission_check( 'frm_view_forms' );
601
+		FrmAppHelper::permission_check( 'frm_view_forms' );
602 602
 
603
-        global $wpdb, $frm_vars;
603
+		global $wpdb, $frm_vars;
604 604
 
605 605
 		if ( empty( $params ) ) {
606 606
 			$params = FrmForm::list_page_params();
607
-        }
607
+		}
608 608
 
609
-        $wp_list_table = new FrmFormsListHelper( compact( 'params' ) );
609
+		$wp_list_table = new FrmFormsListHelper( compact( 'params' ) );
610 610
 
611
-        $pagenum = $wp_list_table->get_pagenum();
611
+		$pagenum = $wp_list_table->get_pagenum();
612 612
 
613
-        $wp_list_table->prepare_items();
613
+		$wp_list_table->prepare_items();
614 614
 
615
-        $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
616
-        if ( $pagenum > $total_pages && $total_pages > 0 ) {
615
+		$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
616
+		if ( $pagenum > $total_pages && $total_pages > 0 ) {
617 617
 			wp_redirect( esc_url_raw( add_query_arg( 'paged', $total_pages ) ) );
618
-            die();
619
-        }
618
+			die();
619
+		}
620 620
 
621 621
 		require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/list.php' );
622
-    }
622
+	}
623 623
 
624 624
 	public static function get_columns( $columns ) {
625
-	    $columns['cb'] = '<input type="checkbox" />';
626
-	    $columns['id'] = 'ID';
625
+		$columns['cb'] = '<input type="checkbox" />';
626
+		$columns['id'] = 'ID';
627 627
 
628 628
 		$type = FrmAppHelper::get_simple_request(
629 629
 			array(
@@ -633,18 +633,18 @@  discard block
 block discarded – undo
633 633
 			)
634 634
 		);
635 635
 
636
-        if ( 'template' == $type ) {
637
-            $columns['name']        = __( 'Template Name', 'formidable' );
638
-            $columns['type']        = __( 'Type', 'formidable' );
639
-            $columns['form_key']    = __( 'Key', 'formidable' );
640
-        } else {
641
-            $columns['name']        = __( 'Form Title', 'formidable' );
642
-            $columns['entries']     = __( 'Entries', 'formidable' );
643
-            $columns['form_key']    = __( 'Key', 'formidable' );
644
-            $columns['shortcode']   = __( 'Shortcodes', 'formidable' );
645
-        }
636
+		if ( 'template' == $type ) {
637
+			$columns['name']        = __( 'Template Name', 'formidable' );
638
+			$columns['type']        = __( 'Type', 'formidable' );
639
+			$columns['form_key']    = __( 'Key', 'formidable' );
640
+		} else {
641
+			$columns['name']        = __( 'Form Title', 'formidable' );
642
+			$columns['entries']     = __( 'Entries', 'formidable' );
643
+			$columns['form_key']    = __( 'Key', 'formidable' );
644
+			$columns['shortcode']   = __( 'Shortcodes', 'formidable' );
645
+		}
646 646
 
647
-        $columns['created_at'] = __( 'Date', 'formidable' );
647
+		$columns['created_at'] = __( 'Date', 'formidable' );
648 648
 
649 649
 		add_screen_option(
650 650
 			'per_page',
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
 			)
656 656
 		);
657 657
 
658
-        return $columns;
658
+		return $columns;
659 659
 	}
660 660
 
661 661
 	public static function get_sortable_columns() {
@@ -685,34 +685,34 @@  discard block
 block discarded – undo
685 685
 	}
686 686
 
687 687
 	public static function save_per_page( $save, $option, $value ) {
688
-        if ( $option == 'formidable_page_formidable_per_page' ) {
689
-            $save = (int) $value;
690
-        }
691
-        return $save;
692
-    }
688
+		if ( $option == 'formidable_page_formidable_per_page' ) {
689
+			$save = (int) $value;
690
+		}
691
+		return $save;
692
+	}
693 693
 
694 694
 	private static function get_edit_vars( $id, $errors = array(), $message = '', $create_link = false ) {
695
-        global $frm_vars;
695
+		global $frm_vars;
696 696
 
697
-        $form = FrmForm::getOne( $id );
698
-        if ( ! $form ) {
699
-            wp_die( esc_html__( 'You are trying to edit a form that does not exist.', 'formidable' ) );
700
-        }
697
+		$form = FrmForm::getOne( $id );
698
+		if ( ! $form ) {
699
+			wp_die( esc_html__( 'You are trying to edit a form that does not exist.', 'formidable' ) );
700
+		}
701 701
 
702
-        if ( $form->parent_form_id ) {
702
+		if ( $form->parent_form_id ) {
703 703
 			wp_die( sprintf( esc_html__( 'You are trying to edit a child form. Please edit from %1$shere%2$s', 'formidable' ), '<a href="' . esc_url( admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . $form->parent_form_id ) ) . '">', '</a>' ) );
704
-        }
704
+		}
705 705
 
706 706
 		$frm_field_selection = FrmField::field_selection();
707 707
 		$fields = FrmField::get_all_for_form( $form->id );
708 708
 
709
-        // Automatically add end section fields if they don't exist (2.0 migration)
710
-        $reset_fields = false;
711
-        FrmFormsHelper::auto_add_end_section_fields( $form, $fields, $reset_fields );
709
+		// Automatically add end section fields if they don't exist (2.0 migration)
710
+		$reset_fields = false;
711
+		FrmFormsHelper::auto_add_end_section_fields( $form, $fields, $reset_fields );
712 712
 
713
-        if ( $reset_fields ) {
714
-            $fields = FrmField::get_all_for_form( $form->id, '', 'exclude' );
715
-        }
713
+		if ( $reset_fields ) {
714
+			$fields = FrmField::get_all_for_form( $form->id, '', 'exclude' );
715
+		}
716 716
 
717 717
 		unset( $end_section_values, $last_order, $open, $reset_fields );
718 718
 
@@ -720,30 +720,30 @@  discard block
 block discarded – undo
720 720
 		$values = FrmAppHelper::setup_edit_vars( $form, 'forms', '', true, array(), $args );
721 721
 		$values['fields'] = $fields;
722 722
 
723
-        $edit_message = __( 'Form was Successfully Updated', 'formidable' );
724
-        if ( $form->is_template && $message == $edit_message ) {
725
-            $message = __( 'Template was Successfully Updated', 'formidable' );
726
-        }
723
+		$edit_message = __( 'Form was Successfully Updated', 'formidable' );
724
+		if ( $form->is_template && $message == $edit_message ) {
725
+			$message = __( 'Template was Successfully Updated', 'formidable' );
726
+		}
727 727
 
728 728
 		$all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' );
729 729
 
730
-        if ( $form->default_template ) {
730
+		if ( $form->default_template ) {
731 731
 			wp_die( esc_html__( 'That template cannot be edited', 'formidable' ) );
732 732
 		} elseif ( defined( 'DOING_AJAX' ) ) {
733
-            wp_die();
734
-        } else if ( $create_link ) {
733
+			wp_die();
734
+		} else if ( $create_link ) {
735 735
 			require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new.php' );
736
-        } else {
736
+		} else {
737 737
 			require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/edit.php' );
738
-        }
739
-    }
738
+		}
739
+	}
740 740
 
741 741
 	public static function get_settings_vars( $id, $errors = array(), $message = '' ) {
742 742
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
743 743
 
744
-        global $frm_vars;
744
+		global $frm_vars;
745 745
 
746
-        $form = FrmForm::getOne( $id );
746
+		$form = FrmForm::getOne( $id );
747 747
 
748 748
 		$fields = FrmField::get_all_for_form( $id );
749 749
 		$values = FrmAppHelper::setup_edit_vars( $form, 'forms', $fields, true );
@@ -754,17 +754,17 @@  discard block
 block discarded – undo
754 754
 
755 755
 		self::clean_submit_html( $values );
756 756
 
757
-        $action_controls = FrmFormActionsController::get_form_actions();
757
+		$action_controls = FrmFormActionsController::get_form_actions();
758 758
 
759 759
 		$sections = apply_filters( 'frm_add_form_settings_section', array(), $values );
760
-        $pro_feature = FrmAppHelper::pro_is_installed() ? '' : ' class="pro_feature"';
760
+		$pro_feature = FrmAppHelper::pro_is_installed() ? '' : ' class="pro_feature"';
761 761
 
762 762
 		$styles = apply_filters( 'frm_get_style_opts', array() );
763 763
 
764 764
 		$first_h3 = 'frm_first_h3';
765 765
 
766 766
 		require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/settings.php' );
767
-    }
767
+	}
768 768
 
769 769
 	/**
770 770
 	 * Replace old Submit Button href with new href to avoid errors in Chrome
@@ -779,10 +779,10 @@  discard block
 block discarded – undo
779 779
 		}
780 780
 	}
781 781
 
782
-    public static function mb_tags_box( $form_id, $class = '' ) {
782
+	public static function mb_tags_box( $form_id, $class = '' ) {
783 783
 		$fields = FrmField::get_all_for_form( $form_id, '', 'include' );
784
-        $linked_forms = array();
785
-        $col = 'one';
784
+		$linked_forms = array();
785
+		$col = 'one';
786 786
 		$settings_tab = FrmAppHelper::is_admin_page( 'formidable' ) ? true : false;
787 787
 
788 788
 		$cond_shortcodes = apply_filters( 'frm_conditional_shortcodes', array() );
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 		$advanced_helpers = self::advanced_helpers( compact( 'fields', 'form_id' ) );
792 792
 
793 793
 		include( FrmAppHelper::plugin_path() . '/classes/views/shared/mb_adv_info.php' );
794
-    }
794
+	}
795 795
 
796 796
 	/**
797 797
 	 * @since 3.04.01
@@ -882,7 +882,7 @@  discard block
 block discarded – undo
882 882
 			''          => '',
883 883
 			'siteurl'   => __( 'Site URL', 'formidable' ),
884 884
 			'sitename'  => __( 'Site Name', 'formidable' ),
885
-        );
885
+		);
886 886
 
887 887
 		if ( ! FrmAppHelper::pro_is_installed() ) {
888 888
 			unset( $entry_shortcodes['post_id'] );
@@ -931,21 +931,21 @@  discard block
 block discarded – undo
931 931
 		wp_die();
932 932
 	}
933 933
 
934
-    public static function filter_content( $content, $form, $entry = false ) {
934
+	public static function filter_content( $content, $form, $entry = false ) {
935 935
 		self::get_entry_by_param( $entry );
936
-        if ( ! $entry ) {
937
-            return $content;
938
-        }
936
+		if ( ! $entry ) {
937
+			return $content;
938
+		}
939 939
 
940
-        if ( is_object( $form ) ) {
941
-            $form = $form->id;
942
-        }
940
+		if ( is_object( $form ) ) {
941
+			$form = $form->id;
942
+		}
943 943
 
944
-        $shortcodes = FrmFieldsHelper::get_shortcodes( $content, $form );
945
-        $content = apply_filters( 'frm_replace_content_shortcodes', $content, $entry, $shortcodes );
944
+		$shortcodes = FrmFieldsHelper::get_shortcodes( $content, $form );
945
+		$content = apply_filters( 'frm_replace_content_shortcodes', $content, $entry, $shortcodes );
946 946
 
947
-        return $content;
948
-    }
947
+		return $content;
948
+	}
949 949
 
950 950
 	private static function get_entry_by_param( &$entry ) {
951 951
 		if ( ! $entry || ! is_object( $entry ) ) {
@@ -957,151 +957,151 @@  discard block
 block discarded – undo
957 957
 		}
958 958
 	}
959 959
 
960
-    public static function replace_content_shortcodes( $content, $entry, $shortcodes ) {
961
-        return FrmFieldsHelper::replace_content_shortcodes( $content, $entry, $shortcodes );
962
-    }
960
+	public static function replace_content_shortcodes( $content, $entry, $shortcodes ) {
961
+		return FrmFieldsHelper::replace_content_shortcodes( $content, $entry, $shortcodes );
962
+	}
963 963
 
964
-    public static function process_bulk_form_actions( $errors ) {
965
-        if ( ! $_REQUEST ) {
966
-            return $errors;
967
-        }
964
+	public static function process_bulk_form_actions( $errors ) {
965
+		if ( ! $_REQUEST ) {
966
+			return $errors;
967
+		}
968 968
 
969 969
 		$bulkaction = FrmAppHelper::get_param( 'action', '', 'get', 'sanitize_text_field' );
970
-        if ( $bulkaction == -1 ) {
970
+		if ( $bulkaction == -1 ) {
971 971
 			$bulkaction = FrmAppHelper::get_param( 'action2', '', 'get', 'sanitize_title' );
972
-        }
972
+		}
973 973
 
974
-        if ( ! empty( $bulkaction ) && strpos( $bulkaction, 'bulk_' ) === 0 ) {
975
-            FrmAppHelper::remove_get_action();
974
+		if ( ! empty( $bulkaction ) && strpos( $bulkaction, 'bulk_' ) === 0 ) {
975
+			FrmAppHelper::remove_get_action();
976 976
 
977
-            $bulkaction = str_replace( 'bulk_', '', $bulkaction );
978
-        }
977
+			$bulkaction = str_replace( 'bulk_', '', $bulkaction );
978
+		}
979 979
 
980 980
 		$ids = FrmAppHelper::get_param( 'item-action', '', 'get', 'sanitize_text_field' );
981
-        if ( empty( $ids ) ) {
982
-            $errors[] = __( 'No forms were specified', 'formidable' );
983
-            return $errors;
984
-        }
985
-
986
-        $permission_error = FrmAppHelper::permission_nonce_error( '', '_wpnonce', 'bulk-toplevel_page_formidable' );
987
-        if ( $permission_error !== false ) {
988
-            $errors[] = $permission_error;
989
-            return $errors;
990
-        }
991
-
992
-        if ( ! is_array( $ids ) ) {
993
-            $ids = explode( ',', $ids );
994
-        }
995
-
996
-        switch ( $bulkaction ) {
997
-            case 'delete':
998
-                $message = self::bulk_destroy( $ids );
981
+		if ( empty( $ids ) ) {
982
+			$errors[] = __( 'No forms were specified', 'formidable' );
983
+			return $errors;
984
+		}
985
+
986
+		$permission_error = FrmAppHelper::permission_nonce_error( '', '_wpnonce', 'bulk-toplevel_page_formidable' );
987
+		if ( $permission_error !== false ) {
988
+			$errors[] = $permission_error;
989
+			return $errors;
990
+		}
991
+
992
+		if ( ! is_array( $ids ) ) {
993
+			$ids = explode( ',', $ids );
994
+		}
995
+
996
+		switch ( $bulkaction ) {
997
+			case 'delete':
998
+				$message = self::bulk_destroy( $ids );
999 999
 				break;
1000
-            case 'trash':
1001
-                $message = self::bulk_trash( $ids );
1000
+			case 'trash':
1001
+				$message = self::bulk_trash( $ids );
1002 1002
 				break;
1003
-            case 'untrash':
1004
-                $message = self::bulk_untrash( $ids );
1005
-        }
1003
+			case 'untrash':
1004
+				$message = self::bulk_untrash( $ids );
1005
+		}
1006 1006
 
1007
-        if ( isset( $message ) && ! empty( $message ) ) {
1007
+		if ( isset( $message ) && ! empty( $message ) ) {
1008 1008
 			echo '<div id="message" class="frm_updated_message">' . FrmAppHelper::kses( $message, array( 'a' ) ) . '</div>'; // WPCS: XSS ok.
1009
-        }
1009
+		}
1010 1010
 
1011
-        return $errors;
1012
-    }
1011
+		return $errors;
1012
+	}
1013 1013
 
1014
-    public static function route() {
1014
+	public static function route() {
1015 1015
 		$action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
1016
-        $vars = array();
1016
+		$vars = array();
1017 1017
 		if ( isset( $_POST['frm_compact_fields'] ) ) {
1018 1018
 			FrmAppHelper::permission_check( 'frm_edit_forms' );
1019 1019
 
1020 1020
 			$json_vars = htmlspecialchars_decode( nl2br( stripslashes( str_replace( '&quot;', '\\\"', $_POST['frm_compact_fields'] ) ) ) );
1021 1021
 			$json_vars = json_decode( $json_vars, true );
1022 1022
 			if ( empty( $json_vars ) ) {
1023
-                // json decoding failed so we should return an error message
1023
+				// json decoding failed so we should return an error message
1024 1024
 				$action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
1025
-                if ( 'edit' == $action ) {
1026
-                    $action = 'update';
1027
-                }
1025
+				if ( 'edit' == $action ) {
1026
+					$action = 'update';
1027
+				}
1028 1028
 
1029 1029
 				add_filter( 'frm_validate_form', 'FrmFormsController::json_error' );
1030
-            } else {
1030
+			} else {
1031 1031
 				$vars = FrmAppHelper::json_to_array( $json_vars );
1032
-                $action = $vars[ $action ];
1032
+				$action = $vars[ $action ];
1033 1033
 				unset( $_REQUEST['frm_compact_fields'], $_POST['frm_compact_fields'] );
1034 1034
 				$_REQUEST = array_merge( $_REQUEST, $vars );
1035 1035
 				$_POST = array_merge( $_POST, $_REQUEST );
1036
-            }
1037
-        } else {
1036
+			}
1037
+		} else {
1038 1038
 			$action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
1039
-    		if ( isset( $_REQUEST['delete_all'] ) ) {
1040
-                // override the action for this page
1041
-    			$action = 'delete_all';
1042
-            }
1043
-        }
1039
+			if ( isset( $_REQUEST['delete_all'] ) ) {
1040
+				// override the action for this page
1041
+				$action = 'delete_all';
1042
+			}
1043
+		}
1044 1044
 
1045 1045
 		add_action( 'frm_load_form_hooks', 'FrmHooksController::trigger_load_form_hooks' );
1046
-        FrmAppHelper::trigger_hook_load( 'form' );
1046
+		FrmAppHelper::trigger_hook_load( 'form' );
1047 1047
 
1048
-        switch ( $action ) {
1049
-            case 'new':
1048
+		switch ( $action ) {
1049
+			case 'new':
1050 1050
 				return self::new_form( $vars );
1051
-            case 'create':
1052
-            case 'edit':
1053
-            case 'update':
1054
-            case 'duplicate':
1055
-            case 'trash':
1056
-            case 'untrash':
1057
-            case 'destroy':
1058
-            case 'delete_all':
1059
-            case 'settings':
1060
-            case 'update_settings':
1051
+			case 'create':
1052
+			case 'edit':
1053
+			case 'update':
1054
+			case 'duplicate':
1055
+			case 'trash':
1056
+			case 'untrash':
1057
+			case 'destroy':
1058
+			case 'delete_all':
1059
+			case 'settings':
1060
+			case 'update_settings':
1061 1061
 				return self::$action( $vars );
1062
-            default:
1062
+			default:
1063 1063
 				do_action( 'frm_form_action_' . $action );
1064 1064
 				if ( apply_filters( 'frm_form_stop_action_' . $action, false ) ) {
1065
-                    return;
1066
-                }
1065
+					return;
1066
+				}
1067 1067
 
1068 1068
 				$action = FrmAppHelper::get_param( 'action', '', 'get', 'sanitize_text_field' );
1069
-                if ( $action == -1 ) {
1069
+				if ( $action == -1 ) {
1070 1070
 					$action = FrmAppHelper::get_param( 'action2', '', 'get', 'sanitize_title' );
1071
-                }
1071
+				}
1072 1072
 
1073 1073
 				if ( strpos( $action, 'bulk_' ) === 0 ) {
1074
-                    FrmAppHelper::remove_get_action();
1075
-                    return self::list_form();
1076
-                }
1074
+					FrmAppHelper::remove_get_action();
1075
+					return self::list_form();
1076
+				}
1077 1077
 
1078
-                return self::display_forms_list();
1079
-        }
1080
-    }
1078
+				return self::display_forms_list();
1079
+		}
1080
+	}
1081 1081
 
1082
-    public static function json_error( $errors ) {
1083
-        $errors['json'] = __( 'Abnormal HTML characters prevented your form from saving correctly', 'formidable' );
1084
-        return $errors;
1085
-    }
1082
+	public static function json_error( $errors ) {
1083
+		$errors['json'] = __( 'Abnormal HTML characters prevented your form from saving correctly', 'formidable' );
1084
+		return $errors;
1085
+	}
1086 1086
 
1087 1087
 
1088
-    /* FRONT-END FORMS */
1089
-    public static function admin_bar_css() {
1088
+	/* FRONT-END FORMS */
1089
+	public static function admin_bar_css() {
1090 1090
 		if ( is_admin() || ! current_user_can( 'frm_edit_forms' ) ) {
1091
-            return;
1092
-        }
1091
+			return;
1092
+		}
1093 1093
 
1094 1094
 		add_action( 'wp_before_admin_bar_render', 'FrmFormsController::admin_bar_configure' );
1095 1095
 		FrmAppHelper::load_font_style();
1096 1096
 	}
1097 1097
 
1098 1098
 	public static function admin_bar_configure() {
1099
-        global $frm_vars;
1099
+		global $frm_vars;
1100 1100
 		if ( empty( $frm_vars['forms_loaded'] ) ) {
1101
-            return;
1102
-        }
1101
+			return;
1102
+		}
1103 1103
 
1104
-        $actions = array();
1104
+		$actions = array();
1105 1105
 		foreach ( $frm_vars['forms_loaded'] as $form ) {
1106 1106
 			if ( is_object( $form ) ) {
1107 1107
 				$actions[ $form->id ] = $form->name;
@@ -1156,18 +1156,18 @@  discard block
 block discarded – undo
1156 1156
 		}
1157 1157
 	}
1158 1158
 
1159
-    //formidable shortcode
1159
+	//formidable shortcode
1160 1160
 	public static function get_form_shortcode( $atts ) {
1161
-        global $frm_vars;
1161
+		global $frm_vars;
1162 1162
 		if ( isset( $frm_vars['skip_shortcode'] ) && $frm_vars['skip_shortcode'] ) {
1163
-            $sc = '[formidable';
1163
+			$sc = '[formidable';
1164 1164
 			if ( ! empty( $atts ) ) {
1165 1165
 				foreach ( $atts as $k => $v ) {
1166 1166
 					$sc .= ' ' . $k . '="' . esc_attr( $v ) . '"';
1167 1167
 				}
1168 1168
 			}
1169 1169
 			return $sc . ']';
1170
-        }
1170
+		}
1171 1171
 
1172 1172
 		$shortcode_atts = shortcode_atts(
1173 1173
 			array(
@@ -1185,27 +1185,27 @@  discard block
 block discarded – undo
1185 1185
 		);
1186 1186
 		do_action( 'formidable_shortcode_atts', $shortcode_atts, $atts );
1187 1187
 
1188
-        return self::show_form( $shortcode_atts['id'], $shortcode_atts['key'], $shortcode_atts['title'], $shortcode_atts['description'], $atts );
1189
-    }
1188
+		return self::show_form( $shortcode_atts['id'], $shortcode_atts['key'], $shortcode_atts['title'], $shortcode_atts['description'], $atts );
1189
+	}
1190 1190
 
1191
-    public static function show_form( $id = '', $key = '', $title = false, $description = false, $atts = array() ) {
1192
-        if ( empty( $id ) ) {
1193
-            $id = $key;
1194
-        }
1191
+	public static function show_form( $id = '', $key = '', $title = false, $description = false, $atts = array() ) {
1192
+		if ( empty( $id ) ) {
1193
+			$id = $key;
1194
+		}
1195 1195
 
1196
-        $form = self::maybe_get_form_to_show( $id );
1197
-        if ( ! $form ) {
1198
-            return __( 'Please select a valid form', 'formidable' );
1199
-        }
1196
+		$form = self::maybe_get_form_to_show( $id );
1197
+		if ( ! $form ) {
1198
+			return __( 'Please select a valid form', 'formidable' );
1199
+		}
1200 1200
 
1201 1201
 		FrmAppController::maybe_update_styles();
1202 1202
 
1203 1203
 		add_action( 'frm_load_form_hooks', 'FrmHooksController::trigger_load_form_hooks' );
1204
-        FrmAppHelper::trigger_hook_load( 'form', $form );
1204
+		FrmAppHelper::trigger_hook_load( 'form', $form );
1205 1205
 
1206
-        $form = apply_filters( 'frm_pre_display_form', $form );
1206
+		$form = apply_filters( 'frm_pre_display_form', $form );
1207 1207
 
1208
-        $frm_settings = FrmAppHelper::get_settings();
1208
+		$frm_settings = FrmAppHelper::get_settings();
1209 1209
 
1210 1210
 		if ( self::is_viewable_draft_form( $form ) ) {
1211 1211
 			// don't show a draft form on a page
@@ -1227,7 +1227,7 @@  discard block
 block discarded – undo
1227 1227
 		}
1228 1228
 
1229 1229
 		return $form;
1230
-    }
1230
+	}
1231 1231
 
1232 1232
 	private static function maybe_get_form_to_show( $id ) {
1233 1233
 		$form = false;
@@ -1256,21 +1256,21 @@  discard block
 block discarded – undo
1256 1256
 		return $form->logged_in && get_current_user_id() && isset( $form->options['logged_in_role'] ) && $form->options['logged_in_role'] != '' && ! FrmAppHelper::user_has_permission( $form->options['logged_in_role'] );
1257 1257
 	}
1258 1258
 
1259
-    public static function get_form( $form, $title, $description, $atts = array() ) {
1259
+	public static function get_form( $form, $title, $description, $atts = array() ) {
1260 1260
 		ob_start();
1261 1261
 
1262 1262
 		do_action( 'frm_before_get_form', $atts );
1263 1263
 
1264
-        self::get_form_contents( $form, $title, $description, $atts );
1264
+		self::get_form_contents( $form, $title, $description, $atts );
1265 1265
 		self::enqueue_scripts( FrmForm::get_params( $form ) );
1266 1266
 
1267
-        $contents = ob_get_contents();
1268
-        ob_end_clean();
1267
+		$contents = ob_get_contents();
1268
+		ob_end_clean();
1269 1269
 
1270 1270
 		self::maybe_minimize_form( $atts, $contents );
1271 1271
 
1272
-        return $contents;
1273
-    }
1272
+		return $contents;
1273
+	}
1274 1274
 
1275 1275
 	public static function enqueue_scripts( $params ) {
1276 1276
 		do_action( 'frm_enqueue_form_scripts', $params );
@@ -1616,10 +1616,10 @@  discard block
 block discarded – undo
1616 1616
 	}
1617 1617
 
1618 1618
 	public static function defer_script_loading( $tag, $handle ) {
1619
-	    if ( 'recaptcha-api' == $handle && ! strpos( $tag, 'defer' ) ) {
1620
-	        $tag = str_replace( ' src', ' defer="defer" async="async" src', $tag );
1619
+		if ( 'recaptcha-api' == $handle && ! strpos( $tag, 'defer' ) ) {
1620
+			$tag = str_replace( ' src', ' defer="defer" async="async" src', $tag );
1621 1621
 		}
1622
-	    return $tag;
1622
+		return $tag;
1623 1623
 	}
1624 1624
 
1625 1625
 	public static function footer_js( $location = 'footer' ) {
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
         global $frm_vars;
65 65
 
66 66
 		$action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
67
-		$action = empty( $values ) ? FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ) : $values[ $action ];
67
+		$action = empty( $values ) ? FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ) : $values[$action];
68 68
 
69 69
 		if ( $action == 'create' ) {
70 70
 			self::create( $values );
@@ -408,11 +408,11 @@  discard block
 block discarded – undo
408 408
 			),
409 409
 		);
410 410
 
411
-		if ( ! isset( $available_status[ $status ] ) ) {
411
+		if ( ! isset( $available_status[$status] ) ) {
412 412
 			return;
413 413
 		}
414 414
 
415
-		FrmAppHelper::permission_check( $available_status[ $status ]['permission'] );
415
+		FrmAppHelper::permission_check( $available_status[$status]['permission'] );
416 416
 
417 417
 		$params = FrmForm::list_page_params();
418 418
 
@@ -420,8 +420,8 @@  discard block
 block discarded – undo
420 420
 		check_admin_referer( $status . '_form_' . $params['id'] );
421 421
 
422 422
 		$count = 0;
423
-		if ( FrmForm::set_status( $params['id'], $available_status[ $status ]['new_status'] ) ) {
424
-			$count++;
423
+		if ( FrmForm::set_status( $params['id'], $available_status[$status]['new_status'] ) ) {
424
+			$count ++;
425 425
 		}
426 426
 
427 427
 		$form_type = FrmAppHelper::get_simple_request(
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 		$available_status['untrash']['message'] = sprintf( _n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), $count );
435 435
 		$available_status['trash']['message'] = sprintf( _n( '%1$s form moved to the Trash. %2$sUndo%3$s', '%1$s forms moved to the Trash. %2$sUndo%3$s', $count, 'formidable' ), $count, '<a href="' . esc_url( wp_nonce_url( '?page=formidable&frm_action=untrash&form_type=' . $form_type . '&id=' . $params['id'], 'untrash_form_' . $params['id'] ) ) . '">', '</a>' );
436 436
 
437
-		$message = $available_status[ $status ]['message'];
437
+		$message = $available_status[$status]['message'];
438 438
 
439 439
 		self::display_forms_list( $params, $message );
440 440
 	}
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
         $count = 0;
446 446
         foreach ( $ids as $id ) {
447 447
             if ( FrmForm::trash( $id ) ) {
448
-                $count++;
448
+                $count ++;
449 449
             }
450 450
         }
451 451
 
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 
476 476
         $count = 0;
477 477
         if ( FrmForm::destroy( $params['id'] ) ) {
478
-            $count++;
478
+            $count ++;
479 479
         }
480 480
 
481 481
 		$message = sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count );
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
         foreach ( $ids as $id ) {
491 491
             $d = FrmForm::destroy( $id );
492 492
             if ( $d ) {
493
-                $count++;
493
+                $count ++;
494 494
             }
495 495
         }
496 496
 
@@ -808,7 +808,7 @@  discard block
 block discarded – undo
808 808
 		if ( ! empty( $user_fields ) ) {
809 809
 			$user_helpers = array();
810 810
 			foreach ( $user_fields as $uk => $uf ) {
811
-				$user_helpers[ '|user_id| show="' . $uk . '"' ] = $uf;
811
+				$user_helpers['|user_id| show="' . $uk . '"'] = $uf;
812 812
 				unset( $uk, $uf );
813 813
 			}
814 814
 
@@ -1029,7 +1029,7 @@  discard block
 block discarded – undo
1029 1029
 				add_filter( 'frm_validate_form', 'FrmFormsController::json_error' );
1030 1030
             } else {
1031 1031
 				$vars = FrmAppHelper::json_to_array( $json_vars );
1032
-                $action = $vars[ $action ];
1032
+                $action = $vars[$action];
1033 1033
 				unset( $_REQUEST['frm_compact_fields'], $_POST['frm_compact_fields'] );
1034 1034
 				$_REQUEST = array_merge( $_REQUEST, $vars );
1035 1035
 				$_POST = array_merge( $_POST, $_REQUEST );
@@ -1104,7 +1104,7 @@  discard block
 block discarded – undo
1104 1104
         $actions = array();
1105 1105
 		foreach ( $frm_vars['forms_loaded'] as $form ) {
1106 1106
 			if ( is_object( $form ) ) {
1107
-				$actions[ $form->id ] = $form->name;
1107
+				$actions[$form->id] = $form->name;
1108 1108
 			}
1109 1109
 			unset( $form );
1110 1110
 		}
@@ -1323,8 +1323,8 @@  discard block
 block discarded – undo
1323 1323
 	private static function get_saved_errors( $form, $params ) {
1324 1324
 		global $frm_vars;
1325 1325
 
1326
-		if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][ $form->id ] ) ) {
1327
-			$errors = $frm_vars['created_entries'][ $form->id ]['errors'];
1326
+		if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][$form->id] ) ) {
1327
+			$errors = $frm_vars['created_entries'][$form->id]['errors'];
1328 1328
 		} else {
1329 1329
 			$errors = array();
1330 1330
 		}
@@ -1336,7 +1336,7 @@  discard block
 block discarded – undo
1336 1336
 	 */
1337 1337
 	public static function just_created_entry( $form_id ) {
1338 1338
 		global $frm_vars;
1339
-		return ( isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][ $form_id ] ) && isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) ? $frm_vars['created_entries'][ $form_id ]['entry_id'] : 0;
1339
+		return ( isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][$form_id] ) && isset( $frm_vars['created_entries'][$form_id]['entry_id'] ) ) ? $frm_vars['created_entries'][$form_id]['entry_id'] : 0;
1340 1340
 	}
1341 1341
 
1342 1342
 	/**
@@ -1344,7 +1344,7 @@  discard block
 block discarded – undo
1344 1344
 	 */
1345 1345
 	private static function get_confirmation_method( $atts ) {
1346 1346
 		$opt = 'success_action';
1347
-		$method = ( isset( $atts['form']->options[ $opt ] ) && ! empty( $atts['form']->options[ $opt ] ) ) ? $atts['form']->options[ $opt ] : 'message';
1347
+		$method = ( isset( $atts['form']->options[$opt] ) && ! empty( $atts['form']->options[$opt] ) ) ? $atts['form']->options[$opt] : 'message';
1348 1348
 		$method = apply_filters( 'frm_success_filter', $method, $atts['form'], 'create' );
1349 1349
 
1350 1350
 		if ( $method != 'message' && ( ! $atts['entry_id'] || ! is_numeric( $atts['entry_id'] ) ) ) {
@@ -1357,7 +1357,7 @@  discard block
 block discarded – undo
1357 1357
 	public static function maybe_trigger_redirect( $form, $params, $args ) {
1358 1358
 		if ( ! isset( $params['id'] ) ) {
1359 1359
 			global $frm_vars;
1360
-			$params['id'] = $frm_vars['created_entries'][ $form->id ]['entry_id'];
1360
+			$params['id'] = $frm_vars['created_entries'][$form->id]['entry_id'];
1361 1361
 		}
1362 1362
 
1363 1363
 		$conf_method = self::get_confirmation_method(
@@ -1399,7 +1399,7 @@  discard block
 block discarded – undo
1399 1399
 
1400 1400
 		$opt = ( ! isset( $args['action'] ) || $args['action'] == 'create' ) ? 'success' : 'edit';
1401 1401
 		$args['success_opt'] = $opt;
1402
-		if ( $args['conf_method'] == 'page' && is_numeric( $args['form']->options[ $opt . '_page_id' ] ) ) {
1402
+		if ( $args['conf_method'] == 'page' && is_numeric( $args['form']->options[$opt . '_page_id'] ) ) {
1403 1403
 			self::load_page_after_submit( $args );
1404 1404
 		} elseif ( $args['conf_method'] == 'redirect' ) {
1405 1405
 			self::redirect_after_submit( $args );
@@ -1414,8 +1414,8 @@  discard block
 block discarded – undo
1414 1414
 	private static function load_page_after_submit( $args ) {
1415 1415
 		global $post;
1416 1416
 		$opt = $args['success_opt'];
1417
-		if ( ! $post || $args['form']->options[ $opt . '_page_id' ] != $post->ID ) {
1418
-			$page = get_post( $args['form']->options[ $opt . '_page_id' ] );
1417
+		if ( ! $post || $args['form']->options[$opt . '_page_id'] != $post->ID ) {
1418
+			$page = get_post( $args['form']->options[$opt . '_page_id'] );
1419 1419
 			$old_post = $post;
1420 1420
 			$post = $page;
1421 1421
 			$content = apply_filters( 'frm_content', $page->post_content, $args['form'], $args['entry_id'] );
@@ -1433,11 +1433,11 @@  discard block
 block discarded – undo
1433 1433
 		add_filter( 'frm_use_wpautop', '__return_false' );
1434 1434
 
1435 1435
 		$opt = $args['success_opt'];
1436
-		$success_url = trim( $args['form']->options[ $opt . '_url' ] );
1436
+		$success_url = trim( $args['form']->options[$opt . '_url'] );
1437 1437
 		$success_url = apply_filters( 'frm_content', $success_url, $args['form'], $args['entry_id'] );
1438 1438
 		$success_url = do_shortcode( $success_url );
1439 1439
 
1440
-		$success_msg = isset( $args['form']->options[ $opt . '_msg' ] ) ? $args['form']->options[ $opt . '_msg' ] : __( 'Please wait while you are redirected.', 'formidable' );
1440
+		$success_msg = isset( $args['form']->options[$opt . '_msg'] ) ? $args['form']->options[$opt . '_msg'] : __( 'Please wait while you are redirected.', 'formidable' );
1441 1441
 
1442 1442
 		$redirect_msg = self::get_redirect_message( $success_url, $success_msg, $args );
1443 1443
 
Please login to merge, or discard this patch.
classes/models/FrmEntryMeta.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -281,6 +281,7 @@
 block discarded – undo
281 281
      * @param string|array $where
282 282
      * @param string $order_by
283 283
      * @param string $limit
284
+     * @param boolean $unique
284 285
      */
285 286
 	private static function get_ids_query( $where, $order_by, $limit, $unique, $args, array &$query ) {
286 287
         global $wpdb;
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 
121 121
 				if ( ( is_array( $meta_value ) && empty( $meta_value ) ) || ( ! is_array( $meta_value ) && trim( $meta_value ) == '' ) ) {
122 122
 					// remove blank fields
123
-					unset( $values[ $field_id ] );
123
+					unset( $values[$field_id] );
124 124
 				} else {
125 125
 					// if value exists, then update it
126 126
 					self::update_entry_meta( $entry_id, $field_id, '', $meta_value );
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 	 */
185 185
 	public static function get_meta_value( $entry, $field_id ) {
186 186
 		if ( isset( $entry->metas ) ) {
187
-			return isset( $entry->metas[ $field_id ] ) ? $entry->metas[ $field_id ] : false;
187
+			return isset( $entry->metas[$field_id] ) ? $entry->metas[$field_id] : false;
188 188
 		} else {
189 189
 			return self::get_entry_meta_by_field( $entry->id, $field_id );
190 190
 		}
@@ -202,8 +202,8 @@  discard block
 block discarded – undo
202 202
 			$cached = FrmDb::check_cache( $entry_id, 'frm_entry' );
203 203
 		}
204 204
 
205
-		if ( $cached && isset( $cached->metas ) && isset( $cached->metas[ $field_id ] ) ) {
206
-			$result = $cached->metas[ $field_id ];
205
+		if ( $cached && isset( $cached->metas ) && isset( $cached->metas[$field_id] ) ) {
206
+			$result = $cached->metas[$field_id];
207 207
 			return stripslashes_deep( $result );
208 208
         }
209 209
 
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
         }
245 245
 
246 246
 		foreach ( $values as $k => $v ) {
247
-			$values[ $k ] = maybe_unserialize( $v );
247
+			$values[$k] = maybe_unserialize( $v );
248 248
 			unset( $k, $v );
249 249
         }
250 250
 
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 		}
301 301
 
302 302
 		foreach ( $results as $k => $result ) {
303
-			$results[ $k ]->meta_value = stripslashes_deep( maybe_unserialize( $result->meta_value ) );
303
+			$results[$k]->meta_value = stripslashes_deep( maybe_unserialize( $result->meta_value ) );
304 304
 			unset( $k, $result );
305 305
 		}
306 306
 
Please login to merge, or discard this patch.
Indentation   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -5,23 +5,23 @@  discard block
 block discarded – undo
5 5
 
6 6
 class FrmEntryMeta {
7 7
 
8
-    /**
9
-     * @param string $meta_key
10
-     */
8
+	/**
9
+	 * @param string $meta_key
10
+	 */
11 11
 	public static function add_entry_meta( $entry_id, $field_id, $meta_key = null, $meta_value ) {
12
-        global $wpdb;
12
+		global $wpdb;
13 13
 
14
-        if ( FrmAppHelper::is_empty_value( $meta_value ) ) {
15
-            // don't save blank fields
16
-            return 0;
17
-        }
14
+		if ( FrmAppHelper::is_empty_value( $meta_value ) ) {
15
+			// don't save blank fields
16
+			return 0;
17
+		}
18 18
 
19
-        $new_values = array(
19
+		$new_values = array(
20 20
 			'meta_value'    => is_array( $meta_value ) ? serialize( array_filter( $meta_value, 'FrmAppHelper::is_not_empty_value' ) ) : trim( $meta_value ),
21
-            'item_id'       => $entry_id,
22
-            'field_id'      => $field_id,
21
+			'item_id'       => $entry_id,
22
+			'field_id'      => $field_id,
23 23
 			'created_at'    => current_time( 'mysql', 1 ),
24
-        );
24
+		);
25 25
 
26 26
 		self::set_value_before_save( $new_values );
27 27
 		$new_values = apply_filters( 'frm_add_entry_meta', $new_values );
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
 			$id = 0;
37 37
 		}
38 38
 
39
-        return $id;
40
-    }
39
+		return $id;
40
+	}
41 41
 
42 42
 	/**
43 43
 	 * @param int $entry_id
@@ -48,18 +48,18 @@  discard block
 block discarded – undo
48 48
 	 * @return bool|false|int
49 49
 	 */
50 50
 	public static function update_entry_meta( $entry_id, $field_id, $meta_key = null, $meta_value ) {
51
-        if ( ! $field_id ) {
52
-            return false;
53
-        }
51
+		if ( ! $field_id ) {
52
+			return false;
53
+		}
54 54
 
55
-        global $wpdb;
55
+		global $wpdb;
56 56
 
57 57
 		$values = array(
58 58
 			'item_id'  => $entry_id,
59 59
 			'field_id' => $field_id,
60 60
 		);
61 61
 		$where_values = $values;
62
-        $values['meta_value'] = $meta_value;
62
+		$values['meta_value'] = $meta_value;
63 63
 		self::set_value_before_save( $values );
64 64
 		$values = apply_filters( 'frm_update_entry_meta', $values );
65 65
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 		self::clear_cache();
73 73
 
74 74
 		return $wpdb->update( $wpdb->prefix . 'frm_item_metas', array( 'meta_value' => $meta_value ), $where_values );
75
-    }
75
+	}
76 76
 
77 77
 	/**
78 78
 	 * @since 3.0
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	}
105 105
 
106 106
 	public static function update_entry_metas( $entry_id, $values ) {
107
-        global $wpdb;
107
+		global $wpdb;
108 108
 
109 109
 		$prev_values = FrmDb::get_col(
110 110
 			$wpdb->prefix . 'frm_item_metas',
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 			'field_id'
116 116
 		);
117 117
 
118
-        foreach ( $values as $field_id => $meta_value ) {
118
+		foreach ( $values as $field_id => $meta_value ) {
119 119
 			$field = false;
120 120
 			if ( ! empty( $field_id ) ) {
121 121
 				$field = FrmField::getOne( $field_id );
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 		// Delete any leftovers
159 159
 		$wpdb->query( $wpdb->prepare( 'DELETE FROM ' . $wpdb->prefix . 'frm_item_metas ' . $where['where'], $where['values'] ) ); // WPCS: unprepared SQL ok.
160 160
 		self::clear_cache();
161
-    }
161
+	}
162 162
 
163 163
 	public static function duplicate_entry_metas( $old_id, $new_id ) {
164 164
 		$metas = self::get_entry_meta_info( $old_id );
@@ -170,10 +170,10 @@  discard block
 block discarded – undo
170 170
 	}
171 171
 
172 172
 	public static function delete_entry_meta( $entry_id, $field_id ) {
173
-        global $wpdb;
173
+		global $wpdb;
174 174
 		self::clear_cache();
175 175
 		return $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}frm_item_metas WHERE field_id=%d AND item_id=%d", $field_id, $entry_id ) );
176
-    }
176
+	}
177 177
 
178 178
 	/**
179 179
 	 * Clear entry meta caching
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 	}
199 199
 
200 200
 	public static function get_entry_meta_by_field( $entry_id, $field_id ) {
201
-        global $wpdb;
201
+		global $wpdb;
202 202
 
203 203
 		if ( is_object( $entry_id ) ) {
204 204
 			$entry = $entry_id;
@@ -212,89 +212,89 @@  discard block
 block discarded – undo
212 212
 		if ( $cached && isset( $cached->metas ) && isset( $cached->metas[ $field_id ] ) ) {
213 213
 			$result = $cached->metas[ $field_id ];
214 214
 			return stripslashes_deep( $result );
215
-        }
215
+		}
216 216
 
217 217
 		$get_table = $wpdb->prefix . 'frm_item_metas';
218 218
 		$query = array( 'item_id' => $entry_id );
219 219
 		if ( is_numeric( $field_id ) ) {
220 220
 			$query['field_id'] = $field_id;
221
-        } else {
221
+		} else {
222 222
 			$get_table .= ' it LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_fields fi ON it.field_id=fi.id';
223 223
 			$query['fi.field_key'] = $field_id;
224
-        }
224
+		}
225 225
 
226 226
 		$result = FrmDb::get_var( $get_table, $query, 'meta_value' );
227 227
 		$result = maybe_unserialize( $result );
228 228
 		$result = stripslashes_deep( $result );
229 229
 
230
-        return $result;
231
-    }
230
+		return $result;
231
+	}
232 232
 
233
-    public static function get_entry_metas_for_field( $field_id, $order = '', $limit = '', $args = array() ) {
233
+	public static function get_entry_metas_for_field( $field_id, $order = '', $limit = '', $args = array() ) {
234 234
 		$defaults = array(
235 235
 			'value'    => false,
236 236
 			'unique'   => false,
237 237
 			'stripslashes' => true,
238 238
 			'is_draft' => false,
239 239
 		);
240
-        $args = wp_parse_args( $args, $defaults );
240
+		$args = wp_parse_args( $args, $defaults );
241 241
 
242
-        $query = array();
242
+		$query = array();
243 243
 		self::meta_field_query( $field_id, $order, $limit, $args, $query );
244 244
 		$query = implode( ' ', $query );
245 245
 
246 246
 		$cache_key = 'entry_metas_for_field_' . $field_id . $order . $limit . maybe_serialize( $args );
247 247
 		$values = FrmDb::check_cache( $cache_key, 'frm_entry', $query, 'get_col' );
248 248
 
249
-        if ( ! $args['stripslashes'] ) {
250
-            return $values;
251
-        }
249
+		if ( ! $args['stripslashes'] ) {
250
+			return $values;
251
+		}
252 252
 
253 253
 		foreach ( $values as $k => $v ) {
254 254
 			$values[ $k ] = maybe_unserialize( $v );
255 255
 			unset( $k, $v );
256
-        }
256
+		}
257 257
 
258 258
 		return stripslashes_deep( $values );
259
-    }
259
+	}
260 260
 
261
-    /**
262
-     * @param string $order
263
-     * @param string $limit
264
-     */
261
+	/**
262
+	 * @param string $order
263
+	 * @param string $limit
264
+	 */
265 265
 	private static function meta_field_query( $field_id, $order, $limit, $args, array &$query ) {
266
-        global $wpdb;
267
-        $query[] = 'SELECT';
268
-        $query[] = $args['unique'] ? 'DISTINCT(em.meta_value)' : 'em.meta_value';
266
+		global $wpdb;
267
+		$query[] = 'SELECT';
268
+		$query[] = $args['unique'] ? 'DISTINCT(em.meta_value)' : 'em.meta_value';
269 269
 		$query[] = 'FROM ' . $wpdb->prefix . 'frm_item_metas em ';
270 270
 
271
-        if ( ! $args['is_draft'] ) {
271
+		if ( ! $args['is_draft'] ) {
272 272
 			$query[] = 'INNER JOIN ' . $wpdb->prefix . 'frm_items e ON (e.id=em.item_id)';
273
-        }
273
+		}
274 274
 
275 275
 		if ( is_numeric( $field_id ) ) {
276 276
 			$query[] = $wpdb->prepare( 'WHERE em.field_id=%d', $field_id );
277 277
 		} else {
278 278
 			$query[] = $wpdb->prepare( 'LEFT JOIN ' . $wpdb->prefix . 'frm_fields fi ON (em.field_id = fi.id) WHERE fi.field_key=%s', $field_id );
279
-        }
279
+		}
280 280
 
281
-        if ( ! $args['is_draft'] ) {
282
-            $query[] = 'AND e.is_draft=0';
283
-        }
281
+		if ( ! $args['is_draft'] ) {
282
+			$query[] = 'AND e.is_draft=0';
283
+		}
284 284
 
285
-        if ( $args['value'] ) {
285
+		if ( $args['value'] ) {
286 286
 			$query[] = $wpdb->prepare( ' AND meta_value=%s', $args['value'] );
287
-        }
288
-        $query[] = $order . $limit;
289
-    }
287
+		}
288
+		$query[] = $order . $limit;
289
+	}
290 290
 
291 291
 	public static function get_entry_meta_info( $entry_id ) {
292 292
 		return FrmDb::get_results( 'frm_item_metas', array( 'item_id' => $entry_id ) );
293
-    }
293
+	}
294 294
 
295 295
 	public static function getAll( $where = array(), $order_by = '', $limit = '', $stripslashes = false ) {
296
-        global $wpdb;
297
-        $query = 'SELECT it.*, fi.type as field_type, fi.field_key as field_key,
296
+		global $wpdb;
297
+		$query = 'SELECT it.*, fi.type as field_type, fi.field_key as field_key,
298 298
             fi.required as required, fi.form_id as field_form_id, fi.name as field_name, fi.options as fi_options
299 299
 			FROM ' . $wpdb->prefix . 'frm_item_metas it LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_fields fi ON it.field_id=fi.id' .
300 300
 			FrmDb::prepend_and_or_where( ' WHERE ', $where ) . $order_by . $limit;
@@ -312,9 +312,9 @@  discard block
 block discarded – undo
312 312
 		}
313 313
 
314 314
 		return $results;
315
-    }
315
+	}
316 316
 
317
-    public static function getEntryIds( $where = array(), $order_by = '', $limit = '', $unique = true, $args = array() ) {
317
+	public static function getEntryIds( $where = array(), $order_by = '', $limit = '', $unique = true, $args = array() ) {
318 318
 		$defaults = array(
319 319
 			'is_draft' => false,
320 320
 			'user_id'  => '',
@@ -322,22 +322,22 @@  discard block
 block discarded – undo
322 322
 		);
323 323
 		$args = wp_parse_args( $args, $defaults );
324 324
 
325
-        $query = array();
325
+		$query = array();
326 326
 		self::get_ids_query( $where, $order_by, $limit, $unique, $args, $query );
327 327
 		$query = implode( ' ', $query );
328 328
 
329 329
 		$cache_key = 'ids_' . maybe_serialize( $where ) . $order_by . 'l' . $limit . 'u' . $unique . maybe_serialize( $args );
330 330
 		return FrmDb::check_cache( $cache_key, 'frm_entry', $query, ( $limit == ' LIMIT 1' ? 'get_var' : 'get_col' ) );
331
-    }
331
+	}
332 332
 
333
-    /**
334
-     * @param string|array $where
335
-     * @param string $order_by
336
-     * @param string $limit
337
-     */
333
+	/**
334
+	 * @param string|array $where
335
+	 * @param string $order_by
336
+	 * @param string $limit
337
+	 */
338 338
 	private static function get_ids_query( $where, $order_by, $limit, $unique, $args, array &$query ) {
339
-        global $wpdb;
340
-        $query[] = 'SELECT';
339
+		global $wpdb;
340
+		$query[] = 'SELECT';
341 341
 
342 342
 		$defaults = array( 'return_parent_id' => false );
343 343
 		$args = array_merge( $defaults, $args );
@@ -352,30 +352,30 @@  discard block
 block discarded – undo
352 352
 
353 353
 		$query[] = 'INNER JOIN ' . $wpdb->prefix . 'frm_items e ON (e.id=it.item_id)';
354 354
 		if ( is_array( $where ) ) {
355
-            if ( ! $args['is_draft'] ) {
356
-                $where['e.is_draft'] = 0;
357
-            } else if ( $args['is_draft'] == 1 ) {
358
-                $where['e.is_draft'] = 1;
359
-            }
355
+			if ( ! $args['is_draft'] ) {
356
+				$where['e.is_draft'] = 0;
357
+			} else if ( $args['is_draft'] == 1 ) {
358
+				$where['e.is_draft'] = 1;
359
+			}
360 360
 
361 361
 			if ( ! empty( $args['user_id'] ) ) {
362
-                $where['e.user_id'] = $args['user_id'];
363
-            }
362
+				$where['e.user_id'] = $args['user_id'];
363
+			}
364 364
 			$query[] = FrmDb::prepend_and_or_where( ' WHERE ', $where ) . $order_by . $limit;
365 365
 
366 366
 			if ( $args['group_by'] ) {
367 367
 				$query[] = ' GROUP BY ' . sanitize_text_field( $args['group_by'] );
368 368
 			}
369
-            return;
370
-        }
369
+			return;
370
+		}
371 371
 
372 372
 		$draft_where = '';
373 373
 		$user_where = '';
374
-        if ( ! $args['is_draft'] ) {
374
+		if ( ! $args['is_draft'] ) {
375 375
 			$draft_where = $wpdb->prepare( ' AND e.is_draft=%d', 0 );
376
-        } else if ( $args['is_draft'] == 1 ) {
376
+		} else if ( $args['is_draft'] == 1 ) {
377 377
 			$draft_where = $wpdb->prepare( ' AND e.is_draft=%d', 1 );
378
-        }
378
+		}
379 379
 
380 380
 		if ( ! empty( $args['user_id'] ) ) {
381 381
 			$user_where = $wpdb->prepare( ' AND e.user_id=%d', $args['user_id'] );
@@ -384,56 +384,56 @@  discard block
 block discarded – undo
384 384
 		if ( strpos( $where, ' GROUP BY ' ) ) {
385 385
 			// don't inject WHERE filtering after GROUP BY
386 386
 			$parts = explode( ' GROUP BY ', $where );
387
-            $where = $parts[0];
388
-            $where .= $draft_where . $user_where;
387
+			$where = $parts[0];
388
+			$where .= $draft_where . $user_where;
389 389
 			$where .= ' GROUP BY ' . $parts[1];
390
-        } else {
391
-            $where .= $draft_where . $user_where;
392
-        }
390
+		} else {
391
+			$where .= $draft_where . $user_where;
392
+		}
393 393
 
394 394
 		// The query has already been prepared
395 395
 		$query[] = FrmDb::prepend_and_or_where( ' WHERE ', $where ) . $order_by . $limit;
396
-    }
396
+	}
397 397
 
398
-    public static function search_entry_metas( $search, $field_id = '', $operator ) {
398
+	public static function search_entry_metas( $search, $field_id = '', $operator ) {
399 399
 		$cache_key = 'search_' . maybe_serialize( $search ) . $field_id . $operator;
400 400
 		$results = wp_cache_get( $cache_key, 'frm_entry' );
401
-        if ( false !== $results ) {
402
-            return $results;
403
-        }
401
+		if ( false !== $results ) {
402
+			return $results;
403
+		}
404 404
 
405
-        global $wpdb;
405
+		global $wpdb;
406 406
 		if ( is_array( $search ) ) {
407
-            $where = '';
407
+			$where = '';
408 408
 			foreach ( $search as $field => $value ) {
409 409
 				if ( $value <= 0 || ! in_array( $field, array( 'year', 'month', 'day' ) ) ) {
410
-                    continue;
411
-                }
410
+					continue;
411
+				}
412 412
 
413
-                switch ( $field ) {
414
-                    case 'year':
413
+				switch ( $field ) {
414
+					case 'year':
415 415
 						$value = '%' . $value;
416 416
 						break;
417
-                    case 'month':
418
-                        $value .= '%';
417
+					case 'month':
418
+						$value .= '%';
419 419
 						break;
420
-                    case 'day':
420
+					case 'day':
421 421
 						$value = '%' . $value . '%';
422
-                }
422
+				}
423 423
 				$where .= $wpdb->prepare( ' meta_value ' . $operator . ' %s and', $value ); // WPCS: unprepared SQL ok.
424
-            }
424
+			}
425 425
 			$where .= $wpdb->prepare( ' field_id=%d', $field_id );
426 426
 			$query = 'SELECT DISTINCT item_id FROM ' . $wpdb->prefix . 'frm_item_metas' . FrmDb::prepend_and_or_where( ' WHERE ', $where );
427
-        } else {
427
+		} else {
428 428
 			if ( $operator == 'LIKE' ) {
429
-                $search = '%' . $search . '%';
429
+				$search = '%' . $search . '%';
430 430
 			}
431 431
 			$query = $wpdb->prepare( "SELECT DISTINCT item_id FROM {$wpdb->prefix}frm_item_metas WHERE meta_value {$operator} %s and field_id = %d", $search, $field_id ); // WPCS: unprepared SQL ok.
432
-        }
432
+		}
433 433
 
434 434
 		$results = $wpdb->get_col( $query, 0 ); // WPCS: unprepared SQL ok.
435 435
 		FrmDb::set_cache( $cache_key, $results, 'frm_entry' );
436 436
 
437
-        return $results;
438
-    }
437
+		return $results;
438
+	}
439 439
 }
Please login to merge, or discard this patch.
classes/models/FrmFieldOption.php 1 patch
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -31,6 +31,10 @@
 block discarded – undo
31 31
 	 */
32 32
 	protected $option_label = '';
33 33
 
34
+	/**
35
+	 * @param string $option_key
36
+	 * @param string $option
37
+	 */
34 38
 	public function __construct( $option_key, $option, $args = array() ) {
35 39
 		$this->option_key = $option_key;
36 40
 		$this->option = $option;
Please login to merge, or discard this patch.
classes/models/FrmFieldValueSelector.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@
 block discarded – undo
75 75
 	/**
76 76
 	 * FrmFieldValueSelector constructor
77 77
 	 *
78
-	 * @param int|string $field_id
78
+	 * @param integer $field_id
79 79
 	 */
80 80
 	public function __construct( $field_id, $args ) {
81 81
 		$this->set_html_name( $args );
Please login to merge, or discard this patch.
classes/models/FrmEntry.php 3 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -180,6 +180,7 @@  discard block
 block discarded – undo
180 180
 	*
181 181
 	* @param int $id
182 182
 	* @param array $values
183
+	* @param string $update_type
183 184
 	* @return boolean|int $query_results
184 185
 	*/
185 186
 	private static function update_entry( $id, $values, $update_type ) {
@@ -563,6 +564,9 @@  discard block
 block discarded – undo
563 564
 		return $new_values;
564 565
 	}
565 566
 
567
+	/**
568
+	 * @param string $name
569
+	 */
566 570
 	private static function get_entry_value( $values, $name, $default ) {
567 571
 		return isset( $values[ $name ] ) ? $values[ $name ] : $default;
568 572
 	}
Please login to merge, or discard this patch.
Indentation   +305 added lines, -305 removed lines patch added patch discarded remove patch
@@ -6,11 +6,11 @@  discard block
 block discarded – undo
6 6
 class FrmEntry {
7 7
 
8 8
 	/**
9
-	* Create a new entry
10
-	*
11
-	* @param array $values
12
-	* @return int | boolean $entry_id
13
-	*/
9
+	 * Create a new entry
10
+	 *
11
+	 * @param array $values
12
+	 * @return int | boolean $entry_id
13
+	 */
14 14
 	public static function create( $values ) {
15 15
 		$entry_id = self::create_entry( $values, 'standard' );
16 16
 
@@ -18,12 +18,12 @@  discard block
 block discarded – undo
18 18
 	}
19 19
 
20 20
 	/**
21
-	* Create a new entry with some differences depending on type
22
-	*
23
-	* @param array $values
24
-	* @param string $type
25
-	* @return int | boolean $entry_id
26
-	*/
21
+	 * Create a new entry with some differences depending on type
22
+	 *
23
+	 * @param array $values
24
+	 * @param string $type
25
+	 * @return int | boolean $entry_id
26
+	 */
27 27
 	private static function create_entry( $values, $type ) {
28 28
 		$new_values = self::before_insert_entry_in_database( $values, $type );
29 29
 
@@ -37,10 +37,10 @@  discard block
 block discarded – undo
37 37
 		return $entry_id;
38 38
 	}
39 39
 
40
-    /**
41
-     * check for duplicate entries created in the last minute
42
-     * @return boolean
43
-     */
40
+	/**
41
+	 * check for duplicate entries created in the last minute
42
+	 * @return boolean
43
+	 */
44 44
 	public static function is_duplicate( $new_values, $values ) {
45 45
 		$duplicate_entry_time = apply_filters( 'frm_time_to_check_duplicates', 60, $new_values );
46 46
 
@@ -48,40 +48,40 @@  discard block
 block discarded – undo
48 48
 			return false;
49 49
 		}
50 50
 
51
-        $check_val = $new_values;
51
+		$check_val = $new_values;
52 52
 		$check_val['created_at >'] = date( 'Y-m-d H:i:s', ( strtotime( $new_values['created_at'] ) - absint( $duplicate_entry_time ) ) );
53 53
 
54 54
 		unset( $check_val['created_at'], $check_val['updated_at'] );
55 55
 		unset( $check_val['is_draft'], $check_val['id'], $check_val['item_key'] );
56 56
 
57
-        if ( $new_values['item_key'] == $new_values['name'] ) {
57
+		if ( $new_values['item_key'] == $new_values['name'] ) {
58 58
 			unset( $check_val['name'] );
59
-        }
59
+		}
60 60
 
61
-        global $wpdb;
61
+		global $wpdb;
62 62
 		$entry_exists = FrmDb::get_col( $wpdb->prefix . 'frm_items', $check_val, 'id', array( 'order_by' => 'created_at DESC' ) );
63 63
 
64 64
 		if ( ! $entry_exists || empty( $entry_exists ) || ! isset( $values['item_meta'] ) ) {
65
-            return false;
66
-        }
65
+			return false;
66
+		}
67 67
 
68
-        $is_duplicate = false;
69
-        foreach ( $entry_exists as $entry_exist ) {
70
-            $is_duplicate = true;
68
+		$is_duplicate = false;
69
+		foreach ( $entry_exists as $entry_exist ) {
70
+			$is_duplicate = true;
71 71
 
72 72
 			// make sure it's a duplicate
73 73
 			$metas = FrmEntryMeta::get_entry_meta_info( $entry_exist );
74
-            $field_metas = array();
75
-            foreach ( $metas as $meta ) {
74
+			$field_metas = array();
75
+			foreach ( $metas as $meta ) {
76 76
 				$field_metas[ $meta->field_id ] = $meta->meta_value;
77
-            }
77
+			}
78 78
 
79
-            // If prev entry is empty and current entry is not, they are not duplicates
80
-            $filtered_vals = array_filter( $values['item_meta'] );
79
+			// If prev entry is empty and current entry is not, they are not duplicates
80
+			$filtered_vals = array_filter( $values['item_meta'] );
81 81
 			$field_metas   = array_filter( $field_metas );
82
-            if ( empty( $field_metas ) && ! empty( $filtered_vals ) ) {
83
-                return false;
84
-            }
82
+			if ( empty( $field_metas ) && ! empty( $filtered_vals ) ) {
83
+				return false;
84
+			}
85 85
 
86 86
 			// compare serialized values and not arrays
87 87
 			$new_meta = array_map( 'maybe_serialize', $filtered_vals );
@@ -98,20 +98,20 @@  discard block
 block discarded – undo
98 98
 			}
99 99
 
100 100
 			$diff = array_diff_assoc( $field_metas, $new_meta );
101
-            foreach ( $diff as $field_id => $meta_value ) {
101
+			foreach ( $diff as $field_id => $meta_value ) {
102 102
 				if ( ! empty( $meta_value ) ) {
103
-                    $is_duplicate = false;
104
-                    continue;
105
-                }
106
-            }
103
+					$is_duplicate = false;
104
+					continue;
105
+				}
106
+			}
107 107
 
108
-            if ( $is_duplicate ) {
108
+			if ( $is_duplicate ) {
109 109
 				break;
110
-            }
111
-        }
110
+			}
111
+		}
112 112
 
113
-        return $is_duplicate;
114
-    }
113
+		return $is_duplicate;
114
+	}
115 115
 
116 116
 	/**
117 117
 	 * Determine if an entry needs to be checked as a possible duplicate
@@ -156,32 +156,32 @@  discard block
 block discarded – undo
156 156
 		$new_values['updated_at'] = $new_values['created_at'];
157 157
 
158 158
 		$query_results = $wpdb->insert( $wpdb->prefix . 'frm_items', $new_values );
159
-        if ( ! $query_results ) {
160
-            return false;
161
-        }
159
+		if ( ! $query_results ) {
160
+			return false;
161
+		}
162 162
 
163
-        $entry_id = $wpdb->insert_id;
163
+		$entry_id = $wpdb->insert_id;
164 164
 
165
-        global $frm_vars;
165
+		global $frm_vars;
166 166
 		if ( ! isset( $frm_vars['saved_entries'] ) ) {
167
-            $frm_vars['saved_entries'] = array();
168
-        }
169
-        $frm_vars['saved_entries'][] = (int) $entry_id;
167
+			$frm_vars['saved_entries'] = array();
168
+		}
169
+		$frm_vars['saved_entries'][] = (int) $entry_id;
170 170
 
171 171
 		FrmEntryMeta::duplicate_entry_metas( $id, $entry_id );
172 172
 		self::clear_cache();
173 173
 
174 174
 		do_action( 'frm_after_duplicate_entry', $entry_id, $new_values['form_id'], array( 'old_id' => $id ) );
175
-        return $entry_id;
176
-    }
175
+		return $entry_id;
176
+	}
177 177
 
178 178
 	/**
179
-	* Update an entry (not via XML)
180
-	*
181
-	* @param int $id
182
-	* @param array $values
183
-	* @return boolean|int $update_results
184
-	*/
179
+	 * Update an entry (not via XML)
180
+	 *
181
+	 * @param int $id
182
+	 * @param array $values
183
+	 * @return boolean|int $update_results
184
+	 */
185 185
 	public static function update( $id, $values ) {
186 186
 		$update_results = self::update_entry( $id, $values, 'standard' );
187 187
 
@@ -189,14 +189,14 @@  discard block
 block discarded – undo
189 189
 	}
190 190
 
191 191
 	/**
192
-	* Update an entry with some differences depending on the update type
193
-	*
194
-	* @since 2.0.16
195
-	*
196
-	* @param int $id
197
-	* @param array $values
198
-	* @return boolean|int $query_results
199
-	*/
192
+	 * Update an entry with some differences depending on the update type
193
+	 *
194
+	 * @since 2.0.16
195
+	 *
196
+	 * @param int $id
197
+	 * @param array $values
198
+	 * @return boolean|int $query_results
199
+	 */
200 200
 	private static function update_entry( $id, $values, $update_type ) {
201 201
 		global $wpdb;
202 202
 
@@ -215,14 +215,14 @@  discard block
 block discarded – undo
215 215
 	}
216 216
 
217 217
 	public static function destroy( $id ) {
218
-        global $wpdb;
219
-        $id = (int) $id;
218
+		global $wpdb;
219
+		$id = (int) $id;
220 220
 
221 221
 		$entry = self::getOne( $id );
222
-        if ( ! $entry ) {
223
-            $result = false;
224
-            return $result;
225
-        }
222
+		if ( ! $entry ) {
223
+			$result = false;
224
+			return $result;
225
+		}
226 226
 
227 227
 		do_action( 'frm_before_destroy_entry', $id, $entry );
228 228
 
@@ -231,18 +231,18 @@  discard block
 block discarded – undo
231 231
 
232 232
 		self::clear_cache();
233 233
 
234
-        return $result;
235
-    }
234
+		return $result;
235
+	}
236 236
 
237 237
 	public static function update_form( $id, $value, $form_id ) {
238
-        global $wpdb;
238
+		global $wpdb;
239 239
 		$form_id = isset( $value ) ? $form_id : null;
240 240
 		$result = $wpdb->update( $wpdb->prefix . 'frm_items', array( 'form_id' => $form_id ), array( 'id' => $id ) );
241 241
 		if ( $result ) {
242 242
 			self::clear_cache();
243 243
 		}
244
-        return $result;
245
-    }
244
+		return $result;
245
+	}
246 246
 
247 247
 	/**
248 248
 	 * Clear entry caching
@@ -284,19 +284,19 @@  discard block
 block discarded – undo
284 284
 	}
285 285
 
286 286
 	public static function getOne( $id, $meta = false ) {
287
-        global $wpdb;
287
+		global $wpdb;
288 288
 
289
-        $query = "SELECT it.*, fr.name as form_name, fr.form_key as form_key FROM {$wpdb->prefix}frm_items it
289
+		$query = "SELECT it.*, fr.name as form_name, fr.form_key as form_key FROM {$wpdb->prefix}frm_items it
290 290
                   LEFT OUTER JOIN {$wpdb->prefix}frm_forms fr ON it.form_id=fr.id WHERE ";
291 291
 
292 292
 		$query .= is_numeric( $id ) ? 'it.id=%d' : 'it.item_key=%s';
293
-        $query_args = array( $id );
294
-        $query = $wpdb->prepare( $query, $query_args ); // WPCS: unprepared SQL ok.
293
+		$query_args = array( $id );
294
+		$query = $wpdb->prepare( $query, $query_args ); // WPCS: unprepared SQL ok.
295 295
 
296
-        if ( ! $meta ) {
296
+		if ( ! $meta ) {
297 297
 			$entry = FrmDb::check_cache( $id . '_nometa', 'frm_entry', $query, 'get_row' );
298 298
 			return stripslashes_deep( $entry );
299
-        }
299
+		}
300 300
 
301 301
 		$entry = FrmDb::check_cache( $id, 'frm_entry' );
302 302
 		if ( $entry !== false ) {
@@ -307,14 +307,14 @@  discard block
 block discarded – undo
307 307
 		$entry = self::get_meta( $entry );
308 308
 
309 309
 		return stripslashes_deep( $entry );
310
-    }
310
+	}
311 311
 
312 312
 	public static function get_meta( $entry ) {
313
-        if ( ! $entry ) {
314
-            return $entry;
315
-        }
313
+		if ( ! $entry ) {
314
+			return $entry;
315
+		}
316 316
 
317
-        global $wpdb;
317
+		global $wpdb;
318 318
 		$metas = FrmDb::get_results(
319 319
 			$wpdb->prefix . 'frm_item_metas m LEFT JOIN ' . $wpdb->prefix . 'frm_fields f ON m.field_id=f.id',
320 320
 			array(
@@ -324,56 +324,56 @@  discard block
 block discarded – undo
324 324
 			'field_id, meta_value, field_key, item_id'
325 325
 		);
326 326
 
327
-        $entry->metas = array();
327
+		$entry->metas = array();
328 328
 
329 329
 		$include_key = apply_filters( 'frm_include_meta_keys', false, array( 'form_id' => $entry->form_id ) );
330
-        foreach ( $metas as $meta_val ) {
331
-            if ( $meta_val->item_id == $entry->id ) {
330
+		foreach ( $metas as $meta_val ) {
331
+			if ( $meta_val->item_id == $entry->id ) {
332 332
 				$entry->metas[ $meta_val->field_id ] = maybe_unserialize( $meta_val->meta_value );
333 333
 				if ( $include_key ) {
334 334
 					$entry->metas[ $meta_val->field_key ] = $entry->metas[ $meta_val->field_id ];
335 335
 				}
336
-                 continue;
337
-            }
336
+				 continue;
337
+			}
338 338
 
339
-            // include sub entries in an array
339
+			// include sub entries in an array
340 340
 			if ( ! isset( $entry_metas[ $meta_val->field_id ] ) ) {
341 341
 				$entry->metas[ $meta_val->field_id ] = array();
342
-            }
342
+			}
343 343
 
344 344
 			$entry->metas[ $meta_val->field_id ][] = maybe_unserialize( $meta_val->meta_value );
345 345
 
346 346
 			unset( $meta_val );
347
-        }
347
+		}
348 348
 		unset( $metas );
349 349
 
350 350
 		FrmDb::set_cache( $entry->id, $entry, 'frm_entry' );
351 351
 
352
-        return $entry;
353
-    }
352
+		return $entry;
353
+	}
354 354
 
355
-    /**
356
-     * @param string $id
357
-     */
355
+	/**
356
+	 * @param string $id
357
+	 */
358 358
 	public static function exists( $id ) {
359
-        global $wpdb;
359
+		global $wpdb;
360 360
 
361
-        if ( FrmDb::check_cache( $id, 'frm_entry' ) ) {
362
-            $exists = true;
363
-            return $exists;
364
-        }
361
+		if ( FrmDb::check_cache( $id, 'frm_entry' ) ) {
362
+			$exists = true;
363
+			return $exists;
364
+		}
365 365
 
366 366
 		if ( is_numeric( $id ) ) {
367
-            $where = array( 'id' => $id );
368
-        } else {
369
-            $where = array( 'item_key' => $id );
370
-        }
367
+			$where = array( 'id' => $id );
368
+		} else {
369
+			$where = array( 'item_key' => $id );
370
+		}
371 371
 		$id = FrmDb::get_var( $wpdb->prefix . 'frm_items', $where );
372 372
 
373 373
 		return ( $id && $id > 0 );
374
-    }
374
+	}
375 375
 
376
-    public static function getAll( $where, $order_by = '', $limit = '', $meta = false, $inc_form = true ) {
376
+	public static function getAll( $where, $order_by = '', $limit = '', $meta = false, $inc_form = true ) {
377 377
 		global $wpdb;
378 378
 
379 379
 		$limit = FrmDb::esc_limit( $limit );
@@ -381,21 +381,21 @@  discard block
 block discarded – undo
381 381
 		$cache_key = maybe_serialize( $where ) . $order_by . $limit . $inc_form;
382 382
 		$entries = wp_cache_get( $cache_key, 'frm_entry' );
383 383
 
384
-        if ( false === $entries ) {
385
-            $fields = 'it.id, it.item_key, it.name, it.ip, it.form_id, it.post_id, it.user_id, it.parent_item_id, it.updated_by, it.created_at, it.updated_at, it.is_draft';
384
+		if ( false === $entries ) {
385
+			$fields = 'it.id, it.item_key, it.name, it.ip, it.form_id, it.post_id, it.user_id, it.parent_item_id, it.updated_by, it.created_at, it.updated_at, it.is_draft';
386 386
 			$table = $wpdb->prefix . 'frm_items it ';
387 387
 
388
-            if ( $inc_form ) {
389
-                $fields = 'it.*, fr.name as form_name,fr.form_key as form_key';
390
-                $table .= 'LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_forms fr ON it.form_id=fr.id ';
391
-            }
388
+			if ( $inc_form ) {
389
+				$fields = 'it.*, fr.name as form_name,fr.form_key as form_key';
390
+				$table .= 'LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_forms fr ON it.form_id=fr.id ';
391
+			}
392 392
 
393
-            if ( preg_match( '/ meta_([0-9]+)/', $order_by, $order_matches ) ) {
394
-    		    // sort by a requested field
395
-                $field_id = (int) $order_matches[1];
393
+			if ( preg_match( '/ meta_([0-9]+)/', $order_by, $order_matches ) ) {
394
+				// sort by a requested field
395
+				$field_id = (int) $order_matches[1];
396 396
 				$fields .= ', (SELECT meta_value FROM ' . $wpdb->prefix . 'frm_item_metas WHERE field_id = ' . $field_id . ' AND item_id = it.id) as meta_' . $field_id;
397 397
 				unset( $order_matches, $field_id );
398
-		    }
398
+			}
399 399
 
400 400
 			// prepare the query
401 401
 			$query = 'SELECT ' . $fields . ' FROM ' . $table . FrmDb::prepend_and_or_where( ' WHERE ', $where ) . $order_by . $limit;
@@ -404,45 +404,45 @@  discard block
 block discarded – undo
404 404
 			unset( $query );
405 405
 
406 406
 			FrmDb::set_cache( $cache_key, $entries, 'frm_entry' );
407
-        }
407
+		}
408 408
 
409
-        if ( ! $meta || ! $entries ) {
409
+		if ( ! $meta || ! $entries ) {
410 410
 			return stripslashes_deep( $entries );
411
-        }
411
+		}
412 412
 		unset( $meta );
413 413
 
414 414
 		if ( ! is_array( $where ) && preg_match( '/^it\.form_id=\d+$/', $where ) ) {
415 415
 			$where = array( 'it.form_id' => substr( $where, 11 ) );
416
-        }
416
+		}
417 417
 
418
-        $meta_where = array( 'field_id !' => 0 );
418
+		$meta_where = array( 'field_id !' => 0 );
419 419
 		if ( $limit == '' && is_array( $where ) && count( $where ) == 1 && isset( $where['it.form_id'] ) ) {
420
-            $meta_where['fi.form_id'] = $where['it.form_id'];
421
-        } else {
422
-            $meta_where['item_id'] = array_keys( $entries );
423
-        }
420
+			$meta_where['fi.form_id'] = $where['it.form_id'];
421
+		} else {
422
+			$meta_where['item_id'] = array_keys( $entries );
423
+		}
424 424
 
425
-        $metas = FrmDb::get_results( $wpdb->prefix . 'frm_item_metas it LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_fields fi ON (it.field_id = fi.id)', $meta_where, 'item_id, meta_value, field_id, field_key, form_id' );
425
+		$metas = FrmDb::get_results( $wpdb->prefix . 'frm_item_metas it LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_fields fi ON (it.field_id = fi.id)', $meta_where, 'item_id, meta_value, field_id, field_key, form_id' );
426 426
 
427
-        unset( $meta_where );
427
+		unset( $meta_where );
428 428
 
429
-        if ( ! $metas ) {
429
+		if ( ! $metas ) {
430 430
 			return stripslashes_deep( $entries );
431
-        }
431
+		}
432 432
 
433
-        foreach ( $metas as $m_key => $meta_val ) {
434
-            if ( ! isset( $entries[ $meta_val->item_id ] ) ) {
435
-                continue;
436
-            }
433
+		foreach ( $metas as $m_key => $meta_val ) {
434
+			if ( ! isset( $entries[ $meta_val->item_id ] ) ) {
435
+				continue;
436
+			}
437 437
 
438
-            if ( ! isset( $entries[ $meta_val->item_id ]->metas ) ) {
438
+			if ( ! isset( $entries[ $meta_val->item_id ]->metas ) ) {
439 439
 				$entries[ $meta_val->item_id ]->metas = array();
440
-            }
440
+			}
441 441
 
442 442
 			$entries[ $meta_val->item_id ]->metas[ $meta_val->field_id ] = maybe_unserialize( $meta_val->meta_value );
443 443
 
444 444
 			unset( $m_key, $meta_val );
445
-        }
445
+		}
446 446
 
447 447
 		if ( ! FrmAppHelper::prevent_caching() ) {
448 448
 			foreach ( $entries as $entry ) {
@@ -452,30 +452,30 @@  discard block
 block discarded – undo
452 452
 		}
453 453
 
454 454
 		return stripslashes_deep( $entries );
455
-    }
455
+	}
456 456
 
457
-    // Pagination Methods
458
-    public static function getRecordCount( $where = '' ) {
459
-        global $wpdb;
457
+	// Pagination Methods
458
+	public static function getRecordCount( $where = '' ) {
459
+		global $wpdb;
460 460
 		$table_join = $wpdb->prefix . 'frm_items it LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_forms fr ON it.form_id=fr.id';
461 461
 
462 462
 		if ( is_numeric( $where ) ) {
463
-            $table_join = 'frm_items';
464
-            $where = array( 'form_id' => $where );
465
-        }
463
+			$table_join = 'frm_items';
464
+			$where = array( 'form_id' => $where );
465
+		}
466 466
 
467
-        if ( is_array( $where ) ) {
468
-            $count = FrmDb::get_count( $table_join, $where );
469
-        } else {
467
+		if ( is_array( $where ) ) {
468
+			$count = FrmDb::get_count( $table_join, $where );
469
+		} else {
470 470
 			$cache_key = 'count_' . maybe_serialize( $where );
471 471
 			$query = 'SELECT COUNT(*) FROM ' . $table_join . FrmDb::prepend_and_or_where( ' WHERE ', $where );
472 472
 			$count = FrmDb::check_cache( $cache_key, 'frm_entry', $query, 'get_var' );
473
-        }
473
+		}
474 474
 
475
-        return $count;
476
-    }
475
+		return $count;
476
+	}
477 477
 
478
-    public static function getPageCount( $p_size, $where = '' ) {
478
+	public static function getPageCount( $p_size, $where = '' ) {
479 479
 		$p_size = (int) $p_size;
480 480
 		$count = 1;
481 481
 		if ( $p_size ) {
@@ -486,16 +486,16 @@  discard block
 block discarded – undo
486 486
 		}
487 487
 
488 488
 		return $count;
489
-    }
489
+	}
490 490
 
491 491
 	/**
492
-	* Prepare the data before inserting it into the database
493
-	*
494
-	* @since 2.0.16
495
-	* @param array $values
496
-	* @param string $type
497
-	* @return array $new_values
498
-	*/
492
+	 * Prepare the data before inserting it into the database
493
+	 *
494
+	 * @since 2.0.16
495
+	 * @param array $values
496
+	 * @param string $type
497
+	 * @return array $new_values
498
+	 */
499 499
 	private static function before_insert_entry_in_database( &$values, $type ) {
500 500
 
501 501
 		self::sanitize_entry_post( $values );
@@ -510,13 +510,13 @@  discard block
 block discarded – undo
510 510
 	}
511 511
 
512 512
 	/**
513
-	* Create an entry and perform after create actions
514
-	*
515
-	* @since 2.0.16
516
-	* @param array $values
517
-	* @param array $new_values
518
-	* @return boolean|int $entry_id
519
-	*/
513
+	 * Create an entry and perform after create actions
514
+	 *
515
+	 * @since 2.0.16
516
+	 * @param array $values
517
+	 * @param array $new_values
518
+	 * @return boolean|int $entry_id
519
+	 */
520 520
 	private static function continue_to_create_entry( $values, $new_values ) {
521 521
 		$entry_id = self::insert_entry_into_database( $new_values );
522 522
 		if ( ! $entry_id ) {
@@ -528,37 +528,37 @@  discard block
 block discarded – undo
528 528
 		return $entry_id;
529 529
 	}
530 530
 
531
-    /**
532
-     * Sanitize the POST values before we use them
533
-     *
534
-     * @since 2.0
535
-     * @param array $values The POST values by reference
536
-     */
537
-    public static function sanitize_entry_post( &$values ) {
538
-        $sanitize_method = array(
539
-            'form_id'       => 'absint',
540
-            'frm_action'    => 'sanitize_title',
541
-            'form_key'      => 'sanitize_title',
542
-            'item_key'      => 'sanitize_title',
543
-            'item_name'     => 'sanitize_text_field',
544
-            'frm_saving_draft' => 'absint',
545
-            'is_draft'      => 'absint',
546
-            'post_id'       => 'absint',
547
-            'parent_item_id' => 'absint',
548
-            'created_at'    => 'sanitize_text_field',
549
-            'updated_at'    => 'sanitize_text_field',
550
-        );
551
-
552
-        FrmAppHelper::sanitize_request( $sanitize_method, $values );
553
-    }
531
+	/**
532
+	 * Sanitize the POST values before we use them
533
+	 *
534
+	 * @since 2.0
535
+	 * @param array $values The POST values by reference
536
+	 */
537
+	public static function sanitize_entry_post( &$values ) {
538
+		$sanitize_method = array(
539
+			'form_id'       => 'absint',
540
+			'frm_action'    => 'sanitize_title',
541
+			'form_key'      => 'sanitize_title',
542
+			'item_key'      => 'sanitize_title',
543
+			'item_name'     => 'sanitize_text_field',
544
+			'frm_saving_draft' => 'absint',
545
+			'is_draft'      => 'absint',
546
+			'post_id'       => 'absint',
547
+			'parent_item_id' => 'absint',
548
+			'created_at'    => 'sanitize_text_field',
549
+			'updated_at'    => 'sanitize_text_field',
550
+		);
551
+
552
+		FrmAppHelper::sanitize_request( $sanitize_method, $values );
553
+	}
554 554
 
555 555
 	/**
556
-	* Prepare the new values for inserting into the database
557
-	*
558
-	* @since 2.0.16
559
-	* @param array $values
560
-	* @return array $new_values
561
-	*/
556
+	 * Prepare the new values for inserting into the database
557
+	 *
558
+	 * @since 2.0.16
559
+	 * @param array $values
560
+	 * @return array $new_values
561
+	 */
562 562
 	private static function package_entry_data( &$values ) {
563 563
 		global $wpdb;
564 564
 
@@ -611,34 +611,34 @@  discard block
 block discarded – undo
611 611
 	}
612 612
 
613 613
 	/**
614
-	* Get the is_draft value for a new entry
615
-	*
616
-	* @since 2.0.16
617
-	* @param array $values
618
-	* @return int
619
-	*/
614
+	 * Get the is_draft value for a new entry
615
+	 *
616
+	 * @since 2.0.16
617
+	 * @param array $values
618
+	 * @return int
619
+	 */
620 620
 	private static function get_is_draft_value( $values ) {
621 621
 		return ( ( isset( $values['frm_saving_draft'] ) && $values['frm_saving_draft'] == 1 ) || ( isset( $values['is_draft'] ) && $values['is_draft'] == 1 ) ) ? 1 : 0;
622 622
 	}
623 623
 
624 624
 	/**
625
-	* Get the created_at value for a new entry
626
-	*
627
-	* @since 2.0.16
628
-	* @param array $values
629
-	* @return string
630
-	*/
625
+	 * Get the created_at value for a new entry
626
+	 *
627
+	 * @since 2.0.16
628
+	 * @param array $values
629
+	 * @return string
630
+	 */
631 631
 	private static function get_created_at( $values ) {
632 632
 		return self::get_entry_value( $values, 'created_at', current_time( 'mysql', 1 ) );
633 633
 	}
634 634
 
635 635
 	/**
636
-	* Get the updated_at value for a new entry
637
-	*
638
-	* @since 2.0.16
639
-	* @param array $values
640
-	* @return string
641
-	*/
636
+	 * Get the updated_at value for a new entry
637
+	 *
638
+	 * @since 2.0.16
639
+	 * @param array $values
640
+	 * @return string
641
+	 */
642 642
 	private static function get_updated_at( $values ) {
643 643
 		if ( isset( $values['updated_at'] ) ) {
644 644
 			$updated_at = $values['updated_at'];
@@ -650,12 +650,12 @@  discard block
 block discarded – undo
650 650
 	}
651 651
 
652 652
 	/**
653
-	* Get the description value for a new entry
654
-	*
655
-	* @since 2.0.16
656
-	* @param array $values
657
-	* @return string
658
-	*/
653
+	 * Get the description value for a new entry
654
+	 *
655
+	 * @since 2.0.16
656
+	 * @param array $values
657
+	 * @return string
658
+	 */
659 659
 	private static function get_entry_description( $values ) {
660 660
 		if ( isset( $values['description'] ) && ! empty( $values['description'] ) ) {
661 661
 			$description = maybe_serialize( $values['description'] );
@@ -672,12 +672,12 @@  discard block
 block discarded – undo
672 672
 	}
673 673
 
674 674
 	/**
675
-	* Get the user_id value for a new entry
676
-	*
677
-	* @since 2.0.16
678
-	* @param array $values
679
-	* @return int
680
-	*/
675
+	 * Get the user_id value for a new entry
676
+	 *
677
+	 * @since 2.0.16
678
+	 * @param array $values
679
+	 * @return int
680
+	 */
681 681
 	private static function get_entry_user_id( $values ) {
682 682
 		if ( isset( $values['frm_user_id'] ) && ( is_numeric( $values['frm_user_id'] ) || FrmAppHelper::is_admin() ) ) {
683 683
 			$user_id = $values['frm_user_id'];
@@ -690,12 +690,12 @@  discard block
 block discarded – undo
690 690
 	}
691 691
 
692 692
 	/**
693
-	* Insert new entry into the database
694
-	*
695
-	* @since 2.0.16
696
-	* @param array $new_values
697
-	* @return int | boolean $entry_id
698
-	*/
693
+	 * Insert new entry into the database
694
+	 *
695
+	 * @since 2.0.16
696
+	 * @param array $new_values
697
+	 * @return int | boolean $entry_id
698
+	 */
699 699
 	private static function insert_entry_into_database( $new_values ) {
700 700
 		global $wpdb;
701 701
 
@@ -711,11 +711,11 @@  discard block
 block discarded – undo
711 711
 	}
712 712
 
713 713
 	/**
714
-	* Add the new entry to global $frm_vars
715
-	*
716
-	* @since 2.0.16
717
-	* @param int $entry_id
718
-	*/
714
+	 * Add the new entry to global $frm_vars
715
+	 *
716
+	 * @since 2.0.16
717
+	 * @param int $entry_id
718
+	 */
719 719
 	private static function add_new_entry_to_frm_vars( $entry_id ) {
720 720
 		global $frm_vars;
721 721
 
@@ -727,12 +727,12 @@  discard block
 block discarded – undo
727 727
 	}
728 728
 
729 729
 	/**
730
-	* Add entry metas, if there are any
731
-	*
732
-	* @since 2.0.16
733
-	* @param array $values
734
-	* @param int $entry_id
735
-	*/
730
+	 * Add entry metas, if there are any
731
+	 *
732
+	 * @since 2.0.16
733
+	 * @param array $values
734
+	 * @param int $entry_id
735
+	 */
736 736
 	private static function maybe_add_entry_metas( $values, $entry_id ) {
737 737
 		if ( isset( $values['item_meta'] ) ) {
738 738
 			FrmEntryMeta::update_entry_metas( $entry_id, $values['item_meta'] );
@@ -740,12 +740,12 @@  discard block
 block discarded – undo
740 740
 	}
741 741
 
742 742
 	/**
743
-	* Trigger frm_after_create_entry hooks
744
-	*
745
-	* @since 2.0.16
746
-	* @param int $entry_id
747
-	* @param array $new_values
748
-	*/
743
+	 * Trigger frm_after_create_entry hooks
744
+	 *
745
+	 * @since 2.0.16
746
+	 * @param int $entry_id
747
+	 * @param array $new_values
748
+	 */
749 749
 	private static function after_entry_created_actions( $entry_id, $values, $new_values ) {
750 750
 		// this is a child entry
751 751
 		$is_child = isset( $values['parent_form_id'] ) && isset( $values['parent_nonce'] ) && ! empty( $values['parent_form_id'] ) && wp_verify_nonce( $values['parent_nonce'], 'parent' );
@@ -755,13 +755,13 @@  discard block
 block discarded – undo
755 755
 	}
756 756
 
757 757
 	/**
758
-	* Actions to perform immediately after an entry is inserted in the frm_items database
759
-	*
760
-	* @since 2.0.16
761
-	* @param array $values
762
-	* @param array $new_values
763
-	* @param int $entry_id
764
-	*/
758
+	 * Actions to perform immediately after an entry is inserted in the frm_items database
759
+	 *
760
+	 * @since 2.0.16
761
+	 * @param array $values
762
+	 * @param array $new_values
763
+	 * @param int $entry_id
764
+	 */
765 765
 	private static function after_insert_entry_in_database( $values, $new_values, $entry_id ) {
766 766
 
767 767
 		self::add_new_entry_to_frm_vars( $entry_id );
@@ -774,14 +774,14 @@  discard block
 block discarded – undo
774 774
 	}
775 775
 
776 776
 	/**
777
-	* Perform some actions right before updating an entry
778
-	*
779
-	* @since 2.0.16
780
-	* @param int $id
781
-	* @param array $values
782
-	* @param string $update_type
783
-	* @return boolean $update
784
-	*/
777
+	 * Perform some actions right before updating an entry
778
+	 *
779
+	 * @since 2.0.16
780
+	 * @param int $id
781
+	 * @param array $values
782
+	 * @param string $update_type
783
+	 * @return boolean $update
784
+	 */
785 785
 	private static function before_update_entry( $id, &$values, $update_type ) {
786 786
 		$update = true;
787 787
 
@@ -799,13 +799,13 @@  discard block
 block discarded – undo
799 799
 	}
800 800
 
801 801
 	/**
802
-	* Package the entry data for updating
803
-	*
804
-	* @since 2.0.16
805
-	* @param int $id
806
-	* @param array $values
807
-	* @return array $new_values
808
-	*/
802
+	 * Package the entry data for updating
803
+	 *
804
+	 * @since 2.0.16
805
+	 * @param int $id
806
+	 * @param array $values
807
+	 * @return array $new_values
808
+	 */
809 809
 	private static function package_entry_to_update( $id, $values ) {
810 810
 		global $wpdb;
811 811
 
@@ -839,14 +839,14 @@  discard block
 block discarded – undo
839 839
 	}
840 840
 
841 841
 	/**
842
-	* Perform some actions right after updating an entry
843
-	*
844
-	* @since 2.0.16
845
-	* @param boolean|int $query_results
846
-	* @param int $id
847
-	* @param array $values
848
-	* @param array $new_values
849
-	*/
842
+	 * Perform some actions right after updating an entry
843
+	 *
844
+	 * @since 2.0.16
845
+	 * @param boolean|int $query_results
846
+	 * @param int $id
847
+	 * @param array $values
848
+	 * @param array $new_values
849
+	 */
850 850
 	private static function after_update_entry( $query_results, $id, $values, $new_values ) {
851 851
 		if ( $query_results ) {
852 852
 			self::clear_cache();
@@ -868,13 +868,13 @@  discard block
 block discarded – undo
868 868
 	}
869 869
 
870 870
 	/**
871
-	* Create entry from an XML import
872
-	* Certain actions aren't necessary when importing (like saving sub entries, checking for duplicates, etc.)
873
-	*
874
-	* @since 2.0.16
875
-	* @param array $values
876
-	* @return int | boolean $entry_id
877
-	*/
871
+	 * Create entry from an XML import
872
+	 * Certain actions aren't necessary when importing (like saving sub entries, checking for duplicates, etc.)
873
+	 *
874
+	 * @since 2.0.16
875
+	 * @param array $values
876
+	 * @return int | boolean $entry_id
877
+	 */
878 878
 	public static function create_entry_from_xml( $values ) {
879 879
 		$entry_id = self::create_entry( $values, 'xml' );
880 880
 
@@ -882,26 +882,26 @@  discard block
 block discarded – undo
882 882
 	}
883 883
 
884 884
 	/**
885
-	* Update entry from an XML import
886
-	* Certain actions aren't necessary when importing (like saving sub entries and modifying other vals)
887
-	*
888
-	* @since 2.0.16
889
-	* @param int $id
890
-	* @param array $values
891
-	* @return int | boolean $updated
892
-	*/
885
+	 * Update entry from an XML import
886
+	 * Certain actions aren't necessary when importing (like saving sub entries and modifying other vals)
887
+	 *
888
+	 * @since 2.0.16
889
+	 * @param int $id
890
+	 * @param array $values
891
+	 * @return int | boolean $updated
892
+	 */
893 893
 	public static function update_entry_from_xml( $id, $values ) {
894 894
 		$updated = self::update_entry( $id, $values, 'xml' );
895 895
 
896 896
 		return $updated;
897 897
 	}
898 898
 
899
-    /**
900
-     * @param string $key
901
-     * @return int entry_id
902
-     */
899
+	/**
900
+	 * @param string $key
901
+	 * @return int entry_id
902
+	 */
903 903
 	public static function get_id_by_key( $key ) {
904
-        $entry_id = FrmDb::get_var( 'frm_items', array( 'item_key' => sanitize_title( $key ) ) );
905
-        return $entry_id;
906
-    }
904
+		$entry_id = FrmDb::get_var( 'frm_items', array( 'item_key' => sanitize_title( $key ) ) );
905
+		return $entry_id;
906
+	}
907 907
 }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -73,12 +73,12 @@  discard block
 block discarded – undo
73 73
 			$metas = FrmEntryMeta::get_entry_meta_info( $entry_exist );
74 74
             $field_metas = array();
75 75
             foreach ( $metas as $meta ) {
76
-				$field_metas[ $meta->field_id ] = $meta->meta_value;
76
+				$field_metas[$meta->field_id] = $meta->meta_value;
77 77
             }
78 78
 
79 79
             // If prev entry is empty and current entry is not, they are not duplicates
80 80
             $filtered_vals = array_filter( $values['item_meta'] );
81
-			$field_metas   = array_filter( $field_metas );
81
+			$field_metas = array_filter( $field_metas );
82 82
             if ( empty( $field_metas ) && ! empty( $filtered_vals ) ) {
83 83
                 return false;
84 84
             }
@@ -329,19 +329,19 @@  discard block
 block discarded – undo
329 329
 		$include_key = apply_filters( 'frm_include_meta_keys', false, array( 'form_id' => $entry->form_id ) );
330 330
         foreach ( $metas as $meta_val ) {
331 331
             if ( $meta_val->item_id == $entry->id ) {
332
-				$entry->metas[ $meta_val->field_id ] = maybe_unserialize( $meta_val->meta_value );
332
+				$entry->metas[$meta_val->field_id] = maybe_unserialize( $meta_val->meta_value );
333 333
 				if ( $include_key ) {
334
-					$entry->metas[ $meta_val->field_key ] = $entry->metas[ $meta_val->field_id ];
334
+					$entry->metas[$meta_val->field_key] = $entry->metas[$meta_val->field_id];
335 335
 				}
336 336
                  continue;
337 337
             }
338 338
 
339 339
             // include sub entries in an array
340
-			if ( ! isset( $entry_metas[ $meta_val->field_id ] ) ) {
341
-				$entry->metas[ $meta_val->field_id ] = array();
340
+			if ( ! isset( $entry_metas[$meta_val->field_id] ) ) {
341
+				$entry->metas[$meta_val->field_id] = array();
342 342
             }
343 343
 
344
-			$entry->metas[ $meta_val->field_id ][] = maybe_unserialize( $meta_val->meta_value );
344
+			$entry->metas[$meta_val->field_id][] = maybe_unserialize( $meta_val->meta_value );
345 345
 
346 346
 			unset( $meta_val );
347 347
         }
@@ -431,15 +431,15 @@  discard block
 block discarded – undo
431 431
         }
432 432
 
433 433
         foreach ( $metas as $m_key => $meta_val ) {
434
-            if ( ! isset( $entries[ $meta_val->item_id ] ) ) {
434
+            if ( ! isset( $entries[$meta_val->item_id] ) ) {
435 435
                 continue;
436 436
             }
437 437
 
438
-            if ( ! isset( $entries[ $meta_val->item_id ]->metas ) ) {
439
-				$entries[ $meta_val->item_id ]->metas = array();
438
+            if ( ! isset( $entries[$meta_val->item_id]->metas ) ) {
439
+				$entries[$meta_val->item_id]->metas = array();
440 440
             }
441 441
 
442
-			$entries[ $meta_val->item_id ]->metas[ $meta_val->field_id ] = maybe_unserialize( $meta_val->meta_value );
442
+			$entries[$meta_val->item_id]->metas[$meta_val->field_id] = maybe_unserialize( $meta_val->meta_value );
443 443
 
444 444
 			unset( $m_key, $meta_val );
445 445
         }
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
 	}
588 588
 
589 589
 	private static function get_entry_value( $values, $name, $default ) {
590
-		return isset( $values[ $name ] ) ? $values[ $name ] : $default;
590
+		return isset( $values[$name] ) ? $values[$name] : $default;
591 591
 	}
592 592
 
593 593
 	/**
Please login to merge, or discard this patch.
classes/models/FrmEntryShortcodeFormatter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -285,7 +285,7 @@
 block discarded – undo
285 285
 			'type'  => $field->type,
286 286
 		);
287 287
 
288
-		$this->array_content[ $field->id ] = apply_filters( 'frm_field_shortcodes_for_default_html_email', $array, $field );
288
+		$this->array_content[$field->id] = apply_filters( 'frm_field_shortcodes_for_default_html_email', $array, $field );
289 289
 	}
290 290
 
291 291
 	/**
Please login to merge, or discard this patch.