Completed
Push — master ( 14d726...4e3bcd )
by Jamie
03:31
created
classes/controllers/FrmSettingsController.php 1 patch
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -2,78 +2,78 @@
 block discarded – undo
2 2
 
3 3
 class FrmSettingsController {
4 4
 
5
-    public static function menu() {
5
+	public static function menu() {
6 6
 		// Make sure admins can see the menu items
7 7
 		FrmAppHelper::force_capability( 'frm_change_settings' );
8 8
 
9
-        add_submenu_page( 'formidable', 'Formidable | ' . __( 'Global Settings', 'formidable' ), __( 'Global Settings', 'formidable' ), 'frm_change_settings', 'formidable-settings', 'FrmSettingsController::route' );
10
-    }
9
+		add_submenu_page( 'formidable', 'Formidable | ' . __( 'Global Settings', 'formidable' ), __( 'Global Settings', 'formidable' ), 'frm_change_settings', 'formidable-settings', 'FrmSettingsController::route' );
10
+	}
11 11
 
12
-    public static function license_box() {
12
+	public static function license_box() {
13 13
 		$a = FrmAppHelper::simple_get( 't', 'sanitize_title', 'general_settings' );
14
-        include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/license_box.php' );
15
-    }
14
+		include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/license_box.php' );
15
+	}
16 16
 
17
-    public static function display_form( $errors = array(), $message = '' ) {
18
-        global $frm_vars;
17
+	public static function display_form( $errors = array(), $message = '' ) {
18
+		global $frm_vars;
19 19
 
20
-        $frm_settings = FrmAppHelper::get_settings();
21
-        $frm_roles = FrmAppHelper::frm_capabilities();
20
+		$frm_settings = FrmAppHelper::get_settings();
21
+		$frm_roles = FrmAppHelper::frm_capabilities();
22 22
 
23
-        $uploads = wp_upload_dir();
24
-        $target_path = $uploads['basedir'] . '/formidable/css';
23
+		$uploads = wp_upload_dir();
24
+		$target_path = $uploads['basedir'] . '/formidable/css';
25 25
 
26 26
 		$sections = array();
27 27
 		if ( apply_filters( 'frm_include_addon_page', false ) ) {
28 28
 			$sections['licenses'] = array( 'class' => 'FrmAddonsController', 'function' => 'show_addons' );
29 29
 		}
30
-        $sections = apply_filters( 'frm_add_settings_section', $sections );
30
+		$sections = apply_filters( 'frm_add_settings_section', $sections );
31 31
 
32
-        $captcha_lang = FrmAppHelper::locales( 'captcha' );
32
+		$captcha_lang = FrmAppHelper::locales( 'captcha' );
33 33
 
34
-        require( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/form.php' );
35
-    }
34
+		require( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/form.php' );
35
+	}
36 36
 
37
-    public static function process_form( $stop_load = false ) {
38
-        global $frm_vars;
37
+	public static function process_form( $stop_load = false ) {
38
+		global $frm_vars;
39 39
 
40
-        $frm_settings = FrmAppHelper::get_settings();
40
+		$frm_settings = FrmAppHelper::get_settings();
41 41
 
42 42
 		$process_form = FrmAppHelper::get_post_param( 'process_form', '', 'sanitize_text_field' );
43 43
 		if ( ! wp_verify_nonce( $process_form, 'process_form_nonce' ) ) {
44
-            wp_die( $frm_settings->admin_permission );
45
-        }
44
+			wp_die( $frm_settings->admin_permission );
45
+		}
46 46
 
47
-        $errors = array();
48
-        $message = '';
47
+		$errors = array();
48
+		$message = '';
49 49
 
50
-        if ( ! isset( $frm_vars['settings_routed'] ) || ! $frm_vars['settings_routed'] ) {
51
-            //$errors = $frm_settings->validate($_POST,array());
52
-            $frm_settings->update( stripslashes_deep( $_POST ) );
50
+		if ( ! isset( $frm_vars['settings_routed'] ) || ! $frm_vars['settings_routed'] ) {
51
+			//$errors = $frm_settings->validate($_POST,array());
52
+			$frm_settings->update( stripslashes_deep( $_POST ) );
53 53
 
54
-            if ( empty( $errors ) ) {
55
-                $frm_settings->store();
56
-                $message = __( 'Settings Saved', 'formidable' );
57
-            }
58
-        } else {
59
-            $message = __( 'Settings Saved', 'formidable' );
60
-        }
54
+			if ( empty( $errors ) ) {
55
+				$frm_settings->store();
56
+				$message = __( 'Settings Saved', 'formidable' );
57
+			}
58
+		} else {
59
+			$message = __( 'Settings Saved', 'formidable' );
60
+		}
61 61
 
62 62
 		if ( $stop_load == 'stop_load' ) {
63
-            $frm_vars['settings_routed'] = true;
64
-            return;
65
-        }
63
+			$frm_vars['settings_routed'] = true;
64
+			return;
65
+		}
66 66
 
67
-        self::display_form( $errors, $message );
68
-    }
67
+		self::display_form( $errors, $message );
68
+	}
69 69
 
70
-    public static function route( $stop_load = false ) {
71
-        $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
70
+	public static function route( $stop_load = false ) {
71
+		$action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
72 72
 		$action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
73
-        if ( $action == 'process-form' ) {
74
-            return self::process_form( $stop_load );
75
-        } else if ( $stop_load != 'stop_load' ) {
76
-            return self::display_form();
77
-        }
78
-    }
73
+		if ( $action == 'process-form' ) {
74
+			return self::process_form( $stop_load );
75
+		} else if ( $stop_load != 'stop_load' ) {
76
+			return self::display_form();
77
+		}
78
+	}
79 79
 }
Please login to merge, or discard this patch.
classes/helpers/FrmEntriesHelper.php 1 patch
Indentation   +290 added lines, -290 removed lines patch added patch discarded remove patch
@@ -5,68 +5,68 @@  discard block
 block discarded – undo
