@@ -1,5 +1,5 @@ discard block |
||
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 | |
@@ -8,12 +8,12 @@ discard block |
||
8 | 8 | public static function setup_new_vars( $fields, $form = '', $reset = false, $args = array() ) { |
9 | 9 | $values = array(); |
10 | 10 | foreach ( array( 'name' => '', 'description' => '', 'item_key' => '' ) as $var => $default ) { |
11 | - $values[ $var ] = FrmAppHelper::get_post_param( $var, $default, 'wp_kses_post' ); |
|
11 | + $values[$var] = FrmAppHelper::get_post_param( $var, $default, 'wp_kses_post' ); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | $values['fields'] = array(); |
15 | - if ( empty($fields) ) { |
|
16 | - return apply_filters('frm_setup_new_entry', $values); |
|
15 | + if ( empty( $fields ) ) { |
|
16 | + return apply_filters( 'frm_setup_new_entry', $values ); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | foreach ( (array) $fields as $field ) { |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | 'default_value' => $field->default_value, |
26 | 26 | 'name' => $field->name, |
27 | 27 | 'description' => $field->description, |
28 | - 'type' => apply_filters('frm_field_type', $field->type, $field, $new_value), |
|
28 | + 'type' => apply_filters( 'frm_field_type', $field->type, $field, $new_value ), |
|
29 | 29 | 'options' => $field->options, |
30 | 30 | 'required' => $field->required, |
31 | 31 | 'field_key' => $field->field_key, |
@@ -35,43 +35,43 @@ discard block |
||
35 | 35 | 'reset_value' => $reset, |
36 | 36 | ); |
37 | 37 | |
38 | - $opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true); |
|
38 | + $opt_defaults = FrmFieldsHelper::get_default_field_opts( $field_array['type'], $field, true ); |
|
39 | 39 | $opt_defaults['required_indicator'] = ''; |
40 | 40 | $opt_defaults['original_type'] = $field->type; |
41 | 41 | |
42 | 42 | foreach ( $opt_defaults as $opt => $default_opt ) { |
43 | - $field_array[ $opt ] = ( isset( $field->field_options[ $opt ] ) && $field->field_options[ $opt ] != '' ) ? $field->field_options[ $opt ] : $default_opt; |
|
44 | - unset($opt, $default_opt); |
|
43 | + $field_array[$opt] = ( isset( $field->field_options[$opt] ) && $field->field_options[$opt] != '' ) ? $field->field_options[$opt] : $default_opt; |
|
44 | + unset( $opt, $default_opt ); |
|
45 | 45 | } |
46 | 46 | |
47 | - unset($opt_defaults); |
|
47 | + unset( $opt_defaults ); |
|
48 | 48 | |
49 | 49 | if ( $field_array['custom_html'] == '' ) { |
50 | - $field_array['custom_html'] = FrmFieldsHelper::get_default_html($field->type); |
|
50 | + $field_array['custom_html'] = FrmFieldsHelper::get_default_html( $field->type ); |
|
51 | 51 | } |
52 | 52 | |
53 | - $field_array = apply_filters('frm_setup_new_fields_vars', $field_array, $field); |
|
53 | + $field_array = apply_filters( 'frm_setup_new_fields_vars', $field_array, $field ); |
|
54 | 54 | $field_array = array_merge( $field->field_options, $field_array ); |
55 | 55 | |
56 | 56 | $values['fields'][] = $field_array; |
57 | 57 | |
58 | - if ( ! $form || ! isset($form->id) ) { |
|
59 | - $form = FrmForm::getOne($field->form_id); |
|
58 | + if ( ! $form || ! isset( $form->id ) ) { |
|
59 | + $form = FrmForm::getOne( $field->form_id ); |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
63 | - $form->options = maybe_unserialize($form->options); |
|
64 | - if ( is_array($form->options) ) { |
|
63 | + $form->options = maybe_unserialize( $form->options ); |
|
64 | + if ( is_array( $form->options ) ) { |
|
65 | 65 | foreach ( $form->options as $opt => $value ) { |
66 | - $values[ $opt ] = FrmAppHelper::get_post_param( $opt, $value ); |
|
67 | - unset($opt, $value); |
|
66 | + $values[$opt] = FrmAppHelper::get_post_param( $opt, $value ); |
|
67 | + unset( $opt, $value ); |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 | |
71 | 71 | $form_defaults = FrmFormsHelper::get_default_opts(); |
72 | 72 | |
73 | 73 | $frm_settings = FrmAppHelper::get_settings(); |
74 | - $form_defaults['custom_style'] = ( $frm_settings->load_style != 'none' ); |
|
74 | + $form_defaults['custom_style'] = ( $frm_settings->load_style != 'none' ); |
|
75 | 75 | |
76 | 76 | $values = array_merge( $form_defaults, $values ); |
77 | 77 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | $return_array = FrmField::is_field_with_multiple_values( $field ); |
95 | 95 | |
96 | 96 | // Do any shortcodes in default value and allow customization of default value |
97 | - $field->default_value = apply_filters('frm_get_default_value', $field->default_value, $field, true, $return_array); |
|
97 | + $field->default_value = apply_filters( 'frm_get_default_value', $field->default_value, $field, true, $return_array ); |
|
98 | 98 | // Calls FrmProFieldsHelper::get_default_value |
99 | 99 | |
100 | 100 | $new_value = $field->default_value; |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | } |
108 | 108 | |
109 | 109 | if ( ! is_array( $new_value ) ) { |
110 | - $new_value = str_replace('"', '"', $new_value); |
|
110 | + $new_value = str_replace( '"', '"', $new_value ); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | return $new_value; |
@@ -121,15 +121,15 @@ discard block |
||
121 | 121 | * @param array $args |
122 | 122 | * @return boolean $value_is_posted |
123 | 123 | */ |
124 | - public static function value_is_posted( $field, $args ){ |
|
124 | + public static function value_is_posted( $field, $args ) { |
|
125 | 125 | $value_is_posted = false; |
126 | 126 | if ( $_POST ) { |
127 | 127 | $repeating = isset( $args['repeating'] ) && $args['repeating']; |
128 | 128 | if ( $repeating ) { |
129 | - if ( isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] ) ) { |
|
129 | + if ( isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field->id] ) ) { |
|
130 | 130 | $value_is_posted = true; |
131 | 131 | } |
132 | - } else if ( isset( $_POST['item_meta'][ $field->id ] ) ) { |
|
132 | + } else if ( isset( $_POST['item_meta'][$field->id] ) ) { |
|
133 | 133 | $value_is_posted = true; |
134 | 134 | } |
135 | 135 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | $values['item_key'] = FrmAppHelper::get_post_param( 'item_key', $record->item_key, 'sanitize_title' ); |
141 | 141 | $values['form_id'] = $record->form_id; |
142 | 142 | $values['is_draft'] = $record->is_draft; |
143 | - return apply_filters('frm_setup_edit_entry_vars', $values, $record); |
|
143 | + return apply_filters( 'frm_setup_edit_entry_vars', $values, $record ); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | public static function get_admin_params( $form = null ) { |
@@ -169,22 +169,22 @@ discard block |
||
169 | 169 | } |
170 | 170 | |
171 | 171 | public static function replace_default_message( $message, $atts ) { |
172 | - if ( strpos($message, '[default-message') === false && |
|
173 | - strpos($message, '[default_message') === false && |
|
172 | + if ( strpos( $message, '[default-message' ) === false && |
|
173 | + strpos( $message, '[default_message' ) === false && |
|
174 | 174 | ! empty( $message ) ) { |
175 | 175 | return $message; |
176 | 176 | } |
177 | 177 | |
178 | - if ( empty($message) ) { |
|
178 | + if ( empty( $message ) ) { |
|
179 | 179 | $message = '[default-message]'; |
180 | 180 | } |
181 | 181 | |
182 | - preg_match_all("/\[(default-message|default_message)\b(.*?)(?:(\/))?\]/s", $message, $shortcodes, PREG_PATTERN_ORDER); |
|
182 | + preg_match_all( "/\[(default-message|default_message)\b(.*?)(?:(\/))?\]/s", $message, $shortcodes, PREG_PATTERN_ORDER ); |
|
183 | 183 | |
184 | 184 | foreach ( $shortcodes[0] as $short_key => $tag ) { |
185 | - $add_atts = shortcode_parse_atts( $shortcodes[2][ $short_key ] ); |
|
185 | + $add_atts = shortcode_parse_atts( $shortcodes[2][$short_key] ); |
|
186 | 186 | if ( $add_atts ) { |
187 | - $this_atts = array_merge($atts, $add_atts); |
|
187 | + $this_atts = array_merge( $atts, $add_atts ); |
|
188 | 188 | } else { |
189 | 189 | $this_atts = $atts; |
190 | 190 | } |
@@ -192,32 +192,32 @@ discard block |
||
192 | 192 | $default = FrmEntryFormat::show_entry( $this_atts ); |
193 | 193 | |
194 | 194 | // Add the default message |
195 | - $message = str_replace( $shortcodes[0][ $short_key ], $default, $message ); |
|
195 | + $message = str_replace( $shortcodes[0][$short_key], $default, $message ); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | return $message; |
199 | 199 | } |
200 | 200 | |
201 | 201 | public static function prepare_display_value( $entry, $field, $atts ) { |
202 | - $field_value = isset( $entry->metas[ $field->id ] ) ? $entry->metas[ $field->id ] : false; |
|
202 | + $field_value = isset( $entry->metas[$field->id] ) ? $entry->metas[$field->id] : false; |
|
203 | 203 | |
204 | 204 | if ( FrmAppHelper::pro_is_installed() ) { |
205 | 205 | FrmProEntriesHelper::get_dynamic_list_values( $field, $entry, $field_value ); |
206 | 206 | } |
207 | 207 | |
208 | - if ( $field->form_id == $entry->form_id || empty($atts['embedded_field_id']) ) { |
|
209 | - return self::display_value($field_value, $field, $atts); |
|
208 | + if ( $field->form_id == $entry->form_id || empty( $atts['embedded_field_id'] ) ) { |
|
209 | + return self::display_value( $field_value, $field, $atts ); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | // this is an embeded form |
213 | 213 | $val = ''; |
214 | 214 | |
215 | - if ( strpos($atts['embedded_field_id'], 'form') === 0 ) { |
|
215 | + if ( strpos( $atts['embedded_field_id'], 'form' ) === 0 ) { |
|
216 | 216 | //this is a repeating section |
217 | 217 | $child_entries = FrmEntry::getAll( array( 'it.parent_item_id' => $entry->id ) ); |
218 | 218 | } else { |
219 | 219 | // get all values for this field |
220 | - $child_values = isset( $entry->metas[ $atts['embedded_field_id'] ] ) ? $entry->metas[ $atts['embedded_field_id'] ] : false; |
|
220 | + $child_values = isset( $entry->metas[$atts['embedded_field_id']] ) ? $entry->metas[$atts['embedded_field_id']] : false; |
|
221 | 221 | |
222 | 222 | if ( $child_values ) { |
223 | 223 | $child_entries = FrmEntry::getAll( array( 'it.id' => (array) $child_values ) ); |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | |
227 | 227 | $field_value = array(); |
228 | 228 | |
229 | - if ( ! isset($child_entries) || ! $child_entries || ! FrmAppHelper::pro_is_installed() ) { |
|
229 | + if ( ! isset( $child_entries ) || ! $child_entries || ! FrmAppHelper::pro_is_installed() ) { |
|
230 | 230 | return $val; |
231 | 231 | } |
232 | 232 | |
@@ -235,17 +235,17 @@ discard block |
||
235 | 235 | $atts['post_id'] = $child_entry->post_id; |
236 | 236 | |
237 | 237 | // get the value for this field -- check for post values as well |
238 | - $entry_val = FrmProEntryMetaHelper::get_post_or_meta_value($child_entry, $field); |
|
238 | + $entry_val = FrmProEntryMetaHelper::get_post_or_meta_value( $child_entry, $field ); |
|
239 | 239 | |
240 | 240 | if ( $entry_val ) { |
241 | 241 | // foreach entry get display_value |
242 | - $field_value[] = self::display_value($entry_val, $field, $atts); |
|
242 | + $field_value[] = self::display_value( $entry_val, $field, $atts ); |
|
243 | 243 | } |
244 | 244 | |
245 | - unset($child_entry); |
|
245 | + unset( $child_entry ); |
|
246 | 246 | } |
247 | 247 | |
248 | - $val = implode(', ', (array) $field_value ); |
|
248 | + $val = implode( ', ', (array) $field_value ); |
|
249 | 249 | $val = wp_kses_post( $val ); |
250 | 250 | |
251 | 251 | return $val; |
@@ -265,22 +265,22 @@ discard block |
||
265 | 265 | ); |
266 | 266 | |
267 | 267 | $atts = wp_parse_args( $atts, $defaults ); |
268 | - $atts = apply_filters('frm_display_value_atts', $atts, $field, $value); |
|
268 | + $atts = apply_filters( 'frm_display_value_atts', $atts, $field, $value ); |
|
269 | 269 | |
270 | - if ( ! isset($field->field_options['post_field']) ) { |
|
270 | + if ( ! isset( $field->field_options['post_field'] ) ) { |
|
271 | 271 | $field->field_options['post_field'] = ''; |
272 | 272 | } |
273 | 273 | |
274 | - if ( ! isset($field->field_options['custom_field']) ) { |
|
274 | + if ( ! isset( $field->field_options['custom_field'] ) ) { |
|
275 | 275 | $field->field_options['custom_field'] = ''; |
276 | 276 | } |
277 | 277 | |
278 | 278 | if ( FrmAppHelper::pro_is_installed() && $atts['post_id'] && ( $field->field_options['post_field'] || $atts['type'] == 'tag' ) ) { |
279 | 279 | $atts['pre_truncate'] = $atts['truncate']; |
280 | 280 | $atts['truncate'] = true; |
281 | - $atts['exclude_cat'] = isset($field->field_options['exclude_cat']) ? $field->field_options['exclude_cat'] : 0; |
|
281 | + $atts['exclude_cat'] = isset( $field->field_options['exclude_cat'] ) ? $field->field_options['exclude_cat'] : 0; |
|
282 | 282 | |
283 | - $value = FrmProEntryMetaHelper::get_post_value($atts['post_id'], $field->field_options['post_field'], $field->field_options['custom_field'], $atts); |
|
283 | + $value = FrmProEntryMetaHelper::get_post_value( $atts['post_id'], $field->field_options['post_field'], $field->field_options['custom_field'], $atts ); |
|
284 | 284 | $atts['truncate'] = $atts['pre_truncate']; |
285 | 285 | } |
286 | 286 | |
@@ -288,39 +288,39 @@ discard block |
||
288 | 288 | return $value; |
289 | 289 | } |
290 | 290 | |
291 | - $value = apply_filters('frm_display_value_custom', maybe_unserialize($value), $field, $atts); |
|
291 | + $value = apply_filters( 'frm_display_value_custom', maybe_unserialize( $value ), $field, $atts ); |
|
292 | 292 | $value = apply_filters( 'frm_display_' . $field->type . '_value_custom', $value, compact( 'field', 'atts' ) ); |
293 | 293 | |
294 | 294 | $new_value = ''; |
295 | 295 | |
296 | - if ( is_array($value) && $atts['type'] != 'file' ) { |
|
296 | + if ( is_array( $value ) && $atts['type'] != 'file' ) { |
|
297 | 297 | foreach ( $value as $val ) { |
298 | - if ( is_array($val) ) { |
|
298 | + if ( is_array( $val ) ) { |
|
299 | 299 | //TODO: add options for display (li or ,) |
300 | - $new_value .= implode($atts['sep'], $val); |
|
300 | + $new_value .= implode( $atts['sep'], $val ); |
|
301 | 301 | if ( $atts['type'] != 'data' ) { |
302 | 302 | $new_value .= '<br/>'; |
303 | 303 | } |
304 | 304 | } |
305 | - unset($val); |
|
305 | + unset( $val ); |
|
306 | 306 | } |
307 | 307 | } |
308 | 308 | |
309 | - if ( ! empty($new_value) ) { |
|
309 | + if ( ! empty( $new_value ) ) { |
|
310 | 310 | $value = $new_value; |
311 | - } else if ( is_array($value) && $atts['type'] != 'file' && ! $atts['return_array'] ) { |
|
312 | - $value = implode($atts['sep'], $value); |
|
311 | + } else if ( is_array( $value ) && $atts['type'] != 'file' && ! $atts['return_array'] ) { |
|
312 | + $value = implode( $atts['sep'], $value ); |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | if ( $atts['truncate'] && $atts['type'] != 'image' ) { |
316 | - $value = FrmAppHelper::truncate($value, 50); |
|
316 | + $value = FrmAppHelper::truncate( $value, 50 ); |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | if ( ! $atts['keepjs'] && ! is_array( $value ) ) { |
320 | 320 | $value = wp_kses_post( $value ); |
321 | 321 | } |
322 | 322 | |
323 | - return apply_filters('frm_display_value', $value, $field, $atts); |
|
323 | + return apply_filters( 'frm_display_value', $value, $field, $atts ); |
|
324 | 324 | } |
325 | 325 | |
326 | 326 | public static function set_posted_value( $field, $value, $args ) { |
@@ -328,20 +328,20 @@ discard block |
||
328 | 328 | if ( isset( $args['other'] ) && $args['other'] ) { |
329 | 329 | $value = $args['temp_value']; |
330 | 330 | } |
331 | - if ( empty($args['parent_field_id']) ) { |
|
332 | - $_POST['item_meta'][ $field->id ] = $value; |
|
331 | + if ( empty( $args['parent_field_id'] ) ) { |
|
332 | + $_POST['item_meta'][$field->id] = $value; |
|
333 | 333 | } else { |
334 | - $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] = $value; |
|
334 | + $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field->id] = $value; |
|
335 | 335 | } |
336 | 336 | } |
337 | 337 | |
338 | 338 | public static function get_posted_value( $field, &$value, $args ) { |
339 | 339 | $field_id = is_object( $field ) ? $field->id : $field; |
340 | 340 | |
341 | - if ( empty($args['parent_field_id']) ) { |
|
342 | - $value = isset( $_POST['item_meta'][ $field_id ] ) ? $_POST['item_meta'][ $field_id ] : ''; |
|
341 | + if ( empty( $args['parent_field_id'] ) ) { |
|
342 | + $value = isset( $_POST['item_meta'][$field_id] ) ? $_POST['item_meta'][$field_id] : ''; |
|
343 | 343 | } else { |
344 | - $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 ] : ''; |
|
344 | + $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] : ''; |
|
345 | 345 | } |
346 | 346 | } |
347 | 347 | |
@@ -364,12 +364,12 @@ discard block |
||
364 | 364 | self::set_other_repeating_vals( $field, $value, $args ); |
365 | 365 | |
366 | 366 | // Check if there are any posted "Other" values |
367 | - if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][ $field->id ] ) ) { |
|
367 | + if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][$field->id] ) ) { |
|
368 | 368 | |
369 | 369 | // Save original value |
370 | 370 | $args['temp_value'] = $value; |
371 | 371 | $args['other'] = true; |
372 | - $other_vals = stripslashes_deep( $_POST['item_meta']['other'][ $field->id ] ); |
|
372 | + $other_vals = stripslashes_deep( $_POST['item_meta']['other'][$field->id] ); |
|
373 | 373 | |
374 | 374 | // Set the validation value now |
375 | 375 | self::set_other_validation_val( $value, $other_vals, $field, $args ); |
@@ -391,12 +391,12 @@ discard block |
||
391 | 391 | } |
392 | 392 | |
393 | 393 | // Check if there are any other posted "other" values for this field |
394 | - if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ] ) ) { |
|
394 | + if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']]['other'][$field->id] ) ) { |
|
395 | 395 | // Save original value |
396 | 396 | $args['temp_value'] = $value; |
397 | 397 | $args['other'] = true; |
398 | 398 | |
399 | - $other_vals = $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ]; |
|
399 | + $other_vals = $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']]['other'][$field->id]; |
|
400 | 400 | |
401 | 401 | // Set the validation value now |
402 | 402 | self::set_other_validation_val( $value, $other_vals, $field, $args ); |
@@ -428,27 +428,27 @@ discard block |
||
428 | 428 | } |
429 | 429 | } else { |
430 | 430 | // Radio and dropdowns |
431 | - $other_key = array_filter( array_keys($field->options), 'is_string'); |
|
431 | + $other_key = array_filter( array_keys( $field->options ), 'is_string' ); |
|
432 | 432 | $other_key = reset( $other_key ); |
433 | 433 | |
434 | 434 | // Multi-select dropdown |
435 | 435 | if ( is_array( $value ) ) { |
436 | - $o_key = array_search( $field->options[ $other_key ], $value ); |
|
436 | + $o_key = array_search( $field->options[$other_key], $value ); |
|
437 | 437 | |
438 | 438 | if ( $o_key !== false ) { |
439 | 439 | // Modify the original value so other key will be preserved |
440 | - $value[ $other_key ] = $value[ $o_key ]; |
|
440 | + $value[$other_key] = $value[$o_key]; |
|
441 | 441 | |
442 | 442 | // By default, the array keys will be numeric for multi-select dropdowns |
443 | 443 | // If going backwards and forwards between pages, the array key will match the other key |
444 | 444 | if ( $o_key != $other_key ) { |
445 | - unset( $value[ $o_key ] ); |
|
445 | + unset( $value[$o_key] ); |
|
446 | 446 | } |
447 | 447 | |
448 | 448 | $args['temp_value'] = $value; |
449 | - $value[ $other_key ] = reset( $other_vals ); |
|
449 | + $value[$other_key] = reset( $other_vals ); |
|
450 | 450 | } |
451 | - } else if ( $field->options[ $other_key ] == $value ) { |
|
451 | + } else if ( $field->options[$other_key] == $value ) { |
|
452 | 452 | $value = $other_vals; |
453 | 453 | } |
454 | 454 | } |
@@ -467,9 +467,9 @@ discard block |
||
467 | 467 | $content .= "\n\n"; |
468 | 468 | } |
469 | 469 | |
470 | - if ( is_array($val) ) { |
|
470 | + if ( is_array( $val ) ) { |
|
471 | 471 | $val = FrmAppHelper::array_flatten( $val ); |
472 | - $val = implode(',', $val); |
|
472 | + $val = implode( ',', $val ); |
|
473 | 473 | } |
474 | 474 | |
475 | 475 | $content .= $val; |
@@ -514,6 +514,6 @@ discard block |
||
514 | 514 | } |
515 | 515 | |
516 | 516 | public static function entries_dropdown() { |
517 | - _deprecated_function( __FUNCTION__, '1.07.09'); |
|
517 | + _deprecated_function( __FUNCTION__, '1.07.09' ); |
|
518 | 518 | } |
519 | 519 | } |
@@ -3,7 +3,7 @@ |
||
3 | 3 | <td> |
4 | 4 | <input type="text" name="field_options[size_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['size'] ); ?>" size="5" /> <span class="howto"><?php _e( 'pixels wide', 'formidable' ) ?></span><?php |
5 | 5 | if ( $display_max ) { |
6 | - include( FrmAppHelper::plugin_path() .'/classes/views/back-end-field-opts/max.php' ); |
|
6 | + include( FrmAppHelper::plugin_path() . '/classes/views/back-end-field-opts/max.php' ); |
|
7 | 7 | } |
8 | 8 | ?></td> |
9 | 9 | </tr> |
10 | 10 | \ No newline at end of file |
@@ -1,22 +1,22 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -$display = apply_filters('frm_display_field_options', array( |
|
3 | +$display = apply_filters( 'frm_display_field_options', array( |
|
4 | 4 | 'type' => $field['type'], 'field_data' => $field, |
5 | 5 | 'required' => true, 'unique' => false, 'read_only' => false, |
6 | 6 | 'description' => true, 'options' => true, 'label_position' => true, |
7 | 7 | 'invalid' => false, 'size' => false, 'clear_on_focus' => false, |
8 | 8 | 'default_blank' => true, 'css' => true, 'conf_field' => false, |
9 | 9 | 'max' => true, 'captcha_size' => false, |
10 | -)); |
|
10 | +) ); |
|
11 | 11 | |
12 | 12 | $li_classes = 'form-field edit_form_item frm_field_box frm_top_container frm_not_divider edit_field_type_' . $display['type']; |
13 | -$li_classes = apply_filters('frm_build_field_class', $li_classes, $field ); |
|
13 | +$li_classes = apply_filters( 'frm_build_field_class', $li_classes, $field ); |
|
14 | 14 | |
15 | 15 | if ( isset( $values ) && isset( $values['ajax_load'] ) && $values['ajax_load'] && isset( $count ) && $count > 10 && ! in_array( $field['type'], array( 'divider', 'end_divider' ) ) ) { |
16 | 16 | ?> |
17 | 17 | <li id="frm_field_id_<?php echo esc_attr( $field['id'] ); ?>" class="<?php echo esc_attr( $li_classes ) ?> frm_field_loading" data-fid="<?php echo esc_attr( $field['id'] ) ?>" data-formid="<?php echo esc_attr( 'divider' == $field['type'] ? $field['form_select'] : $field['form_id'] ); ?>" data-ftype="<?php echo esc_attr( $display['type'] ) ?>"> |
18 | 18 | <img src="<?php echo FrmAppHelper::plugin_url() ?>/images/ajax_loader.gif" alt="<?php esc_attr_e( 'Loading', 'formidable' ) ?>" /> |
19 | -<span class="frm_hidden_fdata frm_hidden"><?php echo htmlspecialchars(json_encode($field)) ?></span> |
|
19 | +<span class="frm_hidden_fdata frm_hidden"><?php echo htmlspecialchars( json_encode( $field ) ) ?></span> |
|
20 | 20 | </li> |
21 | 21 | <?php |
22 | 22 | return; |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | $frm_settings = FrmAppHelper::get_settings(); |
26 | 26 | |
27 | 27 | if ( ! isset( $frm_all_field_selection ) ) { |
28 | - if ( isset($frm_field_selection) && isset($pro_field_selection) ) { |
|
29 | - $frm_all_field_selection = array_merge($frm_field_selection, $pro_field_selection); |
|
28 | + if ( isset( $frm_field_selection ) && isset( $pro_field_selection ) ) { |
|
29 | + $frm_all_field_selection = array_merge( $frm_field_selection, $pro_field_selection ); |
|
30 | 30 | } else { |
31 | 31 | $pro_field_selection = FrmField::pro_field_selection(); |
32 | 32 | $frm_all_field_selection = array_merge( FrmField::field_selection(), $pro_field_selection ); |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | <a href="javascript:void(0);" class="frm_bstooltip alignright frm-show-hover frm-move frm-hover-icon frm_icon_font frm_move_icon" title="<?php esc_attr_e( 'Move Field', 'formidable' ) ?>"> </a> |
52 | 52 | <a href="#" class="frm_bstooltip alignright frm-show-hover frm-hover-icon frm_icon_font frm_delete_icon frm_delete_field" title="<?php esc_attr_e( 'Delete Field', 'formidable' ) ?>"> </a> |
53 | 53 | <a href="#" class="frm_bstooltip alignright frm-show-hover frm-hover-icon frm_icon_font frm_duplicate_icon" title="<?php ( $field['type'] == 'divider' ) ? esc_attr_e( 'Duplicate Section', 'formidable' ) : esc_attr_e( 'Duplicate Field', 'formidable' ) ?>"> </a> |
54 | - <input type="hidden" name="frm_fields_submitted[]" value="<?php echo esc_attr($field['id']) ?>" /> |
|
55 | - <?php do_action('frm_extra_field_actions', $field['id']); ?> |
|
54 | + <input type="hidden" name="frm_fields_submitted[]" value="<?php echo esc_attr( $field['id'] ) ?>" /> |
|
55 | + <?php do_action( 'frm_extra_field_actions', $field['id'] ); ?> |
|
56 | 56 | <?php if ( $display['required'] ) { ?> |
57 | 57 | <span id="require_field_<?php echo esc_attr( $field['id'] ); ?>"> |
58 | 58 | <a href="javascript:void(0);" class="frm_req_field frm_action_icon frm_required_icon frm_icon_font alignleft frm_required<?php echo (int) $field['required'] ?>" id="req_field_<?php echo esc_attr( $field['id'] ); ?>" title="Click to Mark as <?php echo FrmField::is_required( $field ) ? 'not ' : ''; ?>Required"></a> |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | <?php } |
61 | 61 | |
62 | 62 | ?> |
63 | - <label class="<?php echo ( $field['type'] == 'end_divider' ) ? '' : 'frm_ipe_field_label'; ?> frm_primary_label <?php echo ( $field['type'] == 'break' ) ? 'button': ''; ?>" id="field_label_<?php echo esc_attr( $field['id'] ); ?>"><?php echo ( $field['name'] == '' ) ? __( '(no label)', 'formidable' ) : force_balance_tags( $field['name'] ); ?></label> |
|
63 | + <label class="<?php echo ( $field['type'] == 'end_divider' ) ? '' : 'frm_ipe_field_label'; ?> frm_primary_label <?php echo ( $field['type'] == 'break' ) ? 'button' : ''; ?>" id="field_label_<?php echo esc_attr( $field['id'] ); ?>"><?php echo ( $field['name'] == '' ) ? __( '(no label)', 'formidable' ) : force_balance_tags( $field['name'] ); ?></label> |
|
64 | 64 | |
65 | 65 | |
66 | 66 | <div id="field_<?php echo esc_attr( $field['id'] ) ?>_inner_container" class="frm_inner_field_container"> |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | </div> |
79 | 79 | <?php |
80 | 80 | if ( $display['description'] ) { ?> |
81 | - <div class="frm_ipe_field_desc description <?php echo ($field['description'] == '') ? 'frm-show-click' : '' ?>" id="field_description_<?php echo esc_attr( $field['id'] ); ?>"><?php echo ($field['description'] == '') ? __( '(Click to add description)', 'formidable' ) : force_balance_tags( $field['description'] ); ?></div> |
|
81 | + <div class="frm_ipe_field_desc description <?php echo ( $field['description'] == '' ) ? 'frm-show-click' : '' ?>" id="field_description_<?php echo esc_attr( $field['id'] ); ?>"><?php echo ( $field['description'] == '' ) ? __( '(Click to add description)', 'formidable' ) : force_balance_tags( $field['description'] ); ?></div> |
|
82 | 82 | <input type="hidden" name="field_options[description_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['description'] ); ?>" /> |
83 | 83 | |
84 | 84 | <?php } ?> |
@@ -88,9 +88,9 @@ discard block |
||
88 | 88 | <div id="frm_conf_field_<?php echo esc_attr( $field['id'] ) ?>_container" class="frm_conf_field_container frm_form_fields frm_conf_details<?php echo esc_attr( $field['id'] . ( $field['conf_field'] ? '' : ' frm_hidden' ) ); ?>"> |
89 | 89 | <div id="frm_conf_field_<?php echo esc_attr( $field['id'] ) ?>_inner_container" class="frm_inner_conf_container"> |
90 | 90 | <div class="frm_form_fields"> |
91 | - <input type="text" id="conf_field_<?php echo esc_attr( $field['field_key'] ) ?>" name="field_options[conf_input_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['conf_input'] ); ?>" <?php do_action('frm_field_input_html', $field) ?> /> |
|
91 | + <input type="text" id="conf_field_<?php echo esc_attr( $field['field_key'] ) ?>" name="field_options[conf_input_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['conf_input'] ); ?>" <?php do_action( 'frm_field_input_html', $field ) ?> /> |
|
92 | 92 | </div> |
93 | - <div class="frm_ipe_field_conf_desc description <?php echo ($field['conf_desc'] == '') ? 'frm-show-click' : '' ?>"><?php echo ($field['conf_desc'] == '') ? __( '(Click to add description)', 'formidable' ) : force_balance_tags($field['conf_desc']); ?></div> |
|
93 | + <div class="frm_ipe_field_conf_desc description <?php echo ( $field['conf_desc'] == '' ) ? 'frm-show-click' : '' ?>"><?php echo ( $field['conf_desc'] == '' ) ? __( '(Click to add description)', 'formidable' ) : force_balance_tags( $field['conf_desc'] ); ?></div> |
|
94 | 94 | <input type="hidden" name="field_options[conf_desc_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['conf_desc'] ); ?>" /> |
95 | 95 | </div> |
96 | 96 | <?php if ( $display['clear_on_focus'] ) { ?> |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | if ( in_array( $field['type'], array( 'select', 'radio', 'checkbox' ) ) ) { ?> |
106 | 106 | <div class="frm-show-click frm_small_top_margin"><?php |
107 | 107 | |
108 | - if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) { |
|
108 | + if ( isset( $field['post_field'] ) && $field['post_field'] == 'post_category' ) { |
|
109 | 109 | echo '<p class="howto">' . FrmFieldsHelper::get_term_link( $field['taxonomy'] ) . '</p>'; |
110 | 110 | } else if ( ! isset( $field['post_field'] ) || ! in_array( $field['post_field'], array( 'post_category' ) ) ) { |
111 | 111 | ?> |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | <?php |
120 | 120 | } |
121 | 121 | |
122 | - if ( ! isset($field['post_field']) || $field['post_field'] != 'post_category' ) { ?> |
|
122 | + if ( ! isset( $field['post_field'] ) || $field['post_field'] != 'post_category' ) { ?> |
|
123 | 123 | <a href="<?php echo esc_url( admin_url( 'admin-ajax.php?action=frm_import_choices&field_id=' . $field['id'] . '&TB_iframe=1' ) ) ?>" title="<?php echo esc_attr( FrmAppHelper::truncate( strip_tags( str_replace( '"', '"', $field['name'] ) ), 20 ) . ' ' . __( 'Field Choices', 'formidable' ) ); ?>" class="thickbox frm_orange"> |
124 | 124 | <?php _e( 'Bulk Edit Options', 'formidable' ) ?> |
125 | 125 | </a> |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | <?php |
133 | 133 | } |
134 | 134 | |
135 | -do_action('frm_before_field_options', $field); |
|
135 | +do_action( 'frm_before_field_options', $field ); |
|
136 | 136 | |
137 | 137 | if ( $display['options'] ) { ?> |
138 | 138 | <div class="widget"> |
@@ -142,13 +142,13 @@ discard block |
||
142 | 142 | </div> |
143 | 143 | <div class="widget-inside"> |
144 | 144 | <table class="form-table frm_clear_none"> |
145 | - <?php $field_types = FrmFieldsHelper::get_field_types($field['type']); ?> |
|
145 | + <?php $field_types = FrmFieldsHelper::get_field_types( $field['type'] ); ?> |
|
146 | 146 | <tr><td class="frm_150_width"><label><?php _e( 'Field Type', 'formidable' ) ?></label></td> |
147 | 147 | <td> |
148 | - <select <?php if ( count($field_types) == 1 ) { ?>disabled="disabled"<?php } else { ?>name="field_options[type_<?php echo esc_attr( $field['id'] ) ?>]"<?php } ?>> |
|
148 | + <select <?php if ( count( $field_types ) == 1 ) { ?>disabled="disabled"<?php } else { ?>name="field_options[type_<?php echo esc_attr( $field['id'] ) ?>]"<?php } ?>> |
|
149 | 149 | <?php |
150 | 150 | foreach ( $field_types as $fkey => $ftype ) { ?> |
151 | - <option value="<?php echo esc_attr( $fkey ) ?>" <?php echo ( $fkey == $field['type'] ) ? ' selected="selected"' : ''; ?> <?php echo array_key_exists($fkey, $disabled_fields ) ? 'disabled="disabled"' : ''; ?>><?php echo is_array($ftype) ? $ftype['name'] : $ftype ?> </option> |
|
151 | + <option value="<?php echo esc_attr( $fkey ) ?>" <?php echo ( $fkey == $field['type'] ) ? ' selected="selected"' : ''; ?> <?php echo array_key_exists( $fkey, $disabled_fields ) ? 'disabled="disabled"' : ''; ?>><?php echo is_array( $ftype ) ? $ftype['name'] : $ftype ?> </option> |
|
152 | 152 | <?php |
153 | 153 | unset( $fkey, $ftype ); |
154 | 154 | } ?> |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | |
157 | 157 | <?php |
158 | 158 | if ( $display['required'] ) { ?> |
159 | - <label for="frm_req_field_<?php echo esc_attr( $field['id'] ) ?>" class="frm_inline_label"><input type="checkbox" id="frm_req_field_<?php echo esc_attr( $field['id'] ) ?>" class="frm_req_field" name="field_options[required_<?php echo esc_attr( $field['id'] ) ?>]" value="1" <?php echo $field['required'] ? 'checked="checked"': ''; ?> /> <?php _e( 'Required', 'formidable' ) ?></label> |
|
159 | + <label for="frm_req_field_<?php echo esc_attr( $field['id'] ) ?>" class="frm_inline_label"><input type="checkbox" id="frm_req_field_<?php echo esc_attr( $field['id'] ) ?>" class="frm_req_field" name="field_options[required_<?php echo esc_attr( $field['id'] ) ?>]" value="1" <?php echo $field['required'] ? 'checked="checked"' : ''; ?> /> <?php _e( 'Required', 'formidable' ) ?></label> |
|
160 | 160 | <?php |
161 | 161 | } |
162 | 162 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | <label for="frm_read_only_field_<?php echo esc_attr( $field['id'] ) ?>" class="frm_inline_label frm_help" title="<?php esc_attr_e( 'Read Only: Show this field but do not allow the field value to be edited from the front-end.', 'formidable' ) ?>" ><input type="checkbox" id="frm_read_only_field_<?php echo esc_attr( $field['id'] ) ?>" name="field_options[read_only_<?php echo esc_attr( $field['id'] ) ?>]" value="1" <?php echo $field['read_only'] ? ' checked="checked"' : ''; ?>/> <?php _e( 'Read Only', 'formidable' ) ?></label> |
178 | 178 | <?php } |
179 | 179 | |
180 | - do_action('frm_field_options_form_top', $field, $display, $values); |
|
180 | + do_action( 'frm_field_options_form_top', $field, $display, $values ); |
|
181 | 181 | |
182 | 182 | ?> |
183 | 183 | <?php |
@@ -214,13 +214,13 @@ discard block |
||
214 | 214 | if ( $display['label_position'] ) { ?> |
215 | 215 | <tr><td class="frm_150_width"><label><?php _e( 'Label Position', 'formidable' ) ?></label></td> |
216 | 216 | <td><select name="field_options[label_<?php echo esc_attr( $field['id'] ) ?>]"> |
217 | - <option value=""<?php selected($field['label'], ''); ?>><?php _e( 'Default', 'formidable' ) ?></option> |
|
218 | - <option value="top"<?php selected($field['label'], 'top'); ?>><?php _e( 'Top', 'formidable' ) ?></option> |
|
219 | - <option value="left"<?php selected($field['label'], 'left'); ?>><?php _e( 'Left', 'formidable' ) ?></option> |
|
220 | - <option value="right"<?php selected($field['label'], 'right'); ?>><?php _e( 'Right', 'formidable' ) ?></option> |
|
221 | - <option value="inline"<?php selected($field['label'], 'inline'); ?>><?php _e( 'Inline (left without a set width)', 'formidable' ) ?></option> |
|
222 | - <option value="none"<?php selected($field['label'], 'none'); ?>><?php _e( 'None', 'formidable' ) ?></option> |
|
223 | - <option value="hidden"<?php selected($field['label'], 'hidden'); ?>><?php _e( 'Hidden (but leave the space)', 'formidable' ) ?></option> |
|
217 | + <option value=""<?php selected( $field['label'], '' ); ?>><?php _e( 'Default', 'formidable' ) ?></option> |
|
218 | + <option value="top"<?php selected( $field['label'], 'top' ); ?>><?php _e( 'Top', 'formidable' ) ?></option> |
|
219 | + <option value="left"<?php selected( $field['label'], 'left' ); ?>><?php _e( 'Left', 'formidable' ) ?></option> |
|
220 | + <option value="right"<?php selected( $field['label'], 'right' ); ?>><?php _e( 'Right', 'formidable' ) ?></option> |
|
221 | + <option value="inline"<?php selected( $field['label'], 'inline' ); ?>><?php _e( 'Inline (left without a set width)', 'formidable' ) ?></option> |
|
222 | + <option value="none"<?php selected( $field['label'], 'none' ); ?>><?php _e( 'None', 'formidable' ) ?></option> |
|
223 | + <option value="hidden"<?php selected( $field['label'], 'hidden' ); ?>><?php _e( 'Hidden (but leave the space)', 'formidable' ) ?></option> |
|
224 | 224 | </select> |
225 | 225 | </td> |
226 | 226 | </tr> |
@@ -230,11 +230,11 @@ discard block |
||
230 | 230 | if ( $display['size'] ) { |
231 | 231 | if ( in_array( $field['type'], array( 'select', 'time', 'data' ) ) ) { |
232 | 232 | if ( ! isset( $values['custom_style'] ) || $values['custom_style'] ) { |
233 | - include( FrmAppHelper::plugin_path() .'/classes/views/back-end-field-opts/automatic-width.php' ); |
|
233 | + include( FrmAppHelper::plugin_path() . '/classes/views/back-end-field-opts/automatic-width.php' ); |
|
234 | 234 | } |
235 | 235 | } else { |
236 | 236 | $display_max = $display['max']; |
237 | - include( FrmAppHelper::plugin_path() .'/classes/views/back-end-field-opts/pixels-wide.php' ); |
|
237 | + include( FrmAppHelper::plugin_path() . '/classes/views/back-end-field-opts/pixels-wide.php' ); |
|
238 | 238 | } |
239 | 239 | } |
240 | 240 | |
@@ -243,8 +243,8 @@ discard block |
||
243 | 243 | <span class="frm_help frm_icon_font frm_tooltip_icon" title="<?php esc_attr_e( 'Set the size of the captcha field. The compact option is best if your form is in a small area.', 'formidable' ) ?>" ></span> |
244 | 244 | </td> |
245 | 245 | <td><select name="field_options[captcha_size_<?php echo esc_attr( $field['id'] ) ?>]"> |
246 | - <option value="default"<?php selected($field['captcha_size'], 'default'); ?>><?php _e( 'Default', 'formidable' ) ?></option> |
|
247 | - <option value="compact"<?php selected($field['captcha_size'], 'compact'); ?>><?php _e( 'Compact', 'formidable' ) ?></option> |
|
246 | + <option value="default"<?php selected( $field['captcha_size'], 'default' ); ?>><?php _e( 'Default', 'formidable' ) ?></option> |
|
247 | + <option value="compact"<?php selected( $field['captcha_size'], 'compact' ); ?>><?php _e( 'Compact', 'formidable' ) ?></option> |
|
248 | 248 | </select> |
249 | 249 | </td> |
250 | 250 | </tr> |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | do_action( 'frm_field_options_form', $field, $display, $values ); |
267 | 267 | |
268 | 268 | if ( $display['required'] || $display['invalid'] || $display['unique'] || $display['conf_field'] ) { ?> |
269 | - <tr class="frm_validation_msg <?php echo ($display['invalid'] || $field['required'] || FrmField::is_option_true( $field, 'unique' ) || FrmField::is_option_true( $field, 'conf_field' ) ) ? '' : 'frm_hidden'; ?>"> |
|
269 | + <tr class="frm_validation_msg <?php echo ( $display['invalid'] || $field['required'] || FrmField::is_option_true( $field, 'unique' ) || FrmField::is_option_true( $field, 'conf_field' ) ) ? '' : 'frm_hidden'; ?>"> |
|
270 | 270 | <td colspan="2"> |
271 | 271 | <div class="menu-settings"> |
272 | 272 | <h3 class="frm_no_bg"><?php _e( 'Validation', 'formidable' ) ?></h3> |
@@ -330,4 +330,4 @@ discard block |
||
330 | 330 | <?php |
331 | 331 | } |
332 | 332 | |
333 | -unset($display); |
|
333 | +unset( $display ); |