Completed
Push — master ( fd7552...ca3d95 )
by Stephanie
02:56
created
classes/views/frm-forms/mb_html_tab.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 
6 6
     <ul class="frm_code_list">
7 7
     <?php
8
-    $col = 'one';
8
+	$col = 'one';
9 9
 	$entry_shortcodes = array(
10 10
 		'id'            => __( 'Field ID', 'formidable' ),
11 11
 		'key'           => __( 'Field Key', 'formidable' ),
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	);
31 31
 
32 32
 	foreach ( $entry_shortcodes as $skey => $sname ) {
33
-    ?>
33
+	?>
34 34
 	<li class="frm_col_<?php echo esc_attr( $col ) ?>">
35 35
 		<a href="javascript:void(0)" class="show_field_custom_html frmbutton button frm_insert_code <?php echo is_array( $sname ) ? 'frm_help' : ''; ?>" data-code="<?php echo esc_attr( $skey ) ?>" <?php echo is_array( $sname ) ? 'title="' . esc_attr( $sname['title'] ) . '"' : ''; ?>><?php echo esc_html( is_array( $sname ) ? $sname['label'] : $sname ); ?></a>
36 36
 	</li>
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 			'button_label' => __( 'Button Label', 'formidable' ),
64 64
 			'button_action' => __( 'Button Hook', 'formidable' ),
65 65
 		) as $skey => $sname ) {
66
-        ?>
66
+		?>
67 67
         <li class="frm_col_<?php echo esc_attr( $col ) ?>">
68 68
 			<a href="javascript:void(0)" class="show_submit_html frmbutton button frm_insert_code" data-code="<?php echo esc_attr( $skey ); ?>"><?php echo esc_html( $sname ); ?></a>
69 69
     	</li>
Please login to merge, or discard this patch.
classes/views/frm-form-actions/_action_inside.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
 	$event_labels = FrmFormAction::trigger_labels();
40 40
 	foreach ( $action_control->action_options['event'] as $event ) {
41 41
 	?>
42
-		<option value="<?php echo esc_attr( $event ) ?>" <?php echo in_array( $event, (array) $form_action->post_content['event'] ) ? ' selected="selected"' : ''; ?> ><?php echo esc_html( isset( $event_labels[ $event ] ) ? $event_labels[ $event ] : $event ); ?></option>
42
+		<option value="<?php echo esc_attr( $event ) ?>" <?php echo in_array( $event, (array) $form_action->post_content['event'] ) ? ' selected="selected"' : ''; ?> ><?php echo esc_html( isset( $event_labels[$event] ) ? $event_labels[$event] : $event ); ?></option>
43 43
 <?php } ?>
44 44
 		</select>
45 45
 	</p>
Please login to merge, or discard this patch.
classes/widgets/FrmShowForm.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 	}
9 9
 
10 10
 	public function widget( $args, $instance ) {
11
-        $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
11
+		$title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
12 12
 
13 13
 		echo FrmAppHelper::kses( $args['before_widget'], 'all' ); // WPCS: XSS ok.
14 14
 
Please login to merge, or discard this patch.
classes/helpers/FrmListHelper.php 3 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -204,8 +204,8 @@  discard block
 block discarded – undo
204 204
 			return $this->get_pagenum();
205 205
 		}
206 206
 
207
-		if ( isset( $this->_pagination_args[ $key ] ) ) {
208
-			return $this->_pagination_args[ $key ];
207
+		if ( isset( $this->_pagination_args[$key] ) ) {
208
+			return $this->_pagination_args[$key];
209 209
 		}
210 210
 	}
211 211
 
@@ -260,8 +260,8 @@  discard block
 block discarded – undo
260 260
 	}
261 261
 
262 262
 	private function hidden_search_inputs( $param_name ) {
263
-		if ( ! empty( $_REQUEST[ $param_name ] ) ) {
264
-			echo '<input type="hidden" name="' . esc_attr( $param_name ) . '" value="' . esc_attr( $_REQUEST[ $param_name ] ) . '" />';
263
+		if ( ! empty( $_REQUEST[$param_name] ) ) {
264
+			echo '<input type="hidden" name="' . esc_attr( $param_name ) . '" value="' . esc_attr( $_REQUEST[$param_name] ) . '" />';
265 265
 		}
266 266
 	}
267 267
 
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 
305 305
 		echo "<ul class='subsubsub'>\n";
306 306
 		foreach ( $views as $class => $view ) {
307
-			$views[ $class ] = "\t" . '<li class="' . esc_attr( $class ) . '">' . $view;
307
+			$views[$class] = "\t" . '<li class="' . esc_attr( $class ) . '">' . $view;
308 308
 		}
309 309
 		echo implode( " |</li>\n", $views ) . "</li>\n"; // WPCS: XSS ok.
310 310
 		echo '</ul>';
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 
430 430
 		$out = '<div class="' . ( $always_visible ? 'row-actions visible' : 'row-actions' ) . '">';
431 431
 		foreach ( $actions as $action => $link ) {
432
-			++$i;
432
+			++ $i;
433 433
 			( $i == $action_count ) ? $sep = '' : $sep = ' | ';
434 434
 			$out .= "<span class='$action'>$link$sep</span>";
435 435
 		}
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
 			'prev'  => __( 'Previous page' ),
643 643
 			'next'  => __( 'Next page' ),
644 644
 		);
645
-		return $labels[ $link ];
645
+		return $labels[$link];
646 646
 	}
647 647
 
648 648
 	private function current_url() {
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
 
731 731
 		// If the primary column doesn't exist fall back to the
732 732
 		// first non-checkbox column.
733
-		if ( ! isset( $columns[ $default ] ) ) {
733
+		if ( ! isset( $columns[$default] ) ) {
734 734
 			$default = FrmListHelper::get_default_primary_column_name();
735 735
 		}
736 736
 
@@ -744,7 +744,7 @@  discard block
 block discarded – undo
744 744
 		 */
745 745
 		$column  = apply_filters( 'list_table_primary_column', $default, $this->screen->id );
746 746
 
747
-		if ( empty( $column ) || ! isset( $columns[ $column ] ) ) {
747
+		if ( empty( $column ) || ! isset( $columns[$column] ) ) {
748 748
 			$column = $default;
749 749
 		}
750 750
 
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
 			// In 4.3, we added a fourth argument for primary column.
767 767
 			$column_headers = array( array(), array(), array(), $this->get_primary_column_name() );
768 768
 			foreach ( $this->_column_headers as $key => $value ) {
769
-				$column_headers[ $key ] = $value;
769
+				$column_headers[$key] = $value;
770 770
 			}
771 771
 
772 772
 			return $column_headers;
@@ -799,7 +799,7 @@  discard block
 block discarded – undo
799 799
 				$data[1] = false;
800 800
 			}
801 801
 
802
-			$sortable[ $id ] = $data;
802
+			$sortable[$id] = $data;
803 803
 		}
804 804
 
805 805
 		$primary = $this->get_primary_column_name();
@@ -854,7 +854,7 @@  discard block
 block discarded – undo
854 854
 			static $cb_counter = 1;
855 855
 			$columns['cb'] = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __( 'Select All' ) . '</label>'
856 856
 				. '<input id="cb-select-all-' . esc_attr( $cb_counter ) . '" type="checkbox" />';
857
-			$cb_counter++;
857
+			$cb_counter ++;
858 858
 		}
859 859
 
860 860
 		foreach ( $columns as $column_key => $column_display_name ) {
@@ -874,8 +874,8 @@  discard block
 block discarded – undo
874 874
 				$class[] = 'column-primary';
875 875
 			}
876 876
 
877
-			if ( isset( $sortable[ $column_key ] ) ) {
878
-				list( $orderby, $desc_first ) = $sortable[ $column_key ];
877
+			if ( isset( $sortable[$column_key] ) ) {
878
+				list( $orderby, $desc_first ) = $sortable[$column_key];
879 879
 
880 880
 				if ( $current_orderby == $orderby ) {
881 881
 					$order = 'asc' == $current_order ? 'desc' : 'asc';
Please login to merge, or discard this patch.
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -267,6 +267,9 @@  discard block
 block discarded – undo
267 267
 <?php
268 268
 	}
269 269
 
270
+	/**
271
+	 * @param string $param_name
272
+	 */
270 273
 	private function hidden_search_inputs( $param_name ) {
271 274
 		if ( ! empty( $_REQUEST[ $param_name ] ) ) {
272 275
 			echo '<input type="hidden" name="' . esc_attr( $param_name ) . '" value="' . esc_attr( $_REQUEST[ $param_name ] ) . '" />';
@@ -405,6 +408,9 @@  discard block
 block discarded – undo
405 408
 		return $action;
406 409
 	}
407 410
 
411
+	/**
412
+	 * @param string $action_name
413
+	 */
408 414
 	private static function get_bulk_action( $action_name ) {
409 415
 		$action = false;
410 416
 		$action_param = self::get_param(
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
 	protected $modes = array();
68 68
 
69 69
 	/**
70
-	*
71
-	* @var array
72
-	*/
73
-    protected $params;
70
+	 *
71
+	 * @var array
72
+	 */
73
+	protected $params;
74 74
 
75 75
 	/**
76 76
 	 * Stores the value returned by ->get_column_info()
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
 	protected $compat_methods = array( 'set_pagination_args', 'get_views', 'get_bulk_actions', 'bulk_actions', 'row_actions', 'view_switcher', 'get_items_per_page', 'pagination', 'get_sortable_columns', 'get_column_info', 'get_table_classes', 'display_tablenav', 'extra_tablenav', 'single_row_columns' );
85 85
 
86 86
 	/**
87
-	* Construct the table object
88
-	*/
87
+	 * Construct the table object
88
+	 */
89 89
 	public function __construct( $args ) {
90 90
 		$args = wp_parse_args(
91 91
 			$args,
Please login to merge, or discard this patch.
classes/views/frm-forms/add_field.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -79,17 +79,17 @@  discard block
 block discarded – undo
79 79
 				</a>
80 80
                 <input type="hidden" value="<?php echo esc_attr( $field['other'] ); ?>" id="other_input_<?php echo esc_attr( $field['id'] ); ?>" name="field_options[other_<?php echo esc_attr( $field['id'] ); ?>]">
81 81
             <?php
82
-            }
82
+			}
83 83
 
84 84
 			if ( ! isset( $field['post_field'] ) || $field['post_field'] != 'post_category' ) {
85
-            ?>
85
+			?>
86 86
 			<a href="<?php echo esc_url( admin_url( 'admin-ajax.php?action=frm_import_choices&field_id=' . $field['id'] . '&TB_iframe=1' ) ) ?>" title="<?php echo esc_attr( FrmAppHelper::truncate( strip_tags( str_replace( '"', '&quot;', $field['name'] ) ), 20 ) . ' ' . __( 'Field Choices', 'formidable' ) ); ?>" class="thickbox frm_orange">
87 87
 				<?php esc_html_e( 'Bulk Edit Options', 'formidable' ); ?>
88 88
 			</a>
89 89
             <?php } ?>
90 90
         </div>
91 91
 <?php
92
-    }
92
+	}
93 93
 ?>
94 94
     </div>
95 95
 <?php
@@ -132,22 +132,22 @@  discard block
 block discarded – undo
132 132
 						<?php esc_html_e( 'Required', 'formidable' ); ?>
133 133
 					</label>
134 134
                 <?php
135
-                }
135
+				}
136 136
 
137 137
 				if ( $display['unique'] ) {
138
-                    if ( ! isset( $field['unique'] ) ) {
139
-                        $field['unique'] = false;
140
-                    }
138
+					if ( ! isset( $field['unique'] ) ) {
139
+						$field['unique'] = false;
140
+					}
141 141
 					?>
142 142
                 <label for="frm_uniq_field_<?php echo esc_attr( $field['id'] ) ?>" class="frm_inline_label frm_help" title="<?php esc_attr_e( 'Unique: Do not allow the same response multiple times. For example, if one user enters \'Joe\', then no one else will be allowed to enter the same name.', 'formidable' ) ?>"><input type="checkbox" name="field_options[unique_<?php echo esc_attr( $field['id'] ) ?>]" id="frm_uniq_field_<?php echo esc_attr( $field['id'] ) ?>" value="1" <?php checked( $field['unique'], 1 ); ?> class="frm_mark_unique" />
143 143
 					<?php esc_html_e( 'Unique', 'formidable' ); ?>
144 144
 				</label>
145 145
                 <?php
146
-                }
146
+				}
147 147
 
148 148
 				if ( $display['read_only'] ) {
149
-                    if ( ! isset( $field['read_only'] ) ) {
150
-                        $field['read_only'] = false;
149
+					if ( ! isset( $field['read_only'] ) ) {
150
+						$field['read_only'] = false;
151 151
 					}
152 152
 					?>
153 153
 				<label for="frm_read_only_field_<?php echo esc_attr( $field['id'] ) ?>" class="frm_inline_label frm_help" title="<?php esc_attr_e( 'Read Only: Show this field but do not allow the field value to be edited from the front-end.', 'formidable' ) ?>" >
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 				<?php
158 158
 				}
159 159
 
160
-                do_action( 'frm_field_options_form_top', $field, $display, $values );
160
+				do_action( 'frm_field_options_form_top', $field, $display, $values );
161 161
 
162 162
 				if ( $display['required'] ) {
163 163
 				?>
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 						</td>
212 212
 					</tr>
213 213
 				<?php
214
-                }
214
+				}
215 215
 
216 216
 				// Field Size
217 217
 				if ( $display['size'] ) {
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 				do_action( 'frm_field_options_form', $field, $display, $values );
292 292
 
293 293
 				if ( $display['required'] || $display['invalid'] || $display['unique'] || $display['conf_field'] ) {
294
-                ?>
294
+				?>
295 295
 					<tr class="frm_validation_msg <?php echo ( $display['invalid'] || $field['required'] || FrmField::is_option_true( $field, 'unique' ) || FrmField::is_option_true( $field, 'conf_field' ) ) ? '' : 'frm_hidden'; ?>">
296 296
 					<td colspan="2">
297 297
                     <div class="menu-settings">
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
                             <input type="text" name="field_options[blank_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['blank'] ); ?>" />
306 306
                         </p>
307 307
                         <?php
308
-                        }
308
+						}
309 309
 
310 310
 						if ( $display['invalid'] ) {
311 311
 							$hidden = FrmField::is_field_type( $field, 'text' ) && ! FrmField::is_option_true( $field, 'format' );
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
                             <input type="text" name="field_options[unique_msg_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['unique_msg'] ); ?>" />
325 325
                         </p>
326 326
                         <?php
327
-                        }
327
+						}
328 328
 
329 329
 						if ( $display['conf_field'] ) {
330 330
 						?>
Please login to merge, or discard this patch.
classes/helpers/FrmXMLHelper.php 2 patches
Indentation   +379 added lines, -379 removed lines patch added patch discarded remove patch
@@ -33,24 +33,24 @@  discard block
 block discarded – undo
33 33
 			'styles'  => 0,
34 34
 		);
35 35
 
36
-        $imported = array(
37
-            'imported' => $defaults,
36
+		$imported = array(
37
+			'imported' => $defaults,
38 38
 			'updated'  => $defaults,
39 39
 			'forms'    => array(),
40 40
 			'terms'    => array(),
41
-        );
41
+		);
42 42
 
43 43
 		unset( $defaults );
44 44
 
45 45
 		if ( ! defined( 'WP_IMPORTING' ) ) {
46 46
 			define( 'WP_IMPORTING', true );
47
-        }
47
+		}
48 48
 
49 49
 		if ( ! class_exists( 'DOMDocument' ) ) {
50
-            return new WP_Error( 'SimpleXML_parse_error', __( 'Your server does not have XML enabled', 'formidable' ), libxml_get_errors() );
51
-        }
50
+			return new WP_Error( 'SimpleXML_parse_error', __( 'Your server does not have XML enabled', 'formidable' ), libxml_get_errors() );
51
+		}
52 52
 
53
-        $dom = new DOMDocument;
53
+		$dom = new DOMDocument;
54 54
 		$success = $dom->loadXML( file_get_contents( $file ) );
55 55
 		if ( ! $success ) {
56 56
 			return new WP_Error( 'SimpleXML_parse_error', __( 'There was an error when reading this XML file', 'formidable' ), libxml_get_errors() );
@@ -68,25 +68,25 @@  discard block
 block discarded – undo
68 68
 			return new WP_Error( 'SimpleXML_parse_error', __( 'There was an error when reading this XML file', 'formidable' ), libxml_get_errors() );
69 69
 		}
70 70
 
71
-        // add terms, forms (form and field ids), posts (post ids), and entries to db, in that order
71
+		// add terms, forms (form and field ids), posts (post ids), and entries to db, in that order
72 72
 		foreach ( array( 'term', 'form', 'view' ) as $item_type ) {
73
-            // grab cats, tags, and terms, or forms or posts
73
+			// grab cats, tags, and terms, or forms or posts
74 74
 			if ( isset( $xml->{$item_type} ) ) {
75 75
 				$function_name = 'import_xml_' . $item_type . 's';
76 76
 				$imported = self::$function_name( $xml->{$item_type}, $imported );
77 77
 				unset( $function_name, $xml->{$item_type} );
78
-            }
79
-        }
78
+			}
79
+		}
80 80
 
81 81
 		$return = apply_filters( 'frm_importing_xml', $imported, $xml );
82 82
 
83
-	    return $return;
84
-    }
83
+		return $return;
84
+	}
85 85
 
86 86
 	public static function import_xml_terms( $terms, $imported ) {
87
-        foreach ( $terms as $t ) {
87
+		foreach ( $terms as $t ) {
88 88
 			if ( term_exists( (string) $t->term_slug, (string) $t->term_taxonomy ) ) {
89
-			    continue;
89
+				continue;
90 90
 			}
91 91
 
92 92
 			$parent = self::get_term_parent_id( $t );
@@ -102,15 +102,15 @@  discard block
 block discarded – undo
102 102
 			);
103 103
 
104 104
 			if ( $term && is_array( $term ) ) {
105
-                $imported['imported']['terms']++;
105
+				$imported['imported']['terms']++;
106 106
 				$imported['terms'][ (int) $t->term_id ] = $term['term_id'];
107
-            }
107
+			}
108 108
 
109 109
 			unset( $term, $t );
110 110
 		}
111 111
 
112 112
 		return $imported;
113
-    }
113
+	}
114 114
 
115 115
 	/**
116 116
 	 * @since 2.0.8
@@ -135,11 +135,11 @@  discard block
 block discarded – undo
135 135
 		self::put_child_forms_first( $forms );
136 136
 
137 137
 		foreach ( $forms as $item ) {
138
-            $form = self::fill_form( $item );
138
+			$form = self::fill_form( $item );
139 139
 
140 140
 			self::update_custom_style_setting_on_import( $form );
141 141
 
142
-	        $this_form = self::maybe_get_form( $form );
142
+			$this_form = self::maybe_get_form( $form );
143 143
 
144 144
 			$old_id = false;
145 145
 			$form_fields = false;
@@ -151,25 +151,25 @@  discard block
 block discarded – undo
151 151
 				$form_fields = self::get_form_fields( $form_id );
152 152
 			} else {
153 153
 				$form_id = FrmForm::create( $form );
154
-		        if ( $form_id ) {
155
-		            $imported['imported']['forms']++;
156
-		            // Keep track of whether this specific form was updated or not
154
+				if ( $form_id ) {
155
+					$imported['imported']['forms']++;
156
+					// Keep track of whether this specific form was updated or not
157 157
 					$imported['form_status'][ $form_id ] = 'imported';
158 158
 					self::track_imported_child_forms( (int) $form_id, $form['parent_form_id'], $child_forms );
159
-		        }
159
+				}
160 160
 			}
161 161
 
162 162
 			self::import_xml_fields( $item->field, $form_id, $this_form, $form_fields, $imported );
163 163
 
164 164
 			self::delete_removed_fields( $form_fields );
165 165
 
166
-		    // Update field ids/keys to new ones
166
+			// Update field ids/keys to new ones
167 167
 			do_action( 'frm_after_duplicate_form', $form_id, $form, array( 'old_id' => $old_id ) );
168 168
 
169 169
 			$imported['forms'][ (int) $item->id ] = $form_id;
170 170
 
171
-            // Send pre 2.0 form options through function that creates actions
172
-            self::migrate_form_settings_to_actions( $form['options'], $form_id, $imported, true );
171
+			// Send pre 2.0 form options through function that creates actions
172
+			self::migrate_form_settings_to_actions( $form['options'], $form_id, $imported, true );
173 173
 
174 174
 			do_action( 'frm_after_import_form', $form_id, $form );
175 175
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 		self::maybe_update_child_form_parent_id( $imported['forms'], $child_forms );
180 180
 
181 181
 		return $imported;
182
-    }
182
+	}
183 183
 
184 184
 	private static function fill_form( $item ) {
185 185
 		$form = array(
@@ -250,11 +250,11 @@  discard block
 block discarded – undo
250 250
 	}
251 251
 
252 252
 	/**
253
-	* Put child forms first so they will be imported before parents
254
-	*
255
-	* @since 2.0.16
256
-	* @param array $forms
257
-	*/
253
+	 * Put child forms first so they will be imported before parents
254
+	 *
255
+	 * @since 2.0.16
256
+	 * @param array $forms
257
+	 */
258 258
 	private static function put_child_forms_first( &$forms ) {
259 259
 		$child_forms = array();
260 260
 		$regular_forms = array();
@@ -273,13 +273,13 @@  discard block
 block discarded – undo
273 273
 	}
274 274
 
275 275
 	/**
276
-	* Keep track of all imported child forms
277
-	*
278
-	* @since 2.0.16
279
-	* @param int $form_id
280
-	* @param int $parent_form_id
281
-	* @param array $child_forms
282
-	*/
276
+	 * Keep track of all imported child forms
277
+	 *
278
+	 * @since 2.0.16
279
+	 * @param int $form_id
280
+	 * @param int $parent_form_id
281
+	 * @param array $child_forms
282
+	 */
283 283
 	private static function track_imported_child_forms( $form_id, $parent_form_id, &$child_forms ) {
284 284
 		if ( $parent_form_id ) {
285 285
 			$child_forms[ $form_id ] = $parent_form_id;
@@ -287,13 +287,13 @@  discard block
 block discarded – undo
287 287
 	}
288 288
 
289 289
 	/**
290
-	* Update the parent_form_id on imported child forms
291
-	* Child forms are imported first so their parent_form_id will need to be updated after the parent is imported
292
-	*
293
-	* @since 2.0.6
294
-	* @param array $imported_forms
295
-	* @param array $child_forms
296
-	*/
290
+	 * Update the parent_form_id on imported child forms
291
+	 * Child forms are imported first so their parent_form_id will need to be updated after the parent is imported
292
+	 *
293
+	 * @since 2.0.6
294
+	 * @param array $imported_forms
295
+	 * @param array $child_forms
296
+	 */
297 297
 	private static function maybe_update_child_form_parent_id( $imported_forms, $child_forms ) {
298 298
 		foreach ( $child_forms as $child_form_id => $old_parent_form_id ) {
299 299
 
@@ -307,11 +307,11 @@  discard block
 block discarded – undo
307 307
 	}
308 308
 
309 309
 	/**
310
-	* Import all fields for a form
311
-	* @since 2.0.13
312
-	*
313
-	* TODO: Cut down on params
314
-	*/
310
+	 * Import all fields for a form
311
+	 * @since 2.0.13
312
+	 *
313
+	 * TODO: Cut down on params
314
+	 */
315 315
 	private static function import_xml_fields( $xml_fields, $form_id, $this_form, &$form_fields, &$imported ) {
316 316
 		$in_section = 0;
317 317
 
@@ -404,12 +404,12 @@  discard block
 block discarded – undo
404 404
 	}
405 405
 
406 406
 	/**
407
-	* Switch the form_select on a repeating field or embedded form if it needs to be switched
408
-	*
409
-	* @since 2.0.16
410
-	* @param array $f
411
-	* @param array $imported
412
-	*/
407
+	 * Switch the form_select on a repeating field or embedded form if it needs to be switched
408
+	 *
409
+	 * @since 2.0.16
410
+	 * @param array $f
411
+	 * @param array $imported
412
+	 */
413 413
 	private static function maybe_update_form_select( &$f, $imported ) {
414 414
 		if ( ! isset( $imported['forms'] ) ) {
415 415
 			return;
@@ -461,13 +461,13 @@  discard block
 block discarded – undo
461 461
 	}
462 462
 
463 463
 	/**
464
-	* Updates the custom style setting on import
465
-	* Convert the post slug to an ID
466
-	*
467
-	* @since 2.0.19
468
-	* @param array $form
469
-	*
470
-	*/
464
+	 * Updates the custom style setting on import
465
+	 * Convert the post slug to an ID
466
+	 *
467
+	 * @since 2.0.19
468
+	 * @param array $form
469
+	 *
470
+	 */
471 471
 	private static function update_custom_style_setting_on_import( &$form ) {
472 472
 		if ( ! isset( $form['options']['custom_style'] ) ) {
473 473
 			return;
@@ -521,16 +521,16 @@  discard block
 block discarded – undo
521 521
 	}
522 522
 
523 523
 	public static function import_xml_views( $views, $imported ) {
524
-        $imported['posts'] = array();
525
-        $form_action_type = FrmFormActionsController::$action_post_type;
524
+		$imported['posts'] = array();
525
+		$form_action_type = FrmFormActionsController::$action_post_type;
526 526
 
527
-        $post_types = array(
528
-            'frm_display' => 'views',
529
-            $form_action_type => 'actions',
530
-            'frm_styles'    => 'styles',
531
-        );
527
+		$post_types = array(
528
+			'frm_display' => 'views',
529
+			$form_action_type => 'actions',
530
+			'frm_styles'    => 'styles',
531
+		);
532 532
 
533
-        foreach ( $views as $item ) {
533
+		foreach ( $views as $item ) {
534 534
 			$post = array(
535 535
 				'post_title'    => (string) $item->title,
536 536
 				'post_name'     => (string) $item->post_name,
@@ -549,52 +549,52 @@  discard block
 block discarded – undo
549 549
 				'post_date'     => (string) $item->post_date,
550 550
 				'post_date_gmt' => (string) $item->post_date_gmt,
551 551
 				'ping_status'   => (string) $item->ping_status,
552
-                'postmeta'      => array(),
553
-                'tax_input'     => array(),
552
+				'postmeta'      => array(),
553
+				'tax_input'     => array(),
554 554
 			);
555 555
 
556
-            $old_id = $post['post_id'];
556
+			$old_id = $post['post_id'];
557 557
 			self::populate_post( $post, $item, $imported );
558 558
 
559 559
 			unset( $item );
560 560
 
561 561
 			$post_id = false;
562
-            if ( $post['post_type'] == $form_action_type ) {
563
-                $action_control = FrmFormActionsController::get_form_actions( $post['post_excerpt'] );
562
+			if ( $post['post_type'] == $form_action_type ) {
563
+				$action_control = FrmFormActionsController::get_form_actions( $post['post_excerpt'] );
564 564
 				if ( $action_control && is_object( $action_control ) ) {
565 565
 					$post_id = $action_control->maybe_create_action( $post, $imported['form_status'] );
566 566
 				}
567 567
 				unset( $action_control );
568
-            } else if ( $post['post_type'] == 'frm_styles' ) {
569
-                // Properly encode post content before inserting the post
570
-                $post['post_content'] = FrmAppHelper::maybe_json_decode( $post['post_content'] );
568
+			} else if ( $post['post_type'] == 'frm_styles' ) {
569
+				// Properly encode post content before inserting the post
570
+				$post['post_content'] = FrmAppHelper::maybe_json_decode( $post['post_content'] );
571 571
 				$custom_css = isset( $post['post_content']['custom_css'] ) ? $post['post_content']['custom_css'] : '';
572
-                $post['post_content'] = FrmAppHelper::prepare_and_encode( $post['post_content'] );
572
+				$post['post_content'] = FrmAppHelper::prepare_and_encode( $post['post_content'] );
573 573
 
574
-                // Create/update post now
575
-                $post_id = wp_insert_post( $post );
574
+				// Create/update post now
575
+				$post_id = wp_insert_post( $post );
576 576
 				self::maybe_update_custom_css( $custom_css );
577
-            } else {
578
-                // Create/update post now
579
-                $post_id = wp_insert_post( $post );
580
-            }
577
+			} else {
578
+				// Create/update post now
579
+				$post_id = wp_insert_post( $post );
580
+			}
581 581
 
582 582
 			if ( ! is_numeric( $post_id ) ) {
583
-                continue;
584
-            }
583
+				continue;
584
+			}
585 585
 
586 586
 			self::update_postmeta( $post, $post_id );
587 587
 
588
-            $this_type = 'posts';
588
+			$this_type = 'posts';
589 589
 			if ( isset( $post_types[ $post['post_type'] ] ) ) {
590 590
 				$this_type = $post_types[ $post['post_type'] ];
591
-            }
591
+			}
592 592
 
593 593
 			if ( isset( $post['ID'] ) && $post_id == $post['ID'] ) {
594
-                $imported['updated'][ $this_type ]++;
595
-            } else {
596
-                $imported['imported'][ $this_type ]++;
597
-            }
594
+				$imported['updated'][ $this_type ]++;
595
+			} else {
596
+				$imported['imported'][ $this_type ]++;
597
+			}
598 598
 
599 599
 			$imported['posts'][ (int) $old_id ] = $post_id;
600 600
 
@@ -606,16 +606,16 @@  discard block
 block discarded – undo
606 606
 		self::maybe_update_stylesheet( $imported );
607 607
 
608 608
 		return $imported;
609
-    }
609
+	}
610 610
 
611
-    private static function populate_post( &$post, $item, $imported ) {
611
+	private static function populate_post( &$post, $item, $imported ) {
612 612
 		if ( isset( $item->attachment_url ) ) {
613 613
 			$post['attachment_url'] = (string) $item->attachment_url;
614 614
 		}
615 615
 
616 616
 		if ( $post['post_type'] == FrmFormActionsController::$action_post_type && isset( $imported['forms'][ (int) $post['menu_order'] ] ) ) {
617
-		    // update to new form id
618
-		    $post['menu_order'] = $imported['forms'][ (int) $post['menu_order'] ];
617
+			// update to new form id
618
+			$post['menu_order'] = $imported['forms'][ (int) $post['menu_order'] ];
619 619
 		}
620 620
 
621 621
 		// Don't allow default styles to take over a site's default style
@@ -631,57 +631,57 @@  discard block
 block discarded – undo
631 631
 		self::populate_taxonomies( $post, $item );
632 632
 
633 633
 		self::maybe_editing_post( $post );
634
-    }
634
+	}
635 635
 
636
-    private static function populate_postmeta( &$post, $meta, $imported ) {
637
-        global $frm_duplicate_ids;
636
+	private static function populate_postmeta( &$post, $meta, $imported ) {
637
+		global $frm_duplicate_ids;
638 638
 
639
-	    $m = array(
639
+		$m = array(
640 640
 			'key'   => (string) $meta->meta_key,
641 641
 			'value' => (string) $meta->meta_value,
642 642
 		);
643 643
 
644 644
 		//switch old form and field ids to new ones
645 645
 		if ( $m['key'] == 'frm_form_id' && isset( $imported['forms'][ (int) $m['value'] ] ) ) {
646
-		    $m['value'] = $imported['forms'][ (int) $m['value'] ];
646
+			$m['value'] = $imported['forms'][ (int) $m['value'] ];
647 647
 		} else {
648
-		    $m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] );
648
+			$m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] );
649 649
 
650 650
 			if ( ! empty( $frm_duplicate_ids ) ) {
651 651
 
652
-		        if ( $m['key'] == 'frm_dyncontent' ) {
652
+				if ( $m['key'] == 'frm_dyncontent' ) {
653 653
 					$m['value'] = FrmFieldsHelper::switch_field_ids( $m['value'] );
654
-    		    } else if ( $m['key'] == 'frm_options' ) {
654
+				} else if ( $m['key'] == 'frm_options' ) {
655 655
 
656 656
 					foreach ( array( 'date_field_id', 'edate_field_id' ) as $setting_name ) {
657 657
 						if ( isset( $m['value'][ $setting_name ] ) && is_numeric( $m['value'][ $setting_name ] ) && isset( $frm_duplicate_ids[ $m['value'][ $setting_name ] ] ) ) {
658 658
 							$m['value'][ $setting_name ] = $frm_duplicate_ids[ $m['value'][ $setting_name ] ];
659
-    		            }
660
-    		        }
661
-
662
-                    $check_dup_array = array();
663
-    		        if ( isset( $m['value']['order_by'] ) && ! empty( $m['value']['order_by'] ) ) {
664
-    		            if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[ $m['value']['order_by'] ] ) ) {
665
-    		                $m['value']['order_by'] = $frm_duplicate_ids[ $m['value']['order_by'] ];
666
-    		            } else if ( is_array( $m['value']['order_by'] ) ) {
667
-                            $check_dup_array[] = 'order_by';
668
-    		            }
669
-    		        }
670
-
671
-    		        if ( isset( $m['value']['where'] ) && ! empty( $m['value']['where'] ) ) {
672
-    		            $check_dup_array[] = 'where';
673
-    		        }
674
-
675
-                    foreach ( $check_dup_array as $check_k ) {
659
+						}
660
+					}
661
+
662
+					$check_dup_array = array();
663
+					if ( isset( $m['value']['order_by'] ) && ! empty( $m['value']['order_by'] ) ) {
664
+						if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[ $m['value']['order_by'] ] ) ) {
665
+							$m['value']['order_by'] = $frm_duplicate_ids[ $m['value']['order_by'] ];
666
+						} else if ( is_array( $m['value']['order_by'] ) ) {
667
+							$check_dup_array[] = 'order_by';
668
+						}
669
+					}
670
+
671
+					if ( isset( $m['value']['where'] ) && ! empty( $m['value']['where'] ) ) {
672
+						$check_dup_array[] = 'where';
673
+					}
674
+
675
+					foreach ( $check_dup_array as $check_k ) {
676 676
 						foreach ( (array) $m['value'][ $check_k ] as $mk => $mv ) {
677 677
 							if ( isset( $frm_duplicate_ids[ $mv ] ) ) {
678 678
 								$m['value'][ $check_k ][ $mk ] = $frm_duplicate_ids[ $mv ];
679
-		                    }
679
+							}
680 680
 							unset( $mk, $mv );
681
-		                }
682
-                    }
683
-    		    }
684
-		    }
681
+						}
682
+					}
683
+				}
684
+			}
685 685
 		}