5 5
 
6 6
 class FrmEntriesHelper {
7 7
 
8
-    public static function setup_new_vars( $fields, $form = '', $reset = false, $args = array() ) {
9
-        global $frm_vars;
10
-        $values = array();
8
+	public static function setup_new_vars( $fields, $form = '', $reset = false, $args = array() ) {
9
+		global $frm_vars;
10
+		$values = array();
11 11
 		foreach ( array( 'name' => '', 'description' => '', 'item_key' => '' ) as $var => $default ) {
12
-            $values[ $var ] = FrmAppHelper::get_post_param( $var, $default );
13
-        }
14
-
15
-        $values['fields'] = array();
16
-        if ( empty($fields) ) {
17
-            return apply_filters('frm_setup_new_entry', $values);
18
-        }
19
-
20
-        foreach ( (array) $fields as $field ) {
21
-            $new_value = self::get_field_value_for_new_entry( $field, $reset );
22
-
23
-            $field_array = array(
24
-                'id' => $field->id,
25
-                'value' => $new_value,
26
-                'default_value' => $field->default_value,
27
-                'name' => $field->name,
28
-                'description' => $field->description,
29
-                'type' => apply_filters('frm_field_type', $field->type, $field, $new_value),
30
-                'options' => $field->options,
31
-                'required' => $field->required,
32
-                'field_key' => $field->field_key,
33
-                'field_order' => $field->field_order,
34
-                'form_id' => $field->form_id,
12
+			$values[ $var ] = FrmAppHelper::get_post_param( $var, $default );
13
+		}
14
+
15
+		$values['fields'] = array();
16
+		if ( empty($fields) ) {
17
+			return apply_filters('frm_setup_new_entry', $values);
18
+		}
19
+
20
+		foreach ( (array) $fields as $field ) {
21
+			$new_value = self::get_field_value_for_new_entry( $field, $reset );
22
+
23
+			$field_array = array(
24
+				'id' => $field->id,
25
+				'value' => $new_value,
26
+				'default_value' => $field->default_value,
27
+				'name' => $field->name,
28
+				'description' => $field->description,
29
+				'type' => apply_filters('frm_field_type', $field->type, $field, $new_value),
30
+				'options' => $field->options,
31
+				'required' => $field->required,
32
+				'field_key' => $field->field_key,
33
+				'field_order' => $field->field_order,
34
+				'form_id' => $field->form_id,
35 35
 				'parent_form_id' => isset( $args['parent_form_id'] ) ? $args['parent_form_id'] : $field->form_id,
36
-            );
36
+			);
37 37
 
38
-            $opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true);
39
-            $opt_defaults['required_indicator'] = '';
38
+			$opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true);
39
+			$opt_defaults['required_indicator'] = '';
40 40
 			$opt_defaults['original_type'] = $field->type;
41 41
 
42 42
 			foreach ( $opt_defaults as $opt => $default_opt ) {
43
-                $field_array[ $opt ] = ( isset( $field->field_options[ $opt ] ) && $field->field_options[ $opt ] != '' ) ? $field->field_options[ $opt ] : $default_opt;
44
-                unset($opt, $default_opt);
45
-            }
43
+				$field_array[ $opt ] = ( isset( $field->field_options[ $opt ] ) && $field->field_options[ $opt ] != '' ) ? $field->field_options[ $opt ] : $default_opt;
44
+				unset($opt, $default_opt);
45
+			}
46 46
 
47
-            unset($opt_defaults);
47
+			unset($opt_defaults);
48 48
 
49
-            if ( $field_array['custom_html'] == '' ) {
50
-                $field_array['custom_html'] = FrmFieldsHelper::get_default_html($field->type);
51
-            }
49
+			if ( $field_array['custom_html'] == '' ) {
50
+				$field_array['custom_html'] = FrmFieldsHelper::get_default_html($field->type);
51
+			}
52 52
 
53
-            $field_array = apply_filters('frm_setup_new_fields_vars', $field_array, $field);
54
-            $field_array = array_merge( $field->field_options, $field_array );
53
+			$field_array = apply_filters('frm_setup_new_fields_vars', $field_array, $field);
54
+			$field_array = array_merge( $field->field_options, $field_array );
55 55
 
56
-            $values['fields'][] = $field_array;
56
+			$values['fields'][] = $field_array;
57 57
 
58
-            if ( ! $form || ! isset($form->id) ) {
59
-                $form = FrmForm::getOne($field->form_id);
60
-            }
61
-        }
58
+			if ( ! $form || ! isset($form->id) ) {
59
+				$form = FrmForm::getOne($field->form_id);
60
+			}
61
+		}
62 62
 
63
-        $form->options = maybe_unserialize($form->options);
64
-        if ( is_array($form->options) ) {
65
-            foreach ( $form->options as $opt => $value ) {
66
-                $values[ $opt ] = FrmAppHelper::get_post_param( $opt, $value );
67
-                unset($opt, $value);
68
-            }
69
-        }
63
+		$form->options = maybe_unserialize($form->options);
64
+		if ( is_array($form->options) ) {
65
+			foreach ( $form->options as $opt => $value ) {
66
+				$values[ $opt ] = FrmAppHelper::get_post_param( $opt, $value );
67
+				unset($opt, $value);
68
+			}
69
+		}
70 70
 
71 71
 		$form_defaults = FrmFormsHelper::get_default_opts();
72 72
 
@@ -76,18 +76,18 @@  discard block
 block discarded – undo
76 76
 		$values = array_merge( $form_defaults, $values );
77 77
 
78 78
 		return apply_filters( 'frm_setup_new_entry', $values );
79
-    }
79
+	}
80 80
 
