Completed
Push — master ( b3b06a...3634bc )
by Jamie
02:58
created
classes/models/FrmAddon.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -275,7 +275,7 @@
 block discarded – undo
275 275
 		return $message;
276 276
 	}
277 277
 
278
-    public function manually_queue_update() {
279
-        set_site_transient( 'update_plugins', null );
280
-    }
278
+	public function manually_queue_update() {
279
+		set_site_transient( 'update_plugins', null );
280
+	}
281 281
 }
Please login to merge, or discard this patch.
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -292,6 +292,9 @@
 block discarded – undo
292 292
 		wp_die();
293 293
 	}
294 294
 
295
+	/**
296
+	 * @param string $action
297
+	 */
295 298
 	public function send_mothership_request( $action ) {
296 299
 		$api_params = array(
297 300
 			'edd_action' => $action,
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -38,15 +38,15 @@  discard block
 block discarded – undo
38 38
 	}
39 39
 
40 40
 	public function insert_installed_addon( $plugins ) {
41
-		$plugins[ $this->plugin_slug ] = $this;
41
+		$plugins[$this->plugin_slug] = $this;
42 42
 		return $plugins;
43 43
 	}
44 44
 
45 45
 	public static function get_addon( $plugin_slug ) {
46 46
 		$plugins = apply_filters( 'frm_installed_addons', array() );
47 47
 		$plugin = false;
48
-		if ( isset( $plugins[ $plugin_slug ] ) ) {
49
-			$plugin = $plugins[ $plugin_slug ];
48
+		if ( isset( $plugins[$plugin_slug] ) ) {
49
+			$plugin = $plugins[$plugin_slug];
50 50
 		}
51 51
 		return $plugin;
52 52
 	}
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	public function show_license_message( $file, $plugin ) {
101 101
 		$wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
102 102
 		echo '<tr class="plugin-update-tr active"><td colspan="' . esc_attr( $wp_list_table->get_column_count() ) . '" class="plugin-update colspanchange"><div class="update-message">';
103
-		echo sprintf( __( 'Your %1$s license key is missing. Please add it on the %2$slicenses page%3$s.', 'formidable' ), $this->plugin_name, '<a href="' . esc_url( admin_url('admin.php?page=formidable-settings&t=licenses_settings' ) ) . '">', '</a>' );
103
+		echo sprintf( __( 'Your %1$s license key is missing. Please add it on the %2$slicenses page%3$s.', 'formidable' ), $this->plugin_name, '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-settings&t=licenses_settings' ) ) . '">', '</a>' );
104 104
 		$id = sanitize_title( $plugin['Name'] );
105 105
 		echo '<script type="text/javascript">var d = document.getElementById("' . esc_attr( $id ) . '");if ( d !== null ){ d.className = d.className + " update"; }</script>';
106 106
 		echo '</div></td></tr>';
@@ -113,10 +113,10 @@  discard block
 block discarded – undo
113 113
 
114 114
 		if ( $this->is_current_version( $transient ) ) {
115 115
 			//make sure it doesn't show there is an update if plugin is up-to-date
116
-			if ( isset( $transient->response[ $this->plugin_folder ] ) ) {
117
-				unset( $transient->response[ $this->plugin_folder ] );
116
+			if ( isset( $transient->response[$this->plugin_folder] ) ) {
117
+				unset( $transient->response[$this->plugin_folder] );
118 118
 			}
119
-		} else if ( isset( $transient->response ) && isset( $transient->response[ $this->plugin_folder ] ) ) {
119
+		} else if ( isset( $transient->response ) && isset( $transient->response[$this->plugin_folder] ) ) {
120 120
 			$cache_key = 'edd_plugin_' . md5( sanitize_key( $this->license . $this->version ) . '_get_version' );
121 121
 			$version_info = get_transient( $cache_key );
122 122
 
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 			}
128 128
 
129 129
 			if ( $version_info !== false && version_compare( $version_info->new_version, $this->version, '>' ) ) {
130
-				$transient->response[ $this->plugin_folder ] = $version_info;
130
+				$transient->response[$this->plugin_folder] = $version_info;
131 131
 			} else {
132 132
 				delete_transient( $cache_key );
133 133
 				if ( ! $this->has_been_cleared() ) {
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 					$this->manually_queue_update();
137 137
 				}
138 138
 
139
-				unset( $transient->response[ $this->plugin_folder ] );
139
+				unset( $transient->response[$this->plugin_folder] );
140 140
 			}
141 141
 		}
142 142
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	}
145 145
 
146 146
 	private function is_current_version( $transient ) {
147
-		if ( empty( $transient->checked ) || ! isset( $transient->checked[ $this->plugin_folder ] ) ) {
147
+		if ( empty( $transient->checked ) || ! isset( $transient->checked[$this->plugin_folder] ) ) {
148 148
 			return false;
149 149
 		}
150 150
 
@@ -153,16 +153,16 @@  discard block
 block discarded – undo
153 153
 			return true;
154 154
 		}
155 155
 
156
-		return isset( $transient->response ) && isset( $transient->response[ $this->plugin_folder ] ) && $transient->checked[ $this->plugin_folder ] == $transient->response[ $this->plugin_folder ]->new_version;
156
+		return isset( $transient->response ) && isset( $transient->response[$this->plugin_folder] ) && $transient->checked[$this->plugin_folder] == $transient->response[$this->plugin_folder]->new_version;
157 157
 	}
158 158
 
159 159
 	private function has_been_cleared() {
160 160
 		$last_cleared = get_option( 'frm_last_cleared' );
161
-		return ( $last_cleared && $last_cleared > date( 'Y-m-d H:i:s', strtotime('-5 minutes') ) );
161
+		return ( $last_cleared && $last_cleared > date( 'Y-m-d H:i:s', strtotime( '-5 minutes' ) ) );
162 162
 	}
163 163
 
164 164
 	private function cleared_plugins() {
165
-		update_option( 'frm_last_cleared', date('Y-m-d H:i:s') );
165
+		update_option( 'frm_last_cleared', date( 'Y-m-d H:i:s' ) );
166 166
 	}
167 167
 
168 168
 	private function is_license_revoked() {
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 		}
172 172
 
173 173
 		$last_checked = get_site_option( $this->transient_key() );
174
-		$seven_days_ago = date( 'Y-m-d H:i:s', strtotime('-7 days') );
174
+		$seven_days_ago = date( 'Y-m-d H:i:s', strtotime( '-7 days' ) );
175 175
 
176 176
 		if ( ! $last_checked || $last_checked < $seven_days_ago ) {
177 177
 			update_site_option( $this->transient_key(), date( 'Y-m-d H:i:s' ) ); // check weekly
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 	}
188 188
 
189 189
 	public static function activate() {
190
-		FrmAppHelper::permission_check('frm_change_settings');
190
+		FrmAppHelper::permission_check( 'frm_change_settings' );
191 191
 	 	check_ajax_referer( 'frm_ajax', 'nonce' );
192 192
 
193 193
 		if ( ! isset( $_POST['license'] ) || empty( $_POST['license'] ) ) {
@@ -208,8 +208,8 @@  discard block
 block discarded – undo
208 208
 			$response['message'] = $response['status'];
209 209
 		} else {
210 210
 			$messages = $this_plugin->get_messages();
211
-			if ( is_string( $response['status'] ) && isset( $messages[ $response['status'] ] ) ) {
212
-				$response['message'] = $messages[ $response['status'] ];
211
+			if ( is_string( $response['status'] ) && isset( $messages[$response['status']] ) ) {
212
+				$response['message'] = $messages[$response['status']];
213 213
 			} else {
214 214
 				$response['message'] = FrmAppHelper::kses( $response['status'], array( 'a' ) );
215 215
 			}
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 	}
266 266
 
267 267
 	public static function deactivate() {
268
-		FrmAppHelper::permission_check('frm_change_settings');
268
+		FrmAppHelper::permission_check( 'frm_change_settings' );
269 269
 		check_ajax_referer( 'frm_ajax', 'nonce' );
270 270
 
271 271
 		$plugin_slug = sanitize_text_field( $_POST['plugin'] );
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 
318 318
 		$message = __( 'Your License Key was invalid', 'formidable' );
319 319
 		if ( is_wp_error( $resp ) ) {
320
-			$message = sprintf( __( 'You had an error communicating with the Formidable API. %1$sClick here%2$s for more information.', 'formidable' ), '<a href="https://formidableforms.com/knowledgebase/why-cant-i-activate-formidable-pro/" target="_blank">', '</a>');
320
+			$message = sprintf( __( 'You had an error communicating with the Formidable API. %1$sClick here%2$s for more information.', 'formidable' ), '<a href="https://formidableforms.com/knowledgebase/why-cant-i-activate-formidable-pro/" target="_blank">', '</a>' );
321 321
 			$message .= ' ' . $resp->get_error_message();
322 322
 		} else if ( $body == 'error' || is_wp_error( $body ) ) {
323 323
 			$message = __( 'You had an HTTP error connecting to the Formidable API', 'formidable' );
Please login to merge, or discard this patch.
classes/views/styles/_form-description.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,17 +1,17 @@
 block discarded – undo
1 1
 <div class="field-group clearfix frm-half frm-first-row">
2 2
     <label><?php _e( 'Size', 'formidable' ) ?></label>
3
-    <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('form_desc_size') ) ?>" id="frm_form_desc_size" value="<?php echo esc_attr( $style->post_content['form_desc_size'] ) ?>" />
3
+    <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'form_desc_size' ) ) ?>" id="frm_form_desc_size" value="<?php echo esc_attr( $style->post_content['form_desc_size'] ) ?>" />
4 4
 </div>
5 5
 
6 6
 <div class="field-group clearfix frm-half frm-first-row">
7 7
     <label><?php _e( 'Color', 'formidable' ) ?></label>
8
-    <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('form_desc_color') ) ?>" id="frm_form_desc_color" class="hex" value="<?php echo esc_attr( $style->post_content['form_desc_color'] ) ?>" />
8
+    <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'form_desc_color' ) ) ?>" id="frm_form_desc_color" class="hex" value="<?php echo esc_attr( $style->post_content['form_desc_color'] ) ?>" />
9 9
 </div>
10 10
 <div class="field-group clearfix frm-half">
11 11
     <label><?php _e( 'Margin Top', 'formidable' ) ?></label>
12
-    <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('form_desc_margin_top') ) ?>" id="frm_form_desc_margin_top" value="<?php echo esc_attr( $style->post_content['form_desc_margin_top'] ) ?>" size="4" />
12
+    <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'form_desc_margin_top' ) ) ?>" id="frm_form_desc_margin_top" value="<?php echo esc_attr( $style->post_content['form_desc_margin_top'] ) ?>" size="4" />
13 13
 </div>
14 14
 <div class="field-group clearfix frm-half">
15 15
     <label><?php _e( 'Margin Bottom', 'formidable' ) ?></label>
16
-    <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('form_desc_margin_bottom') ) ?>" id="frm_form_desc_margin_bottom" value="<?php echo esc_attr( $style->post_content['form_desc_margin_bottom'] ) ?>" size="4" />
16
+    <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'form_desc_margin_bottom' ) ) ?>" id="frm_form_desc_margin_bottom" value="<?php echo esc_attr( $style->post_content['form_desc_margin_bottom'] ) ?>" size="4" />
17 17
 </div>
Please login to merge, or discard this patch.
classes/views/styles/_form-title.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,17 +1,17 @@
 block discarded – undo
1 1
 <div class="field-group clearfix frm-half frm-first-row">
2 2
 	<label><?php _e( 'Size', 'formidable' ) ?></label>
3
-	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('title_size') ) ?>" id="frm_title_size" value="<?php echo esc_attr( $style->post_content['title_size'] ) ?>" />
3
+	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'title_size' ) ) ?>" id="frm_title_size" value="<?php echo esc_attr( $style->post_content['title_size'] ) ?>" />
4 4
 </div>
5 5
 
6 6
 <div class="field-group clearfix frm-half frm-first-row">
7 7
 	<label><?php _e( 'Color', 'formidable' ) ?></label>
8
-	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('title_color') ) ?>" id="frm_title_color" class="hex" value="<?php echo esc_attr( $style->post_content['title_color'] ) ?>" />
8
+	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'title_color' ) ) ?>" id="frm_title_color" class="hex" value="<?php echo esc_attr( $style->post_content['title_color'] ) ?>" />
9 9
 </div>
10 10
 <div class="field-group clearfix frm-half">
11 11
 	<label><?php _e( 'Margin Top', 'formidable' ) ?></label>
12
-	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('title_margin_top') ) ?>" id="frm_title_margin_top" value="<?php echo esc_attr( $style->post_content['title_margin_top'] ) ?>" size="4" />
12
+	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'title_margin_top' ) ) ?>" id="frm_title_margin_top" value="<?php echo esc_attr( $style->post_content['title_margin_top'] ) ?>" size="4" />
13 13
 </div>
14 14
 <div class="field-group clearfix frm-half">
15 15
     <label><?php _e( 'Margin Bottom', 'formidable' ) ?></label>
16
-    <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('title_margin_bottom') ) ?>" id="frm_title_margin_bottom" value="<?php echo esc_attr( $style->post_content['title_margin_bottom'] ) ?>" size="4" />
16
+    <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'title_margin_bottom' ) ) ?>" id="frm_title_margin_bottom" value="<?php echo esc_attr( $style->post_content['title_margin_bottom'] ) ?>" size="4" />
17 17
 </div>
Please login to merge, or discard this patch.
classes/helpers/FrmTipsHelper.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -181,13 +181,13 @@
 block discarded – undo
181 181
 			),
182 182
 		);
183 183
 		$random = rand( 0, count( $tips ) - 1 );
184
-		$tip = $tips[ $random ];
184
+		$tip = $tips[$random];
185 185
 		$tip['num'] = $random;
186 186
 		return $tip;
187 187
 	}
188 188
 
189 189
 	public static function get_random_tip( $tips ) {
190 190
 		$random = rand( 0, count( $tips ) - 1 );
191
-		return $tips[ $random ];
191
+		return $tips[$random];
192 192
 	}
193 193
 }
Please login to merge, or discard this patch.
classes/models/FrmEntry.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -180,6 +180,7 @@
 block discarded – undo
180 180
 	*
181 181
 	* @param int $id
182 182
 	* @param array $values
183
+	* @param string $update_type
183 184
 	* @return boolean|int $query_results
184 185
 	*/