686 686
 
687 687
 		if ( ! is_array( $m['value'] ) ) {
@@ -689,31 +689,31 @@  discard block
 block discarded – undo
689 689
 		}
690 690
 
691 691
 		$post['postmeta'][ (string) $meta->meta_key ] = $m['value'];
692
-    }
693
-
694
-    /**
695
-     * Add terms to post
696
-     * @param array $post by reference
697
-     * @param object $item The XML object data
698
-     */
699
-    private static function populate_taxonomies( &$post, $item ) {
692
+	}
693
+
694
+	/**
695
+	 * Add terms to post
696
+	 * @param array $post by reference
697
+	 * @param object $item The XML object data
698
+	 */
699
+	private static function populate_taxonomies( &$post, $item ) {
700 700
 		foreach ( $item->category as $c ) {
701 701
 			$att = $c->attributes();
702 702
 			if ( ! isset( $att['nicename'] ) ) {
703
-                continue;
704
-            }
703
+				continue;
704
+			}
705 705
 
706
-		    $taxonomy = (string) $att['domain'];
706
+			$taxonomy = (string) $att['domain'];
707 707
 			if ( is_taxonomy_hierarchical( $taxonomy ) ) {
708
-		        $name = (string) $att['nicename'];
708
+				$name = (string) $att['nicename'];
709 709
 				$h_term = get_term_by( 'slug', $name, $taxonomy );
710
-		        if ( $h_term ) {
711
-		            $name = $h_term->term_id;
712
-		        }
710
+				if ( $h_term ) {
711
+					$name = $h_term->term_id;
712
+				}
713 713
 				unset( $h_term );
714
-		    } else {
715
-		        $name = (string) $c;
716
-		    }
714
+			} else {
715
+				$name = (string) $c;
716
+			}
717 717
 
718 718
 			if ( ! isset( $post['tax_input'][ $taxonomy ] ) ) {
719 719
 				$post['tax_input'][ $taxonomy ] = array();
@@ -722,21 +722,21 @@  discard block
 block discarded – undo
722 722
 			$post['tax_input'][ $taxonomy ][] = $name;
723 723
 			unset( $name );
724 724
 		}
725
-    }
725
+	}
726 726
 
727
-    /**
728
-     * Edit post if the key and created time match
729
-     */
730
-    private static function maybe_editing_post( &$post ) {
727
+	/**
728
+	 * Edit post if the key and created time match
729
+	 */
730
+	private static function maybe_editing_post( &$post ) {
731 731
 		$match_by = array(
732
-		    'post_type'     => $post['post_type'],
733
-		    'name'          => $post['post_name'],
734
-		    'post_status'   => $post['post_status'],
735
-		    'posts_per_page' => 1,
732
+			'post_type'     => $post['post_type'],
733
+			'name'          => $post['post_name'],
734
+			'post_status'   => $post['post_status'],
735
+			'posts_per_page' => 1,
736 736
 		);
737 737
 
738 738
 		if ( in_array( $post['post_status'], array( 'trash', 'draft' ) ) ) {
739
-		    $match_by['include'] = $post['post_id'];
739
+			$match_by['include'] = $post['post_id'];
740 740
 			unset( $match_by['name'] );
741 741
 		}
742 742
 
@@ -746,23 +746,23 @@  discard block
 block discarded – undo
746 746
 			// set the id of the post to edit
747 747
 			$post['ID'] = current( $editing )->ID;
748 748
 		}
749
-    }
749
+	}
750 750
 
751
-    private static function update_postmeta( &$post, $post_id ) {
752
-        foreach ( $post['postmeta'] as $k => $v ) {
753
-            if ( '_edit_last' == $k ) {
751
+	private static function update_postmeta( &$post, $post_id ) {
752
+		foreach ( $post['postmeta'] as $k => $v ) {
753
+			if ( '_edit_last' == $k ) {
754 754
 				$v = FrmAppHelper::get_user_id_param( $v );
755
-            } else if ( '_thumbnail_id' == $k && FrmAppHelper::pro_is_installed() ) {
756
-                //change the attachment ID
755
+			} else if ( '_thumbnail_id' == $k && FrmAppHelper::pro_is_installed() ) {
756
+				//change the attachment ID
757 757
 				$field_obj = FrmFieldFactory::get_field_type( 'file' );
758 758
 				$v = $field_obj->get_file_id( $v );
759
-            }
759
+			}
760 760
 
761 761
 			update_post_meta( $post_id, $k, $v );
762 762
 
763 763
 			unset( $k, $v );
764
-        }
765
-    }
764
+		}
765
+	}
766 766
 
767 767
 	/**
768 768
 	 * If a template includes custom css, let's include it.
@@ -795,32 +795,32 @@  discard block
 block discarded – undo
795 795
 		}
796 796
 	}
797 797
 
798
-    /**
799
-     * @param string $message
800
-     */
798
+	/**
799
+	 * @param string $message
800
+	 */
801 801
 	public static function parse_message( $result, &$message, &$errors ) {
802 802
 		if ( is_wp_error( $result ) ) {
803
-            $errors[] = $result->get_error_message();
804
-        } else if ( ! $result ) {
805
-            return;
806
-        }
803
+			$errors[] = $result->get_error_message();
804
+		} else if ( ! $result ) {
805
+			return;
806
+		}
807 807
 
808 808
 		if ( ! is_array( $result ) ) {
809
-            $message = is_string( $result ) ? $result : htmlentities( print_r( $result, 1 ) );
810
-            return;
811
-        }
809
+			$message = is_string( $result ) ? $result : htmlentities( print_r( $result, 1 ) );
810
+			return;
811
+		}
812 812
 
813
-        $t_strings = array(
814
-            'imported'  => __( 'Imported', 'formidable' ),
815
-            'updated'   => __( 'Updated', 'formidable' ),
816
-        );
813
+		$t_strings = array(
814
+			'imported'  => __( 'Imported', 'formidable' ),
815
+			'updated'   => __( 'Updated', 'formidable' ),
816
+		);
817 817
 
818
-        $message = '<ul>';
819
-        foreach ( $result as $type => $results ) {
818
+		$message = '<ul>';
819
+		foreach ( $result as $type => $results ) {
820 820
 			if ( ! isset( $t_strings[ $type ] ) ) {
821
-                // only print imported and updated
822
-                continue;
823
-            }
821
+				// only print imported and updated
822
+				continue;
823
+			}
824 824
 
825 825
 			$s_message = array();
826 826
 			foreach ( $results as $k => $m ) {
@@ -833,34 +833,34 @@  discard block
 block discarded – undo
833 833
 				$message .= implode( ', ', $s_message );
834 834
 				$message .= '</li>';
835 835
 			}
836
-        }
836
+		}
837 837
 
838
-        if ( $message == '<ul>' ) {
839
-            $message = '';
840
-            $errors[] = __( 'Nothing was imported or updated', 'formidable' );
841
-        } else {
842
-            $message .= '</ul>';
843
-        }
844
-    }
838
+		if ( $message == '<ul>' ) {
839
+			$message = '';
840
+			$errors[] = __( 'Nothing was imported or updated', 'formidable' );
841
+		} else {
842
+			$message .= '</ul>';
843
+		}
844
+	}
845 845
 
846 846
 	public static function item_count_message( $m, $type, &$s_message ) {
847
-        if ( ! $m ) {
848
-            return;
849
-        }
850
-
851
-        $strings = array(
852
-            'forms'     => sprintf( _n( '%1$s Form', '%1$s Forms', $m, 'formidable' ), $m ),
853
-            'fields'    => sprintf( _n( '%1$s Field', '%1$s Fields', $m, 'formidable' ), $m ),
854
-            'items'     => sprintf( _n( '%1$s Entry', '%1$s Entries', $m, 'formidable' ), $m ),
855
-            'views'     => sprintf( _n( '%1$s View', '%1$s Views', $m, 'formidable' ), $m ),
856
-            'posts'     => sprintf( _n( '%1$s Post', '%1$s Posts', $m, 'formidable' ), $m ),
857
-            'styles'     => sprintf( _n( '%1$s Style', '%1$s Styles', $m, 'formidable' ), $m ),
858
-            'terms'     => sprintf( _n( '%1$s Term', '%1$s Terms', $m, 'formidable' ), $m ),
859
-            'actions'   => sprintf( _n( '%1$s Form Action', '%1$s Form Actions', $m, 'formidable' ), $m ),
860
-        );
847
+		if ( ! $m ) {
848
+			return;
849
+		}
850
+
851
+		$strings = array(
852
+			'forms'     => sprintf( _n( '%1$s Form', '%1$s Forms', $m, 'formidable' ), $m ),
853
+			'fields'    => sprintf( _n( '%1$s Field', '%1$s Fields', $m, 'formidable' ), $m ),
854
+			'items'     => sprintf( _n( '%1$s Entry', '%1$s Entries', $m, 'formidable' ), $m ),
855
+			'views'     => sprintf( _n( '%1$s View', '%1$s Views', $m, 'formidable' ), $m ),
856
+			'posts'     => sprintf( _n( '%1$s Post', '%1$s Posts', $m, 'formidable' ), $m ),
857
+			'styles'     => sprintf( _n( '%1$s Style', '%1$s Styles', $m, 'formidable' ), $m ),
858
+			'terms'     => sprintf( _n( '%1$s Term', '%1$s Terms', $m, 'formidable' ), $m ),
859
+			'actions'   => sprintf( _n( '%1$s Form Action', '%1$s Form Actions', $m, 'formidable' ), $m ),
860
+		);
861 861
 
862 862
 		$s_message[] = isset( $strings[ $type ] ) ? $strings[ $type ] : ' ' . $m . ' ' . ucfirst( $type );
863
-    }
863
+	}
864 864
 
865 865
 	/**
866 866
 	 * Prepare the form options for export
@@ -899,8 +899,8 @@  discard block
 block discarded – undo
899 899
 		}
900 900
 
901 901
 		if ( is_numeric( $str ) ) {
902
-            return $str;
903
-        }
902
+			return $str;
903
+		}
904 904
 
905 905
 		self::remove_invalid_characters_from_xml( $str );
906 906
 
@@ -921,54 +921,54 @@  discard block
 block discarded – undo
921 921
 		$str = str_replace( '\x1F', '', $str );
922 922
 	}
923 923
 
924
-    public static function migrate_form_settings_to_actions( $form_options, $form_id, &$imported = array(), $switch = false ) {
925
-        // Get post type
926
-        $post_type = FrmFormActionsController::$action_post_type;
924
+	public static function migrate_form_settings_to_actions( $form_options, $form_id, &$imported = array(), $switch = false ) {
925
+		// Get post type
926
+		$post_type = FrmFormActionsController::$action_post_type;
927 927
 
928
-        // Set up imported index, if not set up yet
929
-        if ( ! isset( $imported['imported']['actions'] ) ) {
930
-            $imported['imported']['actions'] = 0;
931
-        }
928
+		// Set up imported index, if not set up yet
929
+		if ( ! isset( $imported['imported']['actions'] ) ) {
930
+			$imported['imported']['actions'] = 0;
931
+		}
932 932
 
933
-        // Migrate post settings to action
934
-        self::migrate_post_settings_to_action( $form_options, $form_id, $post_type, $imported, $switch );
933
+		// Migrate post settings to action
934
+		self::migrate_post_settings_to_action( $form_options, $form_id, $post_type, $imported, $switch );
935 935
 
936
-        // Migrate email settings to action
937
-        self::migrate_email_settings_to_action( $form_options, $form_id, $post_type, $imported, $switch );
938
-    }
936
+		// Migrate email settings to action
937
+		self::migrate_email_settings_to_action( $form_options, $form_id, $post_type, $imported, $switch );
938
+	}
939 939
 
940
-    /**
941
-    * Migrate post settings to form action
942
-    *
943
-    * @param string $post_type
944
-    */
945
-    private static function migrate_post_settings_to_action( $form_options, $form_id, $post_type, &$imported, $switch ) {
940
+	/**
941
+	 * Migrate post settings to form action
942
+	 *
943
+	 * @param string $post_type
944
+	 */
945
+	private static function migrate_post_settings_to_action( $form_options, $form_id, $post_type, &$imported, $switch ) {
946 946
 		if ( ! isset( $form_options['create_post'] ) || ! $form_options['create_post'] ) {
947
-            return;
948
-        }
947
+			return;
948
+		}
949 949
 
950
-        $new_action = array(
951
-            'post_type'     => $post_type,
952
-            'post_excerpt'  => 'wppost',
950
+		$new_action = array(
951
+			'post_type'     => $post_type,
952
+			'post_excerpt'  => 'wppost',
953 953
 			'post_title'    => __( 'Create Posts', 'formidable' ),
954
-            'menu_order'    => $form_id,
955
-            'post_status'   => 'publish',
956
-            'post_content'  => array(),
954
+			'menu_order'    => $form_id,
955
+			'post_status'   => 'publish',
956
+			'post_content'  => array(),
957 957
 			'post_name'     => $form_id . '_wppost_1',
958
-        );
958
+		);
959 959
 
960 960
 		$post_settings = array( 'post_type', 'post_category', 'post_content', 'post_excerpt', 'post_title', 'post_name', 'post_date', 'post_status', 'post_custom_fields', 'post_password' );
961 961
 
962
-        foreach ( $post_settings as $post_setting ) {
962
+		foreach ( $post_settings as $post_setting ) {
963 963
 			if ( isset( $form_options[ $post_setting ] ) ) {
964 964
 				$new_action['post_content'][ $post_setting ] = $form_options[ $post_setting ];
965
-            }
965
+			}
966 966
 			unset( $post_setting );
967
-        }
967
+		}
968 968
 
969 969
 		$new_action['event'] = array( 'create', 'update' );
970 970
 
971
-        if ( $switch ) {
971
+		if ( $switch ) {
972 972
 			// Fields with string or int saved
973 973
 			$basic_fields = array( 'post_title', 'post_content', 'post_excerpt', 'post_password', 'post_date', 'post_status' );
974 974
 
@@ -976,7 +976,7 @@  discard block
 block discarded – undo
976 976
 			$array_fields = array( 'post_category', 'post_custom_fields' );
977 977
 
978 978
 			$new_action['post_content'] = self::switch_action_field_ids( $new_action['post_content'], $basic_fields, $array_fields );
979
-        }
979
+		}
980 980
 		$new_action['post_content'] = json_encode( $new_action['post_content'] );
981 981
 
982 982
 		$exists = get_posts(
@@ -988,12 +988,12 @@  discard block
 block discarded – undo
988 988
 			)
989 989
 		);
990 990
 
991
-        if ( ! $exists ) {
991
+		if ( ! $exists ) {
992 992
 			// this isn't an email, but we need to use a class that will always be included
993 993
 			FrmDb::save_json_post( $new_action );
994
-            $imported['imported']['actions']++;
995
-        }
996
-    }
994
+			$imported['imported']['actions']++;
995
+		}
996
+	}
997 997
 
998 998
 	/**
999 999
 	 * Switch old field IDs for new field IDs in emails and post
@@ -1006,71 +1006,71 @@  discard block
 block discarded – undo
1006 1006
 	 * @return string $post_content - new field IDs
1007 1007
 	 */
1008 1008
 	private static function switch_action_field_ids( $post_content, $basic_fields, $array_fields = array() ) {
1009
-        global $frm_duplicate_ids;
1009
+		global $frm_duplicate_ids;
1010 1010
 
1011
-        // If there aren't IDs that were switched, end now
1012
-        if ( ! $frm_duplicate_ids ) {
1013
-            return;
1014
-        }
1011
+		// If there aren't IDs that were switched, end now
1012
+		if ( ! $frm_duplicate_ids ) {
1013
+			return;
1014
+		}
1015 1015
 
1016
-        // Get old IDs
1017
-        $old = array_keys( $frm_duplicate_ids );
1016
+		// Get old IDs
1017
+		$old = array_keys( $frm_duplicate_ids );
1018 1018
 
1019
-        // Get new IDs
1020
-        $new = array_values( $frm_duplicate_ids );
1019
+		// Get new IDs
1020
+		$new = array_values( $frm_duplicate_ids );
1021 1021
 
1022
-        // Do a str_replace with each item to set the new IDs
1023
-        foreach ( $post_content as $key => $setting ) {
1024
-            if ( ! is_array( $setting ) && in_array( $key, $basic_fields ) ) {
1025
-                // Replace old IDs with new IDs
1022
+		// Do a str_replace with each item to set the new IDs
1023
+		foreach ( $post_content as $key => $setting ) {
1024
+			if ( ! is_array( $setting ) && in_array( $key, $basic_fields ) ) {
1025
+				// Replace old IDs with new IDs
1026 1026
 				$post_content[ $key ] = str_replace( $old, $new, $setting );
1027
-            } else if ( is_array( $setting ) && in_array( $key, $array_fields ) ) {
1028
-                foreach ( $setting as $k => $val ) {
1029
-                    // Replace old IDs with new IDs
1027
+			} else if ( is_array( $setting ) && in_array( $key, $array_fields ) ) {
1028
+				foreach ( $setting as $k => $val ) {
1029
+					// Replace old IDs with new IDs
1030 1030
 					$post_content[ $key ][ $k ] = str_replace( $old, $new, $val );
1031
-                }
1032
-            }
1033
-            unset( $key, $setting );
1034
-        }
1035
-        return $post_content;
1036
-    }
1037
-
1038
-    private static function migrate_email_settings_to_action( $form_options, $form_id, $post_type, &$imported, $switch ) {
1039
-        // No old notifications or autoresponders to carry over
1031
+				}
1032
+			}
1033
+			unset( $key, $setting );
1034
+		}
1035
+		return $post_content;
1036
+	}
1037
+
1038
+	private static function migrate_email_settings_to_action( $form_options, $form_id, $post_type, &$imported, $switch ) {
1039
+		// No old notifications or autoresponders to carry over
1040 1040
 		if ( ! isset( $form_options['auto_responder'] ) && ! isset( $form_options['notification'] ) && ! isset( $form_options['email_to'] ) ) {
1041
-            return;
1042
-        }
1041
+			return;
1042
+		}
1043 1043
 
1044
-        // Initialize notifications array
1045
-        $notifications = array();
1044
+		// Initialize notifications array
1045
+		$notifications = array();
1046 1046
 
1047
-        // Migrate regular notifications
1048
-        self::migrate_notifications_to_action( $form_options, $form_id, $notifications );
1047
+		// Migrate regular notifications
1048
+		self::migrate_notifications_to_action( $form_options, $form_id, $notifications );
1049 1049
 
1050
-        // Migrate autoresponders
1051
-        self::migrate_autoresponder_to_action( $form_options, $form_id, $notifications );
1050
+		// Migrate autoresponders
1051
+		self::migrate_autoresponder_to_action( $form_options, $form_id, $notifications );
1052 1052
 
1053
-        if ( empty( $notifications ) ) {
1054
-            return;
1055
-        }
1053
+		if ( empty( $notifications ) ) {
1054
+			return;
1055
+		}
1056 1056
 
1057
-        foreach ( $notifications as $new_notification ) {
1058
-            $new_notification['post_type']      = $post_type;
1059
-            $new_notification['post_excerpt']   = 'email';
1057
+		foreach ( $notifications as $new_notification ) {
1058
+			$new_notification['post_type']      = $post_type;
1059
+			$new_notification['post_excerpt']   = 'email';
1060 1060
 			$new_notification['post_title']     = __( 'Email Notification', 'formidable' );
1061
-            $new_notification['menu_order']     = $form_id;
1062
-            $new_notification['post_status']    = 'publish';
1061
+			$new_notification['menu_order']     = $form_id;
1062
+			$new_notification['post_status']    = 'publish';
1063 1063
 
1064
-            // Switch field IDs and keys, if needed
1065
-            if ( $switch ) {
1064
+			// Switch field IDs and keys, if needed
1065
+			if ( $switch ) {
1066 1066
 
1067 1067
 				// Switch field IDs in email conditional logic
1068 1068
 				self::switch_email_contition_field_ids( $new_notification['post_content'] );
1069 1069
 
1070 1070
 				// Switch all other field IDs in email
1071
-                $new_notification['post_content'] = FrmFieldsHelper::switch_field_ids( $new_notification['post_content'] );
1072
-            }
1073
-            $new_notification['post_content']   = FrmAppHelper::prepare_and_encode( $new_notification['post_content'] );
1071
+				$new_notification['post_content'] = FrmFieldsHelper::switch_field_ids( $new_notification['post_content'] );
1072
+			}
1073
+			$new_notification['post_content']   = FrmAppHelper::prepare_and_encode( $new_notification['post_content'] );
1074 1074
 
1075 1075
 			$exists = get_posts(
1076 1076
 				array(
@@ -1083,13 +1083,13 @@  discard block
 block discarded – undo
1083 1083
 
1084 1084
 			if ( empty( $exists ) ) {
1085 1085
 				FrmDb::save_json_post( $new_notification );
1086
-                $imported['imported']['actions']++;
1087
-            }
1086
+				$imported['imported']['actions']++;
1087
+			}
1088 1088
 			unset( $new_notification );
1089
-        }
1089
+		}
1090 1090
 
1091 1091
 		self::remove_deprecated_notification_settings( $form_id, $form_options );
1092
-    }
1092
+	}
1093 1093
 
