Completed
Push — master ( 2ef960...ccdf5d )
by Stephanie
02:59
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.
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.
Indentation   +143 added lines, -143 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,18 +435,18 @@  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;
447
+		global $wpdb;
448 448
 		return $wpdb->esc_like( $term );
449
-    }
449
+	}
450 450
 
451 451
 	/**
452 452
 	 * @since 2.05.06
@@ -592,17 +592,17 @@  discard block
 block discarded – undo
592 592
 		return $post;
593 593
 	}
594 594
 
595
-    /**
596
-     * Check cache before fetching values and saving to cache
597
-     *
598
-     * @since 2.05.06
599
-     *
600
-     * @param string $cache_key The unique name for this cache
601
-     * @param string $group The name of the cache group
602
-     * @param string $query If blank, don't run a db call
603
-     * @param string $type The wpdb function to use with this query
604
-     * @return mixed $results The cache or query results
605
-     */
595
+	/**
596
+	 * Check cache before fetching values and saving to cache
597
+	 *
598
+	 * @since 2.05.06
599
+	 *
600
+	 * @param string $cache_key The unique name for this cache
601
+	 * @param string $group The name of the cache group
602
+	 * @param string $query If blank, don't run a db call
603
+	 * @param string $type The wpdb function to use with this query
604
+	 * @return mixed $results The cache or query results
605
+	 */
606 606
 	public static function check_cache( $cache_key, $group = '', $query = '', $type = 'get_var', $time = 300 ) {
607 607
 		$results = wp_cache_get( $cache_key, $group );
608 608
 		if ( ! FrmAppHelper::is_empty_value( $results, false ) || empty( $query ) ) {
@@ -667,13 +667,13 @@  discard block
 block discarded – undo
667 667
 		wp_cache_delete( $cache_key, $group );
668 668
 	}
669 669
 
670
-    /**
671
-     * Delete all caching in a single group
672
-     *
673
-     * @since 2.05.06
674
-     *
675
-     * @param string $group The name of the cache group
676
-     */
670
+	/**
671
+	 * Delete all caching in a single group
672
+	 *
673
+	 * @since 2.05.06
674
+	 *
675
+	 * @param string $group The name of the cache group
676
+	 */
677 677
 	public static function cache_delete_group( $group ) {
678 678
 		$cached_keys = self::get_group_cached_keys( $group );
679 679
 
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.
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.
Doc Comments   +8 added lines patch added patch discarded remove patch
@@ -874,6 +874,7 @@  discard block
 block discarded – undo
874 874
 	 * Get an array of the helper shortcodes to display in the customization panel
875 875
 	 *
876 876
 	 * @since 2.0.6
877
+	 * @param boolean $settings_tab
877 878
 	 */
878 879
 	private static function get_shortcode_helpers( $settings_tab ) {
879 880
 		$entry_shortcodes = array(
@@ -952,6 +953,9 @@  discard block
 block discarded – undo
952 953
         return $content;
953 954
     }
954 955
 
956
+	/**
957
+	 * @param boolean $entry
958
+	 */
955 959
 	private static function get_entry_by_param( &$entry ) {
956 960
 		if ( ! $entry || ! is_object( $entry ) ) {
957 961
 			if ( ! $entry || ! is_numeric( $entry ) ) {
@@ -1235,6 +1239,9 @@  discard block
 block discarded – undo
1235 1239
 		return $form;
1236 1240
     }
1237 1241
 
1242
+	/**
1243
+	 * @param string $id
1244
+	 */
1238 1245
 	private static function maybe_get_form_to_show( $id ) {
1239 1246
 		$form = false;
1240 1247
 
@@ -1648,6 +1655,7 @@  discard block
 block discarded – undo
1648 1655
 
1649 1656
 	/**
1650 1657
 	 * @since 2.0.8
1658
+	 * @param string $content
1651 1659
 	 */
1652 1660
 	private static function maybe_minimize_form( $atts, &$content ) {
1653 1661
 		// check if minimizing is turned on
Please login to merge, or discard this patch.
Indentation   +335 added lines, -335 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' );
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	public static function new_form( $values = array() ) {
76 76
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
77 77
 
78
-        global $frm_vars;
78
+		global $frm_vars;
79 79
 
80 80
 		$action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
81 81
 		$action = empty( $values ) ? FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ) : $values[ $action ];
@@ -86,17 +86,17 @@  discard block
 block discarded – undo
86 86
 		} else if ( $action == 'new' ) {
87 87
 			$frm_field_selection = FrmField::field_selection();
88 88
 			$values = FrmFormsHelper::setup_new_vars( $values );
89
-            $id = FrmForm::create( $values );
89
+			$id = FrmForm::create( $values );
90 90
 			$form = FrmForm::getOne( $id );
91 91
 
92 92
 			self::create_default_email_action( $form );
93 93
 
94 94
 			$all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' );
95 95
 
96
-            $values['id'] = $id;
96
+			$values['id'] = $id;
97 97
 			require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new.php' );
98
-        }
99
-    }
98
+		}
99
+	}
100 100
 
101 101
 	/**
102 102
 	 * Create the default email action
@@ -105,41 +105,41 @@  discard block
 block discarded – undo
105 105
 	 *
106 106
 	 * @param object $form
107 107
 	 */
108
-    private static function create_default_email_action( $form ) {
109
-    	$create_email = apply_filters( 'frm_create_default_email_action', true, $form );
108
+	private static function create_default_email_action( $form ) {
109
+		$create_email = apply_filters( 'frm_create_default_email_action', true, $form );
110 110
 
111
-	    if ( $create_email ) {
112
-		    $action_control = FrmFormActionsController::get_form_actions( 'email' );
113
-		    $action_control->create( $form->id );
114
-	    }
115
-    }
111
+		if ( $create_email ) {
112
+			$action_control = FrmFormActionsController::get_form_actions( 'email' );
113
+			$action_control->create( $form->id );
114
+		}
115
+	}
116 116
 
117 117
 	public static function create( $values = array() ) {
118 118
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
119 119
 
120
-        global $frm_vars;
121
-        if ( empty( $values ) ) {
122
-            $values = $_POST;
123
-        }
120
+		global $frm_vars;
121
+		if ( empty( $values ) ) {
122
+			$values = $_POST;
123
+		}
124 124
 
125
-        //Set radio button and checkbox meta equal to "other" value
126
-        if ( FrmAppHelper::pro_is_installed() ) {
127
-            $values = FrmProEntry::mod_other_vals( $values, 'back' );
128
-        }
125
+		//Set radio button and checkbox meta equal to "other" value
126
+		if ( FrmAppHelper::pro_is_installed() ) {
127
+			$values = FrmProEntry::mod_other_vals( $values, 'back' );
128
+		}
129 129
 
130 130
 		$id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
131 131
 
132
-        if ( ! current_user_can( 'frm_edit_forms' ) || ( $_POST && ( ! isset( $values['frm_save_form'] ) || ! wp_verify_nonce( $values['frm_save_form'], 'frm_save_form_nonce' ) ) ) ) {
133
-            $frm_settings = FrmAppHelper::get_settings();
134
-            $errors = array( 'form' => $frm_settings->admin_permission );
135
-        } else {
132
+		if ( ! current_user_can( 'frm_edit_forms' ) || ( $_POST && ( ! isset( $values['frm_save_form'] ) || ! wp_verify_nonce( $values['frm_save_form'], 'frm_save_form_nonce' ) ) ) ) {
133
+			$frm_settings = FrmAppHelper::get_settings();
134
+			$errors = array( 'form' => $frm_settings->admin_permission );
135
+		} else {
136 136
 			$errors = FrmForm::validate( $values );
137
-        }
137
+		}
138 138
 
139 139
 		if ( count( $errors ) > 0 ) {
140
-            $hide_preview = true;
140
+			$hide_preview = true;
141 141
 			$frm_field_selection = FrmField::field_selection();
142
-            $form = FrmForm::getOne( $id );
142
+			$form = FrmForm::getOne( $id );
143 143
 			$fields = FrmField::get_all_for_form( $id );
144 144
 
145 145
 			$values = FrmAppHelper::setup_edit_vars( $form, 'forms', '', true );
@@ -147,30 +147,30 @@  discard block
 block discarded – undo
147 147
 			$all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' );
148 148
 
149 149
 			require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new.php' );
150
-        } else {
151
-            FrmForm::update( $id, $values, true );
150
+		} else {
151
+			FrmForm::update( $id, $values, true );
152 152
 			$url = admin_url( 'admin.php?page=formidable&frm_action=settings&id=' . $id );
153 153
 			die( FrmAppHelper::js_redirect( $url ) ); // WPCS: XSS ok.
154
-        }
155
-    }
154
+		}
155
+	}
156 156
 
157
-    public static function edit( $values = false ) {
157
+	public static function edit( $values = false ) {
158 158
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
159 159
 
160 160
 		$id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
161 161
 		return self::get_edit_vars( $id );
162
-    }
162
+	}
163 163
 
164
-    public static function settings( $id = false, $message = '' ) {
164
+	public static function settings( $id = false, $message = '' ) {
165 165
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
166 166
 
167 167
 		if ( ! $id || ! is_numeric( $id ) ) {
168 168
 			$id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
169
-        }
169
+		}
170 170
 		return self::get_settings_vars( $id, array(), $message );
171
-    }
171
+	}
172 172
 
173
-    public static function update_settings() {
173
+	public static function update_settings() {
174 174
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
175 175
 
176 176
 		$id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
@@ -184,33 +184,33 @@  discard block
 block discarded – undo
184 184
 
185 185
 		FrmForm::update( $id, $_POST );
186 186
 
187
-        $message = __( 'Settings Successfully Updated', 'formidable' );
187
+		$message = __( 'Settings Successfully Updated', 'formidable' );
188 188
 		return self::get_settings_vars( $id, array(), $message );
189
-    }
189
+	}
190 190
 
191 191
 	public static function update( $values = array() ) {
192 192
 		if ( empty( $values ) ) {
193
-            $values = $_POST;
194
-        }
193
+			$values = $_POST;
194
+		}
195 195
 
196
-        //Set radio button and checkbox meta equal to "other" value
197
-        if ( FrmAppHelper::pro_is_installed() ) {
198
-            $values = FrmProEntry::mod_other_vals( $values, 'back' );
199
-        }
196
+		//Set radio button and checkbox meta equal to "other" value
197
+		if ( FrmAppHelper::pro_is_installed() ) {
198
+			$values = FrmProEntry::mod_other_vals( $values, 'back' );
199
+		}
200 200
 