81 81
 	/**
82
-	* Set the value for each field
83
-	* This function is used when the form is first loaded and on all page turns *for a new entry*
84
-	*
85
-	* @since 2.0.13
86
-	*
87
-	* @param object $field - this is passed by reference since it is an object
88
-	* @param boolean $reset
89
-	* @return string|array $new_value
90
-	*/
82
+	 * Set the value for each field
83
+	 * This function is used when the form is first loaded and on all page turns *for a new entry*
84
+	 *
85
+	 * @since 2.0.13
86
+	 *
87
+	 * @param object $field - this is passed by reference since it is an object
88
+	 * @param boolean $reset
89
+	 * @return string|array $new_value
90
+	 */
91 91
 	private static function get_field_value_for_new_entry( $field, $reset ) {
92 92
 		//If checkbox, multi-select dropdown, or checkbox data from entries field, the value should be an array
93 93
 		$return_array = FrmField::is_field_with_multiple_values( $field );
@@ -118,15 +118,15 @@  discard block
 block discarded – undo
118 118
 
119 119
 	public static function setup_edit_vars( $values, $record ) {
120 120
 		$values['item_key'] = FrmAppHelper::get_post_param( 'item_key', $record->item_key, 'sanitize_title' );
121
-        $values['form_id'] = $record->form_id;
122
-        $values['is_draft'] = $record->is_draft;
123
-        return apply_filters('frm_setup_edit_entry_vars', $values, $record);
124
-    }
121
+		$values['form_id'] = $record->form_id;
122
+		$values['is_draft'] = $record->is_draft;
123
+		return apply_filters('frm_setup_edit_entry_vars', $values, $record);
124
+	}
125 125
 
126
-    public static function get_admin_params( $form = null ) {
126
+	public static function get_admin_params( $form = null ) {
127 127
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmForm::get_admin_params' );
128 128
 		return FrmForm::set_current_form( $form );
129
-    }
129
+	}
130 130
 
131 131
 	public static function set_current_form( $form_id ) {
132 132
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmForm::set_current_form' );
@@ -138,280 +138,280 @@  discard block
 block discarded – undo
138 138
 		return FrmForm::get_current_form( $form_id );
139 139
 	}
140 140
 
141
-    public static function get_current_form_id() {
141
+	public static function get_current_form_id() {
142 142
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmForm::get_current_form_id' );
143 143
 		return FrmForm::get_current_form_id();
144
-    }
144
+	}
145 145
 
146
-    public static function maybe_get_entry( &$entry ) {
146
+	public static function maybe_get_entry( &$entry ) {
147 147
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmEntry::maybe_get_entry' );
148 148
 		FrmEntry::maybe_get_entry( $entry );
149
-    }
149
+	}
150 150
 
151 151
 	public static function replace_default_message( $message, $atts ) {
152
-        if ( strpos($message, '[default-message') === false &&
153
-            strpos($message, '[default_message') === false &&
154
-            ! empty( $message ) ) {
155
-            return $message;
156
-        }
157
-
158
-        if ( empty($message) ) {
159
-            $message = '[default-message]';
160
-        }
161
-
162
-        preg_match_all("/\[(default-message|default_message)\b(.*?)(?:(\/))?\]/s", $message, $shortcodes, PREG_PATTERN_ORDER);
163
-
164
-        foreach ( $shortcodes[0] as $short_key => $tag ) {
165
-            $add_atts = shortcode_parse_atts( $shortcodes[2][ $short_key ] );
166
-            if ( $add_atts ) {
167
-                $this_atts = array_merge($atts, $add_atts);
168
-            } else {
169
-                $this_atts = $atts;
170
-            }
152
+		if ( strpos($message, '[default-message') === false &&
153
+			strpos($message, '[default_message') === false &&
154
+			! empty( $message ) ) {
155
+			return $message;
156
+		}
157
+
158
+		if ( empty($message) ) {
159
+			$message = '[default-message]';
160
+		}
161
+
162
+		preg_match_all("/\[(default-message|default_message)\b(.*?)(?:(\/))?\]/s", $message, $shortcodes, PREG_PATTERN_ORDER);
163
+
164
+		foreach ( $shortcodes[0] as $short_key => $tag ) {
165
+			$add_atts = shortcode_parse_atts( $shortcodes[2][ $short_key ] );
166
+			if ( $add_atts ) {
167
+				$this_atts = array_merge($atts, $add_atts);
168
+			} else {
169
+				$this_atts = $atts;
170
+			}
171 171
 
172 172
 			$default = FrmEntryFormat::show_entry( $this_atts );
173 173
 
174
-            // Add the default message
175
-            $message = str_replace( $shortcodes[0][ $short_key ], $default, $message );
176
-        }
174
+			// Add the default message
175
+			$message = str_replace( $shortcodes[0][ $short_key ], $default, $message );
176
+		}
177 177
 
178
-        return $message;
179
-    }
178
+		return $message;
179
+	}
180 180
 