1094 1094
 	/**
1095 1095
 	 * Remove deprecated notification settings after migration
@@ -1109,17 +1109,17 @@  discard block
 block discarded – undo
1109 1109
 		FrmForm::update( $form_id, array( 'options' => $form_options ) );
1110 1110
 	}
1111 1111
 
1112
-    private static function migrate_notifications_to_action( $form_options, $form_id, &$notifications ) {
1113
-        if ( ! isset( $form_options['notification'] ) && isset( $form_options['email_to'] ) && ! empty( $form_options['email_to'] ) ) {
1114
-            // add old settings into notification array
1112
+	private static function migrate_notifications_to_action( $form_options, $form_id, &$notifications ) {
1113
+		if ( ! isset( $form_options['notification'] ) && isset( $form_options['email_to'] ) && ! empty( $form_options['email_to'] ) ) {
1114
+			// add old settings into notification array
1115 1115
 			$form_options['notification'] = array( 0 => $form_options );
1116
-        } else if ( isset( $form_options['notification']['email_to'] ) ) {
1117
-            // make sure it's in the correct format
1116
+		} else if ( isset( $form_options['notification']['email_to'] ) ) {
1117
+			// make sure it's in the correct format
1118 1118
 			$form_options['notification'] = array( 0 => $form_options['notification'] );
1119
-        }
1119
+		}
1120 1120
 
1121 1121
 		if ( isset( $form_options['notification'] ) && is_array( $form_options['notification'] ) ) {
1122
-            foreach ( $form_options['notification'] as $email_key => $notification ) {
1122
+			foreach ( $form_options['notification'] as $email_key => $notification ) {
1123 1123
 
1124 1124
 				$atts = array(
1125 1125
 					'email_to'  => '',
@@ -1130,119 +1130,119 @@  discard block
 block discarded – undo
1130 1130
 					'email_key' => $email_key,
1131 1131
 				);
1132 1132
 
1133
-                // Format the email data
1134
-                self::format_email_data( $atts, $notification );
1133
+				// Format the email data
1134
+				self::format_email_data( $atts, $notification );
1135 1135
 
1136 1136
 				if ( isset( $notification['twilio'] ) && $notification['twilio'] ) {
1137 1137
 					do_action( 'frm_create_twilio_action', $atts, $notification );
1138 1138
 				}
1139 1139
 
1140
-                // Setup the new notification
1141
-                $new_notification = array();
1142
-                self::setup_new_notification( $new_notification, $notification, $atts );
1140
+				// Setup the new notification
1141
+				$new_notification = array();
1142
+				self::setup_new_notification( $new_notification, $notification, $atts );
1143 1143
 
1144
-                $notifications[] = $new_notification;
1145
-            }
1146
-        }
1147
-    }
1144
+				$notifications[] = $new_notification;
1145
+			}
1146
+		}
1147
+	}
1148 1148
 
1149
-    private static function format_email_data( &$atts, $notification ) {
1150
-        // Format email_to
1151
-        self::format_email_to_data( $atts, $notification );
1149
+	private static function format_email_data( &$atts, $notification ) {
1150
+		// Format email_to
1151
+		self::format_email_to_data( $atts, $notification );
1152 1152
 
1153
-        // Format the reply to email and name
1153
+		// Format the reply to email and name
1154 1154
 		$reply_fields = array(
1155 1155
 			'reply_to'      => '',
1156 1156
 			'reply_to_name' => '',
1157 1157
 		);
1158
-        foreach ( $reply_fields as $f => $val ) {
1158
+		foreach ( $reply_fields as $f => $val ) {
1159 1159
 			if ( isset( $notification[ $f ] ) ) {
1160 1160
 				$atts[ $f ] = $notification[ $f ];
1161 1161
 				if ( 'custom' == $notification[ $f ] ) {
1162 1162
 					$atts[ $f ] = $notification[ 'cust_' . $f ];
1163 1163
 				} else if ( is_numeric( $atts[ $f ] ) && ! empty( $atts[ $f ] ) ) {
1164 1164
 					$atts[ $f ] = '[' . $atts[ $f ] . ']';
1165
-                }
1166
-            }
1167
-            unset( $f, $val );
1168
-        }
1165
+				}
1166
+			}
1167
+			unset( $f, $val );
1168
+		}
1169 1169
 
1170
-        // Format event
1170
+		// Format event
1171 1171
 		$atts['event'] = array( 'create' );
1172
-        if ( isset( $notification['update_email'] ) && 1 == $notification['update_email'] ) {
1173
-            $atts['event'][] = 'update';
1172
+		if ( isset( $notification['update_email'] ) && 1 == $notification['update_email'] ) {
1173
+			$atts['event'][] = 'update';
1174 1174
 		} elseif ( isset( $notification['update_email'] ) && 2 == $notification['update_email'] ) {
1175 1175
 			$atts['event'] = array( 'update' );
1176
-        }
1177
-    }
1176
+		}
1177
+	}
1178 1178
 
1179
-    private static function format_email_to_data( &$atts, $notification ) {
1180
-        if ( isset( $notification['email_to'] ) ) {
1179
+	private static function format_email_to_data( &$atts, $notification ) {
1180
+		if ( isset( $notification['email_to'] ) ) {
1181 1181
 			$atts['email_to'] = preg_split( '/ (,|;) /', $notification['email_to'] );
1182
-        } else {
1183
-            $atts['email_to'] = array();
1184
-        }
1182
+		} else {
1183
+			$atts['email_to'] = array();
1184
+		}
1185 1185
 
1186
-        if ( isset( $notification['also_email_to'] ) ) {
1187
-            $email_fields = (array) $notification['also_email_to'];
1188
-            $atts['email_to'] = array_merge( $email_fields, $atts['email_to'] );
1189
-            unset( $email_fields );
1190
-        }
1186
+		if ( isset( $notification['also_email_to'] ) ) {
1187
+			$email_fields = (array) $notification['also_email_to'];
1188
+			$atts['email_to'] = array_merge( $email_fields, $atts['email_to'] );
1189
+			unset( $email_fields );
1190
+		}
1191 1191
 
1192
-        foreach ( $atts['email_to'] as $key => $email_field ) {
1192
+		foreach ( $atts['email_to'] as $key => $email_field ) {
1193 1193
 
1194
-            if ( is_numeric( $email_field ) ) {
1194
+			if ( is_numeric( $email_field ) ) {
1195 1195
 				$atts['email_to'][ $key ] = '[' . $email_field . ']';
1196
-            }
1196
+			}
1197 1197
 
1198 1198
 			if ( strpos( $email_field, '|' ) ) {
1199
-                $email_opt = explode( '|', $email_field );
1200
-                if ( isset( $email_opt[0] ) ) {
1199
+				$email_opt = explode( '|', $email_field );
1200
+				if ( isset( $email_opt[0] ) ) {
1201 1201
 					$atts['email_to'][ $key ] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']';
1202
-                }
1203
-                unset( $email_opt );
1204
-            }
1205
-        }
1202
+				}
1203
+				unset( $email_opt );
1204
+			}
1205
+		}
1206 1206
 		$atts['email_to'] = implode( ', ', $atts['email_to'] );
1207
-    }
1208
-
1209
-    private static function setup_new_notification( &$new_notification, $notification, $atts ) {
1210
-        // Set up new notification
1211
-        $new_notification = array(
1212
-            'post_content'  => array(
1213
-                'email_to'      => $atts['email_to'],
1214
-                'event'         => $atts['event'],
1215
-            ),
1207
+	}
1208
+
1209
+	private static function setup_new_notification( &$new_notification, $notification, $atts ) {
1210
+		// Set up new notification
1211
+		$new_notification = array(
1212
+			'post_content'  => array(
1213
+				'email_to'      => $atts['email_to'],
1214
+				'event'         => $atts['event'],
1215
+			),
1216 1216
 			'post_name'         => $atts['form_id'] . '_email_' . $atts['email_key'],
1217
-        );
1217
+		);
1218 1218
 
1219
-        // Add more fields to the new notification
1220
-        $add_fields = array( 'email_message', 'email_subject', 'plain_text', 'inc_user_info', 'conditions' );
1221
-        foreach ( $add_fields as $add_field ) {
1219
+		// Add more fields to the new notification
1220
+		$add_fields = array( 'email_message', 'email_subject', 'plain_text', 'inc_user_info', 'conditions' );
1221
+		foreach ( $add_fields as $add_field ) {
1222 1222
 			if ( isset( $notification[ $add_field ] ) ) {
1223 1223
 				$new_notification['post_content'][ $add_field ] = $notification[ $add_field ];
1224
-            } else if ( in_array( $add_field, array( 'plain_text', 'inc_user_info' ) ) ) {
1224
+			} else if ( in_array( $add_field, array( 'plain_text', 'inc_user_info' ) ) ) {
1225 1225
 				$new_notification['post_content'][ $add_field ] = 0;
1226
-            } else {
1226
+			} else {
1227 1227
 				$new_notification['post_content'][ $add_field ] = '';
1228
-            }
1229
-            unset( $add_field );
1230
-        }
1228
+			}
1229
+			unset( $add_field );
1230
+		}
1231 1231
 
1232 1232
 		// Set reply to
1233 1233
 		$new_notification['post_content']['reply_to'] = $atts['reply_to'];
1234 1234
 
1235
-        // Set from
1235
+		// Set from
1236 1236
 		if ( ! empty( $atts['reply_to'] ) || ! empty( $atts['reply_to_name'] ) ) {
1237 1237
 			$new_notification['post_content']['from'] = ( empty( $atts['reply_to_name'] ) ? '[sitename]' : $atts['reply_to_name'] ) . ' <' . ( empty( $atts['reply_to'] ) ? '[admin_email]' : $atts['reply_to'] ) . '>';
1238
-        }
1239
-    }
1238
+		}
1239
+	}
1240 1240
 
1241 1241
 	/**
1242
-	* Switch field IDs in pre-2.0 email conditional logic
1243
-	*
1244
-	* @param $post_content array, pass by reference
1245
-	*/
1242
+	 * Switch field IDs in pre-2.0 email conditional logic
1243
+	 *
1244
+	 * @param $post_content array, pass by reference
1245
+	 */
1246 1246
 	private static function switch_email_contition_field_ids( &$post_content ) {
1247 1247
 		// Switch field IDs in conditional logic
1248 1248
 		if ( isset( $post_content['conditions'] ) && is_array( $post_content['conditions'] ) ) {
@@ -1255,7 +1255,7 @@  discard block
 block discarded – undo
1255 1255
 		}
1256 1256
 	}
1257 1257
 
1258
-    private static function migrate_autoresponder_to_action( $form_options, $form_id, &$notifications ) {
1258
+	private static function migrate_autoresponder_to_action( $form_options, $form_id, &$notifications ) {
1259 1259
 		if ( isset( $form_options['auto_responder'] ) && $form_options['auto_responder'] && isset( $form_options['ar_email_message'] ) && $form_options['ar_email_message'] ) {
1260 1260
 			// migrate autoresponder
1261 1261
 
@@ -1271,8 +1271,8 @@  discard block
 block discarded – undo
1271 1271
 				$email_field = '[' . $email_field . ']';
1272 1272
 			}
1273 1273
 
1274
-            $notification = $form_options;
1275
-            $new_notification2 = array(
1274
+			$notification = $form_options;
1275
+			$new_notification2 = array(
1276 1276
 				'post_content'  => array(
1277 1277
 					'email_message' => $notification['ar_email_message'],
1278 1278
 					'email_subject' => isset( $notification['ar_email_subject'] ) ? $notification['ar_email_subject'] : '',
@@ -1281,7 +1281,7 @@  discard block
 block discarded – undo
1281 1281
 					'inc_user_info' => 0,
1282 1282
 				),
1283 1283
 				'post_name'     => $form_id . '_email_' . count( $notifications ),
1284
-            );
1284
+			);
1285 1285
 
1286 1286
 			$reply_to = isset( $notification['ar_reply_to'] ) ? $notification['ar_reply_to'] : '';
1287 1287
 			$reply_to_name = isset( $notification['ar_reply_to_name'] ) ? $notification['ar_reply_to_name'] : '';
@@ -1294,9 +1294,9 @@  discard block
 block discarded – undo
1294 1294
 				$new_notification2['post_content']['from'] = ( empty( $reply_to_name ) ? '[sitename]' : $reply_to_name ) . ' <' . ( empty( $reply_to ) ? '[admin_email]' : $reply_to ) . '>';
1295 1295
 			}
1296 1296
 
1297
-            $notifications[] = $new_notification2;
1298
-            unset( $new_notification2 );
1299
-        }
1300
-    }
1297
+			$notifications[] = $new_notification2;
1298
+			unset( $new_notification2 );
1299
+		}
1300
+	}
1301 1301
 }
1302 1302
 
Please login to merge, or discard this patch.
Spacing   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
 			);
103 103
 
104 104
 			if ( $term && is_array( $term ) ) {
105
-                $imported['imported']['terms']++;
106
-				$imported['terms'][ (int) $t->term_id ] = $term['term_id'];
105
+                $imported['imported']['terms'] ++;
106
+				$imported['terms'][(int) $t->term_id] = $term['term_id'];
107 107
             }
108 108
 
109 109
 			unset( $term, $t );
@@ -152,9 +152,9 @@  discard block
 block discarded – undo
152 152
 			} else {
153 153
 				$form_id = FrmForm::create( $form );
154 154
 		        if ( $form_id ) {
155
-		            $imported['imported']['forms']++;
155
+		            $imported['imported']['forms'] ++;
156 156
 		            // Keep track of whether this specific form was updated or not
157
-					$imported['form_status'][ $form_id ] = 'imported';
157
+					$imported['form_status'][$form_id] = 'imported';
158 158
 					self::track_imported_child_forms( (int) $form_id, $form['parent_form_id'], $child_forms );
159 159
 		        }
160 160
 			}
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 		    // Update field ids/keys to new ones
167 167
 			do_action( 'frm_after_duplicate_form', $form_id, $form, array( 'old_id' => $old_id ) );
168 168
 
169
-			$imported['forms'][ (int) $item->id ] = $form_id;
169
+			$imported['forms'][(int) $item->id] = $form_id;
170 170
 
171 171
             // Send pre 2.0 form options through function that creates actions
172 172
             self::migrate_form_settings_to_actions( $form['options'], $form_id, $imported, true );
@@ -218,17 +218,17 @@  discard block
 block discarded – undo
218 218
 	private static function update_form( $this_form, $form, &$imported ) {
219 219
 		$form_id = $this_form->id;
220 220
 		FrmForm::update( $form_id, $form );
221
-		$imported['updated']['forms']++;
221
+		$imported['updated']['forms'] ++;
222 222
 		// Keep track of whether this specific form was updated or not
223
-		$imported['form_status'][ $form_id ] = 'updated';
223
+		$imported['form_status'][$form_id] = 'updated';
224 224
 	}
225 225
 