201
-        $errors = FrmForm::validate( $values );
202
-        $permission_error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'frm_save_form', 'frm_save_form_nonce' );
203
-        if ( $permission_error !== false ) {
204
-            $errors['form'] = $permission_error;
205
-        }
201
+		$errors = FrmForm::validate( $values );
202
+		$permission_error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'frm_save_form', 'frm_save_form_nonce' );
203
+		if ( $permission_error !== false ) {
204
+			$errors['form'] = $permission_error;
205
+		}
206 206
 
207 207
 		$id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
208 208
 
209 209
 		if ( count( $errors ) > 0 ) {
210
-            return self::get_edit_vars( $id, $errors );
210
+			return self::get_edit_vars( $id, $errors );
211 211
 		} else {
212
-            FrmForm::update( $id, $values );
213
-            $message = __( 'Form was Successfully Updated', 'formidable' );
212
+			FrmForm::update( $id, $values );
213
+			$message = __( 'Form was Successfully Updated', 'formidable' );
214 214
 
215 215
 			if ( self::is_too_long( $values ) ) {
216 216
 				$message .= '<br/> ' . sprintf(
@@ -221,12 +221,12 @@  discard block
 block discarded – undo
221 221
 				);
222 222
 			}
223 223
 
224
-            if ( defined( 'DOING_AJAX' ) ) {
224
+			if ( defined( 'DOING_AJAX' ) ) {
225 225
 				wp_die( esc_html( $message ) );
226
-            }
226
+			}
227 227
 			return self::get_edit_vars( $id, array(), $message );
228
-        }
229
-    }
228
+		}
229
+	}
230 230
 
231 231
 	/**
232 232
 	 * Check if the value at the end of the form was included.
@@ -263,30 +263,30 @@  discard block
 block discarded – undo
263 263
 		wp_die();
264 264
 	}
265 265
 
266
-    public static function duplicate() {
266
+	public static function duplicate() {
267 267
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
268 268
 
269 269
 		$params = FrmForm::list_page_params();
270
-        $form = FrmForm::duplicate( $params['id'], $params['template'], true );
271
-        $message = $params['template'] ? __( 'Form template was Successfully Created', 'formidable' ) : __( 'Form was Successfully Copied', 'formidable' );
272
-        if ( $form ) {
270
+		$form = FrmForm::duplicate( $params['id'], $params['template'], true );
271
+		$message = $params['template'] ? __( 'Form template was Successfully Created', 'formidable' ) : __( 'Form was Successfully Copied', 'formidable' );
272
+		if ( $form ) {
273 273
 			return self::get_edit_vars( $form, array(), $message, true );
274
-        } else {
274
+		} else {
275 275
 			return self::display_forms_list( $params, __( 'There was a problem creating the new template.', 'formidable' ) );
276
-        }
277
-    }
276
+		}
277
+	}
278 278
 
279
-    public static function page_preview() {
279
+	public static function page_preview() {
280 280
 		$params = FrmForm::list_page_params();
281
-        if ( ! $params['form'] ) {
282
-            return;
283
-        }
281
+		if ( ! $params['form'] ) {
282
+			return;
283
+		}
284 284
 
285
-        $form = FrmForm::getOne( $params['form'] );
285
+		$form = FrmForm::getOne( $params['form'] );
286 286
 		if ( $form ) {
287 287
 			return self::show_form( $form->id, '', true, true );
288 288
 		}
289
-    }
289
+	}
290 290
 
291 291
 	/**
292 292
 	 * @since 3.0
@@ -295,11 +295,11 @@  discard block
 block discarded – undo
295 295
 		echo self::page_preview(); // WPCS: XSS ok.
296 296
 	}
297 297
 
298
-    public static function preview() {
299
-        do_action( 'frm_wp' );
298
+	public static function preview() {
299
+		do_action( 'frm_wp' );
300 300
 
301
-        global $frm_vars;
302
-        $frm_vars['preview'] = true;
301
+		global $frm_vars;
302
+		$frm_vars['preview'] = true;
303 303
 
304 304
 		self::load_wp();
305 305
 
@@ -413,18 +413,18 @@  discard block
 block discarded – undo
413 413
 		require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/direct.php' );
414 414
 	}
415 415
 
416
-    public static function untrash() {
416
+	public static function untrash() {
417 417
 		self::change_form_status( 'untrash' );
418
-    }
418
+	}
419 419
 
420 420
 	public static function bulk_untrash( $ids ) {
421 421
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
422 422
 
423
-        $count = FrmForm::set_status( $ids, 'published' );
423
+		$count = FrmForm::set_status( $ids, 'published' );
424 424
 
425 425
 		$message = sprintf( _n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), 1 );
426
-        return $message;
427
-    }
426
+		return $message;
427
+	}
428 428
 
429 429
 	/**
430 430
 	 * @since 3.06
@@ -437,9 +437,9 @@  discard block
 block discarded – undo
437 437
 		wp_die();
438 438
 	}
439 439
 
440
-    public static function trash() {
440
+	public static function trash() {
441 441
 		self::change_form_status( 'trash' );
442
-    }
442
+	}
443 443
 
444 444
 	/**
445 445
 	 * @param string $status
@@ -492,12 +492,12 @@  discard block
 block discarded – undo
492 492
 	public static function bulk_trash( $ids ) {
493 493
 		FrmAppHelper::permission_check( 'frm_delete_forms' );
494 494
 
495
-        $count = 0;
496
-        foreach ( $ids as $id ) {
497
-            if ( FrmForm::trash( $id ) ) {
498
-                $count++;
499
-            }
500
-        }
495
+		$count = 0;
496
+		foreach ( $ids as $id ) {
497
+			if ( FrmForm::trash( $id ) ) {
498
+				$count++;
499
+			}
500
+		}
501 501
 
502 502
 		$current_page = FrmAppHelper::get_simple_request(
503 503
 			array(
@@ -512,56 +512,56 @@  discard block
 block discarded – undo
512 512
 			'</a>'
513 513
 		);
514 514
 
515
-        return $message;
516
-    }
515
+		return $message;
516
+	}
517 517
 
518
-    public static function destroy() {
518
+	public static function destroy() {
519 519
 		FrmAppHelper::permission_check( 'frm_delete_forms' );
520 520
 
521 521
 		$params = FrmForm::list_page_params();
522 522
 
523
-        //check nonce url
523
+		//check nonce url
524 524
 		check_admin_referer( 'destroy_form_' . $params['id'] );
525 525
 
526
-        $count = 0;
527
-        if ( FrmForm::destroy( $params['id'] ) ) {
528
-            $count++;
529
-        }
526
+		$count = 0;
527
+		if ( FrmForm::destroy( $params['id'] ) ) {
528
+			$count++;
529
+		}
530 530
 
531 531
 		$message = sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count );
532 532
 
533 533
 		self::display_forms_list( $params, $message );
534
-    }
534
+	}
535 535
 
536 536
 	public static function bulk_destroy( $ids ) {
537 537
 		FrmAppHelper::permission_check( 'frm_delete_forms' );
538 538
 
539
-        $count = 0;
540
-        foreach ( $ids as $id ) {
541
-            $d = FrmForm::destroy( $id );
542
-            if ( $d ) {
543
-                $count++;
544
-            }
545
-        }
539
+		$count = 0;
540
+		foreach ( $ids as $id ) {
541
+			$d = FrmForm::destroy( $id );
542
+			if ( $d ) {
543
+				$count++;
544
+			}
545
+		}
546 546
 
547 547
 		$message = sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count );
548 548
 
549
-        return $message;
550
-    }
549
+		return $message;
550
+	}
551 551
 
552
-    private static function delete_all() {
553
-        //check nonce url
552
+	private static function delete_all() {
553
+		//check nonce url
554 554
 		$permission_error = FrmAppHelper::permission_nonce_error( 'frm_delete_forms', '_wpnonce', 'bulk-toplevel_page_formidable' );
555
-        if ( $permission_error !== false ) {
555
+		if ( $permission_error !== false ) {
556 556
 			self::display_forms_list( array(), '', array( $permission_error ) );
557
-            return;
558
-        }
557
+			return;
558
+		}
559 559
 
560 560
 		$count = FrmForm::scheduled_delete( time() );
561 561
 		$message = sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count );
562 562
 
563 563
 		self::display_forms_list( array(), $message );
564
-    }
564
+	}
565 565
 
566 566
 	/**
567 567
 	 * Create a custom template from a form
@@ -604,11 +604,11 @@  discard block
 block discarded – undo
604 604
 	}
605 605
 
606 606
 	/**
607
-	* Inserts Formidable button
608
-	* Hook exists since 2.5.0
609
-	*
610
-	* @since 2.0.15
611
-	*/
607
+	 * Inserts Formidable button
608
+	 * Hook exists since 2.5.0
609
+	 *
610
+	 * @since 2.0.15
611
+	 */
612 612
 	public static function insert_form_button() {
613 613
 		if ( current_user_can( 'frm_view_forms' ) ) {
614 614
 			$menu_name = FrmAppHelper::get_menu_name();
@@ -619,45 +619,45 @@  discard block
 block discarded – undo
619 619
 		}
620 620
 	}
621 621
 
622
-    public static function insert_form_popup() {
622
+	public static function insert_form_popup() {
623 623
 		$page = basename( FrmAppHelper::get_server_value( 'PHP_SELF' ) );
624 624
 		if ( ! in_array( $page, array( 'post.php', 'page.php', 'page-new.php', 'post-new.php' ) ) ) {
625
-            return;
626
-        }
625
+			return;
626
+		}
627 627
 
628
-        FrmAppHelper::load_admin_wide_js();
628
+		FrmAppHelper::load_admin_wide_js();
629 629
 
630
-        $shortcodes = array(
630
+		$shortcodes = array(
631 631
 			'formidable' => array(
632 632
 				'name'  => __( 'Form', 'formidable' ),
633 633
 				'label' => __( 'Insert a Form', 'formidable' ),
634 634
 			),
635
-        );
635
+		);
636 636
 
637 637
 		$shortcodes = apply_filters( 'frm_popup_shortcodes', $shortcodes );
638 638
 
639 639
 		include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/insert_form_popup.php' );
640
-    }
640
+	}
641 641
 