181 181
 	public static function prepare_display_value( $entry, $field, $atts ) {
182 182
 		$field_value = isset( $entry->metas[ $field->id ] ) ? $entry->metas[ $field->id ] : false;
183
-        if ( FrmAppHelper::pro_is_installed() ) {
183
+		if ( FrmAppHelper::pro_is_installed() ) {
184 184
 			FrmProEntriesHelper::get_dynamic_list_values( $field, $entry, $field_value );
185
-        }
185
+		}
186 186
 
187
-        if ( $field->form_id == $entry->form_id || empty($atts['embedded_field_id']) ) {
188
-            return self::display_value($field_value, $field, $atts);
189
-        }
187
+		if ( $field->form_id == $entry->form_id || empty($atts['embedded_field_id']) ) {
188
+			return self::display_value($field_value, $field, $atts);
189
+		}
190 190
 
191
-        // this is an embeded form
192
-        $val = '';
191
+		// this is an embeded form
192
+		$val = '';
193 193
 
194
-	    if ( strpos($atts['embedded_field_id'], 'form') === 0 ) {
195
-            //this is a repeating section
194
+		if ( strpos($atts['embedded_field_id'], 'form') === 0 ) {
195
+			//this is a repeating section
196 196
 			$child_entries = FrmEntry::getAll( array( 'it.parent_item_id' => $entry->id ) );
197
-        } else {
198
-            // get all values for this field
199
-	        $child_values = isset( $entry->metas[ $atts['embedded_field_id'] ] ) ? $entry->metas[ $atts['embedded_field_id'] ] : false;
197
+		} else {
198
+			// get all values for this field
199
+			$child_values = isset( $entry->metas[ $atts['embedded_field_id'] ] ) ? $entry->metas[ $atts['embedded_field_id'] ] : false;
200 200
 
201
-            if ( $child_values ) {
202
-	            $child_entries = FrmEntry::getAll( array( 'it.id' => (array) $child_values ) );
203
-	        }
204
-	    }
201
+			if ( $child_values ) {
202
+				$child_entries = FrmEntry::getAll( array( 'it.id' => (array) $child_values ) );
203
+			}
204
+		}
205 205
 
206
-	    $field_value = array();
206
+		$field_value = array();
207 207
 
208
-        if ( ! isset($child_entries) || ! $child_entries || ! FrmAppHelper::pro_is_installed() ) {
209
-            return $val;
210
-        }
208
+		if ( ! isset($child_entries) || ! $child_entries || ! FrmAppHelper::pro_is_installed() ) {
209
+			return $val;
210
+		}
211 211
 
212
-        foreach ( $child_entries as $child_entry ) {
213
-            $atts['item_id'] = $child_entry->id;
214
-            $atts['post_id'] = $child_entry->post_id;
212
+		foreach ( $child_entries as $child_entry ) {
213
+			$atts['item_id'] = $child_entry->id;
214
+			$atts['post_id'] = $child_entry->post_id;
215 215
 
216
-            // get the value for this field -- check for post values as well
217
-            $entry_val = FrmProEntryMetaHelper::get_post_or_meta_value($child_entry, $field);
216
+			// get the value for this field -- check for post values as well
217
+			$entry_val = FrmProEntryMetaHelper::get_post_or_meta_value($child_entry, $field);
218 218
 
219
-            if ( $entry_val ) {
220
-                // foreach entry get display_value
221
-                $field_value[] = self::display_value($entry_val, $field, $atts);
222
-            }
219
+			if ( $entry_val ) {
220
+				// foreach entry get display_value
221
+				$field_value[] = self::display_value($entry_val, $field, $atts);
222
+			}
223 223
 
224
-            unset($child_entry);
225
-        }
224
+			unset($child_entry);
225
+		}
226 226
 
227
-        $val = implode(', ', (array) $field_value );
227
+		$val = implode(', ', (array) $field_value );
228 228
 		$val = wp_kses_post( $val );
229 229
 
230
-        return $val;
231
-    }
230
+		return $val;
231
+	}
232 232
 
233
-    /**
234
-     * Prepare the saved value for display
235
-     * @return string
236
-     */
233
+	/**
234
+	 * Prepare the saved value for display
235
+	 * @return string
236
+	 */
237 237
 	public static function display_value( $value, $field, $atts = array() ) {
238 238
 
239
-        $defaults = array(
240
-            'type' => '', 'html' => false, 'show_filename' => true,
241
-            'truncate' => false, 'sep' => ', ', 'post_id' => 0,
242
-            'form_id' => $field->form_id, 'field' => $field, 'keepjs' => 0,
239
+		$defaults = array(
240
+			'type' => '', 'html' => false, 'show_filename' => true,
241
+			'truncate' => false, 'sep' => ', ', 'post_id' => 0,
242
+			'form_id' => $field->form_id, 'field' => $field, 'keepjs' => 0,
243 243
 			'return_array' => false,
244
-        );
244
+		);
245 245
 
246
-        $atts = wp_parse_args( $atts, $defaults );
247
-        $atts = apply_filters('frm_display_value_atts', $atts, $field, $value);
246
+		$atts = wp_parse_args( $atts, $defaults );
247
+		$atts = apply_filters('frm_display_value_atts', $atts, $field, $value);
248 248
 
249
-        if ( ! isset($field->field_options['post_field']) ) {
250
-            $field->field_options['post_field'] = '';
251
-        }
249
+		if ( ! isset($field->field_options['post_field']) ) {
250
+			$field->field_options['post_field'] = '';
251
+		}
252 252
 
253
-        if ( ! isset($field->field_options['custom_field']) ) {
254
-            $field->field_options['custom_field'] = '';
255
-        }
253
+		if ( ! isset($field->field_options['custom_field']) ) {
254
+			$field->field_options['custom_field'] = '';
255
+		}
256 256
 
257
-        if ( FrmAppHelper::pro_is_installed() && $atts['post_id'] && ( $field->field_options['post_field'] || $atts['type'] == 'tag' ) ) {
258
-            $atts['pre_truncate'] = $atts['truncate'];
259
-            $atts['truncate'] = true;
260
-            $atts['exclude_cat'] = isset($field->field_options['exclude_cat']) ? $field->field_options['exclude_cat'] : 0;
257
+		if ( FrmAppHelper::pro_is_installed() && $atts['post_id'] && ( $field->field_options['post_field'] || $atts['type'] == 'tag' ) ) {
258
+			$atts['pre_truncate'] = $atts['truncate'];
259
+			$atts['truncate'] = true;
260
+			$atts['exclude_cat'] = isset($field->field_options['exclude_cat']) ? $field->field_options['exclude_cat'] : 0;
261 261
 
262
-            $value = FrmProEntryMetaHelper::get_post_value($atts['post_id'], $field->field_options['post_field'], $field->field_options['custom_field'], $atts);
263
-            $atts['truncate'] = $atts['pre_truncate'];
264
-        }
262
+			$value = FrmProEntryMetaHelper::get_post_value($atts['post_id'], $field->field_options['post_field'], $field->field_options['custom_field'], $atts);
263
+			$atts['truncate'] = $atts['pre_truncate'];
264
+		}
265 265
 
266
-        if ( $value == '' ) {
267
-            return $value;
268
-        }
266
+		if ( $value == '' ) {
267
+			return $value;
268
+		}
269 269
 
270
-        $value = apply_filters('frm_display_value_custom', maybe_unserialize($value), $field, $atts);
270
+		$value = apply_filters('frm_display_value_custom', maybe_unserialize($value), $field, $atts);
271 271
 
272
-        $new_value = '';
272
+		$new_value = '';
273 273
 
274
-        if ( is_array($value) && $atts['type'] != 'file' ) {
275
-            foreach ( $value as $val ) {
276
-                if ( is_array($val) ) {
274
+		if ( is_array($value) && $atts['type'] != 'file' ) {
275
+			foreach ( $value as $val ) {
276
+				if ( is_array($val) ) {
277 277
 					//TODO: add options for display (li or ,)
278
-                    $new_value .= implode($atts['sep'], $val);
279
-                    if ( $atts['type'] != 'data' ) {
280
-                        $new_value .= '<br/>';
281
-                    }
282
-                }
283
-                unset($val);
284
-            }
285
-        }
286
-
287
-        if ( ! empty($new_value) ) {
288
-            $value = $new_value;
289
-        } else if ( is_array($value) && $atts['type'] != 'file' && ! $atts['return_array'] ) {
290
-            $value = implode($atts['sep'], $value);
291
-        }
292
-
293
-        if ( $atts['truncate'] && $atts['type'] != 'image' ) {
294
-            $value = FrmAppHelper::truncate($value, 50);
295
-        }
278
+					$new_value .= implode($atts['sep'], $val);
279
+					if ( $atts['type'] != 'data' ) {
280
+						$new_value .= '<br/>';
281
+					}
282
+				}
283
+				unset($val);
284
+			}
285
+		}
286
+
287
+		if ( ! empty($new_value) ) {
288
+			$value = $new_value;
289
+		} else if ( is_array($value) && $atts['type'] != 'file' && ! $atts['return_array'] ) {
290
+			$value = implode($atts['sep'], $value);
291
+		}
292
+
293
+		if ( $atts['truncate'] && $atts['type'] != 'image' ) {
294
+			$value = FrmAppHelper::truncate($value, 50);
295
+		}
296 296
 
297 297
 		if ( ! $atts['keepjs'] && ! is_array( $value ) ) {
298 298
 			$value = wp_kses_post( $value );
299 299
 		}
300 300
 
301
-        return apply_filters('frm_display_value', $value, $field, $atts);
302
-    }
301
+		return apply_filters('frm_display_value', $value, $field, $atts);
302
+	}
303 303
 
