Completed
Push — master ( 9f636b...8714dd )
by Jamie
07:30 queued 03:36
created
classes/models/FrmEntryMeta.php 3 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -61,6 +61,9 @@  discard block
 block discarded – undo
61 61
         return $wpdb->update( $wpdb->prefix .'frm_item_metas', array( 'meta_value' => $meta_value ), $where_values );
62 62
     }
63 63
 
64
+	/**
65
+	 * @param integer $entry_id
66
+	 */
64 67
 	public static function update_entry_metas( $entry_id, $values ) {
65 68
         global $wpdb;
66 69
 
@@ -286,6 +289,7 @@  discard block
 block discarded – undo
286 289
      * @param string|array $where
287 290
      * @param string $order_by
288 291
      * @param string $limit
292
+     * @param boolean $unique
289 293
      */
290 294
 	private static function get_ids_query( $where, $order_by, $limit, $unique, $args, array &$query ) {
291 295
         global $wpdb;
Please login to merge, or discard this patch.
Indentation   +180 added lines, -180 removed lines patch added patch discarded remove patch
@@ -5,25 +5,25 @@  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,
23
-            'created_at'    => current_time('mysql', 1),
24
-        );
21
+			'item_id'       => $entry_id,
22
+			'field_id'      => $field_id,
23
+			'created_at'    => current_time('mysql', 1),
24
+		);
25 25
 
26
-        $new_values = apply_filters('frm_add_entry_meta', $new_values);
26
+		$new_values = apply_filters('frm_add_entry_meta', $new_values);
27 27
 
28 28
 		$query_results = $wpdb->insert( $wpdb->prefix . 'frm_item_metas', $new_values );
29 29
 
@@ -34,40 +34,40 @@  discard block
 block discarded – undo
34 34
 			$id = 0;
35 35
 		}
36 36
 
37
-        return $id;
38
-    }
37
+		return $id;
38
+	}
39 39
 
40
-    /**
41
-     * @param string $meta_key
42
-     */
40
+	/**
41
+	 * @param string $meta_key
42
+	 */
43 43
 	public static function update_entry_meta( $entry_id, $field_id, $meta_key = null, $meta_value ) {
44
-        if ( ! $field_id ) {
45
-            return false;
46
-        }
44
+		if ( ! $field_id ) {
45
+			return false;
46
+		}
47 47
 
48
-        global $wpdb;
48
+		global $wpdb;
49 49
 
50
-        $values = $where_values = array( 'item_id' => $entry_id, 'field_id' => $field_id );
51
-        $values['meta_value'] = $meta_value;
52
-        $values = apply_filters('frm_update_entry_meta', $values);
50
+		$values = $where_values = array( 'item_id' => $entry_id, 'field_id' => $field_id );
51
+		$values['meta_value'] = $meta_value;
52
+		$values = apply_filters('frm_update_entry_meta', $values);
53 53
 		if ( is_array($values['meta_value']) ) {
54 54
 			$values['meta_value'] = array_filter( $values['meta_value'], 'FrmAppHelper::is_not_empty_value' );
55 55
 		}
56
-        $meta_value = maybe_serialize($values['meta_value']);
56
+		$meta_value = maybe_serialize($values['meta_value']);
57 57
 
58
-        wp_cache_delete( $entry_id, 'frm_entry');
58
+		wp_cache_delete( $entry_id, 'frm_entry');
59 59
 		self::clear_cache();
60 60
 
61 61
 		return $wpdb->update( $wpdb->prefix . 'frm_item_metas', array( 'meta_value' => $meta_value ), $where_values );
62
-    }
62
+	}
63 63
 
64 64
 	public static function update_entry_metas( $entry_id, $values ) {
65
-        global $wpdb;
65
+		global $wpdb;
66 66
 
67 67
 		$prev_values = FrmDb::get_col( $wpdb->prefix . 'frm_item_metas', array( 'item_id' => $entry_id, 'field_id !' => 0 ), 'field_id' );
68 68
 
69
-        foreach ( $values as $field_id => $meta_value ) {
70
-            // set the value for the file upload field and add new tags (in Pro version)
69
+		foreach ( $values as $field_id => $meta_value ) {
70
+			// set the value for the file upload field and add new tags (in Pro version)
71 71
 			$meta_value = apply_filters( 'frm_prepare_data_before_db', $meta_value, $field_id, $entry_id );
72 72
 
73 73
 			if ( $prev_values && in_array($field_id, $prev_values) ) {
@@ -85,39 +85,39 @@  discard block
 block discarded – undo
85 85
 			}
86 86
 		}
87 87
 
88
-        if ( empty($prev_values) ) {
89
-            return;
90
-        }
88
+		if ( empty($prev_values) ) {
89
+			return;
90
+		}
91 91
 
92
-        $prev_values = array_diff($prev_values, array_keys($values));
92
+		$prev_values = array_diff($prev_values, array_keys($values));
93 93
 
94
-        if ( empty($prev_values) ) {
95
-            return;
96
-        }
94
+		if ( empty($prev_values) ) {
95
+			return;
96
+		}
97 97
 
98 98
 		// prepare the query
99 99
 		$where = array( 'item_id' => $entry_id, 'field_id' => $prev_values );
100 100
 		FrmDb::get_where_clause_and_values( $where );
101 101
 
102
-        // Delete any leftovers
103
-        $wpdb->query( $wpdb->prepare( 'DELETE FROM ' . $wpdb->prefix . 'frm_item_metas ' . $where['where'], $where['values'] ) );
102
+		// Delete any leftovers
103
+		$wpdb->query( $wpdb->prepare( 'DELETE FROM ' . $wpdb->prefix . 'frm_item_metas ' . $where['where'], $where['values'] ) );
104 104
 		self::clear_cache();
105
-    }
105
+	}
106 106
 
107 107
 	public static function duplicate_entry_metas( $old_id, $new_id ) {
108
-        $metas = self::get_entry_meta_info($old_id);
109
-        foreach ( $metas as $meta ) {
110
-            self::add_entry_meta($new_id, $meta->field_id, null, $meta->meta_value);
111
-            unset($meta);
112
-        }
108
+		$metas = self::get_entry_meta_info($old_id);
109
+		foreach ( $metas as $meta ) {
110
+			self::add_entry_meta($new_id, $meta->field_id, null, $meta->meta_value);
111
+			unset($meta);
112
+		}
113 113
 		self::clear_cache();
114
-    }
114
+	}
115 115
 
116 116
 	public static function delete_entry_meta( $entry_id, $field_id ) {
117
-        global $wpdb;
117
+		global $wpdb;
118 118
 		self::clear_cache();
119
-        return $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->prefix}frm_item_metas WHERE field_id=%d AND item_id=%d", $field_id, $entry_id));
120
-    }
119
+		return $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->prefix}frm_item_metas WHERE field_id=%d AND item_id=%d", $field_id, $entry_id));
120
+	}
121 121
 
122 122
 	/**
123 123
 	 * Clear entry meta caching
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	}
143 143
 
144 144
 	public static function get_entry_meta_by_field( $entry_id, $field_id ) {
145
-        global $wpdb;
145
+		global $wpdb;
146 146
 
147 147
 		if ( is_object( $entry_id ) ) {
148 148
 			$entry = $entry_id;
@@ -155,137 +155,137 @@  discard block
 block discarded – undo
155 155
 
156 156
 		if ( $cached && isset( $cached->metas ) && isset( $cached->metas[ $field_id ] ) ) {
157 157
 			$result = $cached->metas[ $field_id ];
158
-            return stripslashes_deep($result);
159
-        }
158
+			return stripslashes_deep($result);
159
+		}
160 160
 
161 161
 		$get_table = $wpdb->prefix . 'frm_item_metas';
162 162
 		$query = array( 'item_id' => $entry_id );
163
-        if ( is_numeric($field_id) ) {
163
+		if ( is_numeric($field_id) ) {
164 164
 			$query['field_id'] = $field_id;
165
-        } else {
165
+		} else {
166 166
 			$get_table .= ' it LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_fields fi ON it.field_id=fi.id';
167 167
 			$query['fi.field_key'] = $field_id;
168
-        }
168
+		}
169 169
 
170 170
 		$result = FrmDb::get_var( $get_table, $query, 'meta_value' );
171
-        $result = maybe_unserialize($result);
172
-        $result = stripslashes_deep($result);
171
+		$result = maybe_unserialize($result);
172
+		$result = stripslashes_deep($result);
173 173
 
174
-        return $result;
175
-    }
174
+		return $result;
175
+	}
176 176
 
177 177
 	public static function get_entry_metas( $entry_id ) {
178
-        _deprecated_function( __FUNCTION__, '1.07.10');
178
+		_deprecated_function( __FUNCTION__, '1.07.10');
179 179
 
180
-        global $wpdb;
180
+		global $wpdb;
181 181
 		return FrmDb::get_col( $wpdb->prefix . 'frm_item_metas', array( 'item_id' => $entry_id ), 'meta_value' );
182
-    }
182
+	}
183 183
 
184
-    public static function get_entry_metas_for_field( $field_id, $order = '', $limit = '', $args = array() ) {
184
+	public static function get_entry_metas_for_field( $field_id, $order = '', $limit = '', $args = array() ) {
185 185
 		$defaults = array( 'value' => false, 'unique' => false, 'stripslashes' => true, 'is_draft' => false );
186
-        $args = wp_parse_args( $args, $defaults );
186
+		$args = wp_parse_args( $args, $defaults );
187 187
 
188
-        $query = array();
189
-        self::meta_field_query($field_id, $order, $limit, $args, $query);
190
-        $query = implode(' ', $query);
188
+		$query = array();
189
+		self::meta_field_query($field_id, $order, $limit, $args, $query);
190
+		$query = implode(' ', $query);
191 191
 
192 192
 		$cache_key = 'entry_metas_for_field_' . $field_id . $order . $limit . maybe_serialize( $args );
193
-        $values = FrmAppHelper::check_cache($cache_key, 'frm_entry', $query, 'get_col');
193
+		$values = FrmAppHelper::check_cache($cache_key, 'frm_entry', $query, 'get_col');
194 194
 
195
-        if ( ! $args['stripslashes'] ) {
196
-            return $values;
197
-        }
195
+		if ( ! $args['stripslashes'] ) {
196
+			return $values;
197
+		}
198 198
 
199 199
 		foreach ( $values as $k => $v ) {
200 200
 			$values[ $k ] = maybe_unserialize( $v );
201
-            unset($k, $v);
202
-        }
201
+			unset($k, $v);
202
+		}
203 203
 
204
-        return stripslashes_deep($values);
205
-    }
204
+		return stripslashes_deep($values);
205
+	}
206 206
 
207
-    /**
208
-     * @param string $order
209
-     * @param string $limit
210
-     */
207
+	/**
208
+	 * @param string $order
209
+	 * @param string $limit
210
+	 */
211 211
 	private static function meta_field_query( $field_id, $order, $limit, $args, array &$query ) {
212
-        global $wpdb;
213
-        $query[] = 'SELECT';
214
-        $query[] = $args['unique'] ? 'DISTINCT(em.meta_value)' : 'em.meta_value';
212
+		global $wpdb;
213
+		$query[] = 'SELECT';
214
+		$query[] = $args['unique'] ? 'DISTINCT(em.meta_value)' : 'em.meta_value';
215 215
 		$query[] = 'FROM ' . $wpdb->prefix . 'frm_item_metas em ';
216 216
 
217
-        if ( ! $args['is_draft'] ) {
217
+		if ( ! $args['is_draft'] ) {
218 218
 			$query[] = 'INNER JOIN ' . $wpdb->prefix . 'frm_items e ON (e.id=em.item_id)';
219
-        }
219
+		}
220 220
 
221
-        if ( is_numeric($field_id) ) {
222
-            $query[] = $wpdb->prepare('WHERE em.field_id=%d', $field_id);
223
-        } else {
221
+		if ( is_numeric($field_id) ) {
222
+			$query[] = $wpdb->prepare('WHERE em.field_id=%d', $field_id);
223
+		} else {
224 224
 			$query[] = $wpdb->prepare( 'LEFT JOIN ' . $wpdb->prefix . 'frm_fields fi ON (em.field_id = fi.id) WHERE fi.field_key=%s', $field_id );
225
-        }
225
+		}
226 226
 
227
-        if ( ! $args['is_draft'] ) {
228
-            $query[] = 'AND e.is_draft=0';
229
-        }
227
+		if ( ! $args['is_draft'] ) {
228
+			$query[] = 'AND e.is_draft=0';
229
+		}
230 230
 
231
-        if ( $args['value'] ) {
232
-            $query[] = $wpdb->prepare(' AND meta_value=%s', $args['value']);
233
-        }
234
-        $query[] = $order . $limit;
235
-    }
231
+		if ( $args['value'] ) {
232
+			$query[] = $wpdb->prepare(' AND meta_value=%s', $args['value']);
233
+		}
234
+		$query[] = $order . $limit;
235
+	}
236 236
 
237 237
 	public static function get_entry_meta_info( $entry_id ) {
238 238
 		return FrmDb::get_results( 'frm_item_metas', array( 'item_id' => $entry_id ) );
239
-    }
239
+	}
240 240
 
241 241
 	public static function getAll( $where = array(), $order_by = '', $limit = '', $stripslashes = false ) {
242
-        global $wpdb;
243
-        $query = 'SELECT it.*, fi.type as field_type, fi.field_key as field_key,
242
+		global $wpdb;
243
+		$query = 'SELECT it.*, fi.type as field_type, fi.field_key as field_key,
244 244
             fi.required as required, fi.form_id as field_form_id, fi.name as field_name, fi.options as fi_options
245 245
 			FROM ' . $wpdb->prefix . 'frm_item_metas it LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_fields fi ON it.field_id=fi.id' .
246
-            FrmAppHelper::prepend_and_or_where(' WHERE ', $where) . $order_by . $limit;
246
+			FrmAppHelper::prepend_and_or_where(' WHERE ', $where) . $order_by . $limit;
247 247
 
248 248
 		$cache_key = 'all_' . maybe_serialize( $where ) . $order_by . $limit;
249
-        $results = FrmAppHelper::check_cache($cache_key, 'frm_entry', $query, ($limit == ' LIMIT 1' ? 'get_row' : 'get_results'));
249
+		$results = FrmAppHelper::check_cache($cache_key, 'frm_entry', $query, ($limit == ' LIMIT 1' ? 'get_row' : 'get_results'));
250 250
 
251
-        if ( ! $results || ! $stripslashes ) {
252
-            return $results;
253
-        }
251
+		if ( ! $results || ! $stripslashes ) {
252
+			return $results;
253
+		}
254 254
 
255
-        foreach ( $results as $k => $result ) {
255
+		foreach ( $results as $k => $result ) {
256 256
 			$results[ $k ]->meta_value = stripslashes_deep( maybe_unserialize( $result->meta_value ) );
257
-            unset($k, $result);
258
-        }
257
+			unset($k, $result);
258
+		}
259 259
 
260
-        return $results;
261
-    }
260
+		return $results;
261
+	}
262 262
 
