Completed
Push — master ( 3634bc...e08fbe )
by Jamie
03:00
created
classes/controllers/FrmEntriesController.php 2 patches
Indentation   +291 added lines, -291 removed lines patch added patch discarded remove patch
@@ -2,201 +2,201 @@  discard block
 block discarded – undo
2 2
 
3 3
 class FrmEntriesController {
4 4
 
5
-    public static function menu() {
5
+	public static function menu() {
6 6
 		FrmAppHelper::force_capability( 'frm_view_entries' );
7 7
 
8
-        add_submenu_page('formidable', 'Formidable | ' . __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' );
8
+		add_submenu_page('formidable', 'Formidable | ' . __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' );
9 9
 
10 10
 		if ( ! in_array( FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ), array( 'edit', 'show' ) ) ) {
11 11
 			$menu_name = FrmAppHelper::get_menu_name();
12 12
 			add_filter( 'manage_' . sanitize_title( $menu_name ) . '_page_formidable-entries_columns', 'FrmEntriesController::manage_columns' );
13 13
 			add_filter( 'get_user_option_manage' . sanitize_title( $menu_name ) . '_page_formidable-entriescolumnshidden', 'FrmEntriesController::hidden_columns' );
14 14
 			add_filter( 'manage_' . sanitize_title( $menu_name ) . '_page_formidable-entries_sortable_columns', 'FrmEntriesController::sortable_columns' );
15
-        }
16
-    }
15
+		}
16
+	}
17 17
 
18
-    /* Display in Back End */
19
-    public static function route() {
18
+	/* Display in Back End */
19
+	public static function route() {
20 20
 		$action = FrmAppHelper::get_param( 'frm_action', '', 'get', 'sanitize_title' );
21 21
 
22
-        switch ( $action ) {
23
-            case 'show':
24
-            case 'destroy':
25
-            case 'destroy_all':
26
-                return self::$action();
22
+		switch ( $action ) {
23
+			case 'show':
24
+			case 'destroy':
25
+			case 'destroy_all':
26
+				return self::$action();
27 27
 
28
-            default:
29
-                do_action( 'frm_entry_action_route', $action );
30
-                if ( apply_filters( 'frm_entry_stop_action_route', false, $action ) ) {
31
-                    return;
32
-                }
28
+			default:
29
+				do_action( 'frm_entry_action_route', $action );
30
+				if ( apply_filters( 'frm_entry_stop_action_route', false, $action ) ) {
31
+					return;
32
+				}
33 33
 
34
-                return self::display_list();
35
-        }
36
-    }
34
+				return self::display_list();
35
+		}
36
+	}
37 37
 
38 38
 	public static function contextual_help( $help, $screen_id, $screen ) {
39
-        // Only add to certain screens. add_help_tab was introduced in WordPress 3.3
40
-        if ( ! method_exists( $screen, 'add_help_tab' ) ) {
41
-            return $help;
42
-        }
39
+		// Only add to certain screens. add_help_tab was introduced in WordPress 3.3
40
+		if ( ! method_exists( $screen, 'add_help_tab' ) ) {
41
+			return $help;
42
+		}
43 43
 
44 44
 		$action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );
45 45
 		$page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
46 46
 		if ( $page != 'formidable-entries' || ( ! empty( $action ) && $action != 'list' ) ) {
47
-            return $help;
48
-        }
47
+			return $help;
48
+		}
49 49
 
50 50
 		unset( $action, $page );
51 51
 
52
-        $screen->add_help_tab( array(
53
-            'id'      => 'formidable-entries-tab',
54
-            'title'   => __( 'Overview', 'formidable' ),
52
+		$screen->add_help_tab( array(
53
+			'id'      => 'formidable-entries-tab',
54
+			'title'   => __( 'Overview', 'formidable' ),
55 55
 			'content' => '<p>' . esc_html__( 'This screen provides access to all of your entries. You can customize the display of this screen to suit your workflow.', 'formidable' ) . '</p> <p>' . esc_html__( 'Hovering over a row in the entries list will display action links that allow you to manage your entry.', 'formidable' ) . '</p>',
56
-        ));
56
+		));
57 57
 
58
-        $screen->set_help_sidebar(
58
+		$screen->set_help_sidebar(
59 59
 			'<p><strong>' . esc_html__( 'For more information:', 'formidable' ) . '</strong></p>' .
60 60
 			'<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidableforms.com/knowledgebase/manage-entries-from-the-back-end/' ) ) . '" target="_blank">' . esc_html__( 'Documentation on Entries', 'formidable' ) . '</a></p>' .
61 61
 			'<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidableforms.com/help-desk/' ) ) . '" target="_blank">' . esc_html__( 'Support', 'formidable' ) . '</a></p>'
62
-    	);
62
+		);
63 63
 
64
-        return $help;
65
-    }
64
+		return $help;
65
+	}
66 66
 
67 67
 	public static function manage_columns( $columns ) {
68
-        global $frm_vars, $wpdb;
68
+		global $frm_vars, $wpdb;
69 69
 		$form_id = FrmForm::get_current_form_id();
70 70
 
71 71
 		$columns[ $form_id . '_id' ] = 'ID';
72 72
 		$columns[ $form_id . '_item_key' ] = esc_html__( 'Entry Key', 'formidable' );
73 73
 
74
-        if ( ! $form_id ) {
75
-            return $columns;
76
-        }
74
+		if ( ! $form_id ) {
75
+			return $columns;
76
+		}
77 77
 
78
-        $form_cols = FrmField::get_all_for_form($form_id, '', 'include');
78
+		$form_cols = FrmField::get_all_for_form($form_id, '', 'include');
79 79
 
80
-        foreach ( $form_cols as $form_col ) {
80
+		foreach ( $form_cols as $form_col ) {
81 81
 			if ( FrmField::is_no_save_field( $form_col->type ) ) {
82
-                continue;
83
-            }
82
+				continue;
83
+			}
84 84
 
85
-            if ( $form_col->type == 'form' && isset( $form_col->field_options['form_select'] ) && ! empty( $form_col->field_options['form_select'] ) ) {
85
+			if ( $form_col->type == 'form' && isset( $form_col->field_options['form_select'] ) && ! empty( $form_col->field_options['form_select'] ) ) {
86 86
 				$sub_form_cols = FrmField::get_all_for_form( $form_col->field_options['form_select'] );
87 87
 
88
-                if ( $sub_form_cols ) {
89
-                    foreach ( $sub_form_cols as $k => $sub_form_col ) {
88
+				if ( $sub_form_cols ) {
89
+					foreach ( $sub_form_cols as $k => $sub_form_col ) {
90 90
 						if ( FrmField::is_no_save_field( $sub_form_col->type ) ) {
91
-                            unset( $sub_form_cols[ $k ] );
92
-                            continue;
93
-                        }
91
+							unset( $sub_form_cols[ $k ] );
92
+							continue;
93
+						}
94 94
 						$columns[ $form_id . '_' . $sub_form_col->field_key . '-_-' . $form_col->id ] = FrmAppHelper::truncate( $sub_form_col->name, 35 );
95
-                        unset($sub_form_col);
96
-                    }
97
-                }
98
-                unset($sub_form_cols);
99
-            } else {
100
-                $col_id = $form_col->field_key;
101
-                if ( $form_col->form_id != $form_id ) {
95
+						unset($sub_form_col);
96
+					}
97
+				}
98
+				unset($sub_form_cols);
99
+			} else {
100
+				$col_id = $form_col->field_key;
101
+				if ( $form_col->form_id != $form_id ) {
102 102
 					$col_id .= '-_-form' . $form_col->form_id;
103
-                }
103
+				}
104 104
 
105
-                if ( isset($form_col->field_options['separate_value']) && $form_col->field_options['separate_value'] ) {
105
+				if ( isset($form_col->field_options['separate_value']) && $form_col->field_options['separate_value'] ) {
106 106
 					$columns[ $form_id . '_frmsep_' . $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 );
107
-                }
107
+				}
108 108
 				$columns[ $form_id . '_' . $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 );
109
-            }
110
-        }
109
+			}
110
+		}
111 111
 