304 304
 	public static function set_posted_value( $field, $value, $args ) {
305
-        // If validating a field with "other" opt, set back to prev value now
306
-        if ( isset( $args['other'] ) && $args['other'] ) {
307
-            $value = $args['temp_value'];
308
-        }
309
-        if ( empty($args['parent_field_id']) ) {
310
-            $_POST['item_meta'][ $field->id ] = $value;
311
-        } else {
312
-            $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] = $value;
313
-        }
314
-    }
305
+		// If validating a field with "other" opt, set back to prev value now
306
+		if ( isset( $args['other'] ) && $args['other'] ) {
307
+			$value = $args['temp_value'];
308
+		}
309
+		if ( empty($args['parent_field_id']) ) {
310
+			$_POST['item_meta'][ $field->id ] = $value;
311
+		} else {
312
+			$_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] = $value;
313
+		}
314
+	}
315 315
 
316 316
 	public static function get_posted_value( $field, &$value, $args ) {
317 317
 		$field_id = is_object( $field ) ? $field->id : $field;
318 318
 
319
-        if ( empty($args['parent_field_id']) ) {
320
-            $value = isset( $_POST['item_meta'][ $field_id ] ) ? $_POST['item_meta'][ $field_id ] : '';
321
-        } else {
322
-            $value = isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] ) ? $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] : '';
323
-        }
324
-    }
325
-
326
-    /**
327
-    * Check if field has an "Other" option and if any other values are posted
328
-    *
329
-    * @since 2.0
330
-    *
331
-    * @param object $field
332
-    * @param string|array $value
333
-    * @param array $args
334
-    */
335
-    public static function maybe_set_other_validation( $field, &$value, &$args ) {
336
-        $args['other'] = false;
337
-        if ( ! $value || empty( $value ) || ! FrmAppHelper::pro_is_installed() ) {
338
-            return;
339
-        }
340
-
341
-        // Get other value for fields in repeating section
342
-        self::set_other_repeating_vals( $field, $value, $args );
343
-
344
-        // Check if there are any posted "Other" values
319
+		if ( empty($args['parent_field_id']) ) {
320
+			$value = isset( $_POST['item_meta'][ $field_id ] ) ? $_POST['item_meta'][ $field_id ] : '';
321
+		} else {
322
+			$value = isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] ) ? $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] : '';
323
+		}
324
+	}
325
+
326
+	/**
327
+	 * Check if field has an "Other" option and if any other values are posted
328
+	 *
329
+	 * @since 2.0
330
+	 *
331
+	 * @param object $field
332
+	 * @param string|array $value
333
+	 * @param array $args
334
+	 */
335
+	public static function maybe_set_other_validation( $field, &$value, &$args ) {
336
+		$args['other'] = false;
337
+		if ( ! $value || empty( $value ) || ! FrmAppHelper::pro_is_installed() ) {
338
+			return;
339
+		}
340
+
341
+		// Get other value for fields in repeating section
342
+		self::set_other_repeating_vals( $field, $value, $args );
343
+
344
+		// Check if there are any posted "Other" values
345 345
 		if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][ $field->id ] ) ) {
346 346
 
347
-            // Save original value
348
-            $args['temp_value'] = $value;
349
-            $args['other'] = true;
350
-            $other_vals = stripslashes_deep( $_POST['item_meta']['other'][ $field->id ] );
351
-
352
-            // Set the validation value now
353
-            self::set_other_validation_val( $value, $other_vals, $field, $args );
354
-        }
355
-    }
356
-
357
-    /**
358
-    * Sets radio or checkbox value equal to "other" value if it is set - FOR REPEATING SECTIONS
359
-    *
360
-    * @since 2.0
361
-    *
362
-    * @param object $field
363
-    * @param string|array $value
364
-    * @param array $args
365
-    */
366
-    public static function set_other_repeating_vals( $field, &$value, &$args ) {
367
-        if ( ! $args['parent_field_id'] ) {
368
-            return;
369
-        }
370
-
371
-        // Check if there are any other posted "other" values for this field
347
+			// Save original value
348
+			$args['temp_value'] = $value;
349
+			$args['other'] = true;
350
+			$other_vals = stripslashes_deep( $_POST['item_meta']['other'][ $field->id ] );
351
+
352
+			// Set the validation value now
353
+			self::set_other_validation_val( $value, $other_vals, $field, $args );
354
+		}
355
+	}
356
+
357
+	/**
358
+	 * Sets radio or checkbox value equal to "other" value if it is set - FOR REPEATING SECTIONS
359
+	 *
360
+	 * @since 2.0
361
+	 *
362
+	 * @param object $field
363
+	 * @param string|array $value
364
+	 * @param array $args
365
+	 */
366
+	public static function set_other_repeating_vals( $field, &$value, &$args ) {
367
+		if ( ! $args['parent_field_id'] ) {
368
+			return;
369
+		}
370
+
371
+		// Check if there are any other posted "other" values for this field
372 372
 		if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ] ) ) {
373
-            // Save original value
374
-            $args['temp_value'] = $value;
375
-            $args['other'] = true;
376
-
377
-            $other_vals = $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ];
378
-
379
-            // Set the validation value now
380
-            self::set_other_validation_val( $value, $other_vals, $field, $args );
381
-        }
382
-    }
383
-
384
-    /**
385
-    * Modify value used for validation
386
-    * This function essentially removes the "Other" radio or checkbox value from the $value being validated.
387
-    * It also adds any text from the free text fields to the value
388
-    *
389
-    * Needs to accommodate for times when other opt is selected, but no other free text is entered
390
-    *
391
-    * @since 2.0
392
-    *
393
-    * @param string|array $value
394
-    * @param string|array $other_vals (usually of posted values)
395
-    * @param object $field
396
-    * @param array $args
397
-    */
398
-    public static function set_other_validation_val( &$value, $other_vals, $field, &$args ) {
399
-        // Checkboxes and multi-select dropdowns
400
-        if ( is_array( $value ) && $field->type == 'checkbox' ) {
401
-            // Combine "Other" values with checked values. "Other" values will override checked box values.
402
-            $value = array_merge( $value, $other_vals );
403
-            $value = array_filter( $value );
404
-            if ( count( $value ) == 0 ) {
405
-                $value = '';
406
-            }
407
-        } else {
373
+			// Save original value
374
+			$args['temp_value'] = $value;
375
+			$args['other'] = true;
376
+
377
+			$other_vals = $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ];
378
+
379
+			// Set the validation value now
380
+			self::set_other_validation_val( $value, $other_vals, $field, $args );
381
+		}
382
+	}
383
+
384
+	/**
385
+	 * Modify value used for validation
386
+	 * This function essentially removes the "Other" radio or checkbox value from the $value being validated.
387
+	 * It also adds any text from the free text fields to the value
388
+	 *
389
+	 * Needs to accommodate for times when other opt is selected, but no other free text is entered
390
+	 *
391
+	 * @since 2.0
392
+	 *
393
+	 * @param string|array $value
394
+	 * @param string|array $other_vals (usually of posted values)
395
+	 * @param object $field
396
+	 * @param array $args
397
+	 */
398
+	public static function set_other_validation_val( &$value, $other_vals, $field, &$args ) {
399
+		// Checkboxes and multi-select dropdowns
400
+		if ( is_array( $value ) && $field->type == 'checkbox' ) {
401
+			// Combine "Other" values with checked values. "Other" values will override checked box values.
402
+			$value = array_merge( $value, $other_vals );
403
+			$value = array_filter( $value );
404
+			if ( count( $value ) == 0 ) {
405
+				$value = '';
406
+			}
407
+		} else {
408 408
 			// Radio and dropdowns
409
-            $other_key = array_filter( array_keys($field->options), 'is_string');
410
-            $other_key = reset( $other_key );
409
+			$other_key = array_filter( array_keys($field->options), 'is_string');
410
+			$other_key = reset( $other_key );
411 411
 
412
-            // Multi-select dropdown
413
-            if ( is_array( $value ) ) {
414
-                $o_key = array_search( $field->options[ $other_key ], $value );
412
+			// Multi-select dropdown
413
+			if ( is_array( $value ) ) {
414
+				$o_key = array_search( $field->options[ $other_key ], $value );
415 415
 
416 416
 				if ( $o_key !== false ) {
417 417
 					// Modify the original value so other key will be preserved
@@ -426,20 +426,20 @@  discard block
 block discarded – undo
426 426
 					$args['temp_value'] = $value;
427 427
 					$value[ $other_key ] = reset( $other_vals );
428 428
 				}
429
-            } else if ( $field->options[ $other_key ] == $value ) {
430
-                $value = $other_vals;
431
-            }
432
-        }
433
-    }
429
+			} else if ( $field->options[ $other_key ] == $value ) {
430
+				$value = $other_vals;
431
+			}
432
+		}
433
+	}
434 434
 
