Completed
Pull Request — master (#100)
by Stephanie
03:13
created
classes/models/FrmEntryValidate.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -43,6 +43,9 @@
 block discarded – undo
43 43
 		}
44 44
 	}
45 45
 
46
+	/**
47
+	 * @param boolean $exclude
48
+	 */
46 49
 	private static function get_fields_to_validate( $values, $exclude ) {
47 50
 		$where = apply_filters( 'frm_posted_field_ids', array( 'fi.form_id' => $values['form_id'] ) );
48 51
 
Please login to merge, or discard this patch.
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 class FrmEntryValidate {
4
-    public static function validate( $values, $exclude = false ) {
5
-        FrmEntry::sanitize_entry_post( $values );
6
-        $errors = array();
4
+	public static function validate( $values, $exclude = false ) {
5
+		FrmEntry::sanitize_entry_post( $values );
6
+		$errors = array();
7 7
 
8 8
 		if ( ! isset( $values['form_id'] ) || ! isset( $values['item_meta'] ) ) {
9
-            $errors['form'] = __( 'There was a problem with your submission. Please try again.', 'formidable' );
10
-            return $errors;
11
-        }
9
+			$errors['form'] = __( 'There was a problem with your submission. Please try again.', 'formidable' );
10
+			return $errors;
11
+		}
12 12
 
13 13
 		if ( FrmAppHelper::is_admin() && is_user_logged_in() && ( ! isset( $values[ 'frm_submit_entry_' . $values['form_id'] ] ) || ! wp_verify_nonce( $values[ 'frm_submit_entry_' . $values['form_id'] ], 'frm_submit_entry_nonce' ) ) ) {
14
-            $errors['form'] = __( 'You do not have permission to do that', 'formidable' );
15
-        }
14
+			$errors['form'] = __( 'You do not have permission to do that', 'formidable' );
15
+		}
16 16
 
17 17
 		self::set_item_key( $values );
18 18
 
@@ -57,24 +57,24 @@  discard block
 block discarded – undo
57 57
 		return FrmField::getAll( $where, 'field_order' );
58 58
 	}
59 59
 
60
-    public static function validate_field( $posted_field, &$errors, $values, $args = array() ) {
61
-        $defaults = array(
62
-            'id'              => $posted_field->id,
63
-            'parent_field_id' => '', // the id of the repeat or embed form
64
-            'key_pointer'     => '', // the pointer in the posted array
65
-            'exclude'         => array(), // exclude these field types from validation
66
-        );
67
-        $args = wp_parse_args( $args, $defaults );
60
+	public static function validate_field( $posted_field, &$errors, $values, $args = array() ) {
61
+		$defaults = array(
62
+			'id'              => $posted_field->id,
63
+			'parent_field_id' => '', // the id of the repeat or embed form
64
+			'key_pointer'     => '', // the pointer in the posted array
65
+			'exclude'         => array(), // exclude these field types from validation
66
+		);
67
+		$args = wp_parse_args( $args, $defaults );
68 68
 
69 69
 		if ( empty( $args['parent_field_id'] ) ) {
70 70
 			$value = isset( $values['item_meta'][ $args['id'] ] ) ? $values['item_meta'][ $args['id'] ] : '';
71
-        } else {
72
-            // value is from a nested form
73
-            $value = $values;
74
-        }
71
+		} else {
72
+			// value is from a nested form
73
+			$value = $values;
74
+		}
75 75
 
76
-        // Check for values in "Other" fields
77
-        FrmEntriesHelper::maybe_set_other_validation( $posted_field, $value, $args );
76
+		// Check for values in "Other" fields
77
+		FrmEntriesHelper::maybe_set_other_validation( $posted_field, $value, $args );
78 78
 
79 79
 		self::maybe_clear_value_for_default_blank_setting( $posted_field, $value );
80 80
 
@@ -87,11 +87,11 @@  discard block
 block discarded – undo
87 87
 			$value = trim( $value );
88 88
 		}
89 89
 
90
-        if ( $posted_field->required == '1' && FrmAppHelper::is_empty_value( $value ) ) {
90
+		if ( $posted_field->required == '1' && FrmAppHelper::is_empty_value( $value ) ) {
91 91
 			$errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' );
92
-        } else if ( $posted_field->type == 'text' && ! isset( $_POST['item_name'] ) ) { // WPCS: CSRF ok.
93
-            $_POST['item_name'] = $value;
94
-        }
92
+		} else if ( $posted_field->type == 'text' && ! isset( $_POST['item_name'] ) ) { // WPCS: CSRF ok.
93
+			$_POST['item_name'] = $value;
94
+		}
95 95
 
96 96
 		FrmEntriesHelper::set_posted_value( $posted_field, $value, $args );
97 97
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 
104 104
 		$errors = apply_filters( 'frm_validate_' . $posted_field->type . '_field_entry', $errors, $posted_field, $value, $args );
105 105
 		$errors = apply_filters( 'frm_validate_field_entry', $errors, $posted_field, $value, $args );
106
-    }
106
+	}
107 107
 
108 108
 	private static function maybe_clear_value_for_default_blank_setting( $field, &$value ) {
109 109
 		$is_default = ( FrmField::is_option_true_in_object( $field, 'default_blank' ) && $value == $field->default_value );
@@ -206,32 +206,32 @@  discard block
 block discarded – undo
206 206
 		return $pattern;
207 207
 	}
208 208
 
209
-    /**
210
-     * check for spam
211
-     * @param boolean $exclude
212
-     * @param array $values
213
-     * @param array $errors by reference
214
-     */
215
-    public static function spam_check( $exclude, $values, &$errors ) {
216
-        if ( ! empty( $exclude ) || ! isset( $values['item_meta'] ) || empty( $values['item_meta'] ) || ! empty( $errors ) ) {
217
-            // only check spam if there are no other errors
218
-            return;
219
-        }
209
+	/**
210
+	 * check for spam
211
+	 * @param boolean $exclude
212
+	 * @param array $values
213
+	 * @param array $errors by reference
214
+	 */
215
+	public static function spam_check( $exclude, $values, &$errors ) {
216
+		if ( ! empty( $exclude ) || ! isset( $values['item_meta'] ) || empty( $values['item_meta'] ) || ! empty( $errors ) ) {
217
+			// only check spam if there are no other errors
218
+			return;
219
+		}
220 220
 
221 221
 		if ( self::is_honeypot_spam() || self::is_spam_bot() ) {
222 222
 			$errors['spam'] = __( 'Your entry appears to be spam!', 'formidable' );
223 223
 		}
224 224
 
225
-    	if ( self::blacklist_check( $values ) ) {
226
-            $errors['spam'] = __( 'Your entry appears to be blacklist spam!', 'formidable' );
227
-    	}
225
+		if ( self::blacklist_check( $values ) ) {
226
+			$errors['spam'] = __( 'Your entry appears to be blacklist spam!', 'formidable' );
227
+		}
228 228
 
229
-        if ( self::is_akismet_spam( $values ) ) {
229
+		if ( self::is_akismet_spam( $values ) ) {
230 230
 			if ( self::is_akismet_enabled_for_user( $values['form_id'] ) ) {
231 231
 				$errors['spam'] = __( 'Your entry appears to be spam!', 'formidable' );
232 232
 			}
233
-	    }
234
-    }
233
+		}
234
+	}
235 235
 
236 236
 	private static function is_honeypot_spam() {
237 237
 		$honeypot_value = FrmAppHelper::get_param( 'frm_verify', '', 'get', 'sanitize_text_field' );
@@ -253,15 +253,15 @@  discard block
 block discarded – undo
253 253
 		return ( isset( $form->options['akismet'] ) && ! empty( $form->options['akismet'] ) && ( $form->options['akismet'] != 'logged' || ! is_user_logged_in() ) );
254 254
 	}
255 255
 
256
-    public static function blacklist_check( $values ) {
256
+	public static function blacklist_check( $values ) {
257 257
 		if ( ! apply_filters( 'frm_check_blacklist', true, $values ) ) {
258
-            return false;
259
-        }
258
+			return false;
259
+		}
260 260
 
261
-    	$mod_keys = trim( get_option( 'blacklist_keys' ) );
262
-    	if ( empty( $mod_keys ) ) {
263
-    		return false;
264
-    	}
261
+		$mod_keys = trim( get_option( 'blacklist_keys' ) );
262
+		if ( empty( $mod_keys ) ) {
263
+			return false;
264
+		}
265 265
 
266 266
 		$content = FrmEntriesHelper::entry_array_to_string( $values );
267 267
 		if ( empty( $content ) ) {
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 		$user_info = self::get_spam_check_user_info( $values );
274 274
 
275 275
 		return wp_blacklist_check( $user_info['comment_author'], $user_info['comment_author_email'], $user_info['comment_author_url'], $content, $ip, $user_agent );
276
-    }
276
+	}
277 277
 
278 278
 	/**
279 279
 	 * Check entries for Akismet spam
Please login to merge, or discard this patch.
classes/controllers/FrmAddonsController.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -430,6 +430,7 @@
 block discarded – undo
430 430
 
431 431
 	/**
432 432
 	 * @since 3.04.02
433
+	 * @param string $link
433 434
 	 */
434 435
 	private static function prepare_addon_link( &$link ) {
435 436
 		$site_url = 'https://formidableforms.com/';
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -167,7 +167,7 @@
 block discarded – undo
167 167
 
168 168
 		$response = wp_remote_get( $url );
169 169
 		if ( is_array( $response ) && ! is_wp_error( $response ) ) {
170
-		    $addons = $response['body'];
170
+			$addons = $response['body'];
171 171
 			if ( ! empty( $addons ) ) {
172 172
 				$addons = json_decode( $addons, true );
173 173
 
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 		} else {
52 52
 			foreach ( $addons as $k => $addon ) {
53 53
 				if ( empty( $addon['excerpt'] ) && $k !== 'error' ) {
54
-					unset( $addons[ $k ] );
54
+					unset( $addons[$k] );
55 55
 				}
56 56
 			}
57 57
 		}
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 					}
179 179
 					$cats = array_intersect( $skip_categories, $addon['categories'] );
180 180
 					if ( ! empty( $cats ) ) {
181
-						unset( $addons[ $k ] );
181
+						unset( $addons[$k] );
182 182
 					}
183 183
 				}
184 184
 
@@ -289,16 +289,16 @@  discard block
 block discarded – undo
289 289
 				continue;
290 290
 			}
291 291
 
292
-			$wp_plugin  = isset( $wp_plugins[ $folder ] ) ? $wp_plugins[ $folder ] : array();
292
+			$wp_plugin  = isset( $wp_plugins[$folder] ) ? $wp_plugins[$folder] : array();
293 293
 			$wp_version = isset( $wp_plugin['Version'] ) ? $wp_plugin['Version'] : '1.0';
294 294
 
295 295
 			if ( version_compare( $wp_version, $plugin->new_version, '<' ) ) {
296 296
 				$slug = explode( '/', $folder );
297 297
 				$plugin->slug = $slug[0];
298
-				$transient->response[ $folder ] = $plugin;
298
+				$transient->response[$folder] = $plugin;
299 299
 			}
300 300
 
301
-			$transient->checked[ $folder ] = $wp_version;
301
+			$transient->checked[$folder] = $wp_version;
302 302
 
303 303
 		}
304 304
 
@@ -340,13 +340,13 @@  discard block
 block discarded – undo
340 340
 			}
341 341
 
342 342
 			$download_id = isset( $plugin['id'] ) ? $plugin['id'] : 0;
343
-			if ( ! empty( $download_id ) && ! isset( $version_info[ $download_id ]['package'] ) ) {
343
+			if ( ! empty( $download_id ) && ! isset( $version_info[$download_id]['package'] ) ) {
344 344
 				// if this addon is using its own license, get the update url
345 345
 				$addon_info = self::get_addon_info( $new_license );
346 346
 
347
-				$version_info[ $download_id ] = $addon_info[ $download_id ];
347
+				$version_info[$download_id] = $addon_info[$download_id];
348 348
 				if ( isset( $addon_info['error'] ) ) {
349
-					$version_info[ $download_id ]['error'] = array(
349
+					$version_info[$download_id]['error'] = array(
350 350
 						'message' => $addon_info['error']['message'],
351 351
 						'code'    => $addon_info['error']['code'],
352 352
 					);
@@ -372,8 +372,8 @@  discard block
 block discarded – undo
372 372
 					return $addon;
373 373
 				}
374 374
 			}
375
-		} elseif ( isset( $addons[ $download_id ] ) ) {
376
-			$plugin = $addons[ $download_id ];
375
+		} elseif ( isset( $addons[$download_id] ) ) {
376
+			$plugin = $addons[$download_id];
377 377
 		}
378 378
 
379 379
 		return $plugin;
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 			self::prepare_addon_link( $addon['link'] );
425 425
 
426 426
 			self::set_addon_status( $addon );
427
-			$addons[ $id ] = $addon;
427
+			$addons[$id] = $addon;
428 428
 		}
429 429
 	}
430 430
 
Please login to merge, or discard this patch.
classes/controllers/FrmFormsController.php 3 patches
Doc Comments   +8 added lines patch added patch discarded remove patch
@@ -870,6 +870,7 @@  discard block
 block discarded – undo
870 870
 	/**
871 871
 	 * Get an array of the helper shortcodes to display in the customization panel
872 872
 	 * @since 2.0.6
873
+	 * @param boolean $settings_tab
873 874
 	 */
874 875
 	private static function get_shortcode_helpers( $settings_tab ) {
875 876
 		$entry_shortcodes = array(
@@ -947,6 +948,9 @@  discard block
 block discarded – undo
947 948
         return $content;
948 949
     }
949 950
 
951
+	/**
952
+	 * @param boolean $entry
953
+	 */
950 954
 	private static function get_entry_by_param( &$entry ) {
951 955
 		if ( ! $entry || ! is_object( $entry ) ) {
952 956
 			if ( ! $entry || ! is_numeric( $entry ) ) {
@@ -1229,6 +1233,9 @@  discard block
 block discarded – undo
1229 1233
 		return $form;
1230 1234
     }
1231 1235
 
1236
+	/**
1237
+	 * @param string $id
1238
+	 */
1232 1239
 	private static function maybe_get_form_to_show( $id ) {
1233 1240
 		$form = false;
1234 1241
 
@@ -1635,6 +1642,7 @@  discard block
 block discarded – undo
1635 1642
 
1636 1643
 	/**
1637 1644
 	 * @since 2.0.8
1645
+	 * @param string $content
1638 1646
 	 */
1639 1647
 	private static function maybe_minimize_form( $atts, &$content ) {
1640 1648
 		// check if minimizing is turned on
Please login to merge, or discard this patch.
Indentation   +336 added lines, -336 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 class FrmFormsController {
4 4
 
5
-    public static function menu() {
5
+	public static function menu() {
6 6
 		$menu_label = __( 'Forms', 'formidable' );
7 7
 		if ( ! FrmAppHelper::pro_is_installed() ) {
8 8
 			$menu_label .= ' (Lite)';
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 		add_submenu_page( 'formidable', 'Formidable | ' . $menu_label, $menu_label, 'frm_view_forms', 'formidable', 'FrmFormsController::route' );
11 11
 
12 12
 		self::maybe_load_listing_hooks();
13
-    }
13
+	}
14 14
 
15 15
 	public static function maybe_load_listing_hooks() {
16 16
 		$action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );
@@ -24,13 +24,13 @@  discard block
 block discarded – undo
24 24
 		add_filter( 'manage_toplevel_page_formidable_sortable_columns', 'FrmFormsController::get_sortable_columns' );
25 25
 	}
26 26
 
27
-    public static function head() {
27
+	public static function head() {
28 28
 		wp_enqueue_script( 'formidable-editinplace' );
29 29
 
30
-        if ( wp_is_mobile() ) {
31
-    		wp_enqueue_script( 'jquery-touch-punch' );
32
-    	}
33
-    }
30
+		if ( wp_is_mobile() ) {
31
+			wp_enqueue_script( 'jquery-touch-punch' );
32
+		}
33
+	}
34 34
 
35 35
 	public static function register_widgets() {
36 36
 		require_once( FrmAppHelper::plugin_path() . '/classes/widgets/FrmShowForm.php' );
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 	public static function new_form( $values = array() ) {
62 62
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
63 63
 
64
-        global $frm_vars;
64
+		global $frm_vars;
65 65
 
66 66
 		$action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
67 67
 		$action = empty( $values ) ? FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ) : $values[ $action ];
@@ -72,17 +72,17 @@  discard block
 block discarded – undo
72 72
 		} else if ( $action == 'new' ) {
73 73
 			$frm_field_selection = FrmField::field_selection();
74 74
 			$values = FrmFormsHelper::setup_new_vars( $values );
75
-            $id = FrmForm::create( $values );
75
+			$id = FrmForm::create( $values );
76 76
 			$form = FrmForm::getOne( $id );
77 77
 
78 78
 			self::create_default_email_action( $form );
79 79
 
80 80
 			$all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' );
81 81
 
82
-            $values['id'] = $id;
82
+			$values['id'] = $id;
83 83
 			require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new.php' );
84
-        }
85
-    }
84
+		}
85
+	}
86 86
 
87 87
 	/**
88 88
 	 * Create the default email action
@@ -91,41 +91,41 @@  discard block
 block discarded – undo
91 91
 	 *
92 92
 	 * @param object $form
93 93
 	 */
94
-    private static function create_default_email_action( $form ) {
95
-    	$create_email = apply_filters( 'frm_create_default_email_action', true, $form );
94
+	private static function create_default_email_action( $form ) {
95
+		$create_email = apply_filters( 'frm_create_default_email_action', true, $form );
96 96
 
97
-	    if ( $create_email ) {
98
-		    $action_control = FrmFormActionsController::get_form_actions( 'email' );
99
-		    $action_control->create( $form->id );
100
-	    }
101
-    }
97
+		if ( $create_email ) {
98
+			$action_control = FrmFormActionsController::get_form_actions( 'email' );
99
+			$action_control->create( $form->id );
100
+		}
101
+	}
102 102
 
103 103
 	public static function create( $values = array() ) {
104 104
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
105 105
 
106
-        global $frm_vars;
107
-        if ( empty( $values ) ) {
108
-            $values = $_POST;
109
-        }
106
+		global $frm_vars;
107
+		if ( empty( $values ) ) {
108
+			$values = $_POST;
109
+		}
110 110
 
111
-        //Set radio button and checkbox meta equal to "other" value
112
-        if ( FrmAppHelper::pro_is_installed() ) {
113
-            $values = FrmProEntry::mod_other_vals( $values, 'back' );
114
-        }
111
+		//Set radio button and checkbox meta equal to "other" value
112
+		if ( FrmAppHelper::pro_is_installed() ) {
113
+			$values = FrmProEntry::mod_other_vals( $values, 'back' );
114
+		}
115 115
 
116 116
 		$id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
117 117
 
118
-        if ( ! current_user_can( 'frm_edit_forms' ) || ( $_POST && ( ! isset( $values['frm_save_form'] ) || ! wp_verify_nonce( $values['frm_save_form'], 'frm_save_form_nonce' ) ) ) ) {
119
-            $frm_settings = FrmAppHelper::get_settings();
120
-            $errors = array( 'form' => $frm_settings->admin_permission );
121
-        } else {
118
+		if ( ! current_user_can( 'frm_edit_forms' ) || ( $_POST && ( ! isset( $values['frm_save_form'] ) || ! wp_verify_nonce( $values['frm_save_form'], 'frm_save_form_nonce' ) ) ) ) {
119
+			$frm_settings = FrmAppHelper::get_settings();
120
+			$errors = array( 'form' => $frm_settings->admin_permission );
121
+		} else {
122 122
 			$errors = FrmForm::validate( $values );
123
-        }
123
+		}
124 124
 
125 125
 		if ( count( $errors ) > 0 ) {
126
-            $hide_preview = true;
126
+			$hide_preview = true;
127 127
 			$frm_field_selection = FrmField::field_selection();
128
-            $form = FrmForm::getOne( $id );
128
+			$form = FrmForm::getOne( $id );
129 129
 			$fields = FrmField::get_all_for_form( $id );
130 130
 
131 131
 			$values = FrmAppHelper::setup_edit_vars( $form, 'forms', '', true );
@@ -133,30 +133,30 @@  discard block
 block discarded – undo
133 133
 			$all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' );
134 134
 
135 135
 			require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new.php' );
136
-        } else {
137
-            FrmForm::update( $id, $values, true );
136
+		} else {
137
+			FrmForm::update( $id, $values, true );
138 138
 			$url = admin_url( 'admin.php?page=formidable&frm_action=settings&id=' . $id );
139 139
 			die( FrmAppHelper::js_redirect( $url ) ); // WPCS: XSS ok.
140
-        }
141
-    }
140
+		}
141
+	}
142 142
 
143
-    public static function edit( $values = false ) {
143
+	public static function edit( $values = false ) {
144 144
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
145 145
 
146 146
 		$id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
147 147
 		return self::get_edit_vars( $id );
148
-    }
148
+	}
149 149
 
150
-    public static function settings( $id = false, $message = '' ) {
150
+	public static function settings( $id = false, $message = '' ) {
151 151
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
152 152
 
153 153
 		if ( ! $id || ! is_numeric( $id ) ) {
154 154
 			$id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
155
-        }
155
+		}
156 156
 		return self::get_settings_vars( $id, array(), $message );
157
-    }
157
+	}
158 158
 
159
-    public static function update_settings() {
159
+	public static function update_settings() {
160 160
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
161 161
 
162 162
 		$id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
@@ -170,39 +170,39 @@  discard block
 block discarded – undo
170 170
 
171 171
 		FrmForm::update( $id, $_POST );
172 172
 
173
-        $message = __( 'Settings Successfully Updated', 'formidable' );
173
+		$message = __( 'Settings Successfully Updated', 'formidable' );
174 174
 		return self::get_settings_vars( $id, array(), $message );
175
-    }
175
+	}
176 176
 
177 177
 	public static function update( $values = array() ) {
178 178
 		if ( empty( $values ) ) {
179
-            $values = $_POST;
180
-        }
179
+			$values = $_POST;
180
+		}
181 181
 
182
-        //Set radio button and checkbox meta equal to "other" value
183
-        if ( FrmAppHelper::pro_is_installed() ) {
184
-            $values = FrmProEntry::mod_other_vals( $values, 'back' );
185
-        }
182
+		//Set radio button and checkbox meta equal to "other" value
183
+		if ( FrmAppHelper::pro_is_installed() ) {
184
+			$values = FrmProEntry::mod_other_vals( $values, 'back' );
185
+		}
186 186
 
187
-        $errors = FrmForm::validate( $values );
188
-        $permission_error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'frm_save_form', 'frm_save_form_nonce' );
189
-        if ( $permission_error !== false ) {
190
-            $errors['form'] = $permission_error;
191
-        }
187
+		$errors = FrmForm::validate( $values );
188
+		$permission_error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'frm_save_form', 'frm_save_form_nonce' );
189
+		if ( $permission_error !== false ) {
190
+			$errors['form'] = $permission_error;
191
+		}
192 192
 
193 193
 		$id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
194 194
 
195 195
 		if ( count( $errors ) > 0 ) {
196
-            return self::get_edit_vars( $id, $errors );
196
+			return self::get_edit_vars( $id, $errors );
197 197
 		} else {
198
-            FrmForm::update( $id, $values );
199
-            $message = __( 'Form was Successfully Updated', 'formidable' );
200
-            if ( defined( 'DOING_AJAX' ) ) {
198
+			FrmForm::update( $id, $values );
199
+			$message = __( 'Form was Successfully Updated', 'formidable' );
200
+			if ( defined( 'DOING_AJAX' ) ) {
201 201
 				wp_die( esc_html( $message ) );
202
-            }
202
+			}
203 203
 			return self::get_edit_vars( $id, array(), $message );
204
-        }
205
-    }
204
+		}
205
+	}
206 206
 