185 186
 	private static function update_entry( $id, $values, $update_type ) {
Please login to merge, or discard this patch.
Indentation   +376 added lines, -376 removed lines patch added patch discarded remove patch
@@ -6,11 +6,11 @@  discard block
 block discarded – undo
6 6
 class FrmEntry {
7 7
 
8 8
 	/**
9
-	* Create a new entry
10
-	*
11
-	* @param array $values
12
-	* @return int | boolean $entry_id
13
-	*/
9
+	 * Create a new entry
10
+	 *
11
+	 * @param array $values
12
+	 * @return int | boolean $entry_id
13
+	 */
14 14
 	public static function create( $values ) {
15 15
 		$entry_id = self::create_entry( $values, 'standard' );
16 16
 
@@ -18,12 +18,12 @@  discard block
 block discarded – undo
18 18
 	}
19 19
 
20 20
 	/**
21
-	* Create a new entry with some differences depending on type
22
-	*
23
-	* @param array $values
24
-	* @param string $type
25
-	* @return int | boolean $entry_id
26
-	*/
21
+	 * Create a new entry with some differences depending on type
22
+	 *
23
+	 * @param array $values
24
+	 * @param string $type
25
+	 * @return int | boolean $entry_id
26
+	 */
27 27
 	private static function create_entry( $values, $type ) {
28 28
 		$new_values = self::before_insert_entry_in_database( $values, $type );
29 29
 
@@ -37,10 +37,10 @@  discard block
 block discarded – undo
37 37
 		return $entry_id;
38 38
 	}
39 39
 
40
-    /**
41
-     * check for duplicate entries created in the last minute
42
-     * @return boolean
43
-     */
40
+	/**
41
+	 * check for duplicate entries created in the last minute
42
+	 * @return boolean
43
+	 */
44 44
 	public static function is_duplicate( $new_values, $values ) {
45 45
 		$duplicate_entry_time = apply_filters( 'frm_time_to_check_duplicates', 60, $new_values );
46 46
 
@@ -48,55 +48,55 @@  discard block
 block discarded – undo
48 48
 			return false;
49 49
 		}
50 50
 
51
-        $check_val = $new_values;
51
+		$check_val = $new_values;
52 52
 		$check_val['created_at >'] = date( 'Y-m-d H:i:s', ( strtotime( $new_values['created_at'] ) - absint( $duplicate_entry_time ) ) );
53 53
 
54 54
 		unset( $check_val['created_at'], $check_val['updated_at'] );
55 55
 		unset( $check_val['is_draft'], $check_val['id'], $check_val['item_key'] );
56 56
 
57
-        if ( $new_values['item_key'] == $new_values['name'] ) {
58
-            unset($check_val['name']);
59
-        }
57
+		if ( $new_values['item_key'] == $new_values['name'] ) {
58
+			unset($check_val['name']);
59
+		}
60 60
 
61
-        global $wpdb;
61
+		global $wpdb;
62 62
 		$entry_exists = FrmDb::get_col( $wpdb->prefix . 'frm_items', $check_val, 'id', array( 'order_by' => 'created_at DESC' ) );
63 63
 
64
-        if ( ! $entry_exists || empty($entry_exists) || ! isset($values['item_meta']) ) {
65
-            return false;
66
-        }
64
+		if ( ! $entry_exists || empty($entry_exists) || ! isset($values['item_meta']) ) {
65
+			return false;
66
+		}
67 67
 
68
-        $is_duplicate = false;
69
-        foreach ( $entry_exists as $entry_exist ) {
70
-            $is_duplicate = true;
68
+		$is_duplicate = false;
69
+		foreach ( $entry_exists as $entry_exist ) {
70
+			$is_duplicate = true;
71 71
 
72
-            //add more checks here to make sure it's a duplicate
73
-            $metas = FrmEntryMeta::get_entry_meta_info($entry_exist);
74
-            $field_metas = array();
75
-            foreach ( $metas as $meta ) {
72
+			//add more checks here to make sure it's a duplicate
73
+			$metas = FrmEntryMeta::get_entry_meta_info($entry_exist);
74
+			$field_metas = array();
75
+			foreach ( $metas as $meta ) {
76 76
 				$field_metas[ $meta->field_id ] = $meta->meta_value;
77
-            }
78
-
79
-            // If prev entry is empty and current entry is not, they are not duplicates
80
-            $filtered_vals = array_filter( $values['item_meta'] );
81
-            if ( empty( $field_metas ) && ! empty( $filtered_vals ) ) {
82
-                return false;
83
-            }
84
-
85
-            $diff = array_diff_assoc($field_metas, array_map('maybe_serialize', $values['item_meta']));
86
-            foreach ( $diff as $field_id => $meta_value ) {
87
-                if ( ! empty($meta_value) ) {
88
-                    $is_duplicate = false;
89
-                    continue;
90
-                }
91
-            }
92
-
93
-            if ( $is_duplicate ) {
77
+			}
78
+
79
+			// If prev entry is empty and current entry is not, they are not duplicates
80
+			$filtered_vals = array_filter( $values['item_meta'] );
81
+			if ( empty( $field_metas ) && ! empty( $filtered_vals ) ) {
82
+				return false;
83
+			}
84
+
85
+			$diff = array_diff_assoc($field_metas, array_map('maybe_serialize', $values['item_meta']));
86
+			foreach ( $diff as $field_id => $meta_value ) {
87
+				if ( ! empty($meta_value) ) {
88
+					$is_duplicate = false;
89
+					continue;
90
+				}
91
+			}
92
+
93
+			if ( $is_duplicate ) {
94 94
 				break;
95
-            }
96
-        }
95
+			}
96
+		}
97 97
 
98
-        return $is_duplicate;
99
-    }
98
+		return $is_duplicate;
99
+	}
100 100
 
101 101
 	/**
102 102
 	 * Determine if an entry needs to be checked as a possible duplicate
@@ -125,46 +125,46 @@  discard block
 block discarded – undo
125 125
 		return true;
126 126
 	}
127 127
 
128
-    public static function duplicate( $id ) {
129
-        global $wpdb;
128
+	public static function duplicate( $id ) {
129
+		global $wpdb;
130 130
 
131
-        $values = self::getOne( $id );
131
+		$values = self::getOne( $id );
132 132
 
133
-        $new_values = array();
133
+		$new_values = array();
134 134
 		$new_values['item_key'] = FrmAppHelper::get_unique_key( '', $wpdb->prefix . 'frm_items', 'item_key' );
135
-        $new_values['name'] = $values->name;
136
-        $new_values['is_draft'] = $values->is_draft;
137
-        $new_values['user_id'] = $new_values['updated_by'] = (int) $values->user_id;
138
-        $new_values['form_id'] = $values->form_id ? (int) $values->form_id: null;
139
-        $new_values['created_at'] = $new_values['updated_at'] = current_time('mysql', 1);
135
+		$new_values['name'] = $values->name;
136
+		$new_values['is_draft'] = $values->is_draft;
137
+		$new_values['user_id'] = $new_values['updated_by'] = (int) $values->user_id;
138
+		$new_values['form_id'] = $values->form_id ? (int) $values->form_id: null;
139
+		$new_values['created_at'] = $new_values['updated_at'] = current_time('mysql', 1);
140 140
 
141 141
 		$query_results = $wpdb->insert( $wpdb->prefix . 'frm_items', $new_values );
142
-        if ( ! $query_results ) {
143
-            return false;
144
-        }
142
+		if ( ! $query_results ) {
143
+			return false;
144
+		}
145 145
 
146
-        $entry_id = $wpdb->insert_id;
146
+		$entry_id = $wpdb->insert_id;
147 147
 
148
-        global $frm_vars;
149
-        if ( ! isset($frm_vars['saved_entries']) ) {
150
-            $frm_vars['saved_entries'] = array();
151
-        }
152
-        $frm_vars['saved_entries'][] = (int) $entry_id;
148
+		global $frm_vars;
149
+		if ( ! isset($frm_vars['saved_entries']) ) {
150
+			$frm_vars['saved_entries'] = array();
151
+		}
152
+		$frm_vars['saved_entries'][] = (int) $entry_id;
153 153
 
154
-        FrmEntryMeta::duplicate_entry_metas($id, $entry_id);
154
+		FrmEntryMeta::duplicate_entry_metas($id, $entry_id);
155 155
 		self::clear_cache();
156 156
 
157 157
 		do_action( 'frm_after_duplicate_entry', $entry_id, $new_values['form_id'], array( 'old_id' => $id ) );
158
-        return $entry_id;
159
-    }
158
+		return $entry_id;
159
+	}
160 160
 
161 161
 	/**
162
-	* Update an entry (not via XML)
163
-	*
164
-	* @param int $id
165
-	* @param array $values
166
-	* @return boolean|int $update_results
167
-	*/
162
+	 * Update an entry (not via XML)
163
+	 *
164
+	 * @param int $id
165
+	 * @param array $values
166
+	 * @return boolean|int $update_results
167
+	 */
168 168
 	public static function update( $id, $values ) {
169 169
 		$update_results = self::update_entry( $id, $values, 'standard' );
170 170
 
@@ -172,14 +172,14 @@  discard block
 block discarded – undo
172 172
 	}
173 173
 
174 174
 	/**
175
-	* Update an entry with some differences depending on the update type
176
-	*
177
-	* @since 2.0.16
178
-	*
179
-	* @param int $id
180
-	* @param array $values
181
-	* @return boolean|int $query_results
182
-	*/
175
+	 * Update an entry with some differences depending on the update type
176
+	 *
177
+	 * @since 2.0.16
178
+	 *
179
+	 * @param int $id
180
+	 * @param array $values
181
+	 * @return boolean|int $query_results
182
+	 */
183 183
 	private static function update_entry( $id, $values, $update_type ) {
184 184
 		global $wpdb;
185 185
 
@@ -198,34 +198,34 @@  discard block
 block discarded – undo
198 198
 	}
199 199
 
200 200
 	public static function &destroy( $id ) {
201
-        global $wpdb;
202
-        $id = (int) $id;
201
+		global $wpdb;
202
+		$id = (int) $id;
203 203
 
204 204
 		$entry = self::getOne( $id );
205
-        if ( ! $entry ) {
206
-            $result = false;
207
-            return $result;
208
-        }
205
+		if ( ! $entry ) {
206
+			$result = false;
207
+			return $result;
208
+		}
209 209
 
210
-        do_action('frm_before_destroy_entry', $id, $entry);
210
+		do_action('frm_before_destroy_entry', $id, $entry);
211 211
 
212 212
 		$wpdb->query( $wpdb->prepare( 'DELETE FROM ' . $wpdb->prefix . 'frm_item_metas WHERE item_id=%d', $id ) );
213 213
 		$result = $wpdb->query( $wpdb->prepare( 'DELETE FROM ' . $wpdb->prefix . 'frm_items WHERE id=%d', $id ) );
214 214
 
215 215
 		self::clear_cache();
216 216
 
217
-        return $result;
218
-    }
217
+		return $result;
218
+	}
219 219
 
220 220
 	public static function &update_form( $id, $value, $form_id ) {
221
-        global $wpdb;
222
-        $form_id = isset($value) ? $form_id : null;
221
+		global $wpdb;
222
+		$form_id = isset($value) ? $form_id : null;
223 223
 		$result = $wpdb->update( $wpdb->prefix . 'frm_items', array( 'form_id' => $form_id ), array( 'id' => $id ) );
224 224
 		if ( $result ) {
225 225
 			self::clear_cache();
226 226
 		}
227
-        return $result;
228
-    }
227
+		return $result;
228
+	}
229 229
 
230 230
 	/**
231 231
 	 * Clear entry caching
@@ -261,159 +261,159 @@  discard block
 block discarded – undo
261 261
 	}
262 262
 
263 263
 	public static function getOne( $id, $meta = false ) {
264
-        global $wpdb;
264
+		global $wpdb;
265 265
 
266
-        $query = "SELECT it.*, fr.name as form_name, fr.form_key as form_key FROM {$wpdb->prefix}frm_items it
266
+		$query = "SELECT it.*, fr.name as form_name, fr.form_key as form_key FROM {$wpdb->prefix}frm_items it
267 267
                   LEFT OUTER JOIN {$wpdb->prefix}frm_forms fr ON it.form_id=fr.id WHERE ";
268 268
 
269
-        $query .= is_numeric($id) ? 'it.id=%d' : 'it.item_key=%s';
270
-        $query_args = array( $id );
271
-        $query = $wpdb->prepare( $query, $query_args );
269
+		$query .= is_numeric($id) ? 'it.id=%d' : 'it.item_key=%s';
270
+		$query_args = array( $id );
271
+		$query = $wpdb->prepare( $query, $query_args );
272 272
 
273
-        if ( ! $meta ) {
273
+		if ( ! $meta ) {
274 274
 			$entry = FrmAppHelper::check_cache( $id . '_nometa', 'frm_entry', $query, 'get_row' );
275
-            return stripslashes_deep($entry);
276
-        }
275
+			return stripslashes_deep($entry);
276
+		}
277 277
 
278
-        $entry = FrmAppHelper::check_cache( $id, 'frm_entry' );
279
-        if ( $entry !== false ) {
280
-            return stripslashes_deep($entry);
281
-        }
278
+		$entry = FrmAppHelper::check_cache( $id, 'frm_entry' );
279
+		if ( $entry !== false ) {
280
+			return stripslashes_deep($entry);
281
+		}
282 282
 
283
-        $entry = $wpdb->get_row( $query );
284
-        $entry = self::get_meta($entry);
283
+		$entry = $wpdb->get_row( $query );
284
+		$entry = self::get_meta($entry);
285 285
 
286
-        return stripslashes_deep($entry);
287
-    }
286
+		return stripslashes_deep($entry);
287
+	}
288 288
 
289 289
 	public static function get_meta( $entry ) {
290
-        if ( ! $entry ) {
291
-            return $entry;
292
-        }
290
+		if ( ! $entry ) {
291
+			return $entry;
292
+		}
293 293
 
294
-        global $wpdb;
294
+		global $wpdb;
295 295
 		$metas = FrmDb::get_results( $wpdb->prefix . 'frm_item_metas m LEFT JOIN ' . $wpdb->prefix . 'frm_fields f ON m.field_id=f.id', array( 'item_id' => $entry->id, 'field_id !' => 0 ), 'field_id, meta_value, field_key, item_id' );
296 296
 
297
-        $entry->metas = array();
297
+		$entry->metas = array();
298 298
 
299 299
 		$include_key = apply_filters( 'frm_include_meta_keys', false, array( 'form_id' => $entry->form_id ) );
300
-        foreach ( $metas as $meta_val ) {
301
-            if ( $meta_val->item_id == $entry->id ) {
300
+		foreach ( $metas as $meta_val ) {
301
+			if ( $meta_val->item_id == $entry->id ) {
302 302
 				$entry->metas[ $meta_val->field_id ] = maybe_unserialize( $meta_val->meta_value );
303 303
 				if ( $include_key ) {
304 304
 					$entry->metas[ $meta_val->field_key ] = $entry->metas[ $meta_val->field_id ];
305 305
 				}
306
-                 continue;
307
-            }
306
+				 continue;
307
+			}
308 308
 
309
-            // include sub entries in an array
309
+			// include sub entries in an array
310 310
 			if ( ! isset( $entry_metas[ $meta_val->field_id ] ) ) {
311 311
 				$entry->metas[ $meta_val->field_id ] = array();
312
-            }
312
+			}
313 313
 
314 314
 			$entry->metas[ $meta_val->field_id ][] = maybe_unserialize( $meta_val->meta_value );
315 315
 
316
-            unset($meta_val);
317
-        }
318
-        unset($metas);
316
+			unset($meta_val);
317
+		}
318
+		unset($metas);
319 319
 
320 320
 		FrmAppHelper::set_cache( $entry->id, $entry, 'frm_entry' );
321 321
 
322
-        return $entry;
323
-    }
322
+		return $entry;
323
+	}
324 324
 
325
-    /**
326
-     * @param string $id
327
-     */
325
+	/**
326
+	 * @param string $id
327
+	 */
328 328
 	public static function &exists( $id ) {
329
-        global $wpdb;
330
-
331
-        if ( FrmAppHelper::check_cache( $id, 'frm_entry' ) ) {
332
-            $exists = true;
333
-            return $exists;
334
-        }
335
-
336
-        if ( is_numeric($id) ) {
337
-            $where = array( 'id' => $id );
338
-        } else {
339
-            $where = array( 'item_key' => $id );
340
-        }
329
+		global $wpdb;
330
+
331
+		if ( FrmAppHelper::check_cache( $id, 'frm_entry' ) ) {
332
+			$exists = true;
333
+			return $exists;
334
+		}
335
+
336
+		if ( is_numeric($id) ) {
337
+			$where = array( 'id' => $id );
338
+		} else {
339
+			$where = array( 'item_key' => $id );
340
+		}
341 341
 		$id = FrmDb::get_var( $wpdb->prefix . 'frm_items', $where );
342 342
 
343
-        $exists = ($id && $id > 0) ? true : false;
344
-        return $exists;
345
-    }
343
+		$exists = ($id && $id > 0) ? true : false;
344
+		return $exists;
345
+	}
346 346
 