642
-    public static function get_shortcode_opts() {
642
+	public static function get_shortcode_opts() {
643 643
 		FrmAppHelper::permission_check( 'frm_view_forms' );
644
-        check_ajax_referer( 'frm_ajax', 'nonce' );
644
+		check_ajax_referer( 'frm_ajax', 'nonce' );
645 645
 
646 646
 		$shortcode = FrmAppHelper::get_post_param( 'shortcode', '', 'sanitize_text_field' );
647 647
 		if ( empty( $shortcode ) ) {
648
-            wp_die();
649
-        }
648
+			wp_die();
649
+		}
650 650
 
651 651
 		echo '<div id="sc-opts-' . esc_attr( $shortcode ) . '" class="frm_shortcode_option">';
652 652
 		echo '<input type="radio" name="frmsc" value="' . esc_attr( $shortcode ) . '" id="sc-' . esc_attr( $shortcode ) . '" class="frm_hidden" />';
653 653
 
654
-        $form_id = '';
655
-        $opts = array();
654
+		$form_id = '';
655
+		$opts = array();
656 656
 		switch ( $shortcode ) {
657
-            case 'formidable':
658
-                $opts = array(
657
+			case 'formidable':
658
+				$opts = array(
659 659
 					'form_id'       => 'id',
660
-                    //'key' => ',
660
+					//'key' => ',
661 661
 					'title'         => array(
662 662
 						'val'   => 1,
663 663
 						'label' => __( 'Display form title', 'formidable' ),
@@ -670,8 +670,8 @@  discard block
 block discarded – undo
670 670
 						'val'   => 1,
671 671
 						'label' => __( 'Minimize form HTML', 'formidable' ),
672 672
 					),
673
-                );
674
-        }
673
+				);
674
+		}
675 675
 		$opts = apply_filters( 'frm_sc_popup_opts', $opts, $shortcode );
676 676
 
677 677
 		if ( isset( $opts['form_id'] ) && is_string( $opts['form_id'] ) ) {
@@ -682,38 +682,38 @@  discard block
 block discarded – undo
682 682
 
683 683
 		include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/shortcode_opts.php' );
684 684
 
685
-        echo '</div>';
685
+		echo '</div>';
686 686
 
687
-        wp_die();
688
-    }
687
+		wp_die();
688
+	}
689 689
 
690 690
 	public static function display_forms_list( $params = array(), $message = '', $errors = array() ) {
691
-        FrmAppHelper::permission_check( 'frm_view_forms' );
691
+		FrmAppHelper::permission_check( 'frm_view_forms' );
692 692
 
693
-        global $wpdb, $frm_vars;
693
+		global $wpdb, $frm_vars;
694 694
 
695 695
 		if ( empty( $params ) ) {
696 696
 			$params = FrmForm::list_page_params();
697
-        }
697
+		}
698 698
 
699
-        $wp_list_table = new FrmFormsListHelper( compact( 'params' ) );
699
+		$wp_list_table = new FrmFormsListHelper( compact( 'params' ) );
700 700
 
701
-        $pagenum = $wp_list_table->get_pagenum();
701
+		$pagenum = $wp_list_table->get_pagenum();
702 702
 
703
-        $wp_list_table->prepare_items();
703
+		$wp_list_table->prepare_items();
704 704
 
705
-        $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
706
-        if ( $pagenum > $total_pages && $total_pages > 0 ) {
705
+		$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
706
+		if ( $pagenum > $total_pages && $total_pages > 0 ) {
707 707
 			wp_redirect( esc_url_raw( add_query_arg( 'paged', $total_pages ) ) );
708
-            die();
709
-        }
708
+			die();
709
+		}
710 710
 
711 711
 		require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/list.php' );
712
-    }
712
+	}
713 713
 
714 714
 	public static function get_columns( $columns ) {
715
-	    $columns['cb'] = '<input type="checkbox" />';
716
-	    $columns['id'] = 'ID';
715
+		$columns['cb'] = '<input type="checkbox" />';
716
+		$columns['id'] = 'ID';
717 717
 
718 718
 		$type = FrmAppHelper::get_simple_request(
719 719
 			array(
@@ -723,18 +723,18 @@  discard block
 block discarded – undo
723 723
 			)
724 724
 		);
725 725
 
726
-        if ( 'template' == $type ) {
727
-            $columns['name']        = __( 'Template Name', 'formidable' );
728
-            $columns['type']        = __( 'Type', 'formidable' );
729
-            $columns['form_key']    = __( 'Key', 'formidable' );
730
-        } else {
731
-            $columns['name']        = __( 'Form Title', 'formidable' );
732
-            $columns['entries']     = __( 'Entries', 'formidable' );
733
-            $columns['form_key']    = __( 'Key', 'formidable' );
734
-            $columns['shortcode']   = __( 'Shortcodes', 'formidable' );
735
-        }
726
+		if ( 'template' == $type ) {
727
+			$columns['name']        = __( 'Template Name', 'formidable' );
728
+			$columns['type']        = __( 'Type', 'formidable' );
729
+			$columns['form_key']    = __( 'Key', 'formidable' );
730
+		} else {
731
+			$columns['name']        = __( 'Form Title', 'formidable' );
732
+			$columns['entries']     = __( 'Entries', 'formidable' );
733
+			$columns['form_key']    = __( 'Key', 'formidable' );
734
+			$columns['shortcode']   = __( 'Shortcodes', 'formidable' );
735
+		}
736 736
 
737
-        $columns['created_at'] = __( 'Date', 'formidable' );
737
+		$columns['created_at'] = __( 'Date', 'formidable' );
738 738
 
739 739
 		add_screen_option(
740 740
 			'per_page',
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
 			)
746 746
 		);
747 747
 
748
-        return $columns;
748
+		return $columns;
749 749
 	}
750 750
 
751 751
 	public static function get_sortable_columns() {
@@ -775,11 +775,11 @@  discard block
 block discarded – undo
775 775
 	}
776 776
 
777 777
 	public static function save_per_page( $save, $option, $value ) {
778
-        if ( $option == 'formidable_page_formidable_per_page' ) {
779
-            $save = (int) $value;
780
-        }
781
-        return $save;
782
-    }
778
+		if ( $option == 'formidable_page_formidable_per_page' ) {
779
+			$save = (int) $value;
780
+		}
781
+		return $save;
782
+	}
783 783
 