207 207
 	/**
208 208
 	 * Redirect to the url for creating from a template
@@ -224,30 +224,30 @@  discard block
 block discarded – undo
224 224
 		wp_die();
225 225
 	}
226 226
 
227
-    public static function duplicate() {
227
+	public static function duplicate() {
228 228
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
229 229
 
230 230
 		$params = FrmForm::list_page_params();
231
-        $form = FrmForm::duplicate( $params['id'], $params['template'], true );
232
-        $message = $params['template'] ? __( 'Form template was Successfully Created', 'formidable' ) : __( 'Form was Successfully Copied', 'formidable' );
233
-        if ( $form ) {
231
+		$form = FrmForm::duplicate( $params['id'], $params['template'], true );
232
+		$message = $params['template'] ? __( 'Form template was Successfully Created', 'formidable' ) : __( 'Form was Successfully Copied', 'formidable' );
233
+		if ( $form ) {
234 234
 			return self::get_edit_vars( $form, array(), $message, true );
235
-        } else {
235
+		} else {
236 236
 			return self::display_forms_list( $params, __( 'There was a problem creating the new template.', 'formidable' ) );
237
-        }
238
-    }
237
+		}
238
+	}
239 239
 
240
-    public static function page_preview() {
240
+	public static function page_preview() {
241 241
 		$params = FrmForm::list_page_params();
242
-        if ( ! $params['form'] ) {
243
-            return;
244
-        }
242
+		if ( ! $params['form'] ) {
243
+			return;
244
+		}
245 245
 
246
-        $form = FrmForm::getOne( $params['form'] );
246
+		$form = FrmForm::getOne( $params['form'] );
247 247
 		if ( $form ) {
248 248
 			return self::show_form( $form->id, '', true, true );
249 249
 		}
250
-    }
250
+	}
251 251
 
252 252
 	/**
253 253
 	 * @since 3.0
@@ -256,11 +256,11 @@  discard block
 block discarded – undo
256 256
 		echo self::page_preview(); // WPCS: XSS ok.
257 257
 	}
258 258
 
259
-    public static function preview() {
260
-        do_action( 'frm_wp' );
259
+	public static function preview() {
260
+		do_action( 'frm_wp' );
261 261
 
262
-        global $frm_vars;
263
-        $frm_vars['preview'] = true;
262
+		global $frm_vars;
263
+		$frm_vars['preview'] = true;
264 264
 
265 265
 		self::load_wp();
266 266
 
@@ -374,22 +374,22 @@  discard block
 block discarded – undo
374 374
 		require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/direct.php' );
375 375
 	}
376 376
 
377
-    public static function untrash() {
377
+	public static function untrash() {
378 378
 		self::change_form_status( 'untrash' );
379
-    }
379
+	}
380 380
 
381 381
 	public static function bulk_untrash( $ids ) {
382 382
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
383 383
 
384
-        $count = FrmForm::set_status( $ids, 'published' );
384
+		$count = FrmForm::set_status( $ids, 'published' );
385 385
 
386 386
 		$message = sprintf( _n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), 1 );
387
-        return $message;
388
-    }
387
+		return $message;
388
+	}
389 389
 
390
-    public static function trash() {
390
+	public static function trash() {
391 391
 		self::change_form_status( 'trash' );
392
-    }
392
+	}
393 393
 
394 394
 	/**
395 395
 	 * @param string $status
@@ -442,12 +442,12 @@  discard block
 block discarded – undo
442 442
 	public static function bulk_trash( $ids ) {
443 443
 		FrmAppHelper::permission_check( 'frm_delete_forms' );
444 444
 
445
-        $count = 0;
446
-        foreach ( $ids as $id ) {
447
-            if ( FrmForm::trash( $id ) ) {
448
-                $count++;
449
-            }
450
-        }
445
+		$count = 0;
446
+		foreach ( $ids as $id ) {
447
+			if ( FrmForm::trash( $id ) ) {
448
+				$count++;
449
+			}
450
+		}
451 451
 
452 452
 		$current_page = FrmAppHelper::get_simple_request(
453 453
 			array(
@@ -462,63 +462,63 @@  discard block
 block discarded – undo
462 462
 			'</a>'
463 463
 		);
464 464
 
465
-        return $message;
466
-    }
465
+		return $message;
466
+	}
467 467
 
468
-    public static function destroy() {
468
+	public static function destroy() {
469 469
 		FrmAppHelper::permission_check( 'frm_delete_forms' );
470 470
 
471 471
 		$params = FrmForm::list_page_params();
472 472
 
473
-        //check nonce url
473
+		//check nonce url
474 474
 		check_admin_referer( 'destroy_form_' . $params['id'] );
475 475
 
476
-        $count = 0;
477
-        if ( FrmForm::destroy( $params['id'] ) ) {
478
-            $count++;
479
-        }
476
+		$count = 0;
477
+		if ( FrmForm::destroy( $params['id'] ) ) {
478
+			$count++;
479
+		}
480 480
 
481 481
 		$message = sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count );
482 482
 
483 483
 		self::display_forms_list( $params, $message );
484
-    }
484
+	}
485 485
 
486 486
 	public static function bulk_destroy( $ids ) {
487 487
 		FrmAppHelper::permission_check( 'frm_delete_forms' );
488 488
 
489
-        $count = 0;
490
-        foreach ( $ids as $id ) {
491
-            $d = FrmForm::destroy( $id );
492
-            if ( $d ) {
493
-                $count++;
494
-            }
495
-        }
489
+		$count = 0;
490
+		foreach ( $ids as $id ) {
491
+			$d = FrmForm::destroy( $id );
492
+			if ( $d ) {
493
+				$count++;
494
+			}
495
+		}
496 496
 
497 497
 		$message = sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count );
498 498
 
499
-        return $message;
500
-    }
499
+		return $message;
500
+	}
501 501
 
502
-    private static function delete_all() {
503
-        //check nonce url
502
+	private static function delete_all() {
503
+		//check nonce url
504 504
 		$permission_error = FrmAppHelper::permission_nonce_error( 'frm_delete_forms', '_wpnonce', 'bulk-toplevel_page_formidable' );
505
-        if ( $permission_error !== false ) {
505
+		if ( $permission_error !== false ) {
506 506
 			self::display_forms_list( array(), '', array( $permission_error ) );
507
-            return;
508
-        }
507
+			return;
508
+		}
509 509
 
510 510
 		$count = FrmForm::scheduled_delete( time() );
511 511
 		$message = sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count );
512 512
 
513 513
 		self::display_forms_list( array(), $message );
514
-    }
514
+	}
515 515
 
516 516
 	/**
517
-	* Inserts Formidable button
518
-	* Hook exists since 2.5.0
519
-	*
520
-	* @since 2.0.15
521
-	*/
517
+	 * Inserts Formidable button
518
+	 * Hook exists since 2.5.0
519
+	 *
520
+	 * @since 2.0.15
521
+	 */
522 522
 	public static function insert_form_button() {
523 523
 		if ( current_user_can( 'frm_view_forms' ) ) {
524 524
 			$menu_name = FrmAppHelper::get_menu_name();
@@ -529,45 +529,45 @@  discard block
 block discarded – undo
529 529
 		}
530 530
 	}
531 531
 
532
-    public static function insert_form_popup() {
532
+	public static function insert_form_popup() {
533 533
 		$page = basename( FrmAppHelper::get_server_value( 'PHP_SELF' ) );
534 534
 		if ( ! in_array( $page, array( 'post.php', 'page.php', 'page-new.php', 'post-new.php' ) ) ) {
535
-            return;
536
-        }
535
+			return;
536
+		}
537 537
 
538
-        FrmAppHelper::load_admin_wide_js();
538
+		FrmAppHelper::load_admin_wide_js();
539 539
 
540
-        $shortcodes = array(
540
+		$shortcodes = array(
541 541
 			'formidable' => array(
542 542
 				'name'  => __( 'Form', 'formidable' ),
543 543
 				'label' => __( 'Insert a Form', 'formidable' ),
544 544
 			),
545
-        );
545
+		);
546 546
 
547 547
 		$shortcodes = apply_filters( 'frm_popup_shortcodes', $shortcodes );
548 548
 
549 549
 		include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/insert_form_popup.php' );
550
-    }
550
+	}
551 551
 
552
-    public static function get_shortcode_opts() {
552
+	public static function get_shortcode_opts() {
553 553
 		FrmAppHelper::permission_check( 'frm_view_forms' );
554
-        check_ajax_referer( 'frm_ajax', 'nonce' );
554
+		check_ajax_referer( 'frm_ajax', 'nonce' );
555 555
 
556 556
 		$shortcode = FrmAppHelper::get_post_param( 'shortcode', '', 'sanitize_text_field' );
557 557
 		if ( empty( $shortcode ) ) {
558
-            wp_die();
559
-        }
558
+			wp_die();
559
+		}
560 560
 
561 561
 		echo '<div id="sc-opts-' . esc_attr( $shortcode ) . '" class="frm_shortcode_option">';
562 562
 		echo '<input type="radio" name="frmsc" value="' . esc_attr( $shortcode ) . '" id="sc-' . esc_attr( $shortcode ) . '" class="frm_hidden" />';
563 563
 
564
-        $form_id = '';
565
-        $opts = array();
564
+		$form_id = '';
565
+		$opts = array();
566 566
 		switch ( $shortcode ) {
567
-            case 'formidable':
568
-                $opts = array(
567
+			case 'formidable':
568
+				$opts = array(
569 569
 					'form_id'       => 'id',
570
-                    //'key' => ',
570
+					//'key' => ',
571 571
 					'title'         => array(
572 572
 						'val'   => 1,
573 573
 						'label' => __( 'Display form title', 'formidable' ),
@@ -580,8 +580,8 @@  discard block
 block discarded – undo
580 580
 						'val'   => 1,
581 581
 						'label' => __( 'Minimize form HTML', 'formidable' ),
582 582
 					),
583
-                );
584
-        }
583
+				);
584
+		}
585 585
 		$opts = apply_filters( 'frm_sc_popup_opts', $opts, $shortcode );
586 586
 
587 587
 		if ( isset( $opts['form_id'] ) && is_string( $opts['form_id'] ) ) {
@@ -592,38 +592,38 @@  discard block
 block discarded – undo
592 592
 
593 593
 		include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/shortcode_opts.php' );
594 594
 
595
-        echo '</div>';
595
+		echo '</div>';
596 596
 
597
-        wp_die();
598
-    }
597
+		wp_die();
598
+	}
599 599
 
600 600
 	public static function display_forms_list( $params = array(), $message = '', $errors = array() ) {
601
-        FrmAppHelper::permission_check( 'frm_view_forms' );
601
+		FrmAppHelper::permission_check( 'frm_view_forms' );
602 602
 
603
-        global $wpdb, $frm_vars;
603
+		global $wpdb, $frm_vars;
604 604
 
605 605
 		if ( empty( $params ) ) {
606 606
 			$params = FrmForm::list_page_params();
607
-        }
607
+		}
608 608
 
609
-        $wp_list_table = new FrmFormsListHelper( compact( 'params' ) );
609
+		$wp_list_table = new FrmFormsListHelper( compact( 'params' ) );
610 610
 
611
-        $pagenum = $wp_list_table->get_pagenum();
611
+		$pagenum = $wp_list_table->get_pagenum();
612 612
 
613
-        $wp_list_table->prepare_items();
613
+		$wp_list_table->prepare_items();
614 614
 
615
-        $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
616
-        if ( $pagenum > $total_pages && $total_pages > 0 ) {
615
+		$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
616
+		if ( $pagenum > $total_pages && $total_pages > 0 ) {
617 617
 			wp_redirect( esc_url_raw( add_query_arg( 'paged', $total_pages ) ) );
618
-            die();
619
-        }
618
+			die();
619
+		}
620 620
 
621 621
 		require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/list.php' );
622
-    }
622
+	}
623 623
 
624 624
 	public static function get_columns( $columns ) {
625
-	    $columns['cb'] = '<input type="checkbox" />';
626
-	    $columns['id'] = 'ID';
625
+		$columns['cb'] = '<input type="checkbox" />';
626
+		$columns['id'] = 'ID';
627 627
 
628 628
 		$type = FrmAppHelper::get_simple_request(
629 629
 			array(
@@ -633,18 +633,18 @@  discard block
 block discarded – undo
633 633
 			)
634 634
 		);
635 635
 
636
-        if ( 'template' == $type ) {
637
-            $columns['name']        = __( 'Template Name', 'formidable' );
638
-            $columns['type']        = __( 'Type', 'formidable' );
639
-            $columns['form_key']    = __( 'Key', 'formidable' );
640
-        } else {
641
-            $columns['name']        = __( 'Form Title', 'formidable' );
642
-            $columns['entries']     = __( 'Entries', 'formidable' );
643
-            $columns['form_key']    = __( 'Key', 'formidable' );
644
-            $columns['shortcode']   = __( 'Shortcodes', 'formidable' );
645
-        }
636
+		if ( 'template' == $type ) {
637
+			$columns['name']        = __( 'Template Name', 'formidable' );
638
+			$columns['type']        = __( 'Type', 'formidable' );
639
+			$columns['form_key']    = __( 'Key', 'formidable' );
640
+		} else {
641
+			$columns['name']        = __( 'Form Title', 'formidable' );
642
+			$columns['entries']     = __( 'Entries', 'formidable' );
643
+			$columns['form_key']    = __( 'Key', 'formidable' );
644
+			$columns['shortcode']   = __( 'Shortcodes', 'formidable' );
645
+		}
646 646
 
647
-        $columns['created_at'] = __( 'Date', 'formidable' );
647
+		$columns['created_at'] = __( 'Date', 'formidable' );
648 648
 
649 649
 		add_screen_option(
650 650
 			'per_page',
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
 			)
656 656
 		);
657 657
 
658
-        return $columns;
658
+		return $columns;
659 659
 	}
660 660
 
661 661
 	public static function get_sortable_columns() {
@@ -685,34 +685,34 @@  discard block
 block discarded – undo
685 685
 	}
686 686
 
687 687
 	public static function save_per_page( $save, $option, $value ) {
688
-        if ( $option == 'formidable_page_formidable_per_page' ) {
689
-            $save = (int) $value;
690
-        }
691
-        return $save;
692
-    }
688
+		if ( $option == 'formidable_page_formidable_per_page' ) {
689
+			$save = (int) $value;
690
+		}
691
+		return $save;
692
+	}
693 693
 
694 694
 	private static function get_edit_vars( $id, $errors = array(), $message = '', $create_link = false ) {
695
-        global $frm_vars;
695
+		global $frm_vars;
696 696
 
697
-        $form = FrmForm::getOne( $id );
698
-        if ( ! $form ) {
699
-            wp_die( esc_html__( 'You are trying to edit a form that does not exist.', 'formidable' ) );
700
-        }
697
+		$form = FrmForm::getOne( $id );
698
+		if ( ! $form ) {
699
+			wp_die( esc_html__( 'You are trying to edit a form that does not exist.', 'formidable' ) );
700
+		}
701 701
 
702
-        if ( $form->parent_form_id ) {
702
+		if ( $form->parent_form_id ) {
703 703
 			wp_die( sprintf( esc_html__( 'You are trying to edit a child form. Please edit from %1$shere%2$s', 'formidable' ), '<a href="' . esc_url( admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . $form->parent_form_id ) ) . '">', '</a>' ) );
704
-        }
704
+		}
705 705
 
706 706
 		$frm_field_selection = FrmField::field_selection();
707 707
 		$fields = FrmField::get_all_for_form( $form->id );
708 708
 
709
-        // Automatically add end section fields if they don't exist (2.0 migration)
710
-        $reset_fields = false;
711
-        FrmFormsHelper::auto_add_end_section_fields( $form, $fields, $reset_fields );
709
+		// Automatically add end section fields if they don't exist (2.0 migration)
710
+		$reset_fields = false;
711
+		FrmFormsHelper::auto_add_end_section_fields( $form, $fields, $reset_fields );
712 712
 
713
-        if ( $reset_fields ) {
714
-            $fields = FrmField::get_all_for_form( $form->id, '', 'exclude' );
715
-        }
713
+		if ( $reset_fields ) {
714
+			$fields = FrmField::get_all_for_form( $form->id, '', 'exclude' );
715
+		}
716 716
 
717 717
 		unset( $end_section_values, $last_order, $open, $reset_fields );
718 718
 
@@ -720,30 +720,30 @@  discard block
 block discarded – undo
720 720
 		$values = FrmAppHelper::setup_edit_vars( $form, 'forms', '', true, array(), $args );
721 721
 		$values['fields'] = $fields;
722 722
 
723
-        $edit_message = __( 'Form was Successfully Updated', 'formidable' );
724
-        if ( $form->is_template && $message == $edit_message ) {
725
-            $message = __( 'Template was Successfully Updated', 'formidable' );
726
-        }
723
+		$edit_message = __( 'Form was Successfully Updated', 'formidable' );
724
+		if ( $form->is_template && $message == $edit_message ) {
725
+			$message = __( 'Template was Successfully Updated', 'formidable' );
726
+		}
727 727
 
728 728
 		$all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' );
729 729
 
730
-        if ( $form->default_template ) {
730
+		if ( $form->default_template ) {
731 731
 			wp_die( esc_html__( 'That template cannot be edited', 'formidable' ) );
732 732
 		} elseif ( defined( 'DOING_AJAX' ) ) {
733
-            wp_die();
734
-        } else if ( $create_link ) {
733
+			wp_die();
734
+		} else if ( $create_link ) {
735 735
 			require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new.php' );
736
-        } else {
736
+		} else {
737 737
 			require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/edit.php' );
738
-        }
739
-    }
738
+		}
739
+	}
740 740
 
741 741
 	public static function get_settings_vars( $id, $errors = array(), $message = '' ) {
742 742
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
743 743
 
744
-        global $frm_vars;
744
+		global $frm_vars;
745 745
 
746
-        $form = FrmForm::getOne( $id );
746
+		$form = FrmForm::getOne( $id );
747 747
 
748 748
 		$fields = FrmField::get_all_for_form( $id );
749 749
 		$values = FrmAppHelper::setup_edit_vars( $form, 'forms', $fields, true );
@@ -754,17 +754,17 @@  discard block
 block discarded – undo
754 754
 
755 755
 		self::clean_submit_html( $values );
756 756
 
757
-        $action_controls = FrmFormActionsController::get_form_actions();
757
+		$action_controls = FrmFormActionsController::get_form_actions();
758 758
 
759 759
 		$sections = apply_filters( 'frm_add_form_settings_section', array(), $values );
760
-        $pro_feature = FrmAppHelper::pro_is_installed() ? '' : ' class="pro_feature"';
760
+		$pro_feature = FrmAppHelper::pro_is_installed() ? '' : ' class="pro_feature"';
761 761
 
762 762
 		$styles = apply_filters( 'frm_get_style_opts', array() );
763 763
 
764 764
 		$first_h3 = 'frm_first_h3';
765 765
 
766 766
 		require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/settings.php' );
767
-    }
767
+	}
768 768
 
769 769
 	/**
770 770
 	 * Replace old Submit Button href with new href to avoid errors in Chrome
@@ -779,10 +779,10 @@  discard block
 block discarded – undo
779 779
 		}
780 780
 	}
781 781
 
782
-    public static function mb_tags_box( $form_id, $class = '' ) {
782
+	public static function mb_tags_box( $form_id, $class = '' ) {
783 783
 		$fields = FrmField::get_all_for_form( $form_id, '', 'include' );
784
-        $linked_forms = array();
785
-        $col = 'one';
784
+		$linked_forms = array();
785
+		$col = 'one';
786 786
 		$settings_tab = FrmAppHelper::is_admin_page( 'formidable' ) ? true : false;
787 787
 
788 788
 		$cond_shortcodes = apply_filters( 'frm_conditional_shortcodes', array() );
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 		$advanced_helpers = self::advanced_helpers( compact( 'fields', 'form_id' ) );
792 792
 
793 793
 		include( FrmAppHelper::plugin_path() . '/classes/views/shared/mb_adv_info.php' );
794
-    }
794
+	}
795 795
 
796 796
 	/**
797 797
 	 * @since 3.04.01
@@ -882,7 +882,7 @@  discard block
 block discarded – undo
882 882
 			''          => '',
883 883
 			'siteurl'   => __( 'Site URL', 'formidable' ),
884 884
 			'sitename'  => __( 'Site Name', 'formidable' ),
885
-        );
885
+		);
886 886
 
887 887
 		if ( ! FrmAppHelper::pro_is_installed() ) {
888 888
 			unset( $entry_shortcodes['post_id'] );
@@ -931,21 +931,21 @@  discard block
 block discarded – undo
931 931
 		wp_die();
932 932
 	}
933 933
 
934
-    public static function filter_content( $content, $form, $entry = false ) {
934
+	public static function filter_content( $content, $form, $entry = false ) {
935 935
 		self::get_entry_by_param( $entry );
936
-        if ( ! $entry ) {
937
-            return $content;
938
-        }
936
+		if ( ! $entry ) {
937
+			return $content;
938
+		}
939 939
 
940
-        if ( is_object( $form ) ) {
941
-            $form = $form->id;
942
-        }
940
+		if ( is_object( $form ) ) {
941
+			$form = $form->id;
942
+		}
943 943
 
944
-        $shortcodes = FrmFieldsHelper::get_shortcodes( $content, $form );
945
-        $content = apply_filters( 'frm_replace_content_shortcodes', $content, $entry, $shortcodes );
944
+		$shortcodes = FrmFieldsHelper::get_shortcodes( $content, $form );
945
+		$content = apply_filters( 'frm_replace_content_shortcodes', $content, $entry, $shortcodes );
946 946
 
947
-        return $content;
948
-    }
947
+		return $content;
948
+	}
949 949
 
950 950
 	private static function get_entry_by_param( &$entry ) {
951 951
 		if ( ! $entry || ! is_object( $entry ) ) {
@@ -957,151 +957,151 @@  discard block
 block discarded – undo
957 957
 		}
958 958
 	}
959 959
 
960
-    public static function replace_content_shortcodes( $content, $entry, $shortcodes ) {
961
-        return FrmFieldsHelper::replace_content_shortcodes( $content, $entry, $shortcodes );
962
-    }
960
+	public static function replace_content_shortcodes( $content, $entry, $shortcodes ) {
961
+		return FrmFieldsHelper::replace_content_shortcodes( $content, $entry, $shortcodes );
962
+	}
963 963
 
964
-    public static function process_bulk_form_actions( $errors ) {
965
-        if ( ! $_REQUEST ) {
966
-            return $errors;
967
-        }
964
+	public static function process_bulk_form_actions( $errors ) {
965
+		if ( ! $_REQUEST ) {
966
+			return $errors;
967
+		}
968 968
 
969 969
 		$bulkaction = FrmAppHelper::get_param( 'action', '', 'get', 'sanitize_text_field' );
970
-        if ( $bulkaction == -1 ) {
970
+		if ( $bulkaction == -1 ) {
971 971
 			$bulkaction = FrmAppHelper::get_param( 'action2', '', 'get', 'sanitize_title' );
972
-        }
972
+		}
973 973
 
974
-        if ( ! empty( $bulkaction ) && strpos( $bulkaction, 'bulk_' ) === 0 ) {
975
-            FrmAppHelper::remove_get_action();
974
+		if ( ! empty( $bulkaction ) && strpos( $bulkaction, 'bulk_' ) === 0 ) {
975
+			FrmAppHelper::remove_get_action();
976 976
 
977
-            $bulkaction = str_replace( 'bulk_', '', $bulkaction );
978
-        }
977
+			$bulkaction = str_replace( 'bulk_', '', $bulkaction );
978
+		}
979 979
 
980 980
 		$ids = FrmAppHelper::get_param( 'item-action', '', 'get', 'sanitize_text_field' );
981
-        if ( empty( $ids ) ) {
982
-            $errors[] = __( 'No forms were specified', 'formidable' );
983
-            return $errors;
984
-        }
985
-
986
-        $permission_error = FrmAppHelper::permission_nonce_error( '', '_wpnonce', 'bulk-toplevel_page_formidable' );
987
-        if ( $permission_error !== false ) {
988
-            $errors[] = $permission_error;
989
-            return $errors;
990
-        }
991
-
992
-        if ( ! is_array( $ids ) ) {
993
-            $ids = explode( ',', $ids );
994
-        }
995
-
996
-        switch ( $bulkaction ) {
997
-            case 'delete':
998
-                $message = self::bulk_destroy( $ids );
981
+		if ( empty( $ids ) ) {
982
+			$errors[] = __( 'No forms were specified', 'formidable' );
983
+			return $errors;
984
+		}
985
+
986
+		$permission_error = FrmAppHelper::permission_nonce_error( '', '_wpnonce', 'bulk-toplevel_page_formidable' );
987
+		if ( $permission_error !== false ) {
988
+			$errors[] = $permission_error;
989
+			return $errors;
990
+		}
991
+
992
+		if ( ! is_array( $ids ) ) {
993
+			$ids = explode( ',', $ids );
994
+		}
995
+
996
+		switch ( $bulkaction ) {
997
+			case 'delete':
998
+				$message = self::bulk_destroy( $ids );
999 999
 				break;
1000
-            case 'trash':
1001
-                $message = self::bulk_trash( $ids );
1000
+			case 'trash':
1001
+				$message = self::bulk_trash( $ids );
1002 1002
 				break;
1003
-            case 'untrash':
1004
-                $message = self::bulk_untrash( $ids );
1005
-        }
1003
+			case 'untrash':
1004
+				$message = self::bulk_untrash( $ids );
1005
+		}
1006 1006
 
1007
-        if ( isset( $message ) && ! empty( $message ) ) {
1007
+		if ( isset( $message ) && ! empty( $message ) ) {
1008 1008
 			echo '<div id="message" class="frm_updated_message">' . FrmAppHelper::kses( $message, array( 'a' ) ) . '</div>'; // WPCS: XSS ok.
1009
-        }
1009
+		}
1010 1010
 
1011
-        return $errors;
1012
-    }
1011
+		return $errors;
1012
+	}
1013 1013
 
1014
-    public static function route() {
1014
+	public static function route() {
1015 1015
 		$action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
1016
-        $vars = array();
1016
+		$vars = array();
1017 1017
 		if ( isset( $_POST['frm_compact_fields'] ) ) {
1018 1018
 			FrmAppHelper::permission_check( 'frm_edit_forms' );
1019 1019
 
1020 1020
 			$json_vars = htmlspecialchars_decode( nl2br( stripslashes( str_replace( '&quot;', '\\\"', $_POST['frm_compact_fields'] ) ) ) );
1021 1021
 			$json_vars = json_decode( $json_vars, true );
1022 1022
 			if ( empty( $json_vars ) ) {
1023
-                // json decoding failed so we should return an error message
1023
+				// json decoding failed so we should return an error message
1024 1024
 				$action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
1025
-                if ( 'edit' == $action ) {
1026
-                    $action = 'update';
1027
-                }
1025
+				if ( 'edit' == $action ) {
1026
+					$action = 'update';
1027
+				}
1028 1028
 
1029 1029
 				add_filter( 'frm_validate_form', 'FrmFormsController::json_error' );
1030
-            } else {
1030
+			} else {
1031 1031
 				$vars = FrmAppHelper::json_to_array( $json_vars );
1032
-                $action = $vars[ $action ];
1032
+				$action = $vars[ $action ];
1033 1033
 				unset( $_REQUEST['frm_compact_fields'], $_POST['frm_compact_fields'] );
1034 1034
 				$_REQUEST = array_merge( $_REQUEST, $vars );
1035 1035
 				$_POST = array_merge( $_POST, $_REQUEST );
1036
-            }
1037
-        } else {
1036
+			}
1037
+		} else {
1038 1038
 			$action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
1039
-    		if ( isset( $_REQUEST['delete_all'] ) ) {
1040
-                // override the action for this page
1041
-    			$action = 'delete_all';
1042
-            }
1043
-        }
1039
+			if ( isset( $_REQUEST['delete_all'] ) ) {
1040
+				// override the action for this page
1041
+				$action = 'delete_all';
1042
+			}
1043
+		}
1044 1044
 
1045 1045
 		add_action( 'frm_load_form_hooks', 'FrmHooksController::trigger_load_form_hooks' );
1046
-        FrmAppHelper::trigger_hook_load( 'form' );
1046
+		FrmAppHelper::trigger_hook_load( 'form' );
1047 1047
 
1048
-        switch ( $action ) {
1049
-            case 'new':
1048
+		switch ( $action ) {
1049
+			case 'new':
1050 1050
 				return self::new_form( $vars );
1051
-            case 'create':
1052
-            case 'edit':
1053
-            case 'update':
1054
-            case 'duplicate':
1055
-            case 'trash':
1056
-            case 'untrash':
1057
-            case 'destroy':
1058
-            case 'delete_all':
1059
-            case 'settings':
1060
-            case 'update_settings':
1051
+			case 'create':
1052
+			case 'edit':
1053
+			case 'update':
1054
+			case 'duplicate':
1055
+			case 'trash':
1056
+			case 'untrash':
1057
+			case 'destroy':
1058
+			case 'delete_all':
1059
+			case 'settings':
1060
+			case 'update_settings':
1061 1061
 				return self::$action( $vars );
1062
-            default:
1062
+			default:
1063 1063
 				do_action( 'frm_form_action_' . $action );
1064 1064
 				if ( apply_filters( 'frm_form_stop_action_' . $action, false ) ) {
1065
-                    return;
1066
-                }
1065
+					return;
1066
+				}
1067 1067
 
1068 1068
 				$action = FrmAppHelper::get_param( 'action', '', 'get', 'sanitize_text_field' );
1069
-                if ( $action == -1 ) {
1069
+				if ( $action == -1 ) {
1070 1070
 					$action = FrmAppHelper::get_param( 'action2', '', 'get', 'sanitize_title' );
1071
-                }
1071
+				}
1072 1072
 
1073 1073
 				if ( strpos( $action, 'bulk_' ) === 0 ) {
1074
-                    FrmAppHelper::remove_get_action();
1075
-                    return self::list_form();
1076
-                }
1074
+					FrmAppHelper::remove_get_action();
1075
+					return self::list_form();
1076
+				}
1077 1077
 
1078
-                return self::display_forms_list();
1079
-        }
1080
-    }
1078
+				return self::display_forms_list();
1079
+		}
1080
+	}
1081 1081
 
1082
-    public static function json_error( $errors ) {
1083
-        $errors['json'] = __( 'Abnormal HTML characters prevented your form from saving correctly', 'formidable' );
1084
-        return $errors;
1085
-    }
1082
+	public static function json_error( $errors ) {
1083
+		$errors['json'] = __( 'Abnormal HTML characters prevented your form from saving correctly', 'formidable' );
1084
+		return $errors;
1085
+	}
1086 1086
 
1087 1087
 
1088
-    /* FRONT-END FORMS */
1089
-    public static function admin_bar_css() {
1088
+	/* FRONT-END FORMS */
1089
+	public static function admin_bar_css() {
1090 1090
 		if ( is_admin() || ! current_user_can( 'frm_edit_forms' ) ) {
1091
-            return;
1092
-        }
1091
+			return;
1092
+		}
1093 1093
 
1094 1094
 		add_action( 'wp_before_admin_bar_render', 'FrmFormsController::admin_bar_configure' );
1095 1095
 		FrmAppHelper::load_font_style();
1096 1096
 	}