226 226
 	private static function get_form_fields( $form_id ) {
227 227
 		$form_fields = FrmField::get_all_for_form( $form_id, '', 'exclude', 'exclude' );
228 228
 		$old_fields = array();
229 229
 		foreach ( $form_fields as $f ) {
230
-			$old_fields[ $f->id ] = $f;
231
-			$old_fields[ $f->field_key ] = $f->id;
230
+			$old_fields[$f->id] = $f;
231
+			$old_fields[$f->field_key] = $f->id;
232 232
 			unset( $f );
233 233
 		}
234 234
 		$form_fields = $old_fields;
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 	*/
283 283
 	private static function track_imported_child_forms( $form_id, $parent_form_id, &$child_forms ) {
284 284
 		if ( $parent_form_id ) {
285
-			$child_forms[ $form_id ] = $parent_form_id;
285
+			$child_forms[$form_id] = $parent_form_id;
286 286
 		}
287 287
 	}
288 288
 
@@ -297,9 +297,9 @@  discard block
 block discarded – undo
297 297
 	private static function maybe_update_child_form_parent_id( $imported_forms, $child_forms ) {
298 298
 		foreach ( $child_forms as $child_form_id => $old_parent_form_id ) {
299 299
 
300
-			if ( isset( $imported_forms[ $old_parent_form_id ] ) && $imported_forms[ $old_parent_form_id ] != $old_parent_form_id ) {
300
+			if ( isset( $imported_forms[$old_parent_form_id] ) && $imported_forms[$old_parent_form_id] != $old_parent_form_id ) {
301 301
 				// Update all children with this old parent_form_id
302
-				$new_parent_form_id = (int) $imported_forms[ $old_parent_form_id ];
302
+				$new_parent_form_id = (int) $imported_forms[$old_parent_form_id];
303 303
 
304 304
 				FrmForm::update( $child_form_id, array( 'parent_form_id' => $new_parent_form_id ) );
305 305
 			}
@@ -333,25 +333,25 @@  discard block
 block discarded – undo
333 333
 
334 334
 			if ( ! empty( $this_form ) ) {
335 335
 				// check for field to edit by field id
336
-				if ( isset( $form_fields[ $f['id'] ] ) ) {
336
+				if ( isset( $form_fields[$f['id']] ) ) {
337 337
 					FrmField::update( $f['id'], $f );
338
-					$imported['updated']['fields']++;
338
+					$imported['updated']['fields'] ++;
339 339
 
340
-					unset( $form_fields[ $f['id'] ] );
340
+					unset( $form_fields[$f['id']] );
341 341
 
342 342
 					//unset old field key
343
-					if ( isset( $form_fields[ $f['field_key'] ] ) ) {
344
-						unset( $form_fields[ $f['field_key'] ] );
343
+					if ( isset( $form_fields[$f['field_key']] ) ) {
344
+						unset( $form_fields[$f['field_key']] );
345 345
 					}
346
-				} else if ( isset( $form_fields[ $f['field_key'] ] ) ) {
346
+				} else if ( isset( $form_fields[$f['field_key']] ) ) {
347 347
 					// check for field to edit by field key
348 348
 					unset( $f['id'] );
349 349
 
350
-					FrmField::update( $form_fields[ $f['field_key'] ], $f );
351
-					$imported['updated']['fields']++;
350
+					FrmField::update( $form_fields[$f['field_key']], $f );
351
+					$imported['updated']['fields'] ++;
352 352
 
353
-					unset( $form_fields[ $form_fields[ $f['field_key'] ] ] ); //unset old field id
354
-					unset( $form_fields[ $f['field_key'] ] ); //unset old field key
353
+					unset( $form_fields[$form_fields[$f['field_key']]] ); //unset old field id
354
+					unset( $form_fields[$f['field_key']] ); //unset old field key
355 355
 				} else {
356 356
 					// if no matching field id or key in this form, create the field
357 357
 					self::create_imported_field( $f, $imported );
@@ -418,8 +418,8 @@  discard block
 block discarded – undo
418 418
 		if ( $f['type'] == 'form' || ( $f['type'] == 'divider' && FrmField::is_option_true( $f['field_options'], 'repeat' ) ) ) {
419 419
 			if ( FrmField::is_option_true( $f['field_options'], 'form_select' ) ) {
420 420
 				$form_select = (int) $f['field_options']['form_select'];
421
-				if ( isset( $imported['forms'][ $form_select ] ) ) {
422
-					$f['field_options']['form_select'] = $imported['forms'][ $form_select ];
421
+				if ( isset( $imported['forms'][$form_select] ) ) {
422
+					$f['field_options']['form_select'] = $imported['forms'][$form_select];
423 423
 				}
424 424
 			}
425 425
 		}
@@ -439,8 +439,8 @@  discard block
 block discarded – undo
439 439
 
440 440
 		if ( FrmField::is_option_true_in_array( $f['field_options'], 'get_values_form' ) ) {
441 441
 			$old_form = $f['field_options']['get_values_form'];
442
-			if ( isset( $imported['forms'][ $old_form ] ) ) {
443
-				$f['field_options']['get_values_form'] = $imported['forms'][ $old_form ];
442
+			if ( isset( $imported['forms'][$old_form] ) ) {
443
+				$f['field_options']['get_values_form'] = $imported['forms'][$old_form];
444 444
 			}
445 445
 		}
446 446
 	}
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
 	private static function create_imported_field( $f, &$imported ) {
456 456
 		$new_id = FrmField::create( $f );
457 457
 		if ( $new_id != false ) {
458
-			$imported['imported']['fields']++;
458
+			$imported['imported']['fields'] ++;
459 459
 			do_action( 'frm_after_field_is_imported', $f, $new_id );
460 460
 		}
461 461
 	}
@@ -586,17 +586,17 @@  discard block
 block discarded – undo
586 586
 			self::update_postmeta( $post, $post_id );
587 587
 
588 588
             $this_type = 'posts';
589
-			if ( isset( $post_types[ $post['post_type'] ] ) ) {
590
-				$this_type = $post_types[ $post['post_type'] ];
589
+			if ( isset( $post_types[$post['post_type']] ) ) {
590
+				$this_type = $post_types[$post['post_type']];
591 591
             }
592 592
 
593 593
 			if ( isset( $post['ID'] ) && $post_id == $post['ID'] ) {
594
-                $imported['updated'][ $this_type ]++;
594
+                $imported['updated'][$this_type] ++;
595 595
             } else {
596
-                $imported['imported'][ $this_type ]++;
596
+                $imported['imported'][$this_type] ++;
597 597
             }
598 598
 
599
-			$imported['posts'][ (int) $old_id ] = $post_id;
599
+			$imported['posts'][(int) $old_id] = $post_id;
600 600
 
601 601
 			do_action( 'frm_after_import_view', $post_id, $post );
602 602
 
@@ -613,9 +613,9 @@  discard block
 block discarded – undo
613 613
 			$post['attachment_url'] = (string) $item->attachment_url;
614 614
 		}
615 615
 
616
-		if ( $post['post_type'] == FrmFormActionsController::$action_post_type && isset( $imported['forms'][ (int) $post['menu_order'] ] ) ) {
616
+		if ( $post['post_type'] == FrmFormActionsController::$action_post_type && isset( $imported['forms'][(int) $post['menu_order']] ) ) {
617 617
 		    // update to new form id
618
-		    $post['menu_order'] = $imported['forms'][ (int) $post['menu_order'] ];
618
+		    $post['menu_order'] = $imported['forms'][(int) $post['menu_order']];
619 619
 		}
620 620
 
621 621
 		// Don't allow default styles to take over a site's default style
@@ -642,8 +642,8 @@  discard block
 block discarded – undo
642 642
 		);
643 643
 
644 644
 		//switch old form and field ids to new ones
645
-		if ( $m['key'] == 'frm_form_id' && isset( $imported['forms'][ (int) $m['value'] ] ) ) {
646
-		    $m['value'] = $imported['forms'][ (int) $m['value'] ];
645
+		if ( $m['key'] == 'frm_form_id' && isset( $imported['forms'][(int) $m['value']] ) ) {
646
+		    $m['value'] = $imported['forms'][(int) $m['value']];
647 647
 		} else {
648 648
 		    $m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] );
649 649
 
@@ -654,15 +654,15 @@  discard block
 block discarded – undo
654 654
     		    } else if ( $m['key'] == 'frm_options' ) {
655 655
 
656 656
 					foreach ( array( 'date_field_id', 'edate_field_id' ) as $setting_name ) {
657
-						if ( isset( $m['value'][ $setting_name ] ) && is_numeric( $m['value'][ $setting_name ] ) && isset( $frm_duplicate_ids[ $m['value'][ $setting_name ] ] ) ) {
658
-							$m['value'][ $setting_name ] = $frm_duplicate_ids[ $m['value'][ $setting_name ] ];
657
+						if ( isset( $m['value'][$setting_name] ) && is_numeric( $m['value'][$setting_name] ) && isset( $frm_duplicate_ids[$m['value'][$setting_name]] ) ) {
658
+							$m['value'][$setting_name] = $frm_duplicate_ids[$m['value'][$setting_name]];
659 659
     		            }
660 660
     		        }
661 661
 
662 662
                     $check_dup_array = array();
663 663
     		        if ( isset( $m['value']['order_by'] ) && ! empty( $m['value']['order_by'] ) ) {
664
-    		            if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[ $m['value']['order_by'] ] ) ) {
665
-    		                $m['value']['order_by'] = $frm_duplicate_ids[ $m['value']['order_by'] ];
664
+    		            if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[$m['value']['order_by']] ) ) {
665
+    		                $m['value']['order_by'] = $frm_duplicate_ids[$m['value']['order_by']];
666 666
     		            } else if ( is_array( $m['value']['order_by'] ) ) {
667 667
                             $check_dup_array[] = 'order_by';
668 668
     		            }
@@ -673,9 +673,9 @@  discard block
 block discarded – undo
673 673
     		        }
674 674
 
675 675
                     foreach ( $check_dup_array as $check_k ) {
676
-						foreach ( (array) $m['value'][ $check_k ] as $mk => $mv ) {
677
-							if ( isset( $frm_duplicate_ids[ $mv ] ) ) {
678
-								$m['value'][ $check_k ][ $mk ] = $frm_duplicate_ids[ $mv ];
676
+						foreach ( (array) $m['value'][$check_k] as $mk => $mv ) {
677
+							if ( isset( $frm_duplicate_ids[$mv] ) ) {
678
+								$m['value'][$check_k][$mk] = $frm_duplicate_ids[$mv];
679 679
 		                    }
680 680
 							unset( $mk, $mv );
681 681
 		                }
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 			$m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] );
689 689
 		}
690 690
 
691
-		$post['postmeta'][ (string) $meta->meta_key ] = $m['value'];
691
+		$post['postmeta'][(string) $meta->meta_key] = $m['value'];
692 692
     }
693 693
 
694 694
     /**
@@ -715,11 +715,11 @@  discard block
 block discarded – undo
715 715
 		        $name = (string) $c;
716 716
 		    }
717 717
 
718
-			if ( ! isset( $post['tax_input'][ $taxonomy ] ) ) {
719
-				$post['tax_input'][ $taxonomy ] = array();
718
+			if ( ! isset( $post['tax_input'][$taxonomy] ) ) {
719
+				$post['tax_input'][$taxonomy] = array();
720 720
 			}
721 721
 
722
-			$post['tax_input'][ $taxonomy ][] = $name;
722
+			$post['tax_input'][$taxonomy][] = $name;
723 723
 			unset( $name );
724 724
 		}
725 725
     }
@@ -817,7 +817,7 @@  discard block
 block discarded – undo
817 817
 
818 818
         $message = '<ul>';
819 819
         foreach ( $result as $type => $results ) {
820
-			if ( ! isset( $t_strings[ $type ] ) ) {
820
+			if ( ! isset( $t_strings[$type] ) ) {
821 821
                 // only print imported and updated
822 822
                 continue;
823 823
             }
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
 			}
830 830
 
831 831
 			if ( ! empty( $s_message ) ) {
832
-				$message .= '<li><strong>' . $t_strings[ $type ] . ':</strong> ';
832
+				$message .= '<li><strong>' . $t_strings[$type] . ':</strong> ';
833 833
 				$message .= implode( ', ', $s_message );
834 834
 				$message .= '</li>';
835 835
 			}
@@ -859,7 +859,7 @@  discard block
 block discarded – undo
859 859
             'actions'   => sprintf( _n( '%1$s Form Action', '%1$s Form Actions', $m, 'formidable' ), $m ),
860 860
         );
861 861
 
862
-		$s_message[] = isset( $strings[ $type ] ) ? $strings[ $type ] : ' ' . $m . ' ' . ucfirst( $type );
862
+		$s_message[] = isset( $strings[$type] ) ? $strings[$type] : ' ' . $m . ' ' . ucfirst( $type );
863 863
     }
864 864
 
865 865
 	/**
@@ -960,8 +960,8 @@  discard block
 block discarded – undo
960 960
 		$post_settings = array( 'post_type', 'post_category', 'post_content', 'post_excerpt', 'post_title', 'post_name', 'post_date', 'post_status', 'post_custom_fields', 'post_password' );
961 961
 
962 962
         foreach ( $post_settings as $post_setting ) {
963
-			if ( isset( $form_options[ $post_setting ] ) ) {
964
-				$new_action['post_content'][ $post_setting ] = $form_options[ $post_setting ];
963
+			if ( isset( $form_options[$post_setting] ) ) {
964
+				$new_action['post_content'][$post_setting] = $form_options[$post_setting];
965 965
             }
966 966
 			unset( $post_setting );
967 967
         }
@@ -991,7 +991,7 @@  discard block
 block discarded – undo
991 991
         if ( ! $exists ) {
992 992
 			// this isn't an email, but we need to use a class that will always be included
993 993
 			FrmDb::save_json_post( $new_action );
994
-            $imported['imported']['actions']++;
994
+            $imported['imported']['actions'] ++;
995 995
         }
996 996
     }
997 997
 
@@ -1023,11 +1023,11 @@  discard block
 block discarded – undo
1023 1023
         foreach ( $post_content as $key => $setting ) {
1024 1024
             if ( ! is_array( $setting ) && in_array( $key, $basic_fields ) ) {
1025 1025
                 // Replace old IDs with new IDs
1026
-				$post_content[ $key ] = str_replace( $old, $new, $setting );
1026
+				$post_content[$key] = str_replace( $old, $new, $setting );
1027 1027
             } else if ( is_array( $setting ) && in_array( $key, $array_fields ) ) {
1028 1028
                 foreach ( $setting as $k => $val ) {
1029 1029
                     // Replace old IDs with new IDs
1030
-					$post_content[ $key ][ $k ] = str_replace( $old, $new, $val );
1030
+					$post_content[$key][$k] = str_replace( $old, $new, $val );
1031 1031
                 }
1032 1032
             }
1033 1033
             unset( $key, $setting );
@@ -1057,7 +1057,7 @@  discard block
 block discarded – undo
1057 1057
         foreach ( $notifications as $new_notification ) {
1058 1058
             $new_notification['post_type']      = $post_type;
1059 1059
             $new_notification['post_excerpt']   = 'email';
1060
-			$new_notification['post_title']     = __( 'Email Notification', 'formidable' );
1060
+			$new_notification['post_title'] = __( 'Email Notification', 'formidable' );
1061 1061
             $new_notification['menu_order']     = $form_id;
1062 1062
             $new_notification['post_status']    = 'publish';
1063 1063
 
@@ -1070,7 +1070,7 @@  discard block
 block discarded – undo
1070 1070
 				// Switch all other field IDs in email
1071 1071
                 $new_notification['post_content'] = FrmFieldsHelper::switch_field_ids( $new_notification['post_content'] );
1072 1072
             }
1073
-            $new_notification['post_content']   = FrmAppHelper::prepare_and_encode( $new_notification['post_content'] );
1073
+            $new_notification['post_content'] = FrmAppHelper::prepare_and_encode( $new_notification['post_content'] );
1074 1074
 
1075 1075
 			$exists = get_posts(
1076 1076
 				array(
@@ -1083,7 +1083,7 @@  discard block
 block discarded – undo
1083 1083
 
1084 1084
 			if ( empty( $exists ) ) {
1085 1085
 				FrmDb::save_json_post( $new_notification );
1086
-                $imported['imported']['actions']++;
1086
+                $imported['imported']['actions'] ++;
1087 1087
             }
1088 1088
 			unset( $new_notification );
1089 1089
         }
@@ -1102,8 +1102,8 @@  discard block
 block discarded – undo
1102 1102
 	private static function remove_deprecated_notification_settings( $form_id, $form_options ) {
1103 1103
 		$delete_settings = array( 'notification', 'autoresponder', 'email_to' );
1104 1104
 		foreach ( $delete_settings as $index ) {
1105
-			if ( isset( $form_options[ $index ] ) ) {
1106
-				unset( $form_options[ $index ] );
1105
+			if ( isset( $form_options[$index] ) ) {
1106
+				unset( $form_options[$index] );
1107 1107
 			}
1108 1108
 		}
1109 1109
 		FrmForm::update( $form_id, array( 'options' => $form_options ) );
@@ -1156,12 +1156,12 @@  discard block
 block discarded – undo
1156 1156
 			'reply_to_name' => '',
1157 1157
 		);
1158 1158
         foreach ( $reply_fields as $f => $val ) {
1159
-			if ( isset( $notification[ $f ] ) ) {
1160
-				$atts[ $f ] = $notification[ $f ];
1161
-				if ( 'custom' == $notification[ $f ] ) {
1162
-					$atts[ $f ] = $notification[ 'cust_' . $f ];
1163
-				} else if ( is_numeric( $atts[ $f ] ) && ! empty( $atts[ $f ] ) ) {
1164
-					$atts[ $f ] = '[' . $atts[ $f ] . ']';
1159
+			if ( isset( $notification[$f] ) ) {
1160
+				$atts[$f] = $notification[$f];
1161
+				if ( 'custom' == $notification[$f] ) {
1162
+					$atts[$f] = $notification['cust_' . $f];
1163
+				} else if ( is_numeric( $atts[$f] ) && ! empty( $atts[$f] ) ) {
1164
+					$atts[$f] = '[' . $atts[$f] . ']';
1165 1165
                 }
1166 1166
             }
1167 1167
             unset( $f, $val );
@@ -1192,13 +1192,13 @@  discard block
 block discarded – undo
1192 1192
         foreach ( $atts['email_to'] as $key => $email_field ) {
1193 1193
 
1194 1194
             if ( is_numeric( $email_field ) ) {
1195
-				$atts['email_to'][ $key ] = '[' . $email_field . ']';
1195
+				$atts['email_to'][$key] = '[' . $email_field . ']';
1196 1196
             }
1197 1197
 
1198 1198
 			if ( strpos( $email_field, '|' ) ) {
1199 1199
                 $email_opt = explode( '|', $email_field );
1200 1200
                 if ( isset( $email_opt[0] ) ) {
1201
-					$atts['email_to'][ $key ] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']';
1201
+					$atts['email_to'][$key] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']';
1202 1202
                 }
1203 1203
                 unset( $email_opt );
1204 1204
             }
@@ -1219,12 +1219,12 @@  discard block
 block discarded – undo
1219 1219
         // Add more fields to the new notification
1220 1220
         $add_fields = array( 'email_message', 'email_subject', 'plain_text', 'inc_user_info', 'conditions' );
1221 1221
         foreach ( $add_fields as $add_field ) {
1222
-			if ( isset( $notification[ $add_field ] ) ) {
1223
-				$new_notification['post_content'][ $add_field ] = $notification[ $add_field ];
1222
+			if ( isset( $notification[$add_field] ) ) {
1223
+				$new_notification['post_content'][$add_field] = $notification[$add_field];
1224 1224
             } else if ( in_array( $add_field, array( 'plain_text', 'inc_user_info' ) ) ) {
1225
-				$new_notification['post_content'][ $add_field ] = 0;
1225
+				$new_notification['post_content'][$add_field] = 0;
1226 1226
             } else {
1227
-				$new_notification['post_content'][ $add_field ] = '';
1227
+				$new_notification['post_content'][$add_field] = '';
1228 1228
             }
1229 1229
             unset( $add_field );
1230 1230
         }
@@ -1248,7 +1248,7 @@  discard block
 block discarded – undo
1248 1248
 		if ( isset( $post_content['conditions'] ) && is_array( $post_content['conditions'] ) ) {
1249 1249
 			foreach ( $post_content['conditions'] as $email_key => $val ) {
1250 1250
 				if ( is_numeric( $email_key ) ) {
1251
-					$post_content['conditions'][ $email_key ] = self::switch_action_field_ids( $val, array( 'hide_field' ) );
1251
+					$post_content['conditions'][$email_key] = self::switch_action_field_ids( $val, array( 'hide_field' ) );
1252 1252
 				}
1253 1253
 				unset( $email_key, $val );
1254 1254
 			}
Please login to merge, or discard this patch.
classes/helpers/FrmAppHelper.php 3 patches
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
      * @return string
226 226
      */
227 227
 	public static function get_server_value( $value ) {
228
-        return isset( $_SERVER[ $value ] ) ? wp_strip_all_tags( $_SERVER[ $value ] ) : '';
228
+        return isset( $_SERVER[$value] ) ? wp_strip_all_tags( $_SERVER[$value] ) : '';
229 229
     }
230 230
 
231 231
     /**
@@ -237,11 +237,11 @@  discard block
 block discarded – undo
237 237
     public static function get_ip_address() {
238 238
 		$ip = '';
239 239
 		foreach ( array( 'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR' ) as $key ) {
240
-            if ( ! isset( $_SERVER[ $key ] ) ) {
240
+            if ( ! isset( $_SERVER[$key] ) ) {
241 241
                 continue;
242 242
             }
243 243
 
244
-            foreach ( explode( ',', $_SERVER[ $key ] ) as $ip ) {
244
+            foreach ( explode( ',', $_SERVER[$key] ) as $ip ) {
245 245
 				$ip = trim( $ip ); // just to be safe
246 246
 
247 247
 				if ( filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE ) !== false ) {
@@ -260,9 +260,9 @@  discard block
 block discarded – undo
260 260
         }
261 261
 
262 262
 		if ( $src == 'get' ) {
263
-            $value = isset( $_POST[ $param ] ) ? stripslashes_deep( $_POST[ $param ] ) : ( isset( $_GET[ $param ] ) ? stripslashes_deep( $_GET[ $param ] ) : $default );
264
-            if ( ! isset( $_POST[ $param ] ) && isset( $_GET[ $param ] ) && ! is_array( $value ) ) {
265
-                $value = stripslashes_deep( htmlspecialchars_decode( $_GET[ $param ] ) );
263
+            $value = isset( $_POST[$param] ) ? stripslashes_deep( $_POST[$param] ) : ( isset( $_GET[$param] ) ? stripslashes_deep( $_GET[$param] ) : $default );
264
+            if ( ! isset( $_POST[$param] ) && isset( $_GET[$param] ) && ! is_array( $value ) ) {
265
+                $value = stripslashes_deep( htmlspecialchars_decode( $_GET[$param] ) );
266 266
             }
267 267
 			self::sanitize_value( $sanitize, $value );
268 268
 		} else {
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 				}
284 284
 
285 285
 				$p = trim( $p, ']' );
286
-				$value = isset( $value[ $p ] ) ? $value[ $p ] : $default;
286
+				$value = isset( $value[$p] ) ? $value[$p] : $default;
287 287
 			}
288 288
 		}
289 289
 
@@ -338,16 +338,16 @@  discard block
 block discarded – undo
338 338
 
339 339
 		$value = $args['default'];
340 340
 		if ( $args['type'] == 'get' ) {
341
-			if ( $_GET && isset( $_GET[ $args['param'] ] ) ) {
342
-				$value = $_GET[ $args['param'] ];
341
+			if ( $_GET && isset( $_GET[$args['param']] ) ) {
342
+				$value = $_GET[$args['param']];
343 343
 			}
344 344
 		} else if ( $args['type'] == 'post' ) {
345
-			if ( isset( $_POST[ $args['param'] ] ) ) {
346
-				$value = stripslashes_deep( maybe_unserialize( $_POST[ $args['param'] ] ) );
345
+			if ( isset( $_POST[$args['param']] ) ) {
346
+				$value = stripslashes_deep( maybe_unserialize( $_POST[$args['param']] ) );
347 347
 			}
348 348
 		} else {
349
-			if ( isset( $_REQUEST[ $args['param'] ] ) ) {
350
-				$value = $_REQUEST[ $args['param'] ];
349
+			if ( isset( $_REQUEST[$args['param']] ) ) {
350
+				$value = $_REQUEST[$args['param']];
351 351
 			}
352 352
 		}
353 353
 
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 			if ( is_array( $value ) ) {
376 376
 				$temp_values = $value;
377 377
 				foreach ( $temp_values as $k => $v ) {
378
-					FrmAppHelper::sanitize_value( $sanitize, $value[ $k ] );
378
+					FrmAppHelper::sanitize_value( $sanitize, $value[$k] );
379 379
 				}
380 380
 			} else {
381 381
 				$value = call_user_func( $sanitize, $value );
@@ -386,8 +386,8 @@  discard block
 block discarded – undo
386 386
     public static function sanitize_request( $sanitize_method, &$values ) {
387 387
         $temp_values = $values;
388 388
         foreach ( $temp_values as $k => $val ) {
389
-            if ( isset( $sanitize_method[ $k ] ) ) {
390
-				$values[ $k ] = call_user_func( $sanitize_method[ $k ], $val );
389
+            if ( isset( $sanitize_method[$k] ) ) {
390
+				$values[$k] = call_user_func( $sanitize_method[$k], $val );
391 391
             }
392 392
         }
393 393
     }
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 			$allowed_html = $html;
425 425
 		} elseif ( ! empty( $allowed ) ) {
426 426
 			foreach ( (array) $allowed as $a ) {
427
-				$allowed_html[ $a ] = isset( $html[ $a ] ) ? $html[ $a ] : array();
427
+				$allowed_html[$a] = isset( $html[$a] ) ? $html[$a] : array();
428 428
 			}
429 429
 		}
430 430
 
@@ -543,8 +543,8 @@  discard block
 block discarded – undo
543 543
         }
544 544
 
545 545
         global $wp_query;
546
-        if ( isset( $wp_query->query_vars[ $param ] ) ) {
547
-            $value = $wp_query->query_vars[ $param ];
546
+        if ( isset( $wp_query->query_vars[$param] ) ) {
547
+            $value = $wp_query->query_vars[$param];
548 548
         }
549 549
 
550 550
         return $value;
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
 		$query = array(
633 633
 			'post_type'   => 'page',
634 634
 			'post_status' => array( 'publish', 'private' ),
635
-			'numberposts' => -1,
635
+			'numberposts' => - 1,
636 636
 			'orderby'     => 'title',
637 637
 			'order'       => 'ASC',
638 638
 		);
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
             return $error;
802 802
         }
803 803
 
804
-        if ( $_REQUEST && ( ! isset( $_REQUEST[ $nonce_name ] ) || ! wp_verify_nonce( $_REQUEST[ $nonce_name ], $nonce ) ) ) {
804
+        if ( $_REQUEST && ( ! isset( $_REQUEST[$nonce_name] ) || ! wp_verify_nonce( $_REQUEST[$nonce_name], $nonce ) ) ) {
805 805
             $frm_settings = self::get_settings();
806 806
             $error = $frm_settings->admin_permission;
807 807
         }
@@ -836,7 +836,7 @@  discard block
 block discarded – undo
836 836
 			} else {
837 837
 				foreach ( $value as $k => $v ) {
838 838
 					if ( ! is_array( $v ) ) {
839
-						$value[ $k ] = call_user_func( $original_function, $v );
839
+						$value[$k] = call_user_func( $original_function, $v );
840 840
 					}
841 841
 				}
842 842
 			}
@@ -861,7 +861,7 @@  discard block
 block discarded – undo
861 861
 				$return = array_merge( $return, self::array_flatten( $value, $keys ) );
862 862
             } else {
863 863
 				if ( $keys == 'keep' ) {
864
-					$return[ $key ] = $value;
864
+					$return[$key] = $value;
865 865
 				} else {
866 866
 					$return[] = $value;
867 867
 				}
@@ -918,11 +918,11 @@  discard block
 block discarded – undo
918 918
 		}
919 919
 
920 920
 		$ver = $default;
921
-		if ( ! isset( $wp_scripts->registered[ $handle ] ) ) {
921
+		if ( ! isset( $wp_scripts->registered[$handle] ) ) {
922 922
 			return $ver;
923 923
 		}
924 924
 
925
-		$query = $wp_scripts->registered[ $handle ];
925
+		$query = $wp_scripts->registered[$handle];
926 926
 		if ( is_object( $query ) && ! empty( $query->ver ) ) {
927 927
 			$ver = $query->ver;
928 928
 		}
@@ -1015,7 +1015,7 @@  discard block
 block discarded – undo
1015 1015
 					),
1016 1016
 					$column
1017 1017
 				);
1018
-				$suffix++;
1018
+				$suffix ++;
1019 1019
 			} while ( $key_check || is_numeric( $key_check ) );
1020 1020
 			$key = $alt_post_name;
1021 1021
         }
@@ -1043,7 +1043,7 @@  discard block
 block discarded – undo
1043 1043
 
1044 1044
 		foreach ( array( 'name', 'description' ) as $var ) {
1045 1045
 			$default_val = isset( $record->{$var} ) ? $record->{$var} : '';
1046
-			$values[ $var ] = self::get_param( $var, $default_val, 'get', 'wp_kses_post' );
1046
+			$values[$var] = self::get_param( $var, $default_val, 'get', 'wp_kses_post' );
1047 1047
 			unset( $var, $default_val );
1048 1048
 		}
1049 1049
 
@@ -1098,8 +1098,8 @@  discard block
 block discarded – undo
1098 1098
             }
1099 1099
         }
1100 1100
 
1101
-		$field_type = isset( $post_values['field_options'][ 'type_' . $field->id ] ) ? $post_values['field_options'][ 'type_' . $field->id ] : $field->type;
1102
-        $new_value = isset( $post_values['item_meta'][ $field->id ] ) ? maybe_unserialize( $post_values['item_meta'][ $field->id ] ) : $meta_value;
1101
+		$field_type = isset( $post_values['field_options']['type_' . $field->id] ) ? $post_values['field_options']['type_' . $field->id] : $field->type;
1102
+        $new_value = isset( $post_values['item_meta'][$field->id] ) ? maybe_unserialize( $post_values['item_meta'][$field->id] ) : $meta_value;
1103 1103
 
1104 1104
 		$field_array = self::start_field_array( $field );
1105 1105
 		$field_array['value'] = $new_value;
@@ -1116,7 +1116,7 @@  discard block
 block discarded – undo
1116 1116
 
1117 1117
         $field_array = array_merge( $field->field_options, $field_array );
1118 1118
 
1119
-        $values['fields'][ $field->id ] = $field_array;
1119
+        $values['fields'][$field->id] = $field_array;
1120 1120
     }
1121 1121
 
1122 1122
 	/**
@@ -1161,7 +1161,7 @@  discard block
 block discarded – undo
1161 1161
 		}
1162 1162
 
1163 1163
         foreach ( $form->options as $opt => $value ) {
1164
-            $values[ $opt ] = isset( $post_values[ $opt ] ) ? maybe_unserialize( $post_values[ $opt ] ) : $value;
1164
+            $values[$opt] = isset( $post_values[$opt] ) ? maybe_unserialize( $post_values[$opt] ) : $value;
1165 1165
         }
1166 1166
 
1167 1167
 		self::fill_form_defaults( $post_values, $values );
@@ -1174,8 +1174,8 @@  discard block
 block discarded – undo
1174 1174
         $form_defaults = FrmFormsHelper::get_default_opts();
1175 1175
 
1176 1176
         foreach ( $form_defaults as $opt => $default ) {
1177
-            if ( ! isset( $values[ $opt ] ) || $values[ $opt ] == '' ) {
1178
-				$values[ $opt ] = ( $post_values && isset( $post_values['options'][ $opt ] ) ) ? $post_values['options'][ $opt ] : $default;
1177
+            if ( ! isset( $values[$opt] ) || $values[$opt] == '' ) {
1178
+				$values[$opt] = ( $post_values && isset( $post_values['options'][$opt] ) ) ? $post_values['options'][$opt] : $default;
1179 1179
             }
1180 1180
 
1181 1181
 			unset( $opt, $default );
@@ -1186,8 +1186,8 @@  discard block
 block discarded – undo
1186 1186
 		}
1187 1187
 
1188 1188
 		foreach ( array( 'before', 'after', 'submit' ) as $h ) {
1189
-			if ( ! isset( $values[ $h . '_html' ] ) ) {
1190
-				$values[ $h . '_html' ] = ( isset( $post_values['options'][ $h . '_html' ] ) ? $post_values['options'][ $h . '_html' ] : FrmFormsHelper::get_default_html( $h ) );
1189
+			if ( ! isset( $values[$h . '_html'] ) ) {
1190
+				$values[$h . '_html'] = ( isset( $post_values['options'][$h . '_html'] ) ? $post_values['options'][$h . '_html'] : FrmFormsHelper::get_default_html( $h ) );
1191 1191
             }
1192 1192
 			unset( $h );
1193 1193
         }
@@ -1345,10 +1345,10 @@  discard block
 block discarded – undo
1345 1345
 		$time_strings = self::get_time_strings();
1346 1346
 
1347 1347
 		foreach ( $time_strings as $k => $v ) {
1348
-			if ( $diff[ $k ] ) {
1349
-				$time_strings[ $k ] = $diff[ $k ] . ' ' . ( $diff[ $k ] > 1 ? $v[1] : $v[0] );
1348
+			if ( $diff[$k] ) {
1349
+				$time_strings[$k] = $diff[$k] . ' ' . ( $diff[$k] > 1 ? $v[1] : $v[0] );
1350 1350
 			} else {
1351
-				unset( $time_strings[ $k ] );
1351
+				unset( $time_strings[$k] );
1352 1352
 			}
1353 1353
 		}
1354 1354
 
@@ -1429,17 +1429,17 @@  discard block
 block discarded – undo
1429 1429
 
1430 1430
                     case 1:
1431 1431
                         $l2 = $name;
1432
-                        self::add_value_to_array( $name, $l2, $this_val, $vars[ $l1 ] );
1432
+                        self::add_value_to_array( $name, $l2, $this_val, $vars[$l1] );
1433 1433
 						break;
1434 1434
 
1435 1435
                     case 2:
1436 1436
                         $l3 = $name;
1437
-                        self::add_value_to_array( $name, $l3, $this_val, $vars[ $l1 ][ $l2 ] );
1437
+                        self::add_value_to_array( $name, $l3, $this_val, $vars[$l1][$l2] );
1438 1438
 						break;
1439 1439
 
1440 1440
                     case 3:
1441 1441
                         $l4 = $name;
1442
-                        self::add_value_to_array( $name, $l4, $this_val, $vars[ $l1 ][ $l2 ][ $l3 ] );
1442
+                        self::add_value_to_array( $name, $l4, $this_val, $vars[$l1][$l2][$l3] );
1443 1443
                 }
1444 1444
 
1445 1445
 				unset( $this_val, $n );
@@ -1458,8 +1458,8 @@  discard block
 block discarded – undo
1458 1458
     public static function add_value_to_array( $name, $l1, $val, &$vars ) {
1459 1459
         if ( $name == '' ) {
1460 1460
             $vars[] = $val;
1461
-        } else if ( ! isset( $vars[ $l1 ] ) ) {
1462
-            $vars[ $l1 ] = $val;
1461
+        } else if ( ! isset( $vars[$l1] ) ) {
1462
+            $vars[$l1] = $val;
1463 1463
         }
1464 1464
     }
1465 1465
 
@@ -1474,7 +1474,7 @@  discard block
 block discarded – undo
1474 1474
             '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() ) ),
1475 1475
         );
1476 1476
 
1477
-        if ( ! isset( $tooltips[ $name ] ) ) {
1477
+        if ( ! isset( $tooltips[$name] ) ) {
1478 1478
             return;
1479 1479
         }
1480 1480
 
@@ -1484,7 +1484,7 @@  discard block
 block discarded – undo
1484 1484
             echo ' class="frm_help"';
1485 1485
         }
1486 1486
 
1487
-		echo ' title="' . esc_attr( $tooltips[ $name ] );
1487
+		echo ' title="' . esc_attr( $tooltips[$name] );
1488 1488
 
1489 1489
         if ( 'open' != $class ) {
1490 1490
             echo '"';
@@ -1536,13 +1536,13 @@  discard block
 block discarded – undo
1536 1536
     }
1537 1537
 
1538 1538
 	private static function prepare_action_slashes( $val, $key, &$post_content ) {
1539
-		if ( ! isset( $post_content[ $key ] ) ) {
1539
+		if ( ! isset( $post_content[$key] ) ) {
1540 1540
 			return;
1541 1541
 		}
1542 1542
 
1543 1543
 		if ( is_array( $val ) ) {
1544 1544
 			foreach ( $val as $k1 => $v1 ) {
1545
-				self::prepare_action_slashes( $v1, $k1, $post_content[ $key ] );
1545
+				self::prepare_action_slashes( $v1, $k1, $post_content[$key] );
1546 1546
 				unset( $k1, $v1 );
1547 1547
 			}
1548 1548
 		} else {
@@ -1550,7 +1550,7 @@  discard block
 block discarded – undo
1550 1550
 			$val = stripslashes( $val );
1551 1551
 
1552 1552
 			// Add backslashes before double quotes and forward slashes only
1553
-			$post_content[ $key ] = addcslashes( $val, '"\\/' );
1553
+			$post_content[$key] = addcslashes( $val, '"\\/' );
1554 1554
 		}
1555 1555
 	}
1556 1556
 
Please login to merge, or discard this patch.
Doc Comments   +22 added lines patch added patch discarded remove patch
@@ -67,12 +67,16 @@  discard block
 block discarded – undo
67 67
 		return $url;
68 68
 	}
69 69
 
70
+	/**
71
+	 * @return string
72
+	 */
70 73
 	public static function get_affiliate() {
71 74
 		return absint( apply_filters( 'frm_affiliate_id', 0 ) );
72 75
 	}
73 76
 
74 77
 	/**
75 78
 	 * @since 3.04.02
79
+	 * @param string $medium
76 80
 	 */
77 81
 	public static function admin_upgrade_link( $medium, $page = '' ) {
78 82
 		if ( empty( $page ) ) {
@@ -104,6 +108,9 @@  discard block
 block discarded – undo
104 108
 		return $frm_settings;
105 109
 	}
106 110
 
111
+	/**
112
+	 * @return string
113
+	 */
107 114
 	public static function get_menu_name() {
108 115
 		$frm_settings = FrmAppHelper::get_settings();
109 116
 		return $frm_settings->menu;
@@ -820,6 +827,9 @@  discard block
 block discarded – undo
820 827
 		return ( is_array( $values ) && in_array( $current, $values ) ) || ( ! is_array( $values ) && $values == $current );
821 828
 	}
822 829
 
830
+	/**
831
+	 * @param string $function
832
+	 */
823 833
 	public static function recursive_function_map( $value, $function ) {
824 834
 		if ( is_array( $value ) ) {
825 835
 			$original_function = $function;
@@ -867,6 +877,9 @@  discard block
 block discarded – undo
867 877
         return $return;
868 878
     }
869 879
 
880
+	/**
881
+	 * @return string
882
+	 */
870 883
 	public static function esc_textarea( $text, $is_rich_text = false ) {
871 884
 		$safe_text = str_replace( '&quot;', '"', $text );
872 885
 		if ( ! $is_rich_text ) {
@@ -1059,6 +1072,9 @@  discard block
 block discarded – undo
1059 1072
         return $values;
1060 1073
     }
1061 1074
 
1075
+	/**
1076
+	 * @param string $fields
1077
+	 */
1062 1078
 	private static function prepare_field_arrays( $fields, $record, array &$values, $args ) {
1063 1079
 		if ( ! empty( $fields ) ) {
1064 1080
 			foreach ( (array) $fields as $field ) {
@@ -1261,6 +1277,9 @@  discard block
 block discarded – undo
1261 1277
 		return $sub . ( ( $len < $original_len ) ? $continue : '' );
1262 1278
     }
1263 1279
 
1280
+	/**
1281
+	 * @param string[] $function_names
1282
+	 */
1264 1283
 	public static function mb_function( $function_names, $args ) {
1265 1284
 		$mb_function_name = $function_names[0];
1266 1285
 		$function_name = $function_names[1];
@@ -1294,6 +1313,9 @@  discard block
 block discarded – undo
1294 1313
         return $formatted;
1295 1314
     }
1296 1315
 
1316
+	/**
1317
+	 * @param string $time_format
1318
+	 */
1297 1319
 	private static function add_time_to_date( $time_format, $date ) {
1298 1320
 		if ( empty( $time_format ) ) {
1299 1321
 			$time_format = get_option( 'time_format' );
Please login to merge, or discard this patch.
Indentation   +551 added lines, -551 removed lines patch added patch discarded remove patch
@@ -13,15 +13,15 @@  discard block
 block discarded – undo
13 13
 	 */
14 14
 	public static $plug_version = '3.04.03b';
15 15
 
16
-    /**
17
-     * @since 1.07.02
18
-     *
19
-     * @param none
20
-     * @return string The version of this plugin
21
-     */
22
-    public static function plugin_version() {
23
-        return self::$plug_version;
24
-    }
16
+	/**
17
+	 * @since 1.07.02
18
+	 *
19
+	 * @param none
20
+	 * @return string The version of this plugin
21
+	 */
22
+	public static function plugin_version() {
23
+		return self::$plug_version;
24
+	}
25 25
 
26 26
 	public static function plugin_folder() {
27 27
 		return basename( self::plugin_path() );
@@ -31,29 +31,29 @@  discard block
 block discarded – undo
31 31
 		return dirname( dirname( dirname( __FILE__ ) ) );
32 32
 	}
33 33
 
34
-    public static function plugin_url() {
35
-        //prevously FRM_URL constant
34
+	public static function plugin_url() {
35
+		//prevously FRM_URL constant
36 36
 		return plugins_url( '', self::plugin_path() . '/formidable.php' );
37
-    }
37
+	}
38 38
 
39 39
 	public static function relative_plugin_url() {
40 40
 		return str_replace( array( 'https:', 'http:' ), '', self::plugin_url() );
41 41
 	}
42 42
 
43
-    /**
44
-     * @return string Site URL
45
-     */
46
-    public static function site_url() {
47
-        return site_url();
48
-    }
49
-
50
-    /**
51
-     * Get the name of this site
52
-     * Used for [sitename] shortcode
53
-     *
54
-     * @since 2.0
55
-     * @return string
56
-     */
43
+	/**
44
+	 * @return string Site URL
45
+	 */
46
+	public static function site_url() {
47
+		return site_url();
48
+	}
49
+
50
+	/**
51
+	 * Get the name of this site
52
+	 * Used for [sitename] shortcode
53
+	 *
54
+	 * @since 2.0
55
+	 * @return string
56
+	 */
57 57
 	public static function site_name() {
58 58
 		return get_option( 'blogname' );
59 59
 	}
@@ -88,14 +88,14 @@  discard block
 block discarded – undo
88 88
 		return add_query_arg( $query_args, $page );
89 89
 	}
90 90
 
91
-    /**
92
-     * Get the Formidable settings
93
-     *
94
-     * @since 2.0
95
-     *
96
-     * @param None
97
-     * @return FrmSettings $frm_setings
98
-     */
91
+	/**
92
+	 * Get the Formidable settings
93
+	 *
94
+	 * @since 2.0
95
+	 *
96
+	 * @param None
97
+	 * @return FrmSettings $frm_setings
98
+	 */
99 99
 	public static function get_settings() {
100 100
 		global $frm_settings;
101 101
 		if ( empty( $frm_settings ) ) {
@@ -136,50 +136,50 @@  discard block
 block discarded – undo
136 136
 		return $is_formidable;
137 137
 	}
138 138
 
139
-    /**
140
-     * Check for certain page in Formidable settings
141
-     *
142
-     * @since 2.0
143
-     *
144
-     * @param string $page The name of the page to check
145
-     * @return boolean
146
-     */
139
+	/**
140
+	 * Check for certain page in Formidable settings
141
+	 *
142
+	 * @since 2.0
143
+	 *
144
+	 * @param string $page The name of the page to check
145
+	 * @return boolean
146
+	 */
147 147
 	public static function is_admin_page( $page = 'formidable' ) {
148
-        global $pagenow;
148
+		global $pagenow;
149 149
 		$get_page = self::simple_get( 'page', 'sanitize_title' );
150
-        if ( $pagenow ) {
150
+		if ( $pagenow ) {
151 151
 			// allow this to be true during ajax load i.e. ajax form builder loading
152 152
 			return ( $pagenow == 'admin.php' || $pagenow == 'admin-ajax.php' ) && $get_page == $page;
153
-        }
153
+		}
154 154
 
155 155
 		return is_admin() && $get_page == $page;
156
-    }
157
-
158
-    /**
159
-     * Check for the form preview page
160
-     *
161
-     * @since 2.0
162
-     *
163
-     * @param None
164
-     * @return boolean
165
-     */
166
-    public static function is_preview_page() {
167
-        global $pagenow;
156
+	}
157
+
158
+	/**
159
+	 * Check for the form preview page
160
+	 *
161
+	 * @since 2.0
162
+	 *
163
+	 * @param None
164
+	 * @return boolean
165
+	 */
166
+	public static function is_preview_page() {
167
+		global $pagenow;
168 168
 		$action = FrmAppHelper::simple_get( 'action', 'sanitize_title' );
169 169
 		return $pagenow && $pagenow == 'admin-ajax.php' && $action == 'frm_forms_preview';
170
-    }
171
-
172
-    /**
173
-     * Check for ajax except the form preview page
174
-     *
175
-     * @since 2.0
176
-     *
177
-     * @param None
178
-     * @return boolean
179
-     */
180
-    public static function doing_ajax() {
181
-        return self::wp_doing_ajax() && ! self::is_preview_page();
182
-    }
170
+	}
171
+
172
+	/**
173
+	 * Check for ajax except the form preview page
174
+	 *
175
+	 * @since 2.0
176
+	 *
177
+	 * @param None
178
+	 * @return boolean
179
+	 */
180
+	public static function doing_ajax() {
181
+		return self::wp_doing_ajax() && ! self::is_preview_page();
182
+	}
183 183
 
184 184
 	public static function js_suffix() {
185 185
 		return defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
@@ -206,81 +206,81 @@  discard block
 block discarded – undo
206 206
 		return isset( $frm_vars['prevent_caching'] ) && $frm_vars['prevent_caching'];
207 207
 	}
208 208
 
209
-    /**
210
-     * Check if on an admin page
211
-     *
212
-     * @since 2.0
213
-     *
214
-     * @param None
215
-     * @return boolean
216
-     */
217
-    public static function is_admin() {
218
-        return is_admin() && ! self::wp_doing_ajax();
219
-    }
220
-
221
-    /**
222
-     * Check if value contains blank value or empty array
223
-     *
224
-     * @since 2.0
225
-     * @param mixed $value - value to check
209
+	/**
210
+	 * Check if on an admin page
211
+	 *
212
+	 * @since 2.0
213
+	 *
214
+	 * @param None
215
+	 * @return boolean
216
+	 */
217
+	public static function is_admin() {
218
+		return is_admin() && ! self::wp_doing_ajax();
219
+	}
220
+
221
+	/**
222
+	 * Check if value contains blank value or empty array
223
+	 *
224
+	 * @since 2.0
225
+	 * @param mixed $value - value to check
226 226
 	 * @param string
227
-     * @return boolean
228
-     */
229
-    public static function is_empty_value( $value, $empty = '' ) {
230
-        return ( is_array( $value ) && empty( $value ) ) || $value === $empty;
231
-    }
232
-
233
-    public static function is_not_empty_value( $value, $empty = '' ) {
234
-        return ! self::is_empty_value( $value, $empty );
235
-    }
236
-
237
-    /**
238
-     * Get any value from the $_SERVER
239
-     *
240
-     * @since 2.0
241
-     * @param string $value
242
-     * @return string
243
-     */
227
+	 * @return boolean
228
+	 */
229
+	public static function is_empty_value( $value, $empty = '' ) {
230
+		return ( is_array( $value ) && empty( $value ) ) || $value === $empty;
231
+	}
232
+
233
+	public static function is_not_empty_value( $value, $empty = '' ) {
234
+		return ! self::is_empty_value( $value, $empty );
235
+	}
236
+
237
+	/**
238
+	 * Get any value from the $_SERVER
239
+	 *
240
+	 * @since 2.0
241
+	 * @param string $value
242
+	 * @return string
243
+	 */
244 244
 	public static function get_server_value( $value ) {
245
-        return isset( $_SERVER[ $value ] ) ? wp_strip_all_tags( $_SERVER[ $value ] ) : '';
246
-    }
247
-
248
-    /**
249
-     * Check for the IP address in several places
250
-     * Used by [ip] shortcode
251
-     *
252
-     * @return string The IP address of the current user
253
-     */
254
-    public static function get_ip_address() {
245
+		return isset( $_SERVER[ $value ] ) ? wp_strip_all_tags( $_SERVER[ $value ] ) : '';
246
+	}
247
+
248
+	/**
249
+	 * Check for the IP address in several places
250
+	 * Used by [ip] shortcode
251
+	 *
252
+	 * @return string The IP address of the current user
253
+	 */
254
+	public static function get_ip_address() {
255 255
 		$ip = '';
256 256
 		foreach ( array( 'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR' ) as $key ) {
257
-            if ( ! isset( $_SERVER[ $key ] ) ) {
258
-                continue;
259
-            }
257
+			if ( ! isset( $_SERVER[ $key ] ) ) {
258
+				continue;
259
+			}
260 260
 
261
-            foreach ( explode( ',', $_SERVER[ $key ] ) as $ip ) {
261
+			foreach ( explode( ',', $_SERVER[ $key ] ) as $ip ) {
262 262
 				$ip = trim( $ip ); // just to be safe
263 263
 
264 264
 				if ( filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE ) !== false ) {
265
-                    return sanitize_text_field( $ip );
266
-                }
267
-            }
268
-        }
265
+					return sanitize_text_field( $ip );
266
+				}
267
+			}
268
+		}
269 269
 
270 270
 		return sanitize_text_field( $ip );
271
-    }
271
+	}
272 272
 
273
-    public static function get_param( $param, $default = '', $src = 'get', $sanitize = '' ) {
273
+	public static function get_param( $param, $default = '', $src = 'get', $sanitize = '' ) {
274 274
 		if ( strpos( $param, '[' ) ) {
275 275
 			$params = explode( '[', $param );
276
-            $param = $params[0];
277
-        }
276
+			$param = $params[0];
277
+		}
278 278
 
279 279
 		if ( $src == 'get' ) {
280
-            $value = isset( $_POST[ $param ] ) ? stripslashes_deep( $_POST[ $param ] ) : ( isset( $_GET[ $param ] ) ? stripslashes_deep( $_GET[ $param ] ) : $default );
281
-            if ( ! isset( $_POST[ $param ] ) && isset( $_GET[ $param ] ) && ! is_array( $value ) ) {
282
-                $value = stripslashes_deep( htmlspecialchars_decode( $_GET[ $param ] ) );
283
-            }
280
+			$value = isset( $_POST[ $param ] ) ? stripslashes_deep( $_POST[ $param ] ) : ( isset( $_GET[ $param ] ) ? stripslashes_deep( $_GET[ $param ] ) : $default );
281
+			if ( ! isset( $_POST[ $param ] ) && isset( $_GET[ $param ] ) && ! is_array( $value ) ) {
282
+				$value = stripslashes_deep( htmlspecialchars_decode( $_GET[ $param ] ) );
283
+			}
284 284
 			self::sanitize_value( $sanitize, $value );
285 285
 		} else {
286 286
 			$value = self::get_simple_request(
@@ -304,8 +304,8 @@  discard block
 block discarded – undo
304 304
 			}
305 305
 		}
306 306
 
307
-        return $value;
308
-    }
307
+		return $value;
308
+	}
309 309
 
310 310
 	public static function get_post_param( $param, $default = '', $sanitize = '' ) {
311 311
 		return self::get_simple_request(
@@ -373,12 +373,12 @@  discard block
 block discarded – undo
373 373
 	}
374 374
 
375 375
 	/**
376
-	* Preserve backslashes in a value, but make sure value doesn't get compounding slashes
377
-	*
378
-	* @since 2.0.8
379
-	* @param string $value
380
-	* @return string $value
381
-	*/
376
+	 * Preserve backslashes in a value, but make sure value doesn't get compounding slashes
377
+	 *
378
+	 * @since 2.0.8
379
+	 * @param string $value
380
+	 * @return string $value
381
+	 */
382 382
 	public static function preserve_backslashes( $value ) {
383 383
 		// If backslashes have already been added, don't add them again
384 384
 		if ( strpos( $value, '\\\\' ) === false ) {
@@ -400,14 +400,14 @@  discard block
 block discarded – undo
400 400
 		}
401 401
 	}
402 402
 
403
-    public static function sanitize_request( $sanitize_method, &$values ) {
404
-        $temp_values = $values;
405
-        foreach ( $temp_values as $k => $val ) {
406
-            if ( isset( $sanitize_method[ $k ] ) ) {
403
+	public static function sanitize_request( $sanitize_method, &$values ) {
404
+		$temp_values = $values;
405
+		foreach ( $temp_values as $k => $val ) {
406
+			if ( isset( $sanitize_method[ $k ] ) ) {
407 407
 				$values[ $k ] = call_user_func( $sanitize_method[ $k ], $val );
408
-            }
409
-        }
410
-    }
408
+			}
409
+		}
410
+	}
411 411
 
412 412
 	/**
413 413
 	 * Sanitize the value, and allow some HTML
@@ -524,39 +524,39 @@  discard block
 block discarded – undo
524 524
 		);
525 525
 	}
526 526
 
527
-    /**
528
-     * Used when switching the action for a bulk action
529
-     * @since 2.0
530
-     */
527
+	/**
528
+	 * Used when switching the action for a bulk action
529
+	 * @since 2.0
530
+	 */
531 531
 	public static function remove_get_action() {
532 532
 		if ( ! isset( $_GET ) ) {
533 533
 			return;
534 534
 		}
535 535
 
536
-        $new_action = isset( $_GET['action'] ) ? sanitize_text_field( $_GET['action'] ) : ( isset( $_GET['action2'] ) ? sanitize_text_field( $_GET['action2'] ) : '' );
537
-        if ( ! empty( $new_action ) ) {
536
+		$new_action = isset( $_GET['action'] ) ? sanitize_text_field( $_GET['action'] ) : ( isset( $_GET['action2'] ) ? sanitize_text_field( $_GET['action2'] ) : '' );
537
+		if ( ! empty( $new_action ) ) {
538 538
 			$_SERVER['REQUEST_URI'] = str_replace( '&action=' . $new_action, '', FrmAppHelper::get_server_value( 'REQUEST_URI' ) );
539
-        }
540
-    }
539
+		}
540
+	}
541 541
 
542
-    /**
543
-     * Check the WP query for a parameter
544
-     *
545
-     * @since 2.0
546
-     * @return string|array
547
-     */
548
-    public static function get_query_var( $value, $param ) {
549
-        if ( $value != '' ) {
550
-            return $value;
551
-        }
542
+	/**
543
+	 * Check the WP query for a parameter
544
+	 *
545
+	 * @since 2.0
546
+	 * @return string|array
547
+	 */
548
+	public static function get_query_var( $value, $param ) {
549
+		if ( $value != '' ) {
550
+			return $value;
551
+		}
552 552
 
553
-        global $wp_query;
554
-        if ( isset( $wp_query->query_vars[ $param ] ) ) {
555
-            $value = $wp_query->query_vars[ $param ];
556
-        }
553
+		global $wp_query;
554
+		if ( isset( $wp_query->query_vars[ $param ] ) ) {
555
+			$value = $wp_query->query_vars[ $param ];
556
+		}
557 557
 
558
-        return $value;
559
-    }
558
+		return $value;
559
+	}
560 560
 
561 561
 	/**
562 562
 	 * @since 3.0
@@ -578,16 +578,16 @@  discard block
 block discarded – undo
578 578
 		}
579 579
 	}
580 580
 
581
-    /**
582
-     * @param string $type
583
-     */
584
-    public static function trigger_hook_load( $type, $object = null ) {
585
-        // only load the form hooks once
581
+	/**
582
+	 * @param string $type
583
+	 */
584
+	public static function trigger_hook_load( $type, $object = null ) {
585
+		// only load the form hooks once
586 586
 		$hooks_loaded = apply_filters( 'frm_' . $type . '_hooks_loaded', false, $object );
587
-        if ( ! $hooks_loaded ) {
587
+		if ( ! $hooks_loaded ) {
588 588
 			do_action( 'frm_load_' . $type . '_hooks' );
589
-        }
590
-    }
589
+		}
590
+	}
591 591
 
592 592
 	/**
593 593
 	 * Save all front-end js scripts into a single file
@@ -612,18 +612,18 @@  discard block
 block discarded – undo
612 612
 		$new_file->combine_files( $files );
613 613
 	}
614 614
 
615
-    /**
616
-     * Check a value from a shortcode to see if true or false.
617
-     * True when value is 1, true, 'true', 'yes'
618
-     *
619
-     * @since 1.07.10
620
-     *
621
-     * @param string $value The value to compare
622
-     * @return boolean True or False
623
-     */
615
+	/**
616
+	 * Check a value from a shortcode to see if true or false.
617
+	 * True when value is 1, true, 'true', 'yes'
618
+	 *
619
+	 * @since 1.07.10
620
+	 *
621
+	 * @param string $value The value to compare
622
+	 * @return boolean True or False
623
+	 */
624 624
 	public static function is_true( $value ) {
625
-        return ( true === $value || 1 == $value || 'true' == $value || 'yes' == $value );
626
-    }
625
+		return ( true === $value || 1 == $value || 'true' == $value || 'yes' == $value );
626
+	}
627 627
 
628 628
 	public static function get_pages() {
629 629
 		$query = array(
@@ -636,10 +636,10 @@  discard block
 block discarded – undo
636 636
 		return get_posts( $query );
637 637
 	}
638 638
 
639
-    public static function wp_pages_dropdown( $field_name, $page_id, $truncate = false ) {
640
-        $pages = self::get_pages();
639
+	public static function wp_pages_dropdown( $field_name, $page_id, $truncate = false ) {
640
+		$pages = self::get_pages();
641 641
 		$selected = self::get_post_param( $field_name, $page_id, 'absint' );
642
-    ?>
642
+	?>
643 643
 		<select name="<?php echo esc_attr( $field_name ); ?>" id="<?php echo esc_attr( $field_name ); ?>" class="frm-pages-dropdown">
644 644
             <option value=""> </option>
645 645
             <?php foreach ( $pages as $page ) { ?>
@@ -649,16 +649,16 @@  discard block
 block discarded – undo
649 649
             <?php } ?>
650 650
         </select>
651 651
     <?php
652
-    }
652
+	}
653 653
 
654 654
 	public static function post_edit_link( $post_id ) {
655 655
 		$post = get_post( $post_id );
656
-        if ( $post ) {
656
+		if ( $post ) {
657 657
 			$post_url = admin_url( 'post.php?post=' . $post_id . '&action=edit' );
658 658
 			return '<a href="' . esc_url( $post_url ) . '">' . self::truncate( $post->post_title, 50 ) . '</a>';
659
-        }
660
-        return '';
661
-    }
659
+		}
660
+		return '';
661
+	}
662 662
 
663 663
 	public static function wp_roles_dropdown( $field_name, $capability, $multiple = 'single' ) {
664 664
 		?>
@@ -669,73 +669,73 @@  discard block
 block discarded – undo
669 669
 	}
670 670
 
671 671
 	public static function roles_options( $capability ) {
672
-        global $frm_vars;
672
+		global $frm_vars;
673 673
 		if ( isset( $frm_vars['editable_roles'] ) ) {
674
-            $editable_roles = $frm_vars['editable_roles'];
675
-        } else {
676
-            $editable_roles = get_editable_roles();
677
-            $frm_vars['editable_roles'] = $editable_roles;
678
-        }
674
+			$editable_roles = $frm_vars['editable_roles'];
675
+		} else {
676
+			$editable_roles = get_editable_roles();
677
+			$frm_vars['editable_roles'] = $editable_roles;
678
+		}
679 679
 
680
-        foreach ( $editable_roles as $role => $details ) {
680
+		foreach ( $editable_roles as $role => $details ) {
681 681
 			$name = translate_user_role( $details['name'] );
682 682
 			?>
683 683
 		<option value="<?php echo esc_attr( $role ); ?>" <?php echo in_array( $role, (array) $capability ) ? ' selected="selected"' : ''; ?>><?php echo esc_attr( $name ); ?> </option>
684 684
 <?php
685 685
 			unset( $role, $details );
686
-        }
687
-    }
686
+		}
687
+	}
688 688
 
689 689
 	public static function frm_capabilities( $type = 'auto' ) {
690
-        $cap = array(
691
-            'frm_view_forms'        => __( 'View Forms and Templates', 'formidable' ),
692
-            'frm_edit_forms'        => __( 'Add/Edit Forms and Templates', 'formidable' ),
693
-            'frm_delete_forms'      => __( 'Delete Forms and Templates', 'formidable' ),
694
-            'frm_change_settings'   => __( 'Access this Settings Page', 'formidable' ),
695
-            'frm_view_entries'      => __( 'View Entries from Admin Area', 'formidable' ),
696
-            'frm_delete_entries'    => __( 'Delete Entries from Admin Area', 'formidable' ),
697
-        );
690
+		$cap = array(
691
+			'frm_view_forms'        => __( 'View Forms and Templates', 'formidable' ),
692
+			'frm_edit_forms'        => __( 'Add/Edit Forms and Templates', 'formidable' ),
693
+			'frm_delete_forms'      => __( 'Delete Forms and Templates', 'formidable' ),
694
+			'frm_change_settings'   => __( 'Access this Settings Page', 'formidable' ),
695
+			'frm_view_entries'      => __( 'View Entries from Admin Area', 'formidable' ),
696
+			'frm_delete_entries'    => __( 'Delete Entries from Admin Area', 'formidable' ),
697
+		);
698 698
 
699 699
 		if ( ! self::pro_is_installed() && 'pro' != $type ) {
700
-            return $cap;
701
-        }
700
+			return $cap;
701
+		}
702 702
 
703
-        $cap['frm_create_entries'] = __( 'Add Entries from Admin Area', 'formidable' );
704
-        $cap['frm_edit_entries'] = __( 'Edit Entries from Admin Area', 'formidable' );
705
-        $cap['frm_view_reports'] = __( 'View Reports', 'formidable' );
706
-        $cap['frm_edit_displays'] = __( 'Add/Edit Views', 'formidable' );
703
+		$cap['frm_create_entries'] = __( 'Add Entries from Admin Area', 'formidable' );
704
+		$cap['frm_edit_entries'] = __( 'Edit Entries from Admin Area', 'formidable' );
705
+		$cap['frm_view_reports'] = __( 'View Reports', 'formidable' );
706
+		$cap['frm_edit_displays'] = __( 'Add/Edit Views', 'formidable' );
707 707
 
708
-        return $cap;
709
-    }
708
+		return $cap;
709
+	}
710 710
 
711 711
 	public static function user_has_permission( $needed_role ) {
712
-        if ( $needed_role == '-1' ) {
713
-            return false;
712
+		if ( $needed_role == '-1' ) {
713
+			return false;
714 714
 		}
715 715
 
716
-        // $needed_role will be equal to blank if "Logged-in users" is selected
717
-        if ( ( $needed_role == '' && is_user_logged_in() ) || current_user_can( $needed_role ) ) {
718
-            return true;
719
-        }
716
+		// $needed_role will be equal to blank if "Logged-in users" is selected
717
+		if ( ( $needed_role == '' && is_user_logged_in() ) || current_user_can( $needed_role ) ) {
718
+			return true;
719
+		}
720 720
 
721
-        $roles = array( 'administrator', 'editor', 'author', 'contributor', 'subscriber' );
722
-        foreach ( $roles as $role ) {
721
+		$roles = array( 'administrator', 'editor', 'author', 'contributor', 'subscriber' );
722
+		foreach ( $roles as $role ) {
723 723
 			if ( current_user_can( $role ) ) {
724
-        		return true;
724
+				return true;
725 725
 			}
726
-        	if ( $role == $needed_role ) {
727
-        		break;
726
+			if ( $role == $needed_role ) {
727
+				break;
728 728
 			}
729
-        }
730
-        return false;
731
-    }
732
-
733
-    /**
734
-     * Make sure administrators can see Formidable menu
735
-     *
736
-     * @since 2.0
737
-     */
738
-    public static function maybe_add_permissions() {
729
+		}
730
+		return false;
731
+	}
732
+
733
+	/**
734
+	 * Make sure administrators can see Formidable menu
735
+	 *
736
+	 * @since 2.0
737
+	 */
738
+	public static function maybe_add_permissions() {
739 739
 		self::force_capability( 'frm_view_entries' );
740 740
 
741 741
 		if ( ! current_user_can( 'administrator' ) || current_user_can( 'frm_view_forms' ) ) {
@@ -744,12 +744,12 @@  discard block
 block discarded – undo
744 744
 
745 745
 		$user_id = get_current_user_id();
746 746
 		$user = new WP_User( $user_id );
747
-        $frm_roles = self::frm_capabilities();
748
-        foreach ( $frm_roles as $frm_role => $frm_role_description ) {
747
+		$frm_roles = self::frm_capabilities();
748
+		foreach ( $frm_roles as $frm_role => $frm_role_description ) {
749 749
 			$user->add_cap( $frm_role );
750 750
 			unset( $frm_role, $frm_role_description );
751
-        }
752
-    }
751
+		}
752
+	}
753 753
 
754 754
 	/**
755 755
 	 * Make sure admins have permission to see the menu items
@@ -765,28 +765,28 @@  discard block
 block discarded – undo
765 765
 		}
766 766
 	}
767 767
 
768
-    /**
769
-     * Check if the user has permision for action.
770
-     * Return permission message and stop the action if no permission
771
-     * @since 2.0
772
-     * @param string $permission
773
-     */
768
+	/**
769
+	 * Check if the user has permision for action.
770
+	 * Return permission message and stop the action if no permission
771
+	 * @since 2.0
772
+	 * @param string $permission
773
+	 */
774 774
 	public static function permission_check( $permission, $show_message = 'show' ) {
775 775
 		$permission_error = self::permission_nonce_error( $permission );
776
-        if ( $permission_error !== false ) {
777
-            if ( 'hide' == $show_message ) {
778
-                $permission_error = '';
779
-            }
776
+		if ( $permission_error !== false ) {
777
+			if ( 'hide' == $show_message ) {
778
+				$permission_error = '';
779
+			}
780 780
 			wp_die( esc_html( $permission_error ) );
781
-        }
782
-    }
783
-
784
-    /**
785
-     * Check user permission and nonce
786
-     * @since 2.0
787
-     * @param string $permission
788
-     * @return false|string The permission message or false if allowed
789
-     */
781
+		}
782
+	}
783
+
784
+	/**
785
+	 * Check user permission and nonce
786
+	 * @since 2.0
787
+	 * @param string $permission
788
+	 * @return false|string The permission message or false if allowed
789
+	 */
790 790
 	public static function permission_nonce_error( $permission, $nonce_name = '', $nonce = '' ) {
791 791
 		if ( ! empty( $permission ) && ! current_user_can( $permission ) && ! current_user_can( 'administrator' ) ) {
792 792
 			$frm_settings = self::get_settings();
@@ -795,22 +795,22 @@  discard block
 block discarded – undo
795 795
 
796 796
 		$error = false;
797 797
 		if ( empty( $nonce_name ) ) {
798
-            return $error;
799
-        }
798
+			return $error;
799
+		}
800 800
 
801
-        if ( $_REQUEST && ( ! isset( $_REQUEST[ $nonce_name ] ) || ! wp_verify_nonce( $_REQUEST[ $nonce_name ], $nonce ) ) ) {
802
-            $frm_settings = self::get_settings();
803
-            $error = $frm_settings->admin_permission;
804
-        }
801
+		if ( $_REQUEST && ( ! isset( $_REQUEST[ $nonce_name ] ) || ! wp_verify_nonce( $_REQUEST[ $nonce_name ], $nonce ) ) ) {
802
+			$frm_settings = self::get_settings();
803
+			$error = $frm_settings->admin_permission;
804
+		}
805 805
 
806
-        return $error;
807
-    }
806
+		return $error;
807
+	}
808 808
 
809
-    public static function checked( $values, $current ) {
809
+	public static function checked( $values, $current ) {
810 810
 		if ( self::check_selected( $values, $current ) ) {
811
-            echo ' checked="checked"';
811
+			echo ' checked="checked"';
812 812
 		}
813
-    }
813
+	}
814 814
 
815 815
 	public static function check_selected( $values, $current ) {
816 816
 		$values = self::recursive_function_map( $values, 'trim' );
@@ -848,24 +848,24 @@  discard block
 block discarded – undo
848 848
 		return (bool) count( array_filter( array_keys( $array ), 'is_string' ) );
849 849
 	}
850 850
 
851
-    /**
852
-     * Flatten a multi-dimensional array
853
-     */
851
+	/**
852
+	 * Flatten a multi-dimensional array
853
+	 */
854 854
 	public static function array_flatten( $array, $keys = 'keep' ) {
855
-        $return = array();
856
-        foreach ( $array as $key => $value ) {
855
+		$return = array();
856
+		foreach ( $array as $key => $value ) {
857 857
 			if ( is_array( $value ) ) {
858 858
 				$return = array_merge( $return, self::array_flatten( $value, $keys ) );
859
-            } else {
859
+			} else {
860 860
 				if ( $keys == 'keep' ) {
861 861
 					$return[ $key ] = $value;
862 862
 				} else {
863 863
 					$return[] = $value;
864 864
 				}
865
-            }
866
-        }
867
-        return $return;
868
-    }
865
+			}
866
+		}
867
+		return $return;
868
+	}
869 869
 
