Completed
Push — master ( c88ec9...3f715e )
by Jamie
03:33
created
classes/controllers/FrmEntriesController.php 1 patch
Spacing   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
     public static function menu() {
6 6
 		FrmAppHelper::force_capability( 'frm_view_entries' );
7 7
 
8
-        add_submenu_page('formidable', 'Formidable | '. __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' );
8
+        add_submenu_page( 'formidable', 'Formidable | ' . __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' );
9 9
 
10 10
 		if ( ! in_array( FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ), array( 'edit', 'show' ) ) ) {
11 11
             $frm_settings = FrmAppHelper::get_settings();
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
         $screen->add_help_tab( array(
52 52
             'id'      => 'formidable-entries-tab',
53 53
             'title'   => __( 'Overview', 'formidable' ),
54
-			'content' => '<p>' . esc_html__( 'This screen provides access to all of your entries. You can customize the display of this screen to suit your workflow.', 'formidable' ) .'</p> <p>'. esc_html__( 'Hovering over a row in the entries list will display action links that allow you to manage your entry.', 'formidable' ) . '</p>',
55
-        ));
54
+			'content' => '<p>' . esc_html__( 'This screen provides access to all of your entries. You can customize the display of this screen to suit your workflow.', 'formidable' ) . '</p> <p>' . esc_html__( 'Hovering over a row in the entries list will display action links that allow you to manage your entry.', 'formidable' ) . '</p>',
55
+        ) );
56 56
 
57 57
         $screen->set_help_sidebar(
58 58
 			'<p><strong>' . esc_html__( 'For more information:', 'formidable' ) . '</strong></p>' .
@@ -67,14 +67,14 @@  discard block
 block discarded – undo
67 67
         global $frm_vars, $wpdb;
68 68
 		$form_id = FrmForm::get_current_form_id();
69 69
 
70
-        $columns[ $form_id .'_id' ] = 'ID';
71
-		$columns[ $form_id . '_item_key' ] = esc_html__( 'Entry Key', 'formidable' );
70
+        $columns[$form_id . '_id'] = 'ID';
71
+		$columns[$form_id . '_item_key'] = esc_html__( 'Entry Key', 'formidable' );
72 72
 
73 73
         if ( ! $form_id ) {
74 74
             return $columns;
75 75
         }
76 76
 
77
-        $form_cols = FrmField::get_all_for_form($form_id, '', 'include');
77
+        $form_cols = FrmField::get_all_for_form( $form_id, '', 'include' );
78 78
 
79 79
         foreach ( $form_cols as $form_col ) {
80 80
 			if ( FrmField::is_no_save_field( $form_col->type ) ) {
@@ -87,30 +87,30 @@  discard block
 block discarded – undo
87 87
                 if ( $sub_form_cols ) {
88 88
                     foreach ( $sub_form_cols as $k => $sub_form_col ) {
89 89
 						if ( FrmField::is_no_save_field( $sub_form_col->type ) ) {
90
-                            unset( $sub_form_cols[ $k ] );
90
+                            unset( $sub_form_cols[$k] );
91 91
                             continue;
92 92
                         }
93
-						$columns[ $form_id . '_' . $sub_form_col->field_key . '-_-' . $form_col->id ] = FrmAppHelper::truncate( $sub_form_col->name, 35 );
94
-                        unset($sub_form_col);
93
+						$columns[$form_id . '_' . $sub_form_col->field_key . '-_-' . $form_col->id] = FrmAppHelper::truncate( $sub_form_col->name, 35 );
94
+                        unset( $sub_form_col );
95 95
                     }
96 96
                 }
97
-                unset($sub_form_cols);
97
+                unset( $sub_form_cols );
98 98
             } else {
99 99
                 $col_id = $form_col->field_key;
100 100
                 if ( $form_col->form_id != $form_id ) {
101
-                    $col_id .= '-_-form'. $form_col->form_id;
101
+                    $col_id .= '-_-form' . $form_col->form_id;
102 102
                 }
103 103
 
104
-                if ( isset($form_col->field_options['separate_value']) && $form_col->field_options['separate_value'] ) {
105
-                    $columns[ $form_id .'_frmsep_'. $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 );
104
+                if ( isset( $form_col->field_options['separate_value'] ) && $form_col->field_options['separate_value'] ) {
105
+                    $columns[$form_id . '_frmsep_' . $col_id] = FrmAppHelper::truncate( $form_col->name, 35 );
106 106
                 }
107
-                $columns[ $form_id .'_'. $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 );
107
+                $columns[$form_id . '_' . $col_id] = FrmAppHelper::truncate( $form_col->name, 35 );
108 108
             }
109 109
         }
110 110
 
111
-        $columns[ $form_id .'_created_at' ] = __( 'Entry creation date', 'formidable' );
112
-        $columns[ $form_id .'_updated_at' ] = __( 'Entry update date', 'formidable' );
113
-        $columns[ $form_id .'_ip' ] = 'IP';
111
+        $columns[$form_id . '_created_at'] = __( 'Entry creation date', 'formidable' );
112
+        $columns[$form_id . '_updated_at'] = __( 'Entry update date', 'formidable' );
113
+        $columns[$form_id . '_ip'] = 'IP';
114 114
 
115 115
         $frm_vars['cols'] = $columns;
116 116
 
@@ -124,17 +124,17 @@  discard block
 block discarded – undo
124 124
 
125 125
 	public static function check_hidden_cols( $check, $object_id, $meta_key, $meta_value, $prev_value ) {
126 126
         $frm_settings = FrmAppHelper::get_settings();
127
-        if ( $meta_key != 'manage'.  sanitize_title($frm_settings->menu) .'_page_formidable-entriescolumnshidden' || $meta_value == $prev_value ) {
127
+        if ( $meta_key != 'manage' . sanitize_title( $frm_settings->menu ) . '_page_formidable-entriescolumnshidden' || $meta_value == $prev_value ) {
128 128
             return $check;
129 129
         }
130 130
 
131 131
 		if ( empty( $prev_value ) ) {
132
-            		$prev_value = get_metadata('user', $object_id, $meta_key, true);
132
+            		$prev_value = get_metadata( 'user', $object_id, $meta_key, true );
133 133
         }
134 134
 
135 135
         global $frm_vars;
136 136
         //add a check so we don't create a loop
137
-        $frm_vars['prev_hidden_cols'] = ( isset($frm_vars['prev_hidden_cols']) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value;
137
+        $frm_vars['prev_hidden_cols'] = ( isset( $frm_vars['prev_hidden_cols'] ) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value;
138 138
 
139 139
         return $check;
140 140
     }
@@ -143,25 +143,25 @@  discard block
 block discarded – undo
143 143
 	public static function update_hidden_cols( $meta_id, $object_id, $meta_key, $meta_value ) {
144 144
         $frm_settings = FrmAppHelper::get_settings();
145 145
 
146
-        $sanitized = sanitize_title($frm_settings->menu);
147
-        if ( $meta_key != 'manage'.  $sanitized .'_page_formidable-entriescolumnshidden' ) {
146
+        $sanitized = sanitize_title( $frm_settings->menu );
147
+        if ( $meta_key != 'manage' . $sanitized . '_page_formidable-entriescolumnshidden' ) {
148 148
             return;
149 149
         }
150 150
 
151 151
         global $frm_vars;
152
-        if ( ! isset($frm_vars['prev_hidden_cols']) || ! $frm_vars['prev_hidden_cols'] ) {
152
+        if ( ! isset( $frm_vars['prev_hidden_cols'] ) || ! $frm_vars['prev_hidden_cols'] ) {
153 153
             return; //don't continue if there's no previous value
154 154
         }
155 155
 
156 156
         foreach ( $meta_value as $mk => $mv ) {
157 157
             //remove blank values
158
-            if ( empty( $mv )  ) {
159
-                unset( $meta_value[ $mk ] );
158
+            if ( empty( $mv ) ) {
159
+                unset( $meta_value[$mk] );
160 160
             }
161 161
         }
162 162
 
163
-        $cur_form_prefix = reset($meta_value);
164
-        $cur_form_prefix = explode('_', $cur_form_prefix);
163
+        $cur_form_prefix = reset( $meta_value );
164
+        $cur_form_prefix = explode( '_', $cur_form_prefix );
165 165
         $cur_form_prefix = $cur_form_prefix[0];
166 166
         $save = false;
167 167
 
@@ -180,12 +180,12 @@  discard block
 block discarded – undo
180 180
 
181 181
             $meta_value[] = $prev_hidden;
182 182
             $save = true;
183
-            unset($form_prefix);
183
+            unset( $form_prefix );
184 184
         }
185 185
 
186 186
 		if ( $save ) {
187 187
             $user = wp_get_current_user();
188
-            update_user_option( $user->ID, 'manage'.  $sanitized .'_page_formidable-entriescolumnshidden', $meta_value, true );
188
+            update_user_option( $user->ID, 'manage' . $sanitized . '_page_formidable-entriescolumnshidden', $meta_value, true );
189 189
         }
190 190
     }
191 191
 
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 		foreach ( $fields as $field ) {
213 213
 			if ( $field->type != 'checkbox' && ( ! isset( $field->field_options['post_field'] ) || $field->field_options['post_field'] == '' ) ) {
214 214
 				// Can't sort on checkboxes because they are stored serialized, or post fields
215
-				$columns[ $form_id . '_' . $field->field_key ] = 'meta_' . $field->id;
215
+				$columns[$form_id . '_' . $field->field_key] = 'meta_' . $field->id;
216 216
 			}
217 217
 		}
218 218
 
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
                     break;
236 236
                 }
237 237
 
238
-                unset($form_prefix);
238
+                unset( $form_prefix );
239 239
             }
240 240
         }
241 241
 
@@ -243,36 +243,36 @@  discard block
 block discarded – undo
243 243
 			return $result;
244 244
 		}
245 245
 
246
-        $i = isset($frm_vars['cols']) ? count($frm_vars['cols']) : 0;
246
+        $i = isset( $frm_vars['cols'] ) ? count( $frm_vars['cols'] ) : 0;
247 247
         $max_columns = 8;
248 248
         if ( $i <= $max_columns ) {
249 249
 			return $result;
250 250
 		}
251 251
 
252 252
         global $frm_vars;
253
-        if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] ) {
254
-            $frm_vars['current_form']->options = maybe_unserialize($frm_vars['current_form']->options);
253
+        if ( isset( $frm_vars['current_form'] ) && $frm_vars['current_form'] ) {
254
+            $frm_vars['current_form']->options = maybe_unserialize( $frm_vars['current_form']->options );
255 255
         }
256 256
 
257
-        if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] && isset($frm_vars['current_form']->options['hidden_cols']) && ! empty($frm_vars['current_form']->options['hidden_cols']) ) {
257
+        if ( isset( $frm_vars['current_form'] ) && $frm_vars['current_form'] && isset( $frm_vars['current_form']->options['hidden_cols'] ) && ! empty( $frm_vars['current_form']->options['hidden_cols'] ) ) {
258 258
             $result = $frm_vars['current_form']->options['hidden_cols'];
259 259
         } else {
260 260
             $cols = $frm_vars['cols'];
261
-            $cols = array_reverse($cols, true);
261
+            $cols = array_reverse( $cols, true );
262 262
 
263
-            $result[] = $form_id .'_id';
264
-            $i--;
263
+            $result[] = $form_id . '_id';
264
+            $i --;
265 265
 
266
-            $result[] = $form_id .'_item_key';
267
-            $i--;
266
+            $result[] = $form_id . '_item_key';
267
+            $i --;
268 268
 
269 269
 			foreach ( $cols as $col_key => $col ) {
270 270
                 if ( $i > $max_columns ) {
271 271
 					$result[] = $col_key;
272 272
 				}
273 273
                 //remove some columns by default
274
-                $i--;
275
-                unset($col_key, $col);
274
+                $i --;
275
+                unset( $col_key, $col );
276 276
             }
277 277
         }
278 278
 
@@ -309,23 +309,23 @@  discard block
 block discarded – undo
309 309
         if ( $pagenum > $total_pages && $total_pages > 0 ) {
310 310
 			$url = add_query_arg( 'paged', $total_pages );
311 311
             if ( headers_sent() ) {
312
-                echo FrmAppHelper::js_redirect($url);
312
+                echo FrmAppHelper::js_redirect( $url );
313 313
             } else {
314 314
                 wp_redirect( esc_url_raw( $url ) );
315 315
             }
316 316
             die();
317 317
         }
318 318
 
319
-        if ( empty($message) && isset($_GET['import-message']) ) {
319
+        if ( empty( $message ) && isset( $_GET['import-message'] ) ) {
320 320
             $message = __( 'Your import is complete', 'formidable' );
321 321
         }
322 322
 
323
-        require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/list.php');
323
+        require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/list.php' );
324 324
     }
325 325
 
326 326
     /* Back End CRUD */
327 327
 	public static function show( $id = 0 ) {
328
-        FrmAppHelper::permission_check('frm_view_entries');
328
+        FrmAppHelper::permission_check( 'frm_view_entries' );
329 329
 
330 330
         if ( ! $id ) {
331 331
 			$id = FrmAppHelper::get_param( 'id', 0, 'get', 'absint' );
@@ -335,9 +335,9 @@  discard block
 block discarded – undo
335 335
             }
336 336
         }
337 337
 
338
-        $entry = FrmEntry::getOne($id, true);
338
+        $entry = FrmEntry::getOne( $id, true );
339 339
 
340
-        $data = maybe_unserialize($entry->description);
340
+        $data = maybe_unserialize( $entry->description );
341 341
 		if ( ! is_array( $data ) || ! isset( $data['referrer'] ) ) {
342 342
 			$data = array( 'referrer' => $data );
343 343
 		}
@@ -345,18 +345,18 @@  discard block
 block discarded – undo
345 345
 		$fields = FrmField::get_all_for_form( $entry->form_id, '', 'include' );
346 346
         $to_emails = array();
347 347
 
348
-        include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/show.php');
348
+        include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/show.php' );
349 349
     }
350 350
 
351 351
     public static function destroy() {
352
-        FrmAppHelper::permission_check('frm_delete_entries');
352
+        FrmAppHelper::permission_check( 'frm_delete_entries' );
353 353
 
354 354
 		$params = FrmForm::get_admin_params();
355 355
 
356
-        if ( isset($params['keep_post']) && $params['keep_post'] ) {
356
+        if ( isset( $params['keep_post'] ) && $params['keep_post'] ) {
357 357
             //unlink entry from post
358 358
             global $wpdb;
359
-			$wpdb->update( $wpdb->prefix .'frm_items', array( 'post_id' => '' ), array( 'id' => $params['id'] ) );
359
+			$wpdb->update( $wpdb->prefix . 'frm_items', array( 'post_id' => '' ), array( 'id' => $params['id'] ) );
360 360
         }
361 361
 
362 362
         $message = '';
@@ -431,9 +431,9 @@  discard block
 block discarded – undo
431 431
         if ( ! isset( $frm_vars['form_params'] ) ) {
432 432
             $frm_vars['form_params'] = array();
433 433
         }
434
-		$frm_vars['form_params'][ $form->id ] = $params;
434
+		$frm_vars['form_params'][$form->id] = $params;
435 435
 
436
-		if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) {
436
+		if ( isset( $frm_vars['created_entries'][$form_id] ) ) {
437 437
             return;
438 438
         }
439 439
 
@@ -448,13 +448,13 @@  discard block
 block discarded – undo
448 448
 		 */
449 449
 		$errors = apply_filters( 'frm_entries_before_create', $errors, $form );
450 450
 
451
-		$frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors );
451
+		$frm_vars['created_entries'][$form_id] = array( 'errors' => $errors );
452 452
 
453 453
         if ( empty( $errors ) ) {
454 454
 			$_POST['frm_skip_cookie'] = 1;
455 455
             if ( $params['action'] == 'create' ) {
456
-				if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) {
457
-					$frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST );
456
+				if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][$form_id]['entry_id'] ) ) {
457
+					$frm_vars['created_entries'][$form_id]['entry_id'] = FrmEntry::create( $_POST );
458 458
                 }
459 459
             }
460 460
 
@@ -489,28 +489,28 @@  discard block
 block discarded – undo
489 489
 	}
490 490
 
491 491
     public static function &filter_email_value( $value, $meta, $entry, $atts = array() ) {
492
-        $field = FrmField::getOne($meta->field_id);
492
+        $field = FrmField::getOne( $meta->field_id );
493 493
         if ( ! $field ) {
494 494
             return $value;
495 495
         }
496 496
 
497
-        $value = self::filter_display_value($value, $field, $atts);
497
+        $value = self::filter_display_value( $value, $field, $atts );
498 498
         return $value;
499 499
     }
500 500
 