1097 1097
 
1098 1098
 	public static function admin_bar_configure() {
1099
-        global $frm_vars;
1099
+		global $frm_vars;
1100 1100
 		if ( empty( $frm_vars['forms_loaded'] ) ) {
1101
-            return;
1102
-        }
1101
+			return;
1102
+		}
1103 1103
 
1104
-        $actions = array();
1104
+		$actions = array();
1105 1105
 		foreach ( $frm_vars['forms_loaded'] as $form ) {
1106 1106
 			if ( is_object( $form ) ) {
1107 1107
 				$actions[ $form->id ] = $form->name;
@@ -1156,18 +1156,18 @@  discard block
 block discarded – undo
1156 1156
 		}
1157 1157
 	}
1158 1158
 
1159
-    //formidable shortcode
1159
+	//formidable shortcode
1160 1160
 	public static function get_form_shortcode( $atts ) {
1161
-        global $frm_vars;
1161
+		global $frm_vars;
1162 1162
 		if ( isset( $frm_vars['skip_shortcode'] ) && $frm_vars['skip_shortcode'] ) {
1163
-            $sc = '[formidable';
1163
+			$sc = '[formidable';
1164 1164
 			if ( ! empty( $atts ) ) {
1165 1165
 				foreach ( $atts as $k => $v ) {
1166 1166
 					$sc .= ' ' . $k . '="' . esc_attr( $v ) . '"';
1167 1167
 				}
1168 1168
 			}
1169 1169
 			return $sc . ']';
1170
-        }
1170
+		}
1171 1171
 
1172 1172
 		$shortcode_atts = shortcode_atts(
1173 1173
 			array(
@@ -1185,27 +1185,27 @@  discard block
 block discarded – undo
1185 1185
 		);
1186 1186
 		do_action( 'formidable_shortcode_atts', $shortcode_atts, $atts );
1187 1187
 
1188
-        return self::show_form( $shortcode_atts['id'], $shortcode_atts['key'], $shortcode_atts['title'], $shortcode_atts['description'], $atts );
1189
-    }
1188
+		return self::show_form( $shortcode_atts['id'], $shortcode_atts['key'], $shortcode_atts['title'], $shortcode_atts['description'], $atts );
1189
+	}
1190 1190
 
1191
-    public static function show_form( $id = '', $key = '', $title = false, $description = false, $atts = array() ) {
1192
-        if ( empty( $id ) ) {
1193
-            $id = $key;
1194
-        }
1191
+	public static function show_form( $id = '', $key = '', $title = false, $description = false, $atts = array() ) {
1192
+		if ( empty( $id ) ) {
1193
+			$id = $key;
1194
+		}
1195 1195
 
1196
-        $form = self::maybe_get_form_to_show( $id );
1197
-        if ( ! $form ) {
1198
-            return __( 'Please select a valid form', 'formidable' );
1199
-        }
1196
+		$form = self::maybe_get_form_to_show( $id );
1197
+		if ( ! $form ) {
1198
+			return __( 'Please select a valid form', 'formidable' );
1199
+		}
1200 1200
 
1201 1201
 		FrmAppController::maybe_update_styles();
1202 1202
 
1203 1203
 		add_action( 'frm_load_form_hooks', 'FrmHooksController::trigger_load_form_hooks' );
1204
-        FrmAppHelper::trigger_hook_load( 'form', $form );
1204
+		FrmAppHelper::trigger_hook_load( 'form', $form );
1205 1205
 
1206
-        $form = apply_filters( 'frm_pre_display_form', $form );
1206
+		$form = apply_filters( 'frm_pre_display_form', $form );
1207 1207
 
1208
-        $frm_settings = FrmAppHelper::get_settings();
1208
+		$frm_settings = FrmAppHelper::get_settings();
1209 1209
 
1210 1210
 		if ( self::is_viewable_draft_form( $form ) ) {
1211 1211
 			// don't show a draft form on a page
@@ -1227,7 +1227,7 @@  discard block
 block discarded – undo
1227 1227
 		}
1228 1228
 
1229 1229
 		return $form;
1230
-    }
1230
+	}
1231 1231
 
1232 1232
 	private static function maybe_get_form_to_show( $id ) {
1233 1233
 		$form = false;
@@ -1256,21 +1256,21 @@  discard block
 block discarded – undo
1256 1256
 		return $form->logged_in && get_current_user_id() && isset( $form->options['logged_in_role'] ) && $form->options['logged_in_role'] != '' && ! FrmAppHelper::user_has_permission( $form->options['logged_in_role'] );
1257 1257
 	}
1258 1258
 
1259
-    public static function get_form( $form, $title, $description, $atts = array() ) {
1259
+	public static function get_form( $form, $title, $description, $atts = array() ) {
1260 1260
 		ob_start();
1261 1261
 
1262 1262
 		do_action( 'frm_before_get_form', $atts );
1263 1263
 
1264
-        self::get_form_contents( $form, $title, $description, $atts );
1264
+		self::get_form_contents( $form, $title, $description, $atts );
1265 1265
 		self::enqueue_scripts( FrmForm::get_params( $form ) );
1266 1266
 
1267
-        $contents = ob_get_contents();
1268
-        ob_end_clean();
1267
+		$contents = ob_get_contents();
1268
+		ob_end_clean();
1269 1269
 
1270 1270
 		self::maybe_minimize_form( $atts, $contents );
1271 1271
 
1272
-        return $contents;
1273
-    }
1272
+		return $contents;
1273
+	}
1274 1274
 
1275 1275
 	public static function enqueue_scripts( $params ) {
1276 1276
 		do_action( 'frm_enqueue_form_scripts', $params );
@@ -1616,10 +1616,10 @@  discard block
 block discarded – undo
1616 1616
 	}
1617 1617
 
1618 1618
 	public static function defer_script_loading( $tag, $handle ) {
1619
-	    if ( 'recaptcha-api' == $handle && ! strpos( $tag, 'defer' ) ) {
1620
-	        $tag = str_replace( ' src', ' defer="defer" async="async" src', $tag );
1619
+		if ( 'recaptcha-api' == $handle && ! strpos( $tag, 'defer' ) ) {
1620
+			$tag = str_replace( ' src', ' defer="defer" async="async" src', $tag );
1621 1621
 		}
1622
-	    return $tag;
1622
+		return $tag;
1623 1623
 	}
1624 1624
 
1625 1625
 	public static function footer_js( $location = 'footer' ) {
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
         global $frm_vars;
65 65
 
66 66
 		$action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
67
-		$action = empty( $values ) ? FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ) : $values[ $action ];
67
+		$action = empty( $values ) ? FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ) : $values[$action];
68 68
 
69 69
 		if ( $action == 'create' ) {
70 70
 			self::create( $values );
@@ -408,11 +408,11 @@  discard block
 block discarded – undo
408 408
 			),
409 409
 		);
410 410
 
411
-		if ( ! isset( $available_status[ $status ] ) ) {
411
+		if ( ! isset( $available_status[$status] ) ) {
412 412
 			return;
413 413
 		}
414 414
 
415
-		FrmAppHelper::permission_check( $available_status[ $status ]['permission'] );
415
+		FrmAppHelper::permission_check( $available_status[$status]['permission'] );
416 416
 
417 417
 		$params = FrmForm::list_page_params();
418 418
 
@@ -420,8 +420,8 @@  discard block
 block discarded – undo
420 420
 		check_admin_referer( $status . '_form_' . $params['id'] );
421 421
 
422 422
 		$count = 0;
423
-		if ( FrmForm::set_status( $params['id'], $available_status[ $status ]['new_status'] ) ) {
424
-			$count++;
423
+		if ( FrmForm::set_status( $params['id'], $available_status[$status]['new_status'] ) ) {
424
+			$count ++;
425 425
 		}
426 426
 
427 427
 		$form_type = FrmAppHelper::get_simple_request(
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 		$available_status['untrash']['message'] = sprintf( _n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), $count );
435 435
 		$available_status['trash']['message'] = sprintf( _n( '%1$s form moved to the Trash. %2$sUndo%3$s', '%1$s forms moved to the Trash. %2$sUndo%3$s', $count, 'formidable' ), $count, '<a href="' . esc_url( wp_nonce_url( '?page=formidable&frm_action=untrash&form_type=' . $form_type . '&id=' . $params['id'], 'untrash_form_' . $params['id'] ) ) . '">', '</a>' );
436 436
 
437
-		$message = $available_status[ $status ]['message'];
437
+		$message = $available_status[$status]['message'];
438 438
 
439 439
 		self::display_forms_list( $params, $message );
440 440
 	}
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
         $count = 0;
446 446
         foreach ( $ids as $id ) {
447 447
             if ( FrmForm::trash( $id ) ) {
448
-                $count++;
448
+                $count ++;
449 449
             }
450 450
         }
451 451
 
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 
476 476
         $count = 0;
477 477
         if ( FrmForm::destroy( $params['id'] ) ) {
478
-            $count++;
478
+            $count ++;
479 479
         }
480 480
 
481 481
 		$message = sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count );
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
         foreach ( $ids as $id ) {
491 491
             $d = FrmForm::destroy( $id );
492 492
             if ( $d ) {
493
-                $count++;
493
+                $count ++;
494 494
             }
495 495
         }
496 496
 
@@ -808,7 +808,7 @@  discard block
 block discarded – undo
808 808
 		if ( ! empty( $user_fields ) ) {
809 809
 			$user_helpers = array();
810 810
 			foreach ( $user_fields as $uk => $uf ) {
811
-				$user_helpers[ '|user_id| show="' . $uk . '"' ] = $uf;
811
+				$user_helpers['|user_id| show="' . $uk . '"'] = $uf;
812 812
 				unset( $uk, $uf );
813 813
 			}
814 814
 
@@ -1029,7 +1029,7 @@  discard block
 block discarded – undo
1029 1029
 				add_filter( 'frm_validate_form', 'FrmFormsController::json_error' );
1030 1030
             } else {
1031 1031
 				$vars = FrmAppHelper::json_to_array( $json_vars );
1032
-                $action = $vars[ $action ];
1032
+                $action = $vars[$action];
1033 1033
 				unset( $_REQUEST['frm_compact_fields'], $_POST['frm_compact_fields'] );
1034 1034
 				$_REQUEST = array_merge( $_REQUEST, $vars );
1035 1035
 				$_POST = array_merge( $_POST, $_REQUEST );
@@ -1104,7 +1104,7 @@  discard block
 block discarded – undo
1104 1104
         $actions = array();
1105 1105
 		foreach ( $frm_vars['forms_loaded'] as $form ) {
1106 1106
 			if ( is_object( $form ) ) {
1107
-				$actions[ $form->id ] = $form->name;
1107
+				$actions[$form->id] = $form->name;
1108 1108
 			}
1109 1109
 			unset( $form );
1110 1110
 		}
@@ -1323,8 +1323,8 @@  discard block
 block discarded – undo
1323 1323
 	private static function get_saved_errors( $form, $params ) {
1324 1324
 		global $frm_vars;
1325 1325
 
1326
-		if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][ $form->id ] ) ) {
1327
-			$errors = $frm_vars['created_entries'][ $form->id ]['errors'];
1326
+		if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][$form->id] ) ) {
1327
+			$errors = $frm_vars['created_entries'][$form->id]['errors'];
1328 1328
 		} else {
1329 1329
 			$errors = array();
1330 1330
 		}
@@ -1336,7 +1336,7 @@  discard block
 block discarded – undo
1336 1336
 	 */
1337 1337
 	public static function just_created_entry( $form_id ) {
1338 1338
 		global $frm_vars;
1339
-		return ( isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][ $form_id ] ) && isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) ? $frm_vars['created_entries'][ $form_id ]['entry_id'] : 0;
1339
+		return ( isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][$form_id] ) && isset( $frm_vars['created_entries'][$form_id]['entry_id'] ) ) ? $frm_vars['created_entries'][$form_id]['entry_id'] : 0;
1340 1340
 	}
1341 1341
 
1342 1342
 	/**
@@ -1344,7 +1344,7 @@  discard block
 block discarded – undo
1344 1344
 	 */