784 784
 	/**
785 785
 	 * Show the template listing page
@@ -834,27 +834,27 @@  discard block
 block discarded – undo
834 834
 	}
835 835
 
836 836
 	private static function get_edit_vars( $id, $errors = array(), $message = '', $create_link = false ) {
837
-        global $frm_vars;
837
+		global $frm_vars;
838 838
 
839
-        $form = FrmForm::getOne( $id );
840
-        if ( ! $form ) {
841
-            wp_die( esc_html__( 'You are trying to edit a form that does not exist.', 'formidable' ) );
842
-        }
839
+		$form = FrmForm::getOne( $id );
840
+		if ( ! $form ) {
841
+			wp_die( esc_html__( 'You are trying to edit a form that does not exist.', 'formidable' ) );
842
+		}
843 843
 
844
-        if ( $form->parent_form_id ) {
844
+		if ( $form->parent_form_id ) {
845 845
 			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>' ) );
846
-        }
846
+		}
847 847
 
848 848
 		$frm_field_selection = FrmField::field_selection();
849 849
 		$fields = FrmField::get_all_for_form( $form->id );
850 850
 
851
-        // Automatically add end section fields if they don't exist (2.0 migration)
852
-        $reset_fields = false;
853
-        FrmFormsHelper::auto_add_end_section_fields( $form, $fields, $reset_fields );
851
+		// Automatically add end section fields if they don't exist (2.0 migration)
852
+		$reset_fields = false;
853
+		FrmFormsHelper::auto_add_end_section_fields( $form, $fields, $reset_fields );
854 854
 
855
-        if ( $reset_fields ) {
856
-            $fields = FrmField::get_all_for_form( $form->id, '', 'exclude' );
857
-        }
855
+		if ( $reset_fields ) {
856
+			$fields = FrmField::get_all_for_form( $form->id, '', 'exclude' );
857
+		}
858 858
 
859 859
 		unset( $end_section_values, $last_order, $open, $reset_fields );
860 860
 
@@ -862,45 +862,45 @@  discard block
 block discarded – undo
862 862
 		$values = FrmAppHelper::setup_edit_vars( $form, 'forms', '', true, array(), $args );
863 863
 		$values['fields'] = $fields;
864 864
 
865
-        $edit_message = __( 'Form was Successfully Updated', 'formidable' );
866
-        if ( $form->is_template && $message == $edit_message ) {
867
-            $message = __( 'Template was Successfully Updated', 'formidable' );
868
-        }
865
+		$edit_message = __( 'Form was Successfully Updated', 'formidable' );
866
+		if ( $form->is_template && $message == $edit_message ) {
867
+			$message = __( 'Template was Successfully Updated', 'formidable' );
868
+		}
869 869
 
870 870
 		$all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' );
871 871
 
872 872
 		if ( defined( 'DOING_AJAX' ) ) {
873
-            wp_die();
874
-        } else if ( $create_link ) {
873
+			wp_die();
874
+		} else if ( $create_link ) {
875 875
 			require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new.php' );
876
-        } else {
876
+		} else {
877 877
 			require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/edit.php' );
878
-        }
879
-    }
878
+		}
879
+	}
880 880
 
881 881
 	public static function get_settings_vars( $id, $errors = array(), $message = '' ) {
882 882
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
883 883
 
884
-        global $frm_vars;
884
+		global $frm_vars;
885 885
 
886
-        $form = FrmForm::getOne( $id );
886
+		$form = FrmForm::getOne( $id );
887 887
 
888 888
 		$fields = FrmField::get_all_for_form( $id );
889 889
 		$values = FrmAppHelper::setup_edit_vars( $form, 'forms', $fields, true );
890 890
 
891 891
 		self::clean_submit_html( $values );
892 892
 
893
-        $action_controls = FrmFormActionsController::get_form_actions();
893
+		$action_controls = FrmFormActionsController::get_form_actions();
894 894
 
895 895
 		$sections = apply_filters( 'frm_add_form_settings_section', array(), $values );
896
-        $pro_feature = FrmAppHelper::pro_is_installed() ? '' : ' class="pro_feature"';
896
+		$pro_feature = FrmAppHelper::pro_is_installed() ? '' : ' class="pro_feature"';
897 897
 
898 898
 		$styles = apply_filters( 'frm_get_style_opts', array() );
899 899
 
900 900
 		$first_h3 = 'frm_first_h3';
901 901
 
902 902
 		require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/settings.php' );
903
-    }
903
+	}
904 904
 
905 905
 	/**
906 906
 	 * Replace old Submit Button href with new href to avoid errors in Chrome
@@ -915,10 +915,10 @@  discard block
 block discarded – undo
915 915
 		}
916 916
 	}
917 917
 
918
-    public static function mb_tags_box( $form_id, $class = '' ) {
918
+	public static function mb_tags_box( $form_id, $class = '' ) {
919 919
 		$fields = FrmField::get_all_for_form( $form_id, '', 'include' );
920
-        $linked_forms = array();
921
-        $col = 'one';
920
+		$linked_forms = array();
921
+		$col = 'one';
922 922
 		$settings_tab = FrmAppHelper::is_admin_page( 'formidable' ) ? true : false;
923 923
 
924 924
 		$cond_shortcodes = apply_filters( 'frm_conditional_shortcodes', array() );
@@ -927,7 +927,7 @@  discard block
 block discarded – undo
927 927
 		$advanced_helpers = self::advanced_helpers( compact( 'fields', 'form_id' ) );
928 928
 
929 929
 		include( FrmAppHelper::plugin_path() . '/classes/views/shared/mb_adv_info.php' );
930
-    }
930
+	}
931 931
 
932 932
 	/**
933 933
 	 * @since 3.04.01
@@ -1021,7 +1021,7 @@  discard block
 block discarded – undo
1021 1021
 			''          => '',
1022 1022
 			'siteurl'   => __( 'Site URL', 'formidable' ),
1023 1023
 			'sitename'  => __( 'Site Name', 'formidable' ),
1024
-        );
1024
+		);
1025 1025
 
1026 1026
 		if ( ! FrmAppHelper::pro_is_installed() ) {
1027 1027
 			unset( $entry_shortcodes['post_id'] );
@@ -1071,21 +1071,21 @@  discard block
 block discarded – undo
1071 1071
 		wp_die();
1072 1072
 	}
1073 1073
 
1074
-    public static function filter_content( $content, $form, $entry = false ) {
1074
+	public static function filter_content( $content, $form, $entry = false ) {
1075 1075
 		self::get_entry_by_param( $entry );
1076
-        if ( ! $entry ) {
1077
-            return $content;
1078
-        }
1076
+		if ( ! $entry ) {
1077
+			return $content;
1078
+		}
1079 1079
 
1080
-        if ( is_object( $form ) ) {
1081
-            $form = $form->id;
1082
-        }
1080
+		if ( is_object( $form ) ) {
1081
+			$form = $form->id;
1082
+		}
1083 1083
 
1084
-        $shortcodes = FrmFieldsHelper::get_shortcodes( $content, $form );
1085
-        $content = apply_filters( 'frm_replace_content_shortcodes', $content, $entry, $shortcodes );
1084
+		$shortcodes = FrmFieldsHelper::get_shortcodes( $content, $form );
1085
+		$content = apply_filters( 'frm_replace_content_shortcodes', $content, $entry, $shortcodes );
1086 1086
 
1087
-        return $content;
1088
-    }
1087
+		return $content;
1088
+	}
1089 1089
 
1090 1090
 	private static function get_entry_by_param( &$entry ) {
1091 1091
 		if ( ! $entry || ! is_object( $entry ) ) {
@@ -1097,153 +1097,153 @@  discard block
 block discarded – undo
1097 1097
 		}
1098 1098
 	}
1099 1099
 
1100
-    public static function replace_content_shortcodes( $content, $entry, $shortcodes ) {
1101
-        return FrmFieldsHelper::replace_content_shortcodes( $content, $entry, $shortcodes );
1102
-    }
1100
+	public static function replace_content_shortcodes( $content, $entry, $shortcodes ) {
1101
+		return FrmFieldsHelper::replace_content_shortcodes( $content, $entry, $shortcodes );
1102
+	}
1103 1103
 
1104
-    public static function process_bulk_form_actions( $errors ) {
1105
-        if ( ! $_REQUEST ) {
1106
-            return $errors;
1107
-        }
1104
+	public static function process_bulk_form_actions( $errors ) {
1105
+		if ( ! $_REQUEST ) {
1106
+			return $errors;
1107
+		}
1108 1108
 
1109 1109
 		$bulkaction = FrmAppHelper::get_param( 'action', '', 'get', 'sanitize_text_field' );
1110
-        if ( $bulkaction == -1 ) {
1110
+		if ( $bulkaction == -1 ) {
1111 1111
 			$bulkaction = FrmAppHelper::get_param( 'action2', '', 'get', 'sanitize_title' );
1112
-        }
1112
+		}
1113 1113
 
1114
-        if ( ! empty( $bulkaction ) && strpos( $bulkaction, 'bulk_' ) === 0 ) {
1115
-            FrmAppHelper::remove_get_action();
1114
+		if ( ! empty( $bulkaction ) && strpos( $bulkaction, 'bulk_' ) === 0 ) {
1115
+			FrmAppHelper::remove_get_action();
1116 1116
 
1117
-            $bulkaction = str_replace( 'bulk_', '', $bulkaction );
1118
-        }
1117
+			$bulkaction = str_replace( 'bulk_', '', $bulkaction );
1118
+		}
1119 1119
 
1120 1120
 		$ids = FrmAppHelper::get_param( 'item-action', '', 'get', 'sanitize_text_field' );
1121
-        if ( empty( $ids ) ) {
1122
-            $errors[] = __( 'No forms were specified', 'formidable' );
1123
-            return $errors;
1124
-        }
1125
-
1126
-        $permission_error = FrmAppHelper::permission_nonce_error( '', '_wpnonce', 'bulk-toplevel_page_formidable' );
1127
-        if ( $permission_error !== false ) {
1128
-            $errors[] = $permission_error;
1129
-            return $errors;
1130
-        }
1131
-
1132
-        if ( ! is_array( $ids ) ) {
1133
-            $ids = explode( ',', $ids );
1134
-        }
1135
-
1136
-        switch ( $bulkaction ) {
1137
-            case 'delete':
1138
-                $message = self::bulk_destroy( $ids );
1121
+		if ( empty( $ids ) ) {
1122
+			$errors[] = __( 'No forms were specified', 'formidable' );
1123
+			return $errors;
1124
+		}
1125
+
1126
+		$permission_error = FrmAppHelper::permission_nonce_error( '', '_wpnonce', 'bulk-toplevel_page_formidable' );
1127
+		if ( $permission_error !== false ) {
1128
+			$errors[] = $permission_error;
1129
+			return $errors;
1130
+		}
1131
+
1132
+		if ( ! is_array( $ids ) ) {
1133
+			$ids = explode( ',', $ids );
1134
+		}
1135
+
1136
+		switch ( $bulkaction ) {
1137
+			case 'delete':
1138
+				$message = self::bulk_destroy( $ids );
1139 1139
 				break;
1140
-            case 'trash':
1141
-                $message = self::bulk_trash( $ids );
1140
+			case 'trash':
1141
+				$message = self::bulk_trash( $ids );
1142 1142
 				break;
1143
-            case 'untrash':
1144
-                $message = self::bulk_untrash( $ids );
1145
-        }
1143
+			case 'untrash':
1144
+				$message = self::bulk_untrash( $ids );
1145
+		}
1146 1146
 
1147
-        if ( isset( $message ) && ! empty( $message ) ) {
1147
+		if ( isset( $message ) && ! empty( $message ) ) {
1148 1148
 			$errors['message'] = $message;
1149
-        }
1149
+		}
1150 1150
 
1151
-        return $errors;
1152
-    }
1151
+		return $errors;
1152
+	}
1153 1153
 
1154
-    public static function route() {
1154
+	public static function route() {
1155 1155
 		$action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
1156
-        $vars = array();
1156
+		$vars = array();
1157 1157
 		if ( isset( $_POST['frm_compact_fields'] ) ) {
1158 1158
 			FrmAppHelper::permission_check( 'frm_edit_forms' );
1159 1159
 
1160 1160
 			$json_vars = htmlspecialchars_decode( nl2br( stripslashes( str_replace( '&quot;', '\\\"', $_POST['frm_compact_fields'] ) ) ) );
1161 1161
 			$json_vars = json_decode( $json_vars, true );
1162 1162
 			if ( empty( $json_vars ) ) {
1163
-                // json decoding failed so we should return an error message
1163
+				// json decoding failed so we should return an error message
1164 1164
 				$action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
1165
-                if ( 'edit' == $action ) {
1166
-                    $action = 'update';
1167
-                }
1165
+				if ( 'edit' == $action ) {
1166
+					$action = 'update';
1167
+				}
1168 1168
 
1169 1169
 				add_filter( 'frm_validate_form', 'FrmFormsController::json_error' );
1170
-            } else {
1170
+			} else {
1171 1171
 				$vars = FrmAppHelper::json_to_array( $json_vars );
1172
-                $action = $vars[ $action ];
1172
+				$action = $vars[ $action ];
1173 1173
 				unset( $_REQUEST['frm_compact_fields'], $_POST['frm_compact_fields'] );
1174 1174
 				$_REQUEST = array_merge( $_REQUEST, $vars );
1175 1175
 				$_POST = array_merge( $_POST, $_REQUEST );
1176
-            }
1177
-        } else {
1176
+			}
1177
+		} else {
1178 1178
 			$action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
1179
-    		if ( isset( $_REQUEST['delete_all'] ) ) {
1180
-                // override the action for this page
1181
-    			$action = 'delete_all';
1182
-            }
1183
-        }
1179
+			if ( isset( $_REQUEST['delete_all'] ) ) {
1180
+				// override the action for this page
1181
+				$action = 'delete_all';
1182
+			}
1183
+		}
1184 1184
 
1185 1185
 		add_action( 'frm_load_form_hooks', 'FrmHooksController::trigger_load_form_hooks' );
1186
-        FrmAppHelper::trigger_hook_load( 'form' );
1186
+		FrmAppHelper::trigger_hook_load( 'form' );
1187 1187
 
1188
-        switch ( $action ) {
1189
-            case 'new':
1188
+		switch ( $action ) {
1189
+			case 'new':
1190 1190
 				return self::new_form( $vars );
1191 1191
 			case 'add_new':
1192 1192
 			case 'list_templates':
1193
-            case 'create':
1194
-            case 'edit':
1195
-            case 'update':
1196
-            case 'duplicate':
1197
-            case 'trash':
1198
-            case 'untrash':
1199
-            case 'destroy':
1200
-            case 'delete_all':
1201
-            case 'settings':
1202
-            case 'update_settings':
1193
+			case 'create':
1194
+			case 'edit':
1195
+			case 'update':
1196
+			case 'duplicate':
1197
+			case 'trash':
1198
+			case 'untrash':
1199
+			case 'destroy':
1200
+			case 'delete_all':
1201
+			case 'settings':
1202
+			case 'update_settings':
1203 1203
 				return self::$action( $vars );
1204
-            default:
1204
+			default:
1205 1205
 				do_action( 'frm_form_action_' . $action );
1206 1206
 				if ( apply_filters( 'frm_form_stop_action_' . $action, false ) ) {
1207
-                    return;
1208
-                }
1207
+					return;
1208
+				}
1209 1209
 
1210 1210
 				$action = FrmAppHelper::get_param( 'action', '', 'get', 'sanitize_text_field' );
1211
-                if ( $action == -1 ) {
1211
+				if ( $action == -1 ) {
1212 1212
 					$action = FrmAppHelper::get_param( 'action2', '', 'get', 'sanitize_title' );
1213
-                }
1213
+				}
1214 1214
 
1215 1215
 				if ( strpos( $action, 'bulk_' ) === 0 ) {
1216
-                    FrmAppHelper::remove_get_action();
1217
-                    return self::list_form();
1218
-                }
1216
+					FrmAppHelper::remove_get_action();
1217
+					return self::list_form();
1218
+				}
1219 1219
 
1220
-                return self::display_forms_list();
1221
-        }
1222
-    }
1220
+				return self::display_forms_list();
1221
+		}
1222
+	}
1223 1223
 
1224
-    public static function json_error( $errors ) {
1225
-        $errors['json'] = __( 'Abnormal HTML characters prevented your form from saving correctly', 'formidable' );
1226
-        return $errors;
1227
-    }
1224
+	public static function json_error( $errors ) {
1225
+		$errors['json'] = __( 'Abnormal HTML characters prevented your form from saving correctly', 'formidable' );
1226
+		return $errors;
1227
+	}
1228 1228
 
1229 1229
 
1230
-    /* FRONT-END FORMS */
1231
-    public static function admin_bar_css() {
1230
+	/* FRONT-END FORMS */
1231
+	public static function admin_bar_css() {
1232 1232
 		if ( is_admin() || ! current_user_can( 'frm_edit_forms' ) ) {
1233
-            return;
1234
-        }
1233
+			return;
1234
+		}
1235 1235
 
1236 1236
 		add_action( 'wp_before_admin_bar_render', 'FrmFormsController::admin_bar_configure' );
1237 1237
 		FrmAppHelper::load_font_style();
1238 1238
 	}