870 870
 	public static function esc_textarea( $text, $is_rich_text = false ) {
871 871
 		$safe_text = str_replace( '&quot;', '"', $text );
@@ -876,10 +876,10 @@  discard block
 block discarded – undo
876 876
 		return apply_filters( 'esc_textarea', $safe_text, $text );
877 877
 	}
878 878
 
879
-    /**
880
-     * Add auto paragraphs to text areas
881
-     * @since 2.0
882
-     */
879
+	/**
880
+	 * Add auto paragraphs to text areas
881
+	 * @since 2.0
882
+	 */
883 883
 	public static function use_wpautop( $content ) {
884 884
 		if ( apply_filters( 'frm_use_wpautop', true ) ) {
885 885
 			$content = wpautop( str_replace( '<br>', '<br />', $content ) );
@@ -888,26 +888,26 @@  discard block
 block discarded – undo
888 888
 	}
889 889
 
890 890
 	public static function replace_quotes( $val ) {
891
-        //Replace double quotes
891
+		//Replace double quotes
892 892
 		$val = str_replace( array( '&#8220;', '&#8221;', '&#8243;' ), '"', $val );
893
-        //Replace single quotes
894
-        $val = str_replace( array( '&#8216;', '&#8217;', '&#8242;', '&prime;', '&rsquo;', '&lsquo;' ), "'", $val );
895
-        return $val;
896
-    }
897
-
898
-    /**
899
-     * @since 2.0
900
-     * @return string The base Google APIS url for the current version of jQuery UI
901
-     */
902
-    public static function jquery_ui_base_url() {
893
+		//Replace single quotes
894
+		$val = str_replace( array( '&#8216;', '&#8217;', '&#8242;', '&prime;', '&rsquo;', '&lsquo;' ), "'", $val );
895
+		return $val;
896
+	}
897
+
898
+	/**
899
+	 * @since 2.0
900
+	 * @return string The base Google APIS url for the current version of jQuery UI
901
+	 */
902
+	public static function jquery_ui_base_url() {
903 903
 		$url = 'http' . ( is_ssl() ? 's' : '' ) . '://ajax.googleapis.com/ajax/libs/jqueryui/' . self::script_version( 'jquery-ui-core', '1.11.4' );
904 904
 		$url = apply_filters( 'frm_jquery_ui_base_url', $url );
905
-        return $url;
906
-    }
905
+		return $url;
906
+	}
907 907
 