435 435
 	public static function enqueue_scripts( $params ) {
436 436
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmFormsController::enqueue_scripts' );
437 437
 		return FrmFormsController::enqueue_scripts( $params );
438 438
 	}
439 439
 
440
-    // Add submitted values to a string for spam checking
440
+	// Add submitted values to a string for spam checking
441 441
 	public static function entry_array_to_string( $values ) {
442
-        $content = '';
442
+		$content = '';
443 443
 		foreach ( $values['item_meta'] as $val ) {
444 444
 			if ( $content != '' ) {
445 445
 				$content .= "\n\n";
@@ -447,14 +447,14 @@  discard block
 block discarded – undo
447 447
 
448 448
 			if ( is_array($val) ) {
449 449
 				$val = FrmAppHelper::array_flatten( $val );
450
-			    $val = implode(',', $val);
450
+				$val = implode(',', $val);
451 451
 			}
452 452
 
453 453
 			$content .= $val;
454 454
 		}
455 455
 
456 456
 		return $content;
457
-    }
457
+	}
458 458
 
459 459
 	public static function fill_entry_values( $atts, $f, array &$values ) {
460 460
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmEntryFormat::fill_entry_values' );
Please login to merge, or discard this patch.
classes/models/FrmEntryFormat.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -126,19 +126,19 @@
 block discarded – undo
126 126
 	}