1239 1239
 
1240 1240
 	public static function admin_bar_configure() {
1241
-        global $frm_vars;
1241
+		global $frm_vars;
1242 1242
 		if ( empty( $frm_vars['forms_loaded'] ) ) {
1243
-            return;
1244
-        }
1243
+			return;
1244
+		}
1245 1245
 
1246
-        $actions = array();
1246
+		$actions = array();
1247 1247
 		foreach ( $frm_vars['forms_loaded'] as $form ) {
1248 1248
 			if ( is_object( $form ) ) {
1249 1249
 				$actions[ $form->id ] = $form->name;
@@ -1298,18 +1298,18 @@  discard block
 block discarded – undo
1298 1298
 		}
1299 1299
 	}
1300 1300
 
1301
-    //formidable shortcode
1301
+	//formidable shortcode
1302 1302
 	public static function get_form_shortcode( $atts ) {
1303
-        global $frm_vars;
1303
+		global $frm_vars;
1304 1304
 		if ( isset( $frm_vars['skip_shortcode'] ) && $frm_vars['skip_shortcode'] ) {
1305
-            $sc = '[formidable';
1305
+			$sc = '[formidable';
1306 1306
 			if ( ! empty( $atts ) ) {
1307 1307
 				foreach ( $atts as $k => $v ) {
1308 1308
 					$sc .= ' ' . $k . '="' . esc_attr( $v ) . '"';
1309 1309
 				}
1310 1310
 			}
1311 1311
 			return $sc . ']';
1312
-        }
1312
+		}
1313 1313
 
1314 1314
 		$shortcode_atts = shortcode_atts(
1315 1315
 			array(
@@ -1327,27 +1327,27 @@  discard block
 block discarded – undo
1327 1327
 		);
1328 1328
 		do_action( 'formidable_shortcode_atts', $shortcode_atts, $atts );
1329 1329
 
1330
-        return self::show_form( $shortcode_atts['id'], $shortcode_atts['key'], $shortcode_atts['title'], $shortcode_atts['description'], $atts );
1331
-    }
1330
+		return self::show_form( $shortcode_atts['id'], $shortcode_atts['key'], $shortcode_atts['title'], $shortcode_atts['description'], $atts );
1331
+	}
1332 1332
 
1333
-    public static function show_form( $id = '', $key = '', $title = false, $description = false, $atts = array() ) {
1334
-        if ( empty( $id ) ) {
1335
-            $id = $key;
1336
-        }
1333
+	public static function show_form( $id = '', $key = '', $title = false, $description = false, $atts = array() ) {
1334
+		if ( empty( $id ) ) {
1335
+			$id = $key;
1336
+		}
1337 1337
 
1338
-        $form = self::maybe_get_form_to_show( $id );
1339
-        if ( ! $form ) {
1340
-            return __( 'Please select a valid form', 'formidable' );
1341
-        }
1338
+		$form = self::maybe_get_form_to_show( $id );
1339
+		if ( ! $form ) {
1340
+			return __( 'Please select a valid form', 'formidable' );
1341
+		}
1342 1342
 
1343 1343
 		FrmAppController::maybe_update_styles();
1344 1344
 
1345 1345
 		add_action( 'frm_load_form_hooks', 'FrmHooksController::trigger_load_form_hooks' );
1346
-        FrmAppHelper::trigger_hook_load( 'form', $form );
1346
+		FrmAppHelper::trigger_hook_load( 'form', $form );
1347 1347
 
1348
-        $form = apply_filters( 'frm_pre_display_form', $form );
1348
+		$form = apply_filters( 'frm_pre_display_form', $form );
1349 1349
 
1350
-        $frm_settings = FrmAppHelper::get_settings( array( 'current_form' => $form->id ) );
1350
+		$frm_settings = FrmAppHelper::get_settings( array( 'current_form' => $form->id ) );
1351 1351
 
1352 1352
 		if ( self::is_viewable_draft_form( $form ) ) {
1353 1353
 			// don't show a draft form on a page
@@ -1370,7 +1370,7 @@  discard block
 block discarded – undo
1370 1370
 		}
1371 1371
 
1372 1372
 		return $form;
1373
-    }
1373
+	}
1374 1374
 
1375 1375
 	private static function maybe_get_form_to_show( $id ) {
1376 1376
 		$form = false;
@@ -1399,21 +1399,21 @@  discard block
 block discarded – undo
1399 1399
 		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'] );
1400 1400
 	}
1401 1401
 
1402
-    public static function get_form( $form, $title, $description, $atts = array() ) {
1402
+	public static function get_form( $form, $title, $description, $atts = array() ) {
1403 1403
 		ob_start();
1404 1404
 
1405 1405
 		do_action( 'frm_before_get_form', $atts );
1406 1406
 
1407
-        self::get_form_contents( $form, $title, $description, $atts );
1407
+		self::get_form_contents( $form, $title, $description, $atts );
1408 1408
 		self::enqueue_scripts( FrmForm::get_params( $form ) );
1409 1409
 
1410
-        $contents = ob_get_contents();
1411
-        ob_end_clean();
1410
+		$contents = ob_get_contents();
1411
+		ob_end_clean();
1412 1412
 
1413 1413
 		self::maybe_minimize_form( $atts, $contents );
1414 1414
 
1415
-        return $contents;
1416
-    }
1415
+		return $contents;
1416
+	}
1417 1417
 
1418 1418
 	public static function enqueue_scripts( $params ) {
1419 1419
 		do_action( 'frm_enqueue_form_scripts', $params );
@@ -1766,10 +1766,10 @@  discard block
 block discarded – undo
1766 1766
 	}
1767 1767
 
1768 1768
 	public static function defer_script_loading( $tag, $handle ) {
1769
-	    if ( 'recaptcha-api' == $handle && ! strpos( $tag, 'defer' ) ) {
1770
-	        $tag = str_replace( ' src', ' defer="defer" async="async" src', $tag );
1769
+		if ( 'recaptcha-api' == $handle && ! strpos( $tag, 'defer' ) ) {
1770
+			$tag = str_replace( ' src', ' defer="defer" async="async" src', $tag );
1771 1771
 		}
1772
-	    return $tag;
1772
+		return $tag;
1773 1773
 	}
1774 1774
 
1775 1775
 	public static function footer_js( $location = 'footer' ) {
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.
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.
Indentation   +294 added lines, -294 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
 
@@ -49,40 +49,40 @@  discard block
 block discarded – undo
49 49
 			return false;
50 50
 		}
51 51
 
52
-        $check_val = $new_values;
52
+		$check_val = $new_values;
53 53
 		$check_val['created_at >'] = date( 'Y-m-d H:i:s', ( strtotime( $new_values['created_at'] ) - absint( $duplicate_entry_time ) ) );
54 54
 
55 55
 		unset( $check_val['created_at'], $check_val['updated_at'] );
56 56
 		unset( $check_val['is_draft'], $check_val['id'], $check_val['item_key'] );
57 57
 
58
-        if ( $new_values['item_key'] == $new_values['name'] ) {
58
+		if ( $new_values['item_key'] == $new_values['name'] ) {
59 59
 			unset( $check_val['name'] );
60
-        }
60
+		}
61 61
 
62
-        global $wpdb;
62
+		global $wpdb;
63 63
 		$entry_exists = FrmDb::get_col( $wpdb->prefix . 'frm_items', $check_val, 'id', array( 'order_by' => 'created_at DESC' ) );
64 64
 
65 65
 		if ( ! $entry_exists || empty( $entry_exists ) || ! isset( $values['item_meta'] ) ) {
66
-            return false;
67
-        }
66
+			return false;
67
+		}
68 68
 
69
-        $is_duplicate = false;
70
-        foreach ( $entry_exists as $entry_exist ) {
71
-            $is_duplicate = true;
69
+		$is_duplicate = false;
70
+		foreach ( $entry_exists as $entry_exist ) {
71
+			$is_duplicate = true;
72 72
 
73 73
 			// make sure it's a duplicate
74 74
 			$metas = FrmEntryMeta::get_entry_meta_info( $entry_exist );
75
-            $field_metas = array();
76
-            foreach ( $metas as $meta ) {
75
+			$field_metas = array();
76
+			foreach ( $metas as $meta ) {
77 77
 				$field_metas[ $meta->field_id ] = $meta->meta_value;
78
-            }
78
+			}
79 79
 
80
-            // If prev entry is empty and current entry is not, they are not duplicates
81
-            $filtered_vals = array_filter( $values['item_meta'] );
80
+			// If prev entry is empty and current entry is not, they are not duplicates
81
+			$filtered_vals = array_filter( $values['item_meta'] );
82 82
 			$field_metas   = array_filter( $field_metas );
83
-            if ( empty( $field_metas ) && ! empty( $filtered_vals ) ) {
84
-                return false;
85
-            }
83
+			if ( empty( $field_metas ) && ! empty( $filtered_vals ) ) {
84
+				return false;
85
+			}
86 86
 
87 87
 			// compare serialized values and not arrays
88 88
 			$new_meta = array_map( 'maybe_serialize', $filtered_vals );
@@ -99,20 +99,20 @@  discard block
 block discarded – undo
99 99
 			}
100 100
 
101 101
 			$diff = array_diff_assoc( $field_metas, $new_meta );
102
-            foreach ( $diff as $field_id => $meta_value ) {
102
+			foreach ( $diff as $field_id => $meta_value ) {
103 103
 				if ( ! empty( $meta_value ) ) {
104
-                    $is_duplicate = false;
105
-                    continue;
106
-                }
107
-            }
104
+					$is_duplicate = false;
105
+					continue;
106
+				}
107
+			}
108 108
 