1345 1345
 	private static function get_confirmation_method( $atts ) {
1346 1346
 		$opt = 'success_action';
1347
-		$method = ( isset( $atts['form']->options[ $opt ] ) && ! empty( $atts['form']->options[ $opt ] ) ) ? $atts['form']->options[ $opt ] : 'message';
1347
+		$method = ( isset( $atts['form']->options[$opt] ) && ! empty( $atts['form']->options[$opt] ) ) ? $atts['form']->options[$opt] : 'message';
1348 1348
 		$method = apply_filters( 'frm_success_filter', $method, $atts['form'], 'create' );
1349 1349
 
1350 1350
 		if ( $method != 'message' && ( ! $atts['entry_id'] || ! is_numeric( $atts['entry_id'] ) ) ) {
@@ -1357,7 +1357,7 @@  discard block
 block discarded – undo
1357 1357
 	public static function maybe_trigger_redirect( $form, $params, $args ) {
1358 1358
 		if ( ! isset( $params['id'] ) ) {
1359 1359
 			global $frm_vars;
1360
-			$params['id'] = $frm_vars['created_entries'][ $form->id ]['entry_id'];
1360
+			$params['id'] = $frm_vars['created_entries'][$form->id]['entry_id'];
1361 1361
 		}
1362 1362
 
1363 1363
 		$conf_method = self::get_confirmation_method(
@@ -1399,7 +1399,7 @@  discard block
 block discarded – undo
1399 1399
 
1400 1400
 		$opt = ( ! isset( $args['action'] ) || $args['action'] == 'create' ) ? 'success' : 'edit';
1401 1401
 		$args['success_opt'] = $opt;
1402
-		if ( $args['conf_method'] == 'page' && is_numeric( $args['form']->options[ $opt . '_page_id' ] ) ) {
1402
+		if ( $args['conf_method'] == 'page' && is_numeric( $args['form']->options[$opt . '_page_id'] ) ) {
1403 1403
 			self::load_page_after_submit( $args );
1404 1404
 		} elseif ( $args['conf_method'] == 'redirect' ) {
1405 1405
 			self::redirect_after_submit( $args );
@@ -1414,8 +1414,8 @@  discard block
 block discarded – undo
1414 1414
 	private static function load_page_after_submit( $args ) {
1415 1415
 		global $post;
1416 1416
 		$opt = $args['success_opt'];
1417
-		if ( ! $post || $args['form']->options[ $opt . '_page_id' ] != $post->ID ) {
1418
-			$page = get_post( $args['form']->options[ $opt . '_page_id' ] );
1417
+		if ( ! $post || $args['form']->options[$opt . '_page_id'] != $post->ID ) {
1418
+			$page = get_post( $args['form']->options[$opt . '_page_id'] );
1419 1419
 			$old_post = $post;
1420 1420
 			$post = $page;
1421 1421
 			$content = apply_filters( 'frm_content', $page->post_content, $args['form'], $args['entry_id'] );
@@ -1433,11 +1433,11 @@  discard block
 block discarded – undo
1433 1433
 		add_filter( 'frm_use_wpautop', '__return_false' );
1434 1434
 
1435 1435
 		$opt = $args['success_opt'];
1436
-		$success_url = trim( $args['form']->options[ $opt . '_url' ] );
1436
+		$success_url = trim( $args['form']->options[$opt . '_url'] );
1437 1437
 		$success_url = apply_filters( 'frm_content', $success_url, $args['form'], $args['entry_id'] );
1438 1438
 		$success_url = do_shortcode( $success_url );
1439 1439
 
1440
-		$success_msg = isset( $args['form']->options[ $opt . '_msg' ] ) ? $args['form']->options[ $opt . '_msg' ] : __( 'Please wait while you are redirected.', 'formidable' );
1440
+		$success_msg = isset( $args['form']->options[$opt . '_msg'] ) ? $args['form']->options[$opt . '_msg'] : __( 'Please wait while you are redirected.', 'formidable' );
1441 1441
 
1442 1442
 		$redirect_msg = self::get_redirect_message( $success_url, $success_msg, $args );
1443 1443
 
Please login to merge, or discard this patch.
classes/helpers/FrmAppHelper.php 2 patches
Doc Comments   +22 added lines patch added patch discarded remove patch
@@ -67,12 +67,16 @@  discard block
 block discarded – undo
67 67
 		return $url;
68 68
 	}
69 69
 
70
+	/**
71
+	 * @return string
72
+	 */
70 73
 	public static function get_affiliate() {
71 74
 		return absint( apply_filters( 'frm_affiliate_id', 0 ) );
72 75
 	}
73 76
 
74 77
 	/**
75 78
 	 * @since 3.04.02
79
+	 * @param string $medium
76 80
 	 */
77 81
 	public static function admin_upgrade_link( $medium, $page = '' ) {
78 82
 		if ( empty( $page ) ) {
@@ -104,6 +108,9 @@  discard block
 block discarded – undo
104 108
 		return $frm_settings;
105 109
 	}
106 110
 
111
+	/**
112
+	 * @return string
113
+	 */
107 114
 	public static function get_menu_name() {
108 115
 		$frm_settings = FrmAppHelper::get_settings();
109 116
 		return $frm_settings->menu;
@@ -820,6 +827,9 @@  discard block
 block discarded – undo
820 827
 		return ( is_array( $values ) && in_array( $current, $values ) ) || ( ! is_array( $values ) && $values == $current );
821 828
 	}
822 829
 
830
+	/**
831
+	 * @param string $function
832
+	 */
823 833
 	public static function recursive_function_map( $value, $function ) {
824 834
 		if ( is_array( $value ) ) {
825 835
 			$original_function = $function;
@@ -867,6 +877,9 @@  discard block
 block discarded – undo
867 877
         return $return;
868 878
     }
869 879
 
880
+	/**
881
+	 * @return string
882
+	 */
870 883
 	public static function esc_textarea( $text, $is_rich_text = false ) {
871 884
 		$safe_text = str_replace( '&quot;', '"', $text );
872 885
 		if ( ! $is_rich_text ) {
@@ -1059,6 +1072,9 @@  discard block
 block discarded – undo
1059 1072
         return $values;
1060 1073
     }
1061 1074
 
1075
+	/**
1076
+	 * @param string $fields
1077
+	 */
1062 1078
 	private static function prepare_field_arrays( $fields, $record, array &$values, $args ) {
1063 1079
 		if ( ! empty( $fields ) ) {
1064 1080
 			foreach ( (array) $fields as $field ) {
@@ -1261,6 +1277,9 @@  discard block
 block discarded – undo
1261 1277
 		return $sub . ( ( $len < $original_len ) ? $continue : '' );
1262 1278
     }
1263 1279
 
1280
+	/**
1281
+	 * @param string[] $function_names
1282
+	 */
1264 1283
 	public static function mb_function( $function_names, $args ) {
1265 1284
 		$mb_function_name = $function_names[0];
1266 1285
 		$function_name = $function_names[1];
@@ -1294,6 +1313,9 @@  discard block
 block discarded – undo
1294 1313
         return $formatted;
1295 1314
     }
1296 1315
 
1316
+	/**
1317
+	 * @param string $time_format
1318
+	 */
1297 1319
 	private static function add_time_to_date( $time_format, $date ) {
1298 1320
 		if ( empty( $time_format ) ) {
1299 1321
 			$time_format = get_option( 'time_format' );
Please login to merge, or discard this patch.
Indentation   +551 added lines, -551 removed lines patch added patch discarded remove patch
@@ -13,15 +13,15 @@  discard block
 block discarded – undo
13 13
 	 */
14 14
 	public static $plug_version = '3.04.02';
15 15
 
16
-    /**
17
-     * @since 1.07.02
18
-     *
19
-     * @param none
20
-     * @return string The version of this plugin
21
-     */
22
-    public static function plugin_version() {
23
-        return self::$plug_version;
24
-    }
16
+	/**
17
+	 * @since 1.07.02
18
+	 *
19
+	 * @param none
20
+	 * @return string The version of this plugin
21
+	 */
22
+	public static function plugin_version() {
23
+		return self::$plug_version;
24
+	}
25 25
 
26 26
 	public static function plugin_folder() {
27 27
 		return basename( self::plugin_path() );
@@ -31,29 +31,29 @@  discard block
 block discarded – undo
31 31
 		return dirname( dirname( dirname( __FILE__ ) ) );
32 32
 	}
33 33
 
34
-    public static function plugin_url() {
35
-        //prevously FRM_URL constant
34
+	public static function plugin_url() {
35
+		//prevously FRM_URL constant
36 36
 		return plugins_url( '', self::plugin_path() . '/formidable.php' );
37
-    }
37
+	}
38 38
 
39 39
 	public static function relative_plugin_url() {
40 40
 		return str_replace( array( 'https:', 'http:' ), '', self::plugin_url() );
41 41
 	}
42 42
 
43
-    /**
44
-     * @return string Site URL
45
-     */
46
-    public static function site_url() {
47
-        return site_url();
48
-    }
49
-
50
-    /**
51
-     * Get the name of this site
52
-     * Used for [sitename] shortcode
53
-     *
54
-     * @since 2.0
55
-     * @return string
56
-     */
43
+	/**
44
+	 * @return string Site URL
45
+	 */
46
+	public static function site_url() {
47
+		return site_url();
48
+	}
49
+
50
+	/**
51
+	 * Get the name of this site
52
+	 * Used for [sitename] shortcode
53
+	 *
54
+	 * @since 2.0
55
+	 * @return string
56
+	 */
57 57
 	public static function site_name() {
58 58
 		return get_option( 'blogname' );
59 59
 	}
@@ -88,14 +88,14 @@  discard block
 block discarded – undo
88 88
 		return add_query_arg( $query_args, $page );
89 89
 	}
90 90
 
91
-    /**
92
-     * Get the Formidable settings
93
-     *
94
-     * @since 2.0
95
-     *
96
-     * @param None
97
-     * @return FrmSettings $frm_setings
98
-     */
91
+	/**
92
+	 * Get the Formidable settings
93
+	 *
94
+	 * @since 2.0
95
+	 *
96
+	 * @param None
97
+	 * @return FrmSettings $frm_setings
98
+	 */
99 99
 	public static function get_settings() {
100 100
 		global $frm_settings;
101 101
 		if ( empty( $frm_settings ) ) {
@@ -136,50 +136,50 @@  discard block
 block discarded – undo
136 136
 		return $is_formidable;
137 137
 	}
138 138
 
139
-    /**
140
-     * Check for certain page in Formidable settings
141
-     *
142
-     * @since 2.0
143
-     *
144
-     * @param string $page The name of the page to check
145
-     * @return boolean
146
-     */
139
+	/**
140
+	 * Check for certain page in Formidable settings
141
+	 *
142
+	 * @since 2.0
143
+	 *
144
+	 * @param string $page The name of the page to check
145
+	 * @return boolean
146
+	 */
147 147
 	public static function is_admin_page( $page = 'formidable' ) {
148
-        global $pagenow;
148
+		global $pagenow;
149 149
 		$get_page = self::simple_get( 'page', 'sanitize_title' );
150
-        if ( $pagenow ) {
150
+		if ( $pagenow ) {
151 151
 			// allow this to be true during ajax load i.e. ajax form builder loading
152 152
 			return ( $pagenow == 'admin.php' || $pagenow == 'admin-ajax.php' ) && $get_page == $page;
153
-        }
153
+		}
154 154
 
155 155
 		return is_admin() && $get_page == $page;
156
-    }
157
-
158
-    /**
159
-     * Check for the form preview page
160
-     *
161
-     * @since 2.0
162
-     *
163
-     * @param None
164
-     * @return boolean
165
-     */
166
-    public static function is_preview_page() {
167
-        global $pagenow;
156
+	}
157
+
158
+	/**
159
+	 * Check for the form preview page
160
+	 *
161
+	 * @since 2.0
162
+	 *
163
+	 * @param None
164
+	 * @return boolean
165
+	 */
166
+	public static function is_preview_page() {
167
+		global $pagenow;
168 168
 		$action = FrmAppHelper::simple_get( 'action', 'sanitize_title' );
169 169
 		return $pagenow && $pagenow == 'admin-ajax.php' && $action == 'frm_forms_preview';
170
-    }
171
-
172
-    /**
173
-     * Check for ajax except the form preview page
174
-     *
175
-     * @since 2.0
176
-     *
177
-     * @param None
178
-     * @return boolean
179
-     */
180
-    public static function doing_ajax() {
181
-        return self::wp_doing_ajax() && ! self::is_preview_page();
182
-    }
170
+	}
171
+
172
+	/**
173
+	 * Check for ajax except the form preview page
174
+	 *
175
+	 * @since 2.0
176
+	 *
177
+	 * @param None
178
+	 * @return boolean
179
+	 */
180
+	public static function doing_ajax() {
181
+		return self::wp_doing_ajax() && ! self::is_preview_page();
182
+	}
183 183
 
184 184
 	public static function js_suffix() {
185 185
 		return defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
@@ -206,81 +206,81 @@  discard block
 block discarded – undo
206 206
 		return isset( $frm_vars['prevent_caching'] ) && $frm_vars['prevent_caching'];
207 207
 	}
208 208
 
209
-    /**
210
-     * Check if on an admin page
211
-     *
212
-     * @since 2.0
213
-     *
214
-     * @param None
215
-     * @return boolean
216
-     */
217
-    public static function is_admin() {
218
-        return is_admin() && ! self::wp_doing_ajax();
219
-    }
220
-
221
-    /**
222
-     * Check if value contains blank value or empty array
223
-     *
224
-     * @since 2.0
225
-     * @param mixed $value - value to check
209
+	/**
210
+	 * Check if on an admin page
211
+	 *
212
+	 * @since 2.0
213
+	 *
214
+	 * @param None
215
+	 * @return boolean
216
+	 */
217
+	public static function is_admin() {
218
+		return is_admin() && ! self::wp_doing_ajax();
219
+	}
220
+
221
+	/**
222
+	 * Check if value contains blank value or empty array
223
+	 *
224
+	 * @since 2.0
225
+	 * @param mixed $value - value to check
226 226
 	 * @param string
227
-     * @return boolean
228
-     */
229
-    public static function is_empty_value( $value, $empty = '' ) {
230
-        return ( is_array( $value ) && empty( $value ) ) || $value === $empty;
231
-    }
232
-
233
-    public static function is_not_empty_value( $value, $empty = '' ) {
234
-        return ! self::is_empty_value( $value, $empty );
235
-    }
236
-
237
-    /**
238
-     * Get any value from the $_SERVER
239
-     *
240
-     * @since 2.0
241
-     * @param string $value
242
-     * @return string
243
-     */
227
+	 * @return boolean
228
+	 */
229
+	public static function is_empty_value( $value, $empty = '' ) {
230
+		return ( is_array( $value ) && empty( $value ) ) || $value === $empty;
231
+	}
232
+
233
+	public static function is_not_empty_value( $value, $empty = '' ) {
234
+		return ! self::is_empty_value( $value, $empty );
235
+	}
236
+
237
+	/**
238
+	 * Get any value from the $_SERVER
239
+	 *
240
+	 * @since 2.0
241
+	 * @param string $value
242
+	 * @return string
243
+	 */
244 244
 	public static function get_server_value( $value ) {
245
-        return isset( $_SERVER[ $value ] ) ? wp_strip_all_tags( $_SERVER[ $value ] ) : '';
246
-    }
247
-
248
-    /**
249
-     * Check for the IP address in several places
250
-     * Used by [ip] shortcode
251
-     *
252
-     * @return string The IP address of the current user
253
-     */
254
-    public static function get_ip_address() {
245
+		return isset( $_SERVER[ $value ] ) ? wp_strip_all_tags( $_SERVER[ $value ] ) : '';
246
+	}
247
+
248
+	/**
249
+	 * Check for the IP address in several places
250
+	 * Used by [ip] shortcode
251
+	 *
252
+	 * @return string The IP address of the current user
253
+	 */
254
+	public static function get_ip_address() {
255 255
 		$ip = '';
256 256
 		foreach ( array( 'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR' ) as $key ) {
257
-            if ( ! isset( $_SERVER[ $key ] ) ) {
258
-                continue;
259
-            }
257
+			if ( ! isset( $_SERVER[ $key ] ) ) {
258
+				continue;
259
+			}
260 260
 
261
-            foreach ( explode( ',', $_SERVER[ $key ] ) as $ip ) {
261
+			foreach ( explode( ',', $_SERVER[ $key ] ) as $ip ) {
262 262
 				$ip = trim( $ip ); // just to be safe
263 263
 
264 264
 				if ( filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE ) !== false ) {
265
-                    return sanitize_text_field( $ip );
266
-                }
267
-            }
268
-        }
265
+					return sanitize_text_field( $ip );
266
+				}
267
+			}
268
+		}
269 269
 
270 270
 		return sanitize_text_field( $ip );
271
-    }
271
+	}
272 272
 
273
-    public static function get_param( $param, $default = '', $src = 'get', $sanitize = '' ) {
273
+	public static function get_param( $param, $default = '', $src = 'get', $sanitize = '' ) {
274 274
 		if ( strpos( $param, '[' ) ) {
275 275
 			$params = explode( '[', $param );
276
-            $param = $params[0];
277
-        }
276
+			$param = $params[0];
277
+		}
278 278
 
279 279
 		if ( $src == 'get' ) {
280
-            $value = isset( $_POST[ $param ] ) ? stripslashes_deep( $_POST[ $param ] ) : ( isset( $_GET[ $param ] ) ? stripslashes_deep( $_GET[ $param ] ) : $default );
281
-            if ( ! isset( $_POST[ $param ] ) && isset( $_GET[ $param ] ) && ! is_array( $value ) ) {
282
-                $value = stripslashes_deep( htmlspecialchars_decode( $_GET[ $param ] ) );
283
-            }
280
+			$value = isset( $_POST[ $param ] ) ? stripslashes_deep( $_POST[ $param ] ) : ( isset( $_GET[ $param ] ) ? stripslashes_deep( $_GET[ $param ] ) : $default );
281
+			if ( ! isset( $_POST[ $param ] ) && isset( $_GET[ $param ] ) && ! is_array( $value ) ) {
282
+				$value = stripslashes_deep( htmlspecialchars_decode( $_GET[ $param ] ) );
283
+			}
284 284
 			self::sanitize_value( $sanitize, $value );
285 285
 		} else {
286 286
 			$value = self::get_simple_request(
@@ -304,8 +304,8 @@  discard block
 block discarded – undo
304 304
 			}
305 305
 		}
306 306
 
307
-        return $value;
308
-    }
307
+		return $value;
308
+	}
309 309
 
310 310
 	public static function get_post_param( $param, $default = '', $sanitize = '' ) {
311 311
 		return self::get_simple_request(
@@ -373,12 +373,12 @@  discard block
 block discarded – undo
373 373
 	}
374 374
 
375 375
 	/**
376
-	* Preserve backslashes in a value, but make sure value doesn't get compounding slashes
377
-	*
378
-	* @since 2.0.8
379
-	* @param string $value
380
-	* @return string $value
381
-	*/
376
+	 * Preserve backslashes in a value, but make sure value doesn't get compounding slashes
377
+	 *
378
+	 * @since 2.0.8
379
+	 * @param string $value
380
+	 * @return string $value
381
+	 */
382 382
 	public static function preserve_backslashes( $value ) {
383 383
 		// If backslashes have already been added, don't add them again
384 384
 		if ( strpos( $value, '\\\\' ) === false ) {
@@ -400,14 +400,14 @@  discard block
 block discarded – undo
400 400
 		}
401 401
 	}
402 402
 
403
-    public static function sanitize_request( $sanitize_method, &$values ) {
404
-        $temp_values = $values;
405
-        foreach ( $temp_values as $k => $val ) {
406
-            if ( isset( $sanitize_method[ $k ] ) ) {
403
+	public static function sanitize_request( $sanitize_method, &$values ) {
404
+		$temp_values = $values;
405
+		foreach ( $temp_values as $k => $val ) {
406
+			if ( isset( $sanitize_method[ $k ] ) ) {
407 407
 				$values[ $k ] = call_user_func( $sanitize_method[ $k ], $val );
408
-            }
409
-        }
410
-    }
408
+			}
409
+		}
410
+	}
411 411
 
412 412
 	/**
413 413
 	 * Sanitize the value, and allow some HTML
@@ -524,39 +524,39 @@  discard block
 block discarded – undo
524 524
 		);
525 525
 	}
526 526
 
527
-    /**
528
-     * Used when switching the action for a bulk action
529
-     * @since 2.0
530
-     */
527
+	/**
528
+	 * Used when switching the action for a bulk action
529
+	 * @since 2.0
530
+	 */
531 531
 	public static function remove_get_action() {
532 532
 		if ( ! isset( $_GET ) ) {
533 533
 			return;
534 534
 		}
535 535
 
536
-        $new_action = isset( $_GET['action'] ) ? sanitize_text_field( $_GET['action'] ) : ( isset( $_GET['action2'] ) ? sanitize_text_field( $_GET['action2'] ) : '' );
537
-        if ( ! empty( $new_action ) ) {
536
+		$new_action = isset( $_GET['action'] ) ? sanitize_text_field( $_GET['action'] ) : ( isset( $_GET['action2'] ) ? sanitize_text_field( $_GET['action2'] ) : '' );
537
+		if ( ! empty( $new_action ) ) {
538 538
 			$_SERVER['REQUEST_URI'] = str_replace( '&action=' . $new_action, '', FrmAppHelper::get_server_value( 'REQUEST_URI' ) );
539
-        }
540
-    }
539
+		}
540
+	}
541 541
 
542
-    /**
543
-     * Check the WP query for a parameter
544
-     *
545
-     * @since 2.0
546
-     * @return string|array
547
-     */
548
-    public static function get_query_var( $value, $param ) {
549
-        if ( $value != '' ) {
550
-            return $value;
551
-        }
542
+	/**
543
+	 * Check the WP query for a parameter
544
+	 *
545
+	 * @since 2.0
546
+	 * @return string|array
547
+	 */
548
+	public static function get_query_var( $value, $param ) {
549
+		if ( $value != '' ) {
550
+			return $value;
551
+		}
552 552
 
553
-        global $wp_query;
554
-        if ( isset( $wp_query->query_vars[ $param ] ) ) {
555
-            $value = $wp_query->query_vars[ $param ];
556
-        }
553
+		global $wp_query;
554
+		if ( isset( $wp_query->query_vars[ $param ] ) ) {
555
+			$value = $wp_query->query_vars[ $param ];
556
+		}
557 557
 
558
-        return $value;
559
-    }
558
+		return $value;
559
+	}
560 560
 
561 561
 	/**
562 562
 	 * @since 3.0
@@ -578,16 +578,16 @@  discard block
 block discarded – undo
578 578
 		}
579 579
 	}
580 580
 
581
-    /**
582
-     * @param string $type
583
-     */
584
-    public static function trigger_hook_load( $type, $object = null ) {
585
-        // only load the form hooks once
581
+	/**
582
+	 * @param string $type
583
+	 */
584
+	public static function trigger_hook_load( $type, $object = null ) {
585
+		// only load the form hooks once
586 586
 		$hooks_loaded = apply_filters( 'frm_' . $type . '_hooks_loaded', false, $object );
587
-        if ( ! $hooks_loaded ) {
587
+		if ( ! $hooks_loaded ) {
588 588
 			do_action( 'frm_load_' . $type . '_hooks' );
589
-        }
590
-    }
589
+		}
590
+	}
591 591
 
592 592
 	/**
593 593
 	 * Save all front-end js scripts into a single file
@@ -612,18 +612,18 @@  discard block
 block discarded – undo
612 612
 		$new_file->combine_files( $files );
613 613
 	}
614 614
 
615
-    /**
616
-     * Check a value from a shortcode to see if true or false.
617
-     * True when value is 1, true, 'true', 'yes'
618
-     *
619
-     * @since 1.07.10
620
-     *
621
-     * @param string $value The value to compare
622
-     * @return boolean True or False
623
-     */
615
+	/**
616
+	 * Check a value from a shortcode to see if true or false.
617
+	 * True when value is 1, true, 'true', 'yes'
618
+	 *
619
+	 * @since 1.07.10
620
+	 *
621
+	 * @param string $value The value to compare
622
+	 * @return boolean True or False
623
+	 */
624 624
 	public static function is_true( $value ) {
625
-        return ( true === $value || 1 == $value || 'true' == $value || 'yes' == $value );
626
-    }
625
+		return ( true === $value || 1 == $value || 'true' == $value || 'yes' == $value );
626
+	}
627 627
 
628 628
 	public static function get_pages() {
629 629
 		$query = array(
@@ -636,10 +636,10 @@  discard block
 block discarded – undo
636 636
 		return get_posts( $query );
637 637
 	}
638 638
 
639
-    public static function wp_pages_dropdown( $field_name, $page_id, $truncate = false ) {
640
-        $pages = self::get_pages();
639
+	public static function wp_pages_dropdown( $field_name, $page_id, $truncate = false ) {
640
+		$pages = self::get_pages();
641 641
 		$selected = self::get_post_param( $field_name, $page_id, 'absint' );
642
-    ?>
642
+	?>
643 643
 		<select name="<?php echo esc_attr( $field_name ); ?>" id="<?php echo esc_attr( $field_name ); ?>" class="frm-pages-dropdown">
644 644
             <option value=""> </option>
645 645
             <?php foreach ( $pages as $page ) { ?>
@@ -649,16 +649,16 @@  discard block
 block discarded – undo
649 649
             <?php } ?>
650 650
         </select>
651 651
     <?php
652
-    }
652
+	}
653 653
 
654 654
 	public static function post_edit_link( $post_id ) {
655 655
 		$post = get_post( $post_id );
656
-        if ( $post ) {
656
+		if ( $post ) {
657 657
 			$post_url = admin_url( 'post.php?post=' . $post_id . '&action=edit' );
658 658
 			return '<a href="' . esc_url( $post_url ) . '">' . self::truncate( $post->post_title, 50 ) . '</a>';
659
-        }
660
-        return '';
661
-    }
659
+		}
660
+		return '';
661
+	}
662 662
 
663 663
 	public static function wp_roles_dropdown( $field_name, $capability, $multiple = 'single' ) {
664 664
 		?>
@@ -669,73 +669,73 @@  discard block
 block discarded – undo
669 669
 	}
670 670
 
671 671
 	public static function roles_options( $capability ) {
672
-        global $frm_vars;
672
+		global $frm_vars;
673 673
 		if ( isset( $frm_vars['editable_roles'] ) ) {
674
-            $editable_roles = $frm_vars['editable_roles'];
675
-        } else {
676
-            $editable_roles = get_editable_roles();
677
-            $frm_vars['editable_roles'] = $editable_roles;
678
-        }
674
+			$editable_roles = $frm_vars['editable_roles'];
675
+		} else {
676
+			$editable_roles = get_editable_roles();
677
+			$frm_vars['editable_roles'] = $editable_roles;
678
+		}
679 679
 
680
-        foreach ( $editable_roles as $role => $details ) {
680
+		foreach ( $editable_roles as $role => $details ) {
681 681
 			$name = translate_user_role( $details['name'] );
682 682
 			?>
683 683
 		<option value="<?php echo esc_attr( $role ); ?>" <?php echo in_array( $role, (array) $capability ) ? ' selected="selected"' : ''; ?>><?php echo esc_attr( $name ); ?> </option>
684 684
 <?php
685 685
 			unset( $role, $details );
686
-        }
687
-    }
686
+		}
687
+	}
688 688
 
689 689
 	public static function frm_capabilities( $type = 'auto' ) {
690
-        $cap = array(
691
-            'frm_view_forms'        => __( 'View Forms and Templates', 'formidable' ),
692
-            'frm_edit_forms'        => __( 'Add/Edit Forms and Templates', 'formidable' ),
693
-            'frm_delete_forms'      => __( 'Delete Forms and Templates', 'formidable' ),
694
-            'frm_change_settings'   => __( 'Access this Settings Page', 'formidable' ),
695
-            'frm_view_entries'      => __( 'View Entries from Admin Area', 'formidable' ),
696
-            'frm_delete_entries'    => __( 'Delete Entries from Admin Area', 'formidable' ),
697
-        );
690
+		$cap = array(
691
+			'frm_view_forms'        => __( 'View Forms and Templates', 'formidable' ),
692
+			'frm_edit_forms'        => __( 'Add/Edit Forms and Templates', 'formidable' ),
693
+			'frm_delete_forms'      => __( 'Delete Forms and Templates', 'formidable' ),
694
+			'frm_change_settings'   => __( 'Access this Settings Page', 'formidable' ),
695
+			'frm_view_entries'      => __( 'View Entries from Admin Area', 'formidable' ),
696
+			'frm_delete_entries'    => __( 'Delete Entries from Admin Area', 'formidable' ),
697
+		);
698 698
 
699 699
 		if ( ! self::pro_is_installed() && 'pro' != $type ) {
700
-            return $cap;
701
-        }
700
+			return $cap;
701
+		}
702 702
 
703
-        $cap['frm_create_entries'] = __( 'Add Entries from Admin Area', 'formidable' );
704
-        $cap['frm_edit_entries'] = __( 'Edit Entries from Admin Area', 'formidable' );
705
-        $cap['frm_view_reports'] = __( 'View Reports', 'formidable' );
706
-        $cap['frm_edit_displays'] = __( 'Add/Edit Views', 'formidable' );
703
+		$cap['frm_create_entries'] = __( 'Add Entries from Admin Area', 'formidable' );
704
+		$cap['frm_edit_entries'] = __( 'Edit Entries from Admin Area', 'formidable' );
705
+		$cap['frm_view_reports'] = __( 'View Reports', 'formidable' );
706
+		$cap['frm_edit_displays'] = __( 'Add/Edit Views', 'formidable' );
707 707
 
708
-        return $cap;
709
-    }
708
+		return $cap;
709
+	}
710 710
 
711 711
 	public static function user_has_permission( $needed_role ) {
712
-        if ( $needed_role == '-1' ) {
713
-            return false;
712
+		if ( $needed_role == '-1' ) {
713
+			return false;
714 714
 		}
715 715
 
716
-        // $needed_role will be equal to blank if "Logged-in users" is selected
717
-        if ( ( $needed_role == '' && is_user_logged_in() ) || current_user_can( $needed_role ) ) {
718
-            return true;
719
-        }
716
+		// $needed_role will be equal to blank if "Logged-in users" is selected
717
+		if ( ( $needed_role == '' && is_user_logged_in() ) || current_user_can( $needed_role ) ) {
718
+			return true;
719
+		}
720 720
 
721
-        $roles = array( 'administrator', 'editor', 'author', 'contributor', 'subscriber' );
722
-        foreach ( $roles as $role ) {
721
+		$roles = array( 'administrator', 'editor', 'author', 'contributor', 'subscriber' );
722
+		foreach ( $roles as $role ) {
723 723
 			if ( current_user_can( $role ) ) {
724
-        		return true;
724
+				return true;
725 725
 			}
726
-        	if ( $role == $needed_role ) {
727
-        		break;
726
+			if ( $role == $needed_role ) {
727
+				break;
728 728
 			}
729
-        }
730
-        return false;
731
-    }
732
-
733
-    /**
734
-     * Make sure administrators can see Formidable menu
735
-     *
736
-     * @since 2.0
737
-     */
738
-    public static function maybe_add_permissions() {
729
+		}
730
+		return false;
731
+	}
732
+
733
+	/**
734
+	 * Make sure administrators can see Formidable menu
735
+	 *
736
+	 * @since 2.0
737
+	 */
738
+	public static function maybe_add_permissions() {
739 739
 		self::force_capability( 'frm_view_entries' );
740 740
 
741 741
 		if ( ! current_user_can( 'administrator' ) || current_user_can( 'frm_view_forms' ) ) {
@@ -744,12 +744,12 @@  discard block
 block discarded – undo
744 744
 
745 745
 		$user_id = get_current_user_id();
746 746
 		$user = new WP_User( $user_id );
747
-        $frm_roles = self::frm_capabilities();
748
-        foreach ( $frm_roles as $frm_role => $frm_role_description ) {
747
+		$frm_roles = self::frm_capabilities();
748
+		foreach ( $frm_roles as $frm_role => $frm_role_description ) {
749 749
 			$user->add_cap( $frm_role );
750 750
 			unset( $frm_role, $frm_role_description );
751
-        }
752
-    }
751
+		}
752
+	}
753 753
 
754 754
 	/**
755 755
 	 * Make sure admins have permission to see the menu items
@@ -765,28 +765,28 @@  discard block
 block discarded – undo
765 765
 		}
766 766
 	}
767 767
 
768
-    /**
769
-     * Check if the user has permision for action.
770
-     * Return permission message and stop the action if no permission
771
-     * @since 2.0
772
-     * @param string $permission
773
-     */
768
+	/**
769
+	 * Check if the user has permision for action.
770
+	 * Return permission message and stop the action if no permission
771
+	 * @since 2.0
772
+	 * @param string $permission
773
+	 */
774 774
 	public static function permission_check( $permission, $show_message = 'show' ) {
775 775
 		$permission_error = self::permission_nonce_error( $permission );
776
-        if ( $permission_error !== false ) {
777
-            if ( 'hide' == $show_message ) {
778
-                $permission_error = '';
779
-            }
776
+		if ( $permission_error !== false ) {
777
+			if ( 'hide' == $show_message ) {
778
+				$permission_error = '';
779
+			}
780 780
 			wp_die( esc_html( $permission_error ) );
781
-        }
782
-    }
783
-
784
-    /**
785
-     * Check user permission and nonce
786
-     * @since 2.0
787
-     * @param string $permission
788
-     * @return false|string The permission message or false if allowed
789
-     */
781
+		}
782
+	}
783
+
784
+	/**
785
+	 * Check user permission and nonce
786
+	 * @since 2.0
787
+	 * @param string $permission
788
+	 * @return false|string The permission message or false if allowed
789
+	 */
790 790
 	public static function permission_nonce_error( $permission, $nonce_name = '', $nonce = '' ) {
791 791
 		if ( ! empty( $permission ) && ! current_user_can( $permission ) && ! current_user_can( 'administrator' ) ) {
792 792
 			$frm_settings = self::get_settings();
@@ -795,22 +795,22 @@  discard block
 block discarded – undo
795 795
 
796 796
 		$error = false;
797 797
 		if ( empty( $nonce_name ) ) {
798
-            return $error;
799
-        }
798
+			return $error;
799
+		}
800 800
 
801
-        if ( $_REQUEST && ( ! isset( $_REQUEST[ $nonce_name ] ) || ! wp_verify_nonce( $_REQUEST[ $nonce_name ], $nonce ) ) ) {
802
-            $frm_settings = self::get_settings();
803
-            $error = $frm_settings->admin_permission;
804
-        }
801
+		if ( $_REQUEST && ( ! isset( $_REQUEST[ $nonce_name ] ) || ! wp_verify_nonce( $_REQUEST[ $nonce_name ], $nonce ) ) ) {
802
+			$frm_settings = self::get_settings();
803
+			$error = $frm_settings->admin_permission;
804
+		}
805 805
 
806
-        return $error;
807
-    }
806
+		return $error;
807
+	}
808 808
 
809
-    public static function checked( $values, $current ) {
809
+	public static function checked( $values, $current ) {
810 810
 		if ( self::check_selected( $values, $current ) ) {
811
-            echo ' checked="checked"';
811
+			echo ' checked="checked"';
812 812
 		}
813
-    }
813
+	}
814 814
 
815 815
 	public static function check_selected( $values, $current ) {
816 816
 		$values = self::recursive_function_map( $values, 'trim' );
@@ -848,24 +848,24 @@  discard block
 block discarded – undo
848 848
 		return (bool) count( array_filter( array_keys( $array ), 'is_string' ) );
849 849
 	}
850 850
 
851
-    /**
852
-     * Flatten a multi-dimensional array
853
-     */
851
+	/**
852
+	 * Flatten a multi-dimensional array
853
+	 */
854 854
 	public static function array_flatten( $array, $keys = 'keep' ) {
855
-        $return = array();
856
-        foreach ( $array as $key => $value ) {
855
+		$return = array();
856
+		foreach ( $array as $key => $value ) {
857 857
 			if ( is_array( $value ) ) {
858 858
 				$return = array_merge( $return, self::array_flatten( $value, $keys ) );
859
-            } else {
859
+			} else {
860 860
 				if ( $keys == 'keep' ) {
861 861
 					$return[ $key ] = $value;
862 862
 				} else {
863 863
 					$return[] = $value;
864 864
 				}
865
-            }
866
-        }
867
-        return $return;
868
-    }
865
+			}
866
+		}
867
+		return $return;
868
+	}
869 869
 
870 870
 	public static function esc_textarea( $text, $is_rich_text = false ) {
871 871
 		$safe_text = str_replace( '&quot;', '"', $text );
@@ -876,10 +876,10 @@  discard block
 block discarded – undo
876 876
 		return apply_filters( 'esc_textarea', $safe_text, $text );
877 877
 	}
878 878
 
879
-    /**
880
-     * Add auto paragraphs to text areas
881
-     * @since 2.0
882
-     */
879
+	/**
880
+	 * Add auto paragraphs to text areas
881
+	 * @since 2.0
882
+	 */
883 883
 	public static function use_wpautop( $content ) {
884 884
 		if ( apply_filters( 'frm_use_wpautop', true ) ) {
885 885
 			$content = wpautop( str_replace( '<br>', '<br />', $content ) );
@@ -888,26 +888,26 @@  discard block
 block discarded – undo
888 888
 	}
889 889
 
890 890
 	public static function replace_quotes( $val ) {
891
-        //Replace double quotes
891
+		//Replace double quotes
892 892
 		$val = str_replace( array( '&#8220;', '&#8221;', '&#8243;' ), '"', $val );
893
-        //Replace single quotes
894
-        $val = str_replace( array( '&#8216;', '&#8217;', '&#8242;', '&prime;', '&rsquo;', '&lsquo;' ), "'", $val );
895
-        return $val;
896
-    }
897
-
898
-    /**
899
-     * @since 2.0
900
-     * @return string The base Google APIS url for the current version of jQuery UI
901
-     */
902
-    public static function jquery_ui_base_url() {
893
+		//Replace single quotes
894
+		$val = str_replace( array( '&#8216;', '&#8217;', '&#8242;', '&prime;', '&rsquo;', '&lsquo;' ), "'", $val );
895
+		return $val;
896
+	}
897
+
898
+	/**
899
+	 * @since 2.0
900
+	 * @return string The base Google APIS url for the current version of jQuery UI
901
+	 */
902
+	public static function jquery_ui_base_url() {
903 903
 		$url = 'http' . ( is_ssl() ? 's' : '' ) . '://ajax.googleapis.com/ajax/libs/jqueryui/' . self::script_version( 'jquery-ui-core', '1.11.4' );
904 904
 		$url = apply_filters( 'frm_jquery_ui_base_url', $url );
905
-        return $url;
906
-    }
905
+		return $url;
906
+	}
907 907
 
908
-    /**
909
-     * @param string $handle
910
-     */
908
+	/**
909
+	 * @param string $handle
910
+	 */
911 911
 	public static function script_version( $handle, $default = 0 ) {
912 912
 		global $wp_scripts;
913 913
 		if ( ! $wp_scripts ) {
@@ -929,12 +929,12 @@  discard block
 block discarded – undo
929 929
 
930 930
 	public static function js_redirect( $url ) {
931 931
 		return '<script type="text/javascript">window.location="' . esc_url_raw( $url ) . '"</script>';
932
-    }
932
+	}
933 933
 
934 934
 	public static function get_user_id_param( $user_id ) {
935 935
 		if ( ! $user_id || empty( $user_id ) || is_numeric( $user_id ) ) {
936
-            return $user_id;
937
-        }
936
+			return $user_id;
937
+		}
938 938
 
939 939
 		$user_id = sanitize_text_field( $user_id );
940 940
 		if ( $user_id == 'current' ) {
@@ -946,14 +946,14 @@  discard block
 block discarded – undo
946 946
 				$user = get_user_by( 'login', $user_id );
947 947
 			}
948 948
 
949
-            if ( $user ) {
950
-                $user_id = $user->ID;
951
-            }
949
+			if ( $user ) {
950
+				$user_id = $user->ID;
951
+			}
952 952
 			unset( $user );
953
-        }
953
+		}
954 954
 
955
-        return $user_id;
956
-    }
955
+		return $user_id;
956
+	}
957 957
 