112 112
 		$columns[ $form_id . '_created_at' ] = __( 'Entry creation date', 'formidable' );
113 113
 		$columns[ $form_id . '_updated_at' ] = __( 'Entry update date', 'formidable' );
114 114
 		$columns[ $form_id . '_ip' ] = 'IP';
115 115
 
116
-        $frm_vars['cols'] = $columns;
116
+		$frm_vars['cols'] = $columns;
117 117
 
118 118
 		$action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );
119 119
 		if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) && in_array( $action, array( '', 'list', 'destroy' ) ) ) {
120 120
 			add_screen_option( 'per_page', array( 'label' => __( 'Entries', 'formidable' ), 'default' => 20, 'option' => 'formidable_page_formidable_entries_per_page' ) );
121
-        }
121
+		}
122 122
 
123
-        return $columns;
124
-    }
123
+		return $columns;
124
+	}
125 125
 
126 126
 	public static function check_hidden_cols( $check, $object_id, $meta_key, $meta_value, $prev_value ) {
127 127
 		$menu_name = FrmAppHelper::get_menu_name();
128 128
 		$this_page_name = 'manage' . sanitize_title( $menu_name ) . '_page_formidable-entriescolumnshidden';
129 129
 		if ( $meta_key != $this_page_name || $meta_value == $prev_value ) {
130
-            return $check;
131
-        }
130
+			return $check;
131
+		}
132 132
 
133 133
 		if ( empty( $prev_value ) ) {
134 134
 			$prev_value = get_metadata( 'user', $object_id, $meta_key, true );
135 135
 		}
136 136
 
137
-        global $frm_vars;
138
-        //add a check so we don't create a loop
139
-        $frm_vars['prev_hidden_cols'] = ( isset($frm_vars['prev_hidden_cols']) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value;
137
+		global $frm_vars;
138
+		//add a check so we don't create a loop
139
+		$frm_vars['prev_hidden_cols'] = ( isset($frm_vars['prev_hidden_cols']) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value;
140 140
 
141
-        return $check;
142
-    }
141
+		return $check;
142
+	}
143 143
 
144
-    //add hidden columns back from other forms
144
+	//add hidden columns back from other forms
145 145
 	public static function update_hidden_cols( $meta_id, $object_id, $meta_key, $meta_value ) {
146 146
 		$menu_name = FrmAppHelper::get_menu_name();
147 147
 		$sanitized = sanitize_title( $menu_name );
148 148
 		$this_page_name = 'manage' . $sanitized . '_page_formidable-entriescolumnshidden';
149 149
 		if ( $meta_key != $this_page_name ) {
150
-            return;
151
-        }
152
-
153
-        global $frm_vars;
154
-        if ( ! isset($frm_vars['prev_hidden_cols']) || ! $frm_vars['prev_hidden_cols'] ) {
155
-            return; //don't continue if there's no previous value
156
-        }
157
-
158
-        foreach ( $meta_value as $mk => $mv ) {
159
-            //remove blank values
160
-            if ( empty( $mv )  ) {
161
-                unset( $meta_value[ $mk ] );
162
-            }
163
-        }
164
-
165
-        $cur_form_prefix = reset($meta_value);
166
-        $cur_form_prefix = explode('_', $cur_form_prefix);
167
-        $cur_form_prefix = $cur_form_prefix[0];
168
-        $save = false;
169
-
170
-        foreach ( (array) $frm_vars['prev_hidden_cols'] as $prev_hidden ) {
150
+			return;
151
+		}
152
+
153
+		global $frm_vars;
154
+		if ( ! isset($frm_vars['prev_hidden_cols']) || ! $frm_vars['prev_hidden_cols'] ) {
155
+			return; //don't continue if there's no previous value
156
+		}
157
+
158
+		foreach ( $meta_value as $mk => $mv ) {
159
+			//remove blank values
160
+			if ( empty( $mv )  ) {
161
+				unset( $meta_value[ $mk ] );
162
+			}
163
+		}
164
+
165
+		$cur_form_prefix = reset($meta_value);
166
+		$cur_form_prefix = explode('_', $cur_form_prefix);
167
+		$cur_form_prefix = $cur_form_prefix[0];
168
+		$save = false;
169
+
170
+		foreach ( (array) $frm_vars['prev_hidden_cols'] as $prev_hidden ) {
171 171
 			if ( empty( $prev_hidden ) || in_array( $prev_hidden, $meta_value ) ) {
172
-                //don't add blank cols or process included cols
173
-                continue;
174
-            }
172
+				//don't add blank cols or process included cols
173
+				continue;
174
+			}
175 175
 
176 176
 			$form_prefix = explode( '_', $prev_hidden );
177
-            $form_prefix = $form_prefix[0];
178
-            if ( $form_prefix == $cur_form_prefix ) {
179
-                //don't add back columns that are meant to be hidden
180
-                continue;
181
-            }
177
+			$form_prefix = $form_prefix[0];
178
+			if ( $form_prefix == $cur_form_prefix ) {
179
+				//don't add back columns that are meant to be hidden
180
+				continue;
181
+			}
182 182
 
183
-            $meta_value[] = $prev_hidden;
184
-            $save = true;
185
-            unset($form_prefix);
186
-        }
183
+			$meta_value[] = $prev_hidden;
184
+			$save = true;
185
+			unset($form_prefix);
186
+		}
187 187
 
188 188
 		if ( $save ) {
189
-            $user = wp_get_current_user();
189
+			$user = wp_get_current_user();
190 190
 			update_user_option( $user->ID, $this_page_name, $meta_value, true );
191
-        }
192
-    }
191
+		}
192
+	}
193 193
 