263
-    public static function getEntryIds( $where = array(), $order_by = '', $limit = '', $unique = true, $args = array() ) {
263
+	public static function getEntryIds( $where = array(), $order_by = '', $limit = '', $unique = true, $args = array() ) {
264 264
 		$defaults = array(
265 265
 			'is_draft' => false,
266 266
 			'user_id'  => '',
267 267
 			'group_by' => '',
268 268
 		);
269
-        $args = wp_parse_args($args, $defaults);
269
+		$args = wp_parse_args($args, $defaults);
270 270
 
271
-        $query = array();
272
-        self::get_ids_query($where, $order_by, $limit, $unique, $args, $query );
273
-        $query = implode(' ', $query);
271
+		$query = array();
272
+		self::get_ids_query($where, $order_by, $limit, $unique, $args, $query );
273
+		$query = implode(' ', $query);
274 274
 
275 275
 		$cache_key = 'ids_' . maybe_serialize( $where ) . $order_by . 'l' . $limit . 'u' . $unique . maybe_serialize( $args );
276
-        $results = FrmAppHelper::check_cache($cache_key, 'frm_entry', $query, ($limit == ' LIMIT 1' ? 'get_var' : 'get_col'));
276
+		$results = FrmAppHelper::check_cache($cache_key, 'frm_entry', $query, ($limit == ' LIMIT 1' ? 'get_var' : 'get_col'));
277 277
 
278
-        return $results;
279
-    }
278
+		return $results;
279
+	}
280 280
 
281
-    /**
282
-     * @param string|array $where
283
-     * @param string $order_by
284
-     * @param string $limit
285
-     */
281
+	/**
282
+	 * @param string|array $where
283
+	 * @param string $order_by
284
+	 * @param string $limit
285
+	 */
286 286
 	private static function get_ids_query( $where, $order_by, $limit, $unique, $args, array &$query ) {
287
-        global $wpdb;
288
-        $query[] = 'SELECT';
287
+		global $wpdb;
288
+		$query[] = 'SELECT';
289 289
 
290 290
 		$defaults = array( 'return_parent_id' => false );
291 291
 		$args = array_merge( $defaults, $args );
@@ -299,88 +299,88 @@  discard block
 block discarded – undo
299 299
 		$query[] = 'FROM ' . $wpdb->prefix . 'frm_item_metas it LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_fields fi ON it.field_id=fi.id';
300 300
 
301 301
 		$query[] = 'INNER JOIN ' . $wpdb->prefix . 'frm_items e ON (e.id=it.item_id)';
302
-        if ( is_array($where) ) {
303
-            if ( ! $args['is_draft'] ) {
304
-                $where['e.is_draft'] = 0;
305
-            } else if ( $args['is_draft'] == 1 ) {
306
-                $where['e.is_draft'] = 1;
307
-            }
308
-
309
-            if ( ! empty($args['user_id']) ) {
310
-                $where['e.user_id'] = $args['user_id'];
311
-            }
312
-            $query[] = FrmAppHelper::prepend_and_or_where(' WHERE ', $where) . $order_by . $limit;
302
+		if ( is_array($where) ) {
303
+			if ( ! $args['is_draft'] ) {
304
+				$where['e.is_draft'] = 0;
305
+			} else if ( $args['is_draft'] == 1 ) {
306
+				$where['e.is_draft'] = 1;
307
+			}
308
+
309
+			if ( ! empty($args['user_id']) ) {
310
+				$where['e.user_id'] = $args['user_id'];
311
+			}
312
+			$query[] = FrmAppHelper::prepend_and_or_where(' WHERE ', $where) . $order_by . $limit;
313 313
 
314 314
 			if ( $args['group_by'] ) {
315 315
 				$query[] = ' GROUP BY ' . sanitize_text_field( $args['group_by'] );
316 316
 			}
317
-            return;
318
-        }
317
+			return;
318
+		}
319 319
 
320 320
 		$draft_where = $user_where = '';
321
-        if ( ! $args['is_draft'] ) {
321
+		if ( ! $args['is_draft'] ) {
322 322
 			$draft_where = $wpdb->prepare( ' AND e.is_draft=%d', 0 );
323
-        } else if ( $args['is_draft'] == 1 ) {
323
+		} else if ( $args['is_draft'] == 1 ) {
324 324
 			$draft_where = $wpdb->prepare( ' AND e.is_draft=%d', 1 );
325
-        }
325
+		}
326 326
 
327
-        if ( ! empty($args['user_id']) ) {
328
-            $user_where = $wpdb->prepare(' AND e.user_id=%d', $args['user_id']);
329
-        }
327
+		if ( ! empty($args['user_id']) ) {
328
+			$user_where = $wpdb->prepare(' AND e.user_id=%d', $args['user_id']);
329
+		}
330 330
 
331
-        if ( strpos($where, ' GROUP BY ') ) {
332
-            // don't inject WHERE filtering after GROUP BY
333
-            $parts = explode(' GROUP BY ', $where);
334
-            $where = $parts[0];
335
-            $where .= $draft_where . $user_where;
331
+		if ( strpos($where, ' GROUP BY ') ) {
332
+			// don't inject WHERE filtering after GROUP BY
333
+			$parts = explode(' GROUP BY ', $where);
334
+			$where = $parts[0];
335
+			$where .= $draft_where . $user_where;
336 336
 			$where .= ' GROUP BY ' . $parts[1];
337
-        } else {
338
-            $where .= $draft_where . $user_where;
339
-        }
337
+		} else {
338
+			$where .= $draft_where . $user_where;
339
+		}
340 340
 
341 341
 		// The query has already been prepared
342 342
 		$query[] = FrmAppHelper::prepend_and_or_where(' WHERE ', $where) . $order_by . $limit;
343
-    }
343
+	}
344 344
 
345
-    public static function search_entry_metas( $search, $field_id = '', $operator ) {
345
+	public static function search_entry_metas( $search, $field_id = '', $operator ) {
346 346
 		$cache_key = 'search_' . maybe_serialize( $search ) . $field_id . $operator;
347
-        $results = wp_cache_get($cache_key, 'frm_entry');
348
-        if ( false !== $results ) {
349
-            return $results;
350
-        }
347
+		$results = wp_cache_get($cache_key, 'frm_entry');
348
+		if ( false !== $results ) {
349
+			return $results;
350
+		}
351 351
 
352
-        global $wpdb;
352
+		global $wpdb;
353 353
 		if ( is_array( $search ) ) {
354
-            $where = '';
354
+			$where = '';
355 355
 			foreach ( $search as $field => $value ) {
356 356
 				if ( $value <= 0 || ! in_array( $field, array( 'year', 'month', 'day' ) ) ) {
357
-                    continue;
358
-                }
357
+					continue;
358
+				}
359 359
 
360
-                switch ( $field ) {
361
-                    case 'year':
360
+				switch ( $field ) {
361
+					case 'year':
362 362
 						$value = '%' . $value;
363
-                    break;
364
-                    case 'month':
365
-                        $value .= '%';
366
-                    break;
367
-                    case 'day':
363
+					break;
364
+					case 'month':
365
+						$value .= '%';
366
+					break;
367
+					case 'day':
368 368
 						$value = '%' . $value . '%';
369
-                }
369
+				}
370 370
 				$where .= $wpdb->prepare(' meta_value ' . $operator . ' %s and', $value );
371
-            }
372
-            $where .= $wpdb->prepare(' field_id=%d', $field_id);
371
+			}
372
+			$where .= $wpdb->prepare(' field_id=%d', $field_id);
373 373
 			$query = 'SELECT DISTINCT item_id FROM ' . $wpdb->prefix . 'frm_item_metas' . FrmAppHelper::prepend_and_or_where( ' WHERE ', $where );
374
-        } else {
374
+		} else {
375 375
 			if ( $operator == 'LIKE' ) {
376
-                $search = '%' . $search . '%';
376
+				$search = '%' . $search . '%';
377 377
 			}
378
-            $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);
379
-        }
378
+			$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);
379
+		}
380 380
 
381
-        $results = $wpdb->get_col($query, 0);
381
+		$results = $wpdb->get_col($query, 0);
382 382
 		FrmAppHelper::set_cache( $cache_key, $results, 'frm_entry' );
383 383
 
384
-        return $results;
385
-    }
384
+		return $results;
385
+	}
386 386
 }
Please login to merge, or discard this patch.
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined('ABSPATH') ) {
2
+if ( ! defined( 'ABSPATH' ) ) {
3 3
 	die( 'You are not allowed to call this page directly.' );
4 4
 }
5 5
 
@@ -20,10 +20,10 @@  discard block
 block discarded – undo
20 20
 			'meta_value'    => is_array( $meta_value ) ? serialize( array_filter( $meta_value, 'FrmAppHelper::is_not_empty_value' ) ) : trim( $meta_value ),
21 21
             'item_id'       => $entry_id,
22 22
             'field_id'      => $field_id,
23
-            'created_at'    => current_time('mysql', 1),
23
+            'created_at'    => current_time( 'mysql', 1 ),
24 24
         );
25 25
 
26
-        $new_values = apply_filters('frm_add_entry_meta', $new_values);
26
+        $new_values = apply_filters( 'frm_add_entry_meta', $new_values );
27 27
 
28 28
 		$query_results = $wpdb->insert( $wpdb->prefix . 'frm_item_metas', $new_values );
29 29
 
@@ -49,13 +49,13 @@  discard block
 block discarded – undo
49 49
 
50 50
         $values = $where_values = array( 'item_id' => $entry_id, 'field_id' => $field_id );
51 51
         $values['meta_value'] = $meta_value;