908
-    /**
909
-     * @param string $handle
910
-     */
908
+	/**
909
+	 * @param string $handle
910
+	 */
911 911
 	public static function script_version( $handle, $default = 0 ) {
912 912
 		global $wp_scripts;
913 913
 		if ( ! $wp_scripts ) {
@@ -929,12 +929,12 @@  discard block
 block discarded – undo
929 929
 
930 930
 	public static function js_redirect( $url ) {
931 931
 		return '<script type="text/javascript">window.location="' . esc_url_raw( $url ) . '"</script>';
932
-    }
932
+	}
933 933
 
934 934
 	public static function get_user_id_param( $user_id ) {
935 935
 		if ( ! $user_id || empty( $user_id ) || is_numeric( $user_id ) ) {
936
-            return $user_id;
937
-        }
936
+			return $user_id;
937
+		}
938 938
 
939 939
 		$user_id = sanitize_text_field( $user_id );
940 940
 		if ( $user_id == 'current' ) {
@@ -946,14 +946,14 @@  discard block
 block discarded – undo
946 946
 				$user = get_user_by( 'login', $user_id );
947 947
 			}
948 948
 
949
-            if ( $user ) {
950
-                $user_id = $user->ID;
951
-            }
949
+			if ( $user ) {
950
+				$user_id = $user->ID;
951
+			}
952 952
 			unset( $user );
953
-        }
953
+		}
954 954
 
955
-        return $user_id;
956
-    }
955
+		return $user_id;
956
+	}
957 957
 
958 958
 	public static function get_file_contents( $filename, $atts = array() ) {
959 959
 		if ( ! is_file( $filename ) ) {
@@ -968,28 +968,28 @@  discard block
 block discarded – undo
968 968
 		return $contents;
969 969
 	}
970 970
 
971
-    /**
972
-     * @param string $table_name
973
-     * @param string $column
971
+	/**
972
+	 * @param string $table_name
973
+	 * @param string $column
974 974
 	 * @param int $id
975 975
 	 * @param int $num_chars
976
-     */
977
-    public static function get_unique_key( $name = '', $table_name, $column, $id = 0, $num_chars = 5 ) {
978
-        $key = '';
976
+	 */
977
+	public static function get_unique_key( $name = '', $table_name, $column, $id = 0, $num_chars = 5 ) {
978
+		$key = '';
979 979
 
980
-        if ( ! empty( $name ) ) {
980
+		if ( ! empty( $name ) ) {
981 981
 			$key = sanitize_key( $name );
982
-        }
982
+		}
983 983
 
984 984
 		if ( empty( $key ) ) {
985 985
 			$max_slug_value = pow( 36, $num_chars );
986
-            $min_slug_value = 37; // we want to have at least 2 characters in the slug
986
+			$min_slug_value = 37; // we want to have at least 2 characters in the slug
987 987
 			$key = base_convert( rand( $min_slug_value, $max_slug_value ), 10, 36 );
988
-        }
988
+		}
989 989
 
990 990
 		if ( is_numeric( $key ) || in_array( $key, array( 'id', 'key', 'created-at', 'detaillink', 'editlink', 'siteurl', 'evenodd' ) ) ) {
991 991
 			$key = $key . 'a';
992
-        }
992
+		}
993 993
 
994 994
 		$key_check = FrmDb::get_var(
995 995
 			$table_name,
@@ -1001,7 +1001,7 @@  discard block
 block discarded – undo
1001 1001
 		);
1002 1002
 
1003 1003
 		if ( $key_check || is_numeric( $key_check ) ) {
1004
-            $suffix = 2;
1004
+			$suffix = 2;
1005 1005
 			do {
1006 1006
 				$alt_post_name = substr( $key, 0, 200 - ( strlen( $suffix ) + 1 ) ) . $suffix;
1007 1007
 				$key_check = FrmDb::get_var(
@@ -1015,19 +1015,19 @@  discard block
 block discarded – undo
1015 1015
 				$suffix++;
1016 1016
 			} while ( $key_check || is_numeric( $key_check ) );
1017 1017
 			$key = $alt_post_name;
1018
-        }
1019
-        return $key;
1020
-    }
1021
-
1022
-    /**
1023
-     * Editing a Form or Entry
1024
-     * @param string $table
1025
-     * @return bool|array
1026
-     */
1027
-    public static function setup_edit_vars( $record, $table, $fields = '', $default = false, $post_values = array(), $args = array() ) {
1028
-        if ( ! $record ) {
1029
-            return false;
1030
-        }
1018
+		}
1019
+		return $key;
1020
+	}
1021
+
1022
+	/**
1023
+	 * Editing a Form or Entry
1024
+	 * @param string $table
1025
+	 * @return bool|array
1026
+	 */
1027
+	public static function setup_edit_vars( $record, $table, $fields = '', $default = false, $post_values = array(), $args = array() ) {
1028
+		if ( ! $record ) {
1029
+			return false;
1030
+		}
1031 1031
 
1032 1032
 		if ( empty( $post_values ) ) {
1033 1033
 			$post_values = stripslashes_deep( $_POST );
@@ -1050,14 +1050,14 @@  discard block
 block discarded – undo
1050 1050
 
1051 1051
 		self::prepare_field_arrays( $fields, $record, $values, array_merge( $args, compact( 'default', 'post_values' ) ) );
1052 1052
 
1053
-        if ( $table == 'entries' ) {
1054
-            $values = FrmEntriesHelper::setup_edit_vars( $values, $record );
1055
-        } else if ( $table == 'forms' ) {
1056
-            $values = FrmFormsHelper::setup_edit_vars( $values, $record, $post_values );
1057
-        }
1053
+		if ( $table == 'entries' ) {
1054
+			$values = FrmEntriesHelper::setup_edit_vars( $values, $record );
1055
+		} else if ( $table == 'forms' ) {
1056
+			$values = FrmFormsHelper::setup_edit_vars( $values, $record, $post_values );
1057
+		}
1058 1058
 
1059
-        return $values;
1060
-    }
1059
+		return $values;
1060
+	}
1061 1061
 
1062 1062
 	private static function prepare_field_arrays( $fields, $record, array &$values, $args ) {
1063 1063
 		if ( ! empty( $fields ) ) {
@@ -1070,15 +1070,15 @@  discard block
 block discarded – undo
1070 1070
 	}
1071 1071
 
1072 1072
 	private static function fill_field_defaults( $field, $record, array &$values, $args ) {
1073
-        $post_values = $args['post_values'];
1073
+		$post_values = $args['post_values'];
1074 1074
 
1075
-        if ( $args['default'] ) {
1076
-            $meta_value = $field->default_value;
1077
-        } else {
1075
+		if ( $args['default'] ) {
1076
+			$meta_value = $field->default_value;
1077
+		} else {
1078 1078
 			if ( $record->post_id && self::pro_is_installed() && isset( $field->field_options['post_field'] ) && $field->field_options['post_field'] ) {
1079 1079
 				if ( ! isset( $field->field_options['custom_field'] ) ) {
1080
-                    $field->field_options['custom_field'] = '';
1081
-                }
1080
+					$field->field_options['custom_field'] = '';
1081
+				}
1082 1082
 				$meta_value = FrmProEntryMetaHelper::get_post_value(
1083 1083
 					$record->post_id,
1084 1084
 					$field->field_options['post_field'],
@@ -1090,31 +1090,31 @@  discard block
 block discarded – undo
1090 1090
 						'field' => $field,
1091 1091
 					)
1092 1092
 				);
1093
-            } else {
1093
+			} else {
1094 1094
 				$meta_value = FrmEntryMeta::get_meta_value( $record, $field->id );
1095
-            }
1096
-        }
1095
+			}
1096
+		}
1097 1097
 
1098 1098
 		$field_type = isset( $post_values['field_options'][ 'type_' . $field->id ] ) ? $post_values['field_options'][ 'type_' . $field->id ] : $field->type;
1099
-        $new_value = isset( $post_values['item_meta'][ $field->id ] ) ? maybe_unserialize( $post_values['item_meta'][ $field->id ] ) : $meta_value;
1099
+		$new_value = isset( $post_values['item_meta'][ $field->id ] ) ? maybe_unserialize( $post_values['item_meta'][ $field->id ] ) : $meta_value;
1100 1100
 
1101 1101
 		$field_array = self::start_field_array( $field );
1102 1102
 		$field_array['value'] = $new_value;
1103 1103
 		$field_array['type']  = apply_filters( 'frm_field_type', $field_type, $field, $new_value );
1104 1104
 		$field_array['parent_form_id'] = $args['parent_form_id'];
1105 1105
 
1106
-        $args['field_type'] = $field_type;
1106
+		$args['field_type'] = $field_type;
1107 1107
 
1108 1108
 		FrmFieldsHelper::prepare_edit_front_field( $field_array, $field, $values['id'], $args );
1109 1109
 
1110 1110
 		if ( ! isset( $field_array['unique'] ) || ! $field_array['unique'] ) {
1111
-            $field_array['unique_msg'] = '';
1112
-        }
1111
+			$field_array['unique_msg'] = '';
1112
+		}
1113 1113
 
1114
-        $field_array = array_merge( $field->field_options, $field_array );
1114
+		$field_array = array_merge( $field->field_options, $field_array );
1115 1115
 
1116
-        $values['fields'][ $field->id ] = $field_array;
1117
-    }
1116
+		$values['fields'][ $field->id ] = $field_array;
1117
+	}
1118 1118
 
1119 1119
 	/**
1120 1120
 	 * @since 3.0
@@ -1135,20 +1135,20 @@  discard block
 block discarded – undo
1135 1135
 		);
1136 1136
 	}
1137 1137
 
1138
-    /**
1139
-     * @param string $table
1140
-     */
1138
+	/**
1139
+	 * @param string $table
1140
+	 */
1141 1141
 	private static function fill_form_opts( $record, $table, $post_values, array &$values ) {
1142
-        if ( $table == 'entries' ) {
1143
-            $form = $record->form_id;
1142
+		if ( $table == 'entries' ) {
1143
+			$form = $record->form_id;
1144 1144
 			FrmForm::maybe_get_form( $form );
1145
-        } else {
1146
-            $form = $record;
1147
-        }
1145
+		} else {
1146
+			$form = $record;
1147
+		}
1148 1148
 
1149
-        if ( ! $form ) {
1150
-            return;
1151
-        }
1149
+		if ( ! $form ) {
1150
+			return;
1151
+		}
1152 1152
 
1153 1153
 		$values['form_name'] = isset( $record->form_id ) ? $form->name : '';
1154 1154
 		$values['parent_form_id'] = isset( $record->form_id ) ? $form->parent_form_id : 0;
@@ -1157,26 +1157,26 @@  discard block
 block discarded – undo
1157 1157
 			return;
1158 1158
 		}
1159 1159
 
1160
-        foreach ( $form->options as $opt => $value ) {
1161
-            $values[ $opt ] = isset( $post_values[ $opt ] ) ? maybe_unserialize( $post_values[ $opt ] ) : $value;
1162
-        }
1160
+		foreach ( $form->options as $opt => $value ) {
1161
+			$values[ $opt ] = isset( $post_values[ $opt ] ) ? maybe_unserialize( $post_values[ $opt ] ) : $value;
1162
+		}
1163 1163
 
1164 1164
 		self::fill_form_defaults( $post_values, $values );
1165
-    }
1165
+	}
1166 1166
 
1167
-    /**
1168
-     * Set to POST value or default
1169
-     */
1167
+	/**
1168
+	 * Set to POST value or default
1169
+	 */
1170 1170
 	private static function fill_form_defaults( $post_values, array &$values ) {
1171
-        $form_defaults = FrmFormsHelper::get_default_opts();
1171
+		$form_defaults = FrmFormsHelper::get_default_opts();
1172 1172
 
1173
-        foreach ( $form_defaults as $opt => $default ) {
1174
-            if ( ! isset( $values[ $opt ] ) || $values[ $opt ] == '' ) {
1173
+		foreach ( $form_defaults as $opt => $default ) {
1174
+			if ( ! isset( $values[ $opt ] ) || $values[ $opt ] == '' ) {
1175 1175
 				$values[ $opt ] = ( $post_values && isset( $post_values['options'][ $opt ] ) ) ? $post_values['options'][ $opt ] : $default;
1176
-            }
1176
+			}
1177 1177
 
1178 1178
 			unset( $opt, $default );
1179
-        }
1179
+		}
1180 1180
 
1181 1181
 		if ( ! isset( $values['custom_style'] ) ) {
1182 1182
 			$values['custom_style'] = self::custom_style_value( $post_values );
@@ -1185,10 +1185,10 @@  discard block
 block discarded – undo
1185 1185
 		foreach ( array( 'before', 'after', 'submit' ) as $h ) {
1186 1186
 			if ( ! isset( $values[ $h . '_html' ] ) ) {
1187 1187
 				$values[ $h . '_html' ] = ( isset( $post_values['options'][ $h . '_html' ] ) ? $post_values['options'][ $h . '_html' ] : FrmFormsHelper::get_default_html( $h ) );
1188
-            }
1188
+			}
1189 1189
 			unset( $h );
1190
-        }
1191
-    }
1190
+		}
1191
+	}
1192 1192
 
1193 1193
 	/**
1194 1194
 	 * @since 2.2.10
@@ -1211,33 +1211,33 @@  discard block
 block discarded – undo
1211 1211
 		if ( $possible_email_field ) {
1212 1212
 			$class .= 'show_frm_not_email_to';
1213 1213
 		}
1214
-    ?>
1214
+	?>
1215 1215
 <li>
1216 1216
 	<a href="javascript:void(0)" class="frmids frm_insert_code alignright <?php echo esc_attr( $class ); ?>" data-code="<?php echo esc_attr( $args['id'] ); ?>" >[<?php echo esc_attr( $args['id'] ); ?>]</a>
1217 1217
 	<a href="javascript:void(0)" class="frmkeys frm_insert_code alignright <?php echo esc_attr( $class ); ?>" data-code="<?php echo esc_attr( $args['key'] ); ?>" >[<?php echo esc_attr( self::truncate( $args['key'], 10 ) ); ?>]</a>
1218 1218
 	<a href="javascript:void(0)" class="frm_insert_code <?php echo esc_attr( $class ); ?>" data-code="<?php echo esc_attr( $args['id'] ); ?>" ><?php echo esc_attr( self::truncate( $args['name'], 60 ) ); ?></a>
1219 1219
 </li>
1220 1220
     <?php
1221
-    }
1221
+	}
1222 1222
 
1223 1223
 	public static function truncate( $str, $length, $minword = 3, $continue = '...' ) {
1224
-        if ( is_array( $str ) ) {
1225
-            return '';
1224
+		if ( is_array( $str ) ) {
1225
+			return '';
1226 1226
 		}
1227 1227
 
1228
-        $length = (int) $length;
1228
+		$length = (int) $length;
1229 1229
 		$str = wp_strip_all_tags( $str );
1230 1230
 		$original_len = self::mb_function( array( 'mb_strlen', 'strlen' ), array( $str ) );
1231 1231
 
1232 1232
 		if ( $length == 0 ) {
1233
-            return '';
1234
-        } else if ( $length <= 10 ) {
1233
+			return '';
1234
+		} else if ( $length <= 10 ) {
1235 1235
 			$sub = self::mb_function( array( 'mb_substr', 'substr' ), array( $str, 0, $length ) );
1236 1236
 			return $sub . ( ( $length < $original_len ) ? $continue : '' );
1237
-        }
1237
+		}
1238 1238
 
1239
-        $sub = '';
1240
-        $len = 0;
1239
+		$sub = '';
1240
+		$len = 0;
1241 1241
 
1242 1242
 		$words = self::mb_function( array( 'mb_split', 'explode' ), array( ' ', $str ) );
1243 1243
 
@@ -1245,21 +1245,21 @@  discard block
 block discarded – undo
1245 1245
 			$part = ( ( $sub != '' ) ? ' ' : '' ) . $word;
1246 1246
 			$total_len = self::mb_function( array( 'mb_strlen', 'strlen' ), array( $sub . $part ) );
1247 1247
 			if ( $total_len > $length && str_word_count( $sub ) ) {
1248
-                break;
1249
-            }
1248
+				break;
1249
+			}
1250 1250
 
1251
-            $sub .= $part;
1251
+			$sub .= $part;
1252 1252
 			$len += self::mb_function( array( 'mb_strlen', 'strlen' ), array( $part ) );
1253 1253
 
1254 1254
 			if ( str_word_count( $sub ) > $minword && $total_len >= $length ) {
1255
-                break;
1256
-            }
1255
+				break;
1256
+			}
1257 1257
 
1258 1258
 			unset( $total_len, $word );
1259
-        }
1259
+		}
1260 1260
 
1261 1261
 		return $sub . ( ( $len < $original_len ) ? $continue : '' );
1262
-    }
1262
+	}
1263 1263
 
1264 1264
 	public static function mb_function( $function_names, $args ) {
1265 1265
 		$mb_function_name = $function_names[0];
@@ -1272,17 +1272,17 @@  discard block
 block discarded – undo
1272 1272
 
1273 1273
 	public static function get_formatted_time( $date, $date_format = '', $time_format = '' ) {
1274 1274
 		if ( empty( $date ) ) {
1275
-            return $date;
1276
-        }
1275
+			return $date;
1276
+		}
1277 1277
 
1278 1278
 		if ( empty( $date_format ) ) {
1279 1279
 			$date_format = get_option( 'date_format' );
1280 1280
 		}
1281 1281
 
1282 1282
 		if ( preg_match( '/^\d{1-2}\/\d{1-2}\/\d{4}$/', $date ) && self::pro_is_installed() ) {
1283
-            $frmpro_settings = new FrmProSettings();
1283
+			$frmpro_settings = new FrmProSettings();
1284 1284
 			$date = FrmProAppHelper::convert_date( $date, $frmpro_settings->date_format, 'Y-m-d' );
1285
-        }
1285
+		}
1286 1286
 
1287 1287
 		$formatted = self::get_localized_date( $date_format, $date );
1288 1288
 
@@ -1291,8 +1291,8 @@  discard block
 block discarded – undo
1291 1291
 			$formatted .= self::add_time_to_date( $time_format, $date );
1292 1292
 		}
1293 1293
 
1294
-        return $formatted;
1295
-    }
1294
+		return $formatted;
1295
+	}
1296 1296
 
1297 1297
 	private static function add_time_to_date( $time_format, $date ) {
1298 1298
 		if ( empty( $time_format ) ) {
@@ -1374,32 +1374,32 @@  discard block
 block discarded – undo
1374 1374
 		);
1375 1375
 	}
1376 1376
 
1377
-    // Pagination Methods
1377
+	// Pagination Methods
1378 1378
 
1379
-    /**
1380
-     * @param integer $current_p
1381
-     */
1379
+	/**
1380
+	 * @param integer $current_p
1381
+	 */
1382 1382
 	public static function get_last_record_num( $r_count, $current_p, $p_size ) {
1383 1383
 		return ( ( $r_count < ( $current_p * $p_size ) ) ? $r_count : ( $current_p * $p_size ) );
1384 1384
 	}
1385 1385
 
1386
-    /**
1387
-     * @param integer $current_p
1388
-     */
1389
-    public static function get_first_record_num( $r_count, $current_p, $p_size ) {
1390
-        if ( $current_p == 1 ) {
1391
-            return 1;
1392
-        } else {
1393
-            return ( self::get_last_record_num( $r_count, ( $current_p - 1 ), $p_size ) + 1 );
1394
-        }
1395
-    }
1386
+	/**
1387
+	 * @param integer $current_p
1388
+	 */
1389
+	public static function get_first_record_num( $r_count, $current_p, $p_size ) {
1390
+		if ( $current_p == 1 ) {
1391
+			return 1;
1392
+		} else {
1393
+			return ( self::get_last_record_num( $r_count, ( $current_p - 1 ), $p_size ) + 1 );
1394
+		}
1395
+	}
1396 1396
 
1397 1397
 	/**
1398 1398
 	 * @return array
1399 1399
 	 */
1400 1400
 	public static function json_to_array( $json_vars ) {
1401
-        $vars = array();
1402
-        foreach ( $json_vars as $jv ) {
1401
+		$vars = array();
1402
+		foreach ( $json_vars as $jv ) {
1403 1403
 			$jv_name = explode( '[', $jv['name'] );
1404 1404
 			$last = count( $jv_name ) - 1;
1405 1405
 			foreach ( $jv_name as $p => $n ) {
@@ -1416,77 +1416,77 @@  discard block
 block discarded – undo
1416 1416
 					$l3 = $name;
1417 1417
 				}
1418 1418
 
1419
-                $this_val = ( $p == $last ) ? $jv['value'] : array();
1419
+				$this_val = ( $p == $last ) ? $jv['value'] : array();
1420 1420
 
1421
-                switch ( $p ) {
1422
-                    case 0:
1423
-                        $l1 = $name;
1424
-                        self::add_value_to_array( $name, $l1, $this_val, $vars );
1421
+				switch ( $p ) {
1422
+					case 0:
1423
+						$l1 = $name;
1424
+						self::add_value_to_array( $name, $l1, $this_val, $vars );
1425 1425
 						break;
1426 1426
 
1427
-                    case 1:
1428
-                        $l2 = $name;
1429
-                        self::add_value_to_array( $name, $l2, $this_val, $vars[ $l1 ] );
1427
+					case 1:
1428
+						$l2 = $name;
1429
+						self::add_value_to_array( $name, $l2, $this_val, $vars[ $l1 ] );
1430 1430
 						break;
1431 1431
 
1432
-                    case 2:
1433
-                        $l3 = $name;
1434
-                        self::add_value_to_array( $name, $l3, $this_val, $vars[ $l1 ][ $l2 ] );
1432
+					case 2:
1433
+						$l3 = $name;
1434
+						self::add_value_to_array( $name, $l3, $this_val, $vars[ $l1 ][ $l2 ] );
1435 1435
 						break;
1436 1436
 
1437
-                    case 3:
1438
-                        $l4 = $name;
1439
-                        self::add_value_to_array( $name, $l4, $this_val, $vars[ $l1 ][ $l2 ][ $l3 ] );
1440
-                }
1437
+					case 3:
1438
+						$l4 = $name;
1439
+						self::add_value_to_array( $name, $l4, $this_val, $vars[ $l1 ][ $l2 ][ $l3 ] );
1440
+				}
1441 1441
 
1442 1442
 				unset( $this_val, $n );
1443
-            }
1443
+			}
1444 1444
 
1445 1445
 			unset( $last, $jv );
1446
-        }
1447
-
1448
-        return $vars;
1449
-    }
1450
-
1451
-    /**
1452
-     * @param string $name
1453
-     * @param string $l1
1454
-     */
1455
-    public static function add_value_to_array( $name, $l1, $val, &$vars ) {
1456
-        if ( $name == '' ) {
1457
-            $vars[] = $val;
1458
-        } else if ( ! isset( $vars[ $l1 ] ) ) {
1459
-            $vars[ $l1 ] = $val;
1460
-        }
1461
-    }
1446
+		}
1447
+
1448
+		return $vars;
1449
+	}
1450
+
1451
+	/**
1452
+	 * @param string $name
1453
+	 * @param string $l1
1454
+	 */
1455
+	public static function add_value_to_array( $name, $l1, $val, &$vars ) {
1456
+		if ( $name == '' ) {
1457
+			$vars[] = $val;
1458
+		} else if ( ! isset( $vars[ $l1 ] ) ) {
1459
+			$vars[ $l1 ] = $val;
1460
+		}
1461
+	}
1462 1462
 
1463 1463
 	public static function maybe_add_tooltip( $name, $class = 'closed', $form_name = '' ) {
1464
-        $tooltips = array(
1465
-            'action_title'  => __( 'Give this action a label for easy reference.', 'formidable' ),
1466
-            'email_to'      => __( 'Add one or more recipient addresses separated by a ",".  FORMAT: Name <[email protected]> or [email protected].  [admin_email] is the address set in WP General Settings.', 'formidable' ),
1467
-            'cc'            => __( 'Add CC addresses separated by a ",".  FORMAT: Name <[email protected]> or [email protected].', 'formidable' ),
1468
-            'bcc'           => __( 'Add BCC addresses separated by a ",".  FORMAT: Name <[email protected]> or [email protected].', 'formidable' ),
1469
-            'reply_to'      => __( 'If you would like a different reply to address than the "from" address, add a single address here.  FORMAT: Name <[email protected]> or [email protected].', 'formidable' ),
1470
-            'from'          => __( 'Enter the name and/or email address of the sender. FORMAT: John Bates <[email protected]> or [email protected].', 'formidable' ),
1471
-            'email_subject' => esc_attr( sprintf( __( 'If you leave the subject blank, the default will be used: %1$s Form submitted on %2$s', 'formidable' ), $form_name, self::site_name() ) ),
1472
-        );
1473
-
1474
-        if ( ! isset( $tooltips[ $name ] ) ) {
1475
-            return;
1476
-        }
1477
-
1478
-        if ( 'open' == $class ) {
1479
-            echo ' frm_help"';
1480
-        } else {
1481
-            echo ' class="frm_help"';
1482
-        }
1464
+		$tooltips = array(
1465
+			'action_title'  => __( 'Give this action a label for easy reference.', 'formidable' ),
1466
+			'email_to'      => __( 'Add one or more recipient addresses separated by a ",".  FORMAT: Name <[email protected]> or [email protected].  [admin_email] is the address set in WP General Settings.', 'formidable' ),
1467
+			'cc'            => __( 'Add CC addresses separated by a ",".  FORMAT: Name <[email protected]> or [email protected].', 'formidable' ),
1468
+			'bcc'           => __( 'Add BCC addresses separated by a ",".  FORMAT: Name <[email protected]> or [email protected].', 'formidable' ),
1469
+			'reply_to'      => __( 'If you would like a different reply to address than the "from" address, add a single address here.  FORMAT: Name <[email protected]> or [email protected].', 'formidable' ),
1470
+			'from'          => __( 'Enter the name and/or email address of the sender. FORMAT: John Bates <[email protected]> or [email protected].', 'formidable' ),
1471
+			'email_subject' => esc_attr( sprintf( __( 'If you leave the subject blank, the default will be used: %1$s Form submitted on %2$s', 'formidable' ), $form_name, self::site_name() ) ),
1472
+		);
1473
+
1474
+		if ( ! isset( $tooltips[ $name ] ) ) {
1475
+			return;
1476
+		}
1477
+
1478
+		if ( 'open' == $class ) {
1479
+			echo ' frm_help"';
1480
+		} else {
1481
+			echo ' class="frm_help"';
1482
+		}
1483 1483
 
1484 1484
 		echo ' title="' . esc_attr( $tooltips[ $name ] );
1485 1485
 
1486
-        if ( 'open' != $class ) {
1487
-            echo '"';
1488
-        }
1489
-    }
1486
+		if ( 'open' != $class ) {
1487
+			echo '"';
1488
+		}
1489
+	}
1490 1490
 