127 127
 
128 128
 	/**
129
-	* Flatten multi-dimensional array for multi-file upload fields
130
-	* @since 2.0.9
131
-	*/
129
+	 * Flatten multi-dimensional array for multi-file upload fields
130
+	 * @since 2.0.9
131
+	 */
132 132
 	public static function flatten_multi_file_upload( $field, &$val ) {
133 133
 		if ( $field->type == 'file' && FrmField::is_option_true( $field, 'multiple' ) ) {
134 134
 			$val = FrmAppHelper::array_flatten( $val );
135 135
 		}
136 136
 	}
137 137
 
138
-    /**
139
-     * Replace returns with HTML line breaks for display
140
-     * @since 2.0.9
141
-     */
138
+	/**
139
+	 * Replace returns with HTML line breaks for display
140
+	 * @since 2.0.9
141
+	 */
142 142
 	public static function textarea_display_value( $type, $plain_text, &$value ) {
143 143
 		if ( $type == 'textarea' && ! $plain_text ) {
144 144
 			$value = str_replace( array( "\r\n", "\r", "\n" ), ' <br/>', $value );
Please login to merge, or discard this patch.
classes/views/frm-entries/_sidebar-shared-pub.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@
 block discarded – undo
1 1
 <?php
2 2
 if ( ! isset( $entry) ) {
3
-    $entry = $record;
3
+	$entry = $record;
4 4
 } ?>
5 5
 
6 6
 <div class="misc-pub-section curtime misc-pub-curtime">
7 7
     <span id="timestamp">
8 8
     <?php
9
-    $date_format = __( 'M j, Y @ G:i' );
9
+	$date_format = __( 'M j, Y @ G:i' );
10 10
 	printf( __( 'Published on: <b>%1$s</b>' ), FrmAppHelper::get_localized_date( $date_format, $entry->created_at ) ); ?>
11 11
     </span>
12 12
 </div>
Please login to merge, or discard this patch.
classes/views/frm-entries/errors.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -4,30 +4,30 @@
 block discarded – undo
4 4
 <?php
5 5
 }
6 6
 if ( isset( $message ) && $message != '' ) {
7
-    if ( FrmAppHelper::is_admin() ) {
7
+	if ( FrmAppHelper::is_admin() ) {
8 8
 		?><div id="message" class="frm_message updated frm_msg_padding"><?php echo wp_kses_post( $message ) ?></div><?php
9 9
 	} else {
10
-        FrmFormsHelper::get_scroll_js($form->id);
10
+		FrmFormsHelper::get_scroll_js($form->id);
11 11
 
12 12
 		// we need to allow scripts here for javascript in the success message
13 13
 		echo $message;
14
-    }
14
+	}
15 15
 }
16 16
 
17 17
 if ( isset($errors) && is_array( $errors ) && ! empty( $errors ) ) {
18 18
 
19 19
 	if ( isset( $form ) && is_object( $form ) ) {
20
-    	FrmFormsHelper::get_scroll_js( $form->id );
20
+		FrmFormsHelper::get_scroll_js( $form->id );
21 21
 	} ?>
22 22
 <div class="frm_error_style">
23 23
 <?php
24 24
 $img = '';
25 25
 if ( ! FrmAppHelper::is_admin() ) {
26
-    $img = apply_filters('frm_error_icon', $img);
27
-    if ( $img && ! empty($img) ) {
28
-    ?><img src="<?php echo esc_attr( $img ) ?>" alt="" />
26
+	$img = apply_filters('frm_error_icon', $img);
27
+	if ( $img && ! empty($img) ) {
28
+	?><img src="<?php echo esc_attr( $img ) ?>" alt="" />
29 29
 <?php
30
-    }
30
+	}
31 31
 }
32 32
 
33 33
 FrmFormsHelper::show_errors( compact( 'img', 'errors' ) );
Please login to merge, or discard this patch.
classes/views/frm-entries/form.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
     </div>
6 6
 </div>
7 7
 <?php
8
-    return;
8
+	return;
9 9
 }
10 10
 
11 11
 global $frm_vars;
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 		} else {
39 39
 			do_action( 'frm_show_other_field_type', $field, $form, array( 'action' => $form_action ) );
40 40
 		}
41
-    	do_action('frm_get_field_scripts', $field, $form, $form->id);
41
+		do_action('frm_get_field_scripts', $field, $form, $form->id);
42 42
 	}
43 43
 }
44 44
 
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
 
64 64
 // close open collapsible toggle div
65 65
 if ( isset($frm_vars['collapse_div']) && $frm_vars['collapse_div'] ) {
66
-    echo "</div>\n";
67
-    unset($frm_vars['collapse_div']);
66
+	echo "</div>\n";
67
+	unset($frm_vars['collapse_div']);
68 68
 }
69 69
 
70 70
 echo FrmFormsHelper::replace_shortcodes($values['after_html'], $form);
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
 }
78 78
 