958 958
 	public static function get_file_contents( $filename, $atts = array() ) {
959 959
 		if ( ! is_file( $filename ) ) {
@@ -968,28 +968,28 @@  discard block
 block discarded – undo
968 968
 		return $contents;
969 969
 	}
970 970
 
971
-    /**
972
-     * @param string $table_name
973
-     * @param string $column
971
+	/**
972
+	 * @param string $table_name
973
+	 * @param string $column
974 974
 	 * @param int $id
975 975
 	 * @param int $num_chars
976
-     */
977
-    public static function get_unique_key( $name = '', $table_name, $column, $id = 0, $num_chars = 5 ) {
978
-        $key = '';
976
+	 */
977
+	public static function get_unique_key( $name = '', $table_name, $column, $id = 0, $num_chars = 5 ) {
978
+		$key = '';
979 979
 
980
-        if ( ! empty( $name ) ) {
980
+		if ( ! empty( $name ) ) {
981 981
 			$key = sanitize_key( $name );
982
-        }
982
+		}
983 983
 
984 984
 		if ( empty( $key ) ) {
985 985
 			$max_slug_value = pow( 36, $num_chars );
986
-            $min_slug_value = 37; // we want to have at least 2 characters in the slug
986
+			$min_slug_value = 37; // we want to have at least 2 characters in the slug
987 987
 			$key = base_convert( rand( $min_slug_value, $max_slug_value ), 10, 36 );
988
-        }
988
+		}
989 989
 
990 990
 		if ( is_numeric( $key ) || in_array( $key, array( 'id', 'key', 'created-at', 'detaillink', 'editlink', 'siteurl', 'evenodd' ) ) ) {
991 991
 			$key = $key . 'a';
992
-        }
992
+		}
993 993
 
994 994
 		$key_check = FrmDb::get_var(
995 995
 			$table_name,
@@ -1001,7 +1001,7 @@  discard block
 block discarded – undo
1001 1001
 		);
1002 1002
 
1003 1003
 		if ( $key_check || is_numeric( $key_check ) ) {
1004
-            $suffix = 2;
1004
+			$suffix = 2;
1005 1005
 			do {
1006 1006
 				$alt_post_name = substr( $key, 0, 200 - ( strlen( $suffix ) + 1 ) ) . $suffix;
1007 1007
 				$key_check = FrmDb::get_var(
@@ -1015,19 +1015,19 @@  discard block
 block discarded – undo
1015 1015
 				$suffix++;
1016 1016
 			} while ( $key_check || is_numeric( $key_check ) );
1017 1017
 			$key = $alt_post_name;
1018
-        }
1019
-        return $key;
1020
-    }
1021
-
1022
-    /**
1023
-     * Editing a Form or Entry
1024
-     * @param string $table
1025
-     * @return bool|array
1026
-     */
1027
-    public static function setup_edit_vars( $record, $table, $fields = '', $default = false, $post_values = array(), $args = array() ) {
1028
-        if ( ! $record ) {
1029
-            return false;
1030
-        }
1018
+		}
1019
+		return $key;
1020
+	}
1021
+
1022
+	/**
1023
+	 * Editing a Form or Entry
1024
+	 * @param string $table
1025
+	 * @return bool|array
1026
+	 */
1027
+	public static function setup_edit_vars( $record, $table, $fields = '', $default = false, $post_values = array(), $args = array() ) {
1028
+		if ( ! $record ) {
1029
+			return false;
1030
+		}
1031 1031
 
1032 1032
 		if ( empty( $post_values ) ) {
1033 1033
 			$post_values = stripslashes_deep( $_POST );
@@ -1050,14 +1050,14 @@  discard block
 block discarded – undo
1050 1050
 
1051 1051
 		self::prepare_field_arrays( $fields, $record, $values, array_merge( $args, compact( 'default', 'post_values' ) ) );
1052 1052
 
1053
-        if ( $table == 'entries' ) {
1054
-            $values = FrmEntriesHelper::setup_edit_vars( $values, $record );
1055
-        } else if ( $table == 'forms' ) {
1056
-            $values = FrmFormsHelper::setup_edit_vars( $values, $record, $post_values );
1057
-        }
1053
+		if ( $table == 'entries' ) {
1054
+			$values = FrmEntriesHelper::setup_edit_vars( $values, $record );
1055
+		} else if ( $table == 'forms' ) {
1056
+			$values = FrmFormsHelper::setup_edit_vars( $values, $record, $post_values );
1057
+		}
1058 1058
 
1059
-        return $values;
1060
-    }
1059
+		return $values;
1060
+	}
1061 1061
 
1062 1062
 	private static function prepare_field_arrays( $fields, $record, array &$values, $args ) {
1063 1063
 		if ( ! empty( $fields ) ) {
@@ -1070,15 +1070,15 @@  discard block
 block discarded – undo
1070 1070
 	}
1071 1071
 
1072 1072
 	private static function fill_field_defaults( $field, $record, array &$values, $args ) {
1073
-        $post_values = $args['post_values'];
1073
+		$post_values = $args['post_values'];
1074 1074
 
1075
-        if ( $args['default'] ) {
1076
-            $meta_value = $field->default_value;
1077
-        } else {
1075
+		if ( $args['default'] ) {
1076
+			$meta_value = $field->default_value;
1077
+		} else {
1078 1078
 			if ( $record->post_id && self::pro_is_installed() && isset( $field->field_options['post_field'] ) && $field->field_options['post_field'] ) {
1079 1079
 				if ( ! isset( $field->field_options['custom_field'] ) ) {
1080
-                    $field->field_options['custom_field'] = '';
1081
-                }
1080
+					$field->field_options['custom_field'] = '';
1081
+				}
1082 1082
 				$meta_value = FrmProEntryMetaHelper::get_post_value(
1083 1083
 					$record->post_id,
1084 1084
 					$field->field_options['post_field'],
@@ -1090,31 +1090,31 @@  discard block
 block discarded – undo
1090 1090
 						'field' => $field,
1091 1091
 					)
1092 1092
 				);
1093
-            } else {
1093
+			} else {
1094 1094
 				$meta_value = FrmEntryMeta::get_meta_value( $record, $field->id );
1095
-            }
1096
-        }
1095
+			}
1096
+		}
1097 1097
 
1098 1098
 		$field_type = isset( $post_values['field_options'][ 'type_' . $field->id ] ) ? $post_values['field_options'][ 'type_' . $field->id ] : $field->type;
1099
-        $new_value = isset( $post_values['item_meta'][ $field->id ] ) ? maybe_unserialize( $post_values['item_meta'][ $field->id ] ) : $meta_value;
1099
+		$new_value = isset( $post_values['item_meta'][ $field->id ] ) ? maybe_unserialize( $post_values['item_meta'][ $field->id ] ) : $meta_value;
1100 1100
 
1101 1101
 		$field_array = self::start_field_array( $field );
1102 1102
 		$field_array['value'] = $new_value;
1103 1103
 		$field_array['type']  = apply_filters( 'frm_field_type', $field_type, $field, $new_value );
1104 1104
 		$field_array['parent_form_id'] = $args['parent_form_id'];
1105 1105
 
1106
-        $args['field_type'] = $field_type;
1106
+		$args['field_type'] = $field_type;
1107 1107
 
1108 1108
 		FrmFieldsHelper::prepare_edit_front_field( $field_array, $field, $values['id'], $args );
1109 1109
 
1110 1110
 		if ( ! isset( $field_array['unique'] ) || ! $field_array['unique'] ) {
1111
-            $field_array['unique_msg'] = '';
1112
-        }
1111
+			$field_array['unique_msg'] = '';
1112
+		}
1113 1113
 
1114
-        $field_array = array_merge( $field->field_options, $field_array );
1114
+		$field_array = array_merge( $field->field_options, $field_array );
1115 1115
 
1116
-        $values['fields'][ $field->id ] = $field_array;
1117
-    }
1116
+		$values['fields'][ $field->id ] = $field_array;
1117
+	}
1118 1118
 
1119 1119
 	/**
1120 1120
 	 * @since 3.0
@@ -1135,20 +1135,20 @@  discard block
 block discarded – undo
1135 1135
 		);
1136 1136
 	}
1137 1137
 
1138
-    /**
1139
-     * @param string $table
1140
-     */
1138
+	/**
1139
+	 * @param string $table
1140
+	 */
1141 1141
 	private static function fill_form_opts( $record, $table, $post_values, array &$values ) {
1142
-        if ( $table == 'entries' ) {
1143
-            $form = $record->form_id;
1142
+		if ( $table == 'entries' ) {
1143
+			$form = $record->form_id;
1144 1144
 			FrmForm::maybe_get_form( $form );
1145
-        } else {
1146
-            $form = $record;
1147
-        }
1145
+		} else {
1146
+			$form = $record;
1147
+		}
1148 1148
 
1149
-        if ( ! $form ) {
1150
-            return;
1151
-        }
1149
+		if ( ! $form ) {
1150
+			return;
1151
+		}
1152 1152
 
1153 1153
 		$values['form_name'] = isset( $record->form_id ) ? $form->name : '';
1154 1154
 		$values['parent_form_id'] = isset( $record->form_id ) ? $form->parent_form_id : 0;
@@ -1157,26 +1157,26 @@  discard block
 block discarded – undo
1157 1157
 			return;
1158 1158
 		}
1159 1159
 
1160
-        foreach ( $form->options as $opt => $value ) {
1161
-            $values[ $opt ] = isset( $post_values[ $opt ] ) ? maybe_unserialize( $post_values[ $opt ] ) : $value;
1162
-        }
1160
+		foreach ( $form->options as $opt => $value ) {
1161
+			$values[ $opt ] = isset( $post_values[ $opt ] ) ? maybe_unserialize( $post_values[ $opt ] ) : $value;
1162
+		}
1163 1163
 
1164 1164
 		self::fill_form_defaults( $post_values, $values );
1165
-    }
1165
+	}
1166 1166
 
1167
-    /**
1168
-     * Set to POST value or default
1169
-     */
1167
+	/**
1168
+	 * Set to POST value or default
1169
+	 */
1170 1170
 	private static function fill_form_defaults( $post_values, array &$values ) {
1171
-        $form_defaults = FrmFormsHelper::get_default_opts();
1171
+		$form_defaults = FrmFormsHelper::get_default_opts();
1172 1172
 
1173
-        foreach ( $form_defaults as $opt => $default ) {
1174
-            if ( ! isset( $values[ $opt ] ) || $values[ $opt ] == '' ) {
1173
+		foreach ( $form_defaults as $opt => $default ) {
1174
+			if ( ! isset( $values[ $opt ] ) || $values[ $opt ] == '' ) {
1175 1175
 				$values[ $opt ] = ( $post_values && isset( $post_values['options'][ $opt ] ) ) ? $post_values['options'][ $opt ] : $default;
1176
-            }
1176
+			}
1177 1177
 
1178 1178
 			unset( $opt, $default );
1179
-        }
1179
+		}
1180 1180
 
1181 1181
 		if ( ! isset( $values['custom_style'] ) ) {
1182 1182
 			$values['custom_style'] = self::custom_style_value( $post_values );
@@ -1185,10 +1185,10 @@  discard block
 block discarded – undo
1185 1185
 		foreach ( array( 'before', 'after', 'submit' ) as $h ) {
1186 1186
 			if ( ! isset( $values[ $h . '_html' ] ) ) {
1187 1187
 				$values[ $h . '_html' ] = ( isset( $post_values['options'][ $h . '_html' ] ) ? $post_values['options'][ $h . '_html' ] : FrmFormsHelper::get_default_html( $h ) );
1188
-            }
1188
+			}
1189 1189
 			unset( $h );
1190
-        }
1191
-    }
1190
+		}
1191
+	}
1192 1192
 
1193 1193
 	/**
1194 1194
 	 * @since 2.2.10
@@ -1211,33 +1211,33 @@  discard block
 block discarded – undo
1211 1211
 		if ( $possible_email_field ) {
1212 1212
 			$class .= 'show_frm_not_email_to';
1213 1213
 		}
1214
-    ?>
1214
+	?>
1215 1215
 <li>
1216 1216
 	<a href="javascript:void(0)" class="frmids frm_insert_code alignright <?php echo esc_attr( $class ); ?>" data-code="<?php echo esc_attr( $args['id'] ); ?>" >[<?php echo esc_attr( $args['id'] ); ?>]</a>
1217 1217
 	<a href="javascript:void(0)" class="frmkeys frm_insert_code alignright <?php echo esc_attr( $class ); ?>" data-code="<?php echo esc_attr( $args['key'] ); ?>" >[<?php echo esc_attr( self::truncate( $args['key'], 10 ) ); ?>]</a>
1218 1218
 	<a href="javascript:void(0)" class="frm_insert_code <?php echo esc_attr( $class ); ?>" data-code="<?php echo esc_attr( $args['id'] ); ?>" ><?php echo esc_attr( self::truncate( $args['name'], 60 ) ); ?></a>
1219 1219
 </li>
1220 1220
     <?php
1221
-    }
1221
+	}
1222 1222
 
1223 1223
 	public static function truncate( $str, $length, $minword = 3, $continue = '...' ) {
1224
-        if ( is_array( $str ) ) {
1225
-            return '';
1224
+		if ( is_array( $str ) ) {
1225
+			return '';
1226 1226
 		}
1227 1227
 
1228
-        $length = (int) $length;
1228
+		$length = (int) $length;
1229 1229
 		$str = wp_strip_all_tags( $str );
1230 1230
 		$original_len = self::mb_function( array( 'mb_strlen', 'strlen' ), array( $str ) );
1231 1231
 
1232 1232
 		if ( $length == 0 ) {
1233
-            return '';
1234
-        } else if ( $length <= 10 ) {
1233
+			return '';
1234
+		} else if ( $length <= 10 ) {
1235 1235
 			$sub = self::mb_function( array( 'mb_substr', 'substr' ), array( $str, 0, $length ) );
1236 1236
 			return $sub . ( ( $length < $original_len ) ? $continue : '' );
1237
-        }
1237
+		}
1238 1238
 
1239
-        $sub = '';
1240
-        $len = 0;
1239
+		$sub = '';
1240
+		$len = 0;
1241 1241
 
1242 1242
 		$words = self::mb_function( array( 'mb_split', 'explode' ), array( ' ', $str ) );
1243 1243
 
@@ -1245,21 +1245,21 @@  discard block
 block discarded – undo
1245 1245
 			$part = ( ( $sub != '' ) ? ' ' : '' ) . $word;
1246 1246
 			$total_len = self::mb_function( array( 'mb_strlen', 'strlen' ), array( $sub . $part ) );
1247 1247
 			if ( $total_len > $length && str_word_count( $sub ) ) {
1248
-                break;
1249
-            }
1248
+				break;
1249
+			}
1250 1250
 
1251
-            $sub .= $part;
1251
+			$sub .= $part;
1252 1252
 			$len += self::mb_function( array( 'mb_strlen', 'strlen' ), array( $part ) );
1253 1253
 
1254 1254
 			if ( str_word_count( $sub ) > $minword && $total_len >= $length ) {
1255
-                break;
1256
-            }
1255
+				break;
1256
+			}
1257 1257
 
1258 1258
 			unset( $total_len, $word );
1259
-        }
1259
+		}
1260 1260
 
1261 1261
 		return $sub . ( ( $len < $original_len ) ? $continue : '' );
1262
-    }
1262
+	}
1263 1263
 
1264 1264
 	public static function mb_function( $function_names, $args ) {
1265 1265
 		$mb_function_name = $function_names[0];
@@ -1272,17 +1272,17 @@  discard block
 block discarded – undo
1272 1272
 
1273 1273
 	public static function get_formatted_time( $date, $date_format = '', $time_format = '' ) {
1274 1274
 		if ( empty( $date ) ) {
1275
-            return $date;
1276
-        }
1275
+			return $date;
1276
+		}
1277 1277
 
1278 1278
 		if ( empty( $date_format ) ) {
1279 1279
 			$date_format = get_option( 'date_format' );
1280 1280
 		}
1281 1281
 
1282 1282
 		if ( preg_match( '/^\d{1-2}\/\d{1-2}\/\d{4}$/', $date ) && self::pro_is_installed() ) {
1283
-            $frmpro_settings = new FrmProSettings();
1283
+			$frmpro_settings = new FrmProSettings();
1284 1284
 			$date = FrmProAppHelper::convert_date( $date, $frmpro_settings->date_format, 'Y-m-d' );
1285
-        }
1285
+		}
1286 1286
 
1287 1287
 		$formatted = self::get_localized_date( $date_format, $date );
1288 1288
 
@@ -1291,8 +1291,8 @@  discard block
 block discarded – undo
1291 1291
 			$formatted .= self::add_time_to_date( $time_format, $date );
1292 1292
 		}
1293 1293
 
1294
-        return $formatted;
1295
-    }
1294
+		return $formatted;
1295
+	}
1296 1296
 
1297 1297
 	private static function add_time_to_date( $time_format, $date ) {
1298 1298
 		if ( empty( $time_format ) ) {
@@ -1374,32 +1374,32 @@  discard block
 block discarded – undo
1374 1374
 		);
1375 1375
 	}
1376 1376
 
1377
-    // Pagination Methods
1377
+	// Pagination Methods
1378 1378
 
1379
-    /**
1380
-     * @param integer $current_p
1381
-     */
1379
+	/**
1380
+	 * @param integer $current_p
1381
+	 */
1382 1382
 	public static function get_last_record_num( $r_count, $current_p, $p_size ) {
1383 1383
 		return ( ( $r_count < ( $current_p * $p_size ) ) ? $r_count : ( $current_p * $p_size ) );
1384 1384
 	}
1385 1385
 
1386
-    /**
1387
-     * @param integer $current_p
1388
-     */
1389
-    public static function get_first_record_num( $r_count, $current_p, $p_size ) {
1390
-        if ( $current_p == 1 ) {
1391
-            return 1;
1392
-        } else {
1393
-            return ( self::get_last_record_num( $r_count, ( $current_p - 1 ), $p_size ) + 1 );
1394
-        }
1395
-    }
1386
+	/**
1387
+	 * @param integer $current_p
1388
+	 */
1389
+	public static function get_first_record_num( $r_count, $current_p, $p_size ) {
1390
+		if ( $current_p == 1 ) {
1391
+			return 1;
1392
+		} else {
1393
+			return ( self::get_last_record_num( $r_count, ( $current_p - 1 ), $p_size ) + 1 );
1394
+		}
1395
+	}
1396 1396
 
1397 1397
 	/**
1398 1398
 	 * @return array
1399 1399
 	 */
1400 1400
 	public static function json_to_array( $json_vars ) {
1401
-        $vars = array();
1402
-        foreach ( $json_vars as $jv ) {
1401
+		$vars = array();
1402
+		foreach ( $json_vars as $jv ) {
1403 1403
 			$jv_name = explode( '[', $jv['name'] );
1404 1404
 			$last = count( $jv_name ) - 1;
1405 1405
 			foreach ( $jv_name as $p => $n ) {
@@ -1416,77 +1416,77 @@  discard block
 block discarded – undo
1416 1416
 					$l3 = $name;
1417 1417
 				}
1418 1418
 
1419
-                $this_val = ( $p == $last ) ? $jv['value'] : array();
1419
+				$this_val = ( $p == $last ) ? $jv['value'] : array();
1420 1420
 
1421
-                switch ( $p ) {
1422
-                    case 0:
1423
-                        $l1 = $name;
1424
-                        self::add_value_to_array( $name, $l1, $this_val, $vars );
1421
+				switch ( $p ) {
1422
+					case 0:
1423
+						$l1 = $name;
1424
+						self::add_value_to_array( $name, $l1, $this_val, $vars );
1425 1425
 						break;
1426 1426
 
1427
-                    case 1:
1428
-                        $l2 = $name;
1429
-                        self::add_value_to_array( $name, $l2, $this_val, $vars[ $l1 ] );
1427
+					case 1:
1428
+						$l2 = $name;
1429
+						self::add_value_to_array( $name, $l2, $this_val, $vars[ $l1 ] );
1430 1430
 						break;
1431 1431
 
1432
-                    case 2:
1433
-                        $l3 = $name;
1434
-                        self::add_value_to_array( $name, $l3, $this_val, $vars[ $l1 ][ $l2 ] );
1432
+					case 2:
1433
+						$l3 = $name;
1434
+						self::add_value_to_array( $name, $l3, $this_val, $vars[ $l1 ][ $l2 ] );
1435 1435
 						break;
1436 1436
 
1437
-                    case 3:
1438
-                        $l4 = $name;
1439
-                        self::add_value_to_array( $name, $l4, $this_val, $vars[ $l1 ][ $l2 ][ $l3 ] );
1440
-                }
1437
+					case 3:
1438
+						$l4 = $name;
1439
+						self::add_value_to_array( $name, $l4, $this_val, $vars[ $l1 ][ $l2 ][ $l3 ] );
1440
+				}
1441 1441
 
1442 1442
 				unset( $this_val, $n );
1443
-            }
1443
+			}
1444 1444
 
1445 1445
 			unset( $last, $jv );
1446
-        }
1447
-
1448
-        return $vars;
1449
-    }
1450
-
1451
-    /**
1452
-     * @param string $name
1453
-     * @param string $l1
1454
-     */
1455
-    public static function add_value_to_array( $name, $l1, $val, &$vars ) {
1456
-        if ( $name == '' ) {
1457
-            $vars[] = $val;
1458
-        } else if ( ! isset( $vars[ $l1 ] ) ) {
1459
-            $vars[ $l1 ] = $val;
1460
-        }
1461
-    }
1446
+		}
1447
+
1448
+		return $vars;
1449
+	}
1450
+
1451
+	/**
1452
+	 * @param string $name
1453
+	 * @param string $l1
1454
+	 */
1455
+	public static function add_value_to_array( $name, $l1, $val, &$vars ) {
1456
+		if ( $name == '' ) {
1457
+			$vars[] = $val;
1458
+		} else if ( ! isset( $vars[ $l1 ] ) ) {
1459
+			$vars[ $l1 ] = $val;
1460
+		}
1461
+	}
1462 1462
 
1463 1463
 	public static function maybe_add_tooltip( $name, $class = 'closed', $form_name = '' ) {
1464
-        $tooltips = array(
1465
-            'action_title'  => __( 'Give this action a label for easy reference.', 'formidable' ),
1466
-            'email_to'      => __( 'Add one or more recipient addresses separated by a ",".  FORMAT: Name <[email protected]> or [email protected].  [admin_email] is the address set in WP General Settings.', 'formidable' ),
1467
-            'cc'            => __( 'Add CC addresses separated by a ",".  FORMAT: Name <[email protected]> or [email protected].', 'formidable' ),
1468
-            'bcc'           => __( 'Add BCC addresses separated by a ",".  FORMAT: Name <[email protected]> or [email protected].', 'formidable' ),
1469
-            'reply_to'      => __( 'If you would like a different reply to address than the "from" address, add a single address here.  FORMAT: Name <[email protected]> or [email protected].', 'formidable' ),
1470
-            'from'          => __( 'Enter the name and/or email address of the sender. FORMAT: John Bates <[email protected]> or [email protected].', 'formidable' ),
1471
-            'email_subject' => esc_attr( sprintf( __( 'If you leave the subject blank, the default will be used: %1$s Form submitted on %2$s', 'formidable' ), $form_name, self::site_name() ) ),
1472
-        );
1473
-
1474
-        if ( ! isset( $tooltips[ $name ] ) ) {
1475
-            return;
1476
-        }
1477
-
1478
-        if ( 'open' == $class ) {
1479
-            echo ' frm_help"';
1480
-        } else {
1481
-            echo ' class="frm_help"';
1482
-        }
1464
+		$tooltips = array(
1465
+			'action_title'  => __( 'Give this action a label for easy reference.', 'formidable' ),
1466
+			'email_to'      => __( 'Add one or more recipient addresses separated by a ",".  FORMAT: Name <[email protected]> or [email protected].  [admin_email] is the address set in WP General Settings.', 'formidable' ),
1467
+			'cc'            => __( 'Add CC addresses separated by a ",".  FORMAT: Name <[email protected]> or [email protected].', 'formidable' ),
1468
+			'bcc'           => __( 'Add BCC addresses separated by a ",".  FORMAT: Name <[email protected]> or [email protected].', 'formidable' ),
1469
+			'reply_to'      => __( 'If you would like a different reply to address than the "from" address, add a single address here.  FORMAT: Name <[email protected]> or [email protected].', 'formidable' ),
1470
+			'from'          => __( 'Enter the name and/or email address of the sender. FORMAT: John Bates <[email protected]> or [email protected].', 'formidable' ),
1471
+			'email_subject' => esc_attr( sprintf( __( 'If you leave the subject blank, the default will be used: %1$s Form submitted on %2$s', 'formidable' ), $form_name, self::site_name() ) ),
1472
+		);
1473
+
1474
+		if ( ! isset( $tooltips[ $name ] ) ) {
1475
+			return;
1476
+		}
1477
+
1478
+		if ( 'open' == $class ) {
1479
+			echo ' frm_help"';
1480
+		} else {
1481
+			echo ' class="frm_help"';
1482
+		}
1483 1483
 
1484 1484
 		echo ' title="' . esc_attr( $tooltips[ $name ] );
1485 1485
 
1486
-        if ( 'open' != $class ) {
1487
-            echo '"';
1488
-        }
1489
-    }
1486
+		if ( 'open' != $class ) {
1487
+			echo '"';
1488
+		}
1489
+	}
1490 1490
 
1491 1491
 	/**
1492 1492
 	 * Add the current_page class to that page in the form nav
@@ -1502,35 +1502,35 @@  discard block
 block discarded – undo
1502 1502
 		}
1503 1503
 	}
1504 1504
 
1505
-    /**
1506
-     * Prepare and json_encode post content
1507
-     *
1508
-     * @since 2.0
1509
-     *
1510
-     * @param array $post_content
1511
-     * @return string $post_content ( json encoded array )
1512
-     */
1513
-    public static function prepare_and_encode( $post_content ) {
1514
-        //Loop through array to strip slashes and add only the needed ones
1505
+	/**
1506
+	 * Prepare and json_encode post content
1507
+	 *
1508
+	 * @since 2.0
1509
+	 *
1510
+	 * @param array $post_content
1511
+	 * @return string $post_content ( json encoded array )
1512
+	 */
1513
+	public static function prepare_and_encode( $post_content ) {
1514
+		//Loop through array to strip slashes and add only the needed ones
1515 1515
 		foreach ( $post_content as $key => $val ) {
1516 1516
 			// Replace problematic characters (like &quot;)
1517 1517
 			$val = str_replace( '&quot;', '"', $val );
1518 1518
 
1519 1519
 			self::prepare_action_slashes( $val, $key, $post_content );
1520
-            unset( $key, $val );
1521
-        }
1520
+			unset( $key, $val );
1521
+		}
1522 1522
 
1523
-        // json_encode the array
1524
-        $post_content = json_encode( $post_content );
1523
+		// json_encode the array
1524
+		$post_content = json_encode( $post_content );
1525 1525
 
1526
-	    // add extra slashes for \r\n since WP strips them
1526
+		// add extra slashes for \r\n since WP strips them
1527 1527
 		$post_content = str_replace( array( '\\r', '\\n', '\\u', '\\t' ), array( '\\\\r', '\\\\n', '\\\\u', '\\\\t' ), $post_content );
1528 1528
 
1529
-        // allow for &quot
1530
-	    $post_content = str_replace( '&quot;', '\\"', $post_content );
1529
+		// allow for &quot
1530
+		$post_content = str_replace( '&quot;', '\\"', $post_content );
1531 1531
 
1532
-        return $post_content;
1533
-    }
1532
+		return $post_content;
1533
+	}
1534 1534
 
1535 1535
 	private static function prepare_action_slashes( $val, $key, &$post_content ) {
1536 1536
 		if ( ! isset( $post_content[ $key ] ) ) {
@@ -1553,54 +1553,54 @@  discard block
 block discarded – undo
1553 1553
 
1554 1554
 	public static function maybe_json_decode( $string ) {
1555 1555
 		if ( is_array( $string ) ) {
1556
-            return $string;
1557
-        }
1556
+			return $string;
1557
+		}
1558 1558
 
1559 1559
 		$new_string = json_decode( $string, true );
1560 1560
 		if ( function_exists( 'json_last_error' ) ) {
1561 1561
 			// php 5.3+
1562
-            if ( json_last_error() == JSON_ERROR_NONE ) {
1563
-                $string = $new_string;
1564
-            }
1562
+			if ( json_last_error() == JSON_ERROR_NONE ) {
1563
+				$string = $new_string;
1564
+			}
1565 1565
 		} elseif ( isset( $new_string ) ) {
1566 1566
 			// php < 5.3 fallback
1567
-            $string = $new_string;
1568
-        }
1569
-        return $string;
1570
-    }
1571
-
1572
-    /**
1573
-     * @since 1.07.10
1574
-     *
1575
-     * @param string $post_type The name of the post type that may need to be highlighted
1576
-     * echo The javascript to open and highlight the Formidable menu
1577
-     */
1567
+			$string = $new_string;
1568
+		}
1569
+		return $string;
1570
+	}
1571
+
1572
+	/**
1573
+	 * @since 1.07.10
1574
+	 *
1575
+	 * @param string $post_type The name of the post type that may need to be highlighted
1576
+	 * echo The javascript to open and highlight the Formidable menu
1577
+	 */
1578 1578
 	public static function maybe_highlight_menu( $post_type ) {
1579
-        global $post;
1579
+		global $post;
1580 1580
 
1581 1581
 		if ( isset( $_REQUEST['post_type'] ) && $_REQUEST['post_type'] != $post_type ) {
1582
-            return;
1583
-        }
1582
+			return;
1583
+		}
1584 1584
 