109
-            if ( $is_duplicate ) {
109
+			if ( $is_duplicate ) {
110 110
 				break;
111
-            }
112
-        }
111
+			}
112
+		}
113 113
 
114
-        return $is_duplicate;
115
-    }
114
+		return $is_duplicate;
115
+	}
116 116
 
117 117
 	/**
118 118
 	 * Determine if an entry needs to be checked as a possible duplicate
@@ -157,32 +157,32 @@  discard block
 block discarded – undo
157 157
 		$new_values['updated_at'] = $new_values['created_at'];
158 158
 
159 159
 		$query_results = $wpdb->insert( $wpdb->prefix . 'frm_items', $new_values );
160
-        if ( ! $query_results ) {
161
-            return false;
162
-        }
160
+		if ( ! $query_results ) {
161
+			return false;
162
+		}
163 163
 
164
-        $entry_id = $wpdb->insert_id;
164
+		$entry_id = $wpdb->insert_id;
165 165
 
166
-        global $frm_vars;
166
+		global $frm_vars;
167 167
 		if ( ! isset( $frm_vars['saved_entries'] ) ) {
168
-            $frm_vars['saved_entries'] = array();
169
-        }
170
-        $frm_vars['saved_entries'][] = (int) $entry_id;
168
+			$frm_vars['saved_entries'] = array();
169
+		}
170
+		$frm_vars['saved_entries'][] = (int) $entry_id;
171 171
 
172 172
 		FrmEntryMeta::duplicate_entry_metas( $id, $entry_id );
173 173
 		self::clear_cache();
174 174
 
175 175
 		do_action( 'frm_after_duplicate_entry', $entry_id, $new_values['form_id'], array( 'old_id' => $id ) );
176
-        return $entry_id;
177
-    }
176
+		return $entry_id;
177
+	}
178 178
 
179 179
 	/**
180
-	* Update an entry (not via XML)
181
-	*
182
-	* @param int $id
183
-	* @param array $values
184
-	* @return boolean|int $update_results
185
-	*/
180
+	 * Update an entry (not via XML)
181
+	 *
182
+	 * @param int $id
183
+	 * @param array $values
184
+	 * @return boolean|int $update_results
185
+	 */
186 186
 	public static function update( $id, $values ) {
187 187
 		$update_results = self::update_entry( $id, $values, 'standard' );
188 188
 
@@ -190,14 +190,14 @@  discard block
 block discarded – undo
190 190
 	}
191 191
 
192 192
 	/**
193
-	* Update an entry with some differences depending on the update type
194
-	*
195
-	* @since 2.0.16
196
-	*
197
-	* @param int $id
198
-	* @param array $values
199
-	* @return boolean|int $query_results
200
-	*/
193
+	 * Update an entry with some differences depending on the update type
194
+	 *
195
+	 * @since 2.0.16
196
+	 *
197
+	 * @param int $id
198
+	 * @param array $values
199
+	 * @return boolean|int $query_results
200
+	 */
201 201
 	private static function update_entry( $id, $values, $update_type ) {
202 202
 		global $wpdb;
203 203
 
@@ -216,14 +216,14 @@  discard block
 block discarded – undo
216 216
 	}
217 217
 
218 218
 	public static function destroy( $id ) {
219
-        global $wpdb;
220
-        $id = (int) $id;
219
+		global $wpdb;
220
+		$id = (int) $id;
221 221
 
222 222
 		$entry = self::getOne( $id );
223
-        if ( ! $entry ) {
224
-            $result = false;
225
-            return $result;
226
-        }
223
+		if ( ! $entry ) {
224
+			$result = false;
225
+			return $result;
226
+		}
227 227
 
228 228
 		do_action( 'frm_before_destroy_entry', $id, $entry );
229 229
 
@@ -232,18 +232,18 @@  discard block
 block discarded – undo
232 232
 
233 233
 		self::clear_cache();
234 234
 
235
-        return $result;
236
-    }
235
+		return $result;
236
+	}
237 237
 
238 238
 	public static function update_form( $id, $value, $form_id ) {
239
-        global $wpdb;
239
+		global $wpdb;
240 240
 		$form_id = isset( $value ) ? $form_id : null;
241 241
 		$result = $wpdb->update( $wpdb->prefix . 'frm_items', array( 'form_id' => $form_id ), array( 'id' => $id ) );
242 242
 		if ( $result ) {
243 243
 			self::clear_cache();
244 244
 		}
245
-        return $result;
246
-    }
245
+		return $result;
246
+	}
247 247
 
248 248
 	/**
249 249
 	 * Clear entry caching
@@ -287,19 +287,19 @@  discard block
 block discarded – undo
287 287
 	}
288 288
 
289 289
 	public static function getOne( $id, $meta = false ) {
290
-        global $wpdb;
290
+		global $wpdb;
291 291
 
292
-        $query = "SELECT it.*, fr.name as form_name, fr.form_key as form_key FROM {$wpdb->prefix}frm_items it
292
+		$query = "SELECT it.*, fr.name as form_name, fr.form_key as form_key FROM {$wpdb->prefix}frm_items it
293 293
                   LEFT OUTER JOIN {$wpdb->prefix}frm_forms fr ON it.form_id=fr.id WHERE ";
294 294
 
295 295
 		$query .= is_numeric( $id ) ? 'it.id=%d' : 'it.item_key=%s';
296
-        $query_args = array( $id );
297
-        $query = $wpdb->prepare( $query, $query_args ); // WPCS: unprepared SQL ok.
296
+		$query_args = array( $id );
297
+		$query = $wpdb->prepare( $query, $query_args ); // WPCS: unprepared SQL ok.
298 298
 
299
-        if ( ! $meta ) {
299
+		if ( ! $meta ) {
300 300
 			$entry = FrmDb::check_cache( $id . '_nometa', 'frm_entry', $query, 'get_row' );
301 301
 			return stripslashes_deep( $entry );
302
-        }
302
+		}
303 303
 
304 304
 		$entry = FrmDb::check_cache( $id, 'frm_entry' );
305 305
 		if ( $entry !== false ) {
@@ -310,14 +310,14 @@  discard block
 block discarded – undo
310 310
 		$entry = self::get_meta( $entry );
311 311
 
312 312
 		return stripslashes_deep( $entry );
313
-    }
313
+	}
314 314
 
315 315
 	public static function get_meta( $entry ) {
316
-        if ( ! $entry ) {
317
-            return $entry;
318
-        }
316
+		if ( ! $entry ) {
317
+			return $entry;
318
+		}
319 319
 
320
-        global $wpdb;
320
+		global $wpdb;
321 321
 		$metas = FrmDb::get_results(
322 322
 			$wpdb->prefix . 'frm_item_metas m LEFT JOIN ' . $wpdb->prefix . 'frm_fields f ON m.field_id=f.id',
323 323
 			array(
@@ -327,56 +327,56 @@  discard block
 block discarded – undo
327 327
 			'field_id, meta_value, field_key, item_id'
328 328
 		);
329 329
 
330
-        $entry->metas = array();
330
+		$entry->metas = array();
331 331
 
332 332
 		$include_key = apply_filters( 'frm_include_meta_keys', false, array( 'form_id' => $entry->form_id ) );
333
-        foreach ( $metas as $meta_val ) {
334
-            if ( $meta_val->item_id == $entry->id ) {
333
+		foreach ( $metas as $meta_val ) {
334
+			if ( $meta_val->item_id == $entry->id ) {
335 335
 				$entry->metas[ $meta_val->field_id ] = maybe_unserialize( $meta_val->meta_value );
336 336
 				if ( $include_key ) {
337 337
 					$entry->metas[ $meta_val->field_key ] = $entry->metas[ $meta_val->field_id ];
338 338
 				}
339
-                 continue;
340
-            }
339
+				 continue;
340
+			}
341 341
 
342
-            // include sub entries in an array
342
+			// include sub entries in an array
343 343
 			if ( ! isset( $entry_metas[ $meta_val->field_id ] ) ) {
344 344
 				$entry->metas[ $meta_val->field_id ] = array();
345
-            }
345
+			}
346 346
 
347 347
 			$entry->metas[ $meta_val->field_id ][] = maybe_unserialize( $meta_val->meta_value );
348 348
 
349 349
 			unset( $meta_val );
350
-        }
350
+		}
351 351
 		unset( $metas );
352 352
 
353 353
 		FrmDb::set_cache( $entry->id, $entry, 'frm_entry' );
354 354
 
355
-        return $entry;
356
-    }
355
+		return $entry;
356
+	}
357 357
 
358
-    /**
359
-     * @param string $id
360
-     */
358
+	/**
359
+	 * @param string $id
360
+	 */
361 361
 	public static function exists( $id ) {
362
-        global $wpdb;
362
+		global $wpdb;
363 363
 
364
-        if ( FrmDb::check_cache( $id, 'frm_entry' ) ) {
365
-            $exists = true;
366
-            return $exists;
367
-        }
364
+		if ( FrmDb::check_cache( $id, 'frm_entry' ) ) {
365
+			$exists = true;
366
+			return $exists;
367
+		}
368 368
 
369 369
 		if ( is_numeric( $id ) ) {
370
-            $where = array( 'id' => $id );
371
-        } else {
372
-            $where = array( 'item_key' => $id );
373
-        }
370
+			$where = array( 'id' => $id );
371
+		} else {
372
+			$where = array( 'item_key' => $id );
373
+		}
374 374
 		$id = FrmDb::get_var( $wpdb->prefix . 'frm_items', $where );
375 375
 
376 376
 		return ( $id && $id > 0 );
377
-    }
377
+	}
378 378
 