194 194
 	public static function save_per_page( $save, $option, $value ) {
195
-        if ( $option == 'formidable_page_formidable_entries_per_page' ) {
196
-            $save = (int) $value;
197
-        }
198
-        return $save;
199
-    }
195
+		if ( $option == 'formidable_page_formidable_entries_per_page' ) {
196
+			$save = (int) $value;
197
+		}
198
+		return $save;
199
+	}
200 200
 
201 201
 	public static function sortable_columns() {
202 202
 		$form_id = FrmForm::get_current_form_id();
@@ -222,122 +222,122 @@  discard block
 block discarded – undo
222 222
 	}
223 223
 
224 224
 	public static function hidden_columns( $result ) {
225
-        global $frm_vars;
225
+		global $frm_vars;
226 226
 
227 227
 		$form_id = FrmForm::get_current_form_id();
228 228
 
229
-        $return = false;
230
-        foreach ( (array) $result as $r ) {
231
-            if ( ! empty( $r ) ) {
232
-                $form_prefix = explode( '_', $r );
233
-                $form_prefix = $form_prefix[0];
229
+		$return = false;
230
+		foreach ( (array) $result as $r ) {
231
+			if ( ! empty( $r ) ) {
232
+				$form_prefix = explode( '_', $r );
233
+				$form_prefix = $form_prefix[0];
234 234
 
235
-                if ( (int) $form_prefix == (int) $form_id ) {
236
-                    $return = true;
237
-                    break;
238
-                }
235
+				if ( (int) $form_prefix == (int) $form_id ) {
236
+					$return = true;
237
+					break;
238
+				}
239 239
 
240
-                unset($form_prefix);
241
-            }
242
-        }
240
+				unset($form_prefix);
241
+			}
242
+		}
243 243
 
244
-        if ( $return ) {
244
+		if ( $return ) {
245 245
 			return $result;
246 246
 		}
247 247
 
248
-        $i = isset($frm_vars['cols']) ? count($frm_vars['cols']) : 0;
249
-        $max_columns = 8;
250
-        if ( $i <= $max_columns ) {
248
+		$i = isset($frm_vars['cols']) ? count($frm_vars['cols']) : 0;
249
+		$max_columns = 8;
250
+		if ( $i <= $max_columns ) {
251 251
 			return $result;
252 252
 		}
253 253
 
254
-        global $frm_vars;
255
-        if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] ) {
256
-            $frm_vars['current_form']->options = maybe_unserialize($frm_vars['current_form']->options);
257
-        }
254
+		global $frm_vars;
255
+		if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] ) {
256
+			$frm_vars['current_form']->options = maybe_unserialize($frm_vars['current_form']->options);
257
+		}
258 258
 
259
-        if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] && isset($frm_vars['current_form']->options['hidden_cols']) && ! empty($frm_vars['current_form']->options['hidden_cols']) ) {
260
-            $result = $frm_vars['current_form']->options['hidden_cols'];
261
-        } else {
262
-            $cols = $frm_vars['cols'];
263
-            $cols = array_reverse($cols, true);
259
+		if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] && isset($frm_vars['current_form']->options['hidden_cols']) && ! empty($frm_vars['current_form']->options['hidden_cols']) ) {
260
+			$result = $frm_vars['current_form']->options['hidden_cols'];
261
+		} else {
262
+			$cols = $frm_vars['cols'];
263
+			$cols = array_reverse($cols, true);
264 264
 
265 265
 			$result[] = $form_id . '_id';
266
-            $i--;
266
+			$i--;
267 267
 
268 268
 			$result[] = $form_id . '_item_key';
269
-            $i--;
269
+			$i--;
270 270
 
271 271
 			foreach ( $cols as $col_key => $col ) {
272
-                if ( $i > $max_columns ) {
272
+				if ( $i > $max_columns ) {
273 273
 					$result[] = $col_key;
274 274
 				}
275
-                //remove some columns by default
276
-                $i--;
277
-                unset($col_key, $col);
278
-            }
279
-        }
275
+				//remove some columns by default
276
+				$i--;
277
+				unset($col_key, $col);
278
+			}
279
+		}
280 280
 
281
-        return $result;
282
-    }
281
+		return $result;
282
+	}
283 283
 
284 284
 	public static function display_list( $message = '', $errors = array() ) {
285
-        global $wpdb, $frm_vars;
285
+		global $wpdb, $frm_vars;
286 286
 
287 287
 		$form = FrmForm::get_current_form();
288 288
 		$params = FrmForm::get_admin_params( $form );
289 289
 
290
-        if ( $form ) {
291
-            $params['form'] = $form->id;
292
-            $frm_vars['current_form'] = $form;
290
+		if ( $form ) {
291
+			$params['form'] = $form->id;
292
+			$frm_vars['current_form'] = $form;
293 293
 
294
-	        if ( 'trash' == $form->status ) {
295
-	            $delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS );
296
-	            $time_to_delete = FrmAppHelper::human_time_diff( $delete_timestamp, ( isset( $form->options['trash_time'] ) ? ( $form->options['trash_time'] ) : time() ) );
297
-	            $errors['trash'] = sprintf( __( 'This form is in the trash and is scheduled to be deleted permanently in %s along with any entries.', 'formidable' ), $time_to_delete );
298
-	            unset( $time_to_delete, $delete_timestamp );
299
-	        }
294
+			if ( 'trash' == $form->status ) {
295
+				$delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS );
296
+				$time_to_delete = FrmAppHelper::human_time_diff( $delete_timestamp, ( isset( $form->options['trash_time'] ) ? ( $form->options['trash_time'] ) : time() ) );
297
+				$errors['trash'] = sprintf( __( 'This form is in the trash and is scheduled to be deleted permanently in %s along with any entries.', 'formidable' ), $time_to_delete );
298
+				unset( $time_to_delete, $delete_timestamp );
299
+			}
300 300
 		}
301 301
 
302
-        $table_class = apply_filters( 'frm_entries_list_class', 'FrmEntriesListHelper' );
302
+		$table_class = apply_filters( 'frm_entries_list_class', 'FrmEntriesListHelper' );
303 303
 
304
-        $wp_list_table = new $table_class( array( 'params' => $params ) );
304
+		$wp_list_table = new $table_class( array( 'params' => $params ) );
305 305
 
306
-        $pagenum = $wp_list_table->get_pagenum();
306
+		$pagenum = $wp_list_table->get_pagenum();
307 307
 
308
-        $wp_list_table->prepare_items();
308
+		$wp_list_table->prepare_items();
309 309
 