79 79
 if ( FrmForm::show_submit( $form ) ) {
80
-    unset($values['fields']);
81
-    FrmFormsHelper::get_custom_submit($values['submit_html'], $form, $submit, $form_action, $values);
80
+	unset($values['fields']);
81
+	FrmFormsHelper::get_custom_submit($values['submit_html'], $form, $submit, $form_action, $values);
82 82
 }
83 83
 ?>
84 84
 </fieldset>
Please login to merge, or discard this patch.
classes/views/frm-entries/show.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -15,43 +15,43 @@
 block discarded – undo
15 15
                     <div class="inside">
16 16
                         <table class="form-table"><tbody>
17 17
                         <?php
18
-                        $first_h3 = 'frm_first_h3';
19
-                        foreach ( $fields as $field ) {
18
+						$first_h3 = 'frm_first_h3';
19
+						foreach ( $fields as $field ) {
20 20
 							if ( in_array( $field->type, array( 'captcha', 'html', 'end_divider', 'form' ) ) ) {
21
-                                continue;
22
-                            }
21
+								continue;
22
+							}
23 23
 
24
-                            if ( in_array($field->type, array( 'break', 'divider' ) ) ) {
25
-                            ?>
24
+							if ( in_array($field->type, array( 'break', 'divider' ) ) ) {
25
+							?>
26 26
                         </tbody></table>
27 27
                         <br/><h3 class="<?php echo esc_attr( $first_h3 ) ?>"><?php echo esc_html( $field->name ) ?></h3>
28 28
                         <table class="form-table"><tbody>
29 29
                         <?php
30
-                                $first_h3 = '';
31
-                            } else {
32
-                        ?>
30
+								$first_h3 = '';
31
+							} else {
32
+						?>
33 33
                         <tr>
34 34
                             <th scope="row"><?php echo esc_html( $field->name ) ?>:</th>
35 35
                             <td>
36 36
                             <?php
37 37
 							$embedded_field_id = ( $entry->form_id != $field->form_id ) ? 'form' . $field->form_id : 0;
38
-                            $atts = array(
39
-                                'type' => $field->type, 'post_id' => $entry->post_id,
40
-                                'show_filename' => true, 'show_icon' => true, 'entry_id' => $entry->id,
41
-                                'embedded_field_id' => $embedded_field_id,
42
-                            );
43
-                            echo $display_value = FrmEntriesHelper::prepare_display_value($entry, $field, $atts);
38
+							$atts = array(
39
+								'type' => $field->type, 'post_id' => $entry->post_id,
40
+								'show_filename' => true, 'show_icon' => true, 'entry_id' => $entry->id,
41
+								'embedded_field_id' => $embedded_field_id,
42
+							);
43
+							echo $display_value = FrmEntriesHelper::prepare_display_value($entry, $field, $atts);
44 44
 
45
-                            if ( is_email($display_value) && ! in_array($display_value, $to_emails) ) {
46
-                                $to_emails[] = $display_value;
47
-                            }
48
-                            ?>
45
+							if ( is_email($display_value) && ! in_array($display_value, $to_emails) ) {
46
+								$to_emails[] = $display_value;
47
+							}
48
+							?>
49 49
                             </td>
50 50
                         </tr>
51 51
                         <?php }
52
-                        }
52
+						}
53 53
 
54
-                        ?>
54
+						?>
55 55
 
56 56
                         <?php if ( $entry->parent_item_id ) { ?>
57 57
                         <tr><th><?php _e( 'Parent Entry ID', 'formidable' ) ?>:</th>
Please login to merge, or discard this patch.
classes/views/frm-entries/sidebar-shared.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -66,18 +66,18 @@
 block discarded – undo
66 66
         <?php } ?>
67 67
 
68 68
         <?php
69
-        foreach ( (array) $data as $k => $d ) {
69
+		foreach ( (array) $data as $k => $d ) {
70 70
 			if ( in_array( $k, array( 'browser', 'referrer' ) ) ) {
71
-                continue;
72
-            }
73
-        ?>
71
+				continue;
72
+			}
73
+		?>
74 74
         <div class="misc-pub-section">
75 75
 			<b><?php echo sanitize_text_field( ucfirst( str_replace( '-', ' ', $k ) ) ); ?></b>:
76 76
 			<?php echo wp_kses_post( implode( ', ', (array) $d ) ); ?>
77 77
         </div>
78 78
         <?php
79
-            unset($k, $d);
80
-        }
81
-        ?>
79
+			unset($k, $d);
80
+		}
81
+		?>
82 82
     </div>
83 83
 </div>
Please login to merge, or discard this patch.
classes/views/frm-form-actions/_email_settings.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -6,11 +6,11 @@
 block discarded – undo
6 6
     </td>
7 7
     <td class="frm_bcc_cc_container">
8 8
         <a href="javascript:void(0)" class="button frm_email_buttons frm_bcc_button <?php
9
-        echo ( ! empty($form_action->post_content['bcc'])  ? 'frm_hidden' : '' );
10
-        ?>" data-emailrow="bcc"><?php _e( 'BCC', 'formidable' ) ?></a>
9
+		echo ( ! empty($form_action->post_content['bcc'])  ? 'frm_hidden' : '' );
10
+		?>" data-emailrow="bcc"><?php _e( 'BCC', 'formidable' ) ?></a>
11 11
         <a href="javascript:void(0)" class="button frm_email_buttons frm_cc_button <?php
12
-        echo ( ! empty($form_action->post_content['cc'])  ? 'frm_hidden' : '' );
13
-        ?>" data-emailrow="cc"><?php _e( 'CC', 'formidable' ) ?></a>
12
+		echo ( ! empty($form_action->post_content['cc'])  ? 'frm_hidden' : '' );
13
+		?>" data-emailrow="cc"><?php _e( 'CC', 'formidable' ) ?></a>
14 14
     </td>
15 15
 </tr>
16 16
 <tr id="frm_cc_row" class="<?php echo empty( $form_action->post_content['cc'] )  ? 'frm_hidden' : ''; ?>" >
Please login to merge, or discard this patch.