@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | if ( $new_val !== $value ) { |
| 219 | - $new_values[ $key ] = $new_val; |
|
| 219 | + $new_values[$key] = $new_val; |
|
| 220 | 220 | } |
| 221 | 221 | }//end foreach |
| 222 | 222 | |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | |
| 254 | 254 | foreach ( $values as $value_key => $value ) { |
| 255 | 255 | if ( $value_key && in_array( $value_key, $form_fields ) ) { |
| 256 | - $new_values[ $value_key ] = $value; |
|
| 256 | + $new_values[$value_key] = $value; |
|
| 257 | 257 | } |
| 258 | 258 | } |
| 259 | 259 | |
@@ -338,15 +338,15 @@ discard block |
||
| 338 | 338 | $existing_keys = array_keys( $values['item_meta'] ); |
| 339 | 339 | foreach ( $all_fields as $fid ) { |
| 340 | 340 | if ( ! in_array( $fid->id, $existing_keys ) && ( isset( $values['frm_fields_submitted'] ) && in_array( $fid->id, $values['frm_fields_submitted'] ) ) || isset( $values['options'] ) ) { |
| 341 | - $values['item_meta'][ $fid->id ] = ''; |
|
| 341 | + $values['item_meta'][$fid->id] = ''; |
|
| 342 | 342 | } |
| 343 | - $field_array[ $fid->id ] = $fid; |
|
| 343 | + $field_array[$fid->id] = $fid; |
|
| 344 | 344 | } |
| 345 | 345 | unset( $all_fields ); |
| 346 | 346 | |
| 347 | 347 | foreach ( $values['item_meta'] as $field_id => $default_value ) { |
| 348 | - if ( isset( $field_array[ $field_id ] ) ) { |
|
| 349 | - $field = $field_array[ $field_id ]; |
|
| 348 | + if ( isset( $field_array[$field_id] ) ) { |
|
| 349 | + $field = $field_array[$field_id]; |
|
| 350 | 350 | } else { |
| 351 | 351 | $field = FrmField::getOne( $field_id ); |
| 352 | 352 | } |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | continue; |
| 356 | 356 | } |
| 357 | 357 | |
| 358 | - $is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options'][ 'custom_html_' . $field_id ] ) ); |
|
| 358 | + $is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options']['custom_html_' . $field_id] ) ); |
|
| 359 | 359 | if ( $is_settings_page ) { |
| 360 | 360 | self::get_settings_page_html( $values, $field ); |
| 361 | 361 | |
@@ -375,22 +375,22 @@ discard block |
||
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | foreach ( $update_options as $opt => $default ) { |
| 378 | - $field->field_options[ $opt ] = $values['field_options'][ $opt . '_' . $field_id ] ?? $default; |
|
| 379 | - self::sanitize_field_opt( $opt, $field->field_options[ $opt ] ); |
|
| 378 | + $field->field_options[$opt] = $values['field_options'][$opt . '_' . $field_id] ?? $default; |
|
| 379 | + self::sanitize_field_opt( $opt, $field->field_options[$opt] ); |
|
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | $field->field_options = apply_filters( 'frm_update_field_options', $field->field_options, $field, $values ); |
| 383 | 383 | |
| 384 | 384 | $new_field = array( |
| 385 | 385 | 'field_options' => $field->field_options, |
| 386 | - 'default_value' => isset( $values[ 'default_value_' . $field_id ] ) ? FrmAppHelper::maybe_json_encode( $values[ 'default_value_' . $field_id ] ) : '', |
|
| 386 | + 'default_value' => isset( $values['default_value_' . $field_id] ) ? FrmAppHelper::maybe_json_encode( $values['default_value_' . $field_id] ) : '', |
|
| 387 | 387 | ); |
| 388 | 388 | |
| 389 | - if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options'][ 'options_' . $field_id ] ) && is_array( $values['field_options'][ 'options_' . $field_id ] ) ) { |
|
| 390 | - foreach ( $values['field_options'][ 'options_' . $field_id ] as $option_key => $option ) { |
|
| 389 | + if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options']['options_' . $field_id] ) && is_array( $values['field_options']['options_' . $field_id] ) ) { |
|
| 390 | + foreach ( $values['field_options']['options_' . $field_id] as $option_key => $option ) { |
|
| 391 | 391 | if ( is_array( $option ) ) { |
| 392 | 392 | foreach ( $option as $key => $item ) { |
| 393 | - $values['field_options'][ 'options_' . $field_id ][ $option_key ][ $key ] = FrmAppHelper::kses( $item, 'all' ); |
|
| 393 | + $values['field_options']['options_' . $field_id][$option_key][$key] = FrmAppHelper::kses( $item, 'all' ); |
|
| 394 | 394 | } |
| 395 | 395 | } |
| 396 | 396 | } |
@@ -420,8 +420,8 @@ discard block |
||
| 420 | 420 | */ |
| 421 | 421 | private static function maybe_update_max_option( $field, $values, &$new_field ) { |
| 422 | 422 | if ( $field->type === 'textarea' && |
| 423 | - ! empty( $values['field_options'][ 'type_' . $field->id ] ) && |
|
| 424 | - in_array( $values['field_options'][ 'type_' . $field->id ], array( 'text', 'email', 'url', 'password', 'phone' ), true ) ) { |
|
| 423 | + ! empty( $values['field_options']['type_' . $field->id] ) && |
|
| 424 | + in_array( $values['field_options']['type_' . $field->id], array( 'text', 'email', 'url', 'password', 'phone' ), true ) ) { |
|
| 425 | 425 | |
| 426 | 426 | $new_field['field_options']['max'] = ''; |
| 427 | 427 | |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | * Update posted field setting so that new 'max' option is displayed after form is saved and page reloads. |
| 430 | 430 | * FrmFieldsHelper::fill_default_field_opts populates field options by calling self::get_posted_field_setting. |
| 431 | 431 | */ |
| 432 | - $_POST['field_options'][ 'max_' . $field->id ] = ''; |
|
| 432 | + $_POST['field_options']['max_' . $field->id] = ''; |
|
| 433 | 433 | } |
| 434 | 434 | } |
| 435 | 435 | |
@@ -511,11 +511,11 @@ discard block |
||
| 511 | 511 | * @return void |
| 512 | 512 | */ |
| 513 | 513 | private static function get_settings_page_html( $values, &$field ) { |
| 514 | - if ( isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ) { |
|
| 514 | + if ( isset( $values['field_options']['custom_html_' . $field->id] ) ) { |
|
| 515 | 515 | $prev_opts = array(); |
| 516 | 516 | $fallback_html = $field->field_options['custom_html'] ?? FrmFieldsHelper::get_default_html( $field->type ); |
| 517 | 517 | |
| 518 | - $field->field_options['custom_html'] = $values['field_options'][ 'custom_html_' . $field->id ] ?? $fallback_html; |
|
| 518 | + $field->field_options['custom_html'] = $values['field_options']['custom_html_' . $field->id] ?? $fallback_html; |
|
| 519 | 519 | } elseif ( $field->type === 'hidden' || $field->type === 'user_id' ) { |
| 520 | 520 | $prev_opts = $field->field_options; |
| 521 | 521 | } |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | ); |
| 541 | 541 | foreach ( $field_cols as $col => $default ) { |
| 542 | 542 | $default = $default === '' ? $field->{$col} : $default; |
| 543 | - $new_field[ $col ] = $values['field_options'][ $col . '_' . $field->id ] ?? $default; |
|
| 543 | + $new_field[$col] = $values['field_options'][$col . '_' . $field->id] ?? $default; |
|
| 544 | 544 | } |
| 545 | 545 | |
| 546 | 546 | if ( $field->type === 'submit' && isset( $new_field['field_order'] ) && (int) $new_field['field_order'] === FrmSubmitHelper::DEFAULT_ORDER ) { |
@@ -734,7 +734,7 @@ discard block |
||
| 734 | 734 | if ( ! isset( $form->options['trash_time'] ) || $form->options['trash_time'] < $delete_timestamp ) { |
| 735 | 735 | self::destroy( $form->id ); |
| 736 | 736 | if ( empty( $form->parent_form_id ) ) { |
| 737 | - ++$count; |
|
| 737 | + ++ $count; |
|
| 738 | 738 | } |
| 739 | 739 | } |
| 740 | 740 | |
@@ -961,16 +961,16 @@ discard block |
||
| 961 | 961 | foreach ( $results as $row ) { |
| 962 | 962 | if ( 'trash' != $row->status ) { |
| 963 | 963 | if ( $row->is_template ) { |
| 964 | - ++$counts['template']; |
|
| 964 | + ++ $counts['template']; |
|
| 965 | 965 | } else { |
| 966 | - ++$counts['published']; |
|
| 966 | + ++ $counts['published']; |
|
| 967 | 967 | } |
| 968 | 968 | } else { |
| 969 | - ++$counts['trash']; |
|
| 969 | + ++ $counts['trash']; |
|
| 970 | 970 | } |
| 971 | 971 | |
| 972 | 972 | if ( 'draft' == $row->status ) { |
| 973 | - ++$counts['draft']; |
|
| 973 | + ++ $counts['draft']; |
|
| 974 | 974 | } |
| 975 | 975 | |
| 976 | 976 | unset( $row ); |
@@ -1011,8 +1011,8 @@ discard block |
||
| 1011 | 1011 | self::maybe_get_form( $form ); |
| 1012 | 1012 | } |
| 1013 | 1013 | |
| 1014 | - if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][ $form->id ] ) ) { |
|
| 1015 | - return $frm_vars['form_params'][ $form->id ]; |
|
| 1014 | + if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][$form->id] ) ) { |
|
| 1015 | + return $frm_vars['form_params'][$form->id]; |
|
| 1016 | 1016 | } |
| 1017 | 1017 | |
| 1018 | 1018 | $action_var = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; // phpcs:ignore WordPress.Security.NonceVerification.Missing |
@@ -1041,15 +1041,15 @@ discard block |
||
| 1041 | 1041 | // If there are two forms on the same page, make sure not to submit both. |
| 1042 | 1042 | foreach ( $default_values as $var => $default ) { |
| 1043 | 1043 | if ( $var === 'action' ) { |
| 1044 | - $values[ $var ] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
| 1044 | + $values[$var] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
| 1045 | 1045 | } else { |
| 1046 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1046 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1047 | 1047 | } |
| 1048 | 1048 | unset( $var, $default ); |
| 1049 | 1049 | } |
| 1050 | 1050 | } else { |
| 1051 | 1051 | foreach ( $default_values as $var => $default ) { |
| 1052 | - $values[ $var ] = $default; |
|
| 1052 | + $values[$var] = $default; |
|
| 1053 | 1053 | unset( $var, $default ); |
| 1054 | 1054 | } |
| 1055 | 1055 | } |
@@ -1075,7 +1075,7 @@ discard block |
||
| 1075 | 1075 | 'sdir' => '', |
| 1076 | 1076 | ); |
| 1077 | 1077 | foreach ( $defaults as $var => $default ) { |
| 1078 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1078 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1079 | 1079 | } |
| 1080 | 1080 | |
| 1081 | 1081 | return $values; |
@@ -1103,7 +1103,7 @@ discard block |
||
| 1103 | 1103 | 'keep_post' => '', |
| 1104 | 1104 | ); |
| 1105 | 1105 | foreach ( $defaults as $var => $default ) { |
| 1106 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1106 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1107 | 1107 | } |
| 1108 | 1108 | |
| 1109 | 1109 | return $values; |
@@ -1217,7 +1217,7 @@ discard block |
||
| 1217 | 1217 | $form = $atts['form']; |
| 1218 | 1218 | $default = $atts['default'] ?? ''; |
| 1219 | 1219 | |
| 1220 | - return $form->options[ $atts['option'] ] ?? $default; |
|
| 1220 | + return $form->options[$atts['option']] ?? $default; |
|
| 1221 | 1221 | } |
| 1222 | 1222 | |
| 1223 | 1223 | /** |
@@ -137,10 +137,10 @@ discard block |
||
| 137 | 137 | if ( $_POST ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 138 | 138 | $repeating = isset( $args['repeating'] ) && $args['repeating']; |
| 139 | 139 | if ( $repeating ) { |
| 140 | - if ( isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 140 | + if ( isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field->id] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 141 | 141 | $value_is_posted = true; |
| 142 | 142 | } |
| 143 | - } elseif ( isset( $_POST['item_meta'][ $field->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 143 | + } elseif ( isset( $_POST['item_meta'][$field->id] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 144 | 144 | $value_is_posted = true; |
| 145 | 145 | } |
| 146 | 146 | } |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | preg_match_all( "/\[(default-message|default_message)\b(.*?)(?:(\/))?\]/s", $message, $shortcodes, PREG_PATTERN_ORDER ); |
| 173 | 173 | |
| 174 | 174 | foreach ( $shortcodes[0] as $short_key => $tag ) { |
| 175 | - $add_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] ); |
|
| 175 | + $add_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][$short_key] ); |
|
| 176 | 176 | if ( ! empty( $add_atts ) ) { |
| 177 | 177 | $this_atts = array_merge( $atts, $add_atts ); |
| 178 | 178 | } else { |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | $default = FrmEntriesController::show_entry_shortcode( $this_atts ); |
| 183 | 183 | |
| 184 | 184 | // Add the default message. |
| 185 | - $message = str_replace( $shortcodes[0][ $short_key ], $default, $message ); |
|
| 185 | + $message = str_replace( $shortcodes[0][$short_key], $default, $message ); |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | return $message; |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | * @return string |
| 196 | 196 | */ |
| 197 | 197 | public static function prepare_display_value( $entry, $field, $atts ) { |
| 198 | - $field_value = $entry->metas[ $field->id ] ?? false; |
|
| 198 | + $field_value = $entry->metas[$field->id] ?? false; |
|
| 199 | 199 | |
| 200 | 200 | if ( FrmAppHelper::pro_is_installed() ) { |
| 201 | 201 | $empty = empty( $field_value ); |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | $child_entries = FrmEntry::getAll( array( 'it.parent_item_id' => $entry->id ), '', '', true ); |
| 224 | 224 | } else { |
| 225 | 225 | // Get all values for this field. |
| 226 | - $child_values = $entry->metas[ $atts['embedded_field_id'] ] ?? false; |
|
| 226 | + $child_values = $entry->metas[$atts['embedded_field_id']] ?? false; |
|
| 227 | 227 | |
| 228 | 228 | if ( $child_values ) { |
| 229 | 229 | $child_entries = FrmEntry::getAll( array( 'it.id' => (array) $child_values ) ); |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | $value = $args['temp_value']; |
| 346 | 346 | } |
| 347 | 347 | if ( empty( $args['parent_field_id'] ) ) { |
| 348 | - $_POST['item_meta'][ $field->id ] = $value; |
|
| 348 | + $_POST['item_meta'][$field->id] = $value; |
|
| 349 | 349 | } else { |
| 350 | 350 | self::set_parent_field_posted_value( $field, $value, $args ); |
| 351 | 351 | } |
@@ -363,17 +363,17 @@ discard block |
||
| 363 | 363 | * @return void |
| 364 | 364 | */ |
| 365 | 365 | private static function set_parent_field_posted_value( $field, $value, $args ) { |
| 366 | - if ( isset( $_POST['item_meta'][ $args['parent_field_id'] ] ) && is_array( $_POST['item_meta'][ $args['parent_field_id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 367 | - if ( ! isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] ) || ! is_array( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 368 | - $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] = array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 366 | + if ( isset( $_POST['item_meta'][$args['parent_field_id']] ) && is_array( $_POST['item_meta'][$args['parent_field_id']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 367 | + if ( ! isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']] ) || ! is_array( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 368 | + $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']] = array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 369 | 369 | } |
| 370 | 370 | } else { |
| 371 | 371 | // All of the section was probably removed. |
| 372 | - $_POST['item_meta'][ $args['parent_field_id'] ] = array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 373 | - $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] = array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 372 | + $_POST['item_meta'][$args['parent_field_id']] = array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 373 | + $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']] = array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 374 | 374 | } |
| 375 | 375 | |
| 376 | - $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] = $value; // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 376 | + $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field->id] = $value; // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | public static function get_posted_value( $field, &$value, $args ) { |
@@ -413,9 +413,9 @@ discard block |
||
| 413 | 413 | private static function get_posted_meta( $field_id, $args ) { |
| 414 | 414 | if ( empty( $args['parent_field_id'] ) ) { |
| 415 | 415 | // Sanitizing is done next. |
| 416 | - $value = isset( $_POST['item_meta'][ $field_id ] ) ? wp_unslash( $_POST['item_meta'][ $field_id ] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 416 | + $value = isset( $_POST['item_meta'][$field_id] ) ? wp_unslash( $_POST['item_meta'][$field_id] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 417 | 417 | } else { |
| 418 | - $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 ] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 418 | + $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] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 419 | 419 | } |
| 420 | 420 | return $value; |
| 421 | 421 | } |
@@ -446,14 +446,14 @@ discard block |
||
| 446 | 446 | self::set_other_repeating_vals( $field, $value, $args ); |
| 447 | 447 | |
| 448 | 448 | // Check if there are any posted "Other" values. |
| 449 | - if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][ $field->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 449 | + if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][$field->id] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 450 | 450 | |
| 451 | 451 | // Save original value. |
| 452 | 452 | $args['temp_value'] = $value; |
| 453 | 453 | $args['other'] = true; |
| 454 | 454 | |
| 455 | 455 | // Sanitizing is done next. |
| 456 | - $other_vals = wp_unslash( $_POST['item_meta']['other'][ $field->id ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 456 | + $other_vals = wp_unslash( $_POST['item_meta']['other'][$field->id] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 457 | 457 | FrmAppHelper::sanitize_value( 'sanitize_text_field', $other_vals ); |
| 458 | 458 | |
| 459 | 459 | // Set the validation value now |
@@ -476,12 +476,12 @@ discard block |
||
| 476 | 476 | } |
| 477 | 477 | |
| 478 | 478 | // Check if there are any other posted "other" values for this field. |
| 479 | - if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 479 | + if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']]['other'][$field->id] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 480 | 480 | // Save original value |
| 481 | 481 | $args['temp_value'] = $value; |
| 482 | 482 | $args['other'] = true; |
| 483 | 483 | |
| 484 | - $other_vals = wp_unslash( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 484 | + $other_vals = wp_unslash( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']]['other'][$field->id] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 485 | 485 | FrmAppHelper::sanitize_value( 'sanitize_text_field', $other_vals ); |
| 486 | 486 | |
| 487 | 487 | // Set the validation value now. |
@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | if ( is_array( $value ) && $field->type === 'checkbox' ) { |
| 509 | 509 | // Combine "Other" values with checked values. "Other" values will override checked box values. |
| 510 | 510 | foreach ( $other_vals as $k => $v ) { |
| 511 | - if ( isset( $value[ $k ] ) && trim( $v ) === '' ) { |
|
| 511 | + if ( isset( $value[$k] ) && trim( $v ) === '' ) { |
|
| 512 | 512 | // If the other box is checked, but doesn't have a value. |
| 513 | 513 | $value = ''; |
| 514 | 514 | break; |
@@ -525,25 +525,25 @@ discard block |
||
| 525 | 525 | |
| 526 | 526 | // Multi-select dropdown. |
| 527 | 527 | if ( is_array( $value ) ) { |
| 528 | - $o_key = array_search( $field->options[ $other_key ], $value ); |
|
| 528 | + $o_key = array_search( $field->options[$other_key], $value ); |
|
| 529 | 529 | |
| 530 | 530 | if ( $o_key !== false ) { |
| 531 | 531 | // Modify the original value so other key will be preserved. |
| 532 | - $value[ $other_key ] = $value[ $o_key ]; |
|
| 532 | + $value[$other_key] = $value[$o_key]; |
|
| 533 | 533 | |
| 534 | 534 | // By default, the array keys will be numeric for multi-select dropdowns. |
| 535 | 535 | // If going backwards and forwards between pages, the array key will match the other key. |
| 536 | 536 | if ( $o_key !== $other_key ) { |
| 537 | - unset( $value[ $o_key ] ); |
|
| 537 | + unset( $value[$o_key] ); |
|
| 538 | 538 | } |
| 539 | 539 | |
| 540 | 540 | $args['temp_value'] = $value; |
| 541 | - $value[ $other_key ] = reset( $other_vals ); |
|
| 542 | - if ( FrmAppHelper::is_empty_value( $value[ $other_key ] ) ) { |
|
| 543 | - unset( $value[ $other_key ] ); |
|
| 541 | + $value[$other_key] = reset( $other_vals ); |
|
| 542 | + if ( FrmAppHelper::is_empty_value( $value[$other_key] ) ) { |
|
| 543 | + unset( $value[$other_key] ); |
|
| 544 | 544 | } |
| 545 | 545 | } |
| 546 | - } elseif ( $field->options[ $other_key ] == $value ) { |
|
| 546 | + } elseif ( $field->options[$other_key] == $value ) { |
|
| 547 | 547 | $value = $other_vals; |
| 548 | 548 | }//end if |
| 549 | 549 | }//end if |
@@ -797,7 +797,7 @@ discard block |
||
| 797 | 797 | * @return void |
| 798 | 798 | */ |
| 799 | 799 | public static function maybe_render_captcha_score( $entry_id ) { |
| 800 | - $query = array( |
|
| 800 | + $query = array( |
|
| 801 | 801 | 'item_id' => (int) $entry_id, |
| 802 | 802 | 'field_id' => 0, |
| 803 | 803 | ); |
@@ -851,7 +851,7 @@ discard block |
||
| 851 | 851 | public static function get_entry_status_label( $status ) { |
| 852 | 852 | $statuses = self::get_entry_statuses(); |
| 853 | 853 | |
| 854 | - return $statuses[ self::get_entry_status( $status ) ]; |
|
| 854 | + return $statuses[self::get_entry_status( $status )]; |
|
| 855 | 855 | } |
| 856 | 856 | |
| 857 | 857 | /** |
@@ -134,13 +134,16 @@ discard block |
||
| 134 | 134 | */ |
| 135 | 135 | public static function value_is_posted( $field, $args ) { |
| 136 | 136 | $value_is_posted = false; |
| 137 | - if ( $_POST ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 137 | + if ( $_POST ) { |
|
| 138 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 138 | 139 | $repeating = isset( $args['repeating'] ) && $args['repeating']; |
| 139 | 140 | if ( $repeating ) { |
| 140 | - if ( isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 141 | + if ( isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] ) ) { |
|
| 142 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 141 | 143 | $value_is_posted = true; |
| 142 | 144 | } |
| 143 | - } elseif ( isset( $_POST['item_meta'][ $field->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 145 | + } elseif ( isset( $_POST['item_meta'][ $field->id ] ) ) { |
|
| 146 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 144 | 147 | $value_is_posted = true; |
| 145 | 148 | } |
| 146 | 149 | } |
@@ -363,8 +366,10 @@ discard block |
||
| 363 | 366 | * @return void |
| 364 | 367 | */ |
| 365 | 368 | private static function set_parent_field_posted_value( $field, $value, $args ) { |
| 366 | - if ( isset( $_POST['item_meta'][ $args['parent_field_id'] ] ) && is_array( $_POST['item_meta'][ $args['parent_field_id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 367 | - if ( ! isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] ) || ! is_array( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 369 | + if ( isset( $_POST['item_meta'][ $args['parent_field_id'] ] ) && is_array( $_POST['item_meta'][ $args['parent_field_id'] ] ) ) { |
|
| 370 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 371 | + if ( ! isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] ) || ! is_array( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] ) ) { |
|
| 372 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 368 | 373 | $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] = array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 369 | 374 | } |
| 370 | 375 | } else { |
@@ -446,7 +451,8 @@ discard block |
||
| 446 | 451 | self::set_other_repeating_vals( $field, $value, $args ); |
| 447 | 452 | |
| 448 | 453 | // Check if there are any posted "Other" values. |
| 449 | - if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][ $field->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 454 | + if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][ $field->id ] ) ) { |
|
| 455 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 450 | 456 | |
| 451 | 457 | // Save original value. |
| 452 | 458 | $args['temp_value'] = $value; |
@@ -476,7 +482,8 @@ discard block |
||
| 476 | 482 | } |
| 477 | 483 | |
| 478 | 484 | // Check if there are any other posted "other" values for this field. |
| 479 | - if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 485 | + if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ] ) ) { |
|
| 486 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 480 | 487 | // Save original value |
| 481 | 488 | $args['temp_value'] = $value; |
| 482 | 489 | $args['other'] = true; |
@@ -152,20 +152,20 @@ discard block |
||
| 152 | 152 | global $frm_vars; |
| 153 | 153 | $form_id = FrmForm::get_current_form_id(); |
| 154 | 154 | |
| 155 | - $columns[ $form_id . '_id' ] = 'ID'; |
|
| 156 | - $columns[ $form_id . '_item_key' ] = esc_html__( 'Entry Key', 'formidable' ); |
|
| 155 | + $columns[$form_id . '_id'] = 'ID'; |
|
| 156 | + $columns[$form_id . '_item_key'] = esc_html__( 'Entry Key', 'formidable' ); |
|
| 157 | 157 | |
| 158 | 158 | if ( $form_id ) { |
| 159 | 159 | self::get_columns_for_form( $form_id, $columns ); |
| 160 | 160 | } else { |
| 161 | - $columns[ $form_id . '_form_id' ] = esc_html__( 'Form', 'formidable' ); |
|
| 162 | - $columns[ $form_id . '_name' ] = esc_html__( 'Entry Name', 'formidable' ); |
|
| 163 | - $columns[ $form_id . '_user_id' ] = esc_html__( 'Created By', 'formidable' ); |
|
| 161 | + $columns[$form_id . '_form_id'] = esc_html__( 'Form', 'formidable' ); |
|
| 162 | + $columns[$form_id . '_name'] = esc_html__( 'Entry Name', 'formidable' ); |
|
| 163 | + $columns[$form_id . '_user_id'] = esc_html__( 'Created By', 'formidable' ); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - $columns[ $form_id . '_is_draft' ] = esc_html__( 'Entry Status', 'formidable' ); |
|
| 167 | - $columns[ $form_id . '_created_at' ] = __( 'Entry creation date', 'formidable' ); |
|
| 168 | - $columns[ $form_id . '_updated_at' ] = __( 'Entry update date', 'formidable' ); |
|
| 166 | + $columns[$form_id . '_is_draft'] = esc_html__( 'Entry Status', 'formidable' ); |
|
| 167 | + $columns[$form_id . '_created_at'] = __( 'Entry creation date', 'formidable' ); |
|
| 168 | + $columns[$form_id . '_updated_at'] = __( 'Entry update date', 'formidable' ); |
|
| 169 | 169 | self::maybe_add_ip_col( $form_id, $columns ); |
| 170 | 170 | |
| 171 | 171 | $frm_vars['cols'] = $columns; |
@@ -229,10 +229,10 @@ discard block |
||
| 229 | 229 | |
| 230 | 230 | foreach ( $sub_form_cols as $k => $sub_form_col ) { |
| 231 | 231 | if ( FrmField::is_no_save_field( $sub_form_col->type ) ) { |
| 232 | - unset( $sub_form_cols[ $k ] ); |
|
| 232 | + unset( $sub_form_cols[$k] ); |
|
| 233 | 233 | continue; |
| 234 | 234 | } |
| 235 | - $columns[ $form_id . '_' . $sub_form_col->field_key . '-_-' . $field->id ] = FrmAppHelper::truncate( $sub_form_col->name, 35 ); |
|
| 235 | + $columns[$form_id . '_' . $sub_form_col->field_key . '-_-' . $field->id] = FrmAppHelper::truncate( $sub_form_col->name, 35 ); |
|
| 236 | 236 | unset( $sub_form_col ); |
| 237 | 237 | } |
| 238 | 238 | } |
@@ -256,10 +256,10 @@ discard block |
||
| 256 | 256 | $is_post_status = FrmField::is_option_true( $field, 'post_field' ) && $field->field_options['post_field'] === 'post_status'; |
| 257 | 257 | $include_column_for_sep_val = $has_separate_value && ! $is_post_status; |
| 258 | 258 | if ( $include_column_for_sep_val ) { |
| 259 | - $columns[ $form_id . '_frmsep_' . $col_id ] = self::maybe_format_field_name_for_column_title( $field, $include_column_for_sep_val ); |
|
| 259 | + $columns[$form_id . '_frmsep_' . $col_id] = self::maybe_format_field_name_for_column_title( $field, $include_column_for_sep_val ); |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | - $columns[ $form_id . '_' . $col_id ] = self::maybe_format_field_name_for_column_title( $field, $include_column_for_sep_val, false ); |
|
| 262 | + $columns[$form_id . '_' . $col_id] = self::maybe_format_field_name_for_column_title( $field, $include_column_for_sep_val, false ); |
|
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | /** |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | */ |
| 292 | 292 | private static function maybe_add_ip_col( $form_id, &$columns ) { |
| 293 | 293 | if ( FrmAppHelper::ips_saved() ) { |
| 294 | - $columns[ $form_id . '_ip' ] = 'IP'; |
|
| 294 | + $columns[$form_id . '_ip'] = 'IP'; |
|
| 295 | 295 | } |
| 296 | 296 | } |
| 297 | 297 | |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | foreach ( $meta_value as $mk => $mv ) { |
| 347 | 347 | // Remove blank values. |
| 348 | 348 | if ( empty( $mv ) ) { |
| 349 | - unset( $meta_value[ $mk ] ); |
|
| 349 | + unset( $meta_value[$mk] ); |
|
| 350 | 350 | } |
| 351 | 351 | } |
| 352 | 352 | |
@@ -423,14 +423,14 @@ discard block |
||
| 423 | 423 | ); |
| 424 | 424 | |
| 425 | 425 | if ( ! $form_id ) { |
| 426 | - $columns[ $form_id . '_user_id' ] = 'user_id'; |
|
| 427 | - $columns[ $form_id . '_name' ] = 'name'; |
|
| 428 | - $columns[ $form_id . '_form_id' ] = 'form_id'; |
|
| 426 | + $columns[$form_id . '_user_id'] = 'user_id'; |
|
| 427 | + $columns[$form_id . '_name'] = 'name'; |
|
| 428 | + $columns[$form_id . '_form_id'] = 'form_id'; |
|
| 429 | 429 | } |
| 430 | 430 | |
| 431 | 431 | foreach ( $fields as $field ) { |
| 432 | 432 | if ( self::field_supports_sorting( $field ) ) { |
| 433 | - $columns[ $form_id . '_' . $field->field_key ] = 'meta_' . $field->id; |
|
| 433 | + $columns[$form_id . '_' . $field->field_key] = 'meta_' . $field->id; |
|
| 434 | 434 | } |
| 435 | 435 | } |
| 436 | 436 | |
@@ -518,7 +518,7 @@ discard block |
||
| 518 | 518 | $atts['form_id'] . '_item_key' => '', |
| 519 | 519 | $atts['form_id'] . '_id' => '', |
| 520 | 520 | ); |
| 521 | - $cols = $remove_first + array_reverse( $frm_vars['cols'], true ); |
|
| 521 | + $cols = $remove_first + array_reverse( $frm_vars['cols'], true ); |
|
| 522 | 522 | |
| 523 | 523 | $i = $atts['i']; |
| 524 | 524 | |
@@ -529,7 +529,7 @@ discard block |
||
| 529 | 529 | |
| 530 | 530 | if ( empty( $result ) || ! in_array( $col_key, $result, true ) ) { |
| 531 | 531 | $result[] = $col_key; |
| 532 | - --$i; |
|
| 532 | + -- $i; |
|
| 533 | 533 | } |
| 534 | 534 | |
| 535 | 535 | unset( $col_key, $col ); |
@@ -677,9 +677,9 @@ discard block |
||
| 677 | 677 | if ( ! isset( $frm_vars['form_params'] ) ) { |
| 678 | 678 | $frm_vars['form_params'] = array(); |
| 679 | 679 | } |
| 680 | - $frm_vars['form_params'][ $form->id ] = $params; |
|
| 680 | + $frm_vars['form_params'][$form->id] = $params; |
|
| 681 | 681 | |
| 682 | - if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) { |
|
| 682 | + if ( isset( $frm_vars['created_entries'][$form_id] ) ) { |
|
| 683 | 683 | return; |
| 684 | 684 | } |
| 685 | 685 | |
@@ -695,16 +695,16 @@ discard block |
||
| 695 | 695 | */ |
| 696 | 696 | $errors = apply_filters( 'frm_entries_before_create', $errors, $form ); |
| 697 | 697 | |
| 698 | - $frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors ); |
|
| 698 | + $frm_vars['created_entries'][$form_id] = array( 'errors' => $errors ); |
|
| 699 | 699 | |
| 700 | 700 | if ( empty( $errors ) ) { |
| 701 | 701 | $_POST['frm_skip_cookie'] = 1; |
| 702 | 702 | $do_success = false; |
| 703 | 703 | if ( $params['action'] === 'create' ) { |
| 704 | - if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) { |
|
| 705 | - $frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 704 | + if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][$form_id]['entry_id'] ) ) { |
|
| 705 | + $frm_vars['created_entries'][$form_id]['entry_id'] = FrmEntry::create( $_POST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 706 | 706 | |
| 707 | - $params['id'] = $frm_vars['created_entries'][ $form_id ]['entry_id']; |
|
| 707 | + $params['id'] = $frm_vars['created_entries'][$form_id]['entry_id']; |
|
| 708 | 708 | $do_success = true; |
| 709 | 709 | } |
| 710 | 710 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | $content_before_channel_tag, |
| 97 | 97 | 1 |
| 98 | 98 | ); |
| 99 | - $xml_string = $content_before_channel_tag . substr( $xml_string, $channel_start_position ); |
|
| 99 | + $xml_string = $content_before_channel_tag . substr( $xml_string, $channel_start_position ); |
|
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | |
@@ -185,8 +185,8 @@ discard block |
||
| 185 | 185 | ); |
| 186 | 186 | |
| 187 | 187 | if ( $term && is_array( $term ) ) { |
| 188 | - ++$imported['imported']['terms']; |
|
| 189 | - $imported['terms'][ (int) $t->term_id ] = $term['term_id']; |
|
| 188 | + ++ $imported['imported']['terms']; |
|
| 189 | + $imported['terms'][(int) $t->term_id] = $term['term_id']; |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | unset( $term, $t ); |
@@ -246,11 +246,11 @@ discard block |
||
| 246 | 246 | if ( $form_id ) { |
| 247 | 247 | if ( empty( $form['parent_form_id'] ) ) { |
| 248 | 248 | // Don't include the repeater form in the imported count. |
| 249 | - ++$imported['imported']['forms']; |
|
| 249 | + ++ $imported['imported']['forms']; |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | // Keep track of whether this specific form was updated or not. |
| 253 | - $imported['form_status'][ $form_id ] = 'imported'; |
|
| 253 | + $imported['form_status'][$form_id] = 'imported'; |
|
| 254 | 254 | } |
| 255 | 255 | } |
| 256 | 256 | |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | // Update field ids/keys to new ones. |
| 266 | 266 | do_action( 'frm_after_duplicate_form', $form_id, $form, array( 'old_id' => $old_id ) ); |
| 267 | 267 | |
| 268 | - $imported['forms'][ (int) $item->id ] = $form_id; |
|
| 268 | + $imported['forms'][(int) $item->id] = $form_id; |
|
| 269 | 269 | |
| 270 | 270 | // Send pre 2.0 form options through function that creates actions. |
| 271 | 271 | self::migrate_form_settings_to_actions( $form['options'], $form_id, $imported, true ); |
@@ -335,19 +335,19 @@ discard block |
||
| 335 | 335 | FrmForm::update( $form_id, $form ); |
| 336 | 336 | if ( empty( $form['parent_form_id'] ) ) { |
| 337 | 337 | // Don't include the repeater form in the updated count. |
| 338 | - ++$imported['updated']['forms']; |
|
| 338 | + ++ $imported['updated']['forms']; |
|
| 339 | 339 | } |
| 340 | 340 | |
| 341 | 341 | // Keep track of whether this specific form was updated or not |
| 342 | - $imported['form_status'][ $form_id ] = 'updated'; |
|
| 342 | + $imported['form_status'][$form_id] = 'updated'; |
|
| 343 | 343 | } |
| 344 | 344 | |
| 345 | 345 | private static function get_form_fields( $form_id ) { |
| 346 | 346 | $form_fields = FrmField::get_all_for_form( $form_id, '', 'exclude', 'exclude' ); |
| 347 | 347 | $old_fields = array(); |
| 348 | 348 | foreach ( $form_fields as $f ) { |
| 349 | - $old_fields[ $f->id ] = $f; |
|
| 350 | - $old_fields[ $f->field_key ] = $f->id; |
|
| 349 | + $old_fields[$f->id] = $f; |
|
| 350 | + $old_fields[$f->field_key] = $f->id; |
|
| 351 | 351 | unset( $f ); |
| 352 | 352 | } |
| 353 | 353 | $form_fields = $old_fields; |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | */ |
| 408 | 408 | private static function track_imported_child_forms( $form_id, $parent_form_id, &$child_forms ) { |
| 409 | 409 | if ( $parent_form_id ) { |
| 410 | - $child_forms[ $form_id ] = $parent_form_id; |
|
| 410 | + $child_forms[$form_id] = $parent_form_id; |
|
| 411 | 411 | } |
| 412 | 412 | } |
| 413 | 413 | |
@@ -422,9 +422,9 @@ discard block |
||
| 422 | 422 | */ |
| 423 | 423 | private static function maybe_update_child_form_parent_id( $imported_forms, $child_forms ) { |
| 424 | 424 | foreach ( $child_forms as $child_form_id => $old_parent_form_id ) { |
| 425 | - if ( isset( $imported_forms[ $old_parent_form_id ] ) && (int) $imported_forms[ $old_parent_form_id ] !== (int) $old_parent_form_id ) { |
|
| 425 | + if ( isset( $imported_forms[$old_parent_form_id] ) && (int) $imported_forms[$old_parent_form_id] !== (int) $old_parent_form_id ) { |
|
| 426 | 426 | // Update all children with this old parent_form_id |
| 427 | - $new_parent_form_id = (int) $imported_forms[ $old_parent_form_id ]; |
|
| 427 | + $new_parent_form_id = (int) $imported_forms[$old_parent_form_id]; |
|
| 428 | 428 | FrmForm::update( $child_form_id, array( 'parent_form_id' => $new_parent_form_id ) ); |
| 429 | 429 | do_action( 'frm_update_child_form_parent_id', $child_form_id, $new_parent_form_id ); |
| 430 | 430 | } |
@@ -460,34 +460,34 @@ discard block |
||
| 460 | 460 | |
| 461 | 461 | if ( ! empty( $this_form ) ) { |
| 462 | 462 | // check for field to edit by field id |
| 463 | - if ( isset( $form_fields[ $f['id'] ] ) ) { |
|
| 463 | + if ( isset( $form_fields[$f['id']] ) ) { |
|
| 464 | 464 | FrmField::update( $f['id'], $f ); |
| 465 | - ++$imported['updated']['fields']; |
|
| 465 | + ++ $imported['updated']['fields']; |
|
| 466 | 466 | |
| 467 | - unset( $form_fields[ $f['id'] ] ); |
|
| 467 | + unset( $form_fields[$f['id']] ); |
|
| 468 | 468 | |
| 469 | 469 | // Unset old field key. |
| 470 | - if ( isset( $form_fields[ $f['field_key'] ] ) ) { |
|
| 471 | - unset( $form_fields[ $f['field_key'] ] ); |
|
| 470 | + if ( isset( $form_fields[$f['field_key']] ) ) { |
|
| 471 | + unset( $form_fields[$f['field_key']] ); |
|
| 472 | 472 | } |
| 473 | - } elseif ( isset( $form_fields[ $f['field_key'] ] ) ) { |
|
| 474 | - $keys_by_original_field_id[ $f['id'] ] = $f['field_key']; |
|
| 473 | + } elseif ( isset( $form_fields[$f['field_key']] ) ) { |
|
| 474 | + $keys_by_original_field_id[$f['id']] = $f['field_key']; |
|
| 475 | 475 | |
| 476 | 476 | $old_field_id = $f['id']; |
| 477 | 477 | |
| 478 | 478 | // check for field to edit by field key |
| 479 | 479 | unset( $f['id'] ); |
| 480 | 480 | |
| 481 | - FrmField::update( $form_fields[ $f['field_key'] ], $f ); |
|
| 482 | - ++$imported['updated']['fields']; |
|
| 481 | + FrmField::update( $form_fields[$f['field_key']], $f ); |
|
| 482 | + ++ $imported['updated']['fields']; |
|
| 483 | 483 | |
| 484 | 484 | self::do_after_field_imported_action( $f, $form_fields, $old_field_id ); |
| 485 | 485 | |
| 486 | 486 | // Unset old field id. |
| 487 | - unset( $form_fields[ $form_fields[ $f['field_key'] ] ] ); |
|
| 487 | + unset( $form_fields[$form_fields[$f['field_key']]] ); |
|
| 488 | 488 | |
| 489 | 489 | // Unset old field key. |
| 490 | - unset( $form_fields[ $f['field_key'] ] ); |
|
| 490 | + unset( $form_fields[$f['field_key']] ); |
|
| 491 | 491 | } else { |
| 492 | 492 | // If no matching field id or key in this form, create the field. |
| 493 | 493 | self::create_imported_field( $f, $imported ); |
@@ -527,7 +527,7 @@ discard block |
||
| 527 | 527 | */ |
| 528 | 528 | private static function do_after_field_imported_action( $field_array, $form_fields, $old_field_id ) { |
| 529 | 529 | // Assign field array the update field's ID. |
| 530 | - $field_array['id'] = $form_fields[ $field_array['field_key'] ]; |
|
| 530 | + $field_array['id'] = $form_fields[$field_array['field_key']]; |
|
| 531 | 531 | |
| 532 | 532 | /** |
| 533 | 533 | * Fires when an existing field is imported. |
@@ -538,7 +538,7 @@ discard block |
||
| 538 | 538 | * @param int $field_id |
| 539 | 539 | * @param int $old_field_id |
| 540 | 540 | */ |
| 541 | - do_action( 'frm_after_existing_field_is_imported', $field_array, $form_fields[ $field_array['field_key'] ], $old_field_id ); |
|
| 541 | + do_action( 'frm_after_existing_field_is_imported', $field_array, $form_fields[$field_array['field_key']], $old_field_id ); |
|
| 542 | 542 | } |
| 543 | 543 | |
| 544 | 544 | private static function fill_field( $field, $form_id ) { |
@@ -641,8 +641,8 @@ discard block |
||
| 641 | 641 | if ( $f['type'] === 'form' || ( $f['type'] === 'divider' && FrmField::is_option_true( $f['field_options'], 'repeat' ) ) ) { |
| 642 | 642 | if ( FrmField::is_option_true( $f['field_options'], 'form_select' ) ) { |
| 643 | 643 | $form_select = (int) $f['field_options']['form_select']; |
| 644 | - if ( isset( $imported['forms'][ $form_select ] ) ) { |
|
| 645 | - $f['field_options']['form_select'] = $imported['forms'][ $form_select ]; |
|
| 644 | + if ( isset( $imported['forms'][$form_select] ) ) { |
|
| 645 | + $f['field_options']['form_select'] = $imported['forms'][$form_select]; |
|
| 646 | 646 | } |
| 647 | 647 | } |
| 648 | 648 | } |
@@ -664,8 +664,8 @@ discard block |
||
| 664 | 664 | |
| 665 | 665 | if ( FrmField::is_option_true_in_array( $f['field_options'], 'get_values_form' ) ) { |
| 666 | 666 | $old_form = $f['field_options']['get_values_form']; |
| 667 | - if ( isset( $imported['forms'][ $old_form ] ) ) { |
|
| 668 | - $f['field_options']['get_values_form'] = $imported['forms'][ $old_form ]; |
|
| 667 | + if ( isset( $imported['forms'][$old_form] ) ) { |
|
| 668 | + $f['field_options']['get_values_form'] = $imported['forms'][$old_form]; |
|
| 669 | 669 | } |
| 670 | 670 | } |
| 671 | 671 | } |
@@ -692,12 +692,12 @@ discard block |
||
| 692 | 692 | private static function migrate_placeholders( &$f ) { |
| 693 | 693 | $update_values = self::migrate_field_placeholder( $f, 'clear_on_focus' ); |
| 694 | 694 | foreach ( $update_values as $k => $v ) { |
| 695 | - $f[ $k ] = $v; |
|
| 695 | + $f[$k] = $v; |
|
| 696 | 696 | } |
| 697 | 697 | |
| 698 | 698 | $update_values = self::migrate_field_placeholder( $f, 'default_blank' ); |
| 699 | 699 | foreach ( $update_values as $k => $v ) { |
| 700 | - $f[ $k ] = $v; |
|
| 700 | + $f[$k] = $v; |
|
| 701 | 701 | } |
| 702 | 702 | } |
| 703 | 703 | |
@@ -715,7 +715,7 @@ discard block |
||
| 715 | 715 | public static function migrate_field_placeholder( $field, $type ) { |
| 716 | 716 | $field = (array) $field; |
| 717 | 717 | $field_options = $field['field_options']; |
| 718 | - if ( empty( $field_options[ $type ] ) || empty( $field['default_value'] ) ) { |
|
| 718 | + if ( empty( $field_options[$type] ) || empty( $field['default_value'] ) ) { |
|
| 719 | 719 | return array(); |
| 720 | 720 | } |
| 721 | 721 | |
@@ -741,7 +741,7 @@ discard block |
||
| 741 | 741 | } |
| 742 | 742 | |
| 743 | 743 | if ( $opt == $default_value ) { |
| 744 | - unset( $options[ $opt_key ] ); |
|
| 744 | + unset( $options[$opt_key] ); |
|
| 745 | 745 | break; |
| 746 | 746 | } |
| 747 | 747 | } |
@@ -769,7 +769,7 @@ discard block |
||
| 769 | 769 | |
| 770 | 770 | $new_id = FrmField::create( $f ); |
| 771 | 771 | if ( $new_id != false ) { |
| 772 | - ++$imported['imported']['fields']; |
|
| 772 | + ++ $imported['imported']['fields']; |
|
| 773 | 773 | do_action( 'frm_after_field_is_imported', $f, $new_id ); |
| 774 | 774 | } |
| 775 | 775 | } |
@@ -798,10 +798,10 @@ discard block |
||
| 798 | 798 | |
| 799 | 799 | $image_id = FrmProFileImport::import_attachment( $option['src'], $field_object ); |
| 800 | 800 | // Remove the src from options as it isn't required after import. |
| 801 | - unset( $field['options'][ $key ]['src'] ); |
|
| 801 | + unset( $field['options'][$key]['src'] ); |
|
| 802 | 802 | |
| 803 | 803 | if ( is_numeric( $image_id ) ) { |
| 804 | - $field['options'][ $key ]['image'] = $image_id; |
|
| 804 | + $field['options'][$key]['image'] = $image_id; |
|
| 805 | 805 | } |
| 806 | 806 | } |
| 807 | 807 | |
@@ -988,8 +988,8 @@ discard block |
||
| 988 | 988 | } else { |
| 989 | 989 | if ( $post['post_type'] === 'frm_display' ) { |
| 990 | 990 | $post['post_content'] = self::maybe_prepare_json_view_content( $post['post_content'] ); |
| 991 | - } elseif ( 'page' === $post['post_type'] && isset( $imported['posts'][ $post['post_parent'] ] ) ) { |
|
| 992 | - $post['post_parent'] = $imported['posts'][ $post['post_parent'] ]; |
|
| 991 | + } elseif ( 'page' === $post['post_type'] && isset( $imported['posts'][$post['post_parent']] ) ) { |
|
| 992 | + $post['post_parent'] = $imported['posts'][$post['post_parent']]; |
|
| 993 | 993 | } |
| 994 | 994 | // Create/update post now |
| 995 | 995 | $post_id = wp_insert_post( $post ); |
@@ -1000,27 +1000,27 @@ discard block |
||
| 1000 | 1000 | } |
| 1001 | 1001 | |
| 1002 | 1002 | if ( false !== strpos( $post['post_content'], '[display-frm-data' ) || false !== strpos( $post['post_content'], '[formidable' ) ) { |
| 1003 | - $posts_with_shortcodes[ $post_id ] = $post; |
|
| 1003 | + $posts_with_shortcodes[$post_id] = $post; |
|
| 1004 | 1004 | } |
| 1005 | 1005 | |
| 1006 | 1006 | self::update_postmeta( $post, $post_id ); |
| 1007 | 1007 | self::update_layout( $post, $post_id ); |
| 1008 | 1008 | |
| 1009 | 1009 | $this_type = 'posts'; |
| 1010 | - if ( isset( $post_types[ $post['post_type'] ] ) ) { |
|
| 1011 | - $this_type = $post_types[ $post['post_type'] ]; |
|
| 1010 | + if ( isset( $post_types[$post['post_type']] ) ) { |
|
| 1011 | + $this_type = $post_types[$post['post_type']]; |
|
| 1012 | 1012 | } |
| 1013 | 1013 | |
| 1014 | 1014 | if ( isset( $post['ID'] ) && $post_id == $post['ID'] ) { |
| 1015 | - ++$imported['updated'][ $this_type ]; |
|
| 1015 | + ++ $imported['updated'][$this_type]; |
|
| 1016 | 1016 | } else { |
| 1017 | - ++$imported['imported'][ $this_type ]; |
|
| 1017 | + ++ $imported['imported'][$this_type]; |
|
| 1018 | 1018 | } |
| 1019 | 1019 | |
| 1020 | - $imported['posts'][ $old_id ] = $post_id; |
|
| 1020 | + $imported['posts'][$old_id] = $post_id; |
|
| 1021 | 1021 | |
| 1022 | 1022 | if ( $post['post_type'] === 'frm_display' ) { |
| 1023 | - $view_ids[ $old_id ] = $post_id; |
|
| 1023 | + $view_ids[$old_id] = $post_id; |
|
| 1024 | 1024 | } |
| 1025 | 1025 | |
| 1026 | 1026 | do_action( 'frm_after_import_view', $post_id, $post ); |
@@ -1182,9 +1182,9 @@ discard block |
||
| 1182 | 1182 | $post['attachment_url'] = (string) $item->attachment_url; |
| 1183 | 1183 | } |
| 1184 | 1184 | |
| 1185 | - if ( $post['post_type'] == FrmFormActionsController::$action_post_type && isset( $imported['forms'][ (int) $post['menu_order'] ] ) ) { |
|
| 1185 | + if ( $post['post_type'] == FrmFormActionsController::$action_post_type && isset( $imported['forms'][(int) $post['menu_order']] ) ) { |
|
| 1186 | 1186 | // update to new form id |
| 1187 | - $post['menu_order'] = $imported['forms'][ (int) $post['menu_order'] ]; |
|
| 1187 | + $post['menu_order'] = $imported['forms'][(int) $post['menu_order']]; |
|
| 1188 | 1188 | } |
| 1189 | 1189 | |
| 1190 | 1190 | // Don't allow default styles to take over a site's default style |
@@ -1221,8 +1221,8 @@ discard block |
||
| 1221 | 1221 | ); |
| 1222 | 1222 | |
| 1223 | 1223 | // Switch old form and field ids to new ones. |
| 1224 | - if ( 'frm_form_id' === $m['key'] && isset( $imported['forms'][ (int) $m['value'] ] ) ) { |
|
| 1225 | - $m['value'] = $imported['forms'][ (int) $m['value'] ]; |
|
| 1224 | + if ( 'frm_form_id' === $m['key'] && isset( $imported['forms'][(int) $m['value']] ) ) { |
|
| 1225 | + $m['value'] = $imported['forms'][(int) $m['value']]; |
|
| 1226 | 1226 | } else { |
| 1227 | 1227 | $m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] ); |
| 1228 | 1228 | |
@@ -1233,23 +1233,23 @@ discard block |
||
| 1233 | 1233 | } elseif ( 'frm_options' === $m['key'] ) { |
| 1234 | 1234 | |
| 1235 | 1235 | foreach ( array( 'date_field_id', 'edate_field_id' ) as $setting_name ) { |
| 1236 | - if ( isset( $m['value'][ $setting_name ] ) && is_numeric( $m['value'][ $setting_name ] ) && isset( $frm_duplicate_ids[ $m['value'][ $setting_name ] ] ) ) { |
|
| 1237 | - $m['value'][ $setting_name ] = $frm_duplicate_ids[ $m['value'][ $setting_name ] ]; |
|
| 1236 | + if ( isset( $m['value'][$setting_name] ) && is_numeric( $m['value'][$setting_name] ) && isset( $frm_duplicate_ids[$m['value'][$setting_name]] ) ) { |
|
| 1237 | + $m['value'][$setting_name] = $frm_duplicate_ids[$m['value'][$setting_name]]; |
|
| 1238 | 1238 | } |
| 1239 | 1239 | } |
| 1240 | 1240 | |
| 1241 | 1241 | if ( ! empty( $m['value']['map_address_fields'] ) ) { |
| 1242 | 1242 | foreach ( $m['value']['map_address_fields'] as $address_field_key => $address_field_id ) { |
| 1243 | - if ( isset( $frm_duplicate_ids[ $address_field_id ] ) ) { |
|
| 1244 | - $m['value']['map_address_fields'][ $address_field_key ] = $frm_duplicate_ids[ $address_field_id ]; |
|
| 1243 | + if ( isset( $frm_duplicate_ids[$address_field_id] ) ) { |
|
| 1244 | + $m['value']['map_address_fields'][$address_field_key] = $frm_duplicate_ids[$address_field_id]; |
|
| 1245 | 1245 | } |
| 1246 | 1246 | } |
| 1247 | 1247 | } |
| 1248 | 1248 | |
| 1249 | 1249 | if ( ! empty( $m['value']['calendar_options'] ) ) { |
| 1250 | 1250 | foreach ( $m['value']['calendar_options'] as $calendar_option_group_key => $calendar_option ) { |
| 1251 | - if ( isset( $frm_duplicate_ids[ $calendar_option['value'] ] ) ) { |
|
| 1252 | - $m['value']['calendar_options'][ $calendar_option_group_key ]['value'] = $frm_duplicate_ids[ $calendar_option['value'] ]; |
|
| 1251 | + if ( isset( $frm_duplicate_ids[$calendar_option['value']] ) ) { |
|
| 1252 | + $m['value']['calendar_options'][$calendar_option_group_key]['value'] = $frm_duplicate_ids[$calendar_option['value']]; |
|
| 1253 | 1253 | } |
| 1254 | 1254 | } |
| 1255 | 1255 | } |
@@ -1257,8 +1257,8 @@ discard block |
||
| 1257 | 1257 | if ( ! empty( $m['value']['timeline_options'] ) ) { |
| 1258 | 1258 | foreach ( $m['value']['timeline_options'] as $timeline_option_group_key => $timeline_group_option ) { |
| 1259 | 1259 | foreach ( $timeline_group_option as $timeline_option_key => $timeline_option ) { |
| 1260 | - if ( isset( $frm_duplicate_ids[ $timeline_option ] ) ) { |
|
| 1261 | - $m['value']['timeline_options'][ $timeline_option_group_key ][ $timeline_option_key ] = $frm_duplicate_ids[ $timeline_option ]; |
|
| 1260 | + if ( isset( $frm_duplicate_ids[$timeline_option] ) ) { |
|
| 1261 | + $m['value']['timeline_options'][$timeline_option_group_key][$timeline_option_key] = $frm_duplicate_ids[$timeline_option]; |
|
| 1262 | 1262 | } |
| 1263 | 1263 | } |
| 1264 | 1264 | } |
@@ -1266,8 +1266,8 @@ discard block |
||
| 1266 | 1266 | |
| 1267 | 1267 | $check_dup_array = array(); |
| 1268 | 1268 | if ( ! empty( $m['value']['order_by'] ) ) { |
| 1269 | - if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[ $m['value']['order_by'] ] ) ) { |
|
| 1270 | - $m['value']['order_by'] = $frm_duplicate_ids[ $m['value']['order_by'] ]; |
|
| 1269 | + if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[$m['value']['order_by']] ) ) { |
|
| 1270 | + $m['value']['order_by'] = $frm_duplicate_ids[$m['value']['order_by']]; |
|
| 1271 | 1271 | } elseif ( is_array( $m['value']['order_by'] ) ) { |
| 1272 | 1272 | $check_dup_array[] = 'order_by'; |
| 1273 | 1273 | } |
@@ -1278,9 +1278,9 @@ discard block |
||
| 1278 | 1278 | } |
| 1279 | 1279 | |
| 1280 | 1280 | foreach ( $check_dup_array as $check_k ) { |
| 1281 | - foreach ( (array) $m['value'][ $check_k ] as $mk => $mv ) { |
|
| 1282 | - if ( isset( $frm_duplicate_ids[ $mv ] ) ) { |
|
| 1283 | - $m['value'][ $check_k ][ $mk ] = $frm_duplicate_ids[ $mv ]; |
|
| 1281 | + foreach ( (array) $m['value'][$check_k] as $mk => $mv ) { |
|
| 1282 | + if ( isset( $frm_duplicate_ids[$mv] ) ) { |
|
| 1283 | + $m['value'][$check_k][$mk] = $frm_duplicate_ids[$mv]; |
|
| 1284 | 1284 | } |
| 1285 | 1285 | unset( $mk, $mv ); |
| 1286 | 1286 | } |
@@ -1293,11 +1293,11 @@ discard block |
||
| 1293 | 1293 | $m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] ); |
| 1294 | 1294 | } |
| 1295 | 1295 | |
| 1296 | - $post['postmeta'][ (string) $meta->meta_key ] = $m['value']; |
|
| 1296 | + $post['postmeta'][(string) $meta->meta_key] = $m['value']; |
|
| 1297 | 1297 | } |
| 1298 | 1298 | |
| 1299 | 1299 | private static function populate_layout( &$post, $layout ) { |
| 1300 | - $post['layout'][ (string) $layout->type ] = (string) $layout->data; |
|
| 1300 | + $post['layout'][(string) $layout->type] = (string) $layout->data; |
|
| 1301 | 1301 | } |
| 1302 | 1302 | |
| 1303 | 1303 | /** |
@@ -1325,11 +1325,11 @@ discard block |
||
| 1325 | 1325 | $name = (string) $c; |
| 1326 | 1326 | } |
| 1327 | 1327 | |
| 1328 | - if ( ! isset( $post['tax_input'][ $taxonomy ] ) ) { |
|
| 1329 | - $post['tax_input'][ $taxonomy ] = array(); |
|
| 1328 | + if ( ! isset( $post['tax_input'][$taxonomy] ) ) { |
|
| 1329 | + $post['tax_input'][$taxonomy] = array(); |
|
| 1330 | 1330 | } |
| 1331 | 1331 | |
| 1332 | - $post['tax_input'][ $taxonomy ][] = $name; |
|
| 1332 | + $post['tax_input'][$taxonomy][] = $name; |
|
| 1333 | 1333 | unset( $name ); |
| 1334 | 1334 | }//end foreach |
| 1335 | 1335 | } |
@@ -1473,7 +1473,7 @@ discard block |
||
| 1473 | 1473 | |
| 1474 | 1474 | $message = '<ul>'; |
| 1475 | 1475 | foreach ( $result as $type => $results ) { |
| 1476 | - if ( ! isset( $t_strings[ $type ] ) ) { |
|
| 1476 | + if ( ! isset( $t_strings[$type] ) ) { |
|
| 1477 | 1477 | // only print imported and updated |
| 1478 | 1478 | continue; |
| 1479 | 1479 | } |
@@ -1485,7 +1485,7 @@ discard block |
||
| 1485 | 1485 | } |
| 1486 | 1486 | |
| 1487 | 1487 | if ( ! empty( $s_message ) ) { |
| 1488 | - $message .= '<li><strong>' . $t_strings[ $type ] . ':</strong> '; |
|
| 1488 | + $message .= '<li><strong>' . $t_strings[$type] . ':</strong> '; |
|
| 1489 | 1489 | $message .= implode( ', ', $s_message ); |
| 1490 | 1490 | $message .= '</li>'; |
| 1491 | 1491 | } |
@@ -1537,8 +1537,8 @@ discard block |
||
| 1537 | 1537 | 'actions' => sprintf( _n( '%1$s Form Action', '%1$s Form Actions', $m, 'formidable' ), $m ), |
| 1538 | 1538 | ); |
| 1539 | 1539 | |
| 1540 | - if ( isset( $strings[ $type ] ) ) { |
|
| 1541 | - $s_message[] = $strings[ $type ]; |
|
| 1540 | + if ( isset( $strings[$type] ) ) { |
|
| 1541 | + $s_message[] = $strings[$type]; |
|
| 1542 | 1542 | } else { |
| 1543 | 1543 | $string = ' ' . $m . ' ' . ucfirst( $type ); |
| 1544 | 1544 | |
@@ -1693,7 +1693,7 @@ discard block |
||
| 1693 | 1693 | |
| 1694 | 1694 | foreach ( $options as $key => $option ) { |
| 1695 | 1695 | if ( is_array( $option ) && ! empty( $option['image'] ) ) { |
| 1696 | - $options[ $key ]['src'] = wp_get_attachment_url( $option['image'] ); |
|
| 1696 | + $options[$key]['src'] = wp_get_attachment_url( $option['image'] ); |
|
| 1697 | 1697 | $updated = true; |
| 1698 | 1698 | } |
| 1699 | 1699 | } |
@@ -1731,8 +1731,8 @@ discard block |
||
| 1731 | 1731 | */ |
| 1732 | 1732 | private static function remove_defaults( $defaults, &$saved ) { |
| 1733 | 1733 | foreach ( $saved as $key => $value ) { |
| 1734 | - if ( isset( $defaults[ $key ] ) && $defaults[ $key ] === $value ) { |
|
| 1735 | - unset( $saved[ $key ] ); |
|
| 1734 | + if ( isset( $defaults[$key] ) && $defaults[$key] === $value ) { |
|
| 1735 | + unset( $saved[$key] ); |
|
| 1736 | 1736 | } |
| 1737 | 1737 | } |
| 1738 | 1738 | } |
@@ -1749,14 +1749,14 @@ discard block |
||
| 1749 | 1749 | * @return void |
| 1750 | 1750 | */ |
| 1751 | 1751 | private static function remove_default_html( $html_name, $defaults, &$options ) { |
| 1752 | - if ( ! isset( $options[ $html_name ] ) || ! isset( $defaults[ $html_name ] ) ) { |
|
| 1752 | + if ( ! isset( $options[$html_name] ) || ! isset( $defaults[$html_name] ) ) { |
|
| 1753 | 1753 | return; |
| 1754 | 1754 | } |
| 1755 | 1755 | |
| 1756 | - $old_html = str_replace( "\r\n", "\n", $options[ $html_name ] ); |
|
| 1757 | - $default_html = $defaults[ $html_name ]; |
|
| 1756 | + $old_html = str_replace( "\r\n", "\n", $options[$html_name] ); |
|
| 1757 | + $default_html = $defaults[$html_name]; |
|
| 1758 | 1758 | if ( $old_html == $default_html ) { |
| 1759 | - unset( $options[ $html_name ] ); |
|
| 1759 | + unset( $options[$html_name] ); |
|
| 1760 | 1760 | |
| 1761 | 1761 | return; |
| 1762 | 1762 | } |
@@ -1764,7 +1764,7 @@ discard block |
||
| 1764 | 1764 | // Account for some of the older field default HTML. |
| 1765 | 1765 | $default_html = str_replace( ' id="frm_desc_field_[key]"', '', $default_html ); |
| 1766 | 1766 | if ( $old_html === $default_html ) { |
| 1767 | - unset( $options[ $html_name ] ); |
|
| 1767 | + unset( $options[$html_name] ); |
|
| 1768 | 1768 | } |
| 1769 | 1769 | } |
| 1770 | 1770 | |
@@ -1872,8 +1872,8 @@ discard block |
||
| 1872 | 1872 | ); |
| 1873 | 1873 | |
| 1874 | 1874 | foreach ( $post_settings as $post_setting ) { |
| 1875 | - if ( isset( $form_options[ $post_setting ] ) ) { |
|
| 1876 | - $new_action['post_content'][ $post_setting ] = $form_options[ $post_setting ]; |
|
| 1875 | + if ( isset( $form_options[$post_setting] ) ) { |
|
| 1876 | + $new_action['post_content'][$post_setting] = $form_options[$post_setting]; |
|
| 1877 | 1877 | } |
| 1878 | 1878 | unset( $post_setting ); |
| 1879 | 1879 | } |
@@ -1911,7 +1911,7 @@ discard block |
||
| 1911 | 1911 | if ( ! $exists ) { |
| 1912 | 1912 | // this isn't an email, but we need to use a class that will always be included |
| 1913 | 1913 | FrmDb::save_json_post( $new_action ); |
| 1914 | - ++$imported['imported']['actions']; |
|
| 1914 | + ++ $imported['imported']['actions']; |
|
| 1915 | 1915 | } |
| 1916 | 1916 | } |
| 1917 | 1917 | |
@@ -1944,11 +1944,11 @@ discard block |
||
| 1944 | 1944 | foreach ( $post_content as $key => $setting ) { |
| 1945 | 1945 | if ( ! is_array( $setting ) && in_array( $key, $basic_fields ) ) { |
| 1946 | 1946 | // Replace old IDs with new IDs |
| 1947 | - $post_content[ $key ] = str_replace( $old, $new, $setting ); |
|
| 1947 | + $post_content[$key] = str_replace( $old, $new, $setting ); |
|
| 1948 | 1948 | } elseif ( is_array( $setting ) && in_array( $key, $array_fields ) ) { |
| 1949 | 1949 | foreach ( $setting as $k => $val ) { |
| 1950 | 1950 | // Replace old IDs with new IDs |
| 1951 | - $post_content[ $key ][ $k ] = str_replace( $old, $new, $val ); |
|
| 1951 | + $post_content[$key][$k] = str_replace( $old, $new, $val ); |
|
| 1952 | 1952 | } |
| 1953 | 1953 | } |
| 1954 | 1954 | unset( $key, $setting ); |
@@ -2016,7 +2016,7 @@ discard block |
||
| 2016 | 2016 | |
| 2017 | 2017 | if ( empty( $exists ) ) { |
| 2018 | 2018 | FrmDb::save_json_post( $new_notification ); |
| 2019 | - ++$imported['imported']['actions']; |
|
| 2019 | + ++ $imported['imported']['actions']; |
|
| 2020 | 2020 | } |
| 2021 | 2021 | unset( $new_notification ); |
| 2022 | 2022 | }//end foreach |
@@ -2037,8 +2037,8 @@ discard block |
||
| 2037 | 2037 | private static function remove_deprecated_notification_settings( $form_id, $form_options ) { |
| 2038 | 2038 | $delete_settings = array( 'notification', 'autoresponder', 'email_to' ); |
| 2039 | 2039 | foreach ( $delete_settings as $index ) { |
| 2040 | - if ( isset( $form_options[ $index ] ) ) { |
|
| 2041 | - unset( $form_options[ $index ] ); |
|
| 2040 | + if ( isset( $form_options[$index] ) ) { |
|
| 2041 | + unset( $form_options[$index] ); |
|
| 2042 | 2042 | } |
| 2043 | 2043 | } |
| 2044 | 2044 | FrmForm::update( $form_id, array( 'options' => $form_options ) ); |
@@ -2108,12 +2108,12 @@ discard block |
||
| 2108 | 2108 | 'reply_to_name' => '', |
| 2109 | 2109 | ); |
| 2110 | 2110 | foreach ( $reply_fields as $f => $val ) { |
| 2111 | - if ( isset( $notification[ $f ] ) ) { |
|
| 2112 | - $atts[ $f ] = $notification[ $f ]; |
|
| 2113 | - if ( 'custom' == $notification[ $f ] ) { |
|
| 2114 | - $atts[ $f ] = $notification[ 'cust_' . $f ]; |
|
| 2115 | - } elseif ( is_numeric( $atts[ $f ] ) && ! empty( $atts[ $f ] ) ) { |
|
| 2116 | - $atts[ $f ] = '[' . $atts[ $f ] . ']'; |
|
| 2111 | + if ( isset( $notification[$f] ) ) { |
|
| 2112 | + $atts[$f] = $notification[$f]; |
|
| 2113 | + if ( 'custom' == $notification[$f] ) { |
|
| 2114 | + $atts[$f] = $notification['cust_' . $f]; |
|
| 2115 | + } elseif ( is_numeric( $atts[$f] ) && ! empty( $atts[$f] ) ) { |
|
| 2116 | + $atts[$f] = '[' . $atts[$f] . ']'; |
|
| 2117 | 2117 | } |
| 2118 | 2118 | } |
| 2119 | 2119 | unset( $f, $val ); |
@@ -2152,13 +2152,13 @@ discard block |
||
| 2152 | 2152 | foreach ( $atts['email_to'] as $key => $email_field ) { |
| 2153 | 2153 | |
| 2154 | 2154 | if ( is_numeric( $email_field ) ) { |
| 2155 | - $atts['email_to'][ $key ] = '[' . $email_field . ']'; |
|
| 2155 | + $atts['email_to'][$key] = '[' . $email_field . ']'; |
|
| 2156 | 2156 | } |
| 2157 | 2157 | |
| 2158 | 2158 | if ( strpos( $email_field, '|' ) ) { |
| 2159 | 2159 | $email_opt = explode( '|', $email_field ); |
| 2160 | 2160 | if ( isset( $email_opt[0] ) ) { |
| 2161 | - $atts['email_to'][ $key ] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']'; |
|
| 2161 | + $atts['email_to'][$key] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']'; |
|
| 2162 | 2162 | } |
| 2163 | 2163 | unset( $email_opt ); |
| 2164 | 2164 | } |
@@ -2188,12 +2188,12 @@ discard block |
||
| 2188 | 2188 | // Add more fields to the new notification |
| 2189 | 2189 | $add_fields = array( 'email_message', 'email_subject', 'plain_text', 'inc_user_info', 'conditions' ); |
| 2190 | 2190 | foreach ( $add_fields as $add_field ) { |
| 2191 | - if ( isset( $notification[ $add_field ] ) ) { |
|
| 2192 | - $new_notification['post_content'][ $add_field ] = $notification[ $add_field ]; |
|
| 2191 | + if ( isset( $notification[$add_field] ) ) { |
|
| 2192 | + $new_notification['post_content'][$add_field] = $notification[$add_field]; |
|
| 2193 | 2193 | } elseif ( in_array( $add_field, array( 'plain_text', 'inc_user_info' ) ) ) { |
| 2194 | - $new_notification['post_content'][ $add_field ] = 0; |
|
| 2194 | + $new_notification['post_content'][$add_field] = 0; |
|
| 2195 | 2195 | } else { |
| 2196 | - $new_notification['post_content'][ $add_field ] = ''; |
|
| 2196 | + $new_notification['post_content'][$add_field] = ''; |
|
| 2197 | 2197 | } |
| 2198 | 2198 | unset( $add_field ); |
| 2199 | 2199 | } |
@@ -2219,7 +2219,7 @@ discard block |
||
| 2219 | 2219 | if ( isset( $post_content['conditions'] ) && is_array( $post_content['conditions'] ) ) { |
| 2220 | 2220 | foreach ( $post_content['conditions'] as $email_key => $val ) { |
| 2221 | 2221 | if ( is_numeric( $email_key ) ) { |
| 2222 | - $post_content['conditions'][ $email_key ] = self::switch_action_field_ids( $val, array( 'hide_field' ) ); |
|
| 2222 | + $post_content['conditions'][$email_key] = self::switch_action_field_ids( $val, array( 'hide_field' ) ); |
|
| 2223 | 2223 | } |
| 2224 | 2224 | unset( $email_key, $val ); |
| 2225 | 2225 | } |
@@ -2823,7 +2823,6 @@ |
||
| 2823 | 2823 | |
| 2824 | 2824 | /** |
| 2825 | 2825 | * @since 3.0 |
| 2826 | - |
|
| 2827 | 2826 | * @param array $args |
| 2828 | 2827 | * @reutrn void |
| 2829 | 2828 | */ |