501 501
 	public static function &filter_shortcode_value( $value, $tag, $atts, $field ) {
502
-        $plain_text = add_filter('frm_plain_text_email', true);
502
+        $plain_text = add_filter( 'frm_plain_text_email', true );
503 503
 		FrmEntryFormat::textarea_display_value( $field->type, $plain_text, $value );
504 504
 
505
-        if ( isset($atts['show']) && $atts['show'] == 'value' ) {
505
+        if ( isset( $atts['show'] ) && $atts['show'] == 'value' ) {
506 506
             return $value;
507 507
         }
508 508
 
509
-        return self::filter_display_value($value, $field, $atts);
509
+        return self::filter_display_value( $value, $field, $atts );
510 510
     }
511 511
 
512 512
     public static function &filter_display_value( $value, $field, $atts = array() ) {
513
-        $saved_value = ( isset($atts['saved_value']) && $atts['saved_value'] ) ? true : false;
513
+        $saved_value = ( isset( $atts['saved_value'] ) && $atts['saved_value'] ) ? true : false;
514 514
 		if ( ! in_array( $field->type, array( 'radio', 'checkbox', 'radio', 'select' ) ) || ! FrmField::is_option_true( $field, 'separate_value' ) || $saved_value ) {
515 515
             return $value;
516 516
         }
@@ -518,29 +518,29 @@  discard block
 block discarded – undo
518 518
         $f_values = $f_labels = array();
519 519
 
520 520
         foreach ( $field->options as $opt_key => $opt ) {
521
-            if ( ! is_array($opt) ) {
521
+            if ( ! is_array( $opt ) ) {
522 522
                 continue;
523 523
             }
524 524
 
525
-            $f_labels[ $opt_key ] = isset( $opt['label'] ) ? $opt['label'] : reset($opt);
526
-            $f_values[ $opt_key ] = isset( $opt['value'] ) ? $opt['value'] : $f_labels[ $opt_key ];
527
-            if ( $f_labels[ $opt_key ] == $f_values[ $opt_key ] ) {
528
-                unset( $f_values[ $opt_key ], $f_labels[ $opt_key ] );
525
+            $f_labels[$opt_key] = isset( $opt['label'] ) ? $opt['label'] : reset( $opt );
526
+            $f_values[$opt_key] = isset( $opt['value'] ) ? $opt['value'] : $f_labels[$opt_key];
527
+            if ( $f_labels[$opt_key] == $f_values[$opt_key] ) {
528
+                unset( $f_values[$opt_key], $f_labels[$opt_key] );
529 529
             }
530
-            unset($opt_key, $opt);
530
+            unset( $opt_key, $opt );
531 531
         }
532 532
 
533
-        if ( ! empty($f_values) ) {
533
+        if ( ! empty( $f_values ) ) {
534 534
             foreach ( (array) $value as $v_key => $val ) {
535
-                if ( in_array($val, $f_values) ) {
536
-                    $opt = array_search($val, $f_values);
537
-                    if ( is_array($value) ) {
538
-                        $value[ $v_key ] = $f_labels[ $opt ];
535
+                if ( in_array( $val, $f_values ) ) {
536
+                    $opt = array_search( $val, $f_values );
537
+                    if ( is_array( $value ) ) {
538
+                        $value[$v_key] = $f_labels[$opt];
539 539
                     } else {
540
-                        $value = $f_labels[ $opt ];
540
+                        $value = $f_labels[$opt];
541 541
                     }
542 542
                 }
543
-                unset($v_key, $val);
543
+                unset( $v_key, $val );
544 544
             }
545 545
         }
546 546
 
@@ -553,13 +553,13 @@  discard block
 block discarded – undo
553 553
 	}
554 554
 
555 555
 	public static function entry_sidebar( $entry ) {
556
-        $data = maybe_unserialize($entry->description);
557
-        $date_format = get_option('date_format');
558
-        $time_format = get_option('time_format');
556
+        $data = maybe_unserialize( $entry->description );
557
+        $date_format = get_option( 'date_format' );
558
+        $time_format = get_option( 'time_format' );
559 559
 		if ( isset( $data['browser'] ) ) {
560 560
 			$browser = FrmEntryFormat::get_browser( $data['browser'] );
561 561
 		}
562 562
 
563
-        include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/sidebar-shared.php');
563
+        include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/sidebar-shared.php' );
564 564
     }
565 565
 }
Please login to merge, or discard this patch.
classes/controllers/FrmFormActionsController.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -48,17 +48,17 @@  discard block
 block discarded – undo
48 48
             'highrise'  => 'FrmDefHrsAction',
49 49
         ) );
50 50
 
51
-        include_once(FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/email_action.php');
52
-        include_once(FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/default_actions.php');
51
+        include_once( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/email_action.php' );
52
+        include_once( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/default_actions.php' );
53 53
 
54 54
         foreach ( $action_classes as $action_class ) {
55
-            self::$registered_actions->register($action_class);
55
+            self::$registered_actions->register( $action_class );
56 56
         }
57 57
     }
58 58
 
59 59
 	public static function get_form_actions( $action = 'all' ) {
60 60
         $temp_actions = self::$registered_actions;
61
-        if ( empty($temp_actions) ) {
61
+        if ( empty( $temp_actions ) ) {
62 62
             self::actions_init();
63 63
             $temp_actions = self::$registered_actions->actions;
64 64
         } else {
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
                 return $a;
73 73
             }
74 74
 
75
-			$actions[ $a->id_base ] = $a;
75
+			$actions[$a->id_base] = $a;
76 76
         }
77 77
         unset( $temp_actions, $a );
78 78
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         arsort( $temp_actions );
87 87
         foreach ( $temp_actions as $type => $a ) {
88 88
             if ( ! isset( $a->action_options['active'] ) || empty( $a->action_options['active'] ) ) {
89
-				unset( $actions[ $type ] );
89
+				unset( $actions[$type] );
90 90
                 if ( count( $actions ) <= $action_limit ) {
91 91
                     break;
92 92
                 }
@@ -118,22 +118,22 @@  discard block
 block discarded – undo
118 118
         $action_map = array();
119 119
 
120 120
 		foreach ( $action_controls as $key => $control ) {
121
-            $action_map[ $control->id_base ] = $key;
121
+            $action_map[$control->id_base] = $key;
122 122
         }
123 123
 
124 124
     	foreach ( $form_actions as $action ) {
125
-    	    if ( ! isset( $action_map[ $action->post_excerpt ] ) ) {
125
+    	    if ( ! isset( $action_map[$action->post_excerpt] ) ) {
126 126
     	        // don't try and show settings if action no longer exists
127 127
     	        continue;
128 128
     	    }
129 129
 
130
-    		self::action_control( $action, $form, $action->ID, $action_controls[ $action_map[ $action->post_excerpt ] ], $values );
130
+    		self::action_control( $action, $form, $action->ID, $action_controls[$action_map[$action->post_excerpt]], $values );
131 131
     	}
132 132
     }
133 133
 
134 134
 	public static function action_control( $form_action, $form, $action_key, $action_control, $values ) {
135
-        $action_control->_set($action_key);
136
-        include(FrmAppHelper::plugin_path() .'/classes/views/frm-form-actions/form_action.php');
135
+        $action_control->_set( $action_key );
136
+        include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/form_action.php' );
137 137
     }
138 138
 
139 139
     public static function add_form_action() {
@@ -145,16 +145,16 @@  discard block
 block discarded – undo
145 145
         $action_type = sanitize_text_field( $_POST['type'] );
146 146
 
147 147
         $action_control = self::get_form_actions( $action_type );
148
-        $action_control->_set($action_key);
148
+        $action_control->_set( $action_key );
149 149
 
150 150
         $form_id = absint( $_POST['form_id'] );
151 151
 
152
-        $form_action = $action_control->prepare_new($form_id);
152
+        $form_action = $action_control->prepare_new( $form_id );
153 153
 
154 154
         $values = array();
155
-        $form = self::fields_to_values($form_id, $values);
155
+        $form = self::fields_to_values( $form_id, $values );
156 156
 
157
-        include(FrmAppHelper::plugin_path() .'/classes/views/frm-form-actions/form_action.php');
157
+        include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/form_action.php' );
158 158
         wp_die();
159 159
     }
160 160
 
@@ -165,34 +165,34 @@  discard block
 block discarded – undo
165 165
         $action_type = sanitize_text_field( $_POST['action_type'] );
166 166
 
167 167
         $action_control = self::get_form_actions( $action_type );
168
-        if ( empty($action_control) ) {
168
+        if ( empty( $action_control ) ) {
169 169
             wp_die();
170 170
         }
171 171
 
172 172
         $form_action = $action_control->get_single_action( $action_key );
173 173
 
174 174
         $values = array();
175
-        $form = self::fields_to_values($form_action->menu_order, $values);
175
+        $form = self::fields_to_values( $form_action->menu_order, $values );
176 176
 
177
-        include(FrmAppHelper::plugin_path() .'/classes/views/frm-form-actions/_action_inside.php');
177
+        include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_action_inside.php' );
178 178
         wp_die();
179 179
     }
180 180
 
181 181
 	private static function fields_to_values( $form_id, array &$values ) {
182
-        $form = FrmForm::getOne($form_id);
182
+        $form = FrmForm::getOne( $form_id );
183 183
 
184 184
 		$values = array( 'fields' => array(), 'id' => $form->id );
185 185
 
186
-        $fields = FrmField::get_all_for_form($form->id);
186
+        $fields = FrmField::get_all_for_form( $form->id );
187 187
         foreach ( $fields as $k => $f ) {
188 188
             $f = (array) $f;
189 189
             $opts = (array) $f['field_options'];
190
-            $f = array_merge($opts, $f);
190
+            $f = array_merge( $opts, $f );
191 191
             if ( ! isset( $f['post_field'] ) ) {
192 192
                 $f['post_field'] = '';
193 193
             }
194 194
             $values['fields'][] = $f;
195
-            unset($k, $f);
195
+            unset( $k, $f );
196 196
         }
197 197
 
198 198
         return $form;
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
         $new_actions = array();
208 208
 
209 209
         foreach ( $registered_actions as $registered_action ) {
210
-            $action_ids = $registered_action->update_callback($form_id);
210
+            $action_ids = $registered_action->update_callback( $form_id );
211 211
             if ( ! empty( $action_ids ) ) {
212 212
                 $new_actions[] = $action_ids;
213 213
             }
@@ -284,33 +284,33 @@  discard block
 block discarded – undo
284 284
             }
285 285
 
286 286
             // store actions so they can be triggered with the correct priority
287
-            $stored_actions[ $action->ID ] = $action;
288
-            $action_priority[ $action->ID ] = $link_settings[ $action->post_excerpt ]->action_options['priority'];
287
+            $stored_actions[$action->ID] = $action;
288
+            $action_priority[$action->ID] = $link_settings[$action->post_excerpt]->action_options['priority'];
289 289
 
290
-            unset($action);
290
+            unset( $action );
291 291
         }
292 292
 
293 293
         if ( ! empty( $stored_actions ) ) {
294
-            asort($action_priority);
294
+            asort( $action_priority );
295 295
 
296 296
             // make sure hooks are loaded
297 297
             new FrmNotification();
298 298
 
299 299
             foreach ( $action_priority as $action_id => $priority ) {
300
-                $action = $stored_actions[ $action_id ];
301
-                do_action('frm_trigger_'. $action->post_excerpt .'_action', $action, $entry, $form, $event);
302
-                do_action('frm_trigger_'. $action->post_excerpt .'_'. $event .'_action', $action, $entry, $form);
300
+                $action = $stored_actions[$action_id];
301
+                do_action( 'frm_trigger_' . $action->post_excerpt . '_action', $action, $entry, $form, $event );
302
+                do_action( 'frm_trigger_' . $action->post_excerpt . '_' . $event . '_action', $action, $entry, $form );
303 303
 
304 304
                 // If post is created, get updated $entry object
305 305
                 if ( $action->post_excerpt == 'wppost' && $event == 'create' ) {
306
-                    $entry = FrmEntry::getOne($entry->id, true);
306
+                    $entry = FrmEntry::getOne( $entry->id, true );
307 307
                 }
308 308
             }
309 309
         }
310 310
     }
311 311
 
312 312
 	public static function duplicate_form_actions( $form_id, $values, $args = array() ) {
313
-        if ( ! isset($args['old_id']) || empty($args['old_id']) ) {
313
+        if ( ! isset( $args['old_id'] ) || empty( $args['old_id'] ) ) {
314 314
             // continue if we know which actions to copy
315 315
             return;
316 316
         }
@@ -344,22 +344,22 @@  discard block
 block discarded – undo
344 344
 	}
345 345
 
346 346
 	public function register( $action_class ) {
347
-		$this->actions[ $action_class ] = new $action_class();
347
+		$this->actions[$action_class] = new $action_class();
348 348
 	}
349 349
 
350 350
 	public function unregister( $action_class ) {
351
-		if ( isset( $this->actions[ $action_class ] ) ) {
352
-			unset($this->actions[ $action_class ]);
351
+		if ( isset( $this->actions[$action_class] ) ) {
352
+			unset( $this->actions[$action_class] );
353 353
 		}
354 354
 	}
355 355
 
356 356
 	public function _register_actions() {
357
-		$keys = array_keys($this->actions);
357
+		$keys = array_keys( $this->actions );
358 358
 
359 359
 		foreach ( $keys as $key ) {
360 360
 			// don't register new action if old action with the same id is already registered
361
-			if ( ! isset( $this->actions[ $key ] ) ) {
362
-			    $this->actions[ $key ]->_register();
361
+			if ( ! isset( $this->actions[$key] ) ) {
362
+			    $this->actions[$key]->_register();
363 363
 			}
364 364
 		}
365 365
 	}
Please login to merge, or discard this patch.
classes/controllers/FrmHooksController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -143,8 +143,8 @@
 block discarded – undo
143 143
         add_action( 'wp_ajax_frm_deauthorize', 'FrmAppController::deauthorize' );
144 144
 
145 145
 		// Addons Controller
146
-		add_action('wp_ajax_frm_addon_activate', 'FrmAddon::activate' );
147
-		add_action('wp_ajax_frm_addon_deactivate', 'FrmAddon::deactivate' );
146
+		add_action( 'wp_ajax_frm_addon_activate', 'FrmAddon::activate' );
147
+		add_action( 'wp_ajax_frm_addon_deactivate', 'FrmAddon::deactivate' );
148 148
 
149 149
         // Fields Controller
150 150
         add_action( 'wp_ajax_frm_load_field', 'FrmFieldsController::load_field' );
Please login to merge, or discard this patch.
classes/controllers/FrmStylesController.php 1 patch
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -41,25 +41,25 @@  discard block
 block discarded – undo
41 41
     }
42 42
 
43 43
     public static function menu() {
44
-        add_submenu_page('formidable', 'Formidable | '. __( 'Styles', 'formidable' ), __( 'Styles', 'formidable' ), 'frm_change_settings', 'formidable-styles', 'FrmStylesController::route');
44
+        add_submenu_page( 'formidable', 'Formidable | ' . __( 'Styles', 'formidable' ), __( 'Styles', 'formidable' ), 'frm_change_settings', 'formidable-styles', 'FrmStylesController::route' );
45 45
     }
46 46
 
47 47
     public static function admin_init() {
48
-        if ( ! FrmAppHelper::is_admin_page('formidable-styles') ) {
48
+        if ( ! FrmAppHelper::is_admin_page( 'formidable-styles' ) ) {
49 49
             return;
50 50
         }
51 51
 
52 52
         self::load_pro_hooks();
53
-        wp_enqueue_script('jquery-ui-datepicker');
53
+        wp_enqueue_script( 'jquery-ui-datepicker' );
54 54
 
55 55
         $version = FrmAppHelper::plugin_version();
56 56
 		wp_enqueue_script( 'jquery-frm-themepicker', FrmAppHelper::plugin_url() . '/js/jquery/jquery-ui-themepicker.js', array( 'jquery' ), $version );
57 57
 
58
-        wp_enqueue_style('frm-custom-theme', admin_url('admin-ajax.php') .'?action=frmpro_css');
58
+        wp_enqueue_style( 'frm-custom-theme', admin_url( 'admin-ajax.php' ) . '?action=frmpro_css' );
59 59
 
60
-        $style = apply_filters('frm_style_head', false);
60
+        $style = apply_filters( 'frm_style_head', false );
61 61
         if ( $style ) {
62
-            wp_enqueue_style('frm-single-custom-theme', admin_url('admin-ajax.php') .'?action=frmpro_load_css&flat=1&'. http_build_query($style->post_content));
62
+            wp_enqueue_style( 'frm-single-custom-theme', admin_url( 'admin-ajax.php' ) . '?action=frmpro_load_css&flat=1&' . http_build_query( $style->post_content ) );
63 63
         }
64 64
     }
65 65
 
@@ -129,18 +129,18 @@  discard block
 block discarded – undo
129 129
 
130 130
 	public static function new_style( $return = '' ) {
131 131
         FrmAppHelper::update_message( __( 'create multiple styling templates', 'formidable' ), 'wrap' );
132
-        self::load_styler('default');
132
+        self::load_styler( 'default' );
133 133
     }
134 134
 
135 135
 	public static function duplicate() {
136 136
 		FrmAppHelper::update_message( __( 'duplicate styling templates', 'formidable' ), 'wrap' );
137
-		self::load_styler('default');
137
+		self::load_styler( 'default' );
138 138
 	}
139 139
 
140 140
 	public static function edit( $style_id = false, $message = '' ) {
141 141
         if ( ! $style_id ) {
142 142
 			$style_id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
143
-            if ( empty($style_id) ) {
143
+            if ( empty( $style_id ) ) {
144 144
                 $style_id = 'default';
145 145
             }
146 146
         }
@@ -148,12 +148,12 @@  discard block
 block discarded – undo
148 148
         if ( 'default' == $style_id ) {
149 149
             $style = 'default';
150 150
         } else {
151
-            $frm_style = new FrmStyle($style_id);
151
+            $frm_style = new FrmStyle( $style_id );
152 152
             $style = $frm_style->get_one();
153 153
             $style = $style->ID;
154 154
         }
155 155
 
156
-        self::load_styler($style, $message);
156
+        self::load_styler( $style, $message );
157 157
     }
158 158
 
159 159
     public static function save() {
@@ -163,17 +163,17 @@  discard block
 block discarded – undo
163 163
 		$style_nonce = FrmAppHelper::get_post_param( 'frm_style', '', 'sanitize_text_field' );
164 164
 
165 165
 		if ( $post_id !== false && wp_verify_nonce( $style_nonce, 'frm_style_nonce' ) ) {
166
-            $id = $frm_style->update($post_id);
167
-            if ( empty($post_id) && ! empty($id) ) {
166
+            $id = $frm_style->update( $post_id );
167
+            if ( empty( $post_id ) && ! empty( $id ) ) {
168 168
                 // set the post id to the new style so it will be loaded for editing
169
-                $post_id = reset($id);
169
+                $post_id = reset( $id );
170 170
             }
171 171
             // include the CSS that includes this style
172 172
 			echo '<link href="' . esc_url( admin_url( 'admin-ajax.php' ) . '?action=frmpro_css' ) . '" type="text/css" rel="Stylesheet" class="frm-custom-theme" />';
173 173
             $message = __( 'Your styling settings have been saved.', 'formidable' );
174 174
         }
175 175
 
176
-        return self::edit($post_id, $message);
176
+        return self::edit( $post_id, $message );
177 177
     }
178 178
 
179 179
 	public static function load_styler( $style, $message = '' ) {
@@ -182,15 +182,15 @@  discard block
 block discarded – undo
182 182
         $frm_style = new FrmStyle();
183 183
         $styles = $frm_style->get_all();
184 184
 
185
-        if ( is_numeric($style) ) {
186
-            $style = $styles[ $style ];
185
+        if ( is_numeric( $style ) ) {
186
+            $style = $styles[$style];
187 187
         } else if ( 'default' == $style ) {
188
-            $style = $frm_style->get_default_style($styles);
188
+            $style = $frm_style->get_default_style( $styles );
189 189
         }
190 190
 
191 191
         self::add_meta_boxes();
192 192
 
193
-        include(FrmAppHelper::plugin_path() .'/classes/views/styles/show.php');
193
+        include( FrmAppHelper::plugin_path() . '/classes/views/styles/show.php' );
194 194
     }
195 195
 
196 196
 	/**
@@ -200,13 +200,13 @@  discard block
 block discarded – undo
200 200
 	private static function manage( $message = '', $forms = array() ) {
201 201
         $frm_style = new FrmStyle();
202 202
         $styles = $frm_style->get_all();
203
-        $default_style = $frm_style->get_default_style($styles);
203
+        $default_style = $frm_style->get_default_style( $styles );
204 204
 
205
-        if ( empty($forms) ) {
205
+        if ( empty( $forms ) ) {
206 206
             $forms = FrmForm::get_published_forms();
207 207
         }
208 208
 
209
-        include(FrmAppHelper::plugin_path() .'/classes/views/styles/manage.php');
209
+        include( FrmAppHelper::plugin_path() . '/classes/views/styles/manage.php' );
210 210
     }
211 211
 
212 212
     private static function manage_styles() {
@@ -219,31 +219,31 @@  discard block
 block discarded – undo
219 219
 
220 220
 		$forms = FrmForm::get_published_forms();
221 221
         foreach ( $forms as $form ) {
222
-            if ( $_POST['style'][ $form->id ] == $_POST['prev_style'][ $form->id ] ) {
222
+            if ( $_POST['style'][$form->id] == $_POST['prev_style'][$form->id] ) {
223 223
                 continue;
224 224
             }
225 225
 
226
-            $form->options['custom_style'] = $_POST['style'][ $form->id ];
226
+            $form->options['custom_style'] = $_POST['style'][$form->id];
227 227
 
228 228
 			$wpdb->update( $wpdb->prefix . 'frm_forms', array( 'options' => maybe_serialize( $form->options ) ), array( 'id' => $form->id ) );
229
-            unset($form);
229
+            unset( $form );
230 230
         }
231 231
 
232 232
         $message = __( 'Your form styles have been saved.', 'formidable' );
233
-        return self::manage($message, $forms);
233
+        return self::manage( $message, $forms );
234 234
     }
235 235
 
236 236
     public static function custom_css( $message = '', $style = null ) {
237
-        wp_enqueue_style('codemirror', FrmAppHelper::plugin_url() . '/css/codemirror.css');
238
-        wp_enqueue_script('codemirror', FrmAppHelper::plugin_url() . '/js/codemirror/codemirror.js', array(), '4.7');
237
+        wp_enqueue_style( 'codemirror', FrmAppHelper::plugin_url() . '/css/codemirror.css' );
238
+        wp_enqueue_script( 'codemirror', FrmAppHelper::plugin_url() . '/js/codemirror/codemirror.js', array(), '4.7' );
239 239
         wp_enqueue_script( 'codemirror-css', FrmAppHelper::plugin_url() . '/js/codemirror/css.js', array( 'codemirror' ), '4.7' );
240 240
 
241
-        if ( ! isset($style) ) {
241
+        if ( ! isset( $style ) ) {
242 242
             $frm_style = new FrmStyle();
243 243
             $style = $frm_style->get_default_style();
244 244
         }
245 245
 
246
-        include(FrmAppHelper::plugin_path() .'/classes/views/styles/custom_css.php');
246
+        include( FrmAppHelper::plugin_path() . '/classes/views/styles/custom_css.php' );
247 247
     }
248 248
 
249 249
     public static function save_css() {
@@ -253,11 +253,11 @@  discard block
 block discarded – undo
253 253
 		$post_id = FrmAppHelper::get_post_param( 'ID', false, 'sanitize_text_field' );
254 254
 		$nonce = FrmAppHelper::get_post_param( 'frm_custom_css', '', 'sanitize_text_field' );
255 255
 		if ( wp_verify_nonce( $nonce, 'frm_custom_css_nonce' ) ) {
256
-            $frm_style->update($post_id);
256
+            $frm_style->update( $post_id );
257 257
             $message = __( 'Your styling settings have been saved.', 'formidable' );
258 258
         }
259 259
 
260
-        return self::custom_css($message);
260
+        return self::custom_css( $message );
261 261
     }
262 262
 
263 263
     public static function route() {
@@ -303,13 +303,13 @@  discard block
 block discarded – undo
303 303
 
304 304
         // remove the # from the colors
305 305
         foreach ( $_GET['frm_style_setting']['post_content'] as $k => $v ) {
306
-            if ( ! is_array($v) && strpos($v, '#') === 0 ) {
307
-                $_GET['frm_style_setting']['post_content'][ $k ] = str_replace( '#', '', $v );
306
+            if ( ! is_array( $v ) && strpos( $v, '#' ) === 0 ) {
307
+                $_GET['frm_style_setting']['post_content'][$k] = str_replace( '#', '', $v );
308 308
             }
309 309
         }
310 310
 
311 311
         echo '<style type="text/css">';
312
-        include(FrmAppHelper::plugin_path() .'/css/_single_theme.css.php');
312
+        include( FrmAppHelper::plugin_path() . '/css/_single_theme.css.php' );
313 313
         echo '</style>';
314 314
         wp_die();
315 315
     }
@@ -331,24 +331,24 @@  discard block
 block discarded – undo
331 331
         );
332 332
 
333 333
         foreach ( $meta_boxes as $nicename => $name ) {
334
-            add_meta_box( $nicename .'-style', $name, 'FrmStylesController::include_style_section', self::$screen, 'side', 'default', $nicename );
335
-            unset($nicename, $name);
334
+            add_meta_box( $nicename . '-style', $name, 'FrmStylesController::include_style_section', self::$screen, 'side', 'default', $nicename );
335
+            unset( $nicename, $name );
336 336
         }
337 337
     }
338 338
 
339 339
 	public static function include_style_section( $atts, $sec ) {
340
-        extract($atts);
340
+        extract( $atts );
341 341
 		$current_tab = FrmAppHelper::simple_get( 'page-tab', 'sanitize_title', 'default' );
342
-        include(FrmAppHelper::plugin_path() .'/classes/views/styles/_'. $sec['args'] .'.php');
342
+        include( FrmAppHelper::plugin_path() . '/classes/views/styles/_' . $sec['args'] . '.php' );
343 343
     }
344 344
 
345 345
     public static function load_css() {
346
-        header('Content-type: text/css');
346
+        header( 'Content-type: text/css' );
347 347
 
348 348
         $frm_style = new FrmStyle();
349 349
         $defaults = $frm_style->get_defaults();
350 350
 
351
-        include(FrmAppHelper::plugin_path() .'/css/_single_theme.css.php');
351
+        include( FrmAppHelper::plugin_path() . '/css/_single_theme.css.php' );
352 352
         wp_die();
353 353
     }
354 354
 
@@ -407,11 +407,11 @@  discard block
 block discarded – undo
407 407
             $style = 'default';
408 408
         }
409 409
 
410
-        $frm_style = new FrmStyle($style);
410
+        $frm_style = new FrmStyle( $style );
411 411
         $style = $frm_style->get_one();
412 412
 
413 413
         if ( $style ) {
414
-            $class .= ' frm_style_'. $style->post_name;
414
+            $class .= ' frm_style_' . $style->post_name;
415 415
         }
416 416
 
417 417
         return $class;
@@ -421,14 +421,14 @@  discard block
 block discarded – undo
421 421
      * @param string $val
422 422
      */
423 423
 	public static function get_style_val( $val, $form = 'default' ) {
424
-        $style = self::get_form_style($form);
425
-        if ( $style && isset( $style->post_content[ $val ] ) ) {
426
-            return $style->post_content[ $val ];
424
+        $style = self::get_form_style( $form );
425
+        if ( $style && isset( $style->post_content[$val] ) ) {
426
+            return $style->post_content[$val];
427 427
         }
428 428
     }
429 429
 
430 430
 	public static function show_entry_styles( $default_styles ) {
431
-        $frm_style = new FrmStyle('default');
431
+        $frm_style = new FrmStyle( 'default' );
432 432
         $style = $frm_style->get_one();
433 433
 
434 434
         if ( ! $style ) {
@@ -442,15 +442,15 @@  discard block
 block discarded – undo
442 442
             } else if ( 'alt_bg_color' == $name ) {
443 443
                 $setting = 'bg_color_active';
444 444
             }
445
-            $default_styles[ $name ] = $style->post_content[ $setting ];
446
-            unset($name, $val);
445
+            $default_styles[$name] = $style->post_content[$setting];
446
+            unset( $name, $val );
447 447
         }
448 448
 
449 449
         return $default_styles;
450 450
     }
451 451
 
452 452
 	public static function &important_style( $important, $field ) {
453
-        $important = self::get_style_val('important_style', $field['form_id']);
453
+        $important = self::get_style_val( 'important_style', $field['form_id'] );
454 454
         return $important;
455 455
     }
456 456
 
@@ -476,18 +476,18 @@  discard block
 block discarded – undo
476 476
     	$i = 0;
477 477
     	$first_open = false;
478 478
     	do {
479
-			if ( ! isset( $wp_meta_boxes ) || ! isset( $wp_meta_boxes[ $page ] ) || ! isset( $wp_meta_boxes[ $page ][ $context ] ) ) {
479
+			if ( ! isset( $wp_meta_boxes ) || ! isset( $wp_meta_boxes[$page] ) || ! isset( $wp_meta_boxes[$page][$context] ) ) {
480 480
 				break;
481 481
 			}
482 482
 
483 483
     		foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) {
484
-    			if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) {
485
-    				foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) {
484
+    			if ( isset( $wp_meta_boxes[$page][$context][$priority] ) ) {
485
+    				foreach ( $wp_meta_boxes[$page][$context][$priority] as $box ) {
486 486
     					if ( false == $box || ! $box['title'] ) {
487 487
     						continue;
488 488
 						}
489 489
 
490
-    					$i++;
490
+    					$i ++;
491 491
     					$hidden_class = in_array( $box['id'], $hidden ) ? 'hide-if-js' : '';
492 492
 
493 493
     					if ( ! $first_open && empty( $hidden_class ) ) {
Please login to merge, or discard this patch.
classes/controllers/FrmXMLController.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 class FrmXMLController {
4 4
 
5 5
     public static function menu() {
6
-        add_submenu_page('formidable', 'Formidable | '. __( 'Import/Export', 'formidable' ), __( 'Import/Export', 'formidable' ), 'frm_edit_forms', 'formidable-import', 'FrmXMLController::route');
6
+        add_submenu_page( 'formidable', 'Formidable | ' . __( 'Import/Export', 'formidable' ), __( 'Import/Export', 'formidable' ), 'frm_edit_forms', 'formidable-import', 'FrmXMLController::route' );
7 7
     }
8 8
 
9 9
     public static function add_default_templates() {
@@ -12,14 +12,14 @@  discard block
 block discarded – undo
12 12
     		return;
13 13
     	}
14 14
 
15
-        $set_err = libxml_use_internal_errors(true);
15
+        $set_err = libxml_use_internal_errors( true );
16 16
         $loader = libxml_disable_entity_loader( true );
17 17
 
18 18
 		$files = apply_filters( 'frm_default_templates_files', array( FrmAppHelper::plugin_path() . '/classes/views/xml/default-templates.xml' ) );
19 19
 
20 20
         foreach ( (array) $files as $file ) {
21
-            FrmXMLHelper::import_xml($file);
22
-            unset($file);
21
+            FrmXMLHelper::import_xml( $file );
22
+            unset( $file );
23 23
         }
24 24
         /*
25 25
         if(is_wp_error($result))
@@ -66,48 +66,48 @@  discard block
 block discarded – undo
66 66
             $csv_format = 'UTF-8';
67 67
         }
68 68
 
69
-        include(FrmAppHelper::plugin_path() .'/classes/views/xml/import_form.php');
69
+        include( FrmAppHelper::plugin_path() . '/classes/views/xml/import_form.php' );
70 70
     }
71 71
 
72 72
     public static function import_xml() {
73 73
         $errors = array();
74 74
         $message = '';
75 75
 
76
-        $permission_error = FrmAppHelper::permission_nonce_error('frm_edit_forms', 'import-xml', 'import-xml-nonce');
76
+        $permission_error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'import-xml', 'import-xml-nonce' );
77 77
         if ( $permission_error !== false ) {
78 78
             $errors[] = $permission_error;
79
-            self::form($errors);
79
+            self::form( $errors );
80 80
             return;
81 81
         }
82 82
 
83
-        if ( ! isset($_FILES) || ! isset($_FILES['frm_import_file']) || empty($_FILES['frm_import_file']['name']) || (int) $_FILES['frm_import_file']['size'] < 1 ) {
83
+        if ( ! isset( $_FILES ) || ! isset( $_FILES['frm_import_file'] ) || empty( $_FILES['frm_import_file']['name'] ) || (int) $_FILES['frm_import_file']['size'] < 1 ) {
84 84
             $errors[] = __( 'Oops, you didn\'t select a file.', 'formidable' );
85
-            self::form($errors);
85
+            self::form( $errors );
86 86
             return;
87 87
         }
88 88
 
89 89
         $file = $_FILES['frm_import_file']['tmp_name'];
90 90
 
91 91
         if ( ! is_uploaded_file( $file ) ) {
92
-            unset($file);
92
+            unset( $file );
93 93
             $errors[] = __( 'The file does not exist, please try again.', 'formidable' );
94
-            self::form($errors);
94
+            self::form( $errors );
95 95
             return;
96 96
         }
97 97
 
98 98
         //add_filter('upload_mimes', 'FrmXMLController::allow_mime');
99 99
 
100
-        $export_format = apply_filters('frm_export_formats', array(
100
+        $export_format = apply_filters( 'frm_export_formats', array(
101 101
 			'xml' => array( 'name' => 'XML', 'support' => 'forms', 'count' => 'multiple' ),
102 102
 		) );
103 103
 
104
-        $file_type = strtolower(pathinfo($_FILES['frm_import_file']['name'], PATHINFO_EXTENSION));
105
-        if ( $file_type != 'xml' && isset( $export_format[ $file_type ] ) ) {
104
+        $file_type = strtolower( pathinfo( $_FILES['frm_import_file']['name'], PATHINFO_EXTENSION ) );
105
+        if ( $file_type != 'xml' && isset( $export_format[$file_type] ) ) {
106 106
             // allow other file types to be imported
107
-            do_action('frm_before_import_'. $file_type );
107
+            do_action( 'frm_before_import_' . $file_type );
108 108
             return;
109 109
         }
110
-        unset($file_type);
110
+        unset( $file_type );
111 111
 
112 112
         //$media_id = FrmProAppHelper::upload_file('frm_import_file');
113 113
 
@@ -128,12 +128,12 @@  discard block
 block discarded – undo
128 128
 		libxml_use_internal_errors( $set_err );
129 129
 		libxml_disable_entity_loader( $loader );
130 130
 
131
-        self::form($errors, $message);
131
+        self::form( $errors, $message );
132 132
     }
133 133
 
134 134
     public static function export_xml() {
135 135
         $error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'export-xml', 'export-xml-nonce' );
136
-        if ( ! empty($error) ) {
136
+        if ( ! empty( $error ) ) {
137 137
             wp_die( $error );
138 138
         }
139 139
 
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
         }
148 148
 
149 149
         if ( $format == 'xml' ) {
150
-            self::generate_xml($type, compact('ids'));
150
+            self::generate_xml( $type, compact( 'ids' ) );
151 151
         } else {
152
-            do_action('frm_export_format_'. $format, compact('ids'));
152
+            do_action( 'frm_export_format_' . $format, compact( 'ids' ) );
153 153
         }
154 154
 
155 155
         wp_die();
@@ -159,19 +159,19 @@  discard block
 block discarded – undo
159 159
     	global $wpdb;
160 160
 
161 161
 	    $type = (array) $type;
162
-        if ( in_array( 'items', $type) && ! in_array( 'forms', $type) ) {
162
+        if ( in_array( 'items', $type ) && ! in_array( 'forms', $type ) ) {
163 163
             // make sure the form is included if there are entries
164 164
             $type[] = 'forms';
165 165
         }
166 166
 
167
-	    if ( in_array( 'forms', $type) ) {
167
+	    if ( in_array( 'forms', $type ) ) {
168 168
             // include actions with forms
169 169
 	        $type[] = 'actions';
170 170
 	    }
171 171
 
172 172
 	    $tables = array(
173
-	        'items'     => $wpdb->prefix .'frm_items',
174
-	        'forms'     => $wpdb->prefix .'frm_forms',
173
+	        'items'     => $wpdb->prefix . 'frm_items',
174
+	        'forms'     => $wpdb->prefix . 'frm_forms',
175 175
 	        'posts'     => $wpdb->posts,
176 176
 	        'styles'    => $wpdb->posts,
177 177
 	        'actions'   => $wpdb->posts,
@@ -201,31 +201,31 @@  discard block
 block discarded – undo
201 201
 		foreach ( $type as $tb_type ) {
202 202
             $where = array();
203 203
 			$join = '';
204
-            $table = $tables[ $tb_type ];
204
+            $table = $tables[$tb_type];
205 205
 
206
-            $select = $table .'.id';
206
+            $select = $table . '.id';
207 207
             $query_vars = array();
208 208
 
209 209
             switch ( $tb_type ) {
210 210
                 case 'forms':
211 211
                     //add forms
212 212
                     if ( $args['ids'] ) {
213
-						$where[] = array( 'or' => 1, $table . '.id' => $args['ids'], $table .'.parent_form_id' => $args['ids'] );
213
+						$where[] = array( 'or' => 1, $table . '.id' => $args['ids'], $table . '.parent_form_id' => $args['ids'] );
214 214
                 	} else {
215
-						$where[ $table . '.status !' ] = 'draft';
215
+						$where[$table . '.status !'] = 'draft';
216 216
                 	}
217 217
                 break;
218 218
                 case 'actions':
219
-                    $select = $table .'.ID';
219
+                    $select = $table . '.ID';
220 220
 					$where['post_type'] = FrmFormActionsController::$action_post_type;
221
-                    if ( ! empty($args['ids']) ) {
221
+                    if ( ! empty( $args['ids'] ) ) {
222 222
 						$where['menu_order'] = $args['ids'];
223 223
                     }
224 224
                 break;
225 225
                 case 'items':
226 226
                     //$join = "INNER JOIN {$wpdb->prefix}frm_item_metas im ON ($table.id = im.item_id)";
227 227
                     if ( $args['ids'] ) {
228
-						$where[ $table . '.form_id' ] = $args['ids'];
228
+						$where[$table . '.form_id'] = $args['ids'];
229 229
                     }
230 230
                 break;
231 231
                 case 'styles':
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
                         }
241 241
                         unset( $form_id, $form_data );
242 242
                     }
243
-                    $select = $table .'.ID';
243
+                    $select = $table . '.ID';
244 244
                     $where['post_type'] = 'frm_styles';
245 245
 
246 246
                     // Only export selected styles
@@ -249,11 +249,11 @@  discard block
 block discarded – undo
249 249
                     }
250 250
                 break;
251 251
                 default:
252
-                    $select = $table .'.ID';
252
+                    $select = $table . '.ID';
253 253
                     $join = ' INNER JOIN ' . $wpdb->postmeta . ' pm ON (pm.post_id=' . $table . '.ID)';
254 254
                     $where['pm.meta_key'] = 'frm_form_id';
255 255
 
256
-                    if ( empty($args['ids']) ) {
256
+                    if ( empty( $args['ids'] ) ) {
257 257
                         $where['pm.meta_value >'] = 1;
258 258
                     } else {
259 259
                         $where['pm.meta_value'] = $args['ids'];
@@ -261,12 +261,12 @@  discard block
 block discarded – undo
261 261
                 break;
262 262
             }
263 263
 
264
-			$records[ $tb_type ] = FrmDb::get_col( $table . $join, $where, $select );
265
-            unset($tb_type);
264
+			$records[$tb_type] = FrmDb::get_col( $table . $join, $where, $select );
265
+            unset( $tb_type );
266 266
         }
267 267
 
268
-		echo '<?xml version="1.0" encoding="' . esc_attr( get_bloginfo('charset') ) . "\" ?>\n";
269
-        include(FrmAppHelper::plugin_path() .'/classes/views/xml/xml.php');
268
+		echo '<?xml version="1.0" encoding="' . esc_attr( get_bloginfo( 'charset' ) ) . "\" ?>\n";
269
+        include( FrmAppHelper::plugin_path() . '/classes/views/xml/xml.php' );
270 270
     }
271 271
 
272 272
 	public static function allow_mime( $mimes ) {
Please login to merge, or discard this patch.
classes/helpers/FrmAppHelper.php 1 patch
Spacing   +227 added lines, -227 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined('ABSPATH') ) {
2
+if ( ! defined( 'ABSPATH' ) ) {
3 3
 	die( 'You are not allowed to call this page directly.' );
4 4
 }
5 5
 
@@ -23,16 +23,16 @@  discard block
 block discarded – undo
23 23
     }
24 24
 
25 25
     public static function plugin_folder() {
26
-        return basename(self::plugin_path());
26
+        return basename( self::plugin_path() );
27 27
     }
28 28
 
29 29
     public static function plugin_path() {
30
-        return dirname(dirname(dirname(__FILE__)));
30
+        return dirname( dirname( dirname( __FILE__ ) ) );
31 31
     }
32 32
 
33 33
     public static function plugin_url() {
34 34
         //prevously FRM_URL constant
35
-        return plugins_url( '', self::plugin_path() .'/formidable.php' );
35
+        return plugins_url( '', self::plugin_path() . '/formidable.php' );
36 36
     }
37 37
 
38 38
 	public static function relative_plugin_url() {
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      * @return string
55 55
      */
56 56
     public static function site_name() {
57
-        return get_option('blogname');
57
+        return get_option( 'blogname' );
58 58
     }
59 59
 
60 60
     /**
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
      */
68 68
     public static function get_settings() {
69 69
         global $frm_settings;
70
-        if ( empty($frm_settings) ) {
70
+        if ( empty( $frm_settings ) ) {
71 71
             $frm_settings = new FrmSettings();
72 72
         }
73 73
         return $frm_settings;
@@ -81,12 +81,12 @@  discard block
 block discarded – undo
81 81
 	public static function update_message( $features, $class = '' ) {
82 82
 		return; // hide the upgrade messages for now
83 83
         if ( ! self::pro_is_installed() ) {
84
-            include(self::plugin_path() .'/classes/views/shared/update_message.php');
84
+            include( self::plugin_path() . '/classes/views/shared/update_message.php' );
85 85
         }
86 86
     }
87 87
 
88 88
     public static function pro_is_installed() {
89
-        return apply_filters('frm_pro_installed', false);
89
+        return apply_filters( 'frm_pro_installed', false );
90 90
     }
91 91
 
92 92
     /**
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
      * @return boolean
131 131
      */
132 132
     public static function doing_ajax() {
133
-        return defined('DOING_AJAX') && DOING_AJAX && ! self::is_preview_page();
133
+        return defined( 'DOING_AJAX' ) && DOING_AJAX && ! self::is_preview_page();
134 134
     }
135 135
 
136 136
 	/**
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
      * @return boolean
151 151
      */
152 152
     public static function is_admin() {
153
-        return is_admin() && ( ! defined('DOING_AJAX') || ! DOING_AJAX );
153
+        return is_admin() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX );
154 154
     }
155 155
 
156 156
     /**
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
      * @return string
177 177
      */
178 178
 	public static function get_server_value( $value ) {
179
-        return isset( $_SERVER[ $value ] ) ? wp_strip_all_tags( $_SERVER[ $value ] ) : '';
179
+        return isset( $_SERVER[$value] ) ? wp_strip_all_tags( $_SERVER[$value] ) : '';
180 180
     }
181 181
 
182 182
     /**
@@ -191,14 +191,14 @@  discard block
 block discarded – undo
191 191
             'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP',
192 192
             'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR',
193 193
         ) as $key ) {
194
-            if ( ! isset( $_SERVER[ $key ] ) ) {
194
+            if ( ! isset( $_SERVER[$key] ) ) {
195 195
                 continue;
196 196
             }
197 197
 
198
-            foreach ( explode( ',', $_SERVER[ $key ] ) as $ip ) {
199
-                $ip = trim($ip); // just to be safe
198
+            foreach ( explode( ',', $_SERVER[$key] ) as $ip ) {
199
+                $ip = trim( $ip ); // just to be safe
200 200
 
201
-                if ( filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) !== false ) {
201
+                if ( filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE ) !== false ) {
202 202
                     return $ip;
203 203
                 }
204 204
             }
@@ -208,15 +208,15 @@  discard block
 block discarded – undo
208 208
     }
209 209
 
210 210
     public static function get_param( $param, $default = '', $src = 'get', $sanitize = '' ) {
211
-        if ( strpos($param, '[') ) {
212
-            $params = explode('[', $param);
211
+        if ( strpos( $param, '[' ) ) {
212
+            $params = explode( '[', $param );
213 213
             $param = $params[0];
214 214
         }
215 215
 
216 216
 		if ( $src == 'get' ) {
217
-            $value = isset( $_POST[ $param ] ) ? stripslashes_deep( $_POST[ $param ] ) : ( isset( $_GET[ $param ] ) ? stripslashes_deep( $_GET[ $param ] ) : $default );
218
-            if ( ! isset( $_POST[ $param ] ) && isset( $_GET[ $param ] ) && ! is_array( $value ) ) {
219
-                $value = stripslashes_deep( htmlspecialchars_decode( urldecode( $_GET[ $param ] ) ) );
217
+            $value = isset( $_POST[$param] ) ? stripslashes_deep( $_POST[$param] ) : ( isset( $_GET[$param] ) ? stripslashes_deep( $_GET[$param] ) : $default );
218
+            if ( ! isset( $_POST[$param] ) && isset( $_GET[$param] ) && ! is_array( $value ) ) {
219
+                $value = stripslashes_deep( htmlspecialchars_decode( urldecode( $_GET[$param] ) ) );
220 220
             }
221 221
 			self::sanitize_value( $sanitize, $value );
222 222
 		} else {
@@ -225,12 +225,12 @@  discard block
 block discarded – undo
225 225
 
226 226
 		if ( isset( $params ) && is_array( $value ) && ! empty( $value ) ) {
227 227
             foreach ( $params as $k => $p ) {
228
-                if ( ! $k || ! is_array($value) ) {
228
+                if ( ! $k || ! is_array( $value ) ) {
229 229
                     continue;
230 230
                 }
231 231
 
232
-                $p = trim($p, ']');
233
-                $value = isset( $value[ $p ] ) ? $value[ $p ] : $default;
232
+                $p = trim( $p, ']' );
233
+                $value = isset( $value[$p] ) ? $value[$p] : $default;
234 234
             }
235 235
         }
236 236
 
@@ -272,16 +272,16 @@  discard block
 block discarded – undo
272 272
 
273 273
 		$value = $args['default'];
274 274
 		if ( $args['type'] == 'get' ) {
275
-			if ( $_GET && isset( $_GET[ $args['param'] ] ) ) {
276
-				$value = $_GET[ $args['param'] ];
275
+			if ( $_GET && isset( $_GET[$args['param']] ) ) {
276
+				$value = $_GET[$args['param']];
277 277
 			}
278 278
 		} else if ( $args['type'] == 'post' ) {
279
-			if ( isset( $_POST[ $args['param'] ] ) ) {
280
-				$value = stripslashes_deep( maybe_unserialize( $_POST[ $args['param'] ] ) );
279
+			if ( isset( $_POST[$args['param']] ) ) {
280
+				$value = stripslashes_deep( maybe_unserialize( $_POST[$args['param']] ) );
281 281
 			}
282 282
 		} else {
283
-			if ( isset( $_REQUEST[ $args['param'] ] ) ) {
284
-				$value = $_REQUEST[ $args['param'] ];
283
+			if ( isset( $_REQUEST[$args['param']] ) ) {
284
+				$value = $_REQUEST[$args['param']];
285 285
 			}
286 286
 		}
287 287
 
@@ -317,8 +317,8 @@  discard block
 block discarded – undo
317 317
     public static function sanitize_request( $sanitize_method, &$values ) {
318 318
         $temp_values = $values;
319 319
         foreach ( $temp_values as $k => $val ) {
320
-            if ( isset( $sanitize_method[ $k ] ) ) {
321
-				$values[ $k ] = call_user_func( $sanitize_method[ $k ], $val );
320
+            if ( isset( $sanitize_method[$k] ) ) {
321
+				$values[$k] = call_user_func( $sanitize_method[$k], $val );
322 322
             }
323 323
         }
324 324
     }
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 	public static function sanitize_array( &$values ) {
327 327
 		$temp_values = $values;
328 328
 		foreach ( $temp_values as $k => $val ) {
329
-			$values[ $k ] = wp_kses_post( $val );
329
+			$values[$k] = wp_kses_post( $val );
330 330
 		}
331 331
 	}
332 332
 
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 
347 347
 		$allowed_html = array();
348 348
 		foreach ( $allowed as $a ) {
349
-			$allowed_html[ $a ] = isset( $html[ $a ] ) ? $html[ $a ] : array();
349
+			$allowed_html[$a] = isset( $html[$a] ) ? $html[$a] : array();
350 350
 		}
351 351
 
352 352
 		return wp_kses( $value, $allowed_html );
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
      * @since 2.0
358 358
      */
359 359
     public static function remove_get_action() {
360
-        if ( ! isset($_GET) ) {
360
+        if ( ! isset( $_GET ) ) {
361 361
             return;
362 362
         }
363 363
 
@@ -379,8 +379,8 @@  discard block
 block discarded – undo
379 379
         }
380 380
 
381 381
         global $wp_query;
382
-        if ( isset( $wp_query->query_vars[ $param ] ) ) {
383
-            $value = $wp_query->query_vars[ $param ];
382
+        if ( isset( $wp_query->query_vars[$param] ) ) {
383
+            $value = $wp_query->query_vars[$param];
384 384
         }
385 385
 
386 386
         return $value;
@@ -391,9 +391,9 @@  discard block
 block discarded – undo
391 391
      */
392 392
     public static function trigger_hook_load( $type, $object = null ) {
393 393
         // only load the form hooks once
394
-        $hooks_loaded = apply_filters('frm_'. $type .'_hooks_loaded', false, $object);
394
+        $hooks_loaded = apply_filters( 'frm_' . $type . '_hooks_loaded', false, $object );
395 395
         if ( ! $hooks_loaded ) {
396
-            do_action('frm_load_'. $type .'_hooks');
396
+            do_action( 'frm_load_' . $type . '_hooks' );
397 397
         }
398 398
     }
399 399
 
@@ -409,16 +409,16 @@  discard block
 block discarded – undo
409 409
      * @return mixed $results The cache or query results
410 410
      */
411 411
     public static function check_cache( $cache_key, $group = '', $query = '', $type = 'get_var', $time = 300 ) {
412
-        $results = wp_cache_get($cache_key, $group);
413
-        if ( ! self::is_empty_value( $results, false ) || empty($query) ) {
412
+        $results = wp_cache_get( $cache_key, $group );
413
+        if ( ! self::is_empty_value( $results, false ) || empty( $query ) ) {
414 414
             return $results;
415 415
         }
416 416
 
417 417
         if ( 'get_posts' == $type ) {
418
-            $results = get_posts($query);
418
+            $results = get_posts( $query );
419 419
         } else {
420 420
             global $wpdb;
421
-            $results = $wpdb->{$type}($query);
421
+            $results = $wpdb->{$type}( $query );
422 422
         }
423 423
 
424 424
 		if ( ! self::prevent_caching() ) {
@@ -442,9 +442,9 @@  discard block
 block discarded – undo
442 442
         }
443 443
 
444 444
         // then check the transient
445
-        $results = get_transient($cache_key);
445
+        $results = get_transient( $cache_key );
446 446
         if ( $results ) {
447
-            wp_cache_set($cache_key, $results);
447
+            wp_cache_set( $cache_key, $results );
448 448
         }
449 449
 
450 450
         return $results;
@@ -455,8 +455,8 @@  discard block
 block discarded – undo
455 455
      * @param string $cache_key
456 456
      */
457 457
 	public static function delete_cache_and_transient( $cache_key ) {
458
-        delete_transient($cache_key);
459
-        wp_cache_delete($cache_key);
458
+        delete_transient( $cache_key );
459
+        wp_cache_delete( $cache_key );
460 460
     }
461 461
 
462 462
     /**
@@ -470,9 +470,9 @@  discard block
 block discarded – undo
470 470
 	public static function cache_delete_group( $group ) {
471 471
     	global $wp_object_cache;
472 472
 
473
-        if ( isset( $wp_object_cache->cache[ $group ] ) ) {
474
-            foreach ( $wp_object_cache->cache[ $group ] as $k => $v ) {
475
-                wp_cache_delete($k, $group);
473
+        if ( isset( $wp_object_cache->cache[$group] ) ) {
474
+            foreach ( $wp_object_cache->cache[$group] as $k => $v ) {
475
+                wp_cache_delete( $k, $group );
476 476
             }
477 477
             return true;
478 478
         }
@@ -503,29 +503,29 @@  discard block
 block discarded – undo
503 503
 	public static function load_scripts( $scripts ) {
504 504
         _deprecated_function( __FUNCTION__, '2.0', 'wp_enqueue_script' );
505 505
         foreach ( (array) $scripts as $s ) {
506
-            wp_enqueue_script($s);
506
+            wp_enqueue_script( $s );
507 507
         }
508 508
     }
509 509
 
510 510
 	public static function load_styles( $styles ) {
511 511
         _deprecated_function( __FUNCTION__, '2.0', 'wp_enqueue_style' );
512 512
         foreach ( (array) $styles as $s ) {
513
-            wp_enqueue_style($s);
513
+            wp_enqueue_style( $s );
514 514
         }
515 515
     }
516 516
 
517 517
     public static function get_pages() {
518
-		return get_posts( array( 'post_type' => 'page', 'post_status' => array( 'publish', 'private' ), 'numberposts' => -1, 'orderby' => 'title', 'order' => 'ASC' ) );
518
+		return get_posts( array( 'post_type' => 'page', 'post_status' => array( 'publish', 'private' ), 'numberposts' => - 1, 'orderby' => 'title', 'order' => 'ASC' ) );
519 519
     }
520 520
 
521 521
     public static function wp_pages_dropdown( $field_name, $page_id, $truncate = false ) {
522 522
         $pages = self::get_pages();
523 523
 		$selected = self::get_post_param( $field_name, $page_id, 'absint' );
524 524
     ?>
525
-        <select name="<?php echo esc_attr($field_name); ?>" id="<?php echo esc_attr($field_name); ?>" class="frm-pages-dropdown">
525
+        <select name="<?php echo esc_attr( $field_name ); ?>" id="<?php echo esc_attr( $field_name ); ?>" class="frm-pages-dropdown">
526 526
             <option value=""> </option>
527 527
             <?php foreach ( $pages as $page ) { ?>
528
-				<option value="<?php echo esc_attr($page->ID); ?>" <?php selected( $selected, $page->ID ) ?>>
528
+				<option value="<?php echo esc_attr( $page->ID ); ?>" <?php selected( $selected, $page->ID ) ?>>
529 529
 					<?php echo esc_html( $truncate ? self::truncate( $page->post_title, $truncate ) : $page->post_title ); ?>
530 530
 				</option>
531 531
             <?php } ?>
@@ -534,26 +534,26 @@  discard block
 block discarded – undo
534 534
     }
535 535
 
536 536
 	public static function post_edit_link( $post_id ) {
537
-        $post = get_post($post_id);
537
+        $post = get_post( $post_id );
538 538
         if ( $post ) {
539
-            return '<a href="'. esc_url(admin_url('post.php') .'?post='. $post_id .'&action=edit') .'">'. self::truncate($post->post_title, 50) .'</a>';
539
+            return '<a href="' . esc_url( admin_url( 'post.php' ) . '?post=' . $post_id . '&action=edit' ) . '">' . self::truncate( $post->post_title, 50 ) . '</a>';
540 540
         }
541 541
         return '';
542 542
     }
543 543
 
544 544
 	public static function wp_roles_dropdown( $field_name, $capability, $multiple = 'single' ) {
545 545
     ?>
546
-        <select name="<?php echo esc_attr($field_name); ?>" id="<?php echo esc_attr($field_name); ?>" <?php
546
+        <select name="<?php echo esc_attr( $field_name ); ?>" id="<?php echo esc_attr( $field_name ); ?>" <?php
547 547
             echo ( 'multiple' == $multiple ) ? 'multiple="multiple"' : '';
548 548
             ?> class="frm_multiselect">
549
-            <?php self::roles_options($capability); ?>
549
+            <?php self::roles_options( $capability ); ?>
550 550
         </select>
551 551
     <?php
552 552
     }
553 553
 
554 554
 	public static function roles_options( $capability ) {
555 555
         global $frm_vars;
556
-        if ( isset($frm_vars['editable_roles']) ) {
556
+        if ( isset( $frm_vars['editable_roles'] ) ) {
557 557
             $editable_roles = $frm_vars['editable_roles'];
558 558
         } else {
559 559
             $editable_roles = get_editable_roles();
@@ -561,10 +561,10 @@  discard block
 block discarded – undo
561 561
         }
562 562
 
563 563
         foreach ( $editable_roles as $role => $details ) {
564
-            $name = translate_user_role($details['name'] ); ?>
565
-        <option value="<?php echo esc_attr($role) ?>" <?php echo in_array($role, (array) $capability) ? ' selected="selected"' : ''; ?>><?php echo esc_attr($name) ?> </option>
564
+            $name = translate_user_role( $details['name'] ); ?>
565
+        <option value="<?php echo esc_attr( $role ) ?>" <?php echo in_array( $role, (array) $capability ) ? ' selected="selected"' : ''; ?>><?php echo esc_attr( $name ) ?> </option>
566 566
 <?php
567
-            unset($role, $details);
567
+            unset( $role, $details );
568 568
         }
569 569
     }
570 570
 
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
     public static function maybe_add_permissions() {
621 621
 		self::force_capability( 'frm_view_entries' );
622 622
 
623
-        if ( ! current_user_can('administrator') || current_user_can('frm_view_forms') ) {
623
+        if ( ! current_user_can( 'administrator' ) || current_user_can( 'frm_view_forms' ) ) {
624 624
             return;
625 625
         }
626 626
 
@@ -629,7 +629,7 @@  discard block
 block discarded – undo
629 629
         $frm_roles = self::frm_capabilities();
630 630
         foreach ( $frm_roles as $frm_role => $frm_role_description ) {
631 631
 			$user->add_cap( $frm_role );
632
-            unset($frm_role, $frm_role_description);
632
+            unset( $frm_role, $frm_role_description );
633 633
         }
634 634
     }
635 635
 
@@ -654,12 +654,12 @@  discard block
 block discarded – undo
654 654
      * @param string $permission
655 655
      */
656 656
 	public static function permission_check( $permission, $show_message = 'show' ) {
657
-        $permission_error = self::permission_nonce_error($permission);
657
+        $permission_error = self::permission_nonce_error( $permission );
658 658
         if ( $permission_error !== false ) {
659 659
             if ( 'hide' == $show_message ) {
660 660
                 $permission_error = '';
661 661
             }
662
-            wp_die($permission_error);
662
+            wp_die( $permission_error );
663 663
         }
664 664
     }
665 665
 
@@ -676,11 +676,11 @@  discard block
 block discarded – undo
676 676
 		}
677 677
 
678 678
 		$error = false;
679
-        if ( empty($nonce_name) ) {
679
+        if ( empty( $nonce_name ) ) {
680 680
             return $error;
681 681
         }
682 682
 
683
-        if ( $_REQUEST && ( ! isset( $_REQUEST[ $nonce_name ] ) || ! wp_verify_nonce( $_REQUEST[ $nonce_name ], $nonce ) ) ) {
683
+        if ( $_REQUEST && ( ! isset( $_REQUEST[$nonce_name] ) || ! wp_verify_nonce( $_REQUEST[$nonce_name], $nonce ) ) ) {
684 684
             $frm_settings = self::get_settings();
685 685
             $error = $frm_settings->admin_permission;
686 686
         }
@@ -696,9 +696,9 @@  discard block
 block discarded – undo
696 696
 
697 697
 	public static function check_selected( $values, $current ) {
698 698
         $values = self::recursive_function_map( $values, 'trim' );
699
-        $current = trim($current);
699
+        $current = trim( $current );
700 700
 
701
-        return ( is_array($values) && in_array($current, $values) ) || ( ! is_array($values) && $values == $current );
701
+        return ( is_array( $values ) && in_array( $current, $values ) ) || ( ! is_array( $values ) && $values == $current );
702 702
     }
703 703
 
704 704
     /**
@@ -759,7 +759,7 @@  discard block
 block discarded – undo
759 759
 			} else {
760 760
 				foreach ( $value as $k => $v ) {
761 761
 					if ( ! is_array( $v ) ) {
762
-						$value[ $k ] = call_user_func( $original_function, $v );
762
+						$value[$k] = call_user_func( $original_function, $v );
763 763
 					}
764 764
 				}
765 765
 			}
@@ -780,11 +780,11 @@  discard block
 block discarded – undo
780 780
 	public static function array_flatten( $array, $keys = 'keep' ) {
781 781
         $return = array();
782 782
         foreach ( $array as $key => $value ) {
783
-            if ( is_array($value) ) {
783
+            if ( is_array( $value ) ) {
784 784
 				$return = array_merge( $return, self::array_flatten( $value, $keys ) );
785 785
             } else {
786 786
 				if ( $keys == 'keep' ) {
787
-					$return[ $key ] = $value;
787
+					$return[$key] = $value;
788 788
 				} else {
789 789
 					$return[] = $value;
790 790
 				}
@@ -794,7 +794,7 @@  discard block
 block discarded – undo
794 794
     }
795 795
 
796 796
     public static function esc_textarea( $text ) {
797
-        $safe_text = str_replace('&quot;', '"', $text);
797
+        $safe_text = str_replace( '&quot;', '"', $text );
798 798
         $safe_text = htmlspecialchars( $safe_text, ENT_NOQUOTES );
799 799
     	return apply_filters( 'esc_textarea', $safe_text, $text );
800 800
     }
@@ -804,8 +804,8 @@  discard block
 block discarded – undo
804 804
      * @since 2.0
805 805
      */
806 806
 	public static function use_wpautop( $content ) {
807
-        if ( apply_filters('frm_use_wpautop', true) ) {
808
-            $content = wpautop(str_replace( '<br>', '<br />', $content));
807
+        if ( apply_filters( 'frm_use_wpautop', true ) ) {
808
+            $content = wpautop( str_replace( '<br>', '<br />', $content ) );
809 809
         }
810 810
         return $content;
811 811
     }
@@ -823,8 +823,8 @@  discard block
 block discarded – undo
823 823
      * @return string The base Google APIS url for the current version of jQuery UI
824 824
      */
825 825
     public static function jquery_ui_base_url() {
826
-        $url = 'http'. ( is_ssl() ? 's' : '' ) .'://ajax.googleapis.com/ajax/libs/jqueryui/'. self::script_version('jquery-ui-core');
827
-        $url = apply_filters('frm_jquery_ui_base_url', $url);
826
+        $url = 'http' . ( is_ssl() ? 's' : '' ) . '://ajax.googleapis.com/ajax/libs/jqueryui/' . self::script_version( 'jquery-ui-core' );
827
+        $url = apply_filters( 'frm_jquery_ui_base_url', $url );
828 828
         return $url;
829 829
     }
830 830
 
@@ -839,11 +839,11 @@  discard block
 block discarded – undo
839 839
 
840 840
         $ver = 0;
841 841
 
842
-        if ( ! isset( $wp_scripts->registered[ $handle ] ) ) {
842
+        if ( ! isset( $wp_scripts->registered[$handle] ) ) {
843 843
             return $ver;
844 844
         }
845 845
 
846
-        $query = $wp_scripts->registered[ $handle ];
846
+        $query = $wp_scripts->registered[$handle];
847 847
     	if ( is_object( $query ) ) {
848 848
     	    $ver = $query->ver;
849 849
     	}
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
     }
857 857
 
858 858
 	public static function get_user_id_param( $user_id ) {
859
-        if ( ! $user_id || empty($user_id) || is_numeric($user_id) ) {
859
+        if ( ! $user_id || empty( $user_id ) || is_numeric( $user_id ) ) {
860 860
             return $user_id;
861 861
         }
862 862
 
@@ -864,29 +864,29 @@  discard block
 block discarded – undo
864 864
             $user_ID = get_current_user_id();
865 865
             $user_id = $user_ID;
866 866
 		} else {
867
-            if ( is_email($user_id) ) {
868
-                $user = get_user_by('email', $user_id);
867
+            if ( is_email( $user_id ) ) {
868
+                $user = get_user_by( 'email', $user_id );
869 869
             } else {
870
-                $user = get_user_by('login', $user_id);
870
+                $user = get_user_by( 'login', $user_id );
871 871
             }
872 872
 
873 873
             if ( $user ) {
874 874
                 $user_id = $user->ID;
875 875
             }
876
-            unset($user);
876
+            unset( $user );
877 877
         }
878 878
 
879 879
         return $user_id;
880 880
     }
881 881
 
882 882
 	public static function get_file_contents( $filename, $atts = array() ) {
883
-        if ( ! is_file($filename) ) {
883
+        if ( ! is_file( $filename ) ) {
884 884
             return false;
885 885
         }
886 886
 
887
-        extract($atts);
887
+        extract( $atts );
888 888
         ob_start();
889
-        include($filename);
889
+        include( $filename );
890 890
         $contents = ob_get_contents();
891 891
         ob_end_clean();
892 892
         return $contents;
@@ -902,28 +902,28 @@  discard block
 block discarded – undo
902 902
         $key = '';
903 903
 
904 904
         if ( ! empty( $name ) ) {
905
-            $key = sanitize_key($name);
905
+            $key = sanitize_key( $name );
906 906
         }
907 907
 
908 908
 		if ( empty( $key ) ) {
909
-            $max_slug_value = pow(36, $num_chars);
909
+            $max_slug_value = pow( 36, $num_chars );
910 910
             $min_slug_value = 37; // we want to have at least 2 characters in the slug
911
-            $key = base_convert( rand($min_slug_value, $max_slug_value), 10, 36 );
911
+            $key = base_convert( rand( $min_slug_value, $max_slug_value ), 10, 36 );
912 912
         }
913 913
 
914
-		if ( is_numeric($key) || in_array( $key, array( 'id', 'key', 'created-at', 'detaillink', 'editlink', 'siteurl', 'evenodd' ) ) ) {
915
-            $key = $key .'a';
914
+		if ( is_numeric( $key ) || in_array( $key, array( 'id', 'key', 'created-at', 'detaillink', 'editlink', 'siteurl', 'evenodd' ) ) ) {
915
+            $key = $key . 'a';
916 916
         }
917 917
 
918 918
 		$key_check = FrmDb::get_var( $table_name, array( $column => $key, 'ID !' => $id ), $column );
919 919
 
920
-        if ( $key_check || is_numeric($key_check) ) {
920
+        if ( $key_check || is_numeric( $key_check ) ) {
921 921
             $suffix = 2;
922 922
 			do {
923 923
 				$alt_post_name = substr( $key, 0, 200 - ( strlen( $suffix ) + 1 ) ) . $suffix;
924 924
 				$key_check = FrmDb::get_var( $table_name, array( $column => $alt_post_name, 'ID !' => $id ), $column );
925
-				$suffix++;
926
-			} while ($key_check || is_numeric($key_check));
925
+				$suffix ++;
926
+			} while ( $key_check || is_numeric( $key_check ) );
927 927
 			$key = $alt_post_name;
928 928
         }
929 929
         return $key;
@@ -941,32 +941,32 @@  discard block
 block discarded – undo
941 941
 
942 942
         global $frm_vars;
943 943
 
944
-        if ( empty($post_values) ) {
945
-            $post_values = stripslashes_deep($_POST);
944
+        if ( empty( $post_values ) ) {
945
+            $post_values = stripslashes_deep( $_POST );
946 946
         }
947 947
 
948 948
 		$values = array( 'id' => $record->id, 'fields' => array() );
949 949
 
950 950
 		foreach ( array( 'name', 'description' ) as $var ) {
951
-            $default_val = isset($record->{$var}) ? $record->{$var} : '';
952
-            $values[ $var ] = self::get_param( $var, $default_val );
953
-            unset($var, $default_val);
951
+            $default_val = isset( $record->{$var}) ? $record->{$var} : '';
952
+            $values[$var] = self::get_param( $var, $default_val );
953
+            unset( $var, $default_val );
954 954
         }
955 955
 
956
-        $values['description'] = self::use_wpautop($values['description']);
956
+        $values['description'] = self::use_wpautop( $values['description'] );
957 957
         $frm_settings = self::get_settings();
958
-        $is_form_builder = self::is_admin_page('formidable' );
958
+        $is_form_builder = self::is_admin_page( 'formidable' );
959 959
 
960 960
         foreach ( (array) $fields as $field ) {
961 961
             // Make sure to filter default values (for placeholder text), but not on the form builder page
962 962
             if ( ! $is_form_builder ) {
963
-                $field->default_value = apply_filters('frm_get_default_value', $field->default_value, $field, true );
963
+                $field->default_value = apply_filters( 'frm_get_default_value', $field->default_value, $field, true );
964 964
             }
965 965
 			$parent_form_id = isset( $args['parent_form_id'] ) ? $args['parent_form_id'] : $field->form_id;
966
-			self::fill_field_defaults($field, $record, $values, compact('default', 'post_values', 'frm_settings', 'parent_form_id' ) );
966
+			self::fill_field_defaults( $field, $record, $values, compact( 'default', 'post_values', 'frm_settings', 'parent_form_id' ) );
967 967
         }
968 968
 
969
-        self::fill_form_opts($record, $table, $post_values, $values);
969
+        self::fill_form_opts( $record, $table, $post_values, $values );
970 970
 
971 971
         if ( $table == 'entries' ) {
972 972
             $values = FrmEntriesHelper::setup_edit_vars( $values, $record );
@@ -983,8 +983,8 @@  discard block
 block discarded – undo
983 983
         if ( $args['default'] ) {
984 984
             $meta_value = $field->default_value;
985 985
         } else {
986
-            if ( $record->post_id && self::pro_is_installed() && isset($field->field_options['post_field']) && $field->field_options['post_field'] ) {
987
-                if ( ! isset($field->field_options['custom_field']) ) {
986
+            if ( $record->post_id && self::pro_is_installed() && isset( $field->field_options['post_field'] ) && $field->field_options['post_field'] ) {
987
+                if ( ! isset( $field->field_options['custom_field'] ) ) {
988 988
                     $field->field_options['custom_field'] = '';
989 989
                 }
990 990
 				$meta_value = FrmProEntryMetaHelper::get_post_value( $record->post_id, $field->field_options['post_field'], $field->field_options['custom_field'], array( 'truncate' => false, 'type' => $field->type, 'form_id' => $field->form_id, 'field' => $field ) );
@@ -993,8 +993,8 @@  discard block
 block discarded – undo
993 993
             }
994 994
         }
995 995
 
996
-        $field_type = isset( $post_values['field_options'][ 'type_'. $field->id ] ) ? $post_values['field_options'][ 'type_'. $field->id ] : $field->type;
997
-        $new_value = isset( $post_values['item_meta'][ $field->id ] ) ? maybe_unserialize( $post_values['item_meta'][ $field->id ] ) : $meta_value;
996
+        $field_type = isset( $post_values['field_options']['type_' . $field->id] ) ? $post_values['field_options']['type_' . $field->id] : $field->type;
997
+        $new_value = isset( $post_values['item_meta'][$field->id] ) ? maybe_unserialize( $post_values['item_meta'][$field->id] ) : $meta_value;
998 998
 
999 999
         $field_array = array(
1000 1000
             'id'            => $field->id,
@@ -1002,7 +1002,7 @@  discard block
 block discarded – undo
1002 1002
             'default_value' => $field->default_value,
1003 1003
             'name'          => $field->name,
1004 1004
             'description'   => $field->description,
1005
-            'type'          => apply_filters('frm_field_type', $field_type, $field, $new_value),
1005
+            'type'          => apply_filters( 'frm_field_type', $field_type, $field, $new_value ),
1006 1006
             'options'       => $field->options,
1007 1007
             'required'      => $field->required,
1008 1008
             'field_key'     => $field->field_key,
@@ -1012,38 +1012,38 @@  discard block
 block discarded – undo
1012 1012
         );
1013 1013
 
1014 1014
         $args['field_type'] = $field_type;
1015
-        self::fill_field_opts($field, $field_array, $args);
1015
+        self::fill_field_opts( $field, $field_array, $args );
1016 1016
 
1017
-        $field_array = apply_filters('frm_setup_edit_fields_vars', $field_array, $field, $values['id']);
1017
+        $field_array = apply_filters( 'frm_setup_edit_fields_vars', $field_array, $field, $values['id'] );
1018 1018
 
1019
-        if ( ! isset($field_array['unique']) || ! $field_array['unique'] ) {
1019
+        if ( ! isset( $field_array['unique'] ) || ! $field_array['unique'] ) {
1020 1020
             $field_array['unique_msg'] = '';
1021 1021
         }
1022 1022
 
1023 1023
         $field_array = array_merge( $field->field_options, $field_array );
1024 1024
 
1025
-        $values['fields'][ $field->id ] = $field_array;
1025
+        $values['fields'][$field->id] = $field_array;
1026 1026
     }
1027 1027
 
1028 1028
 	private static function fill_field_opts( $field, array &$field_array, $args ) {
1029 1029
         $post_values = $args['post_values'];
1030
-        $opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true);
1030
+        $opt_defaults = FrmFieldsHelper::get_default_field_opts( $field_array['type'], $field, true );
1031 1031
 
1032 1032
         foreach ( $opt_defaults as $opt => $default_opt ) {
1033
-            $field_array[ $opt ] = ( $post_values && isset( $post_values['field_options'][ $opt .'_'. $field->id ] ) ) ? maybe_unserialize( $post_values['field_options'][ $opt .'_'. $field->id ] ) : ( isset( $field->field_options[ $opt ] ) ? $field->field_options[ $opt ] : $default_opt );
1034
-            if ( $opt == 'blank' && $field_array[ $opt ] == '' ) {
1035
-                $field_array[ $opt ] = $args['frm_settings']->blank_msg;
1036
-            } else if ( $opt == 'invalid' && $field_array[ $opt ] == '' ) {
1033
+            $field_array[$opt] = ( $post_values && isset( $post_values['field_options'][$opt . '_' . $field->id] ) ) ? maybe_unserialize( $post_values['field_options'][$opt . '_' . $field->id] ) : ( isset( $field->field_options[$opt] ) ? $field->field_options[$opt] : $default_opt );
1034
+            if ( $opt == 'blank' && $field_array[$opt] == '' ) {
1035
+                $field_array[$opt] = $args['frm_settings']->blank_msg;
1036
+            } else if ( $opt == 'invalid' && $field_array[$opt] == '' ) {
1037 1037
                 if ( $args['field_type'] == 'captcha' ) {
1038
-                    $field_array[ $opt ] = $args['frm_settings']->re_msg;
1038
+                    $field_array[$opt] = $args['frm_settings']->re_msg;
1039 1039
                 } else {
1040
-                    $field_array[ $opt ] = sprintf( __( '%s is invalid', 'formidable' ), $field_array['name'] );
1040
+                    $field_array[$opt] = sprintf( __( '%s is invalid', 'formidable' ), $field_array['name'] );
1041 1041
                 }
1042 1042
             }
1043 1043
         }
1044 1044
 
1045 1045
         if ( $field_array['custom_html'] == '' ) {
1046
-            $field_array['custom_html'] = FrmFieldsHelper::get_default_html($args['field_type']);
1046
+            $field_array['custom_html'] = FrmFieldsHelper::get_default_html( $args['field_type'] );
1047 1047
         }
1048 1048
     }
1049 1049
 
@@ -1062,18 +1062,18 @@  discard block
 block discarded – undo
1062 1062
             return;
1063 1063
         }
1064 1064
 
1065
-        $values['form_name'] = isset($record->form_id) ? $form->name : '';
1065
+        $values['form_name'] = isset( $record->form_id ) ? $form->name : '';
1066 1066
 		$values['parent_form_id'] = isset( $record->form_id ) ? $form->parent_form_id : 0;
1067 1067
 
1068
-        if ( ! is_array($form->options) ) {
1068
+        if ( ! is_array( $form->options ) ) {
1069 1069
             return;
1070 1070
         }
1071 1071
 
1072 1072
         foreach ( $form->options as $opt => $value ) {
1073
-            $values[ $opt ] = isset( $post_values[ $opt ] ) ? maybe_unserialize( $post_values[ $opt ] ) : $value;
1073
+            $values[$opt] = isset( $post_values[$opt] ) ? maybe_unserialize( $post_values[$opt] ) : $value;
1074 1074
         }
1075 1075
 
1076
-        self::fill_form_defaults($post_values, $values);
1076
+        self::fill_form_defaults( $post_values, $values );
1077 1077
     }
1078 1078
 
1079 1079
     /**
@@ -1083,23 +1083,23 @@  discard block
 block discarded – undo
1083 1083
         $form_defaults = FrmFormsHelper::get_default_opts();
1084 1084
 
1085 1085
         foreach ( $form_defaults as $opt => $default ) {
1086
-            if ( ! isset( $values[ $opt ] ) || $values[ $opt ] == '' ) {
1087
-				$values[ $opt ] = ( $post_values && isset( $post_values['options'][ $opt ] ) ) ? $post_values['options'][ $opt ] : $default;
1086
+            if ( ! isset( $values[$opt] ) || $values[$opt] == '' ) {
1087
+				$values[$opt] = ( $post_values && isset( $post_values['options'][$opt] ) ) ? $post_values['options'][$opt] : $default;
1088 1088
             }
1089 1089
 
1090
-            unset($opt, $defaut);
1090
+            unset( $opt, $defaut );
1091 1091
         }
1092 1092
 
1093
-        if ( ! isset($values['custom_style']) ) {
1093
+        if ( ! isset( $values['custom_style'] ) ) {
1094 1094
             $frm_settings = self::get_settings();
1095 1095
 			$values['custom_style'] = ( $post_values && isset( $post_values['options']['custom_style'] ) ) ? absint( $_POST['options']['custom_style'] ) : ( $frm_settings->load_style != 'none' );
1096 1096
         }
1097 1097
 
1098 1098
 		foreach ( array( 'before', 'after', 'submit' ) as $h ) {
1099
-            if ( ! isset( $values[ $h .'_html' ] ) ) {
1100
-                $values[ $h .'_html' ] = ( isset( $post_values['options'][ $h .'_html' ] ) ? $post_values['options'][ $h .'_html' ] : FrmFormsHelper::get_default_html( $h ) );
1099
+            if ( ! isset( $values[$h . '_html'] ) ) {
1100
+                $values[$h . '_html'] = ( isset( $post_values['options'][$h . '_html'] ) ? $post_values['options'][$h . '_html'] : FrmFormsHelper::get_default_html( $h ) );
1101 1101
             }
1102
-            unset($h);
1102
+            unset( $h );
1103 1103
         }
1104 1104
     }
1105 1105
 
@@ -1115,9 +1115,9 @@  discard block
 block discarded – undo
1115 1115
         }
1116 1116
     ?>
1117 1117
 <li>
1118
-    <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>
1119
-    <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>
1120
-    <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>
1118
+    <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>
1119
+    <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>
1120
+    <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>
1121 1121
 </li>
1122 1122
     <?php
1123 1123
     }
@@ -1145,7 +1145,7 @@  discard block
 block discarded – undo
1145 1145
             return '';
1146 1146
         } else if ( $length <= 10 ) {
1147 1147
 			$sub = self::mb_function( array( 'mb_substr', 'substr' ), array( $str, 0, $length ) );
1148
-            return $sub . (($length < $original_len) ? $continue : '');
1148
+            return $sub . ( ( $length < $original_len ) ? $continue : '' );
1149 1149
         }
1150 1150
 
1151 1151
         $sub = '';
@@ -1154,23 +1154,23 @@  discard block
 block discarded – undo
1154 1154
 		$words = self::mb_function( array( 'mb_split', 'explode' ), array( ' ', $str ) );
1155 1155
 
1156 1156
 		foreach ( $words as $word ) {
1157
-            $part = (($sub != '') ? ' ' : '') . $word;
1157
+            $part = ( ( $sub != '' ) ? ' ' : '' ) . $word;
1158 1158
 			$total_len = self::mb_function( array( 'mb_strlen', 'strlen' ), array( $sub . $part ) );
1159
-            if ( $total_len > $length && str_word_count($sub) ) {
1159
+            if ( $total_len > $length && str_word_count( $sub ) ) {
1160 1160
                 break;
1161 1161
             }
1162 1162
 
1163 1163
             $sub .= $part;
1164 1164
 			$len += self::mb_function( array( 'mb_strlen', 'strlen' ), array( $part ) );
1165 1165
 
1166
-            if ( str_word_count($sub) > $minword && $total_len >= $length ) {
1166
+            if ( str_word_count( $sub ) > $minword && $total_len >= $length ) {
1167 1167
                 break;
1168 1168
             }
1169 1169
 
1170
-            unset($total_len, $word);
1170
+            unset( $total_len, $word );
1171 1171
         }
1172 1172
 
1173
-        return $sub . (($len < $original_len) ? $continue : '');
1173
+        return $sub . ( ( $len < $original_len ) ? $continue : '' );
1174 1174
     }
1175 1175
 
1176 1176
 	public static function mb_function( $function_names, $args ) {
@@ -1183,17 +1183,17 @@  discard block
 block discarded – undo
1183 1183
 	}
1184 1184
 
1185 1185
 	public static function get_formatted_time( $date, $date_format = '', $time_format = '' ) {
1186
-        if ( empty($date) ) {
1186
+        if ( empty( $date ) ) {
1187 1187
             return $date;
1188 1188
         }
1189 1189
 
1190
-        if ( empty($date_format) ) {
1191
-            $date_format = get_option('date_format');
1190
+        if ( empty( $date_format ) ) {
1191
+            $date_format = get_option( 'date_format' );
1192 1192
         }
1193 1193
 
1194
-        if ( preg_match('/^\d{1-2}\/\d{1-2}\/\d{4}$/', $date) && self::pro_is_installed() ) {
1194
+        if ( preg_match( '/^\d{1-2}\/\d{1-2}\/\d{4}$/', $date ) && self::pro_is_installed() ) {
1195 1195
             $frmpro_settings = new FrmProSettings();
1196
-            $date = FrmProAppHelper::convert_date($date, $frmpro_settings->date_format, 'Y-m-d');
1196
+            $date = FrmProAppHelper::convert_date( $date, $frmpro_settings->date_format, 'Y-m-d' );
1197 1197
         }
1198 1198
 
1199 1199
 		$formatted = self::get_localized_date( $date_format, $date );
@@ -1208,7 +1208,7 @@  discard block
 block discarded – undo
1208 1208
 
1209 1209
 	private static function add_time_to_date( $time_format, $date ) {
1210 1210
 		if ( empty( $time_format ) ) {
1211
-			$time_format = get_option('time_format');
1211
+			$time_format = get_option( 'time_format' );
1212 1212
 		}
1213 1213
 
1214 1214
 		$trimmed_format = trim( $time_format );
@@ -1232,7 +1232,7 @@  discard block
 block discarded – undo
1232 1232
      * @return string The time ago in words
1233 1233
      */
1234 1234
     public static function human_time_diff( $from, $to = '' ) {
1235
-    	if ( empty($to) ) {
1235
+    	if ( empty( $to ) ) {
1236 1236
     	    		$to = time();
1237 1237
     	}
1238 1238
 
@@ -1248,7 +1248,7 @@  discard block
 block discarded – undo
1248 1248
     	);
1249 1249
 
1250 1250
     	// Difference in seconds
1251
-    	$diff = (int) ($to - $from);
1251
+    	$diff = (int) ( $to - $from );
1252 1252
 
1253 1253
     	// Something went wrong with date calculation and we ended up with a negative date.
1254 1254
 		if ( $diff < 1 ) {
@@ -1265,17 +1265,17 @@  discard block
 block discarded – undo
1265 1265
         $count = 0;
1266 1266
 
1267 1267
     	//Step one: the first chunk
1268
-		for ( $i = 0, $j = count( $chunks ); $i < $j; $i++ ) {
1269
-    		$seconds = $chunks[ $i ][0];
1268
+		for ( $i = 0, $j = count( $chunks ); $i < $j; $i ++ ) {
1269
+    		$seconds = $chunks[$i][0];
1270 1270
 
1271 1271
     		// Finding the biggest chunk (if the chunk fits, break)
1272
-    		if ( ( $count = floor($diff / $seconds) ) != 0 ) {
1272
+    		if ( ( $count = floor( $diff / $seconds ) ) != 0 ) {
1273 1273
     		    			break;
1274 1274
     		}
1275 1275
     	}
1276 1276
 
1277 1277
     	// Set output var
1278
-    	$output = ( 1 == $count ) ? '1 '. $chunks[ $i ][1] : $count . ' ' . $chunks[ $i ][2];
1278
+    	$output = ( 1 == $count ) ? '1 ' . $chunks[$i][1] : $count . ' ' . $chunks[$i][2];
1279 1279
 
1280 1280
     	if ( ! (int) trim( $output ) ) {
1281 1281
     		$output = '0 ' . __( 'seconds', 'formidable' );
@@ -1294,7 +1294,7 @@  discard block
 block discarded – undo
1294 1294
      */
1295 1295
 	public static function esc_like( $term ) {
1296 1296
         global $wpdb;
1297
-        if ( method_exists($wpdb, 'esc_like') ) {
1297
+        if ( method_exists( $wpdb, 'esc_like' ) ) {
1298 1298
 			// WP 4.0
1299 1299
             $term = $wpdb->esc_like( $term );
1300 1300
         } else {
@@ -1308,17 +1308,17 @@  discard block
 block discarded – undo
1308 1308
      * @param string $order_query
1309 1309
      */
1310 1310
 	public static function esc_order( $order_query ) {
1311
-        if ( empty($order_query) ) {
1311
+        if ( empty( $order_query ) ) {
1312 1312
             return '';
1313 1313
         }
1314 1314
 
1315 1315
         // remove ORDER BY before santizing
1316
-        $order_query = strtolower($order_query);
1317
-        if ( strpos($order_query, 'order by') !== false ) {
1318
-            $order_query = str_replace('order by', '', $order_query);
1316
+        $order_query = strtolower( $order_query );
1317
+        if ( strpos( $order_query, 'order by' ) !== false ) {
1318
+            $order_query = str_replace( 'order by', '', $order_query );
1319 1319
         }
1320 1320
 
1321
-        $order_query = explode(' ', trim($order_query));
1321
+        $order_query = explode( ' ', trim( $order_query ) );
1322 1322
 
1323 1323
         $order_fields = array(
1324 1324
             'id', 'form_key', 'name', 'description',
@@ -1326,18 +1326,18 @@  discard block
 block discarded – undo
1326 1326
             'default_template', 'status', 'created_at',
1327 1327
         );
1328 1328
 
1329
-        $order = trim(trim(reset($order_query), ','));
1330
-        if ( ! in_array($order, $order_fields) ) {
1329
+        $order = trim( trim( reset( $order_query ), ',' ) );
1330
+        if ( ! in_array( $order, $order_fields ) ) {
1331 1331
             return '';
1332 1332
         }
1333 1333
 
1334 1334
         $order_by = '';
1335
-        if ( count($order_query) > 1 ) {
1335
+        if ( count( $order_query ) > 1 ) {
1336 1336
 			$order_by = end( $order_query );
1337 1337
 			self::esc_order_by( $order_by );
1338 1338
         }
1339 1339
 
1340
-        return ' ORDER BY '. $order . ' '. $order_by;
1340
+        return ' ORDER BY ' . $order . ' ' . $order_by;
1341 1341
     }
1342 1342
 
1343 1343
 	/**
@@ -1354,24 +1354,24 @@  discard block
 block discarded – undo
1354 1354
      * @param string $limit
1355 1355
      */
1356 1356
 	public static function esc_limit( $limit ) {
1357
-        if ( empty($limit) ) {
1357
+        if ( empty( $limit ) ) {
1358 1358
             return '';
1359 1359
         }
1360 1360
 
1361
-        $limit = trim(str_replace(' limit', '', strtolower($limit)));
1362
-        if ( is_numeric($limit) ) {
1363
-            return ' LIMIT '. $limit;
1361
+        $limit = trim( str_replace( ' limit', '', strtolower( $limit ) ) );
1362
+        if ( is_numeric( $limit ) ) {
1363
+            return ' LIMIT ' . $limit;
1364 1364
         }
1365 1365
 
1366
-        $limit = explode(',', trim($limit));
1366
+        $limit = explode( ',', trim( $limit ) );
1367 1367
         foreach ( $limit as $k => $l ) {
1368 1368
             if ( is_numeric( $l ) ) {
1369
-                $limit[ $k ] = $l;
1369
+                $limit[$k] = $l;
1370 1370
             }
1371 1371
         }
1372 1372
 
1373
-        $limit = implode(',', $limit);
1374
-        return ' LIMIT '. $limit;
1373
+        $limit = implode( ',', $limit );
1374
+        return ' LIMIT ' . $limit;
1375 1375
     }
1376 1376
 
1377 1377
     /**
@@ -1379,12 +1379,12 @@  discard block
 block discarded – undo
1379 1379
      * @since 2.0
1380 1380
      */
1381 1381
     public static function prepare_array_values( $array, $type = '%s' ) {
1382
-        $placeholders = array_fill(0, count($array), $type);
1383
-        return implode(', ', $placeholders);
1382
+        $placeholders = array_fill( 0, count( $array ), $type );
1383
+        return implode( ', ', $placeholders );
1384 1384
     }
1385 1385
 
1386 1386
     public static function prepend_and_or_where( $starts_with = ' WHERE ', $where = '' ) {
1387
-        if ( empty($where) ) {
1387
+        if ( empty( $where ) ) {
1388 1388
             return '';
1389 1389
         }
1390 1390
 
@@ -1430,7 +1430,7 @@  discard block
 block discarded – undo
1430 1430
 
1431 1431
     public static function get_referer_info() {
1432 1432
         _deprecated_function( __FUNCTION__, '2.0', 'FrmAppHelper::get_server_value' );
1433
-        return self::get_server_value('HTTP_REFERER');
1433
+        return self::get_server_value( 'HTTP_REFERER' );
1434 1434
     }
1435 1435
 
1436 1436
 	/**
@@ -1439,19 +1439,19 @@  discard block
 block discarded – undo
1439 1439
 	public static function json_to_array( $json_vars ) {
1440 1440
         $vars = array();
1441 1441
         foreach ( $json_vars as $jv ) {
1442
-            $jv_name = explode('[', $jv['name']);
1443
-            $last = count($jv_name) - 1;
1442
+            $jv_name = explode( '[', $jv['name'] );
1443
+            $last = count( $jv_name ) - 1;
1444 1444
             foreach ( $jv_name as $p => $n ) {
1445
-                $name = trim($n, ']');
1446
-                if ( ! isset($l1) ) {
1445
+                $name = trim( $n, ']' );
1446
+                if ( ! isset( $l1 ) ) {
1447 1447
                     $l1 = $name;
1448 1448
                 }
1449 1449
 
1450
-                if ( ! isset($l2) ) {
1450
+                if ( ! isset( $l2 ) ) {
1451 1451
                     $l2 = $name;
1452 1452
                 }
1453 1453
 
1454
-                if ( ! isset($l3) ) {
1454
+                if ( ! isset( $l3 ) ) {
1455 1455
                     $l3 = $name;
1456 1456
                 }
1457 1457
 
@@ -1465,24 +1465,24 @@  discard block
 block discarded – undo
1465 1465
 
1466 1466
                     case 1:
1467 1467
                         $l2 = $name;
1468
-                        self::add_value_to_array( $name, $l2, $this_val, $vars[ $l1 ] );
1468
+                        self::add_value_to_array( $name, $l2, $this_val, $vars[$l1] );
1469 1469
                     break;
1470 1470
 
1471 1471
                     case 2:
1472 1472
                         $l3 = $name;
1473
-                        self::add_value_to_array( $name, $l3, $this_val, $vars[ $l1 ][ $l2 ] );
1473
+                        self::add_value_to_array( $name, $l3, $this_val, $vars[$l1][$l2] );
1474 1474
                     break;
1475 1475
 
1476 1476
                     case 3:
1477 1477
                         $l4 = $name;
1478
-                        self::add_value_to_array( $name, $l4, $this_val, $vars[ $l1 ][ $l2 ][ $l3 ] );
1478
+                        self::add_value_to_array( $name, $l4, $this_val, $vars[$l1][$l2][$l3] );
1479 1479
                     break;
1480 1480
                 }
1481 1481
 
1482
-                unset($this_val, $n);
1482
+                unset( $this_val, $n );
1483 1483
             }
1484 1484
 
1485
-            unset($last, $jv);
1485
+            unset( $last, $jv );
1486 1486
         }
1487 1487
 
1488 1488
         return $vars;
@@ -1495,8 +1495,8 @@  discard block
 block discarded – undo
1495 1495
     public static function add_value_to_array( $name, $l1, $val, &$vars ) {
1496 1496
         if ( $name == '' ) {
1497 1497
             $vars[] = $val;
1498
-        } else if ( ! isset( $vars[ $l1 ] ) ) {
1499
-            $vars[ $l1 ] = $val;
1498
+        } else if ( ! isset( $vars[$l1] ) ) {
1499
+            $vars[$l1] = $val;
1500 1500
         }
1501 1501
     }
1502 1502
 
@@ -1511,7 +1511,7 @@  discard block
 block discarded – undo
1511 1511
             '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() ) ),
1512 1512
         );
1513 1513
 
1514
-        if ( ! isset( $tooltips[ $name ] ) ) {
1514
+        if ( ! isset( $tooltips[$name] ) ) {
1515 1515
             return;
1516 1516
         }
1517 1517
 
@@ -1521,7 +1521,7 @@  discard block
 block discarded – undo
1521 1521
             echo ' class="frm_help"';
1522 1522
         }
1523 1523
 
1524
-        echo ' title="'. esc_attr( $tooltips[ $name ] );
1524
+        echo ' title="' . esc_attr( $tooltips[$name] );
1525 1525
 
1526 1526
         if ( 'open' != $class ) {
1527 1527
             echo '"';
@@ -1570,13 +1570,13 @@  discard block
 block discarded – undo
1570 1570
     }
1571 1571
 
1572 1572
 	private static function prepare_action_slashes( $val, $key, &$post_content ) {
1573
-		if ( ! isset( $post_content[ $key ] ) ) {
1573
+		if ( ! isset( $post_content[$key] ) ) {
1574 1574
 			return;
1575 1575
 		}
1576 1576
 
1577 1577
 		if ( is_array( $val ) ) {
1578 1578
 			foreach ( $val as $k1 => $v1 ) {
1579
-				self::prepare_action_slashes( $v1, $k1, $post_content[ $key ] );
1579
+				self::prepare_action_slashes( $v1, $k1, $post_content[$key] );
1580 1580
 				unset( $k1, $v1 );
1581 1581
 			}
1582 1582
 		} else {
@@ -1584,7 +1584,7 @@  discard block
 block discarded – undo
1584 1584
 			$val = stripslashes( $val );
1585 1585
 
1586 1586
 			// Add backslashes before double quotes and forward slashes only
1587
-			$post_content[ $key ] = addcslashes( $val, '"\\/' );
1587
+			$post_content[$key] = addcslashes( $val, '"\\/' );
1588 1588
 		}
1589 1589
 	}
1590 1590
 
@@ -1601,7 +1601,7 @@  discard block
 block discarded – undo
1601 1601
 		$settings['post_content'] = FrmAppHelper::prepare_and_encode( $settings['post_content'] );
1602 1602
 
1603 1603
 		if ( empty( $settings['ID'] ) ) {
1604
-			unset( $settings['ID']);
1604
+			unset( $settings['ID'] );
1605 1605
 		}
1606 1606
 
1607 1607
 		// delete all caches for this group
@@ -1635,17 +1635,17 @@  discard block
 block discarded – undo
1635 1635
 	}
1636 1636
 
1637 1637
 	public static function maybe_json_decode( $string ) {
1638
-        if ( is_array($string) ) {
1638
+        if ( is_array( $string ) ) {
1639 1639
             return $string;
1640 1640
         }
1641 1641
 
1642
-        $new_string = json_decode($string, true);
1643
-        if ( function_exists('json_last_error') ) {
1642
+        $new_string = json_decode( $string, true );
1643
+        if ( function_exists( 'json_last_error' ) ) {
1644 1644
 			// php 5.3+
1645 1645
             if ( json_last_error() == JSON_ERROR_NONE ) {
1646 1646
                 $string = $new_string;
1647 1647
             }
1648
-        } else if ( isset($new_string) ) {
1648
+        } else if ( isset( $new_string ) ) {
1649 1649
 			// php < 5.3 fallback
1650 1650
             $string = $new_string;
1651 1651
         }
@@ -1661,11 +1661,11 @@  discard block
 block discarded – undo
1661 1661
 	public static function maybe_highlight_menu( $post_type ) {
1662 1662
         global $post, $pagenow;
1663 1663
 
1664
-        if ( isset($_REQUEST['post_type']) && $_REQUEST['post_type'] != $post_type ) {
1664
+        if ( isset( $_REQUEST['post_type'] ) && $_REQUEST['post_type'] != $post_type ) {
1665 1665
             return;
1666 1666
         }
1667 1667
 
1668
-        if ( is_object($post) && $post->post_type != $post_type ) {
1668
+        if ( is_object( $post ) && $post->post_type != $post_type ) {
1669 1669
             return;
1670 1670
         }
1671 1671
 
@@ -1763,11 +1763,11 @@  discard block
 block discarded – undo
1763 1763
         $frm_version = self::plugin_version();
1764 1764
 
1765 1765
         // check if Formidable meets minimum requirements
1766
-        if ( version_compare($frm_version, $min_version, '>=') ) {
1766
+        if ( version_compare( $frm_version, $min_version, '>=' ) ) {
1767 1767
             return;
1768 1768
         }
1769 1769
 
1770
-        $wp_list_table = _get_list_table('WP_Plugins_List_Table');
1770
+        $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
1771 1771
 		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">' .
1772 1772
         __( 'You are running an outdated version of Formidable. This plugin may not work correctly if you do not update Formidable.', 'formidable' ) .
1773 1773
         '</div></td></tr>';
@@ -1775,38 +1775,38 @@  discard block
 block discarded – undo
1775 1775
 
1776 1776
     public static function locales( $type = 'date' ) {
1777 1777
         $locales = array(
1778
-            'en' => __( 'English', 'formidable' ),    '' => __( 'English/Western', 'formidable' ),
1779
-            'af' => __( 'Afrikaans', 'formidable' ),  'sq' => __( 'Albanian', 'formidable' ),
1780
-            'ar' => __( 'Arabic', 'formidable' ),     'hy' => __( 'Armenian', 'formidable' ),
1778
+            'en' => __( 'English', 'formidable' ), '' => __( 'English/Western', 'formidable' ),
1779
+            'af' => __( 'Afrikaans', 'formidable' ), 'sq' => __( 'Albanian', 'formidable' ),
1780
+            'ar' => __( 'Arabic', 'formidable' ), 'hy' => __( 'Armenian', 'formidable' ),
1781 1781
             'az' => __( 'Azerbaijani', 'formidable' ), 'eu' => __( 'Basque', 'formidable' ),
1782
-            'bs' => __( 'Bosnian', 'formidable' ),    'bg' => __( 'Bulgarian', 'formidable' ),
1783
-            'ca' => __( 'Catalan', 'formidable' ),    'zh-HK' => __( 'Chinese Hong Kong', 'formidable' ),
1782
+            'bs' => __( 'Bosnian', 'formidable' ), 'bg' => __( 'Bulgarian', 'formidable' ),
1783
+            'ca' => __( 'Catalan', 'formidable' ), 'zh-HK' => __( 'Chinese Hong Kong', 'formidable' ),
1784 1784
             'zh-CN' => __( 'Chinese Simplified', 'formidable' ), 'zh-TW' => __( 'Chinese Traditional', 'formidable' ),
1785
-            'hr' => __( 'Croatian', 'formidable' ),   'cs' => __( 'Czech', 'formidable' ),
1786
-            'da' => __( 'Danish', 'formidable' ),     'nl' => __( 'Dutch', 'formidable' ),
1785
+            'hr' => __( 'Croatian', 'formidable' ), 'cs' => __( 'Czech', 'formidable' ),
1786
+            'da' => __( 'Danish', 'formidable' ), 'nl' => __( 'Dutch', 'formidable' ),
1787 1787
             'en-GB' => __( 'English/UK', 'formidable' ), 'eo' => __( 'Esperanto', 'formidable' ),
1788
-            'et' => __( 'Estonian', 'formidable' ),   'fo' => __( 'Faroese', 'formidable' ),
1788
+            'et' => __( 'Estonian', 'formidable' ), 'fo' => __( 'Faroese', 'formidable' ),
1789 1789
             'fa' => __( 'Farsi/Persian', 'formidable' ), 'fil' => __( 'Filipino', 'formidable' ),
1790
-            'fi' => __( 'Finnish', 'formidable' ),    'fr' => __( 'French', 'formidable' ),
1790
+            'fi' => __( 'Finnish', 'formidable' ), 'fr' => __( 'French', 'formidable' ),
1791 1791
             'fr-CA' => __( 'French/Canadian', 'formidable' ), 'fr-CH' => __( 'French/Swiss', 'formidable' ),
1792
-            'de' => __( 'German', 'formidable' ),     'de-AT' => __( 'German/Austria', 'formidable' ),
1792
+            'de' => __( 'German', 'formidable' ), 'de-AT' => __( 'German/Austria', 'formidable' ),
1793 1793
             'de-CH' => __( 'German/Switzerland', 'formidable' ), 'el' => __( 'Greek', 'formidable' ),
1794
-            'he' => __( 'Hebrew', 'formidable' ),     'iw' => __( 'Hebrew', 'formidable' ),
1795
-            'hi' => __( 'Hindi', 'formidable' ),      'hu' => __( 'Hungarian', 'formidable' ),
1796
-            'is' => __( 'Icelandic', 'formidable' ),  'id' => __( 'Indonesian', 'formidable' ),
1797
-            'it' => __( 'Italian', 'formidable' ),    'ja' => __( 'Japanese', 'formidable' ),
1798
-            'ko' => __( 'Korean', 'formidable' ),     'lv' => __( 'Latvian', 'formidable' ),
1794
+            'he' => __( 'Hebrew', 'formidable' ), 'iw' => __( 'Hebrew', 'formidable' ),
1795
+            'hi' => __( 'Hindi', 'formidable' ), 'hu' => __( 'Hungarian', 'formidable' ),
1796
+            'is' => __( 'Icelandic', 'formidable' ), 'id' => __( 'Indonesian', 'formidable' ),
1797
+            'it' => __( 'Italian', 'formidable' ), 'ja' => __( 'Japanese', 'formidable' ),
1798
+            'ko' => __( 'Korean', 'formidable' ), 'lv' => __( 'Latvian', 'formidable' ),
1799 1799
             'lt' => __( 'Lithuanian', 'formidable' ), 'ms' => __( 'Malaysian', 'formidable' ),
1800
-            'no' => __( 'Norwegian', 'formidable' ),  'pl' => __( 'Polish', 'formidable' ),
1800
+            'no' => __( 'Norwegian', 'formidable' ), 'pl' => __( 'Polish', 'formidable' ),
1801 1801
             'pt' => __( 'Portuguese', 'formidable' ), 'pt-BR' => __( 'Portuguese/Brazilian', 'formidable' ),
1802 1802
             'pt-PT' => __( 'Portuguese/Portugal', 'formidable' ), 'ro' => __( 'Romanian', 'formidable' ),
1803
-            'ru' => __( 'Russian', 'formidable' ),    'sr' => __( 'Serbian', 'formidable' ),
1803
+            'ru' => __( 'Russian', 'formidable' ), 'sr' => __( 'Serbian', 'formidable' ),
1804 1804
             'sr-SR' => __( 'Serbian', 'formidable' ), 'sk' => __( 'Slovak', 'formidable' ),
1805
-            'sl' => __( 'Slovenian', 'formidable' ),  'es' => __( 'Spanish', 'formidable' ),
1805
+            'sl' => __( 'Slovenian', 'formidable' ), 'es' => __( 'Spanish', 'formidable' ),
1806 1806
             'es-419' => __( 'Spanish/Latin America', 'formidable' ), 'sv' => __( 'Swedish', 'formidable' ),
1807
-            'ta' => __( 'Tamil', 'formidable' ),      'th' => __( 'Thai', 'formidable' ),
1808
-            'tu' => __( 'Turkish', 'formidable' ),    'tr' => __( 'Turkish', 'formidable' ),
1809
-            'uk' => __( 'Ukranian', 'formidable' ),   'vi' => __( 'Vietnamese', 'formidable' ),
1807
+            'ta' => __( 'Tamil', 'formidable' ), 'th' => __( 'Thai', 'formidable' ),
1808
+            'tu' => __( 'Turkish', 'formidable' ), 'tr' => __( 'Turkish', 'formidable' ),
1809
+            'uk' => __( 'Ukranian', 'formidable' ), 'vi' => __( 'Vietnamese', 'formidable' ),
1810 1810
         );
1811 1811
 
1812 1812
         if ( $type == 'captcha' ) {
@@ -1825,8 +1825,8 @@  discard block
 block discarded – undo
1825 1825
             );
1826 1826
         }
1827 1827
 
1828
-        $locales = array_diff_key($locales, array_flip($unset));
1829
-        $locales = apply_filters('frm_locales', $locales);
1828
+        $locales = array_diff_key( $locales, array_flip( $unset ) );
1829
+        $locales = apply_filters( 'frm_locales', $locales );
1830 1830
 
1831 1831
         return $locales;
1832 1832
     }
Please login to merge, or discard this patch.
classes/helpers/FrmEntriesHelper.php 1 patch
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined('ABSPATH') ) {
2
+if ( ! defined( 'ABSPATH' ) ) {
3 3
 	die( 'You are not allowed to call this page directly.' );
4 4
 }
5 5
 
@@ -9,12 +9,12 @@  discard block
 block discarded – undo
9 9
         global $frm_vars;
10 10
         $values = array();
11 11
 		foreach ( array( 'name' => '', 'description' => '', 'item_key' => '' ) as $var => $default ) {
12
-            $values[ $var ] = FrmAppHelper::get_post_param( $var, $default );
12
+            $values[$var] = FrmAppHelper::get_post_param( $var, $default );
13 13
         }
14 14
 
15 15
         $values['fields'] = array();
16
-        if ( empty($fields) ) {
17
-            return apply_filters('frm_setup_new_entry', $values);
16
+        if ( empty( $fields ) ) {
17
+            return apply_filters( 'frm_setup_new_entry', $values );
18 18
         }
19 19
 
20 20
         foreach ( (array) $fields as $field ) {
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
                 'default_value' => $field->default_value,
27 27
                 'name' => $field->name,
28 28
                 'description' => $field->description,
29
-                'type' => apply_filters('frm_field_type', $field->type, $field, $new_value),
29
+                'type' => apply_filters( 'frm_field_type', $field->type, $field, $new_value ),
30 30
                 'options' => $field->options,
31 31
                 'required' => $field->required,
32 32
                 'field_key' => $field->field_key,
@@ -35,43 +35,43 @@  discard block
 block discarded – undo
35 35
 				'parent_form_id' => isset( $args['parent_form_id'] ) ? $args['parent_form_id'] : $field->form_id,
36 36
             );
37 37
 
38
-            $opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true);
38
+            $opt_defaults = FrmFieldsHelper::get_default_field_opts( $field_array['type'], $field, true );
39 39
             $opt_defaults['required_indicator'] = '';
40 40
 			$opt_defaults['original_type'] = $field->type;
41 41
 
42 42
 			foreach ( $opt_defaults as $opt => $default_opt ) {
43
-                $field_array[ $opt ] = ( isset( $field->field_options[ $opt ] ) && $field->field_options[ $opt ] != '' ) ? $field->field_options[ $opt ] : $default_opt;
44
-                unset($opt, $default_opt);
43
+                $field_array[$opt] = ( isset( $field->field_options[$opt] ) && $field->field_options[$opt] != '' ) ? $field->field_options[$opt] : $default_opt;
44
+                unset( $opt, $default_opt );
45 45
             }
46 46
 
47
-            unset($opt_defaults);
47
+            unset( $opt_defaults );
48 48
 
49 49
             if ( $field_array['custom_html'] == '' ) {
50
-                $field_array['custom_html'] = FrmFieldsHelper::get_default_html($field->type);
50
+                $field_array['custom_html'] = FrmFieldsHelper::get_default_html( $field->type );
51 51
             }
52 52
 
53
-            $field_array = apply_filters('frm_setup_new_fields_vars', $field_array, $field);
53
+            $field_array = apply_filters( 'frm_setup_new_fields_vars', $field_array, $field );
54 54
             $field_array = array_merge( $field->field_options, $field_array );
55 55
 
56 56
             $values['fields'][] = $field_array;
57 57
 
58
-            if ( ! $form || ! isset($form->id) ) {
59
-                $form = FrmForm::getOne($field->form_id);
58
+            if ( ! $form || ! isset( $form->id ) ) {
59
+                $form = FrmForm::getOne( $field->form_id );
60 60
             }
61 61
         }
62 62
 
63
-        $form->options = maybe_unserialize($form->options);
64
-        if ( is_array($form->options) ) {
63
+        $form->options = maybe_unserialize( $form->options );
64
+        if ( is_array( $form->options ) ) {
65 65
             foreach ( $form->options as $opt => $value ) {
66
-                $values[ $opt ] = FrmAppHelper::get_post_param( $opt, $value );
67
-                unset($opt, $value);
66
+                $values[$opt] = FrmAppHelper::get_post_param( $opt, $value );
67
+                unset( $opt, $value );
68 68
             }
69 69
         }
70 70
 
71 71
 		$form_defaults = FrmFormsHelper::get_default_opts();
72 72
 
73 73
 		$frm_settings = FrmAppHelper::get_settings();
74
-		$form_defaults['custom_style']  = ( $frm_settings->load_style != 'none' );
74
+		$form_defaults['custom_style'] = ( $frm_settings->load_style != 'none' );
75 75
 
76 76
 		$values = array_merge( $form_defaults, $values );
77 77
 
@@ -93,15 +93,15 @@  discard block
 block discarded – undo
93 93
 		$return_array = FrmField::is_field_with_multiple_values( $field );
94 94
 
95 95
 		// Do any shortcodes in default value and allow customization of default value
96
-		$field->default_value = apply_filters('frm_get_default_value', $field->default_value, $field, true, $return_array);
96
+		$field->default_value = apply_filters( 'frm_get_default_value', $field->default_value, $field, true, $return_array );
97 97
 		// Calls FrmProFieldsHelper::get_default_value
98 98
 
99 99
 		$new_value = $field->default_value;
100 100
 
101
-		if ( ! $reset && $_POST && isset( $_POST['item_meta'][ $field->id ] ) ) {
101
+		if ( ! $reset && $_POST && isset( $_POST['item_meta'][$field->id] ) ) {
102 102
 			// If value was posted, get it
103 103
 
104
-			$new_value = stripslashes_deep( $_POST['item_meta'][ $field->id ] );
104
+			$new_value = stripslashes_deep( $_POST['item_meta'][$field->id] );
105 105
 
106 106
 		} else if ( FrmField::is_option_true( $field, 'clear_on_focus' ) ) {
107 107
 			// If clear on focus is selected, the value should be blank (unless it was posted, of course)
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 		}
111 111
 
112 112
 		if ( ! is_array( $new_value ) ) {
113
-			$new_value = str_replace('"', '&quot;', $new_value);
113
+			$new_value = str_replace( '"', '&quot;', $new_value );
114 114
 		}
115 115
 
116 116
 		return $new_value;
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 		$values['item_key'] = FrmAppHelper::get_post_param( 'item_key', $record->item_key, 'sanitize_title' );
121 121
         $values['form_id'] = $record->form_id;
122 122
         $values['is_draft'] = $record->is_draft;
123
-        return apply_filters('frm_setup_edit_entry_vars', $values, $record);
123
+        return apply_filters( 'frm_setup_edit_entry_vars', $values, $record );
124 124
     }
125 125
 
126 126
     public static function get_admin_params( $form = null ) {
@@ -149,22 +149,22 @@  discard block
 block discarded – undo
149 149
     }
150 150
 
151 151
 	public static function replace_default_message( $message, $atts ) {
152
-        if ( strpos($message, '[default-message') === false &&
153
-            strpos($message, '[default_message') === false &&
152
+        if ( strpos( $message, '[default-message' ) === false &&
153
+            strpos( $message, '[default_message' ) === false &&
154 154
             ! empty( $message ) ) {
155 155
             return $message;
156 156
         }
157 157
 
158
-        if ( empty($message) ) {
158
+        if ( empty( $message ) ) {
159 159
             $message = '[default-message]';
160 160
         }
161 161
 
162
-        preg_match_all("/\[(default-message|default_message)\b(.*?)(?:(\/))?\]/s", $message, $shortcodes, PREG_PATTERN_ORDER);
162
+        preg_match_all( "/\[(default-message|default_message)\b(.*?)(?:(\/))?\]/s", $message, $shortcodes, PREG_PATTERN_ORDER );
163 163
 
164 164
         foreach ( $shortcodes[0] as $short_key => $tag ) {
165
-            $add_atts = shortcode_parse_atts( $shortcodes[2][ $short_key ] );
165
+            $add_atts = shortcode_parse_atts( $shortcodes[2][$short_key] );
166 166
             if ( $add_atts ) {
167
-                $this_atts = array_merge($atts, $add_atts);
167
+                $this_atts = array_merge( $atts, $add_atts );
168 168
             } else {
169 169
                 $this_atts = $atts;
170 170
             }
@@ -172,31 +172,31 @@  discard block
 block discarded – undo
172 172
 			$default = FrmEntryFormat::show_entry( $this_atts );
173 173
 
174 174
             // Add the default message
175
-            $message = str_replace( $shortcodes[0][ $short_key ], $default, $message );
175
+            $message = str_replace( $shortcodes[0][$short_key], $default, $message );
176 176
         }
177 177
 
178 178
         return $message;
179 179
     }
180 180
 
181 181
 	public static function prepare_display_value( $entry, $field, $atts ) {
182
-		$field_value = isset( $entry->metas[ $field->id ] ) ? $entry->metas[ $field->id ] : false;
182
+		$field_value = isset( $entry->metas[$field->id] ) ? $entry->metas[$field->id] : false;
183 183
         if ( FrmAppHelper::pro_is_installed() ) {
184 184
 			FrmProEntriesHelper::get_dynamic_list_values( $field, $entry, $field_value );
185 185
         }
186 186
 
187
-        if ( $field->form_id == $entry->form_id || empty($atts['embedded_field_id']) ) {
188
-            return self::display_value($field_value, $field, $atts);
187
+        if ( $field->form_id == $entry->form_id || empty( $atts['embedded_field_id'] ) ) {
188
+            return self::display_value( $field_value, $field, $atts );
189 189
         }
190 190
 
191 191
         // this is an embeded form
192 192
         $val = '';
193 193
 
194
-	    if ( strpos($atts['embedded_field_id'], 'form') === 0 ) {
194
+	    if ( strpos( $atts['embedded_field_id'], 'form' ) === 0 ) {
195 195
             //this is a repeating section
196 196
 			$child_entries = FrmEntry::getAll( array( 'it.parent_item_id' => $entry->id ) );
197 197
         } else {
198 198
             // get all values for this field
199
-	        $child_values = isset( $entry->metas[ $atts['embedded_field_id'] ] ) ? $entry->metas[ $atts['embedded_field_id'] ] : false;
199
+	        $child_values = isset( $entry->metas[$atts['embedded_field_id']] ) ? $entry->metas[$atts['embedded_field_id']] : false;
200 200
 
201 201
             if ( $child_values ) {
202 202
 	            $child_entries = FrmEntry::getAll( array( 'it.id' => (array) $child_values ) );
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 
206 206
 	    $field_value = array();
207 207
 
208
-        if ( ! isset($child_entries) || ! $child_entries || ! FrmAppHelper::pro_is_installed() ) {
208
+        if ( ! isset( $child_entries ) || ! $child_entries || ! FrmAppHelper::pro_is_installed() ) {
209 209
             return $val;
210 210
         }
211 211
 
@@ -214,17 +214,17 @@  discard block
 block discarded – undo
214 214
             $atts['post_id'] = $child_entry->post_id;
215 215
 
216 216
             // get the value for this field -- check for post values as well
217
-            $entry_val = FrmProEntryMetaHelper::get_post_or_meta_value($child_entry, $field);
217
+            $entry_val = FrmProEntryMetaHelper::get_post_or_meta_value( $child_entry, $field );
218 218
 
219 219
             if ( $entry_val ) {
220 220
                 // foreach entry get display_value
221
-                $field_value[] = self::display_value($entry_val, $field, $atts);
221
+                $field_value[] = self::display_value( $entry_val, $field, $atts );
222 222
             }
223 223
 
224
-            unset($child_entry);
224
+            unset( $child_entry );
225 225
         }
226 226
 
227
-        $val = implode(', ', (array) $field_value );
227
+        $val = implode( ', ', (array) $field_value );
228 228
 		$val = wp_kses_post( $val );
229 229
 
230 230
         return $val;
@@ -244,22 +244,22 @@  discard block
 block discarded – undo
244 244
         );
245 245
 
246 246
         $atts = wp_parse_args( $atts, $defaults );
247
-        $atts = apply_filters('frm_display_value_atts', $atts, $field, $value);
247
+        $atts = apply_filters( 'frm_display_value_atts', $atts, $field, $value );
248 248
 
249
-        if ( ! isset($field->field_options['post_field']) ) {
249
+        if ( ! isset( $field->field_options['post_field'] ) ) {
250 250
             $field->field_options['post_field'] = '';
251 251
         }
252 252
 
253
-        if ( ! isset($field->field_options['custom_field']) ) {
253
+        if ( ! isset( $field->field_options['custom_field'] ) ) {
254 254
             $field->field_options['custom_field'] = '';
255 255
         }
256 256
 
257 257
         if ( FrmAppHelper::pro_is_installed() && $atts['post_id'] && ( $field->field_options['post_field'] || $atts['type'] == 'tag' ) ) {
258 258
             $atts['pre_truncate'] = $atts['truncate'];
259 259
             $atts['truncate'] = true;
260
-            $atts['exclude_cat'] = isset($field->field_options['exclude_cat']) ? $field->field_options['exclude_cat'] : 0;
260
+            $atts['exclude_cat'] = isset( $field->field_options['exclude_cat'] ) ? $field->field_options['exclude_cat'] : 0;
261 261
 
262
-            $value = FrmProEntryMetaHelper::get_post_value($atts['post_id'], $field->field_options['post_field'], $field->field_options['custom_field'], $atts);
262
+            $value = FrmProEntryMetaHelper::get_post_value( $atts['post_id'], $field->field_options['post_field'], $field->field_options['custom_field'], $atts );
263 263
             $atts['truncate'] = $atts['pre_truncate'];
264 264
         }
265 265
 
@@ -267,38 +267,38 @@  discard block
 block discarded – undo
267 267
             return $value;
268 268
         }
269 269
 
270
-        $value = apply_filters('frm_display_value_custom', maybe_unserialize($value), $field, $atts);
270
+        $value = apply_filters( 'frm_display_value_custom', maybe_unserialize( $value ), $field, $atts );
271 271
 
272 272
         $new_value = '';
273 273
 
274
-        if ( is_array($value) && $atts['type'] != 'file' ) {
274
+        if ( is_array( $value ) && $atts['type'] != 'file' ) {
275 275
             foreach ( $value as $val ) {
276
-                if ( is_array($val) ) {
276
+                if ( is_array( $val ) ) {
277 277
 					//TODO: add options for display (li or ,)
278
-                    $new_value .= implode($atts['sep'], $val);
278
+                    $new_value .= implode( $atts['sep'], $val );
279 279
                     if ( $atts['type'] != 'data' ) {
280 280
                         $new_value .= '<br/>';
281 281
                     }
282 282
                 }
283
-                unset($val);
283
+                unset( $val );
284 284
             }
285 285
         }
286 286
 
287
-        if ( ! empty($new_value) ) {
287
+        if ( ! empty( $new_value ) ) {
288 288
             $value = $new_value;
289
-        } else if ( is_array($value) && $atts['type'] != 'file' && ! $atts['return_array'] ) {
290
-            $value = implode($atts['sep'], $value);
289
+        } else if ( is_array( $value ) && $atts['type'] != 'file' && ! $atts['return_array'] ) {
290
+            $value = implode( $atts['sep'], $value );
291 291
         }
292 292
 
293 293
         if ( $atts['truncate'] && $atts['type'] != 'image' ) {
294
-            $value = FrmAppHelper::truncate($value, 50);
294
+            $value = FrmAppHelper::truncate( $value, 50 );
295 295
         }
296 296
 
297 297
 		if ( ! $atts['keepjs'] && ! is_array( $value ) ) {
298 298
 			$value = wp_kses_post( $value );
299 299
 		}
300 300
 
301
-        return apply_filters('frm_display_value', $value, $field, $atts);
301
+        return apply_filters( 'frm_display_value', $value, $field, $atts );
302 302
     }
303 303
 
304 304
 	public static function set_posted_value( $field, $value, $args ) {
@@ -306,20 +306,20 @@  discard block
 block discarded – undo
306 306
         if ( isset( $args['other'] ) && $args['other'] ) {
307 307
             $value = $args['temp_value'];
308 308
         }
309
-        if ( empty($args['parent_field_id']) ) {
310
-            $_POST['item_meta'][ $field->id ] = $value;
309
+        if ( empty( $args['parent_field_id'] ) ) {
310
+            $_POST['item_meta'][$field->id] = $value;
311 311
         } else {
312
-            $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] = $value;
312
+            $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field->id] = $value;
313 313
         }
314 314
     }
315 315
 
316 316
 	public static function get_posted_value( $field, &$value, $args ) {
317 317
 		$field_id = is_object( $field ) ? $field->id : $field;
318 318
 
319
-        if ( empty($args['parent_field_id']) ) {
320
-            $value = isset( $_POST['item_meta'][ $field_id ] ) ? $_POST['item_meta'][ $field_id ] : '';
319
+        if ( empty( $args['parent_field_id'] ) ) {
320
+            $value = isset( $_POST['item_meta'][$field_id] ) ? $_POST['item_meta'][$field_id] : '';
321 321
         } else {
322
-            $value = isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] ) ? $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] : '';
322
+            $value = isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field_id] ) ? $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field_id] : '';
323 323
         }
324 324
     }
325 325
 
@@ -342,12 +342,12 @@  discard block
 block discarded – undo
342 342
         self::set_other_repeating_vals( $field, $value, $args );
343 343
 
344 344
         // Check if there are any posted "Other" values
345
-		if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][ $field->id ] ) ) {
345
+		if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][$field->id] ) ) {
346 346
 
347 347
             // Save original value
348 348
             $args['temp_value'] = $value;
349 349
             $args['other'] = true;
350
-            $other_vals = stripslashes_deep( $_POST['item_meta']['other'][ $field->id ] );
350
+            $other_vals = stripslashes_deep( $_POST['item_meta']['other'][$field->id] );
351 351
 
352 352
             // Set the validation value now
353 353
             self::set_other_validation_val( $value, $other_vals, $field, $args );
@@ -369,12 +369,12 @@  discard block
 block discarded – undo
369 369
         }
370 370
 
371 371
         // Check if there are any other posted "other" values for this field
372
-		if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ] ) ) {
372
+		if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']]['other'][$field->id] ) ) {
373 373
             // Save original value
374 374
             $args['temp_value'] = $value;
375 375
             $args['other'] = true;
376 376
 
377
-            $other_vals = $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ];
377
+            $other_vals = $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']]['other'][$field->id];
378 378
 
379 379
             // Set the validation value now
380 380
             self::set_other_validation_val( $value, $other_vals, $field, $args );
@@ -406,27 +406,27 @@  discard block
 block discarded – undo
406 406
             }
407 407
         } else {
408 408
 			// Radio and dropdowns
409
-            $other_key = array_filter( array_keys($field->options), 'is_string');
409
+            $other_key = array_filter( array_keys( $field->options ), 'is_string' );
410 410
             $other_key = reset( $other_key );
411 411
 
412 412
             // Multi-select dropdown
413 413
             if ( is_array( $value ) ) {
414
-                $o_key = array_search( $field->options[ $other_key ], $value );
414
+                $o_key = array_search( $field->options[$other_key], $value );
415 415
 
416 416
 				if ( $o_key !== false ) {
417 417
 					// Modify the original value so other key will be preserved
418
-					$value[ $other_key ] = $value[ $o_key ];
418
+					$value[$other_key] = $value[$o_key];
419 419
 
420 420
 					// By default, the array keys will be numeric for multi-select dropdowns
421 421
 					// If going backwards and forwards between pages, the array key will match the other key
422 422
 					if ( $o_key != $other_key ) {
423
-						unset( $value[ $o_key ] );
423
+						unset( $value[$o_key] );
424 424
 					}
425 425
 
426 426
 					$args['temp_value'] = $value;
427
-					$value[ $other_key ] = reset( $other_vals );
427
+					$value[$other_key] = reset( $other_vals );
428 428
 				}
429
-            } else if ( $field->options[ $other_key ] == $value ) {
429
+            } else if ( $field->options[$other_key] == $value ) {
430 430
                 $value = $other_vals;
431 431
             }
432 432
         }
@@ -445,9 +445,9 @@  discard block
 block discarded – undo
445 445
 				$content .= "\n\n";
446 446
 			}
447 447
 
448
-			if ( is_array($val) ) {
448
+			if ( is_array( $val ) ) {
449 449
 				$val = FrmAppHelper::array_flatten( $val );
450
-			    $val = implode(',', $val);
450
+			    $val = implode( ',', $val );
451 451
 			}
452 452
 
453 453
 			$content .= $val;
@@ -492,6 +492,6 @@  discard block
 block discarded – undo
492 492
 	}
493 493
 
494 494
 	public static function entries_dropdown() {
495
-		_deprecated_function( __FUNCTION__, '1.07.09');
495
+		_deprecated_function( __FUNCTION__, '1.07.09' );
496 496
 	}
497 497
 }
Please login to merge, or discard this patch.
classes/helpers/FrmEntriesListHelper.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -25,15 +25,15 @@  discard block
 block discarded – undo
25 25
 
26 26
 	    $s_query = array( 'it.form_id' => $form_id );
27 27
 
28
-		$s = isset( $_REQUEST['s'] ) ? stripslashes($_REQUEST['s']) : '';
28
+		$s = isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : '';
29 29
 
30 30
 	    if ( $s != '' && FrmAppHelper::pro_is_installed() ) {
31 31
 	        $fid = isset( $_REQUEST['fid'] ) ? sanitize_title( $_REQUEST['fid'] ) : '';
32
-	        $s_query = FrmProEntriesHelper::get_search_str( $s_query, $s, $form_id, $fid);
32
+	        $s_query = FrmProEntriesHelper::get_search_str( $s_query, $s, $form_id, $fid );
33 33
 	    }
34 34
 
35 35
         $orderby = isset( $_REQUEST['orderby'] ) ? sanitize_title( $_REQUEST['orderby'] ) : $default_orderby;
36
-        if ( strpos($orderby, 'meta') !== false ) {
36
+        if ( strpos( $orderby, 'meta' ) !== false ) {
37 37
             $order_field_type = FrmField::get_type( str_replace( 'meta_', '', $orderby ) );
38 38
 			$orderby .= in_array( $order_field_type, array( 'number', 'scale' ) ) ? ' +0 ' : '';
39 39
         }
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
         $page = $this->get_pagenum();
45 45
 		$start = (int) isset( $_REQUEST['start'] ) ? absint( $_REQUEST['start'] ) : ( ( $page - 1 ) * $per_page );
46 46
 
47
-        $this->items = FrmEntry::getAll($s_query, $order, ' LIMIT '. $start .','. $per_page, true, false);
48
-        $total_items = FrmEntry::getRecordCount($s_query);
47
+        $this->items = FrmEntry::getAll( $s_query, $order, ' LIMIT ' . $start . ',' . $per_page, true, false );
48
+        $total_items = FrmEntry::getRecordCount( $s_query );
49 49
 
50 50
 		$this->set_pagination_args( array(
51 51
 			'total_items' => $total_items,
@@ -55,18 +55,18 @@  discard block
 block discarded – undo
55 55
 
56 56
 	public function no_items() {
57 57
         $s = isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : '';
58
-	    if ( ! empty($s) ) {
58
+	    if ( ! empty( $s ) ) {
59 59
             _e( 'No Entries Found', 'formidable' );
60 60
             return;
61 61
         }
62 62
 
63 63
         $form_id = $form = $this->params['form'];
64 64
         if ( $form_id ) {
65
-            $form = FrmForm::getOne($form_id);
65
+            $form = FrmForm::getOne( $form_id );
66 66
         }
67 67
         $colspan = $this->get_column_count();
68 68
 
69
-        include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/no_entries.php');
69
+        include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/no_entries.php' );
70 70
 	}
71 71
 
72 72
 	public function search_box( $text, $input_id ) {
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	public function single_row( $item, $style = '' ) {
100 100
 		// Set up the hover actions for this user
101 101
 		$actions = array();
102
-		$view_link = '?page=formidable-entries&frm_action=show&id='. $item->id;
102
+		$view_link = '?page=formidable-entries&frm_action=show&id=' . $item->id;
103 103
 
104 104
 		$this->get_actions( $actions, $item, $view_link );
105 105
 
@@ -110,11 +110,11 @@  discard block
 block discarded – undo
110 110
 
111 111
 		$r = "<tr id='item-action-{$item->id}'$style>";
112 112
 
113
-		list( $columns, $hidden, , $primary ) = $this->get_column_info();
113
+		list( $columns, $hidden,, $primary ) = $this->get_column_info();
114 114
         $action_col = false;
115 115
 
116 116
 		foreach ( $columns as $column_name => $column_display_name ) {
117
-			$class = $column_name .' column-'. $column_name;
117
+			$class = $column_name . ' column-' . $column_name;
118 118
 
119 119
 			if ( $column_name === $primary ) {
120 120
 				$class .= ' column-primary';
@@ -127,10 +127,10 @@  discard block
 block discarded – undo
127 127
             }
128 128
 
129 129
 			$attributes = 'class="' . esc_attr( $class ) . '"';
130
-			unset($class);
131
-			$attributes .= ' data-colname="' . $column_display_name  . '"';
130
+			unset( $class );
131
+			$attributes .= ' data-colname="' . $column_display_name . '"';
132 132
 
133
-            $col_name = preg_replace('/^('. $this->params['form'] .'_)/', '', $column_name);
133
+            $col_name = preg_replace( '/^(' . $this->params['form'] . '_)/', '', $column_name );
134 134
 			$this->column_name = $col_name;
135 135
 
136 136
 			switch ( $col_name ) {
@@ -144,24 +144,24 @@  discard block
 block discarded – undo
144 144
 				    break;
145 145
 				case 'name':
146 146
 				case 'description':
147
-				    $val = FrmAppHelper::truncate(strip_tags($item->{$col_name}), 100);
147
+				    $val = FrmAppHelper::truncate( strip_tags( $item->{$col_name}), 100 );
148 148
 				    break;
149 149
 				case 'created_at':
150 150
 				case 'updated_at':
151
-				    $date = FrmAppHelper::get_formatted_time($item->{$col_name});
151
+				    $date = FrmAppHelper::get_formatted_time( $item->{$col_name});
152 152
 					$val = '<abbr title="' . esc_attr( FrmAppHelper::get_formatted_time( $item->{$col_name}, '', 'g:i:s A' ) ) . '">' . $date . '</abbr>';
153 153
 					break;
154 154
 				case 'is_draft':
155
-				    $val = empty($item->is_draft) ? __( 'No') : __( 'Yes');
155
+				    $val = empty( $item->is_draft ) ? __( 'No' ) : __( 'Yes' );
156 156
 			        break;
157 157
 				case 'form_id':
158
-				    $val = FrmFormsHelper::edit_form_link($item->form_id);
158
+				    $val = FrmFormsHelper::edit_form_link( $item->form_id );
159 159
     				break;
160 160
 				case 'post_id':
161
-				    $val = FrmAppHelper::post_edit_link($item->post_id);
161
+				    $val = FrmAppHelper::post_edit_link( $item->post_id );
162 162
 				    break;
163 163
 				case 'user_id':
164
-				    $user = get_userdata($item->user_id);
164
+				    $user = get_userdata( $item->user_id );
165 165
 				    $val = $user->user_login;
166 166
 				    break;
167 167
 				default:
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 			if ( isset( $val ) ) {
176 176
 			    $r .= "<td $attributes>";
177 177
 				if ( $column_name == $action_col ) {
178
-					$edit_link = '?page=formidable-entries&frm_action=edit&id='. $item->id;
178
+					$edit_link = '?page=formidable-entries&frm_action=edit&id=' . $item->id;
179 179
 					$r .= '<a href="' . esc_url( isset( $actions['edit'] ) ? $edit_link : $view_link ) . '" class="row-title" >' . $val . '</a> ';
180 180
 			        $r .= $action_links;
181 181
 				} else {
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 			    }
184 184
 			    $r .= '</td>';
185 185
 			}
186
-			unset($val);
186
+			unset( $val );
187 187
 		}
188 188
 		$r .= '</tr>';
189 189
 
@@ -194,14 +194,14 @@  discard block
 block discarded – undo
194 194
      * @param string $view_link
195 195
      */
196 196
     private function get_actions( &$actions, $item, $view_link ) {
197
-		$actions['view'] = '<a href="' . esc_url( $view_link ) . '">'. __( 'View', 'formidable' ) .'</a>';
197
+		$actions['view'] = '<a href="' . esc_url( $view_link ) . '">' . __( 'View', 'formidable' ) . '</a>';
198 198
 
199
-        if ( current_user_can('frm_delete_entries') ) {
200
-            $delete_link = '?page=formidable-entries&frm_action=destroy&id='. $item->id .'&form='. $this->params['form'];
199
+        if ( current_user_can( 'frm_delete_entries' ) ) {
200
+            $delete_link = '?page=formidable-entries&frm_action=destroy&id=' . $item->id . '&form=' . $this->params['form'];
201 201
 			$actions['delete'] = '<a href="' . esc_url( wp_nonce_url( $delete_link ) ) . '" class="submitdelete" onclick="return confirm(\'' . esc_attr( __( 'Are you sure you want to delete that?', 'formidable' ) ) . '\')">' . __( 'Delete' ) . '</a>';
202 202
 	    }
203 203
 
204
-        $actions = apply_filters('frm_row_actions', $actions, $item);
204
+        $actions = apply_filters( 'frm_row_actions', $actions, $item );
205 205
     }
206 206
 
207 207
 	private function get_column_value( $item, &$val ) {
Please login to merge, or discard this patch.
classes/helpers/FrmFormsHelper.php 1 patch
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined('ABSPATH') ) {
2
+if ( ! defined( 'ABSPATH' ) ) {
3 3
 	die( 'You are not allowed to call this page directly.' );
4 4
 }
5 5
 
@@ -11,8 +11,8 @@  discard block
 block discarded – undo
11 11
 	}
12 12
 
13 13
 	public static function get_direct_link( $key, $form = false ) {
14
-        $target_url = esc_url(admin_url('admin-ajax.php') . '?action=frm_forms_preview&form='. $key);
15
-        $target_url = apply_filters('frm_direct_link', $target_url, $key, $form);
14
+        $target_url = esc_url( admin_url( 'admin-ajax.php' ) . '?action=frm_forms_preview&form=' . $key );
15
+        $target_url = apply_filters( 'frm_direct_link', $target_url, $key, $form );
16 16
 
17 17
         return $target_url;
18 18
     }
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 			$query['id !'] = $args['exclude'];
38 38
         }
39 39
 
40
-        $where = apply_filters('frm_forms_dropdown', $query, $field_name);
40
+        $where = apply_filters( 'frm_forms_dropdown', $query, $field_name );
41 41
 		$forms = FrmForm::get_published_forms( $where, 999, $args['inc_children'] );
42 42
 		$add_html = array();
43 43
 		self::add_html_attr( $args['onchange'], 'onchange', $add_html );
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 		<?php } ?>
51 51
 		<?php foreach ( $forms as $form ) { ?>
52 52
 			<option value="<?php echo esc_attr( $form->id ); ?>" <?php selected( $field_value, $form->id ); ?>><?php
53
-				echo ( '' == $form->name ) ? esc_html__( '(no title)', 'formidable' ) : esc_html( FrmAppHelper::truncate( $form->name, 33 ) ) . ( $form->parent_form_id ? esc_html__( ' (child)', 'formidable' ) : '' ) ;
53
+				echo ( '' == $form->name ) ? esc_html__( '(no title)', 'formidable' ) : esc_html( FrmAppHelper::truncate( $form->name, 33 ) ) . ( $form->parent_form_id ? esc_html__( ' (child)', 'formidable' ) : '' );
54 54
 			?></option>
55 55
 		<?php } ?>
56 56
         </select>
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	 */
67 67
 	public static function add_html_attr( $class, $param, &$add_html ) {
68 68
 		if ( ! empty( $class ) ) {
69
-			$add_html[ $param ] = sanitize_title( $param ) . '="' . esc_attr( trim( sanitize_text_field( $class ) ) ) . '"';
69
+			$add_html[$param] = sanitize_title( $param ) . '="' . esc_attr( trim( sanitize_text_field( $class ) ) ) . '"';
70 70
 		}
71 71
 	}
72 72
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 		$args = array( 'id' => 0, 'form' => 0 );
78 78
 		if ( isset( $_GET['id'] ) && ! isset( $_GET['form'] ) ) {
79 79
 			unset( $args['form'] );
80
-		} else if ( isset( $_GET['form']) && ! isset( $_GET['id'] ) ) {
80
+		} else if ( isset( $_GET['form'] ) && ! isset( $_GET['id'] ) ) {
81 81
 			unset( $args['id'] );
82 82
         }
83 83
 
@@ -85,11 +85,11 @@  discard block
 block discarded – undo
85 85
 		if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) && in_array( $frm_action, array( 'edit', 'show', 'destroy_all' ) ) ) {
86 86
             $args['frm_action'] = 'list';
87 87
             $args['form'] = 0;
88
-		} else if ( FrmAppHelper::is_admin_page('formidable' ) && in_array( $frm_action, array( 'new', 'duplicate' ) ) ) {
88
+		} else if ( FrmAppHelper::is_admin_page( 'formidable' ) && in_array( $frm_action, array( 'new', 'duplicate' ) ) ) {
89 89
             $args['frm_action'] = 'edit';
90 90
 		} else if ( isset( $_GET['post'] ) ) {
91 91
             $args['form'] = 0;
92
-            $base = admin_url('edit.php?post_type=frm_display');
92
+            $base = admin_url( 'edit.php?post_type=frm_display' );
93 93
         }
94 94
 
95 95
         ?>
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 			        $args['form'] = $form->id;
106 106
 				}
107 107
                 ?>
108
-				<li><a href="<?php echo esc_url( isset( $base ) ? add_query_arg( $args, $base ) : add_query_arg( $args ) ); ?>" tabindex="-1"><?php echo esc_html( empty( $form->name ) ? __( '(no title)') : FrmAppHelper::truncate( $form->name, 33 ) ); ?></a></li>
108
+				<li><a href="<?php echo esc_url( isset( $base ) ? add_query_arg( $args, $base ) : add_query_arg( $args ) ); ?>" tabindex="-1"><?php echo esc_html( empty( $form->name ) ? __( '(no title)' ) : FrmAppHelper::truncate( $form->name, 33 ) ); ?></a></li>
109 109
 			<?php
110 110
 				unset( $form );
111 111
 			} ?>
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
     }
116 116
 
117 117
 	public static function get_sortable_classes( $col, $sort_col, $sort_dir ) {
118
-        echo ($sort_col == $col) ? 'sorted' : 'sortable';
119
-        echo ($sort_col == $col && $sort_dir == 'desc') ? ' asc' : ' desc';
118
+        echo ( $sort_col == $col ) ? 'sorted' : 'sortable';
119
+        echo ( $sort_col == $col && $sort_dir == 'desc' ) ? ' asc' : ' desc';
120 120
     }
121 121
 
122 122
 	public static function get_success_message( $atts ) {
@@ -135,37 +135,37 @@  discard block
 block discarded – undo
135 135
             $post_values = $values;
136 136
         } else {
137 137
             $values = array();
138
-            $post_values = isset($_POST) ? $_POST : array();
138
+            $post_values = isset( $_POST ) ? $_POST : array();
139 139
         }
140 140
 
141 141
 		foreach ( array( 'name' => '', 'description' => '' ) as $var => $default ) {
142
-			if ( ! isset( $values[ $var ] ) ) {
143
-				$values[ $var ] = FrmAppHelper::get_param( $var, $default );
142
+			if ( ! isset( $values[$var] ) ) {
143
+				$values[$var] = FrmAppHelper::get_param( $var, $default );
144 144
             }
145 145
         }
146 146
 
147
-        $values['description'] = FrmAppHelper::use_wpautop($values['description']);
147
+        $values['description'] = FrmAppHelper::use_wpautop( $values['description'] );
148 148
 
149 149
 		foreach ( array( 'form_id' => '', 'logged_in' => '', 'editable' => '', 'default_template' => 0, 'is_template' => 0, 'status' => 'draft', 'parent_form_id' => 0 ) as $var => $default ) {
150
-            if ( ! isset( $values[ $var ] ) ) {
151
-				$values[ $var ] = FrmAppHelper::get_param( $var, $default );
150
+            if ( ! isset( $values[$var] ) ) {
151
+				$values[$var] = FrmAppHelper::get_param( $var, $default );
152 152
             }
153 153
         }
154 154
 
155 155
         if ( ! isset( $values['form_key'] ) ) {
156
-            $values['form_key'] = ($post_values && isset($post_values['form_key'])) ? $post_values['form_key'] : FrmAppHelper::get_unique_key('', $wpdb->prefix .'frm_forms', 'form_key');
156
+            $values['form_key'] = ( $post_values && isset( $post_values['form_key'] ) ) ? $post_values['form_key'] : FrmAppHelper::get_unique_key( '', $wpdb->prefix . 'frm_forms', 'form_key' );
157 157
         }
158 158
 
159
-        $values = self::fill_default_opts($values, false, $post_values);
159
+        $values = self::fill_default_opts( $values, false, $post_values );
160 160
 
161
-        if ( $post_values && isset($post_values['options']['custom_style']) ) {
161
+        if ( $post_values && isset( $post_values['options']['custom_style'] ) ) {
162 162
             $values['custom_style'] = $post_values['options']['custom_style'];
163 163
         } else {
164 164
             $frm_settings = FrmAppHelper::get_settings();
165 165
             $values['custom_style'] = ( $frm_settings->load_style != 'none' );
166 166
         }
167 167
 
168
-        return apply_filters('frm_setup_new_form_vars', $values);
168
+        return apply_filters( 'frm_setup_new_form_vars', $values );
169 169
     }
170 170
 
171 171
     /**
@@ -176,42 +176,42 @@  discard block
 block discarded – undo
176 176
 			$post_values = stripslashes_deep( $_POST );
177 177
 		}
178 178
 
179
-        $values['form_key'] = isset($post_values['form_key']) ? $post_values['form_key'] : $record->form_key;
180
-        $values['default_template'] = isset($post_values['default_template']) ? $post_values['default_template'] : $record->default_template;
181
-        $values['is_template'] = isset($post_values['is_template']) ? $post_values['is_template'] : $record->is_template;
179
+        $values['form_key'] = isset( $post_values['form_key'] ) ? $post_values['form_key'] : $record->form_key;
180
+        $values['default_template'] = isset( $post_values['default_template'] ) ? $post_values['default_template'] : $record->default_template;
181
+        $values['is_template'] = isset( $post_values['is_template'] ) ? $post_values['is_template'] : $record->is_template;
182 182
         $values['status'] = $record->status;
183 183
 
184
-        $values = self::fill_default_opts($values, $record, $post_values);
184
+        $values = self::fill_default_opts( $values, $record, $post_values );
185 185
 
186
-        return apply_filters('frm_setup_edit_form_vars', $values);
186
+        return apply_filters( 'frm_setup_edit_form_vars', $values );
187 187
     }
188 188
 
189 189
 	public static function fill_default_opts( $values, $record, $post_values ) {
190 190
 
191 191
         $defaults = self::get_default_opts();
192 192
 		foreach ( $defaults as $var => $default ) {
193
-            if ( is_array($default) ) {
194
-                if ( ! isset( $values[ $var ] ) ) {
195
-					$values[ $var ] = ( $record && isset( $record->options[ $var ] ) ) ? $record->options[ $var ] : array();
193
+            if ( is_array( $default ) ) {
194
+                if ( ! isset( $values[$var] ) ) {
195
+					$values[$var] = ( $record && isset( $record->options[$var] ) ) ? $record->options[$var] : array();
196 196
                 }
197 197
 
198 198
                 foreach ( $default as $k => $v ) {
199
-					$values[ $var ][ $k ] = ( $post_values && isset( $post_values[ $var ][ $k ] ) ) ? $post_values[ $var ][ $k ] : ( ( $record && isset( $record->options[ $var ] ) && isset( $record->options[ $var ][ $k ] ) ) ? $record->options[ $var ][ $k ] : $v);
199
+					$values[$var][$k] = ( $post_values && isset( $post_values[$var][$k] ) ) ? $post_values[$var][$k] : ( ( $record && isset( $record->options[$var] ) && isset( $record->options[$var][$k] ) ) ? $record->options[$var][$k] : $v );
200 200
 
201 201
                     if ( is_array( $v ) ) {
202 202
                         foreach ( $v as $k1 => $v1 ) {
203
-							$values[ $var ][ $k ][ $k1 ] = ( $post_values && isset( $post_values[ $var ][ $k ][ $k1 ] ) ) ? $post_values[ $var ][ $k ][ $k1 ] : ( ( $record && isset( $record->options[ $var ] ) && isset( $record->options[ $var ][ $k ] ) && isset( $record->options[ $var ][ $k ][ $k1 ] ) ) ? $record->options[ $var ][ $k ][ $k1 ] : $v1 );
203
+							$values[$var][$k][$k1] = ( $post_values && isset( $post_values[$var][$k][$k1] ) ) ? $post_values[$var][$k][$k1] : ( ( $record && isset( $record->options[$var] ) && isset( $record->options[$var][$k] ) && isset( $record->options[$var][$k][$k1] ) ) ? $record->options[$var][$k][$k1] : $v1 );
204 204
                             unset( $k1, $v1 );
205 205
                         }
206 206
                     }
207 207
 
208
-                    unset($k, $v);
208
+                    unset( $k, $v );
209 209
                 }
210 210
             } else {
211
-				$values[ $var ] = ( $post_values && isset( $post_values['options'][ $var ] ) ) ? $post_values['options'][ $var ] : ( ( $record && isset( $record->options[ $var ] ) ) ? $record->options[ $var ] : $default );
211
+				$values[$var] = ( $post_values && isset( $post_values['options'][$var] ) ) ? $post_values['options'][$var] : ( ( $record && isset( $record->options[$var] ) ) ? $record->options[$var] : $default );
212 212
             }
213 213
 
214
-            unset($var, $default);
214
+            unset( $var, $default );
215 215
         }
216 216
 
217 217
         return $values;
@@ -224,9 +224,9 @@  discard block
 block discarded – undo
224 224
             'submit_value' => $frm_settings->submit_value, 'success_action' => 'message',
225 225
             'success_msg' => $frm_settings->success_msg, 'show_form' => 0, 'akismet' => '',
226 226
             'no_save' => 0, 'ajax_load' => 0, 'form_class' => '', 'custom_style' => 1,
227
-            'before_html' => self::get_default_html('before'),
227
+            'before_html' => self::get_default_html( 'before' ),
228 228
             'after_html' => '',
229
-            'submit_html' => self::get_default_html('submit'),
229
+            'submit_html' => self::get_default_html( 'submit' ),
230 230
         );
231 231
     }
232 232
 
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 	public static function fill_form_options( &$options, $values ) {
239 239
 		$defaults = self::get_default_opts();
240 240
 		foreach ( $defaults as $var => $default ) {
241
-			$options[ $var ] = isset( $values['options'][ $var ] ) ? $values['options'][ $var ] : $default;
241
+			$options[$var] = isset( $values['options'][$var] ) ? $values['options'][$var] : $default;
242 242
 			unset( $var, $default );
243 243
 		}
244 244
 	}
@@ -278,21 +278,21 @@  discard block
 block discarded – undo
278 278
     }
279 279
 
280 280
 	public static function get_custom_submit( $html, $form, $submit, $form_action, $values ) {
281
-        $button = self::replace_shortcodes($html, $form, $submit, $form_action, $values);
282
-        if ( ! strpos($button, '[button_action]') ) {
281
+        $button = self::replace_shortcodes( $html, $form, $submit, $form_action, $values );
282
+        if ( ! strpos( $button, '[button_action]' ) ) {
283 283
             return;
284 284
         }
285 285
 
286
-        $button_parts = explode('[button_action]', $button);
286
+        $button_parts = explode( '[button_action]', $button );
287 287
         echo $button_parts[0];
288 288
         //echo ' id="frm_submit_"';
289 289
 
290
-        $classes = apply_filters('frm_submit_button_class', array(), $form);
291
-        if ( ! empty($classes) ) {
290
+        $classes = apply_filters( 'frm_submit_button_class', array(), $form );
291
+        if ( ! empty( $classes ) ) {
292 292
 			echo ' class="' . esc_attr( implode( ' ', $classes ) ) . '"';
293 293
         }
294 294
 
295
-        do_action('frm_submit_button_action', $form, $form_action);
295
+        do_action( 'frm_submit_button_action', $form, $form_action );
296 296
         echo $button_parts[1];
297 297
     }
298 298
 
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 		$last_field = false;
314 314
         foreach ( $fields as $field ) {
315 315
 			if ( $prev_order === $field->field_order ) {
316
-				$add_order++;
316
+				$add_order ++;
317 317
 			}
318 318
 
319 319
 			if ( $add_order ) {
@@ -380,21 +380,21 @@  discard block
 block discarded – undo
380 380
             if ( $code == 'form_name' ) {
381 381
                 $replace_with = $form->name;
382 382
             } else if ( $code == 'form_description' ) {
383
-                $replace_with = FrmAppHelper::use_wpautop($form->description);
384
-            } else if ( $code == 'entry_key' && isset($_GET) && isset($_GET['entry']) ) {
383
+                $replace_with = FrmAppHelper::use_wpautop( $form->description );
384
+            } else if ( $code == 'entry_key' && isset( $_GET ) && isset( $_GET['entry'] ) ) {
385 385
                 $replace_with = FrmAppHelper::simple_get( 'entry' );
386 386
             } else {
387 387
                 $replace_with = '';
388 388
             }
389 389
 
390
-            FrmFieldsHelper::remove_inline_conditions( ( FrmAppHelper::is_true($show) && $replace_with != '' ), $code, $replace_with, $html );
390
+            FrmFieldsHelper::remove_inline_conditions( ( FrmAppHelper::is_true( $show ) && $replace_with != '' ), $code, $replace_with, $html );
391 391
         }
392 392
 
393 393
         //replace [form_key]
394
-        $html = str_replace('[form_key]', $form->form_key, $html);
394
+        $html = str_replace( '[form_key]', $form->form_key, $html );
395 395
 
396 396
         //replace [frmurl]
397
-        $html = str_replace('[frmurl]', FrmFieldsHelper::dynamic_default_values( 'frmurl' ), $html);
397
+        $html = str_replace( '[frmurl]', FrmFieldsHelper::dynamic_default_values( 'frmurl' ), $html );
398 398
 
399 399
 		if ( strpos( $html, '[button_label]' ) ) {
400 400
 			add_filter( 'frm_submit_button', 'FrmFormsHelper::submit_button_label', 1 );
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 			$html = str_replace( '[button_label]', $replace_with, $html );
403 403
         }
404 404
 
405
-        $html = apply_filters('frm_form_replace_shortcodes', $html, $form, $values);
405
+        $html = apply_filters( 'frm_form_replace_shortcodes', $html, $form, $values );
406 406
 
407 407
 		if ( strpos( $html, '[if back_button]' ) ) {
408 408
 			$html = preg_replace( '/(\[if\s+back_button\])(.*?)(\[\/if\s+back_button\])/mis', '', $html );
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
     }
421 421
 
422 422
 	public static function submit_button_label( $submit ) {
423
-        if ( ! $submit || empty($submit) ) {
423
+        if ( ! $submit || empty( $submit ) ) {
424 424
             $frm_settings = FrmAppHelper::get_settings();
425 425
             $submit = $frm_settings->submit_value;
426 426
         }
@@ -429,11 +429,11 @@  discard block
 block discarded – undo
429 429
     }
430 430
 
431 431
 	public static function get_form_style_class( $form = false ) {
432
-        $style = self::get_form_style($form);
432
+        $style = self::get_form_style( $form );
433 433
         $class = ' with_frm_style';
434 434
 
435
-        if ( empty($style) ) {
436
-            if ( FrmAppHelper::is_admin_page('formidable-entries') ) {
435
+        if ( empty( $style ) ) {
436
+            if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) ) {
437 437
                 return $class;
438 438
             } else {
439 439
                 return;
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
         }
442 442
 
443 443
         //If submit button needs to be inline or centered
444
-        if ( is_object($form) ) {
444
+        if ( is_object( $form ) ) {
445 445
 			$form = $form->options;
446 446
 		}
447 447
 
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 			$class .= ' frm_center_submit';
454 454
 		}
455 455
 
456
-        $class = apply_filters('frm_add_form_style_class', $class, $style);
456
+        $class = apply_filters( 'frm_add_form_style_class', $class, $style );
457 457
 
458 458
         return $class;
459 459
     }
@@ -541,12 +541,12 @@  discard block
 block discarded – undo
541 541
     }
542 542
 
543 543
 	public static function edit_form_link( $form_id ) {
544
-        if ( is_object($form_id) ) {
544
+        if ( is_object( $form_id ) ) {
545 545
             $form = $form_id;
546 546
             $name = $form->name;
547 547
             $form_id = $form->id;
548 548
         } else {
549
-            $name = FrmForm::getName($form_id);
549
+            $name = FrmForm::getName( $form_id );
550 550
         }
551 551
 
552 552
         if ( $form_id ) {
@@ -576,14 +576,14 @@  discard block
 block discarded – undo
576 576
         );
577 577
 
578 578
         $current_page = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : '';
579
-        $base_url = '?page=formidable&form_type='. $current_page .'&id='. $id;
579
+        $base_url = '?page=formidable&form_type=' . $current_page . '&id=' . $id;
580 580
         if ( 'trash' == $status ) {
581
-			$link = '<a href="'. esc_url( wp_nonce_url( $base_url . '&frm_action=untrash', 'untrash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['restore'][ $length ] . '</a>';
582
-        } else if ( current_user_can('frm_delete_forms') ) {
581
+			$link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=untrash', 'untrash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['restore'][$length] . '</a>';
582
+        } else if ( current_user_can( 'frm_delete_forms' ) ) {
583 583
             if ( EMPTY_TRASH_DAYS ) {
584
-				$link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=trash', 'trash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['trash'][ $length ] . '</a>';
584
+				$link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=trash', 'trash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['trash'][$length] . '</a>';
585 585
             } else {
586
-				$link = '<a href="' . esc_url( wp_nonce_url( $base_url .'&frm_action=destroy', 'destroy_form_' . $id ) ) . '" class="submitdelete deletion" onclick="return confirm(\'' . esc_attr( __( 'Are you sure you want to delete this form and all its entries?', 'formidable' ) ) . '\')">' . $labels['delete'][ $length ] . '</a>';
586
+				$link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=destroy', 'destroy_form_' . $id ) ) . '" class="submitdelete deletion" onclick="return confirm(\'' . esc_attr( __( 'Are you sure you want to delete this form and all its entries?', 'formidable' ) ) . '\')">' . $labels['delete'][$length] . '</a>';
587 587
             }
588 588
         }
589 589
 
@@ -597,11 +597,11 @@  discard block
 block discarded – undo
597 597
             'publish'   => __( 'Published', 'formidable' ),
598 598
         );
599 599
 
600
-        if ( ! in_array($status, array_keys($nice_names)) ) {
600
+        if ( ! in_array( $status, array_keys( $nice_names ) ) ) {
601 601
             $status = 'publish';
602 602
         }
603 603
 
604
-		$name = $nice_names[ $status ];
604
+		$name = $nice_names[$status];
605 605
 
606 606
         return $name;
607 607
     }
Please login to merge, or discard this patch.