1585 1585
 		if ( is_object( $post ) && $post->post_type != $post_type ) {
1586
-            return;
1587
-        }
1586
+			return;
1587
+		}
1588 1588
 
1589
-        self::load_admin_wide_js();
1590
-        echo '<script type="text/javascript">jQuery(document).ready(function(){frmSelectSubnav();});</script>';
1591
-    }
1589
+		self::load_admin_wide_js();
1590
+		echo '<script type="text/javascript">jQuery(document).ready(function(){frmSelectSubnav();});</script>';
1591
+	}
1592 1592
 
1593
-    /**
1594
-     * Load the JS file on non-Formidable pages in the admin area
1595
-     * @since 2.0
1596
-     */
1593
+	/**
1594
+	 * Load the JS file on non-Formidable pages in the admin area
1595
+	 * @since 2.0
1596
+	 */
1597 1597
 	public static function load_admin_wide_js( $load = true ) {
1598
-        $version = FrmAppHelper::plugin_version();
1598
+		$version = FrmAppHelper::plugin_version();
1599 1599
 		wp_register_script( 'formidable_admin_global', FrmAppHelper::plugin_url() . '/js/formidable_admin_global.js', array( 'jquery' ), $version );
1600 1600
 
1601 1601
 		$global_strings = array(
1602 1602
 			'updating_msg' => __( 'Please wait while your site updates.', 'formidable' ),
1603
-            'deauthorize'  => __( 'Are you sure you want to deauthorize Formidable Forms on this site?', 'formidable' ),
1603
+			'deauthorize'  => __( 'Are you sure you want to deauthorize Formidable Forms on this site?', 'formidable' ),
1604 1604
 			'url'          => FrmAppHelper::plugin_url(),
1605 1605
 			'loading'      => __( 'Loading&hellip;' ),
1606 1606
 			'nonce'        => wp_create_nonce( 'frm_ajax' ),
@@ -1610,7 +1610,7 @@  discard block
 block discarded – undo
1610 1610
 		if ( $load ) {
1611 1611
 			wp_enqueue_script( 'formidable_admin_global' );
1612 1612
 		}
1613
-    }
1613
+	}
1614 1614
 
1615 1615
 	/**
1616 1616
 	 * @since 2.0.9
@@ -1619,9 +1619,9 @@  discard block
 block discarded – undo
1619 1619
 		wp_enqueue_style( 'frm_fonts', self::plugin_url() . '/css/frm_fonts.css', array(), self::plugin_version() );
1620 1620
 	}
1621 1621
 
1622
-    /**
1623
-     * @param string $location
1624
-     */
1622
+	/**
1623
+	 * @param string $location
1624
+	 */
1625 1625
 	public static function localize_script( $location ) {
1626 1626
 		$ajax_url = admin_url( 'admin-ajax.php', is_ssl() ? 'admin' : 'http' );
1627 1627
 		$ajax_url = apply_filters( 'frm_ajax_url', $ajax_url );
@@ -1687,27 +1687,27 @@  discard block
 block discarded – undo
1687 1687
 		}
1688 1688
 	}
1689 1689
 
1690
-    /**
1690
+	/**
1691 1691
 	 * echo the message on the plugins listing page
1692
-     * @since 1.07.10
1693
-     *
1694
-     * @param float $min_version The version the add-on requires
1695
-     */
1692
+	 * @since 1.07.10
1693
+	 *
1694
+	 * @param float $min_version The version the add-on requires
1695
+	 */
1696 1696
 	public static function min_version_notice( $min_version ) {
1697
-        $frm_version = self::plugin_version();
1697
+		$frm_version = self::plugin_version();
1698 1698
 
1699
-        // check if Formidable meets minimum requirements
1699
+		// check if Formidable meets minimum requirements
1700 1700
 		if ( version_compare( $frm_version, $min_version, '>=' ) ) {
1701
-            return;
1702
-        }
1701
+			return;
1702
+		}
1703 1703
 
1704 1704
 		$wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
1705 1705
 		echo '<tr class="plugin-update-tr active"><th colspan="' . absint( $wp_list_table->get_column_count() ) . '" class="check-column plugin-update colspanchange"><div class="update-message">' .
1706
-        esc_html__( 'You are running an outdated version of Formidable. This plugin may not work correctly if you do not update Formidable.', 'formidable' ) .
1707
-        '</div></td></tr>';
1708
-    }
1706
+		esc_html__( 'You are running an outdated version of Formidable. This plugin may not work correctly if you do not update Formidable.', 'formidable' ) .
1707
+		'</div></td></tr>';
1708
+	}
1709 1709
 
1710
-    public static function locales( $type = 'date' ) {
1710
+	public static function locales( $type = 'date' ) {
1711 1711
 		$locales = array(
1712 1712
 			'en' => __( 'English', 'formidable' ),
1713 1713
 			''   => __( 'English/Western', 'formidable' ),
@@ -1786,8 +1786,8 @@  discard block
 block discarded – undo
1786 1786
 		$locales = array_diff_key( $locales, array_flip( $unset ) );
1787 1787
 		$locales = apply_filters( 'frm_locales', $locales );
1788 1788
 
1789
-        return $locales;
1790
-    }
1789
+		return $locales;
1790
+	}
1791 1791
 
1792 1792
 	/**
1793 1793
 	 * Used to filter shortcode in text widgets
Please login to merge, or discard this patch.
classes/helpers/FrmStylesHelper.php 2 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 
113 113
     /**
114 114
      * @since 2.0
115
-     * @return The class for this icon
115
+     * @return string class for this icon
116 116
      */
117 117
 	public static function icon_key_to_class( $key, $icon = '+', $type = 'arrow' ) {
118 118
 		if ( 'arrow' == $type && is_numeric( $key ) ) {
@@ -288,6 +288,7 @@  discard block
 block discarded – undo
288 288
 
289 289
 	/**
290 290
 	 * @since 2.3
291
+	 * @param string $default
291 292
 	 */
292 293
 	private static function get_color_output( $default, &$color ) {
293 294
 		$color = trim( $color );
Please login to merge, or discard this patch.
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 			<a href="<?php echo esc_url( admin_url( 'admin.php?page=formidable-styles&frm_action=custom_css' ) ); ?>" class="nav-tab <?php echo ( 'custom_css' == $active ) ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Custom CSS', 'formidable' ); ?></a>
19 19
         </h2>
20 20
 <?php
21
-    }
21
+	}
22 22
 
23 23
 	/**
24 24
 	 * @since 2.05
@@ -110,10 +110,10 @@  discard block
 block discarded – undo
110 110
 		);
111 111
 	}
112 112
 
113
-    /**
114
-     * @since 2.0
115
-     * @return The class for this icon
116
-     */
113
+	/**
114
+	 * @since 2.0
115
+	 * @return The class for this icon
116
+	 */
117 117
 	public static function icon_key_to_class( $key, $icon = '+', $type = 'arrow' ) {
118 118
 		if ( 'arrow' == $type && is_numeric( $key ) ) {
119 119
 			//frm_arrowup6_icon
@@ -132,20 +132,20 @@  discard block
 block discarded – undo
132 132
 			$class = 'frm_' . $plus[ $icon ];
133 133
 		}
134 134
 
135
-        if ( $key ) {
136
-            $class .= $key;
137
-        }
138
-        $class .= '_icon';
135
+		if ( $key ) {
136
+			$class .= $key;
137
+		}
138
+		$class .= '_icon';
139 139
 
140
-        return $class;
141
-    }
140
+		return $class;
141
+	}
142 142
 
143 143
 	public static function bs_icon_select( $style, $frm_style, $type = 'arrow' ) {
144 144
 		$function_name = $type . '_icons';
145 145
 		$icons = self::$function_name();
146 146
 		unset( $function_name );
147 147
 
148
-        $name = ( 'arrow' == $type ) ? 'collapse_icon' : 'repeat_icon';
148
+		$name = ( 'arrow' == $type ) ? 'collapse_icon' : 'repeat_icon';
149 149
 ?>
150 150
     	<select name="<?php echo esc_attr( $frm_style->get_field_name( $name ) ); ?>" id="frm_<?php echo esc_attr( $name ); ?>" class="frm_icon_font frm_multiselect hide-if-js">
151 151
             <?php foreach ( $icons as $key => $icon ) { ?>
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
             </ul>
179 179
         </div>
180 180
 <?php
181
-    }
181
+	}
182 182
 
183 183
 	public static function hex2rgb( $hex ) {
184 184
 		$hex = str_replace( '#', '', $hex );
Please login to merge, or discard this patch.
deprecated/FrmDeprecated.php 3 patches
Doc Comments   +5 added lines patch added patch discarded remove patch
@@ -10,6 +10,8 @@  discard block
 block discarded – undo
10 10
 
11 11
 	/**
12 12
 	 * @deprecated 2.3
13
+	 * @param string $function
14
+	 * @param string $version
13 15
 	 */
14 16
 	public static function deprecated( $function, $version ) {
15 17
 		_deprecated_function( $function, $version );
@@ -68,6 +70,7 @@  discard block
 block discarded – undo
68 70
 
69 71
 	/**
70 72
 	 * @deprecated 3.04.03
73
+	 * @param string $url
71 74
 	 */
72 75
 	private static function send_api_request( $url, $transient = array() ) {
73 76
 		$data = get_transient( $transient['name'] );
@@ -318,6 +321,7 @@  discard block
 block discarded – undo
318 321
 
319 322
 	/**
320 323
 	 * @deprecated 3.0
324
+	 * @param string $field
321 325
 	 */
322 326
 	private static function edit_in_place_value( $field ) {
323 327
 		_deprecated_function( __FUNCTION__, '3.0' );
@@ -714,6 +718,7 @@  discard block
 block discarded – undo
714 718
 
715 719
 	/**
716 720
 	 * @deprecated 3.02.03
721
+	 * @return string
717 722
 	 */
718 723
 	public static function get_form_for_page() {
719 724
 		_deprecated_function( __FUNCTION__, '3.02.03' );
Please login to merge, or discard this patch.
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -624,8 +624,8 @@  discard block
 block discarded – undo
624 624
 	 */
625 625
 	public static function get_shortcode_tag( $shortcodes, $short_key, $args ) {
626 626
 		_deprecated_function( __FUNCTION__, '3.0', 'FrmShortcodeHelper::get_shortcode_tag' );
627
-        return FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key, $args );
628
-    }
627
+		return FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key, $args );
628
+	}
629 629
 
630 630
 	/**
631 631
 	 * @deprecated 3.01
@@ -638,52 +638,52 @@  discard block
 block discarded – undo
638 638
 	/**
639 639
 	 * @deprecated 3.02.03
640 640
 	 */
641
-    public static function jquery_themes() {
641
+	public static function jquery_themes() {
642 642
 		_deprecated_function( __FUNCTION__, '3.02.03', 'FrmProStylesController::jquery_themes' );
643 643
 
644
-        $themes = array(
645
-            'ui-lightness'  => 'UI Lightness',
646
-            'ui-darkness'   => 'UI Darkness',
647
-            'smoothness'    => 'Smoothness',
648
-            'start'         => 'Start',
649
-            'redmond'       => 'Redmond',
650
-            'sunny'         => 'Sunny',
651
-            'overcast'      => 'Overcast',
652
-            'le-frog'       => 'Le Frog',
653
-            'flick'         => 'Flick',
644
+		$themes = array(
645
+			'ui-lightness'  => 'UI Lightness',
646
+			'ui-darkness'   => 'UI Darkness',
647
+			'smoothness'    => 'Smoothness',
648
+			'start'         => 'Start',
649
+			'redmond'       => 'Redmond',
650
+			'sunny'         => 'Sunny',
651
+			'overcast'      => 'Overcast',
652
+			'le-frog'       => 'Le Frog',
653
+			'flick'         => 'Flick',
654 654
 			'pepper-grinder' => 'Pepper Grinder',
655
-            'eggplant'      => 'Eggplant',
656
-            'dark-hive'     => 'Dark Hive',
657
-            'cupertino'     => 'Cupertino',
658
-            'south-street'  => 'South Street',
659
-            'blitzer'       => 'Blitzer',
660
-            'humanity'      => 'Humanity',
661
-            'hot-sneaks'    => 'Hot Sneaks',
662
-            'excite-bike'   => 'Excite Bike',
663
-            'vader'         => 'Vader',
664
-            'dot-luv'       => 'Dot Luv',
665
-            'mint-choc'     => 'Mint Choc',
666
-            'black-tie'     => 'Black Tie',
667
-            'trontastic'    => 'Trontastic',
668
-            'swanky-purse'  => 'Swanky Purse',
669
-        );
655
+			'eggplant'      => 'Eggplant',
656
+			'dark-hive'     => 'Dark Hive',
657
+			'cupertino'     => 'Cupertino',
658
+			'south-street'  => 'South Street',
659
+			'blitzer'       => 'Blitzer',
660
+			'humanity'      => 'Humanity',
661
+			'hot-sneaks'    => 'Hot Sneaks',
662
+			'excite-bike'   => 'Excite Bike',
663
+			'vader'         => 'Vader',
664
+			'dot-luv'       => 'Dot Luv',
665
+			'mint-choc'     => 'Mint Choc',
666
+			'black-tie'     => 'Black Tie',
667
+			'trontastic'    => 'Trontastic',
668
+			'swanky-purse'  => 'Swanky Purse',
669
+		);
670 670
 
671 671
 		$themes = apply_filters( 'frm_jquery_themes', $themes );
672
-        return $themes;
673
-    }
672
+		return $themes;
673
+	}
674 674
 
675 675
 	/**
676 676
 	 * @deprecated 3.02.03
677 677
 	 */
678
-    public static function enqueue_jquery_css() {
678
+	public static function enqueue_jquery_css() {
679 679
 		_deprecated_function( __FUNCTION__, '3.02.03', 'FrmProStylesController::enqueue_jquery_css' );
680 680
 
681 681
 		$form = self::get_form_for_page();
682 682
 		$theme_css = FrmStylesController::get_style_val( 'theme_css', $form );
683
-        if ( $theme_css != -1 ) {
683
+		if ( $theme_css != -1 ) {
684 684
 			wp_enqueue_style( 'jquery-theme', self::jquery_css_url( $theme_css ), array(), FrmAppHelper::plugin_version() );
685
-        }
686
-    }
685
+		}
686
+	}
687 687
 
688 688
 	/**
689 689
 	 * @deprecated 3.02.03
@@ -691,26 +691,26 @@  discard block
 block discarded – undo
691 691
 	public static function jquery_css_url( $theme_css ) {
692 692
 		_deprecated_function( __FUNCTION__, '3.02.03', 'FrmProStylesController::jquery_css_url' );
693 693
 
694
-        if ( $theme_css == -1 ) {
695
-            return;
696
-        }
694
+		if ( $theme_css == -1 ) {
695
+			return;
696
+		}
697 697
 
698
-        if ( ! $theme_css || $theme_css == '' || $theme_css == 'ui-lightness' ) {
699
-            $css_file = FrmAppHelper::plugin_url() . '/css/ui-lightness/jquery-ui.css';
698
+		if ( ! $theme_css || $theme_css == '' || $theme_css == 'ui-lightness' ) {
699
+			$css_file = FrmAppHelper::plugin_url() . '/css/ui-lightness/jquery-ui.css';
700 700
 		} elseif ( preg_match( '/^http.?:\/\/.*\..*$/', $theme_css ) ) {
701
-            $css_file = $theme_css;
702
-        } else {
703
-            $uploads = FrmStylesHelper::get_upload_base();
701
+			$css_file = $theme_css;
702
+		} else {
703
+			$uploads = FrmStylesHelper::get_upload_base();
704 704
 			$file_path = '/formidable/css/' . $theme_css . '/jquery-ui.css';
705 705
 			if ( file_exists( $uploads['basedir'] . $file_path ) ) {
706
-                $css_file = $uploads['baseurl'] . $file_path;
707
-            } else {
706
+				$css_file = $uploads['baseurl'] . $file_path;
707
+			} else {
708 708
 				$css_file = FrmAppHelper::jquery_ui_base_url() . '/themes/' . $theme_css . '/jquery-ui.min.css';
709
-            }
710
-        }
709
+			}
710
+		}
711 711
 
712
-        return $css_file;
713
-    }
712
+		return $css_file;
713
+	}
714 714
 
715 715
 	/**
716 716
 	 * @deprecated 3.02.03
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -343,8 +343,8 @@  discard block
 block discarded – undo
343 343
 		$path = untrailingslashit( trim( $path ) );
344 344
 		$templates = glob( $path . '/*.php' );
345 345
 
346
-		for ( $i = count( $templates ) - 1; $i >= 0; $i-- ) {
347
-			$filename = str_replace( '.php', '', str_replace( $path . '/', '', $templates[ $i ] ) );
346
+		for ( $i = count( $templates ) - 1; $i >= 0; $i -- ) {
347
+			$filename = str_replace( '.php', '', str_replace( $path . '/', '', $templates[$i] ) );
348 348
 			$template_query = array( 'form_key' => $filename );
349 349
 			if ( $template ) {
350 350
 				$template_query['is_template'] = 1;
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
 				$values['default_template'] = 1;
363 363
 			}
364 364
 
365
-			include( $templates[ $i ] );
365
+			include( $templates[$i] );
366 366
 
367 367
 			//get updated form
368 368
 			if ( isset( $form ) && ! empty( $form ) ) {
Please login to merge, or discard this patch.
classes/helpers/FrmFieldsHelper.php 1 patch
Indentation   +165 added lines, -165 removed lines patch added patch discarded remove patch
@@ -29,17 +29,17 @@  discard block
 block discarded – undo
29 29
 			}
30 30
 		}
31 31
 
32
-        return $values;
33
-    }
32
+		return $values;
33
+	}
34 34
 
35 35
 	public static function get_html_id( $field, $plus = '' ) {
36 36
 		return apply_filters( 'frm_field_html_id', 'field_' . $field['field_key'] . $plus, $field );
37
-    }
37
+	}
38 38
 
39
-    public static function setup_edit_vars( $field, $doing_ajax = false ) {
39
+	public static function setup_edit_vars( $field, $doing_ajax = false ) {
40 40
 		$values = self::field_object_to_array( $field );
41 41
 		return apply_filters( 'frm_setup_edit_field_vars', $values, array( 'doing_ajax' => $doing_ajax ) );
42
-    }
42
+	}
43 43
 
44 44
 	public static function field_object_to_array( $field ) {
45 45
 		$values = (array) $field;
@@ -239,18 +239,18 @@  discard block
 block discarded – undo
239 239
 		return $field_type->get_new_field_defaults();
240 240
 	}
241 241
 
242
-    public static function fill_field( &$values, $field, $form_id, $new_key = '' ) {
243
-        global $wpdb;
242
+	public static function fill_field( &$values, $field, $form_id, $new_key = '' ) {
243
+		global $wpdb;
244 244
 
245 245
 		$values['field_key'] = FrmAppHelper::get_unique_key( $new_key, $wpdb->prefix . 'frm_fields', 'field_key' );
246
-        $values['form_id'] = $form_id;
246
+		$values['form_id'] = $form_id;
247 247
 		$values['options'] = maybe_serialize( $field->options );
248 248
 		$values['default_value'] = maybe_serialize( $field->default_value );
249 249
 
250
-        foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) {
251
-            $values[ $col ] = $field->{$col};
252
-        }
253
-    }
250
+		foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) {
251
+			$values[ $col ] = $field->{$col};
252
+		}
253
+	}
254 254
 
255 255
 	/**
256 256
 	 * @since 2.0
@@ -389,26 +389,26 @@  discard block
 block discarded – undo
389 389
 		$html_id = isset( $field['html_id'] ) ? $field['html_id'] : self::get_html_id( $field );
390 390
 
391 391
 		foreach ( $field['options'] as $opt_key => $opt ) {
392
-		    $field_val = self::get_value_from_array( $opt, $opt_key, $field );
393
-		    $opt = self::get_label_from_array( $opt, $opt_key, $field );
392
+			$field_val = self::get_value_from_array( $opt, $opt_key, $field );
393
+			$opt = self::get_label_from_array( $opt, $opt_key, $field );
394 394
 
395 395
 			// Get string for Other text field, if needed
396 396
 			$other_val = self::get_other_val( compact( 'opt_key', 'field' ) );
397 397
 
398 398
 			$checked = ( $other_val || isset( $field['value'] ) && ( ( ! is_array( $field['value'] ) && $field['value'] == $field_val ) || ( is_array( $field['value'] ) && in_array( $field_val, $field['value'] ) ) ) ) ? ' checked="checked"' : '';
399 399
 
400
-		    // If this is an "Other" option, get the HTML for it
400
+			// If this is an "Other" option, get the HTML for it
401 401
 			if ( self::is_other_opt( $opt_key ) ) {
402 402
 				if ( FrmAppHelper::pro_is_installed() ) {
403 403
 					require( FrmProAppHelper::plugin_path() . '/classes/views/frmpro-fields/other-option.php' );
404 404
 				}
405
-		    } else {
405
+			} else {
406 406
 				require( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/single-option.php' );
407
-		    }
407
+			}
408 408
 
409 409
 			unset( $checked, $other_val );
410 410
 		}
411
-    }
411
+	}
412 412
 
413 413
 	public static function get_value_from_array( $opt, $opt_key, $field ) {
414 414
 		$opt = apply_filters( 'frm_field_value_saved', $opt, $opt_key, $field );
@@ -427,9 +427,9 @@  discard block
 block discarded – undo
427 427
 	 */
428 428
 	public static function get_term_link( $tax_id ) {
429 429
 		$tax = get_taxonomy( $tax_id );
430
-        if ( ! $tax ) {
431
-            return '';
432
-        }
430
+		if ( ! $tax ) {
431
+			return '';
432
+		}
433 433
 
434 434
 		$link = sprintf(
435 435
 			esc_html__( 'Please add options from the WordPress "%1$s" page', 'formidable' ),
@@ -437,8 +437,8 @@  discard block
 block discarded – undo
437 437
 		);
438 438
 		unset( $tax );
439 439
 
440
-        return $link;
441
-    }
440
+		return $link;
441
+	}
442 442
 
443 443
 	public static function value_meets_condition( $observed_value, $cond, $hide_opt ) {
444 444
 		$hide_opt = self::get_value_for_comparision( $hide_opt );
@@ -446,9 +446,9 @@  discard block
 block discarded – undo
446 446
 
447 447
 		if ( is_array( $observed_value ) ) {
448 448
 			return self::array_value_condition( $observed_value, $cond, $hide_opt );
449
-        }
449
+		}
450 450
 
451
-        $m = false;
451
+		$m = false;
452 452
 		if ( $cond == '==' ) {
453 453
 			$m = $observed_value == $hide_opt;
454 454
 		} elseif ( $cond == '!=' ) {
@@ -469,8 +469,8 @@  discard block
 block discarded – undo
469 469
 				$m = ( $m === false ) ? false : true;
470 470
 			}
471 471
 		}
472
-        return $m;
473
-    }
472
+		return $m;
473
+	}
474 474
 
475 475
 	/**
476 476
 	 * Trim and sanitize the values
@@ -486,8 +486,8 @@  discard block
 block discarded – undo
486 486
 	}
487 487
 
488 488
 	public static function array_value_condition( $observed_value, $cond, $hide_opt ) {
489
-        $m = false;
490
-        if ( $cond == '==' ) {
489
+		$m = false;
490
+		if ( $cond == '==' ) {
491 491
 			if ( is_array( $hide_opt ) ) {
492 492
 				$m = array_intersect( $hide_opt, $observed_value );
493 493
 				$m = empty( $m ) ? false : true;
@@ -511,35 +511,35 @@  discard block
 block discarded – undo
511 511
 				}
512 512
 			}
513 513
 
514
-            if ( $cond == 'not LIKE' ) {
515
-                $m = ( $m === false ) ? true : false;
516
-            }
517
-        }
514
+			if ( $cond == 'not LIKE' ) {
515
+				$m = ( $m === false ) ? true : false;
516
+			}
517
+		}
518 518
 
519
-        return $m;
520
-    }
519
+		return $m;
520
+	}
521 521
 
522
-    /**
523
-     * Replace a few basic shortcodes and field ids
524
-     * @since 2.0
525
-     * @return string
526
-     */
522
+	/**
523
+	 * Replace a few basic shortcodes and field ids
524
+	 * @since 2.0
525
+	 * @return string
526
+	 */
527 527
 	public static function basic_replace_shortcodes( $value, $form, $entry ) {
528 528
 		if ( strpos( $value, '[sitename]' ) !== false ) {
529
-            $new_value = wp_specialchars_decode( FrmAppHelper::site_name(), ENT_QUOTES );
529
+			$new_value = wp_specialchars_decode( FrmAppHelper::site_name(), ENT_QUOTES );
530 530
 			$value = str_replace( '[sitename]', $new_value, $value );
531
-        }
531
+		}
532 532
 
533 533
 		$value = apply_filters( 'frm_content', $value, $form, $entry );
534 534
 		$value = do_shortcode( $value );
535 535
 
536
-        return $value;
537
-    }
536
+		return $value;
537
+	}
538 538
 