310
-        $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
311
-        if ( $pagenum > $total_pages && $total_pages > 0 ) {
310
+		$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
311
+		if ( $pagenum > $total_pages && $total_pages > 0 ) {
312 312
 			$url = add_query_arg( 'paged', $total_pages );
313
-            if ( headers_sent() ) {
314
-                echo FrmAppHelper::js_redirect($url);
315
-            } else {
316
-                wp_redirect( esc_url_raw( $url ) );
317
-            }
318
-            die();
319
-        }
320
-
321
-        if ( empty($message) && isset($_GET['import-message']) ) {
322
-            $message = __( 'Your import is complete', 'formidable' );
323
-        }
313
+			if ( headers_sent() ) {
314
+				echo FrmAppHelper::js_redirect($url);
315
+			} else {
316
+				wp_redirect( esc_url_raw( $url ) );
317
+			}
318
+			die();
319
+		}
320
+
321
+		if ( empty($message) && isset($_GET['import-message']) ) {
322
+			$message = __( 'Your import is complete', 'formidable' );
323
+		}
324 324
 
325 325
 		require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/list.php' );
326
-    }
326
+	}
327 327
 
328
-    /* Back End CRUD */
328
+	/* Back End CRUD */
329 329
 	public static function show( $id = 0 ) {
330
-        FrmAppHelper::permission_check('frm_view_entries');
330
+		FrmAppHelper::permission_check('frm_view_entries');
331 331
 
332
-        if ( ! $id ) {
332
+		if ( ! $id ) {
333 333
 			$id = FrmAppHelper::get_param( 'id', 0, 'get', 'absint' );
334 334
 
335
-            if ( ! $id ) {
335
+			if ( ! $id ) {
336 336
 				$id = FrmAppHelper::get_param( 'item_id', 0, 'get', 'absint' );
337
-            }
338
-        }
337
+			}
338
+		}
339 339
 
340
-        $entry = FrmEntry::getOne($id, true);
340
+		$entry = FrmEntry::getOne($id, true);
341 341
 		if ( ! $entry ) {
342 342
 			echo '<div id="form_show_entry_page" class="wrap">' .
343 343
 				__( 'You are trying to view an entry that does not exist.', 'formidable' ) .
@@ -345,110 +345,110 @@  discard block
 block discarded – undo
345 345
 			return;
346 346
 		}
347 347
 
348
-        $data = maybe_unserialize($entry->description);
348
+		$data = maybe_unserialize($entry->description);
349 349
 		if ( ! is_array( $data ) || ! isset( $data['referrer'] ) ) {
350 350
 			$data = array( 'referrer' => $data );
351 351
 		}
352 352
 
353 353
 		$fields = FrmField::get_all_for_form( $entry->form_id, '', 'include' );
354
-        $to_emails = array();
354
+		$to_emails = array();
355 355
 
356 356
 		include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/show.php' );
357
-    }
357
+	}
358 358
 
359
-    public static function destroy() {
360
-        FrmAppHelper::permission_check('frm_delete_entries');
359
+	public static function destroy() {
360
+		FrmAppHelper::permission_check('frm_delete_entries');
361 361
 
362 362
 		$params = FrmForm::get_admin_params();
363 363
 
364
-        if ( isset($params['keep_post']) && $params['keep_post'] ) {
365
-            //unlink entry from post
366
-            global $wpdb;
364
+		if ( isset($params['keep_post']) && $params['keep_post'] ) {
365
+			//unlink entry from post
366
+			global $wpdb;
367 367
 			$wpdb->update( $wpdb->prefix . 'frm_items', array( 'post_id' => '' ), array( 'id' => $params['id'] ) );
368
-        }
368
+		}
369 369
 
370
-        $message = '';
371
-        if ( FrmEntry::destroy( $params['id'] ) ) {
372
-            $message = __( 'Entry was Successfully Destroyed', 'formidable' );
373
-        }
370
+		$message = '';
371
+		if ( FrmEntry::destroy( $params['id'] ) ) {
372
+			$message = __( 'Entry was Successfully Destroyed', 'formidable' );
373
+		}
374 374
 
375
-        self::display_list( $message );
376
-    }
375
+		self::display_list( $message );
376
+	}
377 377
 
378
-    public static function destroy_all() {
379
-        if ( ! current_user_can( 'frm_delete_entries' ) ) {
380
-            $frm_settings = FrmAppHelper::get_settings();
381
-            wp_die( $frm_settings->admin_permission );
382
-        }
378
+	public static function destroy_all() {
379
+		if ( ! current_user_can( 'frm_delete_entries' ) ) {
380
+			$frm_settings = FrmAppHelper::get_settings();
381
+			wp_die( $frm_settings->admin_permission );
382
+		}
383 383
 
384
-        global $wpdb;
384
+		global $wpdb;
385 385
 		$params = FrmForm::get_admin_params();
386
-        $message = '';
387
-        $errors = array();
388
-        $form_id = (int) $params['form'];
386
+		$message = '';
387
+		$errors = array();
388
+		$form_id = (int) $params['form'];
389 389
 
390
-        if ( $form_id ) {
391
-            $entry_ids = FrmDb::get_col( 'frm_items', array( 'form_id' => $form_id ) );
390
+		if ( $form_id ) {
391
+			$entry_ids = FrmDb::get_col( 'frm_items', array( 'form_id' => $form_id ) );
392 392
 			$action = FrmFormAction::get_action_for_form( $form_id, 'wppost', 1 );
393 393
 
394
-            if ( $action ) {
395
-                // this action takes a while, so only trigger it if there are posts to delete
396
-                foreach ( $entry_ids as $entry_id ) {
397
-                    do_action( 'frm_before_destroy_entry', $entry_id );
398
-                    unset( $entry_id );
399
-                }
400
-            }
401
-
402
-            $wpdb->query( $wpdb->prepare( "DELETE em.* FROM {$wpdb->prefix}frm_item_metas as em INNER JOIN {$wpdb->prefix}frm_items as e on (em.item_id=e.id) and form_id=%d", $form_id ) );
403
-            $results = $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}frm_items WHERE form_id=%d", $form_id ) );
404
-            if ( $results ) {
394
+			if ( $action ) {
395
+				// this action takes a while, so only trigger it if there are posts to delete
396
+				foreach ( $entry_ids as $entry_id ) {
397
+					do_action( 'frm_before_destroy_entry', $entry_id );
398
+					unset( $entry_id );
399
+				}
400
+			}
401
+
402
+			$wpdb->query( $wpdb->prepare( "DELETE em.* FROM {$wpdb->prefix}frm_item_metas as em INNER JOIN {$wpdb->prefix}frm_items as e on (em.item_id=e.id) and form_id=%d", $form_id ) );
403
+			$results = $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}frm_items WHERE form_id=%d", $form_id ) );
404
+			if ( $results ) {
405 405
 				FrmEntry::clear_cache();
406
-                $message = __( 'Entries were Successfully Destroyed', 'formidable' );
407
-            }
408
-        } else {
409
-            $errors = __( 'No entries were specified', 'formidable' );
410
-        }
411
-
412
-        self::display_list( $message, $errors );
413
-    }
414
-
415
-    public static function show_form( $id = '', $key = '', $title = false, $description = false ) {
416
-        _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::show_form()' );
417
-        return FrmFormsController::show_form( $id, $key, $title, $description );
418
-    }
419
-
420
-    public static function get_form( $filename, $form, $title, $description ) {
421
-        _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form()' );
422
-        return FrmFormsController::get_form( $form, $title, $description );
423
-    }
424
-
425
-    public static function process_entry( $errors = '', $ajax = false ) {
406
+				$message = __( 'Entries were Successfully Destroyed', 'formidable' );
407
+			}
408
+		} else {
409
+			$errors = __( 'No entries were specified', 'formidable' );
410
+		}
411
+
412
+		self::display_list( $message, $errors );
413
+	}
414
+
415
+	public static function show_form( $id = '', $key = '', $title = false, $description = false ) {
416
+		_deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::show_form()' );
417
+		return FrmFormsController::show_form( $id, $key, $title, $description );
418
+	}
419
+
420
+	public static function get_form( $filename, $form, $title, $description ) {
421
+		_deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form()' );
422
+		return FrmFormsController::get_form( $form, $title, $description );
423
+	}
424
+
425
+	public static function process_entry( $errors = '', $ajax = false ) {
426 426
 		$form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' );
427 427
 		if ( FrmAppHelper::is_admin() || empty( $_POST ) || empty( $form_id ) || ! isset( $_POST['item_key'] ) ) {
428
-            return;
429
-        }
428
+			return;
429
+		}
430 430
 