1491 1491
 	/**
1492 1492
 	 * Add the current_page class to that page in the form nav
@@ -1502,35 +1502,35 @@  discard block
 block discarded – undo
1502 1502
 		}
1503 1503
 	}
1504 1504
 
1505
-    /**
1506
-     * Prepare and json_encode post content
1507
-     *
1508
-     * @since 2.0
1509
-     *
1510
-     * @param array $post_content
1511
-     * @return string $post_content ( json encoded array )
1512
-     */
1513
-    public static function prepare_and_encode( $post_content ) {
1514
-        //Loop through array to strip slashes and add only the needed ones
1505
+	/**
1506
+	 * Prepare and json_encode post content
1507
+	 *
1508
+	 * @since 2.0
1509
+	 *
1510
+	 * @param array $post_content
1511
+	 * @return string $post_content ( json encoded array )
1512
+	 */
1513
+	public static function prepare_and_encode( $post_content ) {
1514
+		//Loop through array to strip slashes and add only the needed ones
1515 1515
 		foreach ( $post_content as $key => $val ) {
1516 1516
 			// Replace problematic characters (like &quot;)
1517 1517
 			$val = str_replace( '&quot;', '"', $val );
1518 1518
 
1519 1519
 			self::prepare_action_slashes( $val, $key, $post_content );
1520
-            unset( $key, $val );
1521
-        }
1520
+			unset( $key, $val );
1521
+		}
1522 1522
 
1523
-        // json_encode the array
1524
-        $post_content = json_encode( $post_content );
1523
+		// json_encode the array
1524
+		$post_content = json_encode( $post_content );
1525 1525
 
1526
-	    // add extra slashes for \r\n since WP strips them
1526
+		// add extra slashes for \r\n since WP strips them
1527 1527
 		$post_content = str_replace( array( '\\r', '\\n', '\\u', '\\t' ), array( '\\\\r', '\\\\n', '\\\\u', '\\\\t' ), $post_content );
1528 1528
 
1529
-        // allow for &quot
1530
-	    $post_content = str_replace( '&quot;', '\\"', $post_content );
1529
+		// allow for &quot
1530
+		$post_content = str_replace( '&quot;', '\\"', $post_content );
1531 1531
 
1532
-        return $post_content;
1533
-    }
1532
+		return $post_content;
1533
+	}
1534 1534
 
1535 1535
 	private static function prepare_action_slashes( $val, $key, &$post_content ) {
1536 1536
 		if ( ! isset( $post_content[ $key ] ) ) {
@@ -1553,54 +1553,54 @@  discard block
 block discarded – undo
1553 1553
 
1554 1554
 	public static function maybe_json_decode( $string ) {
1555 1555
 		if ( is_array( $string ) ) {
1556
-            return $string;
1557
-        }
1556
+			return $string;
1557
+		}
1558 1558
 
1559 1559
 		$new_string = json_decode( $string, true );
1560 1560
 		if ( function_exists( 'json_last_error' ) ) {
1561 1561
 			// php 5.3+
1562
-            if ( json_last_error() == JSON_ERROR_NONE ) {
1563
-                $string = $new_string;
1564
-            }
1562
+			if ( json_last_error() == JSON_ERROR_NONE ) {
1563
+				$string = $new_string;
1564
+			}
1565 1565
 		} elseif ( isset( $new_string ) ) {
1566 1566
 			// php < 5.3 fallback
1567
-            $string = $new_string;
1568
-        }
1569
-        return $string;
1570
-    }
1571
-
1572
-    /**
1573
-     * @since 1.07.10
1574
-     *
1575
-     * @param string $post_type The name of the post type that may need to be highlighted
1576
-     * echo The javascript to open and highlight the Formidable menu
1577
-     */
1567
+			$string = $new_string;
1568
+		}
1569
+		return $string;
1570
+	}
1571
+
1572
+	/**
1573
+	 * @since 1.07.10
1574
+	 *
1575
+	 * @param string $post_type The name of the post type that may need to be highlighted
1576
+	 * echo The javascript to open and highlight the Formidable menu
1577
+	 */
1578 1578
 	public static function maybe_highlight_menu( $post_type ) {
1579
-        global $post;
1579
+		global $post;
1580 1580
 
1581 1581
 		if ( isset( $_REQUEST['post_type'] ) && $_REQUEST['post_type'] != $post_type ) {
1582
-            return;
1583
-        }
1582
+			return;
1583
+		}
1584 1584
 
1585 1585
 		if ( is_object( $post ) && $post->post_type != $post_type ) {
1586
-            return;
1587
-        }
1586
+			return;
1587
+		}
1588 1588
 
1589
-        self::load_admin_wide_js();
1590
-        echo '<script type="text/javascript">jQuery(document).ready(function(){frmSelectSubnav();});</script>';
1591
-    }
1589
+		self::load_admin_wide_js();
1590
+		echo '<script type="text/javascript">jQuery(document).ready(function(){frmSelectSubnav();});</script>';
1591
+	}
1592 1592
 
1593
-    /**
1594
-     * Load the JS file on non-Formidable pages in the admin area
1595
-     * @since 2.0
1596
-     */
1593
+	/**
1594
+	 * Load the JS file on non-Formidable pages in the admin area
1595
+	 * @since 2.0
1596
+	 */
1597 1597
 	public static function load_admin_wide_js( $load = true ) {
1598
-        $version = FrmAppHelper::plugin_version();
1598
+		$version = FrmAppHelper::plugin_version();
1599 1599
 		wp_register_script( 'formidable_admin_global', FrmAppHelper::plugin_url() . '/js/formidable_admin_global.js', array( 'jquery' ), $version );
1600 1600
 
1601 1601
 		$global_strings = array(
1602 1602
 			'updating_msg' => __( 'Please wait while your site updates.', 'formidable' ),
1603
-            'deauthorize'  => __( 'Are you sure you want to deauthorize Formidable Forms on this site?', 'formidable' ),
1603
+			'deauthorize'  => __( 'Are you sure you want to deauthorize Formidable Forms on this site?', 'formidable' ),
1604 1604
 			'url'          => FrmAppHelper::plugin_url(),
1605 1605
 			'loading'      => __( 'Loading&hellip;' ),
1606 1606
 			'nonce'        => wp_create_nonce( 'frm_ajax' ),
@@ -1610,7 +1610,7 @@  discard block
 block discarded – undo
1610 1610
 		if ( $load ) {
1611 1611
 			wp_enqueue_script( 'formidable_admin_global' );
1612 1612
 		}
1613
-    }
1613
+	}
1614 1614
 
1615 1615
 	/**
1616 1616
 	 * @since 2.0.9
@@ -1619,9 +1619,9 @@  discard block
 block discarded – undo
1619 1619
 		wp_enqueue_style( 'frm_fonts', self::plugin_url() . '/css/frm_fonts.css', array(), self::plugin_version() );
1620 1620
 	}
1621 1621
 
1622
-    /**
1623
-     * @param string $location
1624
-     */
1622
+	/**
1623
+	 * @param string $location
1624
+	 */
1625 1625
 	public static function localize_script( $location ) {
1626 1626
 		$ajax_url = admin_url( 'admin-ajax.php', is_ssl() ? 'admin' : 'http' );
1627 1627
 		$ajax_url = apply_filters( 'frm_ajax_url', $ajax_url );
@@ -1687,27 +1687,27 @@  discard block
 block discarded – undo
1687 1687
 		}
1688 1688
 	}
1689 1689
 
1690
-    /**
1690
+	/**
1691 1691
 	 * echo the message on the plugins listing page
1692
-     * @since 1.07.10
1693
-     *
1694
-     * @param float $min_version The version the add-on requires
1695
-     */
1692
+	 * @since 1.07.10
1693
+	 *
1694
+	 * @param float $min_version The version the add-on requires
1695
+	 */
1696 1696
 	public static function min_version_notice( $min_version ) {
1697
-        $frm_version = self::plugin_version();
1697
+		$frm_version = self::plugin_version();
1698 1698
 
1699
-        // check if Formidable meets minimum requirements
1699
+		// check if Formidable meets minimum requirements
1700 1700
 		if ( version_compare( $frm_version, $min_version, '>=' ) ) {
1701
-            return;
1702
-        }
1701
+			return;
1702
+		}
1703 1703
 
1704 1704
 		$wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
1705 1705
 		echo '<tr class="plugin-update-tr active"><th colspan="' . absint( $wp_list_table->get_column_count() ) . '" class="check-column plugin-update colspanchange"><div class="update-message">' .
1706
-        esc_html__( 'You are running an outdated version of Formidable. This plugin may not work correctly if you do not update Formidable.', 'formidable' ) .
1707
-        '</div></td></tr>';
1708
-    }
1706
+		esc_html__( 'You are running an outdated version of Formidable. This plugin may not work correctly if you do not update Formidable.', 'formidable' ) .
1707
+		'</div></td></tr>';
1708
+	}
1709 1709
 
1710
-    public static function locales( $type = 'date' ) {
1710
+	public static function locales( $type = 'date' ) {
1711 1711
 		$locales = array(
1712 1712
 			'en' => __( 'English', 'formidable' ),
1713 1713
 			''   => __( 'English/Western', 'formidable' ),
@@ -1786,8 +1786,8 @@  discard block
 block discarded – undo
1786 1786
 		$locales = array_diff_key( $locales, array_flip( $unset ) );
1787 1787
 		$locales = apply_filters( 'frm_locales', $locales );
1788 1788
 
1789
-        return $locales;
1790
-    }
1789
+		return $locales;
1790
+	}
1791 1791
 
1792 1792
 	/**
1793 1793
 	 * Used to filter shortcode in text widgets
Please login to merge, or discard this patch.
classes/helpers/FrmFormsListHelper.php 2 patches
Indentation   +116 added lines, -116 removed lines patch added patch discarded remove patch
@@ -51,21 +51,21 @@  discard block
 block discarded – undo
51 51
 			),
52 52
 		);
53 53
 		switch ( $this->status ) {
54
-		    case 'template':
55
-                $s_query['is_template'] = 1;
56
-                $s_query['status !'] = 'trash';
57
-		        break;
58
-		    case 'draft':
59
-                $s_query['is_template'] = 0;
60
-                $s_query['status'] = 'draft';
61
-		        break;
62
-		    case 'trash':
63
-                $s_query['status'] = 'trash';
64
-		        break;
65
-		    default:
66
-                $s_query['is_template'] = 0;
67
-                $s_query['status !'] = 'trash';
68
-		        break;
54
+			case 'template':
55
+				$s_query['is_template'] = 1;
56
+				$s_query['status !'] = 'trash';
57
+				break;
58
+			case 'draft':
59
+				$s_query['is_template'] = 0;
60
+				$s_query['status'] = 'draft';
61
+				break;
62
+			case 'trash':
63
+				$s_query['status'] = 'trash';
64
+				break;
65
+			default:
66
+				$s_query['is_template'] = 0;
67
+				$s_query['status !'] = 'trash';
68
+				break;
69 69
 		}
70 70
 
71 71
 		$s = self::get_param(
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 				'sanitize' => 'sanitize_text_field',
75 75
 			)
76 76
 		);
77
-	    if ( $s != '' ) {
77
+		if ( $s != '' ) {
78 78
 			preg_match_all( '/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $s, $matches );
79 79
 			$search_terms = array_map( 'trim', $matches[0] );
80 80
 			foreach ( (array) $search_terms as $term ) {
@@ -86,10 +86,10 @@  discard block
 block discarded – undo
86 86
 				);
87 87
 				unset( $term );
88 88
 			}
89
-	    }
89
+		}
90 90
 
91 91
 		$this->items = FrmForm::getAll( $s_query, $orderby . ' ' . $order, $start . ',' . $per_page );
92
-        $total_items = FrmDb::get_count( 'frm_forms', $s_query );
92
+		$total_items = FrmDb::get_count( 'frm_forms', $s_query );
93 93
 
94 94
 		$this->set_pagination_args(
95 95
 			array(
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	}
101 101
 
102 102
 	public function no_items() {
103
-	    if ( 'template' == $this->status ) {
103
+		if ( 'template' == $this->status ) {
104 104
 			esc_html_e( 'No Templates Found.', 'formidable' );
105 105
 		} else {
106 106
 			esc_html_e( 'No Forms Found.', 'formidable' );
@@ -111,29 +111,29 @@  discard block
 block discarded – undo
111 111
 	}
112 112
 
113 113
 	public function get_bulk_actions() {
114
-	    $actions = array();
114
+		$actions = array();
115 115
 
116
-	    if ( 'trash' == $this->status ) {
116
+		if ( 'trash' == $this->status ) {
117 117
 			if ( current_user_can( 'frm_edit_forms' ) ) {
118
-	            $actions['bulk_untrash'] = __( 'Restore', 'formidable' );
119
-	        }
118
+				$actions['bulk_untrash'] = __( 'Restore', 'formidable' );
119
+			}
120 120
 
121 121
 			if ( current_user_can( 'frm_delete_forms' ) ) {
122
-	            $actions['bulk_delete'] = __( 'Delete Permanently', 'formidable' );
123
-	        }
122
+				$actions['bulk_delete'] = __( 'Delete Permanently', 'formidable' );
123
+			}
124 124
 		} elseif ( EMPTY_TRASH_DAYS && current_user_can( 'frm_delete_forms' ) ) {
125
-	        $actions['bulk_trash'] = __( 'Move to Trash', 'formidable' );
125
+			$actions['bulk_trash'] = __( 'Move to Trash', 'formidable' );
126 126
 		} elseif ( current_user_can( 'frm_delete_forms' ) ) {
127 127
 			$actions['bulk_delete'] = __( 'Delete' );
128
-	    }
128
+		}
129 129
 
130
-        return $actions;
131
-    }
130
+		return $actions;
131
+	}
132 132
 
133 133
 	public function extra_tablenav( $which ) {
134
-        if ( 'top' != $which ) {
135
-            return;
136
-        }
134
+		if ( 'top' != $which ) {
135
+			return;
136
+		}
137 137
 
138 138
 		if ( 'trash' == $this->status && current_user_can( 'frm_delete_forms' ) ) {
139 139
 ?>
@@ -141,21 +141,21 @@  discard block
 block discarded – undo
141 141
 			<?php submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false ); ?>
142 142
             </div>
143 143
 <?php
144
-            return;
145
-        }
144
+			return;
145
+		}
146 146
 
147
-        if ( 'template' != $this->status ) {
148
-            return;
149
-        }
147
+		if ( 'template' != $this->status ) {
148
+			return;
149
+		}
150 150
 
151 151
 		$where = apply_filters( 'frm_forms_dropdown', array(), '' );
152 152
 		$forms = FrmForm::get_published_forms( $where );
153 153
 
154 154
 		$base = admin_url( 'admin.php?page=formidable&form_type=template' );
155
-        $args = array(
156
-            'frm_action'    => 'duplicate',
157
-            'template'      => true,
158
-        );
155
+		$args = array(
156
+			'frm_action'    => 'duplicate',
157
+			'template'      => true,
158
+		);
159 159
 
160 160
 ?>
161 161
     <div class="alignleft actions frm_visible_overflow">
@@ -167,16 +167,16 @@  discard block
 block discarded – undo
167 167
 		?>
168 168
 			<li class="frm_dropdown_li"><?php esc_html_e( 'You have not created any forms yet. You must create a form before you can make a template.', 'formidable' ) ?></li>
169 169
         <?php
170
-        } else {
171
-            foreach ( $forms as $form ) {
170
+		} else {
171
+			foreach ( $forms as $form ) {
172 172
 				$args['id'] = $form->id;
173 173
 				?>
174 174
 			<li><a href="<?php echo esc_url( add_query_arg( $args, $base ) ); ?>" tabindex="-1"><?php echo esc_html( empty( $form->name ) ? __( '(no title)' ) : FrmAppHelper::truncate( $form->name, 33 ) ); ?></a></li>
175 175
 			<?php
176 176
 				unset( $form );
177 177
 			}
178
-        }
179
-        ?>
178
+		}
179
+		?>
180 180
 		</ul>
181 181
 	</div>
182 182
 	</div>
@@ -186,14 +186,14 @@  discard block
 block discarded – undo
186 186
 	public function get_views() {
187 187
 
188 188
 		$statuses = array(
189
-		    'published' => __( 'My Forms', 'formidable' ),
190
-		    'template'  => __( 'Templates', 'formidable' ),
191
-		    'draft'     => __( 'Drafts', 'formidable' ),
192
-		    'trash'     => __( 'Trash', 'formidable' ),
189
+			'published' => __( 'My Forms', 'formidable' ),
190
+			'template'  => __( 'Templates', 'formidable' ),
191
+			'draft'     => __( 'Drafts', 'formidable' ),
192
+			'trash'     => __( 'Trash', 'formidable' ),
193 193
 		);
194 194
 
195
-	    $links = array();
196
-	    $counts = FrmForm::get_count();
195
+		$links = array();
196
+		$counts = FrmForm::get_count();
197 197
 		$form_type = self::get_param(
198 198
 			array(
199 199
 				'param' => 'form_type',
@@ -201,20 +201,20 @@  discard block
 block discarded – undo
201 201
 			)
202 202
 		);
203 203
 
204
-	    foreach ( $statuses as $status => $name ) {
204
+		foreach ( $statuses as $status => $name ) {
205 205
 
206
-	        if ( $status == $form_type ) {
207
-    			$class = ' class="current"';
208
-    		} else {
209
-    		    $class = '';
210
-    		}
206
+			if ( $status == $form_type ) {
207
+				$class = ' class="current"';
208
+			} else {
209
+				$class = '';
210
+			}
211 211
 
212
-    		if ( $counts->{$status} || 'published' == $status || 'template' == $status ) {
212
+			if ( $counts->{$status} || 'published' == $status || 'template' == $status ) {
213 213
 				$links[ $status ] = '<a href="' . esc_url( '?page=formidable&form_type=' . $status ) . '" ' . $class . '>' . sprintf( __( '%1$s <span class="count">(%2$s)</span>', 'formidable' ), $name, number_format_i18n( $counts->{$status} ) ) . '</a>';
214
-		    }
214
+			}
215 215
 
216 216
 			unset( $status, $name );
217
-	    }
217
+		}
218 218
 
219 219
 		return $links;
220 220
 	}
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 	}
231 231
 
232 232
 	public function single_row( $item, $style = '' ) {
233
-	    global $frm_vars, $mode;
233
+		global $frm_vars, $mode;
234 234
 
235 235
 		// Set up the hover actions for this user
236 236
 		$actions = array();
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 
239 239
 		$this->get_actions( $actions, $item, $edit_link );
240 240
 
241
-        $action_links = $this->row_actions( $actions );
241
+		$action_links = $this->row_actions( $actions );
242 242
 
243 243
 		// Set up the checkbox ( because the user is editable, otherwise its empty )
244 244
 		$checkbox = '<input type="checkbox" name="item-action[]" id="cb-item-action-' . absint( $item->id ) . '" value="' . esc_attr( $item->id ) . '" />';
@@ -247,9 +247,9 @@  discard block
 block discarded – undo
247 247
 
248 248
 		list( $columns, $hidden ) = $this->get_column_info();
249 249
 
250
-        $format = 'Y/m/d';
251
-        if ( 'list' != $mode ) {
252
-            $format .= ' \<\b\r \/\> g:i:s a';
250
+		$format = 'Y/m/d';
251
+		if ( 'list' != $mode ) {
252
+			$format .= ' \<\b\r \/\> g:i:s a';
253 253
 		}
254 254
 
255 255
 		foreach ( $columns as $column_name => $column_display_name ) {
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 
258 258
 			$style = '';
259 259
 			if ( in_array( $column_name, $hidden ) ) {
260
-                $class .= ' frm_hidden';
260
+				$class .= ' frm_hidden';
261 261
 			}
262 262
 
263 263
 			$class = 'class="' . esc_attr( $class ) . '"';
@@ -270,24 +270,24 @@  discard block
 block discarded – undo
270 270
 					break;
271 271
 				case 'id':
272 272
 				case 'form_key':
273
-				    $val = $item->{$column_name};
274
-				    break;
273
+					$val = $item->{$column_name};
274
+					break;
275 275
 				case 'name':
276
-				    $val = $this->get_form_name( $item, $actions, $edit_link, $mode );
277
-			        $val .= $action_links;
276
+					$val = $this->get_form_name( $item, $actions, $edit_link, $mode );
277
+					$val .= $action_links;
278 278
 
279
-				    break;
279
+					break;
280 280
 				case 'created_at':
281 281
 					$date = date( $format, strtotime( $item->created_at ) );
282 282
 					$val = '<abbr title="' . esc_attr( date( 'Y/m/d g:i:s A', strtotime( $item->created_at ) ) ) . '">' . $date . '</abbr>';
283 283
 					break;
284 284
 				case 'shortcode':
285 285
 					$val = '<input type="text" readonly="readonly" class="frm_select_box" value="' . esc_attr( '[formidable id=' . $item->id . ']' ) . '" /><br/>';
286
-				    if ( 'excerpt' == $mode ) {
286
+					if ( 'excerpt' == $mode ) {
287 287
 						$val .= '<input type="text" readonly="readonly" class="frm_select_box" value="' . esc_attr( '[formidable key=' . $item->form_key . ']' ) . '" />';
288
-				    }
289
-			        break;
290
-			    case 'entries':
288
+					}
289
+					break;
290
+				case 'entries':
291 291
 					if ( isset( $item->options['no_save'] ) && $item->options['no_save'] ) {
292 292
 						$val = '<i class="frm_icon_font frm_forbid_icon frm_bstooltip" title="' . esc_attr( 'Saving entries is disabled for this form', 'formidable' ) . '"></i>';
293 293
 					} else {
@@ -295,16 +295,16 @@  discard block
 block discarded – undo
295 295
 						$val = current_user_can( 'frm_view_entries' ) ? '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-entries&form=' . $item->id ) ) . '">' . $text . '</a>' : $text;
296 296
 						unset( $text );
297 297
 					}
298
-			        break;
299
-                case 'type':
300
-                    $val = ( $item->is_template && $item->default_template ) ? __( 'Default', 'formidable' ) : __( 'Custom', 'formidable' );
301
-                    break;
298
+					break;
299
+				case 'type':
300
+					$val = ( $item->is_template && $item->default_template ) ? __( 'Default', 'formidable' ) : __( 'Custom', 'formidable' );
301
+					break;
302 302
 			}
303 303
 
304 304
 			if ( isset( $val ) ) {
305
-			    $r .= "<td $attributes>";
306
-			    $r .= $val;
307
-			    $r .= '</td>';
305
+				$r .= "<td $attributes>";
306
+				$r .= $val;
307
+				$r .= '</td>';
308 308
 			}
309 309
 			unset( $val );
310 310
 		}
@@ -313,9 +313,9 @@  discard block
 block discarded – undo
313 313
 		return $r;
314 314
 	}
315 315
 
316
-    /**
317
-     * @param string $edit_link
318
-     */
316
+	/**
317
+	 * @param string $edit_link
318
+	 */
319 319
 	private function get_actions( &$actions, $item, $edit_link ) {
320 320
 		$new_actions = FrmFormsHelper::get_action_links( $item->id, $item );
321 321
 		foreach ( $new_actions as $link => $action ) {
@@ -339,13 +339,13 @@  discard block
 block discarded – undo
339 339
 
340 340
 		$actions = array_merge( $actions, $new_actions );
341 341
 		$actions['view'] = '<a href="' . esc_url( FrmFormsHelper::get_direct_link( $item->form_key, $item ) ) . '" target="_blank">' . __( 'Preview' ) . '</a>';
342
-    }
342
+	}
343 343
 
344
-    /**
345
-     * @param string $edit_link
346
-     */
344
+	/**
345
+	 * @param string $edit_link
346
+	 */
347 347
 	private function get_form_name( $item, $actions, $edit_link, $mode = 'list' ) {
348
-        $form_name = $item->name;
348
+		$form_name = $item->name;
349 349
 		if ( trim( $form_name ) == '' ) {
350 350
 			$form_name = __( '(no title)' );
351 351
 		}
@@ -354,37 +354,37 @@  discard block
 block discarded – undo
354 354
 			$form_name = FrmAppHelper::truncate( $form_name, 50 );
355 355
 		}
356 356
 
357
-        $val = '<strong>';
358
-        if ( 'trash' == $this->status ) {
359
-            $val .= $form_name;
360
-        } else {
357
+		$val = '<strong>';
358
+		if ( 'trash' == $this->status ) {
359
+			$val .= $form_name;
360
+		} else {
361 361
 			$val .= '<a href="' . esc_url( isset( $actions['frm_edit'] ) ? $edit_link : FrmFormsHelper::get_direct_link( $item->form_key, $item ) ) . '" class="row-title">' . FrmAppHelper::kses( $form_name ) . '</a> ';
362
-        }
362
+		}
363 363
 
364
-        $this->add_draft_label( $item, $val );
365
-        $val .= '</strong>';
364
+		$this->add_draft_label( $item, $val );
365
+		$val .= '</strong>';
366 366
 
367
-        $this->add_form_description( $item, $val );
367
+		$this->add_form_description( $item, $val );
368 368
 
369
-        return $val;
370
-    }
369
+		return $val;
370
+	}
371 371
 
372
-    /**
373
-     * @param string $val
374
-     */
375
-    private function add_draft_label( $item, &$val ) {
376
-        if ( 'draft' == $item->status && 'draft' != $this->status ) {
372
+	/**
373
+	 * @param string $val
374
+	 */
375
+	private function add_draft_label( $item, &$val ) {
376
+		if ( 'draft' == $item->status && 'draft' != $this->status ) {
377 377
 			$val .= ' - <span class="post-state">' . __( 'Draft', 'formidable' ) . '</span>';
378
-        }
379
-    }
380
-
381
-    /**
382
-     * @param string $val
383
-     */
384
-    private function add_form_description( $item, &$val ) {
385
-        global $mode;
386
-        if ( 'excerpt' == $mode ) {
378
+		}
379
+	}
380
+
381
+	/**
382
+	 * @param string $val
383
+	 */
384
+	private function add_form_description( $item, &$val ) {
385
+		global $mode;
386
+		if ( 'excerpt' == $mode ) {
387 387
 			$val .= FrmAppHelper::truncate( strip_tags( $item->description ), 50 );
388
-        }
389
-    }
388
+		}
389
+	}
390 390
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 		$page = $this->get_pagenum();
19 19
 		$per_page = $this->get_items_per_page( 'formidable_page_formidable_per_page' );
20 20
 