347
-    public static function getAll( $where, $order_by = '', $limit = '', $meta = false, $inc_form = true ) {
347
+	public static function getAll( $where, $order_by = '', $limit = '', $meta = false, $inc_form = true ) {
348 348
 		global $wpdb;
349 349
 
350
-        $limit = FrmAppHelper::esc_limit($limit);
350
+		$limit = FrmAppHelper::esc_limit($limit);
351 351
 
352
-        $cache_key = maybe_serialize($where) . $order_by . $limit . $inc_form;
353
-        $entries = wp_cache_get($cache_key, 'frm_entry');
352
+		$cache_key = maybe_serialize($where) . $order_by . $limit . $inc_form;
353
+		$entries = wp_cache_get($cache_key, 'frm_entry');
354 354
 
355
-        if ( false === $entries ) {
356
-            $fields = 'it.id, it.item_key, it.name, it.ip, it.form_id, it.post_id, it.user_id, it.parent_item_id, it.updated_by, it.created_at, it.updated_at, it.is_draft';
355
+		if ( false === $entries ) {
356
+			$fields = 'it.id, it.item_key, it.name, it.ip, it.form_id, it.post_id, it.user_id, it.parent_item_id, it.updated_by, it.created_at, it.updated_at, it.is_draft';
357 357
 			$table = $wpdb->prefix . 'frm_items it ';
358 358
 
359
-            if ( $inc_form ) {
360
-                $fields = 'it.*, fr.name as form_name,fr.form_key as form_key';
361
-                $table .= 'LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_forms fr ON it.form_id=fr.id ';
362
-            }
359
+			if ( $inc_form ) {
360
+				$fields = 'it.*, fr.name as form_name,fr.form_key as form_key';
361
+				$table .= 'LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_forms fr ON it.form_id=fr.id ';
362
+			}
363 363
 
364
-            if ( preg_match( '/ meta_([0-9]+)/', $order_by, $order_matches ) ) {
365
-    		    // sort by a requested field
366
-                $field_id = (int) $order_matches[1];
364
+			if ( preg_match( '/ meta_([0-9]+)/', $order_by, $order_matches ) ) {
365
+				// sort by a requested field
366
+				$field_id = (int) $order_matches[1];
367 367
 				$fields .= ', (SELECT meta_value FROM ' . $wpdb->prefix . 'frm_item_metas WHERE field_id = ' . $field_id . ' AND item_id = it.id) as meta_' . $field_id;
368 368
 				unset( $order_matches, $field_id );
369
-		    }
369
+			}
370 370
 
371 371
 			// prepare the query
372 372
 			$query = 'SELECT ' . $fields . ' FROM ' . $table . FrmAppHelper::prepend_and_or_where(' WHERE ', $where) . $order_by . $limit;
373 373
 
374
-            $entries = $wpdb->get_results($query, OBJECT_K);
375
-            unset($query);
374
+			$entries = $wpdb->get_results($query, OBJECT_K);
375
+			unset($query);
376 376
 
377 377
 			FrmAppHelper::set_cache( $cache_key, $entries, 'frm_entry' );
378
-        }
378
+		}
379 379
 
380
-        if ( ! $meta || ! $entries ) {
381
-            return stripslashes_deep($entries);
382
-        }
383
-        unset($meta);
380
+		if ( ! $meta || ! $entries ) {
381
+			return stripslashes_deep($entries);
382
+		}
383
+		unset($meta);
384 384
 
385
-        if ( ! is_array( $where ) && preg_match('/^it\.form_id=\d+$/', $where) ) {
385
+		if ( ! is_array( $where ) && preg_match('/^it\.form_id=\d+$/', $where) ) {
386 386
 			$where = array( 'it.form_id' => substr( $where, 11 ) );
387
-        }
387
+		}
388 388
 
389
-        $meta_where = array( 'field_id !' => 0 );
390
-        if ( $limit == '' && is_array($where) && count($where) == 1 && isset($where['it.form_id']) ) {
391
-            $meta_where['fi.form_id'] = $where['it.form_id'];
392
-        } else {
393
-            $meta_where['item_id'] = array_keys( $entries );
394
-        }
389
+		$meta_where = array( 'field_id !' => 0 );
390
+		if ( $limit == '' && is_array($where) && count($where) == 1 && isset($where['it.form_id']) ) {
391
+			$meta_where['fi.form_id'] = $where['it.form_id'];
392
+		} else {
393
+			$meta_where['item_id'] = array_keys( $entries );
394
+		}
395 395
 
396
-        $metas = FrmDb::get_results( $wpdb->prefix . 'frm_item_metas it LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_fields fi ON (it.field_id = fi.id)', $meta_where, 'item_id, meta_value, field_id, field_key, form_id' );
396
+		$metas = FrmDb::get_results( $wpdb->prefix . 'frm_item_metas it LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_fields fi ON (it.field_id = fi.id)', $meta_where, 'item_id, meta_value, field_id, field_key, form_id' );
397 397
 
398
-        unset( $meta_where );
398
+		unset( $meta_where );
399 399
 
400
-        if ( ! $metas ) {
401
-            return stripslashes_deep($entries);
402
-        }
400
+		if ( ! $metas ) {
401
+			return stripslashes_deep($entries);
402
+		}
403 403
 
404
-        foreach ( $metas as $m_key => $meta_val ) {
405
-            if ( ! isset( $entries[ $meta_val->item_id ] ) ) {
406
-                continue;
407
-            }
404
+		foreach ( $metas as $m_key => $meta_val ) {
405
+			if ( ! isset( $entries[ $meta_val->item_id ] ) ) {
406
+				continue;
407
+			}
408 408
 
409
-            if ( ! isset( $entries[ $meta_val->item_id ]->metas ) ) {
409
+			if ( ! isset( $entries[ $meta_val->item_id ]->metas ) ) {
410 410
 				$entries[ $meta_val->item_id ]->metas = array();
411
-            }
411
+			}
412 412
 
413 413
 			$entries[ $meta_val->item_id ]->metas[ $meta_val->field_id ] = maybe_unserialize( $meta_val->meta_value );
414 414
 
415
-            unset($m_key, $meta_val);
416
-        }
415
+			unset($m_key, $meta_val);
416
+		}
417 417
 
418 418
 		if ( ! FrmAppHelper::prevent_caching() ) {
419 419
 			foreach ( $entries as $entry ) {
@@ -422,31 +422,31 @@  discard block
 block discarded – undo
422 422
 			}
423 423
 		}
424 424
 
425
-        return stripslashes_deep($entries);
426
-    }
425
+		return stripslashes_deep($entries);
426
+	}
427 427
 
428
-    // Pagination Methods
429
-    public static function getRecordCount( $where = '' ) {
430
-        global $wpdb;
428
+	// Pagination Methods
429
+	public static function getRecordCount( $where = '' ) {
430
+		global $wpdb;
431 431
 		$table_join = $wpdb->prefix . 'frm_items it LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_forms fr ON it.form_id=fr.id';
432 432
 
433
-        if ( is_numeric($where) ) {
434
-            $table_join = 'frm_items';
435
-            $where = array( 'form_id' => $where );
436
-        }
433
+		if ( is_numeric($where) ) {
434
+			$table_join = 'frm_items';
435
+			$where = array( 'form_id' => $where );
436
+		}
437 437
 
438
-        if ( is_array( $where ) ) {
439
-            $count = FrmDb::get_count( $table_join, $where );
440
-        } else {
438
+		if ( is_array( $where ) ) {
439
+			$count = FrmDb::get_count( $table_join, $where );
440
+		} else {
441 441
 			$cache_key = 'count_' . maybe_serialize( $where );
442 442
 			$query = 'SELECT COUNT(*) FROM ' . $table_join . FrmAppHelper::prepend_and_or_where( ' WHERE ', $where );
443 443
 			$count = FrmAppHelper::check_cache( $cache_key, 'frm_entry', $query, 'get_var' );
444
-        }
444
+		}
445 445
 
446
-        return $count;
447
-    }
446
+		return $count;
447
+	}
448 448
 
449
-    public static function getPageCount( $p_size, $where = '' ) {
449
+	public static function getPageCount( $p_size, $where = '' ) {
450 450
 		$p_size = (int) $p_size;
451 451
 		$count = 1;
452 452
 		if ( $p_size ) {
@@ -457,16 +457,16 @@  discard block
 block discarded – undo
457 457
 		}
458 458
 
459 459
 		return $count;
460
-    }
460
+	}
461 461
 
462 462
 	/**
463
-	* Prepare the data before inserting it into the database
464
-	*
465
-	* @since 2.0.16
466
-	* @param array $values
467
-	* @param string $type
468
-	* @return array $new_values
469
-	*/
463
+	 * Prepare the data before inserting it into the database
464
+	 *
465
+	 * @since 2.0.16
466
+	 * @param array $values
467
+	 * @param string $type
468
+	 * @return array $new_values
469
+	 */
470 470
 	private static function before_insert_entry_in_database( &$values, $type ) {
471 471
 
472 472
 		self::sanitize_entry_post( $values );
@@ -481,13 +481,13 @@  discard block
 block discarded – undo
481 481
 	}
482 482
 