431
-        global $frm_vars;
431
+		global $frm_vars;
432 432
 
433 433
 		$form = FrmForm::getOne( $form_id );
434
-        if ( ! $form ) {
435
-            return;
436
-        }
434
+		if ( ! $form ) {
435
+			return;
436
+		}
437 437
 
438 438
 		$params = FrmForm::get_params( $form );
439 439
 
440
-        if ( ! isset( $frm_vars['form_params'] ) ) {
441
-            $frm_vars['form_params'] = array();
442
-        }
440
+		if ( ! isset( $frm_vars['form_params'] ) ) {
441
+			$frm_vars['form_params'] = array();
442
+		}
443 443
 		$frm_vars['form_params'][ $form->id ] = $params;
444 444
 
445 445
 		if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) {
446
-            return;
447
-        }
446
+			return;
447
+		}
448 448
 
449
-        if ( $errors == '' && ! $ajax ) {
449
+		if ( $errors == '' && ! $ajax ) {
450 450
 			$errors = FrmEntryValidate::validate( $_POST );
451
-        }
451
+		}
452 452
 
453 453
 		/**
454 454
 		 * Use this filter to add trigger actions and add errors after
@@ -459,54 +459,54 @@  discard block
 block discarded – undo
459 459
 
460 460
 		$frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors );
461 461
 
462
-        if ( empty( $errors ) ) {
462
+		if ( empty( $errors ) ) {
463 463
 			$_POST['frm_skip_cookie'] = 1;
464
-            if ( $params['action'] == 'create' ) {
464
+			if ( $params['action'] == 'create' ) {
465 465
 				if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) {
466 466
 					$frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST );
467
-                }
468
-            }
467
+				}
468
+			}
469 469
 
470
-            do_action( 'frm_process_entry', $params, $errors, $form, array( 'ajax' => $ajax ) );
470
+			do_action( 'frm_process_entry', $params, $errors, $form, array( 'ajax' => $ajax ) );
471 471
 			unset( $_POST['frm_skip_cookie'] );
472
-        }
473
-    }
474
-
475
-    public static function delete_entry_before_redirect( $url, $form, $atts ) {
476
-        self::_delete_entry( $atts['id'], $form );
477
-        return $url;
478
-    }
479
-
480
-    //Delete entry if not redirected
481
-    public static function delete_entry_after_save( $atts ) {
482
-        self::_delete_entry( $atts['entry_id'], $atts['form'] );
483
-    }
484
-
485
-    private static function _delete_entry( $entry_id, $form ) {
486
-        if ( ! $form ) {
487
-            return;
488
-        }
489
-
490
-        $form->options = maybe_unserialize( $form->options );
491
-        if ( isset( $form->options['no_save'] ) && $form->options['no_save'] ) {
492
-            FrmEntry::destroy( $entry_id );
493
-        }
494
-    }
472
+		}
473
+	}
474
+
475
+	public static function delete_entry_before_redirect( $url, $form, $atts ) {
476
+		self::_delete_entry( $atts['id'], $form );
477
+		return $url;
478
+	}
479
+
480
+	//Delete entry if not redirected
481
+	public static function delete_entry_after_save( $atts ) {
482
+		self::_delete_entry( $atts['entry_id'], $atts['form'] );
483
+	}
484
+
485
+	private static function _delete_entry( $entry_id, $form ) {
486
+		if ( ! $form ) {
487
+			return;
488
+		}
489
+
490
+		$form->options = maybe_unserialize( $form->options );
491
+		if ( isset( $form->options['no_save'] ) && $form->options['no_save'] ) {
492
+			FrmEntry::destroy( $entry_id );
493
+		}
494
+	}
495 495
 
496 496
 	public static function show_entry_shortcode( $atts ) {
497 497
 		return FrmEntryFormat::show_entry( $atts );
498 498
 	}
499 499
 
500 500
 	public static function filter_shortcode_value( $value, $tag, $atts, $field ) {
501
-        $plain_text = add_filter('frm_plain_text_email', true);
501
+		$plain_text = add_filter('frm_plain_text_email', true);
502 502
 		FrmEntryFormat::textarea_display_value( $field->type, $plain_text, $value );
503 503
 
504
-        if ( isset($atts['show']) && $atts['show'] == 'value' ) {
505
-            return $value;
506
-        }
504
+		if ( isset($atts['show']) && $atts['show'] == 'value' ) {
505
+			return $value;
506
+		}
507 507
 
508
-        return $value;
509
-    }
508
+		return $value;
509
+	}
510 510
 
511 511
 	public static function get_params( $form = null ) {
512 512
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmForm::get_params' );
@@ -514,15 +514,15 @@  discard block
 block discarded – undo
514 514
 	}
515 515
 
516 516
 	public static function entry_sidebar( $entry ) {
517
-        $data = maybe_unserialize($entry->description);
518
-        $date_format = get_option('date_format');
519
-        $time_format = get_option('time_format');
517
+		$data = maybe_unserialize($entry->description);
518
+		$date_format = get_option('date_format');
519
+		$time_format = get_option('time_format');
520 520
 		if ( isset( $data['browser'] ) ) {
521 521
 			$browser = FrmEntryFormat::get_browser( $data['browser'] );
522 522
 		}
523 523
 
524 524
 		include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/sidebar-shared.php' );
525
-    }
525
+	}
526 526
 
527 527
 	/***********************************************************************
528 528
 	 * Deprecated Functions
Please login to merge, or discard this patch.
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
     public static function menu() {
6 6
 		FrmAppHelper::force_capability( 'frm_view_entries' );
7 7
 
8
-        add_submenu_page('formidable', 'Formidable | ' . __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' );
8
+        add_submenu_page( 'formidable', 'Formidable | ' . __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' );
9 9
 
10 10
 		if ( ! in_array( FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ), array( 'edit', 'show' ) ) ) {
11 11
 			$menu_name = FrmAppHelper::get_menu_name();
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
             'id'      => 'formidable-entries-tab',
54 54
             'title'   => __( 'Overview', 'formidable' ),
55 55
 			'content' => '<p>' . esc_html__( 'This screen provides access to all of your entries. You can customize the display of this screen to suit your workflow.', 'formidable' ) . '</p> <p>' . esc_html__( 'Hovering over a row in the entries list will display action links that allow you to manage your entry.', 'formidable' ) . '</p>',
56
-        ));
56
+        ) );
57 57
 
58 58
         $screen->set_help_sidebar(
59 59
 			'<p><strong>' . esc_html__( 'For more information:', 'formidable' ) . '</strong></p>' .
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
         global $frm_vars, $wpdb;
69 69
 		$form_id = FrmForm::get_current_form_id();
70 70
 
71
-		$columns[ $form_id . '_id' ] = 'ID';
72
-		$columns[ $form_id . '_item_key' ] = esc_html__( 'Entry Key', 'formidable' );
71
+		$columns[$form_id . '_id'] = 'ID';
72
+		$columns[$form_id . '_item_key'] = esc_html__( 'Entry Key', 'formidable' );
73 73
 
74 74
         if ( ! $form_id ) {
75 75
             return $columns;
76 76
         }
77 77
 
78
-        $form_cols = FrmField::get_all_for_form($form_id, '', 'include');
78
+        $form_cols = FrmField::get_all_for_form( $form_id, '', 'include' );
79 79
 
80 80
         foreach ( $form_cols as $form_col ) {
81 81
 			if ( FrmField::is_no_save_field( $form_col->type ) ) {
@@ -88,30 +88,30 @@  discard block
 block discarded – undo
88 88
                 if ( $sub_form_cols ) {
89 89
                     foreach ( $sub_form_cols as $k => $sub_form_col ) {
90 90
 						if ( FrmField::is_no_save_field( $sub_form_col->type ) ) {
91
-                            unset( $sub_form_cols[ $k ] );
91
+                            unset( $sub_form_cols[$k] );
92 92
                             continue;
93 93
                         }
94
-						$columns[ $form_id . '_' . $sub_form_col->field_key . '-_-' . $form_col->id ] = FrmAppHelper::truncate( $sub_form_col->name, 35 );
95
-                        unset($sub_form_col);
94
+						$columns[$form_id . '_' . $sub_form_col->field_key . '-_-' . $form_col->id] = FrmAppHelper::truncate( $sub_form_col->name, 35 );
95
+                        unset( $sub_form_col );
96 96
                     }
97 97
                 }
98
-                unset($sub_form_cols);
98
+                unset( $sub_form_cols );
99 99
             } else {
100 100
                 $col_id = $form_col->field_key;
101 101
                 if ( $form_col->form_id != $form_id ) {
102 102
 					$col_id .= '-_-form' . $form_col->form_id;
103 103
                 }
104 104
 
105
-                if ( isset($form_col->field_options['separate_value']) && $form_col->field_options['separate_value'] ) {
106
-					$columns[ $form_id . '_frmsep_' . $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 );
105
+                if ( isset( $form_col->field_options['separate_value'] ) && $form_col->field_options['separate_value'] ) {
106
+					$columns[$form_id . '_frmsep_' . $col_id] = FrmAppHelper::truncate( $form_col->name, 35 );
107 107
                 }
108
-				$columns[ $form_id . '_' . $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 );
108
+				$columns[$form_id . '_' . $col_id] = FrmAppHelper::truncate( $form_col->name, 35 );
109 109
             }
110 110
         }
111 111
 
112
-		$columns[ $form_id . '_created_at' ] = __( 'Entry creation date', 'formidable' );
113
-		$columns[ $form_id . '_updated_at' ] = __( 'Entry update date', 'formidable' );
114
-		$columns[ $form_id . '_ip' ] = 'IP';
112
+		$columns[$form_id . '_created_at'] = __( 'Entry creation date', 'formidable' );
113
+		$columns[$form_id . '_updated_at'] = __( 'Entry update date', 'formidable' );
114
+		$columns[$form_id . '_ip'] = 'IP';
115 115
 
116 116
         $frm_vars['cols'] = $columns;
117 117
 
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 
137 137
         global $frm_vars;
138 138
         //add a check so we don't create a loop
139
-        $frm_vars['prev_hidden_cols'] = ( isset($frm_vars['prev_hidden_cols']) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value;
139
+        $frm_vars['prev_hidden_cols'] = ( isset( $frm_vars['prev_hidden_cols'] ) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value;
140 140
 
141 141
         return $check;
142 142
     }
@@ -151,19 +151,19 @@  discard block
 block discarded – undo
151 151
         }
152 152
 
153 153
         global $frm_vars;
154
-        if ( ! isset($frm_vars['prev_hidden_cols']) || ! $frm_vars['prev_hidden_cols'] ) {
154
+        if ( ! isset( $frm_vars['prev_hidden_cols'] ) || ! $frm_vars['prev_hidden_cols'] ) {
155 155
             return; //don't continue if there's no previous value
156 156
         }
157 157
 
158 158
         foreach ( $meta_value as $mk => $mv ) {
159 159
             //remove blank values
160
-            if ( empty( $mv )  ) {
161
-                unset( $meta_value[ $mk ] );
160
+            if ( empty( $mv ) ) {
161
+                unset( $meta_value[$mk] );
162 162
             }
163 163
         }
164 164
 
165
-        $cur_form_prefix = reset($meta_value);
166
-        $cur_form_prefix = explode('_', $cur_form_prefix);
165
+        $cur_form_prefix = reset( $meta_value );
166
+        $cur_form_prefix = explode( '_', $cur_form_prefix );
167 167
         $cur_form_prefix = $cur_form_prefix[0];
168 168
         $save = false;
169 169
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 
183 183
             $meta_value[] = $prev_hidden;
184 184
             $save = true;
185
-            unset($form_prefix);
185
+            unset( $form_prefix );
186 186
         }
187 187
 
188 188
 		if ( $save ) {
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 		foreach ( $fields as $field ) {
215 215
 			if ( $field->type != 'checkbox' && ( ! isset( $field->field_options['post_field'] ) || $field->field_options['post_field'] == '' ) ) {
216 216
 				// Can't sort on checkboxes because they are stored serialized, or post fields
217
-				$columns[ $form_id . '_' . $field->field_key ] = 'meta_' . $field->id;
217
+				$columns[$form_id . '_' . $field->field_key] = 'meta_' . $field->id;
218 218
 			}
219 219
 		}
220 220
 
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
                     break;
238 238
                 }
239 239
 
240
-                unset($form_prefix);
240
+                unset( $form_prefix );
241 241
             }
242 242
         }
243 243
 
@@ -245,36 +245,36 @@  discard block
 block discarded – undo
245 245
 			return $result;
246 246
 		}
247 247
 
248
-        $i = isset($frm_vars['cols']) ? count($frm_vars['cols']) : 0;
248
+        $i = isset( $frm_vars['cols'] ) ? count( $frm_vars['cols'] ) : 0;
249 249
         $max_columns = 8;
250 250
         if ( $i <= $max_columns ) {
251 251
 			return $result;
252 252
 		}
253 253
 
254 254
         global $frm_vars;
255
-        if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] ) {
256
-            $frm_vars['current_form']->options = maybe_unserialize($frm_vars['current_form']->options);
255
+        if ( isset( $frm_vars['current_form'] ) && $frm_vars['current_form'] ) {
256
+            $frm_vars['current_form']->options = maybe_unserialize( $frm_vars['current_form']->options );
257 257
         }
258 258
 
259
-        if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] && isset($frm_vars['current_form']->options['hidden_cols']) && ! empty($frm_vars['current_form']->options['hidden_cols']) ) {
259
+        if ( isset( $frm_vars['current_form'] ) && $frm_vars['current_form'] && isset( $frm_vars['current_form']->options['hidden_cols'] ) && ! empty( $frm_vars['current_form']->options['hidden_cols'] ) ) {
260 260
             $result = $frm_vars['current_form']->options['hidden_cols'];
261 261
         } else {
262 262
             $cols = $frm_vars['cols'];
263
-            $cols = array_reverse($cols, true);
263
+            $cols = array_reverse( $cols, true );
264 264
 
265 265
 			$result[] = $form_id . '_id';
266
-            $i--;
266
+            $i --;
267 267
 
268 268
 			$result[] = $form_id . '_item_key';
269
-            $i--;
269
+            $i --;
270 270
 
271 271
 			foreach ( $cols as $col_key => $col ) {
272 272
                 if ( $i > $max_columns ) {
273 273
 					$result[] = $col_key;
274 274
 				}
275 275
                 //remove some columns by default
276
-                $i--;
277
-                unset($col_key, $col);
276
+                $i --;
277
+                unset( $col_key, $col );
278 278
             }
279 279
         }
280 280
 
@@ -311,14 +311,14 @@  discard block
 block discarded – undo
311 311
         if ( $pagenum > $total_pages && $total_pages > 0 ) {
312 312
 			$url = add_query_arg( 'paged', $total_pages );
313 313
             if ( headers_sent() ) {
314
-                echo FrmAppHelper::js_redirect($url);
314
+                echo FrmAppHelper::js_redirect( $url );
315 315
             } else {
316 316
                 wp_redirect( esc_url_raw( $url ) );
317 317
             }
318 318
             die();
319 319
         }
320 320
 
321
-        if ( empty($message) && isset($_GET['import-message']) ) {
321
+        if ( empty( $message ) && isset( $_GET['import-message'] ) ) {
322 322
             $message = __( 'Your import is complete', 'formidable' );
323 323
         }
324 324
 
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 
328 328
     /* Back End CRUD */