52
-        $values = apply_filters('frm_update_entry_meta', $values);
53
-		if ( is_array($values['meta_value']) ) {
52
+        $values = apply_filters( 'frm_update_entry_meta', $values );
53
+		if ( is_array( $values['meta_value'] ) ) {
54 54
 			$values['meta_value'] = array_filter( $values['meta_value'], 'FrmAppHelper::is_not_empty_value' );
55 55
 		}
56
-        $meta_value = maybe_serialize($values['meta_value']);
56
+        $meta_value = maybe_serialize( $values['meta_value'] );
57 57
 
58
-        wp_cache_delete( $entry_id, 'frm_entry');
58
+        wp_cache_delete( $entry_id, 'frm_entry' );
59 59
 		self::clear_cache();
60 60
 
61 61
 		return $wpdb->update( $wpdb->prefix . 'frm_item_metas', array( 'meta_value' => $meta_value ), $where_values );
@@ -70,11 +70,11 @@  discard block
 block discarded – undo
70 70
             // set the value for the file upload field and add new tags (in Pro version)
71 71
 			$meta_value = apply_filters( 'frm_prepare_data_before_db', $meta_value, $field_id, $entry_id );
72 72
 
73
-			if ( $prev_values && in_array($field_id, $prev_values) ) {
73
+			if ( $prev_values && in_array( $field_id, $prev_values ) ) {
74 74
 
75 75
 				if ( ( is_array( $meta_value ) && empty( $meta_value ) ) || ( ! is_array( $meta_value ) && trim( $meta_value ) == '' ) ) {
76 76
 					// remove blank fields
77
-					unset( $values[ $field_id ] );
77
+					unset( $values[$field_id] );
78 78
 				} else {
79 79
 					// if value exists, then update it
80 80
 					self::update_entry_meta( $entry_id, $field_id, '', $meta_value );
@@ -85,13 +85,13 @@  discard block
 block discarded – undo
85 85
 			}
86 86
 		}
87 87
 
88
-        if ( empty($prev_values) ) {
88
+        if ( empty( $prev_values ) ) {
89 89
             return;
90 90
         }
91 91
 
92
-        $prev_values = array_diff($prev_values, array_keys($values));
92
+        $prev_values = array_diff( $prev_values, array_keys( $values ) );
93 93
 
94
-        if ( empty($prev_values) ) {
94
+        if ( empty( $prev_values ) ) {
95 95
             return;
96 96
         }
97 97
 
@@ -105,10 +105,10 @@  discard block
 block discarded – undo
105 105
     }
106 106
 
107 107
 	public static function duplicate_entry_metas( $old_id, $new_id ) {
108
-        $metas = self::get_entry_meta_info($old_id);
108
+        $metas = self::get_entry_meta_info( $old_id );
109 109
         foreach ( $metas as $meta ) {
110
-            self::add_entry_meta($new_id, $meta->field_id, null, $meta->meta_value);
111
-            unset($meta);
110
+            self::add_entry_meta( $new_id, $meta->field_id, null, $meta->meta_value );
111
+            unset( $meta );
112 112
         }
113 113
 		self::clear_cache();
114 114
     }
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	public static function delete_entry_meta( $entry_id, $field_id ) {
117 117
         global $wpdb;
118 118
 		self::clear_cache();
119
-        return $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->prefix}frm_item_metas WHERE field_id=%d AND item_id=%d", $field_id, $entry_id));
119
+        return $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}frm_item_metas WHERE field_id=%d AND item_id=%d", $field_id, $entry_id ) );
120 120
     }
121 121
 
122 122
 	/**
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	 */
136 136
 	public static function get_meta_value( $entry, $field_id ) {
137 137
 		if ( isset( $entry->metas ) ) {
138
-			return isset( $entry->metas[ $field_id ] ) ? $entry->metas[ $field_id ] : false;
138
+			return isset( $entry->metas[$field_id] ) ? $entry->metas[$field_id] : false;
139 139
 		} else {
140 140
 			return self::get_entry_meta_by_field( $entry->id, $field_id );
141 141
 		}
@@ -153,14 +153,14 @@  discard block
 block discarded – undo
153 153
 			$cached = FrmAppHelper::check_cache( $entry_id, 'frm_entry' );
154 154
 		}
155 155
 
156
-		if ( $cached && isset( $cached->metas ) && isset( $cached->metas[ $field_id ] ) ) {
157
-			$result = $cached->metas[ $field_id ];
158
-            return stripslashes_deep($result);
156
+		if ( $cached && isset( $cached->metas ) && isset( $cached->metas[$field_id] ) ) {
157
+			$result = $cached->metas[$field_id];
158
+            return stripslashes_deep( $result );
159 159
         }
160 160
 
161 161
 		$get_table = $wpdb->prefix . 'frm_item_metas';
162 162
 		$query = array( 'item_id' => $entry_id );
163
-        if ( is_numeric($field_id) ) {
163
+        if ( is_numeric( $field_id ) ) {
164 164
 			$query['field_id'] = $field_id;
165 165
         } else {
166 166
 			$get_table .= ' it LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_fields fi ON it.field_id=fi.id';
@@ -168,14 +168,14 @@  discard block
 block discarded – undo
168 168
         }
169 169
 
170 170
 		$result = FrmDb::get_var( $get_table, $query, 'meta_value' );
171
-        $result = maybe_unserialize($result);
172
-        $result = stripslashes_deep($result);
171
+        $result = maybe_unserialize( $result );
172
+        $result = stripslashes_deep( $result );
173 173
 
174 174
         return $result;
175 175
     }
176 176
 
177 177
 	public static function get_entry_metas( $entry_id ) {
178
-        _deprecated_function( __FUNCTION__, '1.07.10');
178
+        _deprecated_function( __FUNCTION__, '1.07.10' );
179 179
 
180 180
         global $wpdb;
181 181
 		return FrmDb::get_col( $wpdb->prefix . 'frm_item_metas', array( 'item_id' => $entry_id ), 'meta_value' );
@@ -186,22 +186,22 @@  discard block
 block discarded – undo
186 186
         $args = wp_parse_args( $args, $defaults );
187 187
 
188 188
         $query = array();
189
-        self::meta_field_query($field_id, $order, $limit, $args, $query);
190
-        $query = implode(' ', $query);
189
+        self::meta_field_query( $field_id, $order, $limit, $args, $query );
190
+        $query = implode( ' ', $query );
191 191
 
192 192
 		$cache_key = 'entry_metas_for_field_' . $field_id . $order . $limit . maybe_serialize( $args );
193
-        $values = FrmAppHelper::check_cache($cache_key, 'frm_entry', $query, 'get_col');
193
+        $values = FrmAppHelper::check_cache( $cache_key, 'frm_entry', $query, 'get_col' );
194 194
 
195 195
         if ( ! $args['stripslashes'] ) {
196 196
             return $values;
197 197
         }
198 198
 
199 199
 		foreach ( $values as $k => $v ) {
200
-			$values[ $k ] = maybe_unserialize( $v );
201
-            unset($k, $v);
200
+			$values[$k] = maybe_unserialize( $v );
201
+            unset( $k, $v );
202 202
         }
203 203
 
204
-        return stripslashes_deep($values);
204
+        return stripslashes_deep( $values );
205 205
     }
206 206
 
207 207
     /**
@@ -218,8 +218,8 @@  discard block
 block discarded – undo
218 218
 			$query[] = 'INNER JOIN ' . $wpdb->prefix . 'frm_items e ON (e.id=em.item_id)';
219 219
         }
220 220
 
221
-        if ( is_numeric($field_id) ) {
222
-            $query[] = $wpdb->prepare('WHERE em.field_id=%d', $field_id);
221
+        if ( is_numeric( $field_id ) ) {
222
+            $query[] = $wpdb->prepare( 'WHERE em.field_id=%d', $field_id );
223 223
         } else {
224 224
 			$query[] = $wpdb->prepare( 'LEFT JOIN ' . $wpdb->prefix . 'frm_fields fi ON (em.field_id = fi.id) WHERE fi.field_key=%s', $field_id );
225 225
         }
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
         }
230 230
 
231 231
         if ( $args['value'] ) {
232
-            $query[] = $wpdb->prepare(' AND meta_value=%s', $args['value']);
232
+            $query[] = $wpdb->prepare( ' AND meta_value=%s', $args['value'] );
233 233
         }
234 234
         $query[] = $order . $limit;
235 235
     }
@@ -243,18 +243,18 @@  discard block
 block discarded – undo
243 243
         $query = 'SELECT it.*, fi.type as field_type, fi.field_key as field_key,
244 244
             fi.required as required, fi.form_id as field_form_id, fi.name as field_name, fi.options as fi_options
245 245
 			FROM ' . $wpdb->prefix . 'frm_item_metas it LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_fields fi ON it.field_id=fi.id' .
246
-            FrmAppHelper::prepend_and_or_where(' WHERE ', $where) . $order_by . $limit;
246
+            FrmAppHelper::prepend_and_or_where( ' WHERE ', $where ) . $order_by . $limit;
247 247
 
248 248
 		$cache_key = 'all_' . maybe_serialize( $where ) . $order_by . $limit;
249
-        $results = FrmAppHelper::check_cache($cache_key, 'frm_entry', $query, ($limit == ' LIMIT 1' ? 'get_row' : 'get_results'));
249
+        $results = FrmAppHelper::check_cache( $cache_key, 'frm_entry', $query, ( $limit == ' LIMIT 1' ? 'get_row' : 'get_results' ) );
250 250
 
251 251
         if ( ! $results || ! $stripslashes ) {
252 252
             return $results;
253 253
         }
254 254
 
255 255
         foreach ( $results as $k => $result ) {
256
-			$results[ $k ]->meta_value = stripslashes_deep( maybe_unserialize( $result->meta_value ) );
257
-            unset($k, $result);
256
+			$results[$k]->meta_value = stripslashes_deep( maybe_unserialize( $result->meta_value ) );
257
+            unset( $k, $result );
258 258
         }
259 259
 
260 260
         return $results;
@@ -266,14 +266,14 @@  discard block
 block discarded – undo
266 266
 			'user_id'  => '',
267 267
 			'group_by' => '',
268 268
 		);
269
-        $args = wp_parse_args($args, $defaults);
269
+        $args = wp_parse_args( $args, $defaults );
270 270
 
271 271
         $query = array();
272
-        self::get_ids_query($where, $order_by, $limit, $unique, $args, $query );
273
-        $query = implode(' ', $query);
272
+        self::get_ids_query( $where, $order_by, $limit, $unique, $args, $query );
273
+        $query = implode( ' ', $query );
274 274
 
275 275
 		$cache_key = 'ids_' . maybe_serialize( $where ) . $order_by . 'l' . $limit . 'u' . $unique . maybe_serialize( $args );
276
-        $results = FrmAppHelper::check_cache($cache_key, 'frm_entry', $query, ($limit == ' LIMIT 1' ? 'get_var' : 'get_col'));
276
+        $results = FrmAppHelper::check_cache( $cache_key, 'frm_entry', $query, ( $limit == ' LIMIT 1' ? 'get_var' : 'get_col' ) );
277 277
 
278 278
         return $results;
279 279
     }
@@ -299,17 +299,17 @@  discard block
 block discarded – undo
299 299
 		$query[] = 'FROM ' . $wpdb->prefix . 'frm_item_metas it LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_fields fi ON it.field_id=fi.id';
300 300
 
301 301
 		$query[] = 'INNER JOIN ' . $wpdb->prefix . 'frm_items e ON (e.id=it.item_id)';
302
-        if ( is_array($where) ) {
302
+        if ( is_array( $where ) ) {
303 303
             if ( ! $args['is_draft'] ) {
304 304
                 $where['e.is_draft'] = 0;
305 305
             } else if ( $args['is_draft'] == 1 ) {
306 306
                 $where['e.is_draft'] = 1;
307 307
             }
308 308
 
309
-            if ( ! empty($args['user_id']) ) {
309
+            if ( ! empty( $args['user_id'] ) ) {
310 310
                 $where['e.user_id'] = $args['user_id'];
311 311
             }
312
-            $query[] = FrmAppHelper::prepend_and_or_where(' WHERE ', $where) . $order_by . $limit;
312
+            $query[] = FrmAppHelper::prepend_and_or_where( ' WHERE ', $where ) . $order_by . $limit;
313 313
 
314 314
 			if ( $args['group_by'] ) {
315 315
 				$query[] = ' GROUP BY ' . sanitize_text_field( $args['group_by'] );
@@ -324,13 +324,13 @@  discard block
 block discarded – undo
324 324
 			$draft_where = $wpdb->prepare( ' AND e.is_draft=%d', 1 );
325 325
         }
326 326
 
327
-        if ( ! empty($args['user_id']) ) {
328
-            $user_where = $wpdb->prepare(' AND e.user_id=%d', $args['user_id']);
327
+        if ( ! empty( $args['user_id'] ) ) {
328
+            $user_where = $wpdb->prepare( ' AND e.user_id=%d', $args['user_id'] );
329 329
         }
330 330
 
331
-        if ( strpos($where, ' GROUP BY ') ) {
331
+        if ( strpos( $where, ' GROUP BY ' ) ) {
332 332
             // don't inject WHERE filtering after GROUP BY
333
-            $parts = explode(' GROUP BY ', $where);
333
+            $parts = explode( ' GROUP BY ', $where );
334 334
             $where = $parts[0];
335 335
             $where .= $draft_where . $user_where;
336 336
 			$where .= ' GROUP BY ' . $parts[1];
@@ -339,12 +339,12 @@  discard block
 block discarded – undo
339 339
         }
340 340
 
341 341
 		// The query has already been prepared
342
-		$query[] = FrmAppHelper::prepend_and_or_where(' WHERE ', $where) . $order_by . $limit;
342
+		$query[] = FrmAppHelper::prepend_and_or_where( ' WHERE ', $where ) . $order_by . $limit;
343 343
     }
344 344
 
345 345
     public static function search_entry_metas( $search, $field_id = '', $operator ) {
346 346
 		$cache_key = 'search_' . maybe_serialize( $search ) . $field_id . $operator;
347
-        $results = wp_cache_get($cache_key, 'frm_entry');
347
+        $results = wp_cache_get( $cache_key, 'frm_entry' );
348 348
         if ( false !== $results ) {
349 349
             return $results;
350 350
         }
@@ -367,18 +367,18 @@  discard block
 block discarded – undo
367 367
                     case 'day':
368 368
 						$value = '%' . $value . '%';
369 369
                 }
370
-				$where .= $wpdb->prepare(' meta_value ' . $operator . ' %s and', $value );
370
+				$where .= $wpdb->prepare( ' meta_value ' . $operator . ' %s and', $value );
371 371
             }
372
-            $where .= $wpdb->prepare(' field_id=%d', $field_id);
372
+            $where .= $wpdb->prepare( ' field_id=%d', $field_id );
373 373
 			$query = 'SELECT DISTINCT item_id FROM ' . $wpdb->prefix . 'frm_item_metas' . FrmAppHelper::prepend_and_or_where( ' WHERE ', $where );
374 374
         } else {
375 375
 			if ( $operator == 'LIKE' ) {
376 376
                 $search = '%' . $search . '%';
377 377
 			}
378
-            $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);
378
+            $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 );
379 379
         }
380 380
 
381
-        $results = $wpdb->get_col($query, 0);
381
+        $results = $wpdb->get_col( $query, 0 );
382 382
 		FrmAppHelper::set_cache( $cache_key, $results, 'frm_entry' );
383 383
 
384 384
         return $results;
Please login to merge, or discard this patch.
classes/controllers/FrmHooksController.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -143,8 +143,8 @@
 block discarded – undo
143 143
         add_action( 'wp_ajax_frm_deauthorize', 'FrmAppController::deauthorize' );
144 144
 
145 145
 		// Addons Controller
146
-		add_action('wp_ajax_frm_addon_activate', 'FrmAddon::activate' );
147
-		add_action('wp_ajax_frm_addon_deactivate', 'FrmAddon::deactivate' );
146
+		add_action( 'wp_ajax_frm_addon_activate', 'FrmAddon::activate' );
147
+		add_action( 'wp_ajax_frm_addon_deactivate', 'FrmAddon::deactivate' );
148 148
 
149 149
         // Fields Controller
150 150
         add_action( 'wp_ajax_frm_load_field', 'FrmFieldsController::load_field' );
Please login to merge, or discard this patch.
Indentation   +144 added lines, -144 removed lines patch added patch discarded remove patch
@@ -1,91 +1,91 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 class FrmHooksController {
4
-    /**
5
-     * Trigger plugin-wide hook loading
6
-     */
7
-    public static function trigger_load_hook( $hooks = 'load_hooks' ) {
8
-        $controllers = apply_filters( 'frm_load_controllers', array( 'FrmHooksController' ) );
9
-
10
-        $trigger_hooks = $hooks;
11
-        $hooks = (array) $hooks;
12
-
13
-        if ( 'load_hooks' == $trigger_hooks ) {
14
-            if ( is_admin() ) {
15
-                $hooks[] = 'load_admin_hooks';
16
-                if ( defined( 'DOING_AJAX' ) ) {
17
-                    $hooks[] = 'load_ajax_hooks';
18
-                    $hooks[] = 'load_form_hooks';
19
-                }
20
-            }
21
-
22
-            if ( is_multisite() ) {
23
-                $hooks[] = 'load_multisite_hooks';
24
-            }
25
-        } else {
26
-            // Make sure the hooks are only triggered once
27
-            add_filter( 'frm' . str_replace( 'load', '', $trigger_hooks ) . '_loaded', '__return_true' );
28
-        }
29
-        unset( $trigger_hooks );
30
-
31
-        // Instansiate Controllers
32
-        foreach ( $controllers as $c ) {
33
-            foreach ( $hooks as $hook ) {
4
+	/**
5
+	 * Trigger plugin-wide hook loading
6
+	 */
7
+	public static function trigger_load_hook( $hooks = 'load_hooks' ) {
8
+		$controllers = apply_filters( 'frm_load_controllers', array( 'FrmHooksController' ) );
9
+
10
+		$trigger_hooks = $hooks;
11
+		$hooks = (array) $hooks;
12
+
13
+		if ( 'load_hooks' == $trigger_hooks ) {
14
+			if ( is_admin() ) {
15
+				$hooks[] = 'load_admin_hooks';
16
+				if ( defined( 'DOING_AJAX' ) ) {
17
+					$hooks[] = 'load_ajax_hooks';
18
+					$hooks[] = 'load_form_hooks';
19
+				}
20
+			}
21
+
22
+			if ( is_multisite() ) {
23
+				$hooks[] = 'load_multisite_hooks';
24
+			}
25
+		} else {
26
+			// Make sure the hooks are only triggered once
27
+			add_filter( 'frm' . str_replace( 'load', '', $trigger_hooks ) . '_loaded', '__return_true' );
28
+		}
29
+		unset( $trigger_hooks );
30
+
31
+		// Instansiate Controllers
32
+		foreach ( $controllers as $c ) {
33
+			foreach ( $hooks as $hook ) {
34 34
 				call_user_func( array( $c, $hook ) );
35 35
 				unset( $hook );
36
-            }
36
+			}
37 37
 			unset( $c );
38
-        }
38
+		}
39 39
 
40
-    }
40
+	}
41 41
 
42
-    public static function trigger_load_form_hooks() {
43
-        self::trigger_load_hook( 'load_form_hooks' );
44
-    }
42
+	public static function trigger_load_form_hooks() {
43
+		self::trigger_load_hook( 'load_form_hooks' );
44
+	}
45 45
 
46 46
 	public static function load_hooks() {
47
-        if ( ! is_admin() ) {
48
-            add_filter( 'the_content', 'FrmAppController::page_route', 10 );
49
-        }
50
-
51
-        add_action( 'plugins_loaded', 'FrmAppController::load_lang' );
52
-        add_filter( 'widget_text', 'FrmAppController::widget_text_filter', 8 );
53
-
54
-        // Entries controller
55
-        add_action( 'wp_loaded', 'FrmEntriesController::process_entry', 10, 0 );
56
-        add_filter( 'frm_redirect_url', 'FrmEntriesController::delete_entry_before_redirect', 50, 3 );
57
-        add_action( 'frm_after_entry_processed', 'FrmEntriesController::delete_entry_after_save', 100 );
58
-        add_filter( 'frm_email_value', 'FrmEntriesController::filter_email_value', 10, 3 );
59
-        add_filter( 'frmpro_fields_replace_shortcodes', 'FrmEntriesController::filter_shortcode_value', 10, 4 );
60
-
61
-        // Form Actions Controller
62
-        add_action( 'init', 'FrmFormActionsController::register_post_types', 1 );
47
+		if ( ! is_admin() ) {
48
+			add_filter( 'the_content', 'FrmAppController::page_route', 10 );
49
+		}
50
+
51
+		add_action( 'plugins_loaded', 'FrmAppController::load_lang' );
52
+		add_filter( 'widget_text', 'FrmAppController::widget_text_filter', 8 );
53
+
54
+		// Entries controller
55
+		add_action( 'wp_loaded', 'FrmEntriesController::process_entry', 10, 0 );
56
+		add_filter( 'frm_redirect_url', 'FrmEntriesController::delete_entry_before_redirect', 50, 3 );
57
+		add_action( 'frm_after_entry_processed', 'FrmEntriesController::delete_entry_after_save', 100 );
58
+		add_filter( 'frm_email_value', 'FrmEntriesController::filter_email_value', 10, 3 );
59
+		add_filter( 'frmpro_fields_replace_shortcodes', 'FrmEntriesController::filter_shortcode_value', 10, 4 );
60
+
61
+		// Form Actions Controller
62
+		add_action( 'init', 'FrmFormActionsController::register_post_types', 1 );
63 63
 		add_action( 'frm_after_create_entry', 'FrmFormActionsController::trigger_create_actions', 20, 3 );
64 64
 
65
-        // Forms Controller
66
-        add_action( 'widgets_init', 'FrmFormsController::register_widgets' );
65
+		// Forms Controller
66
+		add_action( 'widgets_init', 'FrmFormsController::register_widgets' );
67 67
 		add_action( 'init', 'FrmFormsController::front_head' );
68
-        add_filter( 'frm_content', 'FrmFormsController::filter_content', 10, 3 );
69
-        add_filter( 'frm_replace_content_shortcodes', 'FrmFormsController::replace_content_shortcodes', 20, 3 );
70
-        add_action( 'admin_bar_init', 'FrmFormsController::admin_bar_css' );
68
+		add_filter( 'frm_content', 'FrmFormsController::filter_content', 10, 3 );
69
+		add_filter( 'frm_replace_content_shortcodes', 'FrmFormsController::replace_content_shortcodes', 20, 3 );
70
+		add_action( 'admin_bar_init', 'FrmFormsController::admin_bar_css' );
71 71
 		add_action( 'wp_footer', 'FrmFormsController::footer_js', 1, 0 );
72 72
 
73 73
 		add_action( 'wp_scheduled_delete', 'FrmForm::scheduled_delete' );
74 74
 
75
-        // Form Shortcodes
76
-        add_shortcode( 'formidable', 'FrmFormsController::get_form_shortcode' );
75
+		// Form Shortcodes
76
+		add_shortcode( 'formidable', 'FrmFormsController::get_form_shortcode' );
77 77
 
78
-        // Styles Controller
79
-        add_action( 'init', 'FrmStylesController::register_post_types', 0 );
80
-        add_filter( 'frm_get_style_opts', 'FrmStylesController::get_style_opts' );
81
-        add_filter( 'frm_add_form_style_class', 'FrmStylesController::get_form_style_class', 10, 2 );
82
-        add_filter( 'frm_show_entry_styles', 'FrmStylesController::show_entry_styles' );
83
-    }
78
+		// Styles Controller
79
+		add_action( 'init', 'FrmStylesController::register_post_types', 0 );
80
+		add_filter( 'frm_get_style_opts', 'FrmStylesController::get_style_opts' );
81
+		add_filter( 'frm_add_form_style_class', 'FrmStylesController::get_form_style_class', 10, 2 );
82
+		add_filter( 'frm_show_entry_styles', 'FrmStylesController::show_entry_styles' );
83
+	}
84 84
 
85 85
 	public static function load_admin_hooks() {
86
-        add_action( 'admin_menu', 'FrmAppController::menu', 1 );
87
-        add_action( 'admin_enqueue_scripts', 'FrmAppController::load_wp_admin_style' );
88
-        add_action( 'admin_notices', 'FrmAppController::pro_get_started_headline' );
86
+		add_action( 'admin_menu', 'FrmAppController::menu', 1 );
87
+		add_action( 'admin_enqueue_scripts', 'FrmAppController::load_wp_admin_style' );
88
+		add_action( 'admin_notices', 'FrmAppController::pro_get_started_headline' );
89 89
 		add_action( 'admin_init', 'FrmAppController::admin_init', 11 );
90 90
 		add_filter( 'admin_body_class', 'FrmAppController::wp_admin_body_class' );
91 91
 		add_filter( 'plugin_action_links_' . FrmAppHelper::plugin_folder() . '/formidable.php', 'FrmAppController::settings_link' );
@@ -94,122 +94,122 @@  discard block
 block discarded – undo
94 94
 		// Addons Controller
95 95
 		add_action( 'admin_menu', 'FrmAddonsController::menu', 100 );
96 96
 
97
-        // Entries Controller
98
-        add_action( 'admin_menu', 'FrmEntriesController::menu', 12 );
99
-        add_filter( 'contextual_help', 'FrmEntriesController::contextual_help', 10, 3 );
100
-        add_filter( 'set-screen-option', 'FrmEntriesController::save_per_page', 10, 3 );
101
-        add_filter( 'update_user_metadata', 'FrmEntriesController::check_hidden_cols', 10, 5 );
102
-        add_action( 'updated_user_meta', 'FrmEntriesController::update_hidden_cols', 10, 4 );
97
+		// Entries Controller
98
+		add_action( 'admin_menu', 'FrmEntriesController::menu', 12 );
99
+		add_filter( 'contextual_help', 'FrmEntriesController::contextual_help', 10, 3 );
100
+		add_filter( 'set-screen-option', 'FrmEntriesController::save_per_page', 10, 3 );
101
+		add_filter( 'update_user_metadata', 'FrmEntriesController::check_hidden_cols', 10, 5 );
102
+		add_action( 'updated_user_meta', 'FrmEntriesController::update_hidden_cols', 10, 4 );
103 103
 
104
-        // Fields Controller
105
-        add_filter( 'frm_display_field_options', 'FrmFieldsController::display_field_options' );
104
+		// Fields Controller
105
+		add_filter( 'frm_display_field_options', 'FrmFieldsController::display_field_options' );
106 106
 
107
-        // Form Actions Controller
108
-        if ( FrmAppHelper::is_admin_page( 'formidable' ) ) {
109
-            add_action( 'frm_before_update_form_settings', 'FrmFormActionsController::update_settings' );
110
-        }
111
-        add_action( 'frm_after_duplicate_form', 'FrmFormActionsController::duplicate_form_actions', 20, 3 );
107
+		// Form Actions Controller
108
+		if ( FrmAppHelper::is_admin_page( 'formidable' ) ) {
109
+			add_action( 'frm_before_update_form_settings', 'FrmFormActionsController::update_settings' );
110
+		}
111
+		add_action( 'frm_after_duplicate_form', 'FrmFormActionsController::duplicate_form_actions', 20, 3 );
112 112
 
113
-        // Forms Controller
114
-        add_action( 'admin_menu', 'FrmFormsController::menu', 10 );
115
-        add_action( 'admin_head-toplevel_page_formidable', 'FrmFormsController::head' );
113
+		// Forms Controller
114
+		add_action( 'admin_menu', 'FrmFormsController::menu', 10 );
115
+		add_action( 'admin_head-toplevel_page_formidable', 'FrmFormsController::head' );
116 116
 
117
-        add_filter( 'set-screen-option', 'FrmFormsController::save_per_page', 10, 3 );
118
-        add_action( 'admin_footer', 'FrmFormsController::insert_form_popup' );
117
+		add_filter( 'set-screen-option', 'FrmFormsController::save_per_page', 10, 3 );
118
+		add_action( 'admin_footer', 'FrmFormsController::insert_form_popup' );
119 119
 		add_action( 'media_buttons', 'FrmFormsController::insert_form_button' );
120 120
 
121
-        // Forms Model
122
-        add_action( 'frm_after_duplicate_form', 'FrmForm::after_duplicate', 10, 2 );
121
+		// Forms Model
122
+		add_action( 'frm_after_duplicate_form', 'FrmForm::after_duplicate', 10, 2 );
123 123
 
124
-        // Settings Controller
125
-        add_action( 'admin_menu', 'FrmSettingsController::menu', 45 );
126
-        add_action( 'frm_before_settings', 'FrmSettingsController::license_box' );
124
+		// Settings Controller
125
+		add_action( 'admin_menu', 'FrmSettingsController::menu', 45 );
126
+		add_action( 'frm_before_settings', 'FrmSettingsController::license_box' );
127 127
 
128
-        // Styles Controller
129
-        add_action( 'admin_menu', 'FrmStylesController::menu', 14 );
130
-        add_action( 'admin_init', 'FrmStylesController::admin_init' );
128
+		// Styles Controller
129
+		add_action( 'admin_menu', 'FrmStylesController::menu', 14 );
130
+		add_action( 'admin_init', 'FrmStylesController::admin_init' );
131 131
 
132
-        // XML Controller
133
-        add_action( 'admin_menu', 'FrmXMLController::menu', 41 );
134
-    }
132
+		// XML Controller
133
+		add_action( 'admin_menu', 'FrmXMLController::menu', 41 );
134
+	}
135 135
 