379
-    public static function getAll( $where, $order_by = '', $limit = '', $meta = false, $inc_form = true ) {
379
+	public static function getAll( $where, $order_by = '', $limit = '', $meta = false, $inc_form = true ) {
380 380
 		global $wpdb;
381 381
 
382 382
 		$limit = FrmDb::esc_limit( $limit );
@@ -384,21 +384,21 @@  discard block
 block discarded – undo
384 384
 		$cache_key = maybe_serialize( $where ) . $order_by . $limit . $inc_form;
385 385
 		$entries = wp_cache_get( $cache_key, 'frm_entry' );
386 386
 
387
-        if ( false === $entries ) {
388
-            $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';
387
+		if ( false === $entries ) {
388
+			$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';
389 389
 			$table = $wpdb->prefix . 'frm_items it ';
390 390
 
391
-            if ( $inc_form ) {
392
-                $fields = 'it.*, fr.name as form_name,fr.form_key as form_key';
393
-                $table .= 'LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_forms fr ON it.form_id=fr.id ';
394
-            }
391
+			if ( $inc_form ) {
392
+				$fields = 'it.*, fr.name as form_name,fr.form_key as form_key';
393
+				$table .= 'LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_forms fr ON it.form_id=fr.id ';
394
+			}
395 395
 
396
-            if ( preg_match( '/ meta_([0-9]+)/', $order_by, $order_matches ) ) {
397
-    		    // sort by a requested field
398
-                $field_id = (int) $order_matches[1];
396
+			if ( preg_match( '/ meta_([0-9]+)/', $order_by, $order_matches ) ) {
397
+				// sort by a requested field
398
+				$field_id = (int) $order_matches[1];
399 399
 				$fields .= ', (SELECT meta_value FROM ' . $wpdb->prefix . 'frm_item_metas WHERE field_id = ' . $field_id . ' AND item_id = it.id) as meta_' . $field_id;
400 400
 				unset( $order_matches, $field_id );
401
-		    }
401
+			}
402 402
 
403 403
 			// prepare the query
404 404
 			$query = 'SELECT ' . $fields . ' FROM ' . $table . FrmDb::prepend_and_or_where( ' WHERE ', $where ) . $order_by . $limit;
@@ -407,45 +407,45 @@  discard block
 block discarded – undo
407 407
 			unset( $query );
408 408
 
409 409
 			FrmDb::set_cache( $cache_key, $entries, 'frm_entry' );
410
-        }
410
+		}
411 411
 
412
-        if ( ! $meta || ! $entries ) {
412
+		if ( ! $meta || ! $entries ) {
413 413
 			return stripslashes_deep( $entries );
414
-        }
414
+		}
415 415
 		unset( $meta );
416 416
 
417 417
 		if ( ! is_array( $where ) && preg_match( '/^it\.form_id=\d+$/', $where ) ) {
418 418
 			$where = array( 'it.form_id' => substr( $where, 11 ) );
419
-        }
419
+		}
420 420
 
421
-        $meta_where = array( 'field_id !' => 0 );
421
+		$meta_where = array( 'field_id !' => 0 );
422 422
 		if ( $limit == '' && is_array( $where ) && count( $where ) == 1 && isset( $where['it.form_id'] ) ) {
423
-            $meta_where['fi.form_id'] = $where['it.form_id'];
424
-        } else {
425
-            $meta_where['item_id'] = array_keys( $entries );
426
-        }
423
+			$meta_where['fi.form_id'] = $where['it.form_id'];
424
+		} else {
425
+			$meta_where['item_id'] = array_keys( $entries );
426
+		}
427 427
 
428
-        $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' );
428
+		$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' );
429 429
 
430
-        unset( $meta_where );
430
+		unset( $meta_where );
431 431
 
432
-        if ( ! $metas ) {
432
+		if ( ! $metas ) {
433 433
 			return stripslashes_deep( $entries );
434
-        }
434
+		}
435 435
 
436
-        foreach ( $metas as $m_key => $meta_val ) {
437
-            if ( ! isset( $entries[ $meta_val->item_id ] ) ) {
438
-                continue;
439
-            }
436
+		foreach ( $metas as $m_key => $meta_val ) {
437
+			if ( ! isset( $entries[ $meta_val->item_id ] ) ) {
438
+				continue;
439
+			}
440 440
 
441
-            if ( ! isset( $entries[ $meta_val->item_id ]->metas ) ) {
441
+			if ( ! isset( $entries[ $meta_val->item_id ]->metas ) ) {
442 442
 				$entries[ $meta_val->item_id ]->metas = array();
443
-            }
443
+			}
444 444
 
445 445
 			$entries[ $meta_val->item_id ]->metas[ $meta_val->field_id ] = maybe_unserialize( $meta_val->meta_value );
446 446
 
447 447
 			unset( $m_key, $meta_val );
448
-        }
448
+		}
449 449
 
450 450
 		if ( ! FrmAppHelper::prevent_caching() ) {
451 451
 			foreach ( $entries as $entry ) {
@@ -455,30 +455,30 @@  discard block
 block discarded – undo
455 455
 		}
456 456
 
457 457
 		return stripslashes_deep( $entries );
458
-    }
458
+	}
459 459
 
460
-    // Pagination Methods
461
-    public static function getRecordCount( $where = '' ) {
462
-        global $wpdb;
460
+	// Pagination Methods
461
+	public static function getRecordCount( $where = '' ) {
462
+		global $wpdb;
463 463
 		$table_join = $wpdb->prefix . 'frm_items it LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_forms fr ON it.form_id=fr.id';
464 464
 
465 465
 		if ( is_numeric( $where ) ) {
466
-            $table_join = 'frm_items';
467
-            $where = array( 'form_id' => $where );
468
-        }
466
+			$table_join = 'frm_items';
467
+			$where = array( 'form_id' => $where );
468
+		}
469 469
 
470
-        if ( is_array( $where ) ) {
471
-            $count = FrmDb::get_count( $table_join, $where );
472
-        } else {
470
+		if ( is_array( $where ) ) {
471
+			$count = FrmDb::get_count( $table_join, $where );
472
+		} else {
473 473
 			$cache_key = 'count_' . maybe_serialize( $where );
474 474
 			$query = 'SELECT COUNT(*) FROM ' . $table_join . FrmDb::prepend_and_or_where( ' WHERE ', $where );
475 475
 			$count = FrmDb::check_cache( $cache_key, 'frm_entry', $query, 'get_var' );
476
-        }
476
+		}
477 477
 
478
-        return $count;
479
-    }
478
+		return $count;
479
+	}
480 480
 
481
-    public static function getPageCount( $p_size, $where = '' ) {
481
+	public static function getPageCount( $p_size, $where = '' ) {
482 482
 		$p_size = (int) $p_size;
483 483
 		$count = 1;
484 484
 		if ( $p_size ) {
@@ -489,16 +489,16 @@  discard block
 block discarded – undo
489 489
 		}
490 490
 
491 491
 		return $count;
492
-    }
492
+	}
493 493
 
494 494
 	/**
495
-	* Prepare the data before inserting it into the database
496
-	*
497
-	* @since 2.0.16
498
-	* @param array $values
499
-	* @param string $type
500
-	* @return array $new_values
501
-	*/
495
+	 * Prepare the data before inserting it into the database
496
+	 *
497
+	 * @since 2.0.16
498
+	 * @param array $values
499
+	 * @param string $type
500
+	 * @return array $new_values
501
+	 */
502 502
 	private static function before_insert_entry_in_database( &$values, $type ) {
503 503
 
504 504
 		self::sanitize_entry_post( $values );
@@ -513,13 +513,13 @@  discard block
 block discarded – undo
513 513
 	}
514 514
 