329 329
 	public static function show( $id = 0 ) {
330
-        FrmAppHelper::permission_check('frm_view_entries');
330
+        FrmAppHelper::permission_check( 'frm_view_entries' );
331 331
 
332 332
         if ( ! $id ) {
333 333
 			$id = FrmAppHelper::get_param( 'id', 0, 'get', 'absint' );
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
             }
338 338
         }
339 339
 
340
-        $entry = FrmEntry::getOne($id, true);
340
+        $entry = FrmEntry::getOne( $id, true );
341 341
 		if ( ! $entry ) {
342 342
 			echo '<div id="form_show_entry_page" class="wrap">' .
343 343
 				__( 'You are trying to view an entry that does not exist.', 'formidable' ) .
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
 			return;
346 346
 		}
347 347
 
348
-        $data = maybe_unserialize($entry->description);
348
+        $data = maybe_unserialize( $entry->description );
349 349
 		if ( ! is_array( $data ) || ! isset( $data['referrer'] ) ) {
350 350
 			$data = array( 'referrer' => $data );
351 351
 		}
@@ -357,11 +357,11 @@  discard block
 block discarded – undo
357 357
     }
358 358
 
359 359
     public static function destroy() {
360
-        FrmAppHelper::permission_check('frm_delete_entries');
360
+        FrmAppHelper::permission_check( 'frm_delete_entries' );
361 361
 
362 362
 		$params = FrmForm::get_admin_params();
363 363
 
364
-        if ( isset($params['keep_post']) && $params['keep_post'] ) {
364
+        if ( isset( $params['keep_post'] ) && $params['keep_post'] ) {
365 365
             //unlink entry from post
366 366
             global $wpdb;
367 367
 			$wpdb->update( $wpdb->prefix . 'frm_items', array( 'post_id' => '' ), array( 'id' => $params['id'] ) );
@@ -440,9 +440,9 @@  discard block
 block discarded – undo
440 440
         if ( ! isset( $frm_vars['form_params'] ) ) {
441 441
             $frm_vars['form_params'] = array();
442 442
         }
443
-		$frm_vars['form_params'][ $form->id ] = $params;
443
+		$frm_vars['form_params'][$form->id] = $params;
444 444
 
445
-		if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) {
445
+		if ( isset( $frm_vars['created_entries'][$form_id] ) ) {
446 446
             return;
447 447
         }
448 448
 
@@ -457,13 +457,13 @@  discard block
 block discarded – undo
457 457
 		 */
458 458
 		$errors = apply_filters( 'frm_entries_before_create', $errors, $form );
459 459
 
460
-		$frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors );
460
+		$frm_vars['created_entries'][$form_id] = array( 'errors' => $errors );
461 461
 
462 462
         if ( empty( $errors ) ) {
463 463
 			$_POST['frm_skip_cookie'] = 1;
464 464
             if ( $params['action'] == 'create' ) {
465
-				if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) {
466
-					$frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST );
465
+				if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][$form_id]['entry_id'] ) ) {
466
+					$frm_vars['created_entries'][$form_id]['entry_id'] = FrmEntry::create( $_POST );
467 467
                 }