136 136
 	public static function load_ajax_hooks() {
137 137
 		add_action( 'wp_ajax_frm_silent_upgrade', 'FrmAppController::ajax_install' );
138 138
 		add_action( 'wp_ajax_nopriv_frm_silent_upgrade', 'FrmAppController::ajax_install' );
139 139
 		add_action( 'wp_ajax_frm_install', 'FrmAppController::ajax_install' );
140
-        add_action( 'wp_ajax_frm_uninstall', 'FrmAppController::uninstall' );
141
-        add_action( 'wp_ajax_frm_deauthorize', 'FrmAppController::deauthorize' );
140
+		add_action( 'wp_ajax_frm_uninstall', 'FrmAppController::uninstall' );
141
+		add_action( 'wp_ajax_frm_deauthorize', 'FrmAppController::deauthorize' );
142 142
 
143 143
 		// Addons
144 144
 		add_action('wp_ajax_frm_addon_activate', 'FrmAddon::activate' );
145 145
 		add_action('wp_ajax_frm_addon_deactivate', 'FrmAddon::deactivate' );
146 146
 		add_action( 'wp_ajax_frm_fill_licenses', 'FrmAddonsController::get_licenses' );
147 147
 
148
-        // Fields Controller
149
-        add_action( 'wp_ajax_frm_load_field', 'FrmFieldsController::load_field' );
150
-        add_action( 'wp_ajax_frm_insert_field', 'FrmFieldsController::create' );
151
-        add_action( 'wp_ajax_frm_field_name_in_place_edit', 'FrmFieldsController::edit_name' );
152
-        add_action( 'wp_ajax_frm_update_ajax_option', 'FrmFieldsController::update_ajax_option' );
153
-        add_action( 'wp_ajax_frm_duplicate_field', 'FrmFieldsController::duplicate' );
154
-        add_action( 'wp_ajax_frm_delete_field', 'FrmFieldsController::destroy' );
155
-        add_action( 'wp_ajax_frm_add_field_option', 'FrmFieldsController::add_option' );
156
-        add_action( 'wp_ajax_frm_field_option_ipe', 'FrmFieldsController::edit_option' );
157
-        add_action( 'wp_ajax_frm_delete_field_option', 'FrmFieldsController::delete_option' );
158
-        add_action( 'wp_ajax_frm_import_choices', 'FrmFieldsController::import_choices' );
159
-        add_action( 'wp_ajax_frm_import_options', 'FrmFieldsController::import_options' );
160
-        add_action( 'wp_ajax_frm_update_field_order', 'FrmFieldsController::update_order' );
161
-
162
-        // Form Actions Controller
163
-        add_action( 'wp_ajax_frm_add_form_action', 'FrmFormActionsController::add_form_action' );
164
-        add_action( 'wp_ajax_frm_form_action_fill', 'FrmFormActionsController::fill_action' );
165
-
166
-        // Forms Controller
148
+		// Fields Controller
149
+		add_action( 'wp_ajax_frm_load_field', 'FrmFieldsController::load_field' );
150
+		add_action( 'wp_ajax_frm_insert_field', 'FrmFieldsController::create' );
151
+		add_action( 'wp_ajax_frm_field_name_in_place_edit', 'FrmFieldsController::edit_name' );
152
+		add_action( 'wp_ajax_frm_update_ajax_option', 'FrmFieldsController::update_ajax_option' );
153
+		add_action( 'wp_ajax_frm_duplicate_field', 'FrmFieldsController::duplicate' );
154
+		add_action( 'wp_ajax_frm_delete_field', 'FrmFieldsController::destroy' );
155
+		add_action( 'wp_ajax_frm_add_field_option', 'FrmFieldsController::add_option' );
156
+		add_action( 'wp_ajax_frm_field_option_ipe', 'FrmFieldsController::edit_option' );
157
+		add_action( 'wp_ajax_frm_delete_field_option', 'FrmFieldsController::delete_option' );
158
+		add_action( 'wp_ajax_frm_import_choices', 'FrmFieldsController::import_choices' );
159
+		add_action( 'wp_ajax_frm_import_options', 'FrmFieldsController::import_options' );
160
+		add_action( 'wp_ajax_frm_update_field_order', 'FrmFieldsController::update_order' );
161
+
162
+		// Form Actions Controller
163
+		add_action( 'wp_ajax_frm_add_form_action', 'FrmFormActionsController::add_form_action' );
164
+		add_action( 'wp_ajax_frm_form_action_fill', 'FrmFormActionsController::fill_action' );
165
+
166
+		// Forms Controller
167 167
 		add_action( 'wp_ajax_frm_create_from_template', 'FrmFormsController::_create_from_template' );
168 168
 		add_action( 'wp_ajax_frm_save_form', 'FrmFormsController::route' );
169 169
 		add_action( 'wp_ajax_frm_form_key_in_place_edit', 'FrmFormsController::edit_key' );
170 170
 		add_action( 'wp_ajax_frm_form_desc_in_place_edit', 'FrmFormsController::edit_description' );
171
-        add_action( 'wp_ajax_frm_get_default_html', 'FrmFormsController::get_email_html' );
172
-        add_action( 'wp_ajax_frm_get_shortcode_opts', 'FrmFormsController::get_shortcode_opts' );
173
-        add_action( 'wp_ajax_frm_forms_preview', 'FrmFormsController::preview' );
174
-        add_action( 'wp_ajax_nopriv_frm_forms_preview', 'FrmFormsController::preview' );
175
-
176
-        // Styles Controller
177
-        add_action( 'wp_ajax_frm_settings_reset', 'FrmStylesController::reset_styling' );
178
-        add_action( 'wp_ajax_frm_change_styling', 'FrmStylesController::change_styling' );
179
-        add_action( 'wp_ajax_frmpro_load_css', 'FrmStylesController::load_css' );
180
-        add_action( 'wp_ajax_nopriv_frmpro_load_css', 'FrmStylesController::load_css' );
171
+		add_action( 'wp_ajax_frm_get_default_html', 'FrmFormsController::get_email_html' );
172
+		add_action( 'wp_ajax_frm_get_shortcode_opts', 'FrmFormsController::get_shortcode_opts' );
173
+		add_action( 'wp_ajax_frm_forms_preview', 'FrmFormsController::preview' );
174
+		add_action( 'wp_ajax_nopriv_frm_forms_preview', 'FrmFormsController::preview' );
175
+
176
+		// Styles Controller
177
+		add_action( 'wp_ajax_frm_settings_reset', 'FrmStylesController::reset_styling' );
178
+		add_action( 'wp_ajax_frm_change_styling', 'FrmStylesController::change_styling' );
179
+		add_action( 'wp_ajax_frmpro_load_css', 'FrmStylesController::load_css' );
180
+		add_action( 'wp_ajax_nopriv_frmpro_load_css', 'FrmStylesController::load_css' );
181 181
 		add_action( 'wp_ajax_frmpro_css', 'FrmStylesController::load_saved_css' );
182 182
 		add_action( 'wp_ajax_nopriv_frmpro_css', 'FrmStylesController::load_saved_css' );
183 183
 
184
-        // XML Controller
184
+		// XML Controller
185 185
 		add_action( 'wp_ajax_frm_entries_csv', 'FrmXMLController::csv' );
186 186
 		add_action( 'wp_ajax_nopriv_frm_entries_csv', 'FrmXMLController::csv' );
187
-        add_action( 'wp_ajax_frm_export_xml', 'FrmXMLController::export_xml' );
188
-    }
187
+		add_action( 'wp_ajax_frm_export_xml', 'FrmXMLController::export_xml' );
188
+	}
189 189
 