539 539
 	public static function get_shortcodes( $content, $form_id ) {
540
-        if ( FrmAppHelper::pro_is_installed() ) {
540
+		if ( FrmAppHelper::pro_is_installed() ) {
541 541
 			return FrmProDisplaysHelper::get_shortcodes( $content, $form_id );
542
-        }
542
+		}
543 543
 
544 544
 		$fields = FrmField::getAll(
545 545
 			array(
@@ -552,23 +552,23 @@  discard block
 block discarded – undo
552 552
 
553 553
 		preg_match_all( "/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER );
554 554
 
555
-        return $matches;
556
-    }
555
+		return $matches;
556
+	}
557 557
 
558 558
 	public static function allowed_shortcodes( $fields = array() ) {
559 559
 		$tagregexp = array( 'editlink', 'id', 'key', 'ip', 'siteurl', 'sitename', 'admin_email', 'post[-|_]id', 'created[-|_]at', 'updated[-|_]at', 'updated[-|_]by', 'parent[-|_]id' );
560 560
 
561
-        foreach ( $fields as $field ) {
562
-            $tagregexp[] = $field->id;
563
-            $tagregexp[] = $field->field_key;
564
-        }
561
+		foreach ( $fields as $field ) {
562
+			$tagregexp[] = $field->id;
563
+			$tagregexp[] = $field->field_key;
564
+		}
565 565
 
566 566
 		$tagregexp = implode( '|', $tagregexp );
567
-        return $tagregexp;
568
-    }
567
+		return $tagregexp;
568
+	}
569 569
 
570 570
 	public static function replace_content_shortcodes( $content, $entry, $shortcodes ) {
571
-        foreach ( $shortcodes[0] as $short_key => $tag ) {
571
+		foreach ( $shortcodes[0] as $short_key => $tag ) {
572 572
 			if ( empty( $tag ) ) {
573 573
 				continue;
574 574
 			}
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
 		}
590 590
 
591 591
 		return $content;
592
-    }
592
+	}
593 593
 
594 594
 	/**
595 595
 	 * Prevent shortcodes in fields from being processed
@@ -698,44 +698,44 @@  discard block
 block discarded – undo
698 698
 		return $replace_with;
699 699
 	}
700 700
 
701
-    /**
702
-     * Get the value to replace a few standard shortcodes
703
-     *
704
-     * @since 2.0
705
-     * @return string
706
-     */
707
-    public static function dynamic_default_values( $tag, $atts = array(), $return_array = false ) {
708
-        $new_value = '';
709
-        switch ( $tag ) {
710
-            case 'admin_email':
701
+	/**
702
+	 * Get the value to replace a few standard shortcodes
703
+	 *
704
+	 * @since 2.0
705
+	 * @return string
706
+	 */
707
+	public static function dynamic_default_values( $tag, $atts = array(), $return_array = false ) {
708
+		$new_value = '';
709
+		switch ( $tag ) {
710
+			case 'admin_email':
711 711
 				$new_value = get_option( 'admin_email' );
712
-                break;
713
-            case 'siteurl':
714
-                $new_value = FrmAppHelper::site_url();
715
-                break;
716
-            case 'frmurl':
717
-                $new_value = FrmAppHelper::plugin_url();
718
-                break;
719
-            case 'sitename':
720
-                $new_value = FrmAppHelper::site_name();
721
-                break;
722
-            case 'get':
723
-                $new_value = self::process_get_shortcode( $atts, $return_array );
724
-        }
725
-
726
-        return $new_value;
727
-    }
728
-
729
-    /**
730
-     * Process the [get] shortcode
731
-     *
732
-     * @since 2.0
733
-     * @return string|array
734
-     */
735
-    public static function process_get_shortcode( $atts, $return_array = false ) {
712
+				break;
713
+			case 'siteurl':
714
+				$new_value = FrmAppHelper::site_url();
715
+				break;
716
+			case 'frmurl':
717
+				$new_value = FrmAppHelper::plugin_url();
718
+				break;
719
+			case 'sitename':
720
+				$new_value = FrmAppHelper::site_name();
721
+				break;
722
+			case 'get':
723
+				$new_value = self::process_get_shortcode( $atts, $return_array );
724
+		}
725
+
726
+		return $new_value;
727
+	}
728
+
729
+	/**
730
+	 * Process the [get] shortcode
731
+	 *
732
+	 * @since 2.0
733
+	 * @return string|array
734
+	 */
735
+	public static function process_get_shortcode( $atts, $return_array = false ) {
736 736
 		if ( ! isset( $atts['param'] ) ) {
737
-            return '';
738
-        }
737
+			return '';
738
+		}
739 739
 
740 740
 		if ( strpos( $atts['param'], '&#91;' ) ) {
741 741
 			$atts['param'] = str_replace( '&#91;', '[', $atts['param'] );
@@ -743,22 +743,22 @@  discard block
 block discarded – undo
743 743
 		}
744 744
 
745 745
 		$new_value = FrmAppHelper::get_param( $atts['param'], '', 'get', 'sanitize_text_field' );
746
-        $new_value = FrmAppHelper::get_query_var( $new_value, $atts['param'] );
746
+		$new_value = FrmAppHelper::get_query_var( $new_value, $atts['param'] );
747 747
 
748
-        if ( $new_value == '' ) {
748
+		if ( $new_value == '' ) {
749 749
 			if ( ! isset( $atts['prev_val'] ) ) {
750
-                $atts['prev_val'] = '';
751
-            }
750
+				$atts['prev_val'] = '';
751
+			}
752 752
 
753 753
 			$new_value = isset( $atts['default'] ) ? $atts['default'] : $atts['prev_val'];
754
-        }
754
+		}
755 755
 
756 756
 		if ( is_array( $new_value ) && ! $return_array ) {
757 757
 			$new_value = implode( ', ', $new_value );
758 758
 		}
759 759
 
760
-        return $new_value;
761
-    }
760
+		return $new_value;
761
+	}
762 762
 
763 763
 	public static function get_display_value( $value, $field, $atts = array() ) {
764 764
 
@@ -828,27 +828,27 @@  discard block
 block discarded – undo
828 828
 
829 829
 		$field_selection = array_merge( FrmField::pro_field_selection(), FrmField::field_selection() );
830 830
 
831
-        $field_types = array();
831
+		$field_types = array();
832 832
 		if ( in_array( $type, $single_input ) ) {
833
-            self::field_types_for_input( $single_input, $field_selection, $field_types );
833
+			self::field_types_for_input( $single_input, $field_selection, $field_types );
834 834
 		} elseif ( in_array( $type, $multiple_input ) ) {
835
-            self::field_types_for_input( $multiple_input, $field_selection, $field_types );
835
+			self::field_types_for_input( $multiple_input, $field_selection, $field_types );
836 836
 		} elseif ( in_array( $type, $other_type ) ) {
837
-            self::field_types_for_input( $other_type, $field_selection, $field_types );
837
+			self::field_types_for_input( $other_type, $field_selection, $field_types );
838 838
 		} elseif ( isset( $field_selection[ $type ] ) ) {
839
-            $field_types[ $type ] = $field_selection[ $type ];
840
-        }
839
+			$field_types[ $type ] = $field_selection[ $type ];
840
+		}
841 841
 
842 842
 		$field_types = apply_filters( 'frm_switch_field_types', $field_types, compact( 'type' ) );
843
-        return $field_types;
844
-    }
843
+		return $field_types;
844
+	}
845 845
 
846
-    private static function field_types_for_input( $inputs, $fields, &$field_types ) {
847
-        foreach ( $inputs as $input ) {
848
-            $field_types[ $input ] = $fields[ $input ];
846
+	private static function field_types_for_input( $inputs, $fields, &$field_types ) {
847
+		foreach ( $inputs as $input ) {
848
+			$field_types[ $input ] = $fields[ $input ];
849 849
 			unset( $input );
850
-        }
851
-    }
850
+		}
851
+	}
852 852
 
853 853
 	/**
854 854
 	 * Check if current field option is an "other" option
@@ -862,14 +862,14 @@  discard block
 block discarded – undo
862 862
 		return $opt_key && strpos( $opt_key, 'other_' ) === 0;
863 863
 	}
864 864
 
865
-    /**
866
-    * Get value that belongs in "Other" text box
867
-    *
868
-    * @since 2.0.6
869
-    *
870
-    * @param array $args
871
-    */
872
-    public static function get_other_val( $args ) {
865
+	/**
866
+	 * Get value that belongs in "Other" text box
867
+	 *
868
+	 * @since 2.0.6
869
+	 *
870
+	 * @param array $args
871
+	 */
872
+	public static function get_other_val( $args ) {
873 873
 		$defaults = array(
874 874
 			'opt_key' => 0,
875 875
 			'field'   => array(),
@@ -947,20 +947,20 @@  discard block
 block discarded – undo
947 947
 		}
948 948
 
949 949
 		return $other_val;
950
-    }
951
-
952
-    /**
953
-    * Check if there is a saved value for the "Other" text field. If so, set it as the $other_val.
954
-    * Intended for front-end use
955
-    *
956
-    * @since 2.0.6
957
-    *
958
-    * @param array $args should include field, opt_key and field name
959
-    * @param boolean $other_opt
960
-    * @param string $checked
961
-    * @return array $other_args
962
-    */
963
-    public static function prepare_other_input( $args, &$other_opt, &$checked ) {
950
+	}
951
+
952
+	/**
953
+	 * Check if there is a saved value for the "Other" text field. If so, set it as the $other_val.
954
+	 * Intended for front-end use
955
+	 *
956
+	 * @since 2.0.6
957
+	 *
958
+	 * @param array $args should include field, opt_key and field name
959
+	 * @param boolean $other_opt
960
+	 * @param string $checked
961
+	 * @return array $other_args
962
+	 */
963
+	public static function prepare_other_input( $args, &$other_opt, &$checked ) {
964 964
 		//Check if this is an "Other" option
965 965
 		if ( ! self::is_other_opt( $args['opt_key'] ) ) {
966 966
 			return;
@@ -976,8 +976,8 @@  discard block
 block discarded – undo
976 976
 			$checked = 'checked="checked" ';
977 977
 		}
978 978
 
979
-        return $other_args;
980
-    }
979
+		return $other_args;
980
+	}
981 981
 
982 982
 	/**
983 983
 	 * @param array $args
@@ -1034,8 +1034,8 @@  discard block
 block discarded – undo
1034 1034
 	 * @since 2.0.6
1035 1035
 	 */
1036 1036
 	public static function include_other_input( $args ) {
1037
-        if ( ! $args['other_opt'] ) {
1038
-        	return;
1037
+		if ( ! $args['other_opt'] ) {
1038
+			return;
1039 1039
 		}
1040 1040
 
1041 1041
 		$classes = array( 'frm_other_input' );
@@ -1060,15 +1060,15 @@  discard block
 block discarded – undo
1060 1060
 	}
1061 1061
 
1062 1062
 	/**
1063
-	* Get the HTML id for an "Other" text field
1064
-	* Note: This does not affect fields in repeating sections
1065
-	*
1066
-	* @since 2.0.08
1067
-	* @param string $type - field type
1068
-	* @param string $html_id
1069
-	* @param string|boolean $opt_key
1070
-	* @return string $other_id
1071
-	*/
1063
+	 * Get the HTML id for an "Other" text field
1064
+	 * Note: This does not affect fields in repeating sections
1065
+	 *
1066
+	 * @since 2.0.08
1067
+	 * @param string $type - field type
1068
+	 * @param string $html_id
1069
+	 * @param string|boolean $opt_key
1070
+	 * @return string $other_id
1071
+	 */
1072 1072
 	public static function get_other_field_html_id( $type, $html_id, $opt_key = false ) {
1073 1073
 		$other_id = $html_id;
1074 1074
 
@@ -1132,10 +1132,10 @@  discard block
 block discarded – undo
1132 1132
 	}
1133 1133
 
1134 1134
 	public static function switch_field_ids( $val ) {
1135
-        global $frm_duplicate_ids;
1136
-        $replace = array();
1137
-        $replace_with = array();
1138
-        foreach ( (array) $frm_duplicate_ids as $old => $new ) {
1135
+		global $frm_duplicate_ids;
1136
+		$replace = array();
1137
+		$replace_with = array();
1138
+		foreach ( (array) $frm_duplicate_ids as $old => $new ) {
1139 1139
 			$replace[] = '[if ' . $old . ']';
1140 1140
 			$replace_with[] = '[if ' . $new . ']';
1141 1141
 			$replace[] = '[if ' . $old . ' ';
@@ -1151,18 +1151,18 @@  discard block
 block discarded – undo
1151 1151
 			$replace[] = '[' . $old . ' ';
1152 1152
 			$replace_with[] = '[' . $new . ' ';
1153 1153
 			unset( $old, $new );
1154
-        }
1154
+		}
1155 1155
 		if ( is_array( $val ) ) {
1156 1156
 			foreach ( $val as $k => $v ) {
1157
-                $val[ $k ] = str_replace( $replace, $replace_with, $v );
1157
+				$val[ $k ] = str_replace( $replace, $replace_with, $v );
1158 1158
 				unset( $k, $v );
1159
-            }
1160
-        } else {
1159
+			}
1160
+		} else {
1161 1161
 			$val = str_replace( $replace, $replace_with, $val );
1162
-        }
1162
+		}
1163 1163
 
1164
-        return $val;
1165
-    }
1164
+		return $val;
1165
+	}
1166 1166
 
1167 1167
 	public static function get_us_states() {
1168 1168
 		$states = array(
@@ -1228,7 +1228,7 @@  discard block
 block discarded – undo
1228 1228
 	public static function get_bulk_prefilled_opts( array &$prepop ) {
1229 1229
 		$prepop[ __( 'Countries', 'formidable' ) ] = FrmFieldsHelper::get_countries();
1230 1230
 
1231
-        $states = FrmFieldsHelper::get_us_states();
1231
+		$states = FrmFieldsHelper::get_us_states();
1232 1232
 		$state_abv = array_keys( $states );
1233 1233
 		sort( $state_abv );
1234 1234
 		$prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv;
@@ -1277,7 +1277,7 @@  discard block
 block discarded – undo
1277 1277
 		);
1278 1278
 
1279 1279
 		$prepop = apply_filters( 'frm_bulk_field_choices', $prepop );
1280
-    }
1280
+	}
1281 1281
 
1282 1282
 	/**
1283 1283
 	 * Display a field value selector
@@ -1287,10 +1287,10 @@  discard block
 block discarded – undo
1287 1287
 	 * @param int $selector_field_id
1288 1288
 	 * @param array $selector_args
1289 1289
 	 */
1290
-    public static function display_field_value_selector( $selector_field_id, $selector_args ) {
1291
-	    $field_value_selector = FrmFieldFactory::create_field_value_selector( $selector_field_id, $selector_args );
1292
-	    $field_value_selector->display();
1293
-    }
1290
+	public static function display_field_value_selector( $selector_field_id, $selector_args ) {
1291
+		$field_value_selector = FrmFieldFactory::create_field_value_selector( $selector_field_id, $selector_args );
1292
+		$field_value_selector->display();
1293
+	}
1294 1294
 
1295 1295
 	/**
1296 1296
 	 * Convert a field object to a flat array
@@ -1330,7 +1330,7 @@  discard block
 block discarded – undo
1330 1330
 	 */
1331 1331
 	public static function get_shortcode_tag( $shortcodes, $short_key, $args ) {
1332 1332
 		return FrmDeprecated::get_shortcode_tag( $shortcodes, $short_key, $args );
1333
-    }
1333
+	}
1334 1334
 
1335 1335
 	/**
1336 1336
 	 * @deprecated 3.0
Please login to merge, or discard this patch.
classes/models/FrmAddon.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -41,15 +41,15 @@  discard block
 block discarded – undo
41 41
 	}
42 42
 
43 43
 	public function insert_installed_addon( $plugins ) {
44
-		$plugins[ $this->plugin_slug ] = $this;
44
+		$plugins[$this->plugin_slug] = $this;
45 45
 		return $plugins;
46 46
 	}
47 47
 
48 48
 	public static function get_addon( $plugin_slug ) {
49 49
 		$plugins = apply_filters( 'frm_installed_addons', array() );
50 50
 		$plugin = false;
51
-		if ( isset( $plugins[ $plugin_slug ] ) ) {
52
-			$plugin = $plugins[ $plugin_slug ];
51
+		if ( isset( $plugins[$plugin_slug] ) ) {
52
+			$plugin = $plugins[$plugin_slug];
53 53
 		}
54 54
 		return $plugin;
55 55
 	}
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 			);
106 106
 		} else {
107 107
 			$plugins = FrmAddonsController::get_addon_info( $this->license );
108
-			$_data = $plugins[ $item_id ];
108
+			$_data = $plugins[$item_id];
109 109
 		}
110 110
 
111 111
 		$_data['sections'] = array(
@@ -272,19 +272,19 @@  discard block
 block discarded – undo
272 272
 
273 273
 		if ( $this->is_current_version( $transient ) ) {
274 274
 			//make sure it doesn't show there is an update if plugin is up-to-date
275
-			if ( isset( $transient->response[ $this->plugin_folder ] ) ) {
276
-				unset( $transient->response[ $this->plugin_folder ] );
275
+			if ( isset( $transient->response[$this->plugin_folder] ) ) {
276
+				unset( $transient->response[$this->plugin_folder] );
277 277
 			}
278
-		} elseif ( isset( $transient->response ) && isset( $transient->response[ $this->plugin_folder ] ) ) {
279
-			$this->prepare_update_details( $transient->response[ $this->plugin_folder ] );
278
+		} elseif ( isset( $transient->response ) && isset( $transient->response[$this->plugin_folder] ) ) {
279
+			$this->prepare_update_details( $transient->response[$this->plugin_folder] );
280 280
 
281 281
 			// if the transient has expired, clear the update and trigger it again
282
-			if ( $transient->response[ $this->plugin_folder ] === false ) {
282
+			if ( $transient->response[$this->plugin_folder] === false ) {
283 283
 				if ( ! $this->has_been_cleared() ) {
284 284
 					$this->cleared_plugins();
285 285
 					$this->manually_queue_update();
286 286
 				}
287
-				unset( $transient->response[ $this->plugin_folder ] );
287
+				unset( $transient->response[$this->plugin_folder] );
288 288
 			}
289 289
 		}
290 290
 
@@ -365,13 +365,13 @@  discard block
 block discarded – undo
365 365
 			$version_info->new_version = $version_info->beta['version'];
366 366
 			$version_info->package     = $version_info->beta['package'];
367 367
 			if ( isset( $version_info->plugin ) && ! empty( $version_info->plugin ) ) {
368
-				$version_info->plugin  = $version_info->beta['plugin'];
368
+				$version_info->plugin = $version_info->beta['plugin'];
369 369
 			}
370 370
 		}
371 371
 	}
372 372
 
373 373
 	private function is_current_version( $transient ) {
374
-		if ( empty( $transient->checked ) || ! isset( $transient->checked[ $this->plugin_folder ] ) ) {
374
+		if ( empty( $transient->checked ) || ! isset( $transient->checked[$this->plugin_folder] ) ) {
375 375
 			return false;
376 376
 		}
377 377
 
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 			return true;
381 381
 		}
382 382
 
383
-		return isset( $transient->response ) && isset( $transient->response[ $this->plugin_folder ] ) && $transient->checked[ $this->plugin_folder ] === $transient->response[ $this->plugin_folder ]->new_version;
383
+		return isset( $transient->response ) && isset( $transient->response[$this->plugin_folder] ) && $transient->checked[$this->plugin_folder] === $transient->response[$this->plugin_folder]->new_version;
384 384
 	}
385 385
 
386 386
 	private function has_been_cleared() {
@@ -460,8 +460,8 @@  discard block
 block discarded – undo
460 460
 			$response['message'] = $response['status'];
461 461
 		} else {
462 462
 			$messages = $this->get_messages();
463
-			if ( is_string( $response['status'] ) && isset( $messages[ $response['status'] ] ) ) {
464
-				$response['message'] = $messages[ $response['status'] ];
463
+			if ( is_string( $response['status'] ) && isset( $messages[$response['status']] ) ) {
464
+				$response['message'] = $messages[$response['status']];
465 465
 			} else {
466 466
 				$response['message'] = FrmAppHelper::kses( $response['status'], array( 'a' ) );
467 467
 			}
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -306,7 +306,8 @@  discard block
 block discarded – undo
306 306
 
307 307
 		if ( isset( $version_info->new_version ) && ! empty( $version_info->new_version ) ) {
308 308
 			$this->clear_old_plugin_version( $version_info );
309
-			if ( $version_info === false ) { // was cleared with timeout
309
+			if ( $version_info === false ) {
310
+// was cleared with timeout
310 311
 				$transient = false;
311 312
 			} else {
312 313
 				$this->maybe_use_beta_url( $version_info );
@@ -393,7 +394,8 @@  discard block
 block discarded – undo
393 394
 	}
394 395
 
395 396
 	private function is_license_revoked() {
396
-		if ( empty( $this->license ) || empty( $this->plugin_slug ) || isset( $_POST['license'] ) ) { // WPCS: CSRF ok.
397
+		if ( empty( $this->license ) || empty( $this->plugin_slug ) || isset( $_POST['license'] ) ) {
398
+// WPCS: CSRF ok.
397 399
 			return;
398 400
 		}
399 401
 
Please login to merge, or discard this patch.
classes/models/FrmForm.php 2 patches
Indentation   +221 added lines, -221 removed lines patch added patch discarded remove patch
@@ -1,15 +1,15 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if ( ! defined( 'ABSPATH' ) ) {
3
-    die( 'You are not allowed to call this page directly.' );
3
+	die( 'You are not allowed to call this page directly.' );
4 4
 }
5 5
 
6 6
 class FrmForm {
7 7
 
8
-    /**
9
-     * @return int|boolean id on success or false on failure
10
-     */
11
-    public static function create( $values ) {
12
-        global $wpdb;
8
+	/**
9
+	 * @return int|boolean id on success or false on failure
10
+	 */
11
+	public static function create( $values ) {
12
+		global $wpdb;
13 13
 
14 14
 		$new_values = array(
15 15
 			'form_key'      => FrmAppHelper::get_unique_key( $values['form_key'], $wpdb->prefix . 'frm_forms', 'form_key' ),
@@ -34,52 +34,52 @@  discard block
 block discarded – undo
34 34
 		$options = apply_filters( 'frm_form_options_before_update', $options, $values );
35 35
 		$new_values['options'] = serialize( $options );
36 36
 
37
-        //if(isset($values['id']) && is_numeric($values['id']))
38
-        //    $new_values['id'] = $values['id'];
37
+		//if(isset($values['id']) && is_numeric($values['id']))
38
+		//    $new_values['id'] = $values['id'];
39 39
 
40 40
 		$wpdb->insert( $wpdb->prefix . 'frm_forms', $new_values );
41 41
 
42
-        $id = $wpdb->insert_id;
42
+		$id = $wpdb->insert_id;
43 43
 
44 44
 		// Clear form caching
45 45
 		self::clear_form_cache();
46 46
 
47
-        return $id;
48
-    }
47
+		return $id;
48
+	}
49 49
 
50
-    /**
51
-     * @return int|boolean ID on success or false on failure
52
-     */
53
-    public static function duplicate( $id, $template = false, $copy_keys = false, $blog_id = false ) {
54
-        global $wpdb;
50
+	/**
51
+	 * @return int|boolean ID on success or false on failure
52
+	 */
53
+	public static function duplicate( $id, $template = false, $copy_keys = false, $blog_id = false ) {
54
+		global $wpdb;
55 55
 
56
-        $values = self::getOne( $id, $blog_id );
57
-        if ( ! $values ) {
58
-            return false;
59
-        }
56
+		$values = self::getOne( $id, $blog_id );
57
+		if ( ! $values ) {
58
+			return false;
59
+		}
60 60
 
61
-        $new_key = $copy_keys ? $values->form_key : '';
61
+		$new_key = $copy_keys ? $values->form_key : '';
62 62
 
63
-        $new_values = array(
63
+		$new_values = array(
64 64
 			'form_key'      => FrmAppHelper::get_unique_key( $new_key, $wpdb->prefix . 'frm_forms', 'form_key' ),
65
-            'name'          => $values->name,
66
-            'description'   => $values->description,
67
-            'status'        => $template ? 'published' : 'draft',
68
-            'logged_in'     => $values->logged_in ? $values->logged_in : 0,
69
-            'editable'      => $values->editable ? $values->editable : 0,
65
+			'name'          => $values->name,
66
+			'description'   => $values->description,
67
+			'status'        => $template ? 'published' : 'draft',
68
+			'logged_in'     => $values->logged_in ? $values->logged_in : 0,
69
+			'editable'      => $values->editable ? $values->editable : 0,
70 70
 			'created_at'    => current_time( 'mysql', 1 ),
71
-            'is_template'   => $template ? 1 : 0,
72
-        );
71
+			'is_template'   => $template ? 1 : 0,
72
+		);
73 73
 
74
-        if ( $blog_id ) {
75
-            $new_values['status'] = 'published';
74
+		if ( $blog_id ) {
75
+			$new_values['status'] = 'published';
76 76
 			$new_options = maybe_unserialize( $values->options );
77 77
 			$new_options['email_to'] = get_option( 'admin_email' );
78
-            $new_options['copy'] = false;
79
-            $new_values['options'] = $new_options;
80
-        } else {
81
-            $new_values['options'] = $values->options;
82
-        }
78
+			$new_options['copy'] = false;
79
+			$new_values['options'] = $new_options;
80
+		} else {
81
+			$new_values['options'] = $values->options;
82
+		}
83 83
 
84 84
 		if ( is_array( $new_values['options'] ) ) {
85 85
 			$new_values['options'] = serialize( $new_values['options'] );
@@ -87,20 +87,20 @@  discard block
 block discarded – undo
87 87
 
88 88
 		$query_results = $wpdb->insert( $wpdb->prefix . 'frm_forms', $new_values );
89 89
 
90
-        if ( $query_results ) {
90
+		if ( $query_results ) {
91 91
 			// Clear form caching
92 92
 			self::clear_form_cache();
93 93
 
94
-            $form_id = $wpdb->insert_id;
94
+			$form_id = $wpdb->insert_id;
95 95
 			FrmField::duplicate( $id, $form_id, $copy_keys, $blog_id );
96 96
 
97
-            // update form settings after fields are created
97
+			// update form settings after fields are created
98 98
 			do_action( 'frm_after_duplicate_form', $form_id, $new_values, array( 'old_id' => $id ) );
99
-            return $form_id;
100
-        }
99
+			return $form_id;
100
+		}
101 101
 
102
-        return false;
103
-    }
102
+		return false;
103
+	}
104 104
 
105 105
 	public static function after_duplicate( $form_id, $values ) {
106 106
 		$new_opts = maybe_unserialize( $values['options'] );
@@ -112,48 +112,48 @@  discard block
 block discarded – undo
112 112
 
113 113
 		$new_opts = apply_filters( 'frm_after_duplicate_form_values', $new_opts, $form_id );
114 114
 
115
-        if ( $new_opts != $values['options'] ) {
116
-            global $wpdb;
115
+		if ( $new_opts != $values['options'] ) {
116
+			global $wpdb;
117 117
 			$wpdb->update( $wpdb->prefix . 'frm_forms', array( 'options' => maybe_serialize( $new_opts ) ), array( 'id' => $form_id ) );
118
-        }
119
-    }
118
+		}
119
+	}
120 120
 
121
-    /**
122
-     * @return int|boolean
123
-     */
124
-    public static function update( $id, $values, $create_link = false ) {
125
-        global $wpdb;
121
+	/**
122
+	 * @return int|boolean
123
+	 */
124
+	public static function update( $id, $values, $create_link = false ) {
125
+		global $wpdb;
126 126
 
127
-        if ( ! isset( $values['status'] ) && ( $create_link || isset( $values['options'] ) || isset( $values['item_meta'] ) || isset( $values['field_options'] ) ) ) {
128
-            $values['status'] = 'published';
129
-        }
127
+		if ( ! isset( $values['status'] ) && ( $create_link || isset( $values['options'] ) || isset( $values['item_meta'] ) || isset( $values['field_options'] ) ) ) {
128
+			$values['status'] = 'published';
129
+		}
130 130
 
131 131
 		if ( isset( $values['form_key'] ) ) {
132 132
 			$values['form_key'] = FrmAppHelper::get_unique_key( $values['form_key'], $wpdb->prefix . 'frm_forms', 'form_key', $id );
133
-        }
133
+		}
134 134
 
135 135
 		$form_fields = array( 'form_key', 'name', 'description', 'status', 'parent_form_id' );
136 136
 
137 137
 		$new_values = self::set_update_options( array(), $values );
138 138
 
139
-        foreach ( $values as $value_key => $value ) {
139
+		foreach ( $values as $value_key => $value ) {
140 140
 			if ( $value_key && in_array( $value_key, $form_fields ) ) {
141 141
 				$new_values[ $value_key ] = $value;
142
-            }
143
-        }
142
+			}
143
+		}
144 144
 
145
-        if ( isset( $values['new_status'] ) && ! empty( $values['new_status'] ) ) {
146
-            $new_values['status'] = $values['new_status'];
147
-        }
145
+		if ( isset( $values['new_status'] ) && ! empty( $values['new_status'] ) ) {
146
+			$new_values['status'] = $values['new_status'];
147
+		}
148 148
 
149
-        if ( ! empty( $new_values ) ) {
149
+		if ( ! empty( $new_values ) ) {
150 150
 			$query_results = $wpdb->update( $wpdb->prefix . 'frm_forms', $new_values, array( 'id' => $id ) );
151
-            if ( $query_results ) {
151
+			if ( $query_results ) {
152 152
 				self::clear_form_cache();
153
-            }
154
-        } else {
155
-            $query_results = true;
156
-        }
153
+			}
154
+		} else {
155
+			$query_results = true;
156
+		}
157 157
 		unset( $new_values );
158 158
 
159 159
 		$values = self::update_fields( $id, $values );
@@ -161,16 +161,16 @@  discard block
 block discarded – undo
161 161
 		do_action( 'frm_update_form', $id, $values );
162 162
 		do_action( 'frm_update_form_' . $id, $values );
163 163
 
164
-        return $query_results;
165
-    }
164
+		return $query_results;
165
+	}
166 166
 