468 468
             }
469 469
 
@@ -498,10 +498,10 @@  discard block
 block discarded – undo
498 498
 	}
499 499
 
500 500
 	public static function filter_shortcode_value( $value, $tag, $atts, $field ) {
501
-        $plain_text = add_filter('frm_plain_text_email', true);
501
+        $plain_text = add_filter( 'frm_plain_text_email', true );
502 502
 		FrmEntryFormat::textarea_display_value( $field->type, $plain_text, $value );
503 503
 
504
-        if ( isset($atts['show']) && $atts['show'] == 'value' ) {
504
+        if ( isset( $atts['show'] ) && $atts['show'] == 'value' ) {
505 505
             return $value;
506 506
         }
507 507
 
@@ -514,9 +514,9 @@  discard block
 block discarded – undo
514 514
 	}
515 515
 
516 516
 	public static function entry_sidebar( $entry ) {
517
-        $data = maybe_unserialize($entry->description);
518
-        $date_format = get_option('date_format');
519
-        $time_format = get_option('time_format');
517
+        $data = maybe_unserialize( $entry->description );
518
+        $date_format = get_option( 'date_format' );
519
+        $time_format = get_option( 'time_format' );
520 520
 		if ( isset( $data['browser'] ) ) {
521 521
 			$browser = FrmEntryFormat::get_browser( $data['browser'] );
522 522
 		}
Please login to merge, or discard this patch.
classes/views/frm-form-actions/_action_inside.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@  discard block
 block discarded – undo
1
-<input type="hidden" name="<?php echo esc_attr( $action_control->get_field_name('post_excerpt', '') ) ?>" class="frm_action_name" value="<?php echo esc_attr( $form_action->post_excerpt ); ?>" />
2
-<input type="hidden" name="<?php echo esc_attr( $action_control->get_field_name('ID', '') ) ?>" value="<?php echo esc_attr( $form_action->ID ); ?>" />
1
+<input type="hidden" name="<?php echo esc_attr( $action_control->get_field_name( 'post_excerpt', '' ) ) ?>" class="frm_action_name" value="<?php echo esc_attr( $form_action->post_excerpt ); ?>" />
2
+<input type="hidden" name="<?php echo esc_attr( $action_control->get_field_name( 'ID', '' ) ) ?>" value="<?php echo esc_attr( $form_action->ID ); ?>" />
3 3
 
4 4
 <table class="form-table">
5 5
     <tr>
6 6
         <th>
7
-            <label <?php FrmAppHelper::maybe_add_tooltip('action_title') ?>><?php _e( 'Label', 'formidable' ) ?></label>
7
+            <label <?php FrmAppHelper::maybe_add_tooltip( 'action_title' ) ?>><?php _e( 'Label', 'formidable' ) ?></label>
8 8
         </th>
9
-        <td><input type="text" name="<?php echo esc_attr( $action_control->get_field_name('post_title', '') ) ?>" value="<?php echo esc_attr($form_action->post_title); ?>" class="large-text <?php FrmAppHelper::maybe_add_tooltip('action_title', 'open') ?>" id="<?php echo esc_attr( $action_control->get_field_id('action_post_title') ) ?>" />
9
+        <td><input type="text" name="<?php echo esc_attr( $action_control->get_field_name( 'post_title', '' ) ) ?>" value="<?php echo esc_attr( $form_action->post_title ); ?>" class="large-text <?php FrmAppHelper::maybe_add_tooltip( 'action_title', 'open' ) ?>" id="<?php echo esc_attr( $action_control->get_field_id( 'action_post_title' ) ) ?>" />
10 10
         </td>
11 11
     </tr>
12 12
 </table>
13
-<?php $action_control->form($form_action, compact('form', 'action_key', 'values')); ?>
13
+<?php $action_control->form( $form_action, compact( 'form', 'action_key', 'values' ) ); ?>
14 14
 
15 15
 <table class="form-table frm-no-margin">
16 16
     <tr><td>
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 if ( count( $action_control->action_options['event'] ) == 1 || $action_control->action_options['force_event'] ) {
27 27
 	foreach ( $action_control->action_options['event'] as $e ) { ?>
28
-	<input type="hidden" name="<?php echo esc_attr( $action_control->get_field_name('event') ) ?>[]" value="<?php echo esc_attr( $e ) ?>" />
28
+	<input type="hidden" name="<?php echo esc_attr( $action_control->get_field_name( 'event' ) ) ?>[]" value="<?php echo esc_attr( $e ) ?>" />
29 29
 <?php
30 30
 	}
31 31
 } else {
@@ -36,12 +36,12 @@  discard block
 block discarded – undo
36 36
 		<tr>
37 37
 			<td>
38 38
 				<label class="frm_left_label"><?php _e( 'Trigger this action after', 'formidable' ) ?></label>
39
-				<select name="<?php echo esc_attr( $action_control->get_field_name('event') ) ?>[]" multiple="multiple" class="frm_multiselect" id="<?php echo esc_attr( $action_control->get_field_id('event') ) ?>">
39
+				<select name="<?php echo esc_attr( $action_control->get_field_name( 'event' ) ) ?>[]" multiple="multiple" class="frm_multiselect" id="<?php echo esc_attr( $action_control->get_field_id( 'event' ) ) ?>">
40 40
 <?php
41 41
 
42 42
 	$event_labels = FrmFormAction::trigger_labels();
43 43
 	foreach ( $action_control->action_options['event'] as $event ) { ?>
44
-		<option value="<?php echo esc_attr( $event ) ?>" <?php echo in_array( $event, (array) $form_action->post_content['event'] ) ? ' selected="selected"' : ''; ?> ><?php echo isset( $event_labels[ $event ] ) ? $event_labels[ $event ] : $event; ?></option>
44
+		<option value="<?php echo esc_attr( $event ) ?>" <?php echo in_array( $event, (array) $form_action->post_content['event'] ) ? ' selected="selected"' : ''; ?> ><?php echo isset( $event_labels[$event] ) ? $event_labels[$event] : $event; ?></option>
45 45
 <?php
46 46
 	}
47 47
 ?>		        </select>
@@ -56,6 +56,6 @@  discard block
 block discarded – undo
56 56
 do_action( 'frm_additional_action_settings', $form_action, $pass_args );
57 57
 
58 58
 ?>
59
-    <span class="alignright frm_action_id <?php echo empty( $form_action->ID ) ? 'frm_hidden' : ''; ?>"><?php printf( __( 'Action ID: %1$s', 'formidable' ), $form_action->ID); ?></span>
59
+    <span class="alignright frm_action_id <?php echo empty( $form_action->ID ) ? 'frm_hidden' : ''; ?>"><?php printf( __( 'Action ID: %1$s', 'formidable' ), $form_action->ID ); ?></span>
60 60
     </td></tr>
61 61
 </table>
Please login to merge, or discard this patch.