190 190
 	public static function load_form_hooks() {
191
-        // Fields Controller
192
-        add_filter( 'frm_field_type', 'FrmFieldsController::change_type' );
193
-        add_action( 'frm_field_input_html', 'FrmFieldsController::input_html' );
194
-        add_filter( 'frm_field_value_saved', 'FrmFieldsController::check_value', 50, 3 );
195
-        add_filter( 'frm_field_label_seen', 'FrmFieldsController::check_label' );
191
+		// Fields Controller
192
+		add_filter( 'frm_field_type', 'FrmFieldsController::change_type' );
193
+		add_action( 'frm_field_input_html', 'FrmFieldsController::input_html' );
194
+		add_filter( 'frm_field_value_saved', 'FrmFieldsController::check_value', 50, 3 );
195
+		add_filter( 'frm_field_label_seen', 'FrmFieldsController::check_label' );
196 196
 
197 197
 		// Forms Controller
198 198
 		add_filter( 'frm_form_classes', 'FrmFormsController::form_classes' );
199 199
 
200
-        // Styles Controller
201
-        add_filter( 'frm_use_important_width', 'FrmStylesController::important_style', 10, 2 );
202
-    }
200
+		// Styles Controller
201
+		add_filter( 'frm_use_important_width', 'FrmStylesController::important_style', 10, 2 );
202
+	}
203 203
 
204 204
 	public static function load_view_hooks() {
205
-        // Hooks go here when a view is loaded
206
-    }
205
+		// Hooks go here when a view is loaded
206
+	}
207 207
 
208 208
 	public static function load_multisite_hooks() {
209 209
 		add_action( 'init', 'FrmAppController::front_head' );
210 210
 		add_action( 'wpmu_upgrade_site', 'FrmAppController::network_upgrade_site' );
211 211
 
212
-        // drop tables when mu site is deleted
213
-        add_filter( 'wpmu_drop_tables', 'FrmAppController::drop_tables' );
214
-    }
212
+		// drop tables when mu site is deleted
213
+		add_filter( 'wpmu_drop_tables', 'FrmAppController::drop_tables' );
214
+	}
215 215
 }
Please login to merge, or discard this patch.
classes/models/FrmEntryFormat.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -126,19 +126,19 @@
 block discarded – undo
126 126
 	}
127 127
 
128 128
 	/**
129
-	* Flatten multi-dimensional array for multi-file upload fields
130
-	* @since 2.0.9
131
-	*/
129
+	 * Flatten multi-dimensional array for multi-file upload fields
130
+	 * @since 2.0.9
131
+	 */
132 132
 	public static function flatten_multi_file_upload( $field, &$val ) {
133 133
 		if ( $field->type == 'file' && FrmField::is_option_true( $field, 'multiple' ) ) {
134 134
 			$val = FrmAppHelper::array_flatten( $val );
135 135
 		}
136 136
 	}
137 137
 