167
-    /**
168
-     * @return array
169
-     */
167
+	/**
168
+	 * @return array
169
+	 */
170 170
 	public static function set_update_options( $new_values, $values ) {
171 171
 		if ( ! isset( $values['options'] ) ) {
172
-            return $new_values;
173
-        }
172
+			return $new_values;
173
+		}
174 174
 
175 175
 		$options = isset( $values['options'] ) ? (array) $values['options'] : array();
176 176
 		FrmFormsHelper::fill_form_options( $options, $values );
@@ -184,17 +184,17 @@  discard block
 block discarded – undo
184 184
 		$new_values['options'] = serialize( $options );
185 185
 
186 186
 		return $new_values;
187
-    }
187
+	}
188 188
 
189 189
 
190
-    /**
191
-     * @return array
192
-     */
190
+	/**
191
+	 * @return array
192
+	 */
193 193
 	public static function update_fields( $id, $values ) {
194 194
 
195 195
 		if ( ! isset( $values['item_meta'] ) && ! isset( $values['field_options'] ) ) {
196
-            return $values;
197
-        }
196
+			return $values;
197
+		}
198 198
 
199 199
 		$all_fields = FrmField::get_all_for_form( $id );
200 200
 		if ( empty( $all_fields ) ) {
@@ -205,26 +205,26 @@  discard block
 block discarded – undo
205 205
 			$values['item_meta'] = array();
206 206
 		}
207 207
 
208
-        $field_array = array();
209
-        $existing_keys = array_keys( $values['item_meta'] );
210
-        foreach ( $all_fields as $fid ) {
208
+		$field_array = array();
209
+		$existing_keys = array_keys( $values['item_meta'] );
210
+		foreach ( $all_fields as $fid ) {
211 211
 			if ( ! in_array( $fid->id, $existing_keys ) && ( isset( $values['frm_fields_submitted'] ) && in_array( $fid->id, $values['frm_fields_submitted'] ) ) || isset( $values['options'] ) ) {
212 212
 				$values['item_meta'][ $fid->id ] = '';
213
-            }
213
+			}
214 214
 			$field_array[ $fid->id ] = $fid;
215
-        }
215
+		}
216 216
 		unset( $all_fields );
217 217
 
218
-        foreach ( $values['item_meta'] as $field_id => $default_value ) {
218
+		foreach ( $values['item_meta'] as $field_id => $default_value ) {
219 219
 			if ( isset( $field_array[ $field_id ] ) ) {
220 220
 				$field = $field_array[ $field_id ];
221
-            } else {
221
+			} else {
222 222
 				$field = FrmField::getOne( $field_id );
223
-            }
223
+			}
224 224
 
225
-            if ( ! $field ) {
226
-                continue;
227
-            }
225
+			if ( ! $field ) {
226
+				continue;
227
+			}
228 228
 
229 229
 			$is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options'][ 'custom_html_' . $field_id ] ) );
230 230
 			if ( $is_settings_page ) {
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 			foreach ( $update_options as $opt => $default ) {
244 244
 				$field->field_options[ $opt ] = isset( $values['field_options'][ $opt . '_' . $field_id ] ) ? $values['field_options'][ $opt . '_' . $field_id ] : $default;
245 245
 				self::sanitize_field_opt( $opt, $field->field_options[ $opt ] );
246
-            }
246
+			}
247 247
 
248 248
 			$field->field_options = apply_filters( 'frm_update_field_options', $field->field_options, $field, $values );
249 249
 			$default_value = maybe_serialize( $values['item_meta'][ $field_id ] );
@@ -258,11 +258,11 @@  discard block
 block discarded – undo
258 258
 			FrmField::update( $field_id, $new_field );
259 259
 
260 260
 			FrmField::delete_form_transient( $field->form_id );
261
-        }
261
+		}
262 262
 		self::clear_form_cache();
263 263
 
264
-        return $values;
265
-    }
264
+		return $values;
265
+	}
266 266
 
267 267
 	private static function sanitize_field_opt( $opt, &$value ) {
268 268
 		if ( is_string( $value ) ) {
@@ -310,21 +310,21 @@  discard block
 block discarded – undo
310 310
 		}
311 311
 	}
312 312
 
313
-    /**
314
-     * @param string $status
315
-     * @return int|boolean
316
-     */
313
+	/**
314
+	 * @param string $status
315
+	 * @return int|boolean
316
+	 */
317 317
 	public static function set_status( $id, $status ) {
318
-        if ( 'trash' == $status ) {
318
+		if ( 'trash' == $status ) {
319 319
 			return self::trash( $id );
320
-        }
320
+		}
321 321
 
322 322
 		$statuses  = array( 'published', 'draft', 'trash' );
323
-        if ( ! in_array( $status, $statuses ) ) {
324
-            return false;
325
-        }
323
+		if ( ! in_array( $status, $statuses ) ) {
324
+			return false;
325
+		}
326 326
 
327
-        global $wpdb;
327
+		global $wpdb;
328 328
 
329 329
 		if ( is_array( $id ) ) {
330 330
 			$where = array(
@@ -336,33 +336,33 @@  discard block
 block discarded – undo
336 336
 			array_unshift( $where['values'], $status );
337 337
 
338 338
 			$query_results = $wpdb->query( $wpdb->prepare( 'UPDATE ' . $wpdb->prefix . 'frm_forms SET status = %s ' . $where['where'], $where['values'] ) ); // WPCS: unprepared SQL ok.
339
-        } else {
339
+		} else {
340 340
 			$query_results = $wpdb->update( $wpdb->prefix . 'frm_forms', array( 'status' => $status ), array( 'id' => $id ) );
341 341
 			$wpdb->update( $wpdb->prefix . 'frm_forms', array( 'status' => $status ), array( 'parent_form_id' => $id ) );
342
-        }
342
+		}
343 343
 
344
-        if ( $query_results ) {
344
+		if ( $query_results ) {
345 345
 			self::clear_form_cache();
346
-        }
346
+		}
347 347
 
348
-        return $query_results;
349
-    }
348
+		return $query_results;
349
+	}
350 350
 
351
-    /**
352
-     * @return int|boolean
353
-     */
351
+	/**
352
+	 * @return int|boolean
353
+	 */
354 354
 	public static function trash( $id ) {
355
-        if ( ! EMPTY_TRASH_DAYS ) {
356
-            return self::destroy( $id );
357
-        }
355
+		if ( ! EMPTY_TRASH_DAYS ) {
356
+			return self::destroy( $id );
357
+		}
358 358
 
359 359
 		$form = self::getOne( $id );
360
-        if ( ! $form ) {
361
-            return false;
362
-        }
360
+		if ( ! $form ) {
361
+			return false;
362
+		}
363 363
 
364
-        $options = $form->options;
365
-        $options['trash_time'] = time();
364
+		$options = $form->options;
365
+		$options['trash_time'] = time();
366 366
 
367 367
 		global $wpdb;
368 368
 		$query_results = $wpdb->update(
@@ -387,39 +387,39 @@  discard block
 block discarded – undo
387 387
 			)
388 388
 		);
389 389
 
390
-        if ( $query_results ) {
390
+		if ( $query_results ) {
391 391
 			self::clear_form_cache();
392
-        }
392
+		}
393 393
 
394
-        return $query_results;
395
-    }
394
+		return $query_results;
395
+	}
396 396
 
397
-    /**
398
-     * @return int|boolean
399
-     */
397
+	/**
398
+	 * @return int|boolean
399
+	 */
400 400
 	public static function destroy( $id ) {
401
-        global $wpdb;
401
+		global $wpdb;
402 402
 
403 403
 		$form = self::getOne( $id );
404
-        if ( ! $form ) {
405
-            return false;
406
-        }
404
+		if ( ! $form ) {
405
+			return false;
406
+		}
407 407
 		$id = $form->id;
408 408
 
409
-        // Disconnect the entries from this form
409
+		// Disconnect the entries from this form
410 410
 		$entries = FrmDb::get_col( $wpdb->prefix . 'frm_items', array( 'form_id' => $id ) );
411 411
 		foreach ( $entries as $entry_id ) {
412 412
 			FrmEntry::destroy( $entry_id );
413 413
 			unset( $entry_id );
414 414
 		}
415 415
 
416
-        // Disconnect the fields from this form
416
+		// Disconnect the fields from this form
417 417
 		$wpdb->query( $wpdb->prepare( 'DELETE fi FROM ' . $wpdb->prefix . 'frm_fields AS fi LEFT JOIN ' . $wpdb->prefix . 'frm_forms fr ON (fi.form_id = fr.id) WHERE fi.form_id=%d OR parent_form_id=%d', $id, $id ) );
418 418
 
419 419
 		$query_results = $wpdb->query( $wpdb->prepare( 'DELETE FROM ' . $wpdb->prefix . 'frm_forms WHERE id=%d OR parent_form_id=%d', $id, $id ) );
420
-        if ( $query_results ) {
421
-            // Delete all form actions linked to this form
422
-            $action_control = FrmFormActionsController::get_form_actions( 'email' );
420
+		if ( $query_results ) {
421
+			// Delete all form actions linked to this form
422
+			$action_control = FrmFormActionsController::get_form_actions( 'email' );
423 423
 			$action_control->destroy( $id, 'all' );
424 424
 
425 425
 			// Clear form caching
@@ -427,10 +427,10 @@  discard block
 block discarded – undo
427 427
 
428 428
 			do_action( 'frm_destroy_form', $id );
429 429
 			do_action( 'frm_destroy_form_' . $id );
430
-        }
430
+		}
431 431
 
432
-        return $query_results;
433
-    }
432
+		return $query_results;
433
+	}
434 434
 
435 435
 	/**
436 436
 	 * Delete trashed forms based on how long they have been trashed
@@ -462,48 +462,48 @@  discard block
 block discarded – undo
462 462
 		return $count;
463 463
 	}
464 464
 
465
-    /**
466
-     * @return string form name
467
-     */
468
-    public static function getName( $id ) {
465
+	/**
466
+	 * @return string form name
467
+	 */
468
+	public static function getName( $id ) {
469 469
 		$form = FrmDb::check_cache( $id, 'frm_form' );
470
-        if ( $form ) {
470
+		if ( $form ) {
471 471
 			$r = stripslashes( $form->name );
472
-            return $r;
473
-        }
472
+			return $r;
473
+		}
474 474
 
475
-        $query_key = is_numeric( $id ) ? 'id' : 'form_key';
476
-        $r = FrmDb::get_var( 'frm_forms', array( $query_key => $id ), 'name' );
475
+		$query_key = is_numeric( $id ) ? 'id' : 'form_key';
476
+		$r = FrmDb::get_var( 'frm_forms', array( $query_key => $id ), 'name' );
477 477
 		$r = stripslashes( $r );
478 478
 
479
-        return $r;
480
-    }
479
+		return $r;
480
+	}
481 481
 
482
-    /**
482
+	/**
483 483
 	 * @since 3.0
484
-     * @param string $key
485
-     * @return int form id
486
-     */
484
+	 * @param string $key
485
+	 * @return int form id
486
+	 */
487 487
 	public static function get_id_by_key( $key ) {
488 488
 		return (int) FrmDb::get_var( 'frm_forms', array( 'form_key' => sanitize_title( $key ) ) );
489
-    }
489
+	}
490 490
 
491
-    /**
491
+	/**
492 492
 	 * @since 3.0
493
-     * @param int $id
494
-     * @return string form key
495
-     */
493
+	 * @param int $id
494
+	 * @return string form key
495
+	 */
496 496
 	public static function get_key_by_id( $id ) {
497
-        $id = (int) $id;
497
+		$id = (int) $id;
498 498
 		$cache = FrmDb::check_cache( $id, 'frm_form' );
499
-        if ( $cache ) {
500
-            return $cache->form_key;
501
-        }
499
+		if ( $cache ) {
500
+			return $cache->form_key;
501
+		}
502 502
 
503
-        $key = FrmDb::get_var( 'frm_forms', array( 'id' => $id ), 'form_key' );
503
+		$key = FrmDb::get_var( 'frm_forms', array( 'id' => $id ), 'form_key' );
504 504
 
505
-        return $key;
506
-    }
505
+		return $key;
506
+	}
507 507
 
508 508
 	/**
509 509
 	 * If $form is numeric, get the form object
@@ -516,47 +516,47 @@  discard block
 block discarded – undo
516 516
 		}
517 517
 	}
518 518
 
519
-    /**
520
-     * @return object form
521
-     */
522
-    public static function getOne( $id, $blog_id = false ) {
523
-        global $wpdb;
519
+	/**
520
+	 * @return object form
521
+	 */
522
+	public static function getOne( $id, $blog_id = false ) {
523
+		global $wpdb;
524 524
 
525
-        if ( $blog_id && is_multisite() ) {
526
-            global $wpmuBaseTablePrefix;
525
+		if ( $blog_id && is_multisite() ) {
526
+			global $wpmuBaseTablePrefix;
527 527
 			$prefix = $wpmuBaseTablePrefix ? $wpmuBaseTablePrefix . $blog_id . '_' : $wpdb->get_blog_prefix( $blog_id );
528 528
 
529 529
 			$table_name = $prefix . 'frm_forms';
530
-        } else {
530
+		} else {
531 531
 			$table_name = $wpdb->prefix . 'frm_forms';
532 532
 			$cache = wp_cache_get( $id, 'frm_form' );
533
-            if ( $cache ) {
533
+			if ( $cache ) {
534 534
 				if ( isset( $cache->options ) ) {
535 535
 					$cache->options = maybe_unserialize( $cache->options );
536
-                }
536
+				}
537 537
 
538 538
 				return stripslashes_deep( $cache );
539
-            }
540
-        }
539
+			}
540
+		}
541 541
 
542 542
 		if ( is_numeric( $id ) ) {
543
-            $where = array( 'id' => $id );
544
-        } else {
545
-            $where = array( 'form_key' => $id );
546
-        }
543
+			$where = array( 'id' => $id );
544
+		} else {
545
+			$where = array( 'form_key' => $id );
546
+		}
547 547
 
548
-        $results = FrmDb::get_row( $table_name, $where );
548
+		$results = FrmDb::get_row( $table_name, $where );
549 549
 
550 550
 		if ( isset( $results->options ) ) {
551 551
 			FrmDb::set_cache( $results->id, $results, 'frm_form' );
552 552
 			$results->options = maybe_unserialize( $results->options );
553
-        }
553
+		}
554 554
 		return stripslashes_deep( $results );
555
-    }
555
+	}
556 556
 
557
-    /**
558
-     * @return object|array of objects
559
-     */
557
+	/**
558
+	 * @return object|array of objects
559
+	 */
560 560
 	public static function getAll( $where = array(), $order_by = '', $limit = '' ) {
561 561
 		if ( is_array( $where ) && ! empty( $where ) ) {
562 562
 			if ( isset( $where['is_template'] ) && $where['is_template'] && ! isset( $where['status'] ) ) {
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 		}
587 587
 
588 588
 		return stripslashes_deep( $results );
589
-    }
589
+	}
590 590
 
591 591
 	/**
592 592
 	 * Get all published forms
@@ -604,18 +604,18 @@  discard block
 block discarded – undo
604 604
 		return $forms;
605 605
 	}
606 606
 
607
-    /**
608
-     * @return int count of forms
609
-     */
610
-    public static function get_count() {
611
-    	global $wpdb;
607
+	/**
608
+	 * @return int count of forms
609
+	 */
610
+	public static function get_count() {
611
+		global $wpdb;
612 612
 
613
-    	$cache_key = 'frm_form_counts';
613
+		$cache_key = 'frm_form_counts';
614 614
 
615
-    	$counts = wp_cache_get( $cache_key, 'frm_form' );
616
-    	if ( false !== $counts ) {
617
-    	    return $counts;
618
-    	}
615
+		$counts = wp_cache_get( $cache_key, 'frm_form' );
616
+		if ( false !== $counts ) {
617
+			return $counts;
618
+		}
619 619
 
620 620
 		$results = (array) FrmDb::get_results(
621 621
 			'frm_forms',
@@ -628,31 +628,31 @@  discard block
 block discarded – undo
628 628
 		);
629 629
 
630 630
 		$statuses = array( 'published', 'draft', 'template', 'trash' );
631
-    	$counts = array_fill_keys( $statuses, 0 );
631
+		$counts = array_fill_keys( $statuses, 0 );
632 632
 
633
-    	foreach ( $results as $row ) {
634
-            if ( 'trash' != $row->status ) {
635
-    	        if ( $row->is_template ) {
633
+		foreach ( $results as $row ) {
634
+			if ( 'trash' != $row->status ) {
635
+				if ( $row->is_template ) {
636 636
 					$counts['template']++;
637
-    	        } else {
637
+				} else {
638 638
 					$counts['published']++;
639
-    	        }
640
-    	    } else {
639
+				}
640
+			} else {
641 641
 				$counts['trash']++;
642
-        	}
642
+			}
643 643
 
644
-    	    if ( 'draft' == $row->status ) {
644
+			if ( 'draft' == $row->status ) {
645 645
 				$counts['draft']++;
646
-    	    }
646
+			}
647 647
 
648 648
 			unset( $row );
649
-    	}
649
+		}
650 650
 
651
-    	$counts = (object) $counts;
651
+		$counts = (object) $counts;
652 652
 		FrmDb::set_cache( $cache_key, $counts, 'frm_form' );
653 653
 
654
-    	return $counts;
655
-    }
654
+		return $counts;
655
+	}
656 656
 
657 657
 	/**
658 658
 	 * Clear form caching
@@ -665,14 +665,14 @@  discard block
 block discarded – undo
665 665
 		FrmDb::cache_delete_group( 'frm_form' );
666 666
 	}
667 667
 
668
-    /**
669
-     * @return array of errors
670
-     */
668
+	/**
669
+	 * @return array of errors
670
+	 */
671 671
 	public static function validate( $values ) {
672
-        $errors = array();
672
+		$errors = array();
673 673
 
674 674
 		return apply_filters( 'frm_validate_form', $errors, $values );
675
-    }
675
+	}
676 676
 
677 677
 	public static function get_params( $form = null ) {
678 678
 		global $frm_vars;
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 
139 139
         foreach ( $values as $value_key => $value ) {
140 140
 			if ( $value_key && in_array( $value_key, $form_fields ) ) {
141
-				$new_values[ $value_key ] = $value;
141
+				$new_values[$value_key] = $value;
142 142
             }
143 143
         }
144 144
 
@@ -209,15 +209,15 @@  discard block
 block discarded – undo
209 209
         $existing_keys = array_keys( $values['item_meta'] );
210 210
         foreach ( $all_fields as $fid ) {
211 211
 			if ( ! in_array( $fid->id, $existing_keys ) && ( isset( $values['frm_fields_submitted'] ) && in_array( $fid->id, $values['frm_fields_submitted'] ) ) || isset( $values['options'] ) ) {
212
-				$values['item_meta'][ $fid->id ] = '';
212
+				$values['item_meta'][$fid->id] = '';
213 213
             }
214
-			$field_array[ $fid->id ] = $fid;
214
+			$field_array[$fid->id] = $fid;
215 215
         }
216 216
 		unset( $all_fields );
217 217
 
218 218
         foreach ( $values['item_meta'] as $field_id => $default_value ) {
219
-			if ( isset( $field_array[ $field_id ] ) ) {
220
-				$field = $field_array[ $field_id ];
219
+			if ( isset( $field_array[$field_id] ) ) {
220
+				$field = $field_array[$field_id];
221 221
             } else {
222 222
 				$field = FrmField::getOne( $field_id );
223 223
             }
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
                 continue;
227 227
             }
228 228
 
229
-			$is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options'][ 'custom_html_' . $field_id ] ) );
229
+			$is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options']['custom_html_' . $field_id] ) );
230 230
 			if ( $is_settings_page ) {
231 231
 				self::get_settings_page_html( $values, $field );
232 232
 
@@ -241,12 +241,12 @@  discard block
 block discarded – undo
241 241
 			$update_options = apply_filters( 'frm_field_options_to_update', $update_options );
242 242
 
243 243
 			foreach ( $update_options as $opt => $default ) {
244
-				$field->field_options[ $opt ] = isset( $values['field_options'][ $opt . '_' . $field_id ] ) ? $values['field_options'][ $opt . '_' . $field_id ] : $default;
245
-				self::sanitize_field_opt( $opt, $field->field_options[ $opt ] );
244
+				$field->field_options[$opt] = isset( $values['field_options'][$opt . '_' . $field_id] ) ? $values['field_options'][$opt . '_' . $field_id] : $default;
245
+				self::sanitize_field_opt( $opt, $field->field_options[$opt] );
246 246
             }
247 247
 
248 248
 			$field->field_options = apply_filters( 'frm_update_field_options', $field->field_options, $field, $values );
249
-			$default_value = maybe_serialize( $values['item_meta'][ $field_id ] );
249
+			$default_value = maybe_serialize( $values['item_meta'][$field_id] );
250 250
 
251 251
 			$new_field = array(
252 252
 				'field_options' => $field->field_options,
@@ -279,10 +279,10 @@  discard block
 block discarded – undo
279 279
 	 * updating the settings page
280 280
 	 */
281 281
 	private static function get_settings_page_html( $values, &$field ) {
282
-		if ( isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ) {
282
+		if ( isset( $values['field_options']['custom_html_' . $field->id] ) ) {
283 283
 			$prev_opts = array();
284 284
 			$fallback_html = isset( $field->field_options['custom_html'] ) ? $field->field_options['custom_html'] : FrmFieldsHelper::get_default_html( $field->type );
285
-			$field->field_options['custom_html'] = isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ? $values['field_options'][ 'custom_html_' . $field->id ] : $fallback_html;
285
+			$field->field_options['custom_html'] = isset( $values['field_options']['custom_html_' . $field->id] ) ? $values['field_options']['custom_html_' . $field->id] : $fallback_html;
286 286
 		} elseif ( $field->type == 'hidden' || $field->type == 'user_id' ) {
287 287
 			$prev_opts = $field->field_options;
288 288
 		}
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 		);
307 307
 		foreach ( $field_cols as $col => $default ) {
308 308
 			$default = ( $default === '' ) ? $field->{$col} : $default;
309
-			$new_field[ $col ] = isset( $values['field_options'][ $col . '_' . $field->id ] ) ? $values['field_options'][ $col . '_' . $field->id ] : $default;
309
+			$new_field[$col] = isset( $values['field_options'][$col . '_' . $field->id] ) ? $values['field_options'][$col . '_' . $field->id] : $default;
310 310
 		}
311 311
 	}
312 312
 
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 			return self::trash( $id );
320 320
         }
321 321
 
322
-		$statuses  = array( 'published', 'draft', 'trash' );
322
+		$statuses = array( 'published', 'draft', 'trash' );
323 323
         if ( ! in_array( $status, $statuses ) ) {
324 324
             return false;
325 325
         }
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 			$form->options = maybe_unserialize( $form->options );
455 455
 			if ( ! isset( $form->options['trash_time'] ) || $form->options['trash_time'] < $delete_timestamp ) {
456 456
 				self::destroy( $form->id );
457
-				$count++;
457
+				$count ++;
458 458
 			}
459 459
 
460 460
 			unset( $form );
@@ -633,16 +633,16 @@  discard block
 block discarded – undo
633 633
     	foreach ( $results as $row ) {
634 634
             if ( 'trash' != $row->status ) {
635 635
     	        if ( $row->is_template ) {
636
-					$counts['template']++;
636
+					$counts['template'] ++;
637 637
     	        } else {
638
-					$counts['published']++;
638
+					$counts['published'] ++;
639 639
     	        }
640 640
     	    } else {
641
-				$counts['trash']++;
641
+				$counts['trash'] ++;
642 642
         	}
643 643
 
644 644
     	    if ( 'draft' == $row->status ) {
645
-				$counts['draft']++;
645
+				$counts['draft'] ++;
646 646
     	    }
647 647
 
648 648
 			unset( $row );
@@ -683,8 +683,8 @@  discard block
 block discarded – undo
683 683
 			self::maybe_get_form( $form );
684 684
 		}
685 685
 
686
-		if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][ $form->id ] ) ) {
687
-			return $frm_vars['form_params'][ $form->id ];
686
+		if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][$form->id] ) ) {
687
+			return $frm_vars['form_params'][$form->id];
688 688
 		}
689 689
 
690 690
 		$action_var = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; // WPCS: CSRF ok.
@@ -713,15 +713,15 @@  discard block
 block discarded – undo
713 713
 			//if there are two forms on the same page, make sure not to submit both
714 714
 			foreach ( $default_values as $var => $default ) {
715 715
 				if ( $var == 'action' ) {
716
-					$values[ $var ] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' );
716
+					$values[$var] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' );
717 717
 				} else {
718
-					$values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
718
+					$values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
719 719
 				}
720 720
 				unset( $var, $default );
721 721
 			}
722 722
 		} else {
723 723
 			foreach ( $default_values as $var => $default ) {
724
-				$values[ $var ] = $default;
724
+				$values[$var] = $default;
725 725
 				unset( $var, $default );
726 726
 			}
727 727
 		}
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
 			'sdir'   => '',
746 746
 		);
747 747
 		foreach ( $defaults as $var => $default ) {
748
-			$values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
748
+			$values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
749 749
 		}
750 750
 
751 751
 		return $values;
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
 			'keep_post' => '',
774 774
 		);
775 775
 		foreach ( $defaults as $var => $default ) {
776
-			$values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
776
+			$values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
777 777
 		}
778 778
 
779 779
 		return $values;
@@ -854,7 +854,7 @@  discard block
 block discarded – undo
854 854
 	 */
855 855
 	public static function get_option( $atts ) {
856 856
 		$form = $atts['form'];
857
-		return isset( $form->options[ $atts['option'] ] ) ? $form->options[ $atts['option'] ] : $atts['default'];
857
+		return isset( $form->options[$atts['option']] ) ? $form->options[$atts['option']] : $atts['default'];
858 858
 	}
859 859
 
860 860
 	/**
Please login to merge, or discard this patch.