|
@@ -117,10 +117,10 @@ discard block |
|
|
block discarded – undo |
|
117
|
117
|
if ( $_POST ) { |
|
118
|
118
|
$repeating = isset( $args['repeating'] ) && $args['repeating']; |
|
119
|
119
|
if ( $repeating ) { |
|
120
|
|
- if ( isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] ) ) { |
|
|
120
|
+ if ( isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field->id] ) ) { |
|
121
|
121
|
$value_is_posted = true; |
|
122
|
122
|
} |
|
123
|
|
- } elseif ( isset( $_POST['item_meta'][ $field->id ] ) ) { |
|
|
123
|
+ } elseif ( isset( $_POST['item_meta'][$field->id] ) ) { |
|
124
|
124
|
$value_is_posted = true; |
|
125
|
125
|
} |
|
126
|
126
|
} |
|
@@ -150,7 +150,7 @@ discard block |
|
|
block discarded – undo |
|
150
|
150
|
preg_match_all( "/\[(default-message|default_message)\b(.*?)(?:(\/))?\]/s", $message, $shortcodes, PREG_PATTERN_ORDER ); |
|
151
|
151
|
|
|
152
|
152
|
foreach ( $shortcodes[0] as $short_key => $tag ) { |
|
153
|
|
- $add_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] ); |
|
|
153
|
+ $add_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][$short_key] ); |
|
154
|
154
|
if ( ! empty( $add_atts ) ) { |
|
155
|
155
|
$this_atts = array_merge( $atts, $add_atts ); |
|
156
|
156
|
} else { |
|
@@ -160,14 +160,14 @@ discard block |
|
|
block discarded – undo |
|
160
|
160
|
$default = FrmEntriesController::show_entry_shortcode( $this_atts ); |
|
161
|
161
|
|
|
162
|
162
|
// Add the default message. |
|
163
|
|
- $message = str_replace( $shortcodes[0][ $short_key ], $default, $message ); |
|
|
163
|
+ $message = str_replace( $shortcodes[0][$short_key], $default, $message ); |
|
164
|
164
|
} |
|
165
|
165
|
|
|
166
|
166
|
return $message; |
|
167
|
167
|
} |
|
168
|
168
|
|
|
169
|
169
|
public static function prepare_display_value( $entry, $field, $atts ) { |
|
170
|
|
- $field_value = isset( $entry->metas[ $field->id ] ) ? $entry->metas[ $field->id ] : false; |
|
|
170
|
+ $field_value = isset( $entry->metas[$field->id] ) ? $entry->metas[$field->id] : false; |
|
171
|
171
|
|
|
172
|
172
|
if ( FrmAppHelper::pro_is_installed() ) { |
|
173
|
173
|
FrmProEntriesHelper::get_dynamic_list_values( $field, $entry, $field_value ); |
|
@@ -185,7 +185,7 @@ discard block |
|
|
block discarded – undo |
|
185
|
185
|
$child_entries = FrmEntry::getAll( array( 'it.parent_item_id' => $entry->id ) ); |
|
186
|
186
|
} else { |
|
187
|
187
|
// Get all values for this field. |
|
188
|
|
- $child_values = isset( $entry->metas[ $atts['embedded_field_id'] ] ) ? $entry->metas[ $atts['embedded_field_id'] ] : false; |
|
|
188
|
+ $child_values = isset( $entry->metas[$atts['embedded_field_id']] ) ? $entry->metas[$atts['embedded_field_id']] : false; |
|
189
|
189
|
|
|
190
|
190
|
if ( $child_values ) { |
|
191
|
191
|
$child_entries = FrmEntry::getAll( array( 'it.id' => (array) $child_values ) ); |
|
@@ -298,9 +298,9 @@ discard block |
|
|
block discarded – undo |
|
298
|
298
|
$value = $args['temp_value']; |
|
299
|
299
|
} |
|
300
|
300
|
if ( empty( $args['parent_field_id'] ) ) { |
|
301
|
|
- $_POST['item_meta'][ $field->id ] = $value; |
|
|
301
|
+ $_POST['item_meta'][$field->id] = $value; |
|
302
|
302
|
} else { |
|
303
|
|
- $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] = $value; |
|
|
303
|
+ $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field->id] = $value; |
|
304
|
304
|
} |
|
305
|
305
|
} |
|
306
|
306
|
|
|
@@ -308,9 +308,9 @@ discard block |
|
|
block discarded – undo |
|
308
|
308
|
$field_id = is_object( $field ) ? $field->id : $field; |
|
309
|
309
|
|
|
310
|
310
|
if ( empty( $args['parent_field_id'] ) ) { |
|
311
|
|
- $value = isset( $_POST['item_meta'][ $field_id ] ) ? wp_unslash( $_POST['item_meta'][ $field_id ] ) : ''; |
|
|
311
|
+ $value = isset( $_POST['item_meta'][$field_id] ) ? wp_unslash( $_POST['item_meta'][$field_id] ) : ''; |
|
312
|
312
|
} else { |
|
313
|
|
- $value = isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] ) ? wp_unslash( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] ) : ''; |
|
|
313
|
+ $value = isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field_id] ) ? wp_unslash( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field_id] ) : ''; |
|
314
|
314
|
} |
|
315
|
315
|
|
|
316
|
316
|
if ( is_array( $field ) ) { |
|
@@ -341,12 +341,12 @@ discard block |
|
|
block discarded – undo |
|
341
|
341
|
self::set_other_repeating_vals( $field, $value, $args ); |
|
342
|
342
|
|
|
343
|
343
|
// Check if there are any posted "Other" values. |
|
344
|
|
- if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][ $field->id ] ) ) { |
|
|
344
|
+ if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][$field->id] ) ) { |
|
345
|
345
|
|
|
346
|
346
|
// Save original value. |
|
347
|
347
|
$args['temp_value'] = $value; |
|
348
|
348
|
$args['other'] = true; |
|
349
|
|
- $other_vals = wp_unslash( $_POST['item_meta']['other'][ $field->id ] ); |
|
|
349
|
+ $other_vals = wp_unslash( $_POST['item_meta']['other'][$field->id] ); |
|
350
|
350
|
|
|
351
|
351
|
// Set the validation value now |
|
352
|
352
|
self::set_other_validation_val( $value, $other_vals, $field, $args ); |
|
@@ -368,12 +368,12 @@ discard block |
|
|
block discarded – undo |
|
368
|
368
|
} |
|
369
|
369
|
|
|
370
|
370
|
// Check if there are any other posted "other" values for this field. |
|
371
|
|
- if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ] ) ) { |
|
|
371
|
+ if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']]['other'][$field->id] ) ) { |
|
372
|
372
|
// Save original value |
|
373
|
373
|
$args['temp_value'] = $value; |
|
374
|
374
|
$args['other'] = true; |
|
375
|
375
|
|
|
376
|
|
- $other_vals = wp_unslash( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ] ); |
|
|
376
|
+ $other_vals = wp_unslash( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']]['other'][$field->id] ); |
|
377
|
377
|
|
|
378
|
378
|
// Set the validation value now. |
|
379
|
379
|
self::set_other_validation_val( $value, $other_vals, $field, $args ); |
|
@@ -410,25 +410,25 @@ discard block |
|
|
block discarded – undo |
|
410
|
410
|
|
|
411
|
411
|
// Multi-select dropdown. |
|
412
|
412
|
if ( is_array( $value ) ) { |
|
413
|
|
- $o_key = array_search( $field->options[ $other_key ], $value ); |
|
|
413
|
+ $o_key = array_search( $field->options[$other_key], $value ); |
|
414
|
414
|
|
|
415
|
415
|
if ( $o_key !== false ) { |
|
416
|
416
|
// Modify the original value so other key will be preserved. |
|
417
|
|
- $value[ $other_key ] = $value[ $o_key ]; |
|
|
417
|
+ $value[$other_key] = $value[$o_key]; |
|
418
|
418
|
|
|
419
|
419
|
// By default, the array keys will be numeric for multi-select dropdowns. |
|
420
|
420
|
// If going backwards and forwards between pages, the array key will match the other key. |
|
421
|
421
|
if ( $o_key !== $other_key ) { |
|
422
|
|
- unset( $value[ $o_key ] ); |
|
|
422
|
+ unset( $value[$o_key] ); |
|
423
|
423
|
} |
|
424
|
424
|
|
|
425
|
425
|
$args['temp_value'] = $value; |
|
426
|
|
- $value[ $other_key ] = reset( $other_vals ); |
|
427
|
|
- if ( FrmAppHelper::is_empty_value( $value[ $other_key ] ) ) { |
|
428
|
|
- unset( $value[ $other_key ] ); |
|
|
426
|
+ $value[$other_key] = reset( $other_vals ); |
|
|
427
|
+ if ( FrmAppHelper::is_empty_value( $value[$other_key] ) ) { |
|
|
428
|
+ unset( $value[$other_key] ); |
|
429
|
429
|
} |
|
430
|
430
|
} |
|
431
|
|
- } elseif ( $field->options[ $other_key ] == $value ) { |
|
|
431
|
+ } elseif ( $field->options[$other_key] == $value ) { |
|
432
|
432
|
$value = $other_vals; |
|
433
|
433
|
} |
|
434
|
434
|
} |