138
-    /**
139
-     * Replace returns with HTML line breaks for display
140
-     * @since 2.0.9
141
-     */
138
+	/**
139
+	 * Replace returns with HTML line breaks for display
140
+	 * @since 2.0.9
141
+	 */
142 142
 	public static function textarea_display_value( $type, $plain_text, &$value ) {
143 143
 		if ( $type == 'textarea' && ! $plain_text ) {
144 144
 			$value = str_replace( array( "\r\n", "\r", "\n" ), ' <br/>', $value );
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -37,20 +37,20 @@  discard block
 block discarded – undo
37 37
 			$atts['id'] = $atts['entry']->id;
38 38
 		}
39 39
 
40
-		if ( ! $atts['fields'] || ! is_array($atts['fields']) ) {
40
+		if ( ! $atts['fields'] || ! is_array( $atts['fields'] ) ) {
41 41
 			$atts['fields'] = FrmField::get_all_for_form( $atts['form_id'], '', 'include' );
42 42
 		}
43 43
 
44 44
 		$values = array();
45 45
 		foreach ( $atts['fields'] as $f ) {
46 46
 			self::fill_entry_values( $atts, $f, $values );
47
-			unset($f);
47
+			unset( $f );
48 48
 		}
49 49
 
50 50
 		self::fill_entry_user_info( $atts, $values );
51 51
 
52 52
 		if ( $atts['format'] == 'json' ) {
53
-			return json_encode($values);
53
+			return json_encode( $values );
54 54
 		} else if ( $atts['format'] == 'array' ) {
55 55
 			return $values;
56 56
 		}
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 		self::convert_entry_to_content( $values, $atts, $content );
60 60
 
61 61
 		if ( 'text' == $atts['format'] ) {
62
-			$content = implode('', $content);
62
+			$content = implode( '', $content );
63 63
 		}
64 64
 
65 65
 		if ( $atts['clickable'] ) {
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 			'val' => '[' . $f->id . ']'
83 83
 		);
84 84
 
85
-		$values[ $f->id ] = apply_filters( 'frm_field_shortcodes_for_default_html_email', $field_shortcodes, $f );
85
+		$values[$f->id] = apply_filters( 'frm_field_shortcodes_for_default_html_email', $field_shortcodes, $f );
86 86
 	}
87 87
 
88 88
 	public static function fill_entry_values( $atts, $f, array &$values ) {
@@ -95,9 +95,9 @@  discard block
 block discarded – undo
95 95
 			return;
96 96
 		}
97 97
 
98
-		if ( $atts['entry'] && ! isset( $atts['entry']->metas[ $f->id ] ) ) {
98
+		if ( $atts['entry'] && ! isset( $atts['entry']->metas[$f->id] ) ) {
99 99
 			// In case include_blank is set
100
-			$atts['entry']->metas[ $f->id ] = '';
100
+			$atts['entry']->metas[$f->id] = '';
101 101
 
102 102
 			if ( FrmAppHelper::pro_is_installed() ) {
103 103
 				FrmProEntryMeta::add_post_value_to_entry( $f, $atts['entry'] );
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 
108 108
 		$val = '';
109 109
 		if ( $atts['entry'] ) {
110
-			$prev_val = maybe_unserialize( $atts['entry']->metas[ $f->id ] );
110
+			$prev_val = maybe_unserialize( $atts['entry']->metas[$f->id] );
111 111
 			$meta = array( 'item_id' => $atts['id'], 'field_id' => $f->id, 'meta_value' => $prev_val, 'field_type' => $f->type );
112 112
 
113 113
 			//This filter applies to the default-message shortcode and frm-show-entry shortcode only
@@ -132,12 +132,12 @@  discard block
 block discarded – undo
132 132
 		self::maybe_strip_html( $atts['plain_text'], $val );
133 133
 
134 134
 		if ( $atts['format'] != 'text' ) {
135
-			$values[ $f->field_key ] = $val;
135
+			$values[$f->field_key] = $val;
136 136
 			if ( isset( $prev_val ) && $prev_val != $val && $f->type != 'textarea' ) {
137
-				$values[ $f->field_key . '-value' ] = $prev_val;
137
+				$values[$f->field_key . '-value'] = $prev_val;
138 138
 			}
139 139
 		} else {
140
-			$values[ $f->id ] = array( 'label' => $f->name, 'val' => $val );
140
+			$values[$f->id] = array( 'label' => $f->name, 'val' => $val );
141 141
 		}
142 142
 	}
143 143
 
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 			return;
184 184
 		}
185 185
 
186
-		$data  = self::get_entry_description_data( $atts );
186
+		$data = self::get_entry_description_data( $atts );
187 187
 
188 188
 		if ( $atts['default_email'] ) {
189 189
 			$atts['entry']->ip = '[ip]';
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 		preg_match_all( $pattern, $u_agent, $matches ); // get the matching numbers
271 271
 
272 272
 		// see how many we have
273
-		$i = count($matches['browser']);
273
+		$i = count( $matches['browser'] );
274 274
 		if ( $i != 1 ) {
275 275
 			//we will have two since we are not using 'other' argument yet
276 276
 			//see if version is before or after the name
@@ -307,15 +307,15 @@  discard block
 block discarded – undo
307 307
 
308 308
 			// merge defaults, global settings, and shortcode options
309 309
 			foreach ( $default_settings as $key => $setting ) {
310
-				if ( $atts[ $key ] != '' ) {
310
+				if ( $atts[$key] != '' ) {
311 311
 					continue;
312 312
 				}
313 313
 
314
-				$atts[ $key ] = $setting;
314
+				$atts[$key] = $setting;
315 315
 				unset( $key, $setting );
316 316
 			}
317 317
 
318
-			unset($default_settings);
318
+			unset( $default_settings );
319 319
 
320 320
 			$content[] = '<table cellspacing="0" style="font-size:' . $atts['font_size'] . ';line-height:135%; border-bottom:' . $atts['border_width'] . ' solid #' . $atts['border_color'] . ';"><tbody>' . "\r\n";
321 321
 			$atts['bg_color'] = ' style="background-color:#' . $atts['bg_color'] . ';"';
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 				continue;
339 339
 			}
340 340
 
341
-			if ( $atts['default_email'] && is_numeric($id) ) {
341
+			if ( $atts['default_email'] && is_numeric( $id ) ) {
342 342
 				$content[] = '[if ' . $id . ']<tr style="[frm-alt-color]">';
343 343
 			} else {
344 344
 				$content[] = '<tr' . ( $odd ? $atts['bg_color'] : $bg_color_alt ) . '>';
Please login to merge, or discard this patch.
classes/models/FrmSettings.php 3 patches
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-class FrmSettings{
3
+class FrmSettings {
4 4
     public $option_name = 'frm_options';
5 5
     public $menu;
6 6
     public $mu_menu;
@@ -47,7 +47,8 @@  discard block
 block discarded – undo
47 47
     }
48 48
 
49 49
 	private function translate_settings( $settings ) {
50
-        if ( $settings ) { //workaround for W3 total cache conflict
50
+        if ( $settings ) {
51
+//workaround for W3 total cache conflict
51 52
             return unserialize(serialize($settings));
52 53
         }
53 54
 
@@ -58,7 +59,8 @@  discard block
 block discarded – undo
58 59
         }
59 60
 
60 61
         // If unserializing didn't work
61
-        if ( $settings ) { //workaround for W3 total cache conflict
62
+        if ( $settings ) {
63
+//workaround for W3 total cache conflict
62 64
             $settings = unserialize(serialize($settings));
63 65
         } else {
64 66
             $settings = $this;
Please login to merge, or discard this patch.
Indentation   +185 added lines, -185 removed lines patch added patch discarded remove patch
@@ -1,243 +1,243 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 class FrmSettings{
4
-    public $option_name = 'frm_options';
5
-    public $menu;
6
-    public $mu_menu;
7
-    public $preview_page_id;
8
-    public $use_html;
9
-    public $jquery_css;
10
-    public $accordion_js;
11
-
12
-    public $success_msg;
13
-    public $blank_msg;
14
-    public $unique_msg;
15
-    public $invalid_msg;
16
-    public $failed_msg;
17
-    public $submit_value;
18
-    public $login_msg;
19
-    public $admin_permission;
20
-
21
-    public $email_to;
22
-    public $load_style;
23
-    public $custom_style;
24
-
25
-    public $pubkey;
26
-    public $privkey;
27
-    public $re_lang;
28
-    public $re_msg;
4
+	public $option_name = 'frm_options';
5
+	public $menu;
6
+	public $mu_menu;
7
+	public $preview_page_id;
8
+	public $use_html;
9
+	public $jquery_css;
10
+	public $accordion_js;
11
+
12
+	public $success_msg;
13
+	public $blank_msg;
14
+	public $unique_msg;
15
+	public $invalid_msg;
16
+	public $failed_msg;
17
+	public $submit_value;
18
+	public $login_msg;
19
+	public $admin_permission;
20
+
21
+	public $email_to;
22
+	public $load_style;
23
+	public $custom_style;
24
+
25
+	public $pubkey;
26
+	public $privkey;
27
+	public $re_lang;
28
+	public $re_msg;
29 29
 	public $re_multi;
30 30
 
31
-    public function __construct() {
32
-        if ( ! defined('ABSPATH') ) {
33
-            die('You are not allowed to call this page directly.');
34
-        }
31
+	public function __construct() {
32
+		if ( ! defined('ABSPATH') ) {
33
+			die('You are not allowed to call this page directly.');
34
+		}
35 35
 
36
-        $settings = get_transient($this->option_name);
36
+		$settings = get_transient($this->option_name);
37 37
 
38
-        if ( ! is_object($settings) ) {
39
-            $settings = $this->translate_settings($settings);
40
-        }
38
+		if ( ! is_object($settings) ) {
39
+			$settings = $this->translate_settings($settings);
40
+		}
41 41
 
42
-        foreach ( $settings as $setting_name => $setting ) {
43
-            $this->{$setting_name} = $setting;
44
-            unset($setting_name, $setting);
45
-        }
42
+		foreach ( $settings as $setting_name => $setting ) {
43
+			$this->{$setting_name} = $setting;
44
+			unset($setting_name, $setting);
45
+		}
46 46
 
47
-        $this->set_default_options();
48
-    }
47
+		$this->set_default_options();
48
+	}
49 49
 
50 50
 	private function translate_settings( $settings ) {
51
-        if ( $settings ) { //workaround for W3 total cache conflict
52
-            return unserialize(serialize($settings));
53
-        }
54
-
55
-        $settings = get_option($this->option_name);
56
-        if ( is_object($settings) ) {
57
-            set_transient($this->option_name, $settings);
58
-            return $settings;
59
-        }
60
-
61
-        // If unserializing didn't work
62
-        if ( $settings ) { //workaround for W3 total cache conflict
63
-            $settings = unserialize(serialize($settings));
64
-        } else {
65
-            $settings = $this;
66
-        }
67
-
68
-        update_option($this->option_name, $settings);
69
-        set_transient($this->option_name, $settings);
70
-
71
-        return $settings;
72
-    }
73
-
74
-    /**
75
-     * @return array
76
-     */
51
+		if ( $settings ) { //workaround for W3 total cache conflict
52
+			return unserialize(serialize($settings));
53
+		}
54
+
55
+		$settings = get_option($this->option_name);
56
+		if ( is_object($settings) ) {
57
+			set_transient($this->option_name, $settings);
58
+			return $settings;
59
+		}
60
+
61
+		// If unserializing didn't work
62
+		if ( $settings ) { //workaround for W3 total cache conflict
63
+			$settings = unserialize(serialize($settings));
64
+		} else {
65
+			$settings = $this;
66
+		}
67
+
68
+		update_option($this->option_name, $settings);
69
+		set_transient($this->option_name, $settings);
70
+
71
+		return $settings;
72
+	}
73
+
74
+	/**
75
+	 * @return array
76
+	 */
77 77
 	public function default_options() {
78
-        return array(
79
-            'menu'      => apply_filters( 'frm_default_menu', __( 'Forms', 'formidable' ) ),
80
-            'mu_menu'   => 0,
81
-            'preview_page_id' => 0,
82
-            'use_html'  => true,
83
-            'jquery_css' => false,
84
-            'accordion_js' => false,
78
+		return array(
79
+			'menu'      => apply_filters( 'frm_default_menu', __( 'Forms', 'formidable' ) ),
80
+			'mu_menu'   => 0,
81
+			'preview_page_id' => 0,
82
+			'use_html'  => true,
83
+			'jquery_css' => false,
84
+			'accordion_js' => false,
85 85
 
86 86
 			're_multi'  => 0,
87 87
 
88
-            'success_msg' => __( 'Your responses were successfully submitted. Thank you!', 'formidable' ),
89
-            'blank_msg' => __( 'This field cannot be blank.', 'formidable' ),
90
-            'unique_msg' => __( 'This value must be unique.', 'formidable' ),
91
-            'invalid_msg' => __( 'There was a problem with your submission. Errors are marked below.', 'formidable' ),
92
-            'failed_msg' => __( 'We\'re sorry. It looks like you\'ve  already submitted that.', 'formidable' ),
93
-            'submit_value' => __( 'Submit', 'formidable' ),
94
-            'login_msg' => __( 'You do not have permission to view this form.', 'formidable' ),
95
-            'admin_permission' => __( 'You do not have permission to do that', 'formidable' ),
88
+			'success_msg' => __( 'Your responses were successfully submitted. Thank you!', 'formidable' ),
89
+			'blank_msg' => __( 'This field cannot be blank.', 'formidable' ),
90
+			'unique_msg' => __( 'This value must be unique.', 'formidable' ),
91
+			'invalid_msg' => __( 'There was a problem with your submission. Errors are marked below.', 'formidable' ),
92
+			'failed_msg' => __( 'We\'re sorry. It looks like you\'ve  already submitted that.', 'formidable' ),
93
+			'submit_value' => __( 'Submit', 'formidable' ),
94
+			'login_msg' => __( 'You do not have permission to view this form.', 'formidable' ),
95
+			'admin_permission' => __( 'You do not have permission to do that', 'formidable' ),
96 96
 
97
-            'email_to' => '[admin_email]',
98
-        );
99
-    }
97
+			'email_to' => '[admin_email]',
98
+		);
99
+	}
100 100
 
101 101
 	private function set_default_options() {
102
-        $this->fill_recaptcha_settings();
103
-
104
-        if ( ! isset($this->load_style) ) {
105
-            if ( ! isset($this->custom_style) ) {
106
-                $this->custom_style = true;
107
-            }
108
-
109
-            $this->load_style = 'all';
110
-        }
111
-
112
-        $this->fill_with_defaults();
113
-
114
-        if ( is_multisite() && is_admin() ) {
115
-            $mu_menu = get_site_option('frm_admin_menu_name');
116
-            if ( $mu_menu && ! empty($mu_menu) ) {
117
-                $this->menu = $mu_menu;
118
-                $this->mu_menu = 1;
119
-            }
120
-        }
121
-
122
-        $frm_roles = FrmAppHelper::frm_capabilities('pro');
123
-        foreach ( $frm_roles as $frm_role => $frm_role_description ) {
124
-            if ( ! isset($this->$frm_role) ) {
125
-                $this->$frm_role = 'administrator';
126
-            }
127
-        }
128
-    }
102
+		$this->fill_recaptcha_settings();
103
+
104
+		if ( ! isset($this->load_style) ) {
105
+			if ( ! isset($this->custom_style) ) {
106
+				$this->custom_style = true;
107
+			}
108
+
109
+			$this->load_style = 'all';
110
+		}
111
+
112
+		$this->fill_with_defaults();
113
+
114
+		if ( is_multisite() && is_admin() ) {
115
+			$mu_menu = get_site_option('frm_admin_menu_name');
116
+			if ( $mu_menu && ! empty($mu_menu) ) {
117
+				$this->menu = $mu_menu;
118
+				$this->mu_menu = 1;
119
+			}
120
+		}
121
+
122
+		$frm_roles = FrmAppHelper::frm_capabilities('pro');
123
+		foreach ( $frm_roles as $frm_role => $frm_role_description ) {
124
+			if ( ! isset($this->$frm_role) ) {
125
+				$this->$frm_role = 'administrator';
126
+			}
127
+		}
128
+	}
129 129
 
130 130
 	public function fill_with_defaults( $params = array() ) {
131
-        $settings = $this->default_options();
131
+		$settings = $this->default_options();
132 132
 
133
-        foreach ( $settings as $setting => $default ) {
133
+		foreach ( $settings as $setting => $default ) {
134 134
 			if ( isset( $params[ 'frm_' . $setting ] ) ) {
135 135
 				$this->{$setting} = $params[ 'frm_' . $setting ];
136
-            } else if ( ! isset($this->{$setting}) ) {
137
-                $this->{$setting} = $default;
138
-            }
136
+			} else if ( ! isset($this->{$setting}) ) {
137
+				$this->{$setting} = $default;
138
+			}
139 139
 
140 140
 			if ( $setting == 'menu' && empty( $this->{$setting} ) ) {
141 141
 				$this->{$setting} = $default;
142 142
 			}
143 143
 
144
-            unset($setting, $default);
145
-        }
146
-    }
147
-
148
-    private function fill_recaptcha_settings() {
149
-        $privkey = '';
150
-        $re_lang = 'en';
151
-
152
-        if ( ! isset($this->pubkey) ) {
153
-            // get the options from the database
154
-            $recaptcha_opt = is_multisite() ? get_site_option('recaptcha') : get_option('recaptcha');
155
-            $this->pubkey = isset($recaptcha_opt['pubkey']) ? $recaptcha_opt['pubkey'] : '';
156
-            $privkey = isset($recaptcha_opt['privkey']) ? $recaptcha_opt['privkey'] : $privkey;
157
-            $re_lang = isset($recaptcha_opt['re_lang']) ? $recaptcha_opt['re_lang'] : $re_lang;
158
-        }
144
+			unset($setting, $default);
145
+		}
146
+	}
147
+
148
+	private function fill_recaptcha_settings() {
149
+		$privkey = '';
150
+		$re_lang = 'en';
151
+
152
+		if ( ! isset($this->pubkey) ) {
153
+			// get the options from the database
154
+			$recaptcha_opt = is_multisite() ? get_site_option('recaptcha') : get_option('recaptcha');
155
+			$this->pubkey = isset($recaptcha_opt['pubkey']) ? $recaptcha_opt['pubkey'] : '';
156
+			$privkey = isset($recaptcha_opt['privkey']) ? $recaptcha_opt['privkey'] : $privkey;
157
+			$re_lang = isset($recaptcha_opt['re_lang']) ? $recaptcha_opt['re_lang'] : $re_lang;
158
+		}
159 159
 
160
-        if ( ! isset($this->re_msg) || empty($this->re_msg) ) {
161
-            $this->re_msg = __( 'The reCAPTCHA was not entered correctly', 'formidable' );
162
-        }
160
+		if ( ! isset($this->re_msg) || empty($this->re_msg) ) {
161
+			$this->re_msg = __( 'The reCAPTCHA was not entered correctly', 'formidable' );
162
+		}
163 163
 
164
-        if ( ! isset($this->privkey) ) {
165
-            $this->privkey = $privkey;
166
-        }
164
+		if ( ! isset($this->privkey) ) {
165
+			$this->privkey = $privkey;
166
+		}
167 167
 
168
-        if ( ! isset($this->re_lang) ) {
169
-            $this->re_lang = $re_lang;
170
-        }
171
-    }
168
+		if ( ! isset($this->re_lang) ) {
169
+			$this->re_lang = $re_lang;
170
+		}
171
+	}
172 172
 
173
-    public function validate( $params, $errors ) {
174
-        $errors = apply_filters( 'frm_validate_settings', $errors, $params );
175
-        return $errors;
176
-    }
173
+	public function validate( $params, $errors ) {
174
+		$errors = apply_filters( 'frm_validate_settings', $errors, $params );
175
+		return $errors;
176
+	}
177 177
 
178 178
 	public function update( $params ) {
179
-        $this->fill_with_defaults($params);
180
-        $this->update_settings($params);
179
+		$this->fill_with_defaults($params);
180
+		$this->update_settings($params);
181 181
 
182
-        if ( $this->mu_menu ) {
183
-            update_site_option('frm_admin_menu_name', $this->menu);
184
-        } else if ( current_user_can('administrator') ) {
185
-            update_site_option('frm_admin_menu_name', false);
186
-        }
182
+		if ( $this->mu_menu ) {
183
+			update_site_option('frm_admin_menu_name', $this->menu);
184
+		} else if ( current_user_can('administrator') ) {
185
+			update_site_option('frm_admin_menu_name', false);
186
+		}
187 187
 
188
-        $this->update_roles($params);
188
+		$this->update_roles($params);
189 189
 
190
-        do_action( 'frm_update_settings', $params );
191
-    }
190
+		do_action( 'frm_update_settings', $params );
191
+	}
192 192
 
193 193
 	private function update_settings( $params ) {
194
-        $this->mu_menu = isset($params['frm_mu_menu']) ? $params['frm_mu_menu'] : 0;
194
+		$this->mu_menu = isset($params['frm_mu_menu']) ? $params['frm_mu_menu'] : 0;
195 195
 
196
-        $this->pubkey = trim($params['frm_pubkey']);
197
-        $this->privkey = $params['frm_privkey'];
198
-        $this->re_lang = $params['frm_re_lang'];
196
+		$this->pubkey = trim($params['frm_pubkey']);
197
+		$this->privkey = $params['frm_privkey'];
198
+		$this->re_lang = $params['frm_re_lang'];
199 199
 		$this->re_multi = isset( $params['frm_re_multi'] ) ? $params['frm_re_multi'] : 0;
200 200
 
201
-        $this->load_style = $params['frm_load_style'];
202
-        $this->preview_page_id = (int) $params['frm-preview-page-id'];
201
+		$this->load_style = $params['frm_load_style'];
202
+		$this->preview_page_id = (int) $params['frm-preview-page-id'];
203 203
 
204
-        $this->use_html = isset($params['frm_use_html']) ? $params['frm_use_html'] : 0;
205
-        //$this->custom_style = isset($params['frm_custom_style']) ? $params['frm_custom_style'] : 0;
204
+		$this->use_html = isset($params['frm_use_html']) ? $params['frm_use_html'] : 0;
205
+		//$this->custom_style = isset($params['frm_custom_style']) ? $params['frm_custom_style'] : 0;
206 206
 		$this->jquery_css = isset( $params['frm_jquery_css'] ) ? absint( $params['frm_jquery_css'] ) : 0;
207 207
 		$this->accordion_js = isset( $params['frm_accordion_js'] ) ? absint( $params['frm_accordion_js'] ) : 0;
208
-    }
208
+	}
209 209
 
210 210
 	private function update_roles( $params ) {
211
-        global $wp_roles;
211
+		global $wp_roles;
212 212
 
213
-        $frm_roles = FrmAppHelper::frm_capabilities();
214
-        $roles = get_editable_roles();
215
-        foreach ( $frm_roles as $frm_role => $frm_role_description ) {
216
-            $this->$frm_role = (array) ( isset( $params[ $frm_role ] ) ? $params[ $frm_role ] : 'administrator' );
213
+		$frm_roles = FrmAppHelper::frm_capabilities();
214
+		$roles = get_editable_roles();
215
+		foreach ( $frm_roles as $frm_role => $frm_role_description ) {
216
+			$this->$frm_role = (array) ( isset( $params[ $frm_role ] ) ? $params[ $frm_role ] : 'administrator' );
217 217
 
218
-            // Make sure administrators always have permissions
219
-            if ( ! in_array( 'administrator', $this->$frm_role ) ) {
218
+			// Make sure administrators always have permissions
219
+			if ( ! in_array( 'administrator', $this->$frm_role ) ) {
220 220
 				array_push( $this->$frm_role, 'administrator' );
221
-            }
221
+			}
222 222
 
223
-            foreach ( $roles as $role => $details ) {
224
-                if ( in_array($role, $this->$frm_role) ) {
225
-    			    $wp_roles->add_cap( $role, $frm_role );
226
-    			} else {
227
-    			    $wp_roles->remove_cap( $role, $frm_role );
228
-    			}
229
-    		}
223
+			foreach ( $roles as $role => $details ) {
224
+				if ( in_array($role, $this->$frm_role) ) {
225
+					$wp_roles->add_cap( $role, $frm_role );
226
+				} else {
227
+					$wp_roles->remove_cap( $role, $frm_role );
228
+				}
229
+			}
230 230
 		}
231
-    }
231
+	}
232 232
 
233 233
 	public function store() {
234
-        // Save the posted value in the database
234
+		// Save the posted value in the database
235 235
 
236
-        update_option('frm_options', $this);
236
+		update_option('frm_options', $this);
237 237
 
238
-        delete_transient('frm_options');
239
-        set_transient('frm_options', $this);
238
+		delete_transient('frm_options');
239
+		set_transient('frm_options', $this);
240 240
 
241
-        do_action( 'frm_store_settings' );
242
-    }
241
+		do_action( 'frm_store_settings' );
242
+	}
243 243
 }
Please login to merge, or discard this patch.
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-class FrmSettings{
3
+class FrmSettings {
4 4
     public $option_name = 'frm_options';
5 5
     public $menu;
6 6
     public $mu_menu;
@@ -29,19 +29,19 @@  discard block
 block discarded – undo
29 29
 	public $re_multi;
30 30
 
31 31
     public function __construct() {
32
-        if ( ! defined('ABSPATH') ) {
33
-            die('You are not allowed to call this page directly.');
32
+        if ( ! defined( 'ABSPATH' ) ) {
33
+            die( 'You are not allowed to call this page directly.' );
34 34
         }
35 35
 
36
-        $settings = get_transient($this->option_name);
36
+        $settings = get_transient( $this->option_name );
37 37
 
38
-        if ( ! is_object($settings) ) {
39
-            $settings = $this->translate_settings($settings);
38
+        if ( ! is_object( $settings ) ) {
39
+            $settings = $this->translate_settings( $settings );
40 40
         }
41 41
 
42 42
         foreach ( $settings as $setting_name => $setting ) {
43 43
             $this->{$setting_name} = $setting;
44
-            unset($setting_name, $setting);
44
+            unset( $setting_name, $setting );
45 45
         }
46 46
 
47 47
         $this->set_default_options();
@@ -49,24 +49,24 @@  discard block
 block discarded – undo
49 49
 
50 50
 	private function translate_settings( $settings ) {
51 51
         if ( $settings ) { //workaround for W3 total cache conflict
52
-            return unserialize(serialize($settings));
52
+            return unserialize( serialize( $settings ) );
53 53
         }
54 54
 
55
-        $settings = get_option($this->option_name);
56
-        if ( is_object($settings) ) {
57
-            set_transient($this->option_name, $settings);
55
+        $settings = get_option( $this->option_name );
56
+        if ( is_object( $settings ) ) {
57
+            set_transient( $this->option_name, $settings );
58 58
             return $settings;
59 59
         }
60 60
 
61 61
         // If unserializing didn't work
62 62
         if ( $settings ) { //workaround for W3 total cache conflict
63
-            $settings = unserialize(serialize($settings));
63
+            $settings = unserialize( serialize( $settings ) );
64 64
         } else {
65 65
             $settings = $this;
66 66
         }
67 67
 
68
-        update_option($this->option_name, $settings);
69
-        set_transient($this->option_name, $settings);
68
+        update_option( $this->option_name, $settings );
69
+        set_transient( $this->option_name, $settings );
70 70
 
71 71
         return $settings;
72 72
     }
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
 	private function set_default_options() {
102 102
         $this->fill_recaptcha_settings();
103 103
 
104
-        if ( ! isset($this->load_style) ) {
105
-            if ( ! isset($this->custom_style) ) {
104
+        if ( ! isset( $this->load_style ) ) {
105
+            if ( ! isset( $this->custom_style ) ) {
106 106
                 $this->custom_style = true;
107 107
             }
108 108
 
@@ -112,16 +112,16 @@  discard block
 block discarded – undo
112 112
         $this->fill_with_defaults();
113 113
 
114 114
         if ( is_multisite() && is_admin() ) {
115
-            $mu_menu = get_site_option('frm_admin_menu_name');
116
-            if ( $mu_menu && ! empty($mu_menu) ) {
115
+            $mu_menu = get_site_option( 'frm_admin_menu_name' );
116
+            if ( $mu_menu && ! empty( $mu_menu ) ) {
117 117
                 $this->menu = $mu_menu;
118 118
                 $this->mu_menu = 1;
119 119
             }
120 120
         }
121 121
 
122
-        $frm_roles = FrmAppHelper::frm_capabilities('pro');
122
+        $frm_roles = FrmAppHelper::frm_capabilities( 'pro' );
123 123
         foreach ( $frm_roles as $frm_role => $frm_role_description ) {
124
-            if ( ! isset($this->$frm_role) ) {
124
+            if ( ! isset( $this->$frm_role ) ) {
125 125
                 $this->$frm_role = 'administrator';
126 126
             }
127 127
         }
@@ -131,9 +131,9 @@  discard block
 block discarded – undo
131 131
         $settings = $this->default_options();
132 132
 
133 133
         foreach ( $settings as $setting => $default ) {
134
-			if ( isset( $params[ 'frm_' . $setting ] ) ) {
135
-				$this->{$setting} = $params[ 'frm_' . $setting ];
136
-            } else if ( ! isset($this->{$setting}) ) {
134
+			if ( isset( $params['frm_' . $setting] ) ) {
135
+				$this->{$setting} = $params['frm_' . $setting];
136
+            } else if ( ! isset( $this->{$setting}) ) {
137 137
                 $this->{$setting} = $default;
138 138
             }
139 139
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 				$this->{$setting} = $default;
142 142
 			}
143 143
 
144
-            unset($setting, $default);
144
+            unset( $setting, $default );
145 145
         }
146 146
     }
147 147
 
@@ -149,23 +149,23 @@  discard block
 block discarded – undo
149 149
         $privkey = '';
150 150
         $re_lang = 'en';
151 151
 
152
-        if ( ! isset($this->pubkey) ) {
152
+        if ( ! isset( $this->pubkey ) ) {
153 153
             // get the options from the database
154
-            $recaptcha_opt = is_multisite() ? get_site_option('recaptcha') : get_option('recaptcha');
155
-            $this->pubkey = isset($recaptcha_opt['pubkey']) ? $recaptcha_opt['pubkey'] : '';
156
-            $privkey = isset($recaptcha_opt['privkey']) ? $recaptcha_opt['privkey'] : $privkey;
157
-            $re_lang = isset($recaptcha_opt['re_lang']) ? $recaptcha_opt['re_lang'] : $re_lang;
154
+            $recaptcha_opt = is_multisite() ? get_site_option( 'recaptcha' ) : get_option( 'recaptcha' );
155
+            $this->pubkey = isset( $recaptcha_opt['pubkey'] ) ? $recaptcha_opt['pubkey'] : '';
156
+            $privkey = isset( $recaptcha_opt['privkey'] ) ? $recaptcha_opt['privkey'] : $privkey;
157
+            $re_lang = isset( $recaptcha_opt['re_lang'] ) ? $recaptcha_opt['re_lang'] : $re_lang;
158 158
         }
159 159
 
160
-        if ( ! isset($this->re_msg) || empty($this->re_msg) ) {
160
+        if ( ! isset( $this->re_msg ) || empty( $this->re_msg ) ) {
161 161
             $this->re_msg = __( 'The reCAPTCHA was not entered correctly', 'formidable' );
162 162
         }
163 163
 
164
-        if ( ! isset($this->privkey) ) {
164
+        if ( ! isset( $this->privkey ) ) {
165 165
             $this->privkey = $privkey;
166 166
         }
167 167
 
168
-        if ( ! isset($this->re_lang) ) {
168
+        if ( ! isset( $this->re_lang ) ) {
169 169
             $this->re_lang = $re_lang;
170 170
         }
171 171
     }
@@ -176,24 +176,24 @@  discard block
 block discarded – undo
176 176
     }
177 177
 
178 178
 	public function update( $params ) {
179
-        $this->fill_with_defaults($params);
180
-        $this->update_settings($params);
179
+        $this->fill_with_defaults( $params );
180
+        $this->update_settings( $params );
181 181
 
182 182
         if ( $this->mu_menu ) {
183
-            update_site_option('frm_admin_menu_name', $this->menu);
184
-        } else if ( current_user_can('administrator') ) {
185
-            update_site_option('frm_admin_menu_name', false);
183
+            update_site_option( 'frm_admin_menu_name', $this->menu );
184
+        } else if ( current_user_can( 'administrator' ) ) {
185
+            update_site_option( 'frm_admin_menu_name', false );
186 186
         }
187 187
 
188
-        $this->update_roles($params);
188
+        $this->update_roles( $params );
189 189
 
190 190
         do_action( 'frm_update_settings', $params );
191 191
     }
192 192
 
193 193
 	private function update_settings( $params ) {
194
-        $this->mu_menu = isset($params['frm_mu_menu']) ? $params['frm_mu_menu'] : 0;
194
+        $this->mu_menu = isset( $params['frm_mu_menu'] ) ? $params['frm_mu_menu'] : 0;
195 195
 
196
-        $this->pubkey = trim($params['frm_pubkey']);
196
+        $this->pubkey = trim( $params['frm_pubkey'] );
197 197
         $this->privkey = $params['frm_privkey'];
198 198
         $this->re_lang = $params['frm_re_lang'];
199 199
 		$this->re_multi = isset( $params['frm_re_multi'] ) ? $params['frm_re_multi'] : 0;
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
         $this->load_style = $params['frm_load_style'];
202 202
         $this->preview_page_id = (int) $params['frm-preview-page-id'];
203 203
 
204
-        $this->use_html = isset($params['frm_use_html']) ? $params['frm_use_html'] : 0;
204
+        $this->use_html = isset( $params['frm_use_html'] ) ? $params['frm_use_html'] : 0;
205 205
         //$this->custom_style = isset($params['frm_custom_style']) ? $params['frm_custom_style'] : 0;
206 206
 		$this->jquery_css = isset( $params['frm_jquery_css'] ) ? absint( $params['frm_jquery_css'] ) : 0;
207 207
 		$this->accordion_js = isset( $params['frm_accordion_js'] ) ? absint( $params['frm_accordion_js'] ) : 0;
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
         $frm_roles = FrmAppHelper::frm_capabilities();
214 214
         $roles = get_editable_roles();
215 215
         foreach ( $frm_roles as $frm_role => $frm_role_description ) {
216
-            $this->$frm_role = (array) ( isset( $params[ $frm_role ] ) ? $params[ $frm_role ] : 'administrator' );
216
+            $this->$frm_role = (array) ( isset( $params[$frm_role] ) ? $params[$frm_role] : 'administrator' );
217 217
 
218 218
             // Make sure administrators always have permissions
219 219
             if ( ! in_array( 'administrator', $this->$frm_role ) ) {
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
             }
222 222
 
223 223
             foreach ( $roles as $role => $details ) {
224
-                if ( in_array($role, $this->$frm_role) ) {
224
+                if ( in_array( $role, $this->$frm_role ) ) {
225 225
     			    $wp_roles->add_cap( $role, $frm_role );
226 226
     			} else {
227 227
     			    $wp_roles->remove_cap( $role, $frm_role );
@@ -233,10 +233,10 @@  discard block
 block discarded – undo
233 233
 	public function store() {
234 234
         // Save the posted value in the database
235 235
 
236
-        update_option('frm_options', $this);
236
+        update_option( 'frm_options', $this );
237 237
 
238
-        delete_transient('frm_options');
239
-        set_transient('frm_options', $this);
238
+        delete_transient( 'frm_options' );
239
+        set_transient( 'frm_options', $this );
240 240
 
241 241
         do_action( 'frm_store_settings' );
242 242
     }
Please login to merge, or discard this patch.
classes/views/frm-entries/_sidebar-shared-pub.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@
 block discarded – undo
1 1
 <?php
2 2
 if ( ! isset( $entry) ) {
3
-    $entry = $record;
3
+	$entry = $record;
4 4
 } ?>
5 5
 
6 6
 <div class="misc-pub-section curtime misc-pub-curtime">
7 7
     <span id="timestamp">
8 8
     <?php
9
-    $date_format = __( 'M j, Y @ G:i' );
9
+	$date_format = __( 'M j, Y @ G:i' );
10 10
 	printf( __( 'Published on: <b>%1$s</b>' ), FrmAppHelper::get_localized_date( $date_format, $entry->created_at ) ); ?>
11 11
     </span>
12 12
 </div>
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! isset( $entry) ) {
2
+if ( ! isset( $entry ) ) {
3 3
     $entry = $record;
4 4
 } ?>
5 5
 
@@ -18,4 +18,4 @@  discard block
 block discarded – undo
18 18
 </div>
19 19
 <?php } ?>
20 20
 
21
-<?php do_action('frm_entry_shared_sidebar', $entry); ?>
21
+<?php do_action( 'frm_entry_shared_sidebar', $entry ); ?>
Please login to merge, or discard this patch.
classes/views/frm-entries/errors.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -4,30 +4,30 @@
 block discarded – undo
4 4
 <?php
5 5
 }
6 6
 if ( isset( $message ) && $message != '' ) {
7
-    if ( FrmAppHelper::is_admin() ) {
7
+	if ( FrmAppHelper::is_admin() ) {
8 8
 		?><div id="message" class="frm_message updated frm_msg_padding"><?php echo wp_kses_post( $message ) ?></div><?php
9 9
 	} else {
10
-        FrmFormsHelper::get_scroll_js($form->id);
10
+		FrmFormsHelper::get_scroll_js($form->id);
11 11
 
12 12
 		// we need to allow scripts here for javascript in the success message
13 13
 		echo $message;
14
-    }
14
+	}
15 15
 }
16 16
 
17 17
 if ( isset($errors) && is_array( $errors ) && ! empty( $errors ) ) {
18 18
 
19 19
 	if ( isset( $form ) && is_object( $form ) ) {
20
-    	FrmFormsHelper::get_scroll_js( $form->id );
20
+		FrmFormsHelper::get_scroll_js( $form->id );
21 21
 	} ?>
22 22
 <div class="frm_error_style">
23 23
 <?php
24 24
 $img = '';
25 25
 if ( ! FrmAppHelper::is_admin() ) {
26
-    $img = apply_filters('frm_error_icon', $img);
27
-    if ( $img && ! empty($img) ) {
28
-    ?><img src="<?php echo esc_attr( $img ) ?>" alt="" />
26
+	$img = apply_filters('frm_error_icon', $img);
27
+	if ( $img && ! empty($img) ) {
28
+	?><img src="<?php echo esc_attr( $img ) ?>" alt="" />
29 29
 <?php
30
-    }
30
+	}
31 31
 }
32 32
 
33 33
 FrmFormsHelper::show_errors( compact( 'img', 'errors' ) );
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( isset($include_extra_container) ) { ?>
2
+if ( isset( $include_extra_container ) ) { ?>
3 3
 <div class="<?php echo esc_attr( $include_extra_container ) ?>" id="frm_form_<?php echo esc_attr( $form->id ) ?>_container">
4 4
 <?php
5 5
 }
@@ -7,14 +7,14 @@  discard block
 block discarded – undo
7 7
     if ( FrmAppHelper::is_admin() ) {
8 8
 		?><div id="message" class="frm_message updated frm_msg_padding"><?php echo wp_kses_post( $message ) ?></div><?php
9 9
 	} else {
10
-        FrmFormsHelper::get_scroll_js($form->id);
10
+        FrmFormsHelper::get_scroll_js( $form->id );
11 11
 
12 12
 		// we need to allow scripts here for javascript in the success message
13 13
 		echo $message;
14 14
     }
15 15
 }
16 16
 
17
-if ( isset($errors) && is_array( $errors ) && ! empty( $errors ) ) {
17
+if ( isset( $errors ) && is_array( $errors ) && ! empty( $errors ) ) {
18 18
 
19 19
 	if ( isset( $form ) && is_object( $form ) ) {
20 20
     	FrmFormsHelper::get_scroll_js( $form->id );
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
 <?php
24 24
 $img = '';
25 25
 if ( ! FrmAppHelper::is_admin() ) {
26
-    $img = apply_filters('frm_error_icon', $img);
27
-    if ( $img && ! empty($img) ) {
26
+    $img = apply_filters( 'frm_error_icon', $img );
27
+    if ( $img && ! empty( $img ) ) {
28 28
     ?><img src="<?php echo esc_attr( $img ) ?>" alt="" />
29 29
 <?php
30 30
     }
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 <?php
38 38
 }
39 39
 
40
-if ( isset($include_extra_container) ) { ?>
40
+if ( isset( $include_extra_container ) ) { ?>
41 41
 </div>
42 42
 <?php
43 43
 }
Please login to merge, or discard this patch.
classes/views/frm-entries/form.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
     </div>
6 6
 </div>
7 7
 <?php
8
-    return;
8
+	return;
9 9
 }
10 10
 
11 11
 global $frm_vars;
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 		} else {
39 39
 			do_action( 'frm_show_other_field_type', $field, $form, array( 'action' => $form_action ) );
40 40
 		}
41
-    	do_action('frm_get_field_scripts', $field, $form, $form->id);
41
+		do_action('frm_get_field_scripts', $field, $form, $form->id);
42 42
 	}
43 43
 }
44 44
 
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
 
64 64
 // close open collapsible toggle div
65 65
 if ( isset($frm_vars['collapse_div']) && $frm_vars['collapse_div'] ) {
66
-    echo "</div>\n";
67
-    unset($frm_vars['collapse_div']);
66
+	echo "</div>\n";
67
+	unset($frm_vars['collapse_div']);
68 68
 }
69 69
 
70 70
 echo FrmFormsHelper::replace_shortcodes($values['after_html'], $form);
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
 }
78 78
 
79 79
 if ( FrmForm::show_submit( $form ) ) {
80
-    unset($values['fields']);
81
-    FrmFormsHelper::get_custom_submit($values['submit_html'], $form, $submit, $form_action, $values);
80
+	unset($values['fields']);
81
+	FrmFormsHelper::get_custom_submit($values['submit_html'], $form, $submit, $form_action, $values);
82 82
 }
83 83
 ?>
84 84
 </fieldset>
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( empty($values) || ! isset($values['fields']) || empty($values['fields']) ) { ?>
3
-<div class="frm_forms <?php echo FrmFormsHelper::get_form_style_class($form); ?>" id="frm_form_<?php echo esc_attr( $form->id ) ?>_container">
2
+if ( empty( $values ) || ! isset( $values['fields'] ) || empty( $values['fields'] ) ) { ?>
3
+<div class="frm_forms <?php echo FrmFormsHelper::get_form_style_class( $form ); ?>" id="frm_form_<?php echo esc_attr( $form->id ) ?>_container">
4 4
 	<div class="frm_error_style"><strong><?php _e( 'Oops!', 'formidable' ) ?></strong> <?php printf( __( 'You did not add any fields to your form. %1$sGo back%2$s and add some.', 'formidable' ), '<a href="' . esc_url( admin_url( '?page=formidable&frm_action=edit&id=' . $form->id ) ) . '">', '</a>' ) ?>
5 5
     </div>
6 6
 </div>
@@ -18,10 +18,10 @@  discard block
 block discarded – undo
18 18
 <div class="frm_form_fields <?php echo esc_attr( apply_filters( 'frm_form_fields_class', '', $values ) ); ?>">
19 19
 <fieldset>
20 20
 <?php echo FrmFormsHelper::replace_shortcodes( $values['before_html'], $form, $title, $description ); ?>
21
-<input type="hidden" name="frm_action" value="<?php echo esc_attr($form_action) ?>" />
22
-<input type="hidden" name="form_id" value="<?php echo esc_attr($form->id) ?>" />
23
-<input type="hidden" name="frm_hide_fields_<?php echo esc_attr( $form->id ) ?>" id="frm_hide_fields_<?php echo esc_attr( $form->id ) ?>" value="<?php echo esc_attr($frm_hide_fields) ?>" />
24
-<input type="hidden" name="form_key" value="<?php echo esc_attr($form->form_key) ?>" />
21
+<input type="hidden" name="frm_action" value="<?php echo esc_attr( $form_action ) ?>" />
22
+<input type="hidden" name="form_id" value="<?php echo esc_attr( $form->id ) ?>" />
23
+<input type="hidden" name="frm_hide_fields_<?php echo esc_attr( $form->id ) ?>" id="frm_hide_fields_<?php echo esc_attr( $form->id ) ?>" value="<?php echo esc_attr( $frm_hide_fields ) ?>" />
24
+<input type="hidden" name="form_key" value="<?php echo esc_attr( $form->form_key ) ?>" />
25 25
 <input type="hidden" name="item_meta[0]" value="" />
26 26
 <?php wp_nonce_field( 'frm_submit_entry_nonce', 'frm_submit_entry_' . $form->id ); ?>
27 27
 
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 		} else {
35 35
 			do_action( 'frm_show_other_field_type', $field, $form, array( 'action' => $form_action ) );
36 36
 		}
37
-    	do_action('frm_get_field_scripts', $field, $form, $form->id);
37
+    	do_action( 'frm_get_field_scripts', $field, $form, $form->id );
38 38
 	}
39 39
 }
40 40
 
@@ -42,13 +42,13 @@  discard block
 block discarded – undo
42 42
 if ( FrmAppHelper::is_admin() ) { ?>
43 43
 <div class="frm_form_field form-field">
44 44
 <label class="frm_primary_label"><?php _e( 'Entry Key', 'formidable' ) ?></label>
45
-<input type="text" name="item_key" value="<?php echo esc_attr($values['item_key']) ?>" />
45
+<input type="text" name="item_key" value="<?php echo esc_attr( $values['item_key'] ) ?>" />
46 46
 </div>
47 47
 <?php } else { ?>
48
-<input type="hidden" name="item_key" value="<?php echo esc_attr($values['item_key']) ?>" />
48
+<input type="hidden" name="item_key" value="<?php echo esc_attr( $values['item_key'] ) ?>" />
49 49
 <?php }
50 50
 
51
-do_action('frm_entry_form', $form, $form_action, $errors);
51
+do_action( 'frm_entry_form', $form, $form_action, $errors );
52 52
 
53 53
 global $frm_vars;
54 54
 // close open section div
@@ -58,23 +58,23 @@  discard block
 block discarded – undo
58 58
 }
59 59
 
60 60
 // close open collapsible toggle div
61
-if ( isset($frm_vars['collapse_div']) && $frm_vars['collapse_div'] ) {
61
+if ( isset( $frm_vars['collapse_div'] ) && $frm_vars['collapse_div'] ) {
62 62
     echo "</div>\n";
63
-    unset($frm_vars['collapse_div']);
63
+    unset( $frm_vars['collapse_div'] );
64 64
 }
65 65
 
66
-echo FrmFormsHelper::replace_shortcodes($values['after_html'], $form);
66
+echo FrmFormsHelper::replace_shortcodes( $values['after_html'], $form );
67 67
 
68 68
 
69
-if ( has_action('frm_entries_footer_scripts') ) { ?>
69
+if ( has_action( 'frm_entries_footer_scripts' ) ) { ?>
70 70
 <script type="text/javascript">
71
-<?php do_action('frm_entries_footer_scripts', $values['fields'], $form); ?>
71
+<?php do_action( 'frm_entries_footer_scripts', $values['fields'], $form ); ?>
72 72
 </script><?php
73 73
 }
74 74
 
75 75
 if ( FrmForm::show_submit( $form ) ) {
76
-    unset($values['fields']);
77
-    FrmFormsHelper::get_custom_submit($values['submit_html'], $form, $submit, $form_action, $values);
76
+    unset( $values['fields'] );
77
+    FrmFormsHelper::get_custom_submit( $values['submit_html'], $form, $submit, $form_action, $values );
78 78
 }
79 79
 ?>
80 80
 </fieldset>
Please login to merge, or discard this patch.
classes/views/frm-entries/show.php 2 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -15,43 +15,43 @@
 block discarded – undo
15 15
                     <div class="inside">
16 16
                         <table class="form-table"><tbody>
17 17
                         <?php
18
-                        $first_h3 = 'frm_first_h3';
19
-                        foreach ( $fields as $field ) {
18
+						$first_h3 = 'frm_first_h3';
19
+						foreach ( $fields as $field ) {
20 20
 							if ( in_array( $field->type, array( 'captcha', 'html', 'end_divider', 'form' ) ) ) {
21
-                                continue;
22
-                            }
21
+								continue;
22
+							}
23 23
 
24
-                            if ( in_array($field->type, array( 'break', 'divider' ) ) ) {
25
-                            ?>
24
+							if ( in_array($field->type, array( 'break', 'divider' ) ) ) {
25
+							?>
26 26
                         </tbody></table>
27 27
                         <br/><h3 class="<?php echo esc_attr( $first_h3 ) ?>"><?php echo esc_html( $field->name ) ?></h3>
28 28
                         <table class="form-table"><tbody>
29 29
                         <?php
30
-                                $first_h3 = '';
31
-                            } else {
32
-                        ?>
30
+								$first_h3 = '';
31
+							} else {
32
+						?>
33 33
                         <tr>
34 34
                             <th scope="row"><?php echo esc_html( $field->name ) ?>:</th>
35 35
                             <td>
36 36
                             <?php
37 37
 							$embedded_field_id = ( $entry->form_id != $field->form_id ) ? 'form' . $field->form_id : 0;
38
-                            $atts = array(
39
-                                'type' => $field->type, 'post_id' => $entry->post_id,
40
-                                'show_filename' => true, 'show_icon' => true, 'entry_id' => $entry->id,
41
-                                'embedded_field_id' => $embedded_field_id,
42
-                            );
43
-                            echo $display_value = FrmEntriesHelper::prepare_display_value($entry, $field, $atts);
38
+							$atts = array(
39
+								'type' => $field->type, 'post_id' => $entry->post_id,
40
+								'show_filename' => true, 'show_icon' => true, 'entry_id' => $entry->id,
41
+								'embedded_field_id' => $embedded_field_id,
42
+							);
43
+							echo $display_value = FrmEntriesHelper::prepare_display_value($entry, $field, $atts);
44 44
 
45
-                            if ( is_email($display_value) && ! in_array($display_value, $to_emails) ) {
46
-                                $to_emails[] = $display_value;
47
-                            }
48
-                            ?>
45
+							if ( is_email($display_value) && ! in_array($display_value, $to_emails) ) {
46
+								$to_emails[] = $display_value;
47
+							}
48
+							?>
49 49
                             </td>
50 50
                         </tr>
51 51
                         <?php }
52
-                        }
52
+						}
53 53
 
54
-                        ?>
54
+						?>
55 55
 
56 56
                         <?php if ( $entry->parent_item_id ) { ?>
57 57
                         <tr><th><?php _e( 'Parent Entry ID', 'formidable' ) ?>:</th>
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <div id="form_show_entry_page" class="wrap">
2 2
     <div class="frmicon icon32"><br/></div>
3 3
     <h2><?php _e( 'View Entry', 'formidable' ) ?>
4
-        <?php do_action('frm_entry_inside_h2', $entry->form_id); ?>
4
+        <?php do_action( 'frm_entry_inside_h2', $entry->form_id ); ?>
5 5
     </h2>
6 6
 
7 7
     <div class="frm_forms">
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
         <div id="poststuff">
10 10
             <div id="post-body" class="metabox-holder columns-2">
11 11
             <div id="post-body-content">
12
-                <?php FrmAppController::get_form_nav($entry->form_id, true); ?>
12
+                <?php FrmAppController::get_form_nav( $entry->form_id, true ); ?>
13 13
                 <div class="postbox">
14 14
                     <h3 class="hndle"><span><?php _e( 'Entry', 'formidable' ) ?></span></h3>
15 15
                     <div class="inside">
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
                                 continue;
22 22
                             }
23 23
 
24
-                            if ( in_array($field->type, array( 'break', 'divider' ) ) ) {
24
+                            if ( in_array( $field->type, array( 'break', 'divider' ) ) ) {
25 25
                             ?>
26 26
                         </tbody></table>
27 27
                         <br/><h3 class="<?php echo esc_attr( $first_h3 ) ?>"><?php echo esc_html( $field->name ) ?></h3>
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
                                 'show_filename' => true, 'show_icon' => true, 'entry_id' => $entry->id,
41 41
                                 'embedded_field_id' => $embedded_field_id,
42 42
                             );
43
-                            echo $display_value = FrmEntriesHelper::prepare_display_value($entry, $field, $atts);
43
+                            echo $display_value = FrmEntriesHelper::prepare_display_value( $entry, $field, $atts );
44 44
 
45
-                            if ( is_email($display_value) && ! in_array($display_value, $to_emails) ) {
45
+                            if ( is_email( $display_value ) && ! in_array( $display_value, $to_emails ) ) {
46 46
                                 $to_emails[] = $display_value;
47 47
                             }
48 48
                             ?>
@@ -59,11 +59,11 @@  discard block
 block discarded – undo
59 59
                         </td></tr>
60 60
                         <?php } ?>
61 61
                         </tbody></table>
62
-                        <?php do_action('frm_show_entry', $entry); ?>
62
+                        <?php do_action( 'frm_show_entry', $entry ); ?>
63 63
                     </div>
64 64
                 </div>
65 65
 
66
-                <?php do_action('frm_after_show_entry', $entry); ?>
66
+                <?php do_action( 'frm_after_show_entry', $entry ); ?>
67 67
 
68 68
             </div>
69 69
 			<?php require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/sidebar-show.php' ); ?>
Please login to merge, or discard this patch.
classes/views/frm-entries/sidebar-shared.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -66,18 +66,18 @@
 block discarded – undo
66 66
         <?php } ?>
67 67
 
68 68
         <?php
69
-        foreach ( (array) $data as $k => $d ) {
69
+		foreach ( (array) $data as $k => $d ) {
70 70
 			if ( in_array( $k, array( 'browser', 'referrer' ) ) ) {
71
-                continue;
72
-            }
73
-        ?>
71
+				continue;
72
+			}
73
+		?>
74 74
         <div class="misc-pub-section">
75 75
 			<b><?php echo sanitize_text_field( ucfirst( str_replace( '-', ' ', $k ) ) ); ?></b>:
76 76
 			<?php echo wp_kses_post( implode( ', ', (array) $d ) ); ?>
77 77
         </div>
78 78
         <?php
79
-            unset($k, $d);
80
-        }
81
-        ?>
79
+			unset($k, $d);
80
+		}
81
+		?>
82 82
     </div>
83 83
 </div>
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
         <div class="misc-pub-section">
7 7
             <span class="dashicons dashicons-admin-post wp-media-buttons-icon"></span>
8 8
             <?php _e( 'Post', 'formidable' ) ?>:
9
-            <b><?php echo get_the_title($entry->post_id) ?></b>
9
+            <b><?php echo get_the_title( $entry->post_id ) ?></b>
10 10
 			<span>
11 11
 				<a href="<?php echo esc_url( admin_url( 'post.php?post=' . $entry->post_id . '&action=edit' ) ) ?>">
12 12
 					<?php _e( 'Edit', 'formidable' ) ?>
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
         <?php if ( $entry->updated_by && $entry->updated_by != $entry->user_id ) { ?>
42 42
         <div class="misc-pub-section">
43 43
             <span class="dashicons dashicons-admin-users wp-media-buttons-icon"></span>
44
-			<?php printf( __( 'Updated by: %1$s', 'formidable' ), FrmProFieldsHelper::get_display_name( $entry->updated_by,  'display_name', array( 'link' => true ) ) ); ?>
44
+			<?php printf( __( 'Updated by: %1$s', 'formidable' ), FrmProFieldsHelper::get_display_name( $entry->updated_by, 'display_name', array( 'link' => true ) ) ); ?>
45 45
         </div>
46 46
         <?php } ?>
47 47
         <?php } ?>
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
64 64
         </div>
65 65
         <?php } ?>
66 66
 
67
-        <?php if ( isset($data['referrer']) ) { ?>
67
+        <?php if ( isset( $data['referrer'] ) ) { ?>
68 68
         <div class="misc-pub-section">
69 69
             <b><?php _e( 'Referrer', 'formidable' ) ?></b>:<br/>
70
-			<?php echo wp_kses_post( str_replace( "\r\n", '<br/>', $data['referrer'] ) );  ?>
70
+			<?php echo wp_kses_post( str_replace( "\r\n", '<br/>', $data['referrer'] ) ); ?>
71 71
         </div>
72 72
         <?php } ?>
73 73
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 			<?php echo wp_kses_post( implode( ', ', (array) $d ) ); ?>
83 83
         </div>
84 84
         <?php
85
-            unset($k, $d);
85
+            unset( $k, $d );
86 86
         }
87 87
         ?>
88 88
     </div>
Please login to merge, or discard this patch.