483 483
 	/**
484
-	* Create an entry and perform after create actions
485
-	*
486
-	* @since 2.0.16
487
-	* @param array $values
488
-	* @param array $new_values
489
-	* @return boolean|int $entry_id
490
-	*/
484
+	 * Create an entry and perform after create actions
485
+	 *
486
+	 * @since 2.0.16
487
+	 * @param array $values
488
+	 * @param array $new_values
489
+	 * @return boolean|int $entry_id
490
+	 */
491 491
 	private static function continue_to_create_entry( $values, $new_values ) {
492 492
 		$entry_id = self::insert_entry_into_database( $new_values );
493 493
 		if ( ! $entry_id ) {
@@ -499,37 +499,37 @@  discard block
 block discarded – undo
499 499
 		return $entry_id;
500 500
 	}
501 501
 
502
-    /**
503
-     * Sanitize the POST values before we use them
504
-     *
505
-     * @since 2.0
506
-     * @param array $values The POST values by reference
507
-     */
508
-    public static function sanitize_entry_post( &$values ) {
509
-        $sanitize_method = array(
510
-            'form_id'       => 'absint',
511
-            'frm_action'    => 'sanitize_title',
512
-            'form_key'      => 'sanitize_title',
513
-            'item_key'      => 'sanitize_title',
514
-            'item_name'     => 'sanitize_text_field',
515
-            'frm_saving_draft' => 'absint',
516
-            'is_draft'      => 'absint',
517
-            'post_id'       => 'absint',
518
-            'parent_item_id' => 'absint',
519
-            'created_at'    => 'sanitize_text_field',
520
-            'updated_at'    => 'sanitize_text_field',
521
-        );
522
-
523
-        FrmAppHelper::sanitize_request( $sanitize_method, $values );
524
-    }
525
-
526
-	/**
527
-	* Prepare the new values for inserting into the database
528
-	*
529
-	* @since 2.0.16
530
-	* @param array $values
531
-	* @return array $new_values
532
-	*/
502
+	/**
503
+	 * Sanitize the POST values before we use them
504
+	 *
505
+	 * @since 2.0
506
+	 * @param array $values The POST values by reference
507
+	 */
508
+	public static function sanitize_entry_post( &$values ) {
509
+		$sanitize_method = array(
510
+			'form_id'       => 'absint',
511
+			'frm_action'    => 'sanitize_title',
512
+			'form_key'      => 'sanitize_title',
513
+			'item_key'      => 'sanitize_title',
514
+			'item_name'     => 'sanitize_text_field',
515
+			'frm_saving_draft' => 'absint',
516
+			'is_draft'      => 'absint',
517
+			'post_id'       => 'absint',
518
+			'parent_item_id' => 'absint',
519
+			'created_at'    => 'sanitize_text_field',
520
+			'updated_at'    => 'sanitize_text_field',
521
+		);
522
+
523
+		FrmAppHelper::sanitize_request( $sanitize_method, $values );
524
+	}
525
+
526
+	/**
527
+	 * Prepare the new values for inserting into the database
528
+	 *
529
+	 * @since 2.0.16
530
+	 * @param array $values
531
+	 * @return array $new_values
532
+	 */
533 533
 	private static function package_entry_data( &$values ) {
534 534
 		global $wpdb;
535 535
 
@@ -562,67 +562,67 @@  discard block
 block discarded – undo
562 562
 	}
563 563
 
564 564
 	/**
565
-	* Get the is_draft value for a new entry
566
-	*
567
-	* @since 2.0.16
568
-	* @param array $values
569
-	* @return int
570
-	*/
565
+	 * Get the is_draft value for a new entry
566
+	 *
567
+	 * @since 2.0.16
568
+	 * @param array $values
569
+	 * @return int
570
+	 */
571 571
 	private static function get_is_draft_value( $values ) {
572 572
 		return ( ( isset( $values['frm_saving_draft'] ) && $values['frm_saving_draft'] == 1 ) ||  ( isset( $values['is_draft'] ) && $values['is_draft'] == 1 ) ) ? 1 : 0;
573 573
 	}
574 574
 
575 575
 	/**
576
-	* Get the form_id value for a new entry
577
-	*
578
-	* @since 2.0.16
579
-	* @param array $values
580
-	* @return int|null
581
-	*/
576
+	 * Get the form_id value for a new entry
577
+	 *
578
+	 * @since 2.0.16
579
+	 * @param array $values
580
+	 * @return int|null
581
+	 */
582 582
 	private static function get_form_id( $values ) {
583 583
 		return isset( $values['form_id'] ) ? (int) $values['form_id'] : null;
584 584
 	}
585 585
 
586 586
 	/**
587
-	* Get the post_id value for a new entry
588
-	*
589
-	* @since 2.0.16
590
-	* @param array $values
591
-	* @return int
592
-	*/
587
+	 * Get the post_id value for a new entry
588
+	 *
589
+	 * @since 2.0.16
590
+	 * @param array $values
591
+	 * @return int
592
+	 */
593 593
 	private static function get_post_id( $values ) {
594 594
 		return isset( $values['post_id'] ) ? (int) $values['post_id']: 0;
595 595
 	}
596 596
 
597 597
 	/**
598
-	* Get the parent_item_id value for a new entry
599
-	*
600
-	* @since 2.0.16
601
-	* @param array $values
602
-	* @return int
603
-	*/
598
+	 * Get the parent_item_id value for a new entry
599
+	 *
600
+	 * @since 2.0.16
601
+	 * @param array $values
602
+	 * @return int
603
+	 */
604 604
 	private static function get_parent_item_id( $values ) {
605 605
 		return isset( $values['parent_item_id'] ) ? (int) $values['parent_item_id']: 0;
606 606
 	}
607 607
 
608 608
 	/**
609
-	* Get the created_at value for a new entry
610
-	*
611
-	* @since 2.0.16
612
-	* @param array $values
613
-	* @return string
614
-	*/
609
+	 * Get the created_at value for a new entry
610
+	 *
611
+	 * @since 2.0.16
612
+	 * @param array $values
613
+	 * @return string
614
+	 */
615 615
 	private static function get_created_at( $values ) {
616 616
 		return isset( $values['created_at'] ) ? $values['created_at']: current_time('mysql', 1);
617 617
 	}
618 618
 
619 619
 	/**
620
-	* Get the updated_at value for a new entry
621
-	*
622
-	* @since 2.0.16
623
-	* @param array $values
624
-	* @return string
625
-	*/
620
+	 * Get the updated_at value for a new entry
621
+	 *
622
+	 * @since 2.0.16
623
+	 * @param array $values
624
+	 * @return string
625
+	 */
626 626
 	private static function get_updated_at( $values ) {
627 627
 		if ( isset( $values['updated_at'] ) ) {
628 628
 			$updated_at = $values['updated_at'];
@@ -634,12 +634,12 @@  discard block
 block discarded – undo
634 634
 	}
635 635
 
636 636
 	/**
637
-	* Get the description value for a new entry
638
-	*
639
-	* @since 2.0.16
640
-	* @param array $values
641
-	* @return string
642
-	*/
637
+	 * Get the description value for a new entry
638
+	 *
639
+	 * @since 2.0.16
640
+	 * @param array $values
641
+	 * @return string
642
+	 */
643 643
 	private static function get_entry_description( $values ) {
644 644
 		if ( isset( $values['description'] ) && ! empty( $values['description'] ) ) {
645 645
 			$description = maybe_serialize( $values['description'] );
@@ -654,12 +654,12 @@  discard block
 block discarded – undo
654 654
 	}
655 655
 
656 656
 	/**
657
-	* Get the user_id value for a new entry
658
-	*
659
-	* @since 2.0.16
660
-	* @param array $values
661
-	* @return int
662
-	*/
657
+	 * Get the user_id value for a new entry
658
+	 *
659
+	 * @since 2.0.16
660
+	 * @param array $values
661
+	 * @return int
662
+	 */
663 663
 	private static function get_entry_user_id( $values ) {
664 664
 		if ( isset( $values['frm_user_id'] ) && ( is_numeric( $values['frm_user_id'] ) || FrmAppHelper::is_admin() ) ) {
665 665
 			$user_id = $values['frm_user_id'];
@@ -672,12 +672,12 @@  discard block
 block discarded – undo
672 672
 	}
673 673
 
674 674
 	/**
675
-	* Insert new entry into the database
676
-	*
677
-	* @since 2.0.16
678
-	* @param array $new_values
679
-	* @return int | boolean $entry_id
680
-	*/
675
+	 * Insert new entry into the database
676
+	 *
677
+	 * @since 2.0.16
678
+	 * @param array $new_values
679
+	 * @return int | boolean $entry_id
680
+	 */
681 681
 	private static function insert_entry_into_database( $new_values ) {
682 682
 		global $wpdb;
683 683
 
@@ -693,11 +693,11 @@  discard block
 block discarded – undo
693 693
 	}
694 694
 
695 695
 	/**
696
-	* Add the new entry to global $frm_vars
697
-	*
698
-	* @since 2.0.16
699
-	* @param int $entry_id
700
-	*/
696
+	 * Add the new entry to global $frm_vars
697
+	 *
698
+	 * @since 2.0.16
699
+	 * @param int $entry_id
700
+	 */
701 701
 	private static function add_new_entry_to_frm_vars( $entry_id ) {
702 702
 		global $frm_vars;
703 703
 
@@ -709,12 +709,12 @@  discard block
 block discarded – undo
709 709
 	}
710 710
 
711 711
 	/**
712
-	* Add entry metas, if there are any
713
-	*
714
-	* @since 2.0.16
715
-	* @param array $values
716
-	* @param int $entry_id
717
-	*/
712
+	 * Add entry metas, if there are any
713
+	 *
714
+	 * @since 2.0.16
715
+	 * @param array $values
716
+	 * @param int $entry_id
717
+	 */
718 718
 	private static function maybe_add_entry_metas( $values, $entry_id ) {
719 719
 		if ( isset($values['item_meta']) ) {
720 720
 			FrmEntryMeta::update_entry_metas( $entry_id, $values['item_meta'] );
@@ -722,12 +722,12 @@  discard block
 block discarded – undo
722 722
 	}
723 723
 
724 724
 	/**
725
-	* Trigger frm_after_create_entry hooks
726
-	*
727
-	* @since 2.0.16
728
-	* @param int $entry_id
729
-	* @param array $new_values
730
-	*/
725
+	 * Trigger frm_after_create_entry hooks
726
+	 *
727
+	 * @since 2.0.16
728
+	 * @param int $entry_id
729
+	 * @param array $new_values
730
+	 */
731 731
 	private static function after_entry_created_actions( $entry_id, $values, $new_values ) {
732 732
 		// this is a child entry
733 733
 		$is_child = isset( $values['parent_form_id'] ) && isset( $values['parent_nonce'] ) && ! empty( $values['parent_form_id'] ) && wp_verify_nonce( $values['parent_nonce'], 'parent' );
@@ -737,13 +737,13 @@  discard block
 block discarded – undo
737 737
 	}
738 738
 
739 739
 	/**
740
-	* Actions to perform immediately after an entry is inserted in the frm_items database
741
-	*
742
-	* @since 2.0.16
743
-	* @param array $values
744
-	* @param array $new_values
745
-	* @param int $entry_id
746
-	*/
740
+	 * Actions to perform immediately after an entry is inserted in the frm_items database
741
+	 *
742
+	 * @since 2.0.16
743
+	 * @param array $values
744
+	 * @param array $new_values
745
+	 * @param int $entry_id
746
+	 */
747 747
 	private static function after_insert_entry_in_database( $values, $new_values, $entry_id ) {
748 748
 
749 749
 		self::add_new_entry_to_frm_vars( $entry_id );
@@ -756,14 +756,14 @@  discard block
 block discarded – undo
756 756
 	}
757 757
 
758 758
 	/**
759
-	* Perform some actions right before updating an entry
760
-	*
761
-	* @since 2.0.16
762
-	* @param int $id
763
-	* @param array $values
764
-	* @param string $update_type
765
-	* @return boolean $update
766
-	*/
759
+	 * Perform some actions right before updating an entry
760
+	 *
761
+	 * @since 2.0.16
762
+	 * @param int $id
763
+	 * @param array $values
764
+	 * @param string $update_type
765
+	 * @return boolean $update
766
+	 */
767 767
 	private static function before_update_entry( $id, &$values, $update_type ) {
768 768
 		$update = true;
769 769
 
@@ -781,13 +781,13 @@  discard block
 block discarded – undo
781 781
 	}
782 782
 
783 783
 	/**
784
-	* Package the entry data for updating
785
-	*
786
-	* @since 2.0.16
787
-	* @param int $id
788
-	* @param array $values
789
-	* @return array $new_values
790
-	*/
784
+	 * Package the entry data for updating
785
+	 *
786
+	 * @since 2.0.16
787
+	 * @param int $id
788
+	 * @param array $values
789
+	 * @return array $new_values
790
+	 */
791 791
 	private static function package_entry_to_update( $id, $values ) {
792 792
 		global $wpdb;
793 793
 
@@ -821,14 +821,14 @@  discard block
 block discarded – undo
821 821
 	}
822 822
 
823 823
 	/**
824
-	* Perform some actions right after updating an entry
825
-	*
826
-	* @since 2.0.16
827
-	* @param boolean|int $query_results
828
-	* @param int $id
829
-	* @param array $values
830
-	* @param array $new_values
831
-	*/
824
+	 * Perform some actions right after updating an entry
825
+	 *
826
+	 * @since 2.0.16
827
+	 * @param boolean|int $query_results
828
+	 * @param int $id
829
+	 * @param array $values
830
+	 * @param array $new_values
831
+	 */
832 832
 	private static function after_update_entry( $query_results, $id, $values, $new_values ) {
833 833
 		if ( $query_results ) {
834 834
 			self::clear_cache();
@@ -850,13 +850,13 @@  discard block
 block discarded – undo
850 850
 	}
851 851
 
852 852
 	/**
853
-	* Create entry from an XML import
854
-	* Certain actions aren't necessary when importing (like saving sub entries, checking for duplicates, etc.)
855
-	*
856
-	* @since 2.0.16
857
-	* @param array $values
858
-	* @return int | boolean $entry_id
859
-	*/
853
+	 * Create entry from an XML import
854
+	 * Certain actions aren't necessary when importing (like saving sub entries, checking for duplicates, etc.)
855
+	 *
856
+	 * @since 2.0.16
857
+	 * @param array $values
858
+	 * @return int | boolean $entry_id
859
+	 */
860 860
 	public static function create_entry_from_xml( $values ) {
861 861
 		$entry_id = self::create_entry( $values, 'xml' );
862 862
 
@@ -864,28 +864,28 @@  discard block
 block discarded – undo
864 864
 	}
865 865
 
866 866
 	/**
867
-	* Update entry from an XML import
868
-	* Certain actions aren't necessary when importing (like saving sub entries and modifying other vals)
869
-	*
870
-	* @since 2.0.16
871
-	* @param int $id
872
-	* @param array $values
873
-	* @return int | boolean $updated
874
-	*/
867
+	 * Update entry from an XML import
868
+	 * Certain actions aren't necessary when importing (like saving sub entries and modifying other vals)
869
+	 *
870
+	 * @since 2.0.16
871
+	 * @param int $id
872
+	 * @param array $values
873
+	 * @return int | boolean $updated
874
+	 */
875 875
 	public static function update_entry_from_xml( $id, $values ) {
876 876
 		$updated = self::update_entry( $id, $values, 'xml' );
877 877
 
878 878
 		return $updated;
879 879
 	}
880 880
 
881
-    /**
882
-     * @param string $key
883
-     * @return int entry_id
884
-     */
881
+	/**
882
+	 * @param string $key
883
+	 * @return int entry_id
884
+	 */
885 885
 	public static function get_id_by_key( $key ) {
886
-        $entry_id = FrmDb::get_var( 'frm_items', array( 'item_key' => sanitize_title( $key ) ) );
887
-        return $entry_id;
888
-    }
886
+		$entry_id = FrmDb::get_var( 'frm_items', array( 'item_key' => sanitize_title( $key ) ) );
887
+		return $entry_id;
888
+	}
889 889
 
890 890
 	public static function validate( $values, $exclude = false ) {
891 891
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmEntryValidate::validate' );
Please login to merge, or discard this patch.
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined('ABSPATH') ) {
2
+if ( ! defined( 'ABSPATH' ) ) {
3 3
 	die( 'You are not allowed to call this page directly.' );
4 4
 }
5 5
 
@@ -55,13 +55,13 @@  discard block
 block discarded – undo
55 55
 		unset( $check_val['is_draft'], $check_val['id'], $check_val['item_key'] );
56 56
 
57 57
         if ( $new_values['item_key'] == $new_values['name'] ) {
58
-            unset($check_val['name']);
58
+            unset( $check_val['name'] );
59 59
         }
60 60
 
61 61
         global $wpdb;
62 62
 		$entry_exists = FrmDb::get_col( $wpdb->prefix . 'frm_items', $check_val, 'id', array( 'order_by' => 'created_at DESC' ) );
63 63
 
64
-        if ( ! $entry_exists || empty($entry_exists) || ! isset($values['item_meta']) ) {
64
+        if ( ! $entry_exists || empty( $entry_exists ) || ! isset( $values['item_meta'] ) ) {
65 65
             return false;
66 66
         }
67 67
 
@@ -70,10 +70,10 @@  discard block
 block discarded – undo
70 70
             $is_duplicate = true;
71 71
 
72 72
             //add more checks here to make sure it's a duplicate
73
-            $metas = FrmEntryMeta::get_entry_meta_info($entry_exist);
73
+            $metas = FrmEntryMeta::get_entry_meta_info( $entry_exist );
74 74
             $field_metas = array();
75 75
             foreach ( $metas as $meta ) {
76
-				$field_metas[ $meta->field_id ] = $meta->meta_value;
76
+				$field_metas[$meta->field_id] = $meta->meta_value;
77 77
             }
78 78
 
79 79
             // If prev entry is empty and current entry is not, they are not duplicates
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
                 return false;
83 83
             }
84 84
 
85
-            $diff = array_diff_assoc($field_metas, array_map('maybe_serialize', $values['item_meta']));
85
+            $diff = array_diff_assoc( $field_metas, array_map( 'maybe_serialize', $values['item_meta'] ) );
86 86
             foreach ( $diff as $field_id => $meta_value ) {
87
-                if ( ! empty($meta_value) ) {
87
+                if ( ! empty( $meta_value ) ) {
88 88
                     $is_duplicate = false;
89 89
                     continue;
90 90
                 }
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 		}
114 114
 
115 115
 		// If CSV is importing, don't check for duplicates
116
-		if ( defined('WP_IMPORTING') && WP_IMPORTING ) {
116
+		if ( defined( 'WP_IMPORTING' ) && WP_IMPORTING ) {
117 117
 			return false;
118 118
 		}
119 119
 
@@ -135,8 +135,8 @@  discard block
 block discarded – undo
135 135
         $new_values['name'] = $values->name;
136 136
         $new_values['is_draft'] = $values->is_draft;
137 137
         $new_values['user_id'] = $new_values['updated_by'] = (int) $values->user_id;
138
-        $new_values['form_id'] = $values->form_id ? (int) $values->form_id: null;
139
-        $new_values['created_at'] = $new_values['updated_at'] = current_time('mysql', 1);
138
+        $new_values['form_id'] = $values->form_id ? (int) $values->form_id : null;
139
+        $new_values['created_at'] = $new_values['updated_at'] = current_time( 'mysql', 1 );
140 140
 
141 141
 		$query_results = $wpdb->insert( $wpdb->prefix . 'frm_items', $new_values );
142 142
         if ( ! $query_results ) {
@@ -146,12 +146,12 @@  discard block
 block discarded – undo
146 146
         $entry_id = $wpdb->insert_id;
147 147
 
148 148
         global $frm_vars;
149
-        if ( ! isset($frm_vars['saved_entries']) ) {
149
+        if ( ! isset( $frm_vars['saved_entries'] ) ) {
150 150
             $frm_vars['saved_entries'] = array();
151 151
         }
152 152
         $frm_vars['saved_entries'][] = (int) $entry_id;
153 153
 
154
-        FrmEntryMeta::duplicate_entry_metas($id, $entry_id);
154
+        FrmEntryMeta::duplicate_entry_metas( $id, $entry_id );
155 155
 		self::clear_cache();
156 156
 
157 157
 		do_action( 'frm_after_duplicate_entry', $entry_id, $new_values['form_id'], array( 'old_id' => $id ) );
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 
191 191
 		$new_values = self::package_entry_to_update( $id, $values );
192 192
 
193
-		$query_results = $wpdb->update( $wpdb->prefix . 'frm_items', $new_values, compact('id') );
193
+		$query_results = $wpdb->update( $wpdb->prefix . 'frm_items', $new_values, compact( 'id' ) );
194 194
 
195 195
 		self::after_update_entry( $query_results, $id, $values, $new_values );
196 196
 
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
             return $result;
208 208
         }
209 209
 
210
-        do_action('frm_before_destroy_entry', $id, $entry);
210
+        do_action( 'frm_before_destroy_entry', $id, $entry );
211 211
 
212 212
 		$wpdb->query( $wpdb->prepare( 'DELETE FROM ' . $wpdb->prefix . 'frm_item_metas WHERE item_id=%d', $id ) );
213 213
 		$result = $wpdb->query( $wpdb->prepare( 'DELETE FROM ' . $wpdb->prefix . 'frm_items WHERE id=%d', $id ) );
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 
220 220
 	public static function &update_form( $id, $value, $form_id ) {
221 221
         global $wpdb;
222
-        $form_id = isset($value) ? $form_id : null;
222
+        $form_id = isset( $value ) ? $form_id : null;
223 223
 		$result = $wpdb->update( $wpdb->prefix . 'frm_items', array( 'form_id' => $form_id ), array( 'id' => $id ) );
224 224
 		if ( $result ) {
225 225
 			self::clear_cache();
@@ -266,24 +266,24 @@  discard block
 block discarded – undo
266 266
         $query = "SELECT it.*, fr.name as form_name, fr.form_key as form_key FROM {$wpdb->prefix}frm_items it
267 267
                   LEFT OUTER JOIN {$wpdb->prefix}frm_forms fr ON it.form_id=fr.id WHERE ";
268 268
 
269
-        $query .= is_numeric($id) ? 'it.id=%d' : 'it.item_key=%s';
269
+        $query .= is_numeric( $id ) ? 'it.id=%d' : 'it.item_key=%s';
270 270
         $query_args = array( $id );
271 271
         $query = $wpdb->prepare( $query, $query_args );
272 272
 
273 273
         if ( ! $meta ) {
274 274
 			$entry = FrmAppHelper::check_cache( $id . '_nometa', 'frm_entry', $query, 'get_row' );
275
-            return stripslashes_deep($entry);
275
+            return stripslashes_deep( $entry );
276 276
         }
277 277
 
278 278
         $entry = FrmAppHelper::check_cache( $id, 'frm_entry' );
279 279
         if ( $entry !== false ) {
280
-            return stripslashes_deep($entry);
280
+            return stripslashes_deep( $entry );
281 281
         }
282 282
 
283 283
         $entry = $wpdb->get_row( $query );
284
-        $entry = self::get_meta($entry);
284
+        $entry = self::get_meta( $entry );
285 285
 
286
-        return stripslashes_deep($entry);
286
+        return stripslashes_deep( $entry );
287 287
     }
288 288
 
289 289
 	public static function get_meta( $entry ) {
@@ -299,23 +299,23 @@  discard block
 block discarded – undo
299 299
 		$include_key = apply_filters( 'frm_include_meta_keys', false, array( 'form_id' => $entry->form_id ) );
300 300
         foreach ( $metas as $meta_val ) {
301 301
             if ( $meta_val->item_id == $entry->id ) {
302
-				$entry->metas[ $meta_val->field_id ] = maybe_unserialize( $meta_val->meta_value );
302
+				$entry->metas[$meta_val->field_id] = maybe_unserialize( $meta_val->meta_value );
303 303
 				if ( $include_key ) {
304
-					$entry->metas[ $meta_val->field_key ] = $entry->metas[ $meta_val->field_id ];
304
+					$entry->metas[$meta_val->field_key] = $entry->metas[$meta_val->field_id];
305 305
 				}
306 306
                  continue;
307 307
             }
308 308
 
309 309
             // include sub entries in an array
310
-			if ( ! isset( $entry_metas[ $meta_val->field_id ] ) ) {
311
-				$entry->metas[ $meta_val->field_id ] = array();
310
+			if ( ! isset( $entry_metas[$meta_val->field_id] ) ) {
311
+				$entry->metas[$meta_val->field_id] = array();
312 312
             }
313 313
 
314
-			$entry->metas[ $meta_val->field_id ][] = maybe_unserialize( $meta_val->meta_value );
314
+			$entry->metas[$meta_val->field_id][] = maybe_unserialize( $meta_val->meta_value );
315 315
 
316
-            unset($meta_val);
316
+            unset( $meta_val );
317 317
         }
318
-        unset($metas);
318
+        unset( $metas );
319 319
 
320 320
 		FrmAppHelper::set_cache( $entry->id, $entry, 'frm_entry' );
321 321
 
@@ -333,24 +333,24 @@  discard block
 block discarded – undo
333 333
             return $exists;
334 334
         }
335 335
 
336
-        if ( is_numeric($id) ) {
336
+        if ( is_numeric( $id ) ) {
337 337
             $where = array( 'id' => $id );
338 338
         } else {
339 339
             $where = array( 'item_key' => $id );
340 340
         }
341 341
 		$id = FrmDb::get_var( $wpdb->prefix . 'frm_items', $where );
342 342
 
343
-        $exists = ($id && $id > 0) ? true : false;
343
+        $exists = ( $id && $id > 0 ) ? true : false;
344 344
         return $exists;
345 345
     }
346 346
 
347 347
     public static function getAll( $where, $order_by = '', $limit = '', $meta = false, $inc_form = true ) {
348 348
 		global $wpdb;
349 349
 
350
-        $limit = FrmAppHelper::esc_limit($limit);
350
+        $limit = FrmAppHelper::esc_limit( $limit );
351 351
 
352
-        $cache_key = maybe_serialize($where) . $order_by . $limit . $inc_form;
353
-        $entries = wp_cache_get($cache_key, 'frm_entry');
352
+        $cache_key = maybe_serialize( $where ) . $order_by . $limit . $inc_form;
353
+        $entries = wp_cache_get( $cache_key, 'frm_entry' );
354 354
 
355 355
         if ( false === $entries ) {
356 356
             $fields = 'it.id, it.item_key, it.name, it.ip, it.form_id, it.post_id, it.user_id, it.parent_item_id, it.updated_by, it.created_at, it.updated_at, it.is_draft';
@@ -369,25 +369,25 @@  discard block
 block discarded – undo
369 369
 		    }
370 370
 
371 371
 			// prepare the query
372
-			$query = 'SELECT ' . $fields . ' FROM ' . $table . FrmAppHelper::prepend_and_or_where(' WHERE ', $where) . $order_by . $limit;
372
+			$query = 'SELECT ' . $fields . ' FROM ' . $table . FrmAppHelper::prepend_and_or_where( ' WHERE ', $where ) . $order_by . $limit;
373 373
 
374
-            $entries = $wpdb->get_results($query, OBJECT_K);
375
-            unset($query);
374
+            $entries = $wpdb->get_results( $query, OBJECT_K );
375
+            unset( $query );
376 376
 
377 377
 			FrmAppHelper::set_cache( $cache_key, $entries, 'frm_entry' );
378 378
         }
379 379
 
380 380
         if ( ! $meta || ! $entries ) {
381
-            return stripslashes_deep($entries);
381
+            return stripslashes_deep( $entries );
382 382
         }
383
-        unset($meta);
383
+        unset( $meta );
384 384
 
385
-        if ( ! is_array( $where ) && preg_match('/^it\.form_id=\d+$/', $where) ) {
385
+        if ( ! is_array( $where ) && preg_match( '/^it\.form_id=\d+$/', $where ) ) {
386 386
 			$where = array( 'it.form_id' => substr( $where, 11 ) );
387 387
         }
388 388
 
389 389
         $meta_where = array( 'field_id !' => 0 );
390
-        if ( $limit == '' && is_array($where) && count($where) == 1 && isset($where['it.form_id']) ) {
390
+        if ( $limit == '' && is_array( $where ) && count( $where ) == 1 && isset( $where['it.form_id'] ) ) {
391 391
             $meta_where['fi.form_id'] = $where['it.form_id'];
392 392
         } else {
393 393
             $meta_where['item_id'] = array_keys( $entries );
@@ -398,21 +398,21 @@  discard block
 block discarded – undo
398 398
         unset( $meta_where );
399 399
 
400 400
         if ( ! $metas ) {
401
-            return stripslashes_deep($entries);
401
+            return stripslashes_deep( $entries );
402 402
         }
403 403
 
404 404
         foreach ( $metas as $m_key => $meta_val ) {
405
-            if ( ! isset( $entries[ $meta_val->item_id ] ) ) {
405
+            if ( ! isset( $entries[$meta_val->item_id] ) ) {
406 406
                 continue;
407 407
             }
408 408
 
409
-            if ( ! isset( $entries[ $meta_val->item_id ]->metas ) ) {
410
-				$entries[ $meta_val->item_id ]->metas = array();
409
+            if ( ! isset( $entries[$meta_val->item_id]->metas ) ) {
410
+				$entries[$meta_val->item_id]->metas = array();
411 411
             }
412 412
 
413
-			$entries[ $meta_val->item_id ]->metas[ $meta_val->field_id ] = maybe_unserialize( $meta_val->meta_value );
413
+			$entries[$meta_val->item_id]->metas[$meta_val->field_id] = maybe_unserialize( $meta_val->meta_value );
414 414
 
415
-            unset($m_key, $meta_val);
415
+            unset( $m_key, $meta_val );
416 416
         }
417 417
 
418 418
 		if ( ! FrmAppHelper::prevent_caching() ) {
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 			}
423 423
 		}
424 424
 
425
-        return stripslashes_deep($entries);
425
+        return stripslashes_deep( $entries );
426 426
     }
427 427
 
428 428
     // Pagination Methods
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
         global $wpdb;
431 431
 		$table_join = $wpdb->prefix . 'frm_items it LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_forms fr ON it.form_id=fr.id';
432 432
 
433
-        if ( is_numeric($where) ) {
433
+        if ( is_numeric( $where ) ) {
434 434
             $table_join = 'frm_items';
435 435
             $where = array( 'form_id' => $where );
436 436
         }
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
 		self::sanitize_entry_post( $values );
473 473
 
474 474
 		if ( $type != 'xml' ) {
475
-			$values = apply_filters('frm_pre_create_entry', $values);
475
+			$values = apply_filters( 'frm_pre_create_entry', $values );
476 476
 		}
477 477
 
478 478
 		$new_values = self::package_entry_data( $values );
@@ -552,11 +552,11 @@  discard block
 block discarded – undo
552 552
 			'user_id' => self::get_entry_user_id( $values ),
553 553
 		);
554 554
 
555
-		if ( is_array($new_values['name']) ) {
556
-			$new_values['name'] = reset($new_values['name']);
555
+		if ( is_array( $new_values['name'] ) ) {
556
+			$new_values['name'] = reset( $new_values['name'] );
557 557
 		}
558 558
 
559
-		$new_values['updated_by'] = isset($values['updated_by']) ? $values['updated_by'] : $new_values['user_id'];
559
+		$new_values['updated_by'] = isset( $values['updated_by'] ) ? $values['updated_by'] : $new_values['user_id'];
560 560
 
561 561
 		return $new_values;
562 562
 	}
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 	* @return int
570 570
 	*/
571 571
 	private static function get_is_draft_value( $values ) {
572
-		return ( ( isset( $values['frm_saving_draft'] ) && $values['frm_saving_draft'] == 1 ) ||  ( isset( $values['is_draft'] ) && $values['is_draft'] == 1 ) ) ? 1 : 0;
572
+		return ( ( isset( $values['frm_saving_draft'] ) && $values['frm_saving_draft'] == 1 ) || ( isset( $values['is_draft'] ) && $values['is_draft'] == 1 ) ) ? 1 : 0;
573 573
 	}
574 574
 
575 575
 	/**
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
 	* @return int
592 592
 	*/
593 593
 	private static function get_post_id( $values ) {
594
-		return isset( $values['post_id'] ) ? (int) $values['post_id']: 0;
594
+		return isset( $values['post_id'] ) ? (int) $values['post_id'] : 0;
595 595
 	}
596 596
 
597 597
 	/**
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
 	* @return int
603 603
 	*/
604 604
 	private static function get_parent_item_id( $values ) {
605
-		return isset( $values['parent_item_id'] ) ? (int) $values['parent_item_id']: 0;
605
+		return isset( $values['parent_item_id'] ) ? (int) $values['parent_item_id'] : 0;
606 606
 	}
607 607
 
608 608
 	/**
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
 	* @return string
614 614
 	*/
615 615
 	private static function get_created_at( $values ) {
616
-		return isset( $values['created_at'] ) ? $values['created_at']: current_time('mysql', 1);
616
+		return isset( $values['created_at'] ) ? $values['created_at'] : current_time( 'mysql', 1 );
617 617
 	}
618 618
 
619 619
 	/**
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
 	private static function add_new_entry_to_frm_vars( $entry_id ) {
702 702
 		global $frm_vars;
703 703
 
704
-		if ( ! isset($frm_vars['saved_entries']) ) {
704
+		if ( ! isset( $frm_vars['saved_entries'] ) ) {
705 705
 			$frm_vars['saved_entries'] = array();
706 706
 		}
707 707
 
@@ -716,7 +716,7 @@  discard block
 block discarded – undo
716 716
 	* @param int $entry_id
717 717
 	*/
718 718
 	private static function maybe_add_entry_metas( $values, $entry_id ) {
719
-		if ( isset($values['item_meta']) ) {
719
+		if ( isset( $values['item_meta'] ) ) {
720 720
 			FrmEntryMeta::update_entry_metas( $entry_id, $values['item_meta'] );
721 721
 		}
722 722
 	}
@@ -733,7 +733,7 @@  discard block
 block discarded – undo
733 733
 		$is_child = isset( $values['parent_form_id'] ) && isset( $values['parent_nonce'] ) && ! empty( $values['parent_form_id'] ) && wp_verify_nonce( $values['parent_nonce'], 'parent' );
734 734
 
735 735
 		do_action( 'frm_after_create_entry', $entry_id, $new_values['form_id'], compact( 'is_child' ) );
736
-		do_action( 'frm_after_create_entry_' . $new_values['form_id'], $entry_id , compact( 'is_child' ) );
736
+		do_action( 'frm_after_create_entry_' . $new_values['form_id'], $entry_id, compact( 'is_child' ) );
737 737
 	}
738 738
 
739 739
 	/**
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
 		}
775 775
 
776 776
 		if ( $update && $update_type != 'xml' ) {
777
-			$values = apply_filters('frm_pre_update_entry', $values, $id);
777
+			$values = apply_filters( 'frm_pre_update_entry', $values, $id );
778 778
 		}
779 779
 
780 780
 		return $update;
@@ -795,27 +795,27 @@  discard block
 block discarded – undo
795 795
 			'name'      => self::get_new_entry_name( $values ),
796 796
 			'form_id'   => self::get_form_id( $values ),
797 797
 			'is_draft'  => self::get_is_draft_value( $values ),
798
-			'updated_at' => current_time('mysql', 1),
799
-			'updated_by' => isset($values['updated_by']) ? $values['updated_by'] : get_current_user_id(),
798
+			'updated_at' => current_time( 'mysql', 1 ),
799
+			'updated_by' => isset( $values['updated_by'] ) ? $values['updated_by'] : get_current_user_id(),
800 800
 		);
801 801
 
802
-		if ( isset($values['post_id']) ) {
802
+		if ( isset( $values['post_id'] ) ) {
803 803
 			$new_values['post_id'] = (int) $values['post_id'];
804 804
 		}
805 805
 
806
-		if ( isset($values['item_key']) ) {
806
+		if ( isset( $values['item_key'] ) ) {
807 807
 			$new_values['item_key'] = FrmAppHelper::get_unique_key( $values['item_key'], $wpdb->prefix . 'frm_items', 'item_key', $id );
808 808
 		}
809 809
 
810
-		if ( isset($values['parent_item_id']) ) {
810
+		if ( isset( $values['parent_item_id'] ) ) {
811 811
 			$new_values['parent_item_id'] = (int) $values['parent_item_id'];
812 812
 		}
813 813
 
814
-		if ( isset($values['frm_user_id']) && is_numeric($values['frm_user_id']) ) {
814
+		if ( isset( $values['frm_user_id'] ) && is_numeric( $values['frm_user_id'] ) ) {
815 815
 			$new_values['user_id'] = $values['frm_user_id'];
816 816
 		}
817 817
 
818
-		$new_values = apply_filters('frm_update_entry', $new_values, $id);
818
+		$new_values = apply_filters( 'frm_update_entry', $new_values, $id );
819 819
 
820 820
 		return $new_values;
821 821
 	}
Please login to merge, or discard this patch.
classes/controllers/FrmFormActionsController.php 2 patches
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -48,17 +48,17 @@  discard block
 block discarded – undo
48 48
             'highrise'  => 'FrmDefHrsAction',
49 49
         ) );
50 50
 
51
-        include_once(FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/email_action.php');
52
-        include_once(FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/default_actions.php');
51
+        include_once( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/email_action.php' );
52
+        include_once( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/default_actions.php' );
53 53
 
54 54
         foreach ( $action_classes as $action_class ) {
55
-            self::$registered_actions->register($action_class);
55
+            self::$registered_actions->register( $action_class );
56 56
         }
57 57
     }
58 58
 
59 59
 	public static function get_form_actions( $action = 'all' ) {
60 60
         $temp_actions = self::$registered_actions;
61
-        if ( empty($temp_actions) ) {
61
+        if ( empty( $temp_actions ) ) {
62 62
             self::actions_init();
63 63
             $temp_actions = self::$registered_actions->actions;
64 64
         } else {
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
                 return $a;
73 73
             }
74 74
 
75
-			$actions[ $a->id_base ] = $a;
75
+			$actions[$a->id_base] = $a;
76 76
         }
77 77
         unset( $temp_actions, $a );
78 78
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         arsort( $temp_actions );
87 87
         foreach ( $temp_actions as $type => $a ) {
88 88
             if ( ! isset( $a->action_options['active'] ) || empty( $a->action_options['active'] ) ) {
89
-				unset( $actions[ $type ] );
89
+				unset( $actions[$type] );
90 90
                 if ( count( $actions ) <= $action_limit ) {
91 91
                     break;
92 92
                 }
@@ -118,26 +118,26 @@  discard block
 block discarded – undo
118 118
         $action_map = array();
119 119
 
120 120
 		foreach ( $action_controls as $key => $control ) {
121
-            $action_map[ $control->id_base ] = $key;
121
+            $action_map[$control->id_base] = $key;
122 122
         }
123 123
 
124 124
     	foreach ( $form_actions as $action ) {
125
-    	    if ( ! isset( $action_map[ $action->post_excerpt ] ) ) {
125
+    	    if ( ! isset( $action_map[$action->post_excerpt] ) ) {
126 126
     	        // don't try and show settings if action no longer exists
127 127
     	        continue;
128 128
     	    }
129 129
 
130
-    		self::action_control( $action, $form, $action->ID, $action_controls[ $action_map[ $action->post_excerpt ] ], $values );
130
+    		self::action_control( $action, $form, $action->ID, $action_controls[$action_map[$action->post_excerpt]], $values );
131 131
     	}
132 132
     }
133 133
 
134 134
 	public static function action_control( $form_action, $form, $action_key, $action_control, $values ) {
135
-        $action_control->_set($action_key);
135
+        $action_control->_set( $action_key );
136 136
 		include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/form_action.php' );
137 137
     }
138 138
 
139 139
     public static function add_form_action() {
140
-		FrmAppHelper::permission_check('frm_edit_forms');
140
+		FrmAppHelper::permission_check( 'frm_edit_forms' );
141 141
         check_ajax_referer( 'frm_ajax', 'nonce' );
142 142
 
143 143
         global $frm_vars;
@@ -146,55 +146,55 @@  discard block
 block discarded – undo
146 146
         $action_type = sanitize_text_field( $_POST['type'] );
147 147
 
148 148
         $action_control = self::get_form_actions( $action_type );
149
-        $action_control->_set($action_key);
149
+        $action_control->_set( $action_key );
150 150
 
151 151
         $form_id = absint( $_POST['form_id'] );
152 152
 
153
-        $form_action = $action_control->prepare_new($form_id);
153
+        $form_action = $action_control->prepare_new( $form_id );
154 154
 
155 155
         $values = array();
156
-        $form = self::fields_to_values($form_id, $values);
156
+        $form = self::fields_to_values( $form_id, $values );
157 157
 
158 158
 		include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/form_action.php' );
159 159
         wp_die();
160 160
     }
161 161
 
162 162
     public static function fill_action() {
163
-		FrmAppHelper::permission_check('frm_edit_forms');
163
+		FrmAppHelper::permission_check( 'frm_edit_forms' );
164 164
         check_ajax_referer( 'frm_ajax', 'nonce' );
165 165
 
166 166
         $action_key = absint( $_POST['action_id'] );
167 167
         $action_type = sanitize_text_field( $_POST['action_type'] );
168 168
 
169 169
         $action_control = self::get_form_actions( $action_type );
170
-        if ( empty($action_control) ) {
170
+        if ( empty( $action_control ) ) {
171 171
             wp_die();
172 172
         }
173 173
 
174 174
         $form_action = $action_control->get_single_action( $action_key );
175 175
 
176 176
         $values = array();
177
-        $form = self::fields_to_values($form_action->menu_order, $values);
177
+        $form = self::fields_to_values( $form_action->menu_order, $values );
178 178
 
179 179
 		include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_action_inside.php' );
180 180
         wp_die();
181 181
     }
182 182
 
183 183
 	private static function fields_to_values( $form_id, array &$values ) {
184
-        $form = FrmForm::getOne($form_id);
184
+        $form = FrmForm::getOne( $form_id );
185 185
 
186 186
 		$values = array( 'fields' => array(), 'id' => $form->id );
187 187
 
188
-        $fields = FrmField::get_all_for_form($form->id);
188
+        $fields = FrmField::get_all_for_form( $form->id );
189 189
         foreach ( $fields as $k => $f ) {
190 190
             $f = (array) $f;
191 191
             $opts = (array) $f['field_options'];
192
-            $f = array_merge($opts, $f);
192
+            $f = array_merge( $opts, $f );
193 193
             if ( ! isset( $f['post_field'] ) ) {
194 194
                 $f['post_field'] = '';
195 195
             }
196 196
             $values['fields'][] = $f;
197
-            unset($k, $f);
197
+            unset( $k, $f );
198 198
         }
199 199
 
200 200
         return $form;
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
         $new_actions = array();
210 210
 
211 211
         foreach ( $registered_actions as $registered_action ) {
212
-            $action_ids = $registered_action->update_callback($form_id);
212
+            $action_ids = $registered_action->update_callback( $form_id );
213 213
             if ( ! empty( $action_ids ) ) {
214 214
                 $new_actions[] = $action_ids;
215 215
             }
@@ -291,33 +291,33 @@  discard block
 block discarded – undo
291 291
             }
292 292
 
293 293
             // store actions so they can be triggered with the correct priority
294
-            $stored_actions[ $action->ID ] = $action;
295
-            $action_priority[ $action->ID ] = $link_settings[ $action->post_excerpt ]->action_options['priority'];
294
+            $stored_actions[$action->ID] = $action;
295
+            $action_priority[$action->ID] = $link_settings[$action->post_excerpt]->action_options['priority'];
296 296
 
297
-            unset($action);
297
+            unset( $action );
298 298
         }
299 299
 
300 300
         if ( ! empty( $stored_actions ) ) {
301
-            asort($action_priority);
301
+            asort( $action_priority );
302 302
 
303 303
             // make sure hooks are loaded
304 304
             new FrmNotification();
305 305
 
306 306
             foreach ( $action_priority as $action_id => $priority ) {
307
-                $action = $stored_actions[ $action_id ];
307
+                $action = $stored_actions[$action_id];
308 308
 				do_action( 'frm_trigger_' . $action->post_excerpt . '_action', $action, $entry, $form, $event );
309 309
 				do_action( 'frm_trigger_' . $action->post_excerpt . '_' . $event . '_action', $action, $entry, $form );
310 310
 
311 311
                 // If post is created, get updated $entry object
312 312
                 if ( $action->post_excerpt == 'wppost' && $event == 'create' ) {
313
-                    $entry = FrmEntry::getOne($entry->id, true);
313
+                    $entry = FrmEntry::getOne( $entry->id, true );
314 314
                 }
315 315
             }
316 316
         }
317 317
     }
318 318
 
319 319
 	public static function duplicate_form_actions( $form_id, $values, $args = array() ) {
320
-        if ( ! isset($args['old_id']) || empty($args['old_id']) ) {
320
+        if ( ! isset( $args['old_id'] ) || empty( $args['old_id'] ) ) {
321 321
             // continue if we know which actions to copy
322 322
             return;
323 323
         }
@@ -351,22 +351,22 @@  discard block
 block discarded – undo
351 351
 	}
352 352
 
353 353
 	public function register( $action_class ) {
354
-		$this->actions[ $action_class ] = new $action_class();
354
+		$this->actions[$action_class] = new $action_class();
355 355
 	}
356 356
 
357 357
 	public function unregister( $action_class ) {
358
-		if ( isset( $this->actions[ $action_class ] ) ) {
359
-			unset($this->actions[ $action_class ]);
358
+		if ( isset( $this->actions[$action_class] ) ) {
359
+			unset( $this->actions[$action_class] );
360 360
 		}
361 361
 	}
362 362
 
363 363
 	public function _register_actions() {
364
-		$keys = array_keys($this->actions);
364
+		$keys = array_keys( $this->actions );
365 365
 
366 366
 		foreach ( $keys as $key ) {
367 367
 			// don't register new action if old action with the same id is already registered
368
-			if ( ! isset( $this->actions[ $key ] ) ) {
369
-			    $this->actions[ $key ]->_register();
368
+			if ( ! isset( $this->actions[$key] ) ) {
369
+			    $this->actions[$key]->_register();
370 370
 			}
371 371
 		}
372 372
 	}
Please login to merge, or discard this patch.
Indentation   +216 added lines, -216 removed lines patch added patch discarded remove patch
@@ -1,109 +1,109 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 class FrmFormActionsController {
4
-    public static $action_post_type = 'frm_form_actions';
5
-    public static $registered_actions;
6
-
7
-    public static function register_post_types() {
8
-        register_post_type( self::$action_post_type, array(
9
-            'label' => __( 'Form Actions', 'formidable' ),
10
-            'description' => '',
11
-            'public' => false,
12
-            'show_ui' => false,
13
-            'exclude_from_search' => true,
14
-            'show_in_nav_menus' => false,
15
-            'show_in_menu' => true,
16
-            'capability_type' => 'page',
17
-            'supports' => array(
4
+	public static $action_post_type = 'frm_form_actions';
5
+	public static $registered_actions;
6
+
7
+	public static function register_post_types() {
8
+		register_post_type( self::$action_post_type, array(
9
+			'label' => __( 'Form Actions', 'formidable' ),
10
+			'description' => '',
11
+			'public' => false,
12
+			'show_ui' => false,
13
+			'exclude_from_search' => true,
14
+			'show_in_nav_menus' => false,
15
+			'show_in_menu' => true,
16
+			'capability_type' => 'page',
17
+			'supports' => array(
18 18
 				'title', 'editor', 'excerpt', 'custom-fields',
19 19
 				'page-attributes',
20
-            ),
21
-            'has_archive' => false,
22
-        ) );
23
-
24
-        /**
25
-         * post_content: json settings
26
-         * menu_order: form id
27
-         * post_excerpt: action type
28
-         */
29
-
30
-        self::actions_init();
31
-    }
32
-
33
-    public static function actions_init() {
34
-        self::$registered_actions = new Frm_Form_Action_Factory();
35
-        self::register_actions();
36
-        do_action( 'frm_form_actions_init' );
37
-    }
38
-
39
-    public static function register_actions() {
40
-        $action_classes = apply_filters( 'frm_registered_form_actions', array(
41
-            'email'     => 'FrmEmailAction',
42
-            'wppost'    => 'FrmDefPostAction',
43
-            'register'  => 'FrmDefRegAction',
44
-            'paypal'    => 'FrmDefPayPalAction',
45
-            //'aweber'    => 'FrmDefAweberAction',
46
-            'mailchimp' => 'FrmDefMlcmpAction',
47
-            'twilio'    => 'FrmDefTwilioAction',
48
-            'highrise'  => 'FrmDefHrsAction',
49
-        ) );
50
-
51
-        include_once(FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/email_action.php');
52
-        include_once(FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/default_actions.php');
53
-
54
-        foreach ( $action_classes as $action_class ) {
55
-            self::$registered_actions->register($action_class);
56
-        }
57
-    }
20
+			),
21
+			'has_archive' => false,
22
+		) );
23
+
24
+		/**
25
+		 * post_content: json settings
26
+		 * menu_order: form id
27
+		 * post_excerpt: action type
28
+		 */
29
+
30
+		self::actions_init();
31
+	}
32
+
33
+	public static function actions_init() {
34
+		self::$registered_actions = new Frm_Form_Action_Factory();
35
+		self::register_actions();
36
+		do_action( 'frm_form_actions_init' );
37
+	}
38
+
39
+	public static function register_actions() {
40
+		$action_classes = apply_filters( 'frm_registered_form_actions', array(
41
+			'email'     => 'FrmEmailAction',
42
+			'wppost'    => 'FrmDefPostAction',
43
+			'register'  => 'FrmDefRegAction',
44
+			'paypal'    => 'FrmDefPayPalAction',
45
+			//'aweber'    => 'FrmDefAweberAction',
46
+			'mailchimp' => 'FrmDefMlcmpAction',
47
+			'twilio'    => 'FrmDefTwilioAction',
48
+			'highrise'  => 'FrmDefHrsAction',
49
+		) );
50
+
51
+		include_once(FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/email_action.php');
52
+		include_once(FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/default_actions.php');
53
+
54
+		foreach ( $action_classes as $action_class ) {
55
+			self::$registered_actions->register($action_class);
56
+		}
57
+	}
58 58
 
59 59
 	public static function get_form_actions( $action = 'all' ) {
60
-        $temp_actions = self::$registered_actions;
61
-        if ( empty($temp_actions) ) {
62
-            self::actions_init();
63
-            $temp_actions = self::$registered_actions->actions;
64
-        } else {
65
-            $temp_actions = $temp_actions->actions;
66
-        }
60
+		$temp_actions = self::$registered_actions;
61
+		if ( empty($temp_actions) ) {
62
+			self::actions_init();
63
+			$temp_actions = self::$registered_actions->actions;
64
+		} else {
65
+			$temp_actions = $temp_actions->actions;
66
+		}
67 67
 
68
-        $actions = array();
68
+		$actions = array();
69 69
 
70
-        foreach ( $temp_actions as $a ) {
71
-            if ( 'all' != $action && $a->id_base == $action ) {
72
-                return $a;
73
-            }
70
+		foreach ( $temp_actions as $a ) {
71
+			if ( 'all' != $action && $a->id_base == $action ) {
72
+				return $a;
73
+			}
74 74
 
75 75
 			$actions[ $a->id_base ] = $a;
76
-        }
77
-        unset( $temp_actions, $a );
78
-
79
-        $action_limit = 10;
80
-        if ( count( $actions ) <= $action_limit ) {
81
-            return $actions;
82
-        }
83
-
84
-        // remove the last few inactive icons if there are too many
85
-        $temp_actions = $actions;
86
-        arsort( $temp_actions );
87
-        foreach ( $temp_actions as $type => $a ) {
88
-            if ( ! isset( $a->action_options['active'] ) || empty( $a->action_options['active'] ) ) {
76
+		}
77
+		unset( $temp_actions, $a );
78
+
79
+		$action_limit = 10;
80
+		if ( count( $actions ) <= $action_limit ) {
81
+			return $actions;
82
+		}
83
+
84
+		// remove the last few inactive icons if there are too many
85
+		$temp_actions = $actions;
86
+		arsort( $temp_actions );
87
+		foreach ( $temp_actions as $type => $a ) {
88
+			if ( ! isset( $a->action_options['active'] ) || empty( $a->action_options['active'] ) ) {
89 89
 				unset( $actions[ $type ] );
90
-                if ( count( $actions ) <= $action_limit ) {
91
-                    break;
92
-                }
93
-            }
94
-            unset( $type, $a );
95
-        }
90
+				if ( count( $actions ) <= $action_limit ) {
91
+					break;
92
+				}
93
+			}
94
+			unset( $type, $a );
95
+		}
96 96
 
97
-        return $actions;
98
-    }
97
+		return $actions;
98
+	}
99 99
 
100 100
 	/**
101 101
 	 * @since 2.0
102 102
 	 */
103
-    public static function list_actions( $form, $values ) {
104
-        if ( empty( $form ) ) {
105
-            return;
106
-        }
103
+	public static function list_actions( $form, $values ) {
104
+		if ( empty( $form ) ) {
105
+			return;
106
+		}
107 107
 
108 108
 		/**
109 109
 		 * use this hook to migrate old settings into a new action
@@ -113,116 +113,116 @@  discard block
 block discarded – undo
113 113
 
114 114
 		$form_actions = FrmFormAction::get_action_for_form( $form->id );
115 115
 
116
-        $action_controls = self::get_form_actions();
116
+		$action_controls = self::get_form_actions();
117 117
 
118
-        $action_map = array();
118
+		$action_map = array();
119 119
 
120 120
 		foreach ( $action_controls as $key => $control ) {
121
-            $action_map[ $control->id_base ] = $key;
122
-        }
121
+			$action_map[ $control->id_base ] = $key;
122
+		}
123 123
 
124
-    	foreach ( $form_actions as $action ) {
125
-    	    if ( ! isset( $action_map[ $action->post_excerpt ] ) ) {
126
-    	        // don't try and show settings if action no longer exists
127
-    	        continue;
128
-    	    }
124
+		foreach ( $form_actions as $action ) {
125
+			if ( ! isset( $action_map[ $action->post_excerpt ] ) ) {
126
+				// don't try and show settings if action no longer exists
127
+				continue;
128
+			}
129 129
 
130
-    		self::action_control( $action, $form, $action->ID, $action_controls[ $action_map[ $action->post_excerpt ] ], $values );
131
-    	}
132
-    }
130
+			self::action_control( $action, $form, $action->ID, $action_controls[ $action_map[ $action->post_excerpt ] ], $values );
131
+		}
132
+	}
133 133
 
134 134
 	public static function action_control( $form_action, $form, $action_key, $action_control, $values ) {
135
-        $action_control->_set($action_key);
135
+		$action_control->_set($action_key);
136 136
 		include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/form_action.php' );
137
-    }
137
+	}
138 138
 
139
-    public static function add_form_action() {
139
+	public static function add_form_action() {
140 140
 		FrmAppHelper::permission_check('frm_edit_forms');
141
-        check_ajax_referer( 'frm_ajax', 'nonce' );
141
+		check_ajax_referer( 'frm_ajax', 'nonce' );
142 142
 
143
-        global $frm_vars;
143
+		global $frm_vars;
144 144
 
145 145
 		$action_key = absint( $_POST['list_id'] );
146
-        $action_type = sanitize_text_field( $_POST['type'] );
146
+		$action_type = sanitize_text_field( $_POST['type'] );
147 147
 
148
-        $action_control = self::get_form_actions( $action_type );
149
-        $action_control->_set($action_key);
148
+		$action_control = self::get_form_actions( $action_type );
149
+		$action_control->_set($action_key);
150 150
 
151
-        $form_id = absint( $_POST['form_id'] );
151
+		$form_id = absint( $_POST['form_id'] );
152 152
 
153
-        $form_action = $action_control->prepare_new($form_id);
153
+		$form_action = $action_control->prepare_new($form_id);
154 154
 
155
-        $values = array();
156
-        $form = self::fields_to_values($form_id, $values);
155
+		$values = array();
156
+		$form = self::fields_to_values($form_id, $values);
157 157
 
158 158
 		include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/form_action.php' );
159
-        wp_die();
160
-    }
159
+		wp_die();
160
+	}
161 161
 
162
-    public static function fill_action() {
162
+	public static function fill_action() {
163 163
 		FrmAppHelper::permission_check('frm_edit_forms');
164
-        check_ajax_referer( 'frm_ajax', 'nonce' );
164
+		check_ajax_referer( 'frm_ajax', 'nonce' );
165 165
 
166
-        $action_key = absint( $_POST['action_id'] );
167
-        $action_type = sanitize_text_field( $_POST['action_type'] );
166
+		$action_key = absint( $_POST['action_id'] );
167
+		$action_type = sanitize_text_field( $_POST['action_type'] );
168 168
 
169
-        $action_control = self::get_form_actions( $action_type );
170
-        if ( empty($action_control) ) {
171
-            wp_die();
172
-        }
169
+		$action_control = self::get_form_actions( $action_type );
170
+		if ( empty($action_control) ) {
171
+			wp_die();
172
+		}
173 173
 
174
-        $form_action = $action_control->get_single_action( $action_key );
174
+		$form_action = $action_control->get_single_action( $action_key );
175 175
 
176
-        $values = array();
177
-        $form = self::fields_to_values($form_action->menu_order, $values);
176
+		$values = array();
177
+		$form = self::fields_to_values($form_action->menu_order, $values);
178 178
 
179 179
 		include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_action_inside.php' );
180
-        wp_die();
181
-    }
180
+		wp_die();
181
+	}
182 182
 
183 183
 	private static function fields_to_values( $form_id, array &$values ) {
184
-        $form = FrmForm::getOne($form_id);
184
+		$form = FrmForm::getOne($form_id);
185 185
 
186 186
 		$values = array( 'fields' => array(), 'id' => $form->id );
187 187
 
188
-        $fields = FrmField::get_all_for_form($form->id);
189
-        foreach ( $fields as $k => $f ) {
190
-            $f = (array) $f;
191
-            $opts = (array) $f['field_options'];
192
-            $f = array_merge($opts, $f);
193
-            if ( ! isset( $f['post_field'] ) ) {
194
-                $f['post_field'] = '';
195
-            }
196
-            $values['fields'][] = $f;
197
-            unset($k, $f);
198
-        }
199
-
200
-        return $form;
201
-    }
188
+		$fields = FrmField::get_all_for_form($form->id);
189
+		foreach ( $fields as $k => $f ) {
190
+			$f = (array) $f;
191
+			$opts = (array) $f['field_options'];
192
+			$f = array_merge($opts, $f);
193
+			if ( ! isset( $f['post_field'] ) ) {
194
+				$f['post_field'] = '';
195
+			}
196
+			$values['fields'][] = $f;
197
+			unset($k, $f);
198
+		}
199
+
200
+		return $form;
201
+	}
202 202
 
203 203
 	public static function update_settings( $form_id ) {
204
-        global $wpdb;
204
+		global $wpdb;
205 205
 
206
-        $registered_actions = self::$registered_actions->actions;
206
+		$registered_actions = self::$registered_actions->actions;
207 207
 
208 208
 		$old_actions = FrmDb::get_col( $wpdb->posts, array( 'post_type' => self::$action_post_type, 'menu_order' => $form_id ), 'ID' );
209
-        $new_actions = array();
209
+		$new_actions = array();
210 210
 
211
-        foreach ( $registered_actions as $registered_action ) {
212
-            $action_ids = $registered_action->update_callback($form_id);
213
-            if ( ! empty( $action_ids ) ) {
214
-                $new_actions[] = $action_ids;
215
-            }
216
-        }
211
+		foreach ( $registered_actions as $registered_action ) {
212
+			$action_ids = $registered_action->update_callback($form_id);
213
+			if ( ! empty( $action_ids ) ) {
214
+				$new_actions[] = $action_ids;
215
+			}
216
+		}
217 217
 
218
-        //Only use array_merge if there are new actions
219
-        if ( ! empty( $new_actions ) ) {
220
-            $new_actions = call_user_func_array( 'array_merge', $new_actions );
221
-        }
222
-        $old_actions = array_diff( $old_actions, $new_actions );
218
+		//Only use array_merge if there are new actions
219
+		if ( ! empty( $new_actions ) ) {
220
+			$new_actions = call_user_func_array( 'array_merge', $new_actions );
221
+		}
222
+		$old_actions = array_diff( $old_actions, $new_actions );
223 223
 
224 224
 		self::delete_missing_actions( $old_actions );
225
-    }
225
+	}
226 226
 
227 227
 	public static function delete_missing_actions( $old_actions ) {
228 228
 		if ( ! empty( $old_actions ) ) {
@@ -242,36 +242,36 @@  discard block
 block discarded – undo
242 242
 		self::trigger_actions( $event, $form_id, $entry_id, 'all', $args );
243 243
 	}
244 244
 
245
-    /**
246
-     * @param string $event
247
-     */
245
+	/**
246
+	 * @param string $event
247
+	 */
248 248
 	public static function trigger_actions( $event, $form, $entry, $type = 'all', $args = array() ) {
249 249
 		$form_actions = FrmFormAction::get_action_for_form( ( is_object( $form ) ? $form->id : $form ), $type );
250 250
 
251 251
 		if ( empty( $form_actions ) ) {
252
-            return;
253
-        }
252
+			return;
253
+		}
254 254
 
255 255
 		FrmForm::maybe_get_form( $form );
256 256
 
257
-        $link_settings = self::get_form_actions( $type );
258
-        if ( 'all' != $type ) {
259
-            $link_settings = array( $type => $link_settings );
260
-        }
257
+		$link_settings = self::get_form_actions( $type );
258
+		if ( 'all' != $type ) {
259
+			$link_settings = array( $type => $link_settings );
260
+		}
261 261
 
262
-        $stored_actions = $action_priority = array();
262
+		$stored_actions = $action_priority = array();
263 263
 
264 264
 		$importing = in_array( $event, array( 'create', 'update' ) ) && defined( 'WP_IMPORTING' ) && WP_IMPORTING;
265 265
 
266
-        foreach ( $form_actions as $action ) {
266
+		foreach ( $form_actions as $action ) {
267 267
 			$trigger_on_import = $importing && in_array( 'import', $action->post_content['event'] );
268 268
 			if ( ! in_array( $event, $action->post_content['event'] ) && ! $trigger_on_import ) {
269
-                continue;
270
-            }
269
+				continue;
270
+			}
271 271
 
272
-            if ( ! is_object( $entry ) ) {
273
-                $entry = FrmEntry::getOne( $entry, true );
274
-            }
272
+			if ( ! is_object( $entry ) ) {
273
+				$entry = FrmEntry::getOne( $entry, true );
274
+			}
275 275
 
276 276
 			if ( empty( $entry ) || ( $entry->is_draft && $event != 'draft' ) ) {
277 277
 				continue;
@@ -285,64 +285,64 @@  discard block
 block discarded – undo
285 285
 				if ( ! $trigger_children ) {
286 286
 					continue;
287 287
 				}
288
-            }
288
+			}
289 289
 
290
-            // check conditional logic
290
+			// check conditional logic
291 291
 			$stop = FrmFormAction::action_conditions_met( $action, $entry );
292
-            if ( $stop ) {
293
-                continue;
294
-            }
292
+			if ( $stop ) {
293
+				continue;
294
+			}
295 295
 
296
-            // store actions so they can be triggered with the correct priority
297
-            $stored_actions[ $action->ID ] = $action;
298
-            $action_priority[ $action->ID ] = $link_settings[ $action->post_excerpt ]->action_options['priority'];
296
+			// store actions so they can be triggered with the correct priority
297
+			$stored_actions[ $action->ID ] = $action;
298
+			$action_priority[ $action->ID ] = $link_settings[ $action->post_excerpt ]->action_options['priority'];
299 299
 
300
-            unset($action);
301
-        }
300
+			unset($action);
301
+		}
302 302
 
303
-        if ( ! empty( $stored_actions ) ) {
304
-            asort($action_priority);
303
+		if ( ! empty( $stored_actions ) ) {
304
+			asort($action_priority);
305 305
 
306
-            // make sure hooks are loaded
307
-            new FrmNotification();
306
+			// make sure hooks are loaded
307
+			new FrmNotification();
308 308
 
309
-            foreach ( $action_priority as $action_id => $priority ) {
310
-                $action = $stored_actions[ $action_id ];
309
+			foreach ( $action_priority as $action_id => $priority ) {
310
+				$action = $stored_actions[ $action_id ];
311 311
 				do_action( 'frm_trigger_' . $action->post_excerpt . '_action', $action, $entry, $form, $event );
312 312
 				do_action( 'frm_trigger_' . $action->post_excerpt . '_' . $event . '_action', $action, $entry, $form );
313 313
 
314
-                // If post is created, get updated $entry object
315
-                if ( $action->post_excerpt == 'wppost' && $event == 'create' ) {
316
-                    $entry = FrmEntry::getOne($entry->id, true);
317
-                }
318
-            }
319
-        }
320
-    }
314
+				// If post is created, get updated $entry object
315
+				if ( $action->post_excerpt == 'wppost' && $event == 'create' ) {
316
+					$entry = FrmEntry::getOne($entry->id, true);
317
+				}
318
+			}
319
+		}
320
+	}
321 321
 
322 322
 	public static function duplicate_form_actions( $form_id, $values, $args = array() ) {
323
-        if ( ! isset($args['old_id']) || empty($args['old_id']) ) {
324
-            // continue if we know which actions to copy
325
-            return;
326
-        }
323
+		if ( ! isset($args['old_id']) || empty($args['old_id']) ) {
324
+			// continue if we know which actions to copy
325
+			return;
326
+		}
327 327
 
328
-        $action_controls = self::get_form_actions( );
328
+		$action_controls = self::get_form_actions( );
329 329
 
330
-        foreach ( $action_controls as $action_control ) {
331
-            $action_control->duplicate_form_actions( $form_id, $args['old_id'] );
332
-            unset( $action_control );
333
-        }
334
-    }
330
+		foreach ( $action_controls as $action_control ) {
331
+			$action_control->duplicate_form_actions( $form_id, $args['old_id'] );
332
+			unset( $action_control );
333
+		}
334
+	}
335 335
 
336
-    public static function limit_by_type( $where ) {
337
-        global $frm_vars, $wpdb;
336
+	public static function limit_by_type( $where ) {
337
+		global $frm_vars, $wpdb;
338 338
 
339
-        if ( ! isset( $frm_vars['action_type'] ) ) {
340
-            return $where;
341
-        }
339
+		if ( ! isset( $frm_vars['action_type'] ) ) {
340
+			return $where;
341
+		}
342 342
 
343
-        $where .= $wpdb->prepare( ' AND post_excerpt = %s ', $frm_vars['action_type'] );
344
-        return $where;
345
-    }
343
+		$where .= $wpdb->prepare( ' AND post_excerpt = %s ', $frm_vars['action_type'] );
344
+		return $where;
345
+	}
346 346
 }
347 347
 
348 348
 
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 		foreach ( $keys as $key ) {
370 370
 			// don't register new action if old action with the same id is already registered
371 371
 			if ( ! isset( $this->actions[ $key ] ) ) {
372
-			    $this->actions[ $key ]->_register();
372
+				$this->actions[ $key ]->_register();
373 373
 			}
374 374
 		}
375 375
 	}
Please login to merge, or discard this patch.
formidable.php 2 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -23,41 +23,41 @@
 block discarded – undo
23 23
 
24 24
 global $frm_vars;
25 25
 $frm_vars = array(
26
-    'load_css' => false, 'forms_loaded' => array(),
27
-    'created_entries'   => array(),
28
-    'pro_is_authorized' => false,
26
+	'load_css' => false, 'forms_loaded' => array(),
27
+	'created_entries'   => array(),
28
+	'pro_is_authorized' => false,
29 29
 );
30 30
 
31 31
 function frm_forms_autoloader( $class_name ) {
32
-    // Only load Frm classes here
32
+	// Only load Frm classes here
33 33
 	if ( ! preg_match( '/^Frm.+$/', $class_name ) ) {
34
-        return;
35
-    }
34
+		return;
35
+	}
36 36
 
37
-    $filepath = dirname(__FILE__);
37
+	$filepath = dirname(__FILE__);
38 38
 	if ( preg_match( '/^FrmPro.+$/', $class_name ) || 'FrmUpdatesController' == $class_name ) {
39
-        $filepath .= '/pro';
40
-    }
41
-    $filepath .= '/classes';
39
+		$filepath .= '/pro';
40
+	}
41
+	$filepath .= '/classes';
42 42
 
43 43
 	if ( preg_match( '/^.+Helper$/', $class_name ) ) {
44
-        $filepath .= '/helpers/';
44
+		$filepath .= '/helpers/';
45 45
 	} else if ( preg_match( '/^.+Controller$/', $class_name ) ) {
46
-        $filepath .= '/controllers/';
47
-    } else {
48
-        $filepath .= '/models/';
49
-    }
46
+		$filepath .= '/controllers/';
47
+	} else {
48
+		$filepath .= '/models/';
49
+	}
50 50
 
51 51
 	$filepath .= $class_name . '.php';
52 52
 
53
-    if ( file_exists($filepath) ) {
54
-        include($filepath);
55
-    }
53
+	if ( file_exists($filepath) ) {
54
+		include($filepath);
55
+	}
56 56
 }
57 57
 
58 58
 // if __autoload is active, put it on the spl_autoload stack
59 59
 if ( is_array(spl_autoload_functions()) && in_array( '__autoload', spl_autoload_functions()) ) {
60
-    spl_autoload_register('__autoload');
60
+	spl_autoload_register('__autoload');
61 61
 }
62 62
 
63 63
 // Add the autoloader
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
         return;
35 35
     }
36 36
 
37
-    $filepath = dirname(__FILE__);
37
+    $filepath = dirname( __FILE__ );
38 38
 	if ( preg_match( '/^FrmPro.+$/', $class_name ) || 'FrmUpdatesController' == $class_name ) {
39 39
         $filepath .= '/pro';
40 40
     }
@@ -50,25 +50,25 @@  discard block
 block discarded – undo
50 50
 
51 51
 	$filepath .= $class_name . '.php';
52 52
 
53
-    if ( file_exists($filepath) ) {
54
-        include($filepath);
53
+    if ( file_exists( $filepath ) ) {
54
+        include( $filepath );
55 55
     }
56 56
 }
57 57
 
58 58
 // if __autoload is active, put it on the spl_autoload stack
59
-if ( is_array(spl_autoload_functions()) && in_array( '__autoload', spl_autoload_functions()) ) {
60
-    spl_autoload_register('__autoload');
59
+if ( is_array( spl_autoload_functions() ) && in_array( '__autoload', spl_autoload_functions() ) ) {
60
+    spl_autoload_register( '__autoload' );
61 61
 }
62 62
 
63 63
 // Add the autoloader
64
-spl_autoload_register('frm_forms_autoloader');
64
+spl_autoload_register( 'frm_forms_autoloader' );
65 65
 
66
-$frm_path = dirname(__FILE__);
67
-if ( file_exists($frm_path . '/pro/formidable-pro.php') ) {
66
+$frm_path = dirname( __FILE__ );
67
+if ( file_exists( $frm_path . '/pro/formidable-pro.php' ) ) {
68 68
 	include( $frm_path . '/pro/formidable-pro.php' );
69 69
 }
70 70
 
71 71
 FrmHooksController::trigger_load_hook();
72 72
 
73 73
 include_once( $frm_path . '/deprecated.php' );
74
-unset($frm_path);
74
+unset( $frm_path );
Please login to merge, or discard this patch.
classes/views/frm-fields/radio.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@
 block discarded – undo
1 1
 <?php
2 2
 if ( ! is_array($field['options']) ) {
3
-    return;
3
+	return;
4 4
 }
5 5
 
6 6
 foreach ( $field['options'] as $opt_key => $opt ) {
7
-    $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
8
-    $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
7
+	$field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
8
+	$opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
9 9
 
10
-    // Get string for Other text field, if needed
10
+	// Get string for Other text field, if needed
11 11
 	$other_val = FrmFieldsHelper::get_other_val( compact( 'opt_key', 'field' ) );
12 12
 
13
-    $checked = ( $other_val || isset($field['value']) &&  (( ! is_array($field['value']) && $field['value'] == $field_val ) || (is_array($field['value']) && in_array($field_val, $field['value']) ) ) ) ? ' checked="checked"':'';
13
+	$checked = ( $other_val || isset($field['value']) &&  (( ! is_array($field['value']) && $field['value'] == $field_val ) || (is_array($field['value']) && in_array($field_val, $field['value']) ) ) ) ? ' checked="checked"':'';
14 14
 
15 15
 	if ( FrmFieldsHelper::is_other_opt( $opt_key ) ) {
16 16
 		include( FrmAppHelper::plugin_path() . '/pro/classes/views/frmpro-fields/other-option.php' );
17
-    } else {
17
+	} else {
18 18
 		include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/single-option.php' );
19
-    }
19
+	}
20 20
 
21
-    unset($checked, $other_val);
21
+	unset($checked, $other_val);
22 22
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! is_array($field['options']) ) {
2
+if ( ! is_array( $field['options'] ) ) {
3 3
     return;
4 4
 }
5 5
 
6 6
 foreach ( $field['options'] as $opt_key => $opt ) {
7
-    $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
8
-    $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
7
+    $field_val = apply_filters( 'frm_field_value_saved', $opt, $opt_key, $field );
8
+    $opt = apply_filters( 'frm_field_label_seen', $opt, $opt_key, $field );
9 9
 
10 10
     // Get string for Other text field, if needed
11 11
 	$other_val = FrmFieldsHelper::get_other_val( compact( 'opt_key', 'field' ) );
12 12
 
13
-    $checked = ( $other_val || isset($field['value']) &&  (( ! is_array($field['value']) && $field['value'] == $field_val ) || (is_array($field['value']) && in_array($field_val, $field['value']) ) ) ) ? ' checked="checked"':'';
13
+    $checked = ( $other_val || isset( $field['value'] ) && ( ( ! is_array( $field['value'] ) && $field['value'] == $field_val ) || ( is_array( $field['value'] ) && in_array( $field_val, $field['value'] ) ) ) ) ? ' checked="checked"' : '';
14 14
 
15 15
 	if ( FrmFieldsHelper::is_other_opt( $opt_key ) ) {
16 16
 		include( FrmAppHelper::plugin_path() . '/pro/classes/views/frmpro-fields/other-option.php' );
@@ -18,5 +18,5 @@  discard block
 block discarded – undo
18 18
 		include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/single-option.php' );
19 19
     }
20 20
 
21
-    unset($checked, $other_val);
21
+    unset( $checked, $other_val );
22 22
 }
Please login to merge, or discard this patch.
classes/views/frm-fields/import_choices.php 2 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -4,18 +4,18 @@  discard block
 block discarded – undo
4 4
     <meta charset="<?php bloginfo( 'charset' ); ?>" />
5 5
     <title><?php bloginfo('name'); ?></title>
6 6
     <?php
7
-    wp_admin_css( 'global' );
8
-    wp_admin_css();
9
-    wp_admin_css( 'colors' );
10
-    wp_admin_css( 'ie' );
7
+	wp_admin_css( 'global' );
8
+	wp_admin_css();
9
+	wp_admin_css( 'colors' );
10
+	wp_admin_css( 'ie' );
11 11
 	if ( is_multisite() ) {
12
-    	wp_admin_css( 'ms' );
12
+		wp_admin_css( 'ms' );
13 13
 	}
14 14
 
15
-    do_action('admin_print_styles');
16
-    do_action('admin_print_scripts');
15
+	do_action('admin_print_styles');
16
+	do_action('admin_print_scripts');
17 17
 
18
-    ?>
18
+	?>
19 19
 </head>
20 20
 <body class="wp-admin no-js wp-core-ui frm_field_opts_popup <?php echo esc_attr( apply_filters( 'admin_body_class', '' ) . ' ' . $admin_body_class ); ?>">
21 21
 <div class="frm_med_padding">
@@ -29,21 +29,21 @@  discard block
 block discarded – undo
29 29
 <?php
30 30
 $other_array = array();
31 31
 foreach ( $field->options as $fkey => $fopt ) {
32
-    //If it is an other option, don't include it
33
-    if ( $fkey && strpos( $fkey, 'other') !== false ) {
34
-        continue;
35
-    }
32
+	//If it is an other option, don't include it
33
+	if ( $fkey && strpos( $fkey, 'other') !== false ) {
34
+		continue;
35
+	}
36 36
 	if ( is_array( $fopt ) ) {
37
-        $label = (isset($fopt['label'])) ? $fopt['label'] : reset($fopt);
38
-        $value = (isset($fopt['value'])) ? $fopt['value'] : $label;
37
+		$label = (isset($fopt['label'])) ? $fopt['label'] : reset($fopt);
38
+		$value = (isset($fopt['value'])) ? $fopt['value'] : $label;
39 39
 		if ( $label != $value && FrmField::is_option_true( $field, 'separate_value' ) ) {
40
-            echo "$label|$value\n";
40
+			echo "$label|$value\n";
41 41
 		} else {
42 42
 			echo $label . "\n";
43
-        }
43
+		}
44 44
 	} else {
45 45
 		echo $fopt . "\n";
46
-    }
46
+	}
47 47
 } ?>
48 48
 </textarea>
49 49
 
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 <html <?php language_attributes(); ?>>
3 3
 <head>
4 4
     <meta charset="<?php bloginfo( 'charset' ); ?>" />
5
-    <title><?php bloginfo('name'); ?></title>
5
+    <title><?php bloginfo( 'name' ); ?></title>
6 6
     <?php
7 7
     wp_admin_css( 'global' );
8 8
     wp_admin_css();
@@ -12,8 +12,8 @@  discard block
 block discarded – undo
12 12
     	wp_admin_css( 'ms' );
13 13
 	}
14 14
 
15
-    do_action('admin_print_styles');
16
-    do_action('admin_print_scripts');
15
+    do_action( 'admin_print_styles' );
16
+    do_action( 'admin_print_scripts' );
17 17
 
18 18
     ?>
19 19
 </head>
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 <p class="howto"><?php _e( 'Edit or add field options (one per line)', 'formidable' ) ?></p>
23 23
 <ul class="frm_prepop">
24 24
 	<?php foreach ( $prepop as $label => $pop ) { ?>
25
-    <li><a href="javascript:void(0)" onclick='frmPrePop(<?php echo str_replace("'", '&#145;', json_encode($pop)) ?>); return false;'><?php echo esc_html( $label ) ?></a></li>
25
+    <li><a href="javascript:void(0)" onclick='frmPrePop(<?php echo str_replace( "'", '&#145;', json_encode( $pop ) ) ?>); return false;'><?php echo esc_html( $label ) ?></a></li>
26 26
     <?php } ?>
27 27
 </ul>
28 28
 <textarea name="frm_bulk_options" id="frm_bulk_options">
@@ -30,12 +30,12 @@  discard block
 block discarded – undo
30 30
 $other_array = array();
31 31
 foreach ( $field->options as $fkey => $fopt ) {
32 32
     //If it is an other option, don't include it
33
-    if ( $fkey && strpos( $fkey, 'other') !== false ) {
33
+    if ( $fkey && strpos( $fkey, 'other' ) !== false ) {
34 34
         continue;
35 35
     }
36 36
 	if ( is_array( $fopt ) ) {
37
-        $label = (isset($fopt['label'])) ? $fopt['label'] : reset($fopt);
38
-        $value = (isset($fopt['value'])) ? $fopt['value'] : $label;
37
+        $label = ( isset( $fopt['label'] ) ) ? $fopt['label'] : reset( $fopt );
38
+        $value = ( isset( $fopt['value'] ) ) ? $fopt['value'] : $label;
39 39
 		if ( $label != $value && FrmField::is_option_true( $field, 'separate_value' ) ) {
40 40
             echo "$label|$value\n";
41 41
 		} else {
Please login to merge, or discard this patch.