21
-		$mode    = self::get_param(
21
+		$mode = self::get_param(
22 22
 			array(
23 23
 				'param'   => 'mode',
24 24
 				'default' => 'list',
@@ -30,13 +30,13 @@  discard block
 block discarded – undo
30 30
 				'default' => 'name',
31 31
 			)
32 32
 		);
33
-		$order   = self::get_param(
33
+		$order = self::get_param(
34 34
 			array(
35 35
 				'param'   => 'order',
36 36
 				'default' => 'ASC',
37 37
 			)
38 38
 		);
39
-		$start   = self::get_param(
39
+		$start = self::get_param(
40 40
 			array(
41 41
 				'param'   => 'start',
42 42
 				'default' => ( $page - 1 ) * $per_page,
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
     		}
211 211
 
212 212
     		if ( $counts->{$status} || 'published' == $status || 'template' == $status ) {
213
-				$links[ $status ] = '<a href="' . esc_url( '?page=formidable&form_type=' . $status ) . '" ' . $class . '>' . sprintf( __( '%1$s <span class="count">(%2$s)</span>', 'formidable' ), $name, number_format_i18n( $counts->{$status} ) ) . '</a>';
213
+				$links[$status] = '<a href="' . esc_url( '?page=formidable&form_type=' . $status ) . '" ' . $class . '>' . sprintf( __( '%1$s <span class="count">(%2$s)</span>', 'formidable' ), $name, number_format_i18n( $counts->{$status} ) ) . '</a>';
214 214
 		    }
215 215
 
216 216
 			unset( $status, $name );
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 	private function get_actions( &$actions, $item, $edit_link ) {
320 320
 		$new_actions = FrmFormsHelper::get_action_links( $item->id, $item );
321 321
 		foreach ( $new_actions as $link => $action ) {
322
-			$new_actions[ $link ] = FrmFormsHelper::format_link_html( $action, 'short' );
322
+			$new_actions[$link] = FrmFormsHelper::format_link_html( $action, 'short' );
323 323
 		}
324 324
 
325 325
 		if ( 'trash' == $this->status ) {
Please login to merge, or discard this patch.
classes/controllers/FrmEntriesController.php 2 patches
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -101,19 +101,19 @@  discard block
 block discarded – undo
101 101
         global $frm_vars;
102 102
 		$form_id = FrmForm::get_current_form_id();
103 103
 
104
-		$columns[ $form_id . '_id' ] = 'ID';
105
-		$columns[ $form_id . '_item_key' ] = esc_html__( 'Entry Key', 'formidable' );
104
+		$columns[$form_id . '_id'] = 'ID';
105
+		$columns[$form_id . '_item_key'] = esc_html__( 'Entry Key', 'formidable' );
106 106
 
107 107
 		if ( $form_id ) {
108 108
 			self::get_columns_for_form( $form_id, $columns );
109 109
 		} else {
110
-			$columns[ $form_id . '_form_id' ] = __( 'Form', 'formidable' );
111
-			$columns[ $form_id . '_name' ] = __( 'Entry Name', 'formidable' );
112
-			$columns[ $form_id . '_user_id' ] = __( 'Created By', 'formidable' );
110
+			$columns[$form_id . '_form_id'] = __( 'Form', 'formidable' );
111
+			$columns[$form_id . '_name'] = __( 'Entry Name', 'formidable' );
112
+			$columns[$form_id . '_user_id'] = __( 'Created By', 'formidable' );
113 113
 		}
114 114
 
115
-		$columns[ $form_id . '_created_at' ] = __( 'Entry creation date', 'formidable' );
116
-		$columns[ $form_id . '_updated_at' ] = __( 'Entry update date', 'formidable' );
115
+		$columns[$form_id . '_created_at'] = __( 'Entry creation date', 'formidable' );
116
+		$columns[$form_id . '_updated_at'] = __( 'Entry update date', 'formidable' );
117 117
 		self::maybe_add_ip_col( $form_id, $columns );
118 118
 
119 119
         $frm_vars['cols'] = $columns;
@@ -161,10 +161,10 @@  discard block
 block discarded – undo
161 161
 
162 162
 		foreach ( $sub_form_cols as $k => $sub_form_col ) {
163 163
 			if ( FrmField::is_no_save_field( $sub_form_col->type ) ) {
164
-				unset( $sub_form_cols[ $k ] );
164
+				unset( $sub_form_cols[$k] );
165 165
 				continue;
166 166
 			}
167
-			$columns[ $form_id . '_' . $sub_form_col->field_key . '-_-' . $field->id ] = FrmAppHelper::truncate( $sub_form_col->name, 35 );
167
+			$columns[$form_id . '_' . $sub_form_col->field_key . '-_-' . $field->id] = FrmAppHelper::truncate( $sub_form_col->name, 35 );
168 168
 			unset( $sub_form_col );
169 169
 		}
170 170
 	}
@@ -181,15 +181,15 @@  discard block
 block discarded – undo
181 181
 		$has_separate_value = ! FrmField::is_option_empty( $field, 'separate_value' );
182 182
 		$is_post_status     = FrmField::is_option_true( $field, 'post_field' ) && $field->field_options['post_field'] == 'post_status';
183 183
 		if ( $has_separate_value && ! $is_post_status ) {
184
-			$columns[ $form_id . '_frmsep_' . $col_id ] = FrmAppHelper::truncate( $field->name, 35 );
184
+			$columns[$form_id . '_frmsep_' . $col_id] = FrmAppHelper::truncate( $field->name, 35 );
185 185
 		}
186 186
 
187
-		$columns[ $form_id . '_' . $col_id ] = FrmAppHelper::truncate( $field->name, 35 );
187
+		$columns[$form_id . '_' . $col_id] = FrmAppHelper::truncate( $field->name, 35 );
188 188
 	}
189 189
 
190 190
 	private static function maybe_add_ip_col( $form_id, &$columns ) {
191 191
 		if ( FrmAppHelper::ips_saved() ) {
192
-			$columns[ $form_id . '_ip' ] = 'IP';
192
+			$columns[$form_id . '_ip'] = 'IP';
193 193
 		}
194 194
 	}
195 195
 
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
         foreach ( $meta_value as $mk => $mv ) {
226 226
             //remove blank values
227 227
             if ( empty( $mv ) ) {
228
-                unset( $meta_value[ $mk ] );
228
+                unset( $meta_value[$mk] );
229 229
             }
230 230
         }
231 231
 
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 		foreach ( $fields as $field ) {
300 300
 			if ( $field->type != 'checkbox' && ( ! isset( $field->field_options['post_field'] ) || $field->field_options['post_field'] == '' ) ) {
301 301
 				// Can't sort on checkboxes because they are stored serialized, or post fields
302
-				$columns[ $form_id . '_' . $field->field_key ] = 'meta_' . $field->id;
302
+				$columns[$form_id . '_' . $field->field_key] = 'meta_' . $field->id;
303 303
 			}
304 304
 		}
305 305
 
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 
374 374
 			if ( empty( $result ) || ! in_array( $col_key, $result, true ) ) {
375 375
 				$result[] = $col_key;
376
-				$i--;
376
+				$i --;
377 377
 			}
378 378
 
379 379
 			unset( $col_key, $col );
@@ -587,9 +587,9 @@  discard block
 block discarded – undo
587 587
         if ( ! isset( $frm_vars['form_params'] ) ) {
588 588
             $frm_vars['form_params'] = array();
589 589
         }
590
-		$frm_vars['form_params'][ $form->id ] = $params;
590
+		$frm_vars['form_params'][$form->id] = $params;
591 591
 
592
-		if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) {
592
+		if ( isset( $frm_vars['created_entries'][$form_id] ) ) {
593 593
             return;
594 594
         }
595 595
 
@@ -604,15 +604,15 @@  discard block
 block discarded – undo
604 604
 		 */
605 605
 		$errors = apply_filters( 'frm_entries_before_create', $errors, $form );
606 606
 
607
-		$frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors );
607
+		$frm_vars['created_entries'][$form_id] = array( 'errors' => $errors );
608 608
 
609 609
         if ( empty( $errors ) ) {
610 610
 			$_POST['frm_skip_cookie'] = 1;
611 611
 			$do_success = false;
612 612
             if ( $params['action'] == 'create' ) {
613
-				if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) {
614
-					$frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST );
615
-					$params['id'] = $frm_vars['created_entries'][ $form_id ]['entry_id'];
613
+				if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][$form_id]['entry_id'] ) ) {
614
+					$frm_vars['created_entries'][$form_id]['entry_id'] = FrmEntry::create( $_POST );
615
+					$params['id'] = $frm_vars['created_entries'][$form_id]['entry_id'];
616 616
 					$do_success = true;
617 617
                 }
618 618
             }
Please login to merge, or discard this patch.
Indentation   +165 added lines, -165 removed lines patch added patch discarded remove patch
@@ -26,38 +26,38 @@  discard block
 block discarded – undo
26 26
 		}
27 27
 	}
28 28
 
29
-    /* Display in Back End */
30
-    public static function route() {
29
+	/* Display in Back End */
30
+	public static function route() {
31 31
 		$action = FrmAppHelper::get_param( 'frm_action', '', 'get', 'sanitize_title' );
32 32
 
33
-        switch ( $action ) {
34
-            case 'show':
35
-            case 'destroy':
36
-            case 'destroy_all':
37
-                return self::$action();
33
+		switch ( $action ) {
34
+			case 'show':
35
+			case 'destroy':
36
+			case 'destroy_all':
37
+				return self::$action();
38 38
 
39
-            default:
40
-                do_action( 'frm_entry_action_route', $action );
41
-                if ( apply_filters( 'frm_entry_stop_action_route', false, $action ) ) {
42
-                    return;
43
-                }
39
+			default:
40
+				do_action( 'frm_entry_action_route', $action );
41
+				if ( apply_filters( 'frm_entry_stop_action_route', false, $action ) ) {
42
+					return;
43
+				}
44 44
 
45
-                return self::display_list();
46
-        }
47
-    }
45
+				return self::display_list();
46
+		}
47
+	}
48 48
 
49 49
 	public static function contextual_help( $help, $screen_id, $screen ) {
50
-        // Only add to certain screens. add_help_tab was introduced in WordPress 3.3
51
-        if ( ! method_exists( $screen, 'add_help_tab' ) ) {
52
-            return $help;
53
-        }
50
+		// Only add to certain screens. add_help_tab was introduced in WordPress 3.3
51
+		if ( ! method_exists( $screen, 'add_help_tab' ) ) {
52
+			return $help;
53
+		}
54 54
 
55 55
 		$action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );
56 56
 		$page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
57 57
 		$show_help = ( $page == 'formidable-entries' && ( empty( $action ) || $action == 'list' ) );
58 58
 		if ( ! $show_help ) {
59
-            return $help;
60
-        }
59
+			return $help;
60
+		}
61 61
 
62 62
 		unset( $action, $page );
63 63
 
@@ -73,14 +73,14 @@  discard block
 block discarded – undo
73 73
 			)
74 74
 		);
75 75
 
76
-        $screen->set_help_sidebar(
76
+		$screen->set_help_sidebar(
77 77
 			'<p><strong>' . esc_html__( 'For more information:', 'formidable' ) . '</strong></p>' .
78 78
 			'<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidableforms.com/knowledgebase/manage-entries-from-the-back-end/?utm_source=WordPress&utm_medium=entries&utm_campaign=liteplugin' ) ) . '" target="_blank">' . esc_html__( 'Documentation on Entries', 'formidable' ) . '</a></p>' .
79 79
 			'<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidableforms.com/support/?utm_source=WordPress&utm_medium=entries&utm_campaign=liteplugin' ) ) . '" target="_blank">' . esc_html__( 'Support', 'formidable' ) . '</a></p>'
80
-    	);
80
+		);
81 81
 
82
-        return $help;
83
-    }
82
+		return $help;
83
+	}
84 84
 
85 85
 	/**
86 86
 	 * Prevent the "screen options" tab from showing when
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	}
99 99
 
100 100
 	public static function manage_columns( $columns ) {
101
-        global $frm_vars;
101
+		global $frm_vars;
102 102
 		$form_id = FrmForm::get_current_form_id();
103 103
 
104 104
 		$columns[ $form_id . '_id' ] = 'ID';
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 		$columns[ $form_id . '_updated_at' ] = __( 'Entry update date', 'formidable' );
117 117
 		self::maybe_add_ip_col( $form_id, $columns );
118 118
 
119
-        $frm_vars['cols'] = $columns;
119
+		$frm_vars['cols'] = $columns;
120 120
 
121 121
 		$action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );
122 122
 		if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) && in_array( $action, array( '', 'list', 'destroy' ) ) ) {
@@ -128,10 +128,10 @@  discard block
 block discarded – undo
128 128
 					'option'  => 'formidable_page_formidable_entries_per_page',
129 129
 				)
130 130
 			);
131
-        }
131
+		}
132 132
 
133
-        return $columns;
134
-    }
133
+		return $columns;
134
+	}
135 135
 
136 136
 	private static function get_columns_for_form( $form_id, &$columns ) {
137 137
 		$form_cols = FrmField::get_all_for_form( $form_id, '', 'include' );
@@ -196,67 +196,67 @@  discard block
 block discarded – undo
196 196
 	public static function check_hidden_cols( $check, $object_id, $meta_key, $meta_value, $prev_value ) {
197 197
 		$this_page_name = self::hidden_column_key();
198 198
 		if ( $meta_key != $this_page_name || $meta_value == $prev_value ) {
199
-            return $check;
200
-        }
199
+			return $check;
200
+		}
201 201
 
202 202
 		if ( empty( $prev_value ) ) {
203 203
 			$prev_value = get_metadata( 'user', $object_id, $meta_key, true );
204 204
 		}
205 205
 
206
-        global $frm_vars;
206
+		global $frm_vars;
207 207
 		//add a check so we don't create a loop
208 208
 		$frm_vars['prev_hidden_cols'] = ( isset( $frm_vars['prev_hidden_cols'] ) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value;
209 209
 
210
-        return $check;
211
-    }
210
+		return $check;
211
+	}
212 212
 
213
-    //add hidden columns back from other forms
213
+	//add hidden columns back from other forms
214 214
 	public static function update_hidden_cols( $meta_id, $object_id, $meta_key, $meta_value ) {
215 215
 		$this_page_name = self::hidden_column_key();
216 216
 		if ( $meta_key != $this_page_name ) {
217
-            return;
218
-        }
217
+			return;
218
+		}
219 219
 
220 220
 		global $frm_vars;
221 221
 		if ( ! isset( $frm_vars['prev_hidden_cols'] ) || ! $frm_vars['prev_hidden_cols'] ) {
222 222
 			return; //don't continue if there's no previous value
223 223
 		}
224 224
 
225
-        foreach ( $meta_value as $mk => $mv ) {
226
-            //remove blank values
227
-            if ( empty( $mv ) ) {
228
-                unset( $meta_value[ $mk ] );
229
-            }
230
-        }
225
+		foreach ( $meta_value as $mk => $mv ) {
226
+			//remove blank values
227
+			if ( empty( $mv ) ) {
228
+				unset( $meta_value[ $mk ] );
229
+			}
230
+		}
231 231
 
232 232
 		$cur_form_prefix = reset( $meta_value );
233 233
 		$cur_form_prefix = explode( '_', $cur_form_prefix );
234
-        $cur_form_prefix = $cur_form_prefix[0];
235
-        $save = false;
234
+		$cur_form_prefix = $cur_form_prefix[0];
235
+		$save = false;
236 236
 
237
-        foreach ( (array) $frm_vars['prev_hidden_cols'] as $prev_hidden ) {
237
+		foreach ( (array) $frm_vars['prev_hidden_cols'] as $prev_hidden ) {
238 238
 			if ( empty( $prev_hidden ) || in_array( $prev_hidden, $meta_value ) ) {
239
-                //don't add blank cols or process included cols
240
-                continue;
241
-            }
239
+				//don't add blank cols or process included cols
240
+				continue;
241
+			}
242 242
 
243 243
 			$form_prefix = explode( '_', $prev_hidden );
244
-            $form_prefix = $form_prefix[0];
245
-            if ( $form_prefix == $cur_form_prefix ) {
246
-                //don't add back columns that are meant to be hidden
247
-                continue;
248
-            }
249
-
250
-            $meta_value[] = $prev_hidden;
251
-            $save = true;
244
+			$form_prefix = $form_prefix[0];
245
+			if ( $form_prefix == $cur_form_prefix ) {
246
+				//don't add back columns that are meant to be hidden
247
+				continue;
248
+			}
249
+
250
+			$meta_value[] = $prev_hidden;
251
+			$save = true;
252 252
 			unset( $form_prefix );
253
-        }
253
+		}
254 254
 
255 255
 		if ( $save ) {
256 256
 			$user_id = get_current_user_id();
257 257
 			update_user_option( $user_id, $this_page_name, $meta_value, true );
258
-        }
259
-    }
258
+		}
259
+	}
260 260
 
261 261
 	/**
262 262
 	 * @since 2.05.07
@@ -277,11 +277,11 @@  discard block
 block discarded – undo
277 277
 	}
278 278
 
279 279
 	public static function save_per_page( $save, $option, $value ) {
280
-        if ( $option == 'formidable_page_formidable_entries_per_page' ) {
281
-            $save = (int) $value;
282
-        }
283
-        return $save;
284
-    }
280
+		if ( $option == 'formidable_page_formidable_entries_per_page' ) {
281
+			$save = (int) $value;
282
+		}
283
+		return $save;
284
+	}
285 285
 
286 286
 	public static function sortable_columns() {
287 287
 		$form_id = FrmForm::get_current_form_id();
@@ -381,43 +381,43 @@  discard block
 block discarded – undo
381 381
 	}
382 382
 
383 383
 	public static function display_list( $message = '', $errors = array() ) {
384
-        global $wpdb, $frm_vars;
384
+		global $wpdb, $frm_vars;
385 385
 
386 386
 		$form = FrmForm::maybe_get_current_form();
387 387
 		$params = FrmForm::get_admin_params( $form );
388 388
 
389
-        if ( $form ) {
390
-            $params['form'] = $form->id;
391
-            $frm_vars['current_form'] = $form;
389
+		if ( $form ) {
390
+			$params['form'] = $form->id;
391
+			$frm_vars['current_form'] = $form;
392 392
 
393 393
 			self::get_delete_form_time( $form, $errors );
394 394
 		}
395 395
 
396
-        $table_class = apply_filters( 'frm_entries_list_class', 'FrmEntriesListHelper' );
396
+		$table_class = apply_filters( 'frm_entries_list_class', 'FrmEntriesListHelper' );
397 397
 
398
-        $wp_list_table = new $table_class( array( 'params' => $params ) );
398
+		$wp_list_table = new $table_class( array( 'params' => $params ) );
399 399
 
400
-        $pagenum = $wp_list_table->get_pagenum();
400
+		$pagenum = $wp_list_table->get_pagenum();
401 401
 
402
-        $wp_list_table->prepare_items();
402
+		$wp_list_table->prepare_items();
403 403
 
404
-        $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
405
-        if ( $pagenum > $total_pages && $total_pages > 0 ) {
404
+		$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
405
+		if ( $pagenum > $total_pages && $total_pages > 0 ) {
406 406
 			$url = add_query_arg( 'paged', $total_pages );
407
-            if ( headers_sent() ) {
407
+			if ( headers_sent() ) {
408 408
 				echo FrmAppHelper::js_redirect( $url ); // WPCS: XSS ok.
409
-            } else {
410
-                wp_redirect( esc_url_raw( $url ) );
411
-            }
412
-            die();
413
-        }
409
+			} else {
410
+				wp_redirect( esc_url_raw( $url ) );
411
+			}
412
+			die();
413
+		}
414 414
 
415 415
 		if ( empty( $message ) && isset( $_GET['import-message'] ) ) {
416
-            $message = __( 'Your import is complete', 'formidable' );
417
-        }
416
+			$message = __( 'Your import is complete', 'formidable' );
417
+		}
418 418
 
419 419
 		require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/list.php' );
420
-    }
420
+	}
421 421
 
422 422
 	private static function get_delete_form_time( $form, &$errors ) {
423 423
 		if ( 'trash' == $form->status ) {
@@ -427,17 +427,17 @@  discard block
 block discarded – undo
427 427
 		}
428 428
 	}
429 429
 
430
-    /* Back End CRUD */
430
+	/* Back End CRUD */
431 431
 	public static function show( $id = 0 ) {
432 432
 		FrmAppHelper::permission_check( 'frm_view_entries' );
433 433
 
434
-        if ( ! $id ) {
434
+		if ( ! $id ) {
435 435
 			$id = FrmAppHelper::get_param( 'id', 0, 'get', 'absint' );
436 436
 
437
-            if ( ! $id ) {
437
+			if ( ! $id ) {
438 438
 				$id = FrmAppHelper::get_param( 'item_id', 0, 'get', 'absint' );
439
-            }
440
-        }
439
+			}
440
+		}
441 441
 
442 442
 		$entry = FrmEntry::getOne( $id, true );
443 443
 		if ( ! $entry ) {
@@ -453,63 +453,63 @@  discard block
 block discarded – undo
453 453
 		}
454 454
 
455 455
 		$fields = FrmField::get_all_for_form( $entry->form_id, '', 'include' );
456
-        $to_emails = array();
456
+		$to_emails = array();
457 457
 		$form = FrmForm::getOne( $entry->form_id );
458 458
 
459 459
 		include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/show.php' );
460
-    }
460
+	}
461 461
 
462
-    public static function destroy() {
462
+	public static function destroy() {
463 463
 		FrmAppHelper::permission_check( 'frm_delete_entries' );
464 464
 
465 465
 		$params = FrmForm::get_admin_params();
466 466
 
467 467
 		if ( isset( $params['keep_post'] ) && $params['keep_post'] ) {
468 468
 			self::unlink_post( $params['id'] );
469
-        }
469
+		}
470 470
 
471
-        $message = '';
472
-        if ( FrmEntry::destroy( $params['id'] ) ) {
473
-            $message = __( 'Entry was Successfully Destroyed', 'formidable' );
474
-        }
471
+		$message = '';
472
+		if ( FrmEntry::destroy( $params['id'] ) ) {
473
+			$message = __( 'Entry was Successfully Destroyed', 'formidable' );
474
+		}
475 475
 
476
-        self::display_list( $message );
477
-    }
476
+		self::display_list( $message );
477
+	}
478 478
 
479
-    public static function destroy_all() {
480
-        if ( ! current_user_can( 'frm_delete_entries' ) ) {
481
-            $frm_settings = FrmAppHelper::get_settings();
482
-            wp_die( esc_html( $frm_settings->admin_permission ) );
483
-        }
479
+	public static function destroy_all() {
480
+		if ( ! current_user_can( 'frm_delete_entries' ) ) {
481
+			$frm_settings = FrmAppHelper::get_settings();
482
+			wp_die( esc_html( $frm_settings->admin_permission ) );
483
+		}
484 484
 
485 485
 		$params = FrmForm::get_admin_params();
486
-        $message = '';
487
-        $errors = array();
488
-        $form_id = (int) $params['form'];
486
+		$message = '';
487
+		$errors = array();
488
+		$form_id = (int) $params['form'];
489 489
 
490
-        if ( $form_id ) {
491
-            $entry_ids = FrmDb::get_col( 'frm_items', array( 'form_id' => $form_id ) );
490
+		if ( $form_id ) {
491
+			$entry_ids = FrmDb::get_col( 'frm_items', array( 'form_id' => $form_id ) );
492 492
 			$action = FrmFormAction::get_action_for_form( $form_id, 'wppost', 1 );
493 493
 
494
-            if ( $action ) {
495
-                // this action takes a while, so only trigger it if there are posts to delete
496
-                foreach ( $entry_ids as $entry_id ) {
497
-                    do_action( 'frm_before_destroy_entry', $entry_id );
498
-                    unset( $entry_id );
499
-                }
500
-            }
494
+			if ( $action ) {
495
+				// this action takes a while, so only trigger it if there are posts to delete
496
+				foreach ( $entry_ids as $entry_id ) {
497
+					do_action( 'frm_before_destroy_entry', $entry_id );
498
+					unset( $entry_id );
499
+				}
500
+			}
501 501
 
502
-            $results = self::delete_form_entries( $form_id );
503
-            if ( $results ) {
502
+			$results = self::delete_form_entries( $form_id );
503
+			if ( $results ) {
504 504
 				FrmEntry::clear_cache();
505
-                $message = __( 'Entries were Successfully Destroyed', 'formidable' );
506
-            }
507
-        } else {
508
-            $errors = __( 'No entries were specified', 'formidable' );
509
-        }
505
+				$message = __( 'Entries were Successfully Destroyed', 'formidable' );
506
+			}
507
+		} else {
508
+			$errors = __( 'No entries were specified', 'formidable' );
509
+		}
510 510
 
511
-        self::display_list( $message, $errors );
512
-    }
511
+		self::display_list( $message, $errors );
512
+	}
513 513
 
514 514
 	/**
515 515
 	 * @since 3.01
@@ -551,33 +551,33 @@  discard block
 block discarded – undo
551 551
 		return $form_ids;
552 552
 	}
553 553
 
554
-    public static function process_entry( $errors = '', $ajax = false ) {
554
+	public static function process_entry( $errors = '', $ajax = false ) {
555 555
 		$form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' );
556 556
 		if ( FrmAppHelper::is_admin() || empty( $_POST ) || empty( $form_id ) || ! isset( $_POST['item_key'] ) ) {
557
-            return;
558
-        }
557
+			return;
558
+		}
559 559
 
560
-        global $frm_vars;
560
+		global $frm_vars;
561 561
 
562 562
 		$form = FrmForm::getOne( $form_id );
563
-        if ( ! $form ) {
564
-            return;
565
-        }
563
+		if ( ! $form ) {
564
+			return;
565
+		}
566 566
 
567 567
 		$params = FrmForm::get_params( $form );
568 568
 
569
-        if ( ! isset( $frm_vars['form_params'] ) ) {
570
-            $frm_vars['form_params'] = array();
571
-        }
569
+		if ( ! isset( $frm_vars['form_params'] ) ) {
570
+			$frm_vars['form_params'] = array();
571
+		}
572 572
 		$frm_vars['form_params'][ $form->id ] = $params;
573 573
 
574 574
 		if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) {
575
-            return;
576
-        }
575
+			return;
576
+		}
577 577
 
578
-        if ( $errors == '' && ! $ajax ) {
578
+		if ( $errors == '' && ! $ajax ) {
579 579
 			$errors = FrmEntryValidate::validate( $_POST );
580
-        }
580
+		}
581 581
 
582 582
 		/**
583 583
 		 * Use this filter to add trigger actions and add errors after
@@ -588,24 +588,24 @@  discard block
 block discarded – undo
588 588
 
589 589
 		$frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors );
590 590
 
591
-        if ( empty( $errors ) ) {
591
+		if ( empty( $errors ) ) {
592 592
 			$_POST['frm_skip_cookie'] = 1;
593 593
 			$do_success = false;
594
-            if ( $params['action'] == 'create' ) {
594
+			if ( $params['action'] == 'create' ) {
595 595
 				if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) {
596 596
 					$frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST );
597 597
 					$params['id'] = $frm_vars['created_entries'][ $form_id ]['entry_id'];
598 598
 					$do_success = true;
599
-                }
600
-            }
599
+				}
600
+			}
601 601
 
602
-            do_action( 'frm_process_entry', $params, $errors, $form, array( 'ajax' => $ajax ) );
602
+			do_action( 'frm_process_entry', $params, $errors, $form, array( 'ajax' => $ajax ) );
603 603
 			if ( $do_success ) {
604 604
 				FrmFormsController::maybe_trigger_redirect( $form, $params, array( 'ajax' => $ajax ) );
605 605
 			}
606 606
 			unset( $_POST['frm_skip_cookie'] );
607
-        }
608
-    }
607
+		}
608
+	}
609 609
 
610 610
 	/**
611 611
 	 * Escape url entities before redirect
@@ -619,27 +619,27 @@  discard block
 block discarded – undo
619 619
 		return str_replace( array( ' ', '[', ']', '|', '@' ), array( '%20', '%5B', '%5D', '%7C', '%40' ), $url );
620 620
 	}
621 621
 
622
-    public static function delete_entry_before_redirect( $url, $form, $atts ) {
623
-        self::_delete_entry( $atts['id'], $form );
624
-        return $url;
625
-    }
622
+	public static function delete_entry_before_redirect( $url, $form, $atts ) {
623
+		self::_delete_entry( $atts['id'], $form );
624
+		return $url;
625
+	}
626 626
 
627
-    //Delete entry if not redirected
628
-    public static function delete_entry_after_save( $atts ) {
629
-        self::_delete_entry( $atts['entry_id'], $atts['form'] );
630
-    }
627
+	//Delete entry if not redirected
628
+	public static function delete_entry_after_save( $atts ) {
629
+		self::_delete_entry( $atts['entry_id'], $atts['form'] );
630
+	}
631 631
 
632
-    private static function _delete_entry( $entry_id, $form ) {
633
-        if ( ! $form ) {
634
-            return;
635
-        }
632
+	private static function _delete_entry( $entry_id, $form ) {
633
+		if ( ! $form ) {
634
+			return;
635
+		}
636 636
 
637
-        $form->options = maybe_unserialize( $form->options );
638
-        if ( isset( $form->options['no_save'] ) && $form->options['no_save'] ) {
637
+		$form->options = maybe_unserialize( $form->options );
638
+		if ( isset( $form->options['no_save'] ) && $form->options['no_save'] ) {
639 639
 			self::unlink_post( $entry_id );
640
-            FrmEntry::destroy( $entry_id );
641
-        }
642
-    }
640
+			FrmEntry::destroy( $entry_id );
641
+		}
642
+	}
643 643
 
644 644
 	/**
645 645
 	 * unlink entry from post
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 		}
713 713
 
714 714
 		include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/sidebar-shared.php' );
715
-    }
715
+	}
716 716
 
717 717
 	/**
718 718
 	 * @deprecated 1.07.05
Please login to merge, or discard this patch.