515 515
 	/**
516
-	* Create an entry and perform after create actions
517
-	*
518
-	* @since 2.0.16
519
-	* @param array $values
520
-	* @param array $new_values
521
-	* @return boolean|int $entry_id
522
-	*/
516
+	 * Create an entry and perform after create actions
517
+	 *
518
+	 * @since 2.0.16
519
+	 * @param array $values
520
+	 * @param array $new_values
521
+	 * @return boolean|int $entry_id
522
+	 */
523 523
 	private static function continue_to_create_entry( $values, $new_values ) {
524 524
 		$entry_id = self::insert_entry_into_database( $new_values );
525 525
 		if ( ! $entry_id ) {
@@ -531,37 +531,37 @@  discard block
 block discarded – undo
531 531
 		return $entry_id;
532 532
 	}
533 533
 
534
-    /**
535
-     * Sanitize the POST values before we use them
536
-     *
537
-     * @since 2.0
538
-     * @param array $values The POST values by reference
539
-     */
540
-    public static function sanitize_entry_post( &$values ) {
541
-        $sanitize_method = array(
542
-            'form_id'       => 'absint',
543
-            'frm_action'    => 'sanitize_title',
544
-            'form_key'      => 'sanitize_title',
545
-            'item_key'      => 'sanitize_title',
546
-            'item_name'     => 'sanitize_text_field',
547
-            'frm_saving_draft' => 'absint',
548
-            'is_draft'      => 'absint',
549
-            'post_id'       => 'absint',
550
-            'parent_item_id' => 'absint',
551
-            'created_at'    => 'sanitize_text_field',
552
-            'updated_at'    => 'sanitize_text_field',
553
-        );
554
-
555
-        FrmAppHelper::sanitize_request( $sanitize_method, $values );
556
-    }
534
+	/**
535
+	 * Sanitize the POST values before we use them
536
+	 *
537
+	 * @since 2.0
538
+	 * @param array $values The POST values by reference
539
+	 */
540
+	public static function sanitize_entry_post( &$values ) {
541
+		$sanitize_method = array(
542
+			'form_id'       => 'absint',
543
+			'frm_action'    => 'sanitize_title',
544
+			'form_key'      => 'sanitize_title',
545
+			'item_key'      => 'sanitize_title',
546
+			'item_name'     => 'sanitize_text_field',
547
+			'frm_saving_draft' => 'absint',
548
+			'is_draft'      => 'absint',
549
+			'post_id'       => 'absint',
550
+			'parent_item_id' => 'absint',
551
+			'created_at'    => 'sanitize_text_field',
552
+			'updated_at'    => 'sanitize_text_field',
553
+		);
554
+
555
+		FrmAppHelper::sanitize_request( $sanitize_method, $values );
556
+	}
557 557
 
558 558
 	/**
559
-	* Prepare the new values for inserting into the database
560
-	*
561
-	* @since 2.0.16
562
-	* @param array $values
563
-	* @return array $new_values
564
-	*/
559
+	 * Prepare the new values for inserting into the database
560
+	 *
561
+	 * @since 2.0.16
562
+	 * @param array $values
563
+	 * @return array $new_values
564
+	 */
565 565
 	private static function package_entry_data( &$values ) {
566 566
 		global $wpdb;
567 567
 
@@ -614,34 +614,34 @@  discard block
 block discarded – undo
614 614
 	}
615 615
 
616 616
 	/**
617
-	* Get the is_draft value for a new entry
618
-	*
619
-	* @since 2.0.16
620
-	* @param array $values
621
-	* @return int
622
-	*/
617
+	 * Get the is_draft value for a new entry
618
+	 *
619
+	 * @since 2.0.16
620
+	 * @param array $values
621
+	 * @return int
622
+	 */
623 623
 	private static function get_is_draft_value( $values ) {
624 624
 		return ( ( isset( $values['frm_saving_draft'] ) && $values['frm_saving_draft'] == 1 ) || ( isset( $values['is_draft'] ) && $values['is_draft'] == 1 ) ) ? 1 : 0;
625 625
 	}
626 626
 
627 627
 	/**
628
-	* Get the created_at value for a new entry
629
-	*
630
-	* @since 2.0.16
631
-	* @param array $values
632
-	* @return string
633
-	*/
628
+	 * Get the created_at value for a new entry
629
+	 *
630
+	 * @since 2.0.16
631
+	 * @param array $values
632
+	 * @return string
633
+	 */
634 634
 	private static function get_created_at( $values ) {
635 635
 		return self::get_entry_value( $values, 'created_at', current_time( 'mysql', 1 ) );
636 636
 	}
637 637
 
638 638
 	/**
639
-	* Get the updated_at value for a new entry
640
-	*
641
-	* @since 2.0.16
642
-	* @param array $values
643
-	* @return string
644
-	*/
639
+	 * Get the updated_at value for a new entry
640
+	 *
641
+	 * @since 2.0.16
642
+	 * @param array $values
643
+	 * @return string
644
+	 */
645 645
 	private static function get_updated_at( $values ) {
646 646
 		if ( isset( $values['updated_at'] ) ) {
647 647
 			$updated_at = $values['updated_at'];
@@ -653,12 +653,12 @@  discard block
 block discarded – undo
653 653
 	}
654 654
 
655 655
 	/**
656
-	* Get the description value for a new entry
657
-	*
658
-	* @since 2.0.16
659
-	* @param array $values
660
-	* @return string
661
-	*/
656
+	 * Get the description value for a new entry
657
+	 *
658
+	 * @since 2.0.16
659
+	 * @param array $values
660
+	 * @return string
661
+	 */
662 662
 	private static function get_entry_description( $values ) {
663 663
 		if ( isset( $values['description'] ) && ! empty( $values['description'] ) ) {
664 664
 			$description = maybe_serialize( $values['description'] );
@@ -675,12 +675,12 @@  discard block
 block discarded – undo
675 675
 	}
676 676
 
677 677
 	/**
678
-	* Get the user_id value for a new entry
679
-	*
680
-	* @since 2.0.16
681
-	* @param array $values
682
-	* @return int
683
-	*/
678
+	 * Get the user_id value for a new entry
679
+	 *
680
+	 * @since 2.0.16
681
+	 * @param array $values
682
+	 * @return int
683
+	 */
684 684
 	private static function get_entry_user_id( $values ) {
685 685
 		if ( isset( $values['frm_user_id'] ) && ( is_numeric( $values['frm_user_id'] ) || FrmAppHelper::is_admin() ) ) {
686 686
 			$user_id = $values['frm_user_id'];
@@ -693,12 +693,12 @@  discard block
 block discarded – undo
693 693
 	}
694 694
 
695 695
 	/**
696
-	* Insert new entry into the database
697
-	*
698
-	* @since 2.0.16
699
-	* @param array $new_values
700
-	* @return int | boolean $entry_id
701
-	*/
696
+	 * Insert new entry into the database
697
+	 *
698
+	 * @since 2.0.16
699
+	 * @param array $new_values
700
+	 * @return int | boolean $entry_id
701
+	 */
702 702
 	private static function insert_entry_into_database( $new_values ) {
703 703
 		global $wpdb;
704 704
 
@@ -714,11 +714,11 @@  discard block
 block discarded – undo
714 714
 	}
715 715
 
716 716
 	/**
717
-	* Add the new entry to global $frm_vars
718
-	*
719
-	* @since 2.0.16
720
-	* @param int $entry_id
721
-	*/
717
+	 * Add the new entry to global $frm_vars
718
+	 *
719
+	 * @since 2.0.16
720
+	 * @param int $entry_id
721
+	 */
722 722
 	private static function add_new_entry_to_frm_vars( $entry_id ) {
723 723
 		global $frm_vars;
724 724
 
@@ -730,12 +730,12 @@  discard block
 block discarded – undo
730 730
 	}
731 731
 
732 732
 	/**
733
-	* Add entry metas, if there are any
734
-	*
735
-	* @since 2.0.16
736
-	* @param array $values
737
-	* @param int $entry_id
738
-	*/
733
+	 * Add entry metas, if there are any
734
+	 *
735
+	 * @since 2.0.16
736
+	 * @param array $values
737
+	 * @param int $entry_id
738
+	 */
739 739
 	private static function maybe_add_entry_metas( $values, $entry_id ) {
740 740
 		if ( isset( $values['item_meta'] ) ) {
741 741
 			FrmEntryMeta::update_entry_metas( $entry_id, $values['item_meta'] );
@@ -743,12 +743,12 @@  discard block
 block discarded – undo
743 743
 	}
744 744
 
745 745
 	/**
746
-	* Trigger frm_after_create_entry hooks
747
-	*
748
-	* @since 2.0.16
749
-	* @param int $entry_id
750
-	* @param array $new_values
751
-	*/
746
+	 * Trigger frm_after_create_entry hooks
747
+	 *
748
+	 * @since 2.0.16
749
+	 * @param int $entry_id
750
+	 * @param array $new_values
751
+	 */
752 752
 	private static function after_entry_created_actions( $entry_id, $values, $new_values ) {
753 753
 		// this is a child entry
754 754
 		$is_child = isset( $values['parent_form_id'] ) && isset( $values['parent_nonce'] ) && ! empty( $values['parent_form_id'] ) && wp_verify_nonce( $values['parent_nonce'], 'parent' );
@@ -758,13 +758,13 @@  discard block
 block discarded – undo
758 758
 	}
759 759
 
760 760
 	/**
761
-	* Actions to perform immediately after an entry is inserted in the frm_items database
762
-	*
763
-	* @since 2.0.16
764
-	* @param array $values
765
-	* @param array $new_values
766
-	* @param int $entry_id
767
-	*/
761
+	 * Actions to perform immediately after an entry is inserted in the frm_items database
762
+	 *
763
+	 * @since 2.0.16
764
+	 * @param array $values
765
+	 * @param array $new_values
766
+	 * @param int $entry_id
767
+	 */
768 768
 	private static function after_insert_entry_in_database( $values, $new_values, $entry_id ) {
769 769
 
770 770
 		self::add_new_entry_to_frm_vars( $entry_id );
@@ -777,14 +777,14 @@  discard block
 block discarded – undo
777 777
 	}
778 778
 
779 779
 	/**
780
-	* Perform some actions right before updating an entry
781
-	*
782
-	* @since 2.0.16
783
-	* @param int $id
784
-	* @param array $values
785
-	* @param string $update_type
786
-	* @return boolean $update
787
-	*/
780
+	 * Perform some actions right before updating an entry
781
+	 *
782
+	 * @since 2.0.16
783
+	 * @param int $id
784
+	 * @param array $values
785
+	 * @param string $update_type
786
+	 * @return boolean $update
787
+	 */
788 788
 	private static function before_update_entry( $id, &$values, $update_type ) {
789 789
 		$update = true;
790 790
 
@@ -802,13 +802,13 @@  discard block
 block discarded – undo
802 802
 	}
803 803
 
804 804
 	/**
805
-	* Package the entry data for updating
806
-	*
807
-	* @since 2.0.16
808
-	* @param int $id
809
-	* @param array $values
810
-	* @return array $new_values
811
-	*/
805
+	 * Package the entry data for updating
806
+	 *
807
+	 * @since 2.0.16
808
+	 * @param int $id
809
+	 * @param array $values
810
+	 * @return array $new_values
811
+	 */
812 812
 	private static function package_entry_to_update( $id, $values ) {
813 813
 		global $wpdb;
814 814
 
@@ -842,14 +842,14 @@  discard block
 block discarded – undo
842 842
 	}
843 843
 
844 844
 	/**
845
-	* Perform some actions right after updating an entry
846
-	*
847
-	* @since 2.0.16
848
-	* @param boolean|int $query_results
849
-	* @param int $id
850
-	* @param array $values
851
-	* @param array $new_values
852
-	*/
845
+	 * Perform some actions right after updating an entry
846
+	 *
847
+	 * @since 2.0.16
848
+	 * @param boolean|int $query_results
849
+	 * @param int $id
850
+	 * @param array $values
851
+	 * @param array $new_values
852
+	 */
853 853
 	private static function after_update_entry( $query_results, $id, $values, $new_values ) {
854 854
 		if ( $query_results ) {
855 855
 			self::clear_cache();
@@ -871,13 +871,13 @@  discard block
 block discarded – undo
871 871
 	}
872 872
 
873 873
 	/**
874
-	* Create entry from an XML import
875
-	* Certain actions aren't necessary when importing (like saving sub entries, checking for duplicates, etc.)
876
-	*
877
-	* @since 2.0.16
878
-	* @param array $values
879
-	* @return int | boolean $entry_id
880
-	*/
874
+	 * Create entry from an XML import
875
+	 * Certain actions aren't necessary when importing (like saving sub entries, checking for duplicates, etc.)
876
+	 *
877
+	 * @since 2.0.16
878
+	 * @param array $values
879
+	 * @return int | boolean $entry_id
880
+	 */
881 881
 	public static function create_entry_from_xml( $values ) {
882 882
 		$entry_id = self::create_entry( $values, 'xml' );
883 883
 
@@ -885,14 +885,14 @@  discard block
 block discarded – undo
885 885
 	}
886 886
 
887 887
 	/**
888
-	* Update entry from an XML import
889
-	* Certain actions aren't necessary when importing (like saving sub entries and modifying other vals)
890
-	*
891
-	* @since 2.0.16
892
-	* @param int $id
893
-	* @param array $values
894
-	* @return int | boolean $updated
895
-	*/
888
+	 * Update entry from an XML import
889
+	 * Certain actions aren't necessary when importing (like saving sub entries and modifying other vals)
890
+	 *
891
+	 * @since 2.0.16
892
+	 * @param int $id
893
+	 * @param array $values
894
+	 * @return int | boolean $updated
895
+	 */
896 896
 	public static function update_entry_from_xml( $id, $values ) {
897 897
 		$updated = self::update_entry( $id, $values, 'xml' );
898 898
 
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.