@@ -87,7 +87,8 @@ |
||
| 87 | 87 | |
| 88 | 88 | if ( ! isset( $imported['form_status'] ) || empty( $imported['form_status'] ) ) { |
| 89 | 89 | // Check for an error message in the XML. |
| 90 | - if ( isset( $xml->Code ) && isset( $xml->Message ) ) { // phpcs:ignore WordPress.NamingConventions |
|
| 90 | + if ( isset( $xml->Code ) && isset( $xml->Message ) ) { |
|
| 91 | +// phpcs:ignore WordPress.NamingConventions |
|
| 91 | 92 | $imported['error'] = (string) $xml->Message; // phpcs:ignore WordPress.NamingConventions |
| 92 | 93 | } |
| 93 | 94 | } |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | if ( $term && is_array( $term ) ) { |
| 142 | 142 | $imported['imported']['terms'] ++; |
| 143 | - $imported['terms'][ (int) $t->term_id ] = $term['term_id']; |
|
| 143 | + $imported['terms'][(int) $t->term_id] = $term['term_id']; |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | unset( $term, $t ); |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | // Keep track of whether this specific form was updated or not. |
| 199 | - $imported['form_status'][ $form_id ] = 'imported'; |
|
| 199 | + $imported['form_status'][$form_id] = 'imported'; |
|
| 200 | 200 | } |
| 201 | 201 | } |
| 202 | 202 | |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | // Update field ids/keys to new ones. |
| 212 | 212 | do_action( 'frm_after_duplicate_form', $form_id, $form, array( 'old_id' => $old_id ) ); |
| 213 | 213 | |
| 214 | - $imported['forms'][ (int) $item->id ] = $form_id; |
|
| 214 | + $imported['forms'][(int) $item->id] = $form_id; |
|
| 215 | 215 | |
| 216 | 216 | // Send pre 2.0 form options through function that creates actions. |
| 217 | 217 | self::migrate_form_settings_to_actions( $form['options'], $form_id, $imported, true ); |
@@ -279,15 +279,15 @@ discard block |
||
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | // Keep track of whether this specific form was updated or not |
| 282 | - $imported['form_status'][ $form_id ] = 'updated'; |
|
| 282 | + $imported['form_status'][$form_id] = 'updated'; |
|
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | private static function get_form_fields( $form_id ) { |
| 286 | 286 | $form_fields = FrmField::get_all_for_form( $form_id, '', 'exclude', 'exclude' ); |
| 287 | 287 | $old_fields = array(); |
| 288 | 288 | foreach ( $form_fields as $f ) { |
| 289 | - $old_fields[ $f->id ] = $f; |
|
| 290 | - $old_fields[ $f->field_key ] = $f->id; |
|
| 289 | + $old_fields[$f->id] = $f; |
|
| 290 | + $old_fields[$f->field_key] = $f->id; |
|
| 291 | 291 | unset( $f ); |
| 292 | 292 | } |
| 293 | 293 | $form_fields = $old_fields; |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | */ |
| 345 | 345 | private static function track_imported_child_forms( $form_id, $parent_form_id, &$child_forms ) { |
| 346 | 346 | if ( $parent_form_id ) { |
| 347 | - $child_forms[ $form_id ] = $parent_form_id; |
|
| 347 | + $child_forms[$form_id] = $parent_form_id; |
|
| 348 | 348 | } |
| 349 | 349 | } |
| 350 | 350 | |
@@ -359,9 +359,9 @@ discard block |
||
| 359 | 359 | */ |
| 360 | 360 | private static function maybe_update_child_form_parent_id( $imported_forms, $child_forms ) { |
| 361 | 361 | foreach ( $child_forms as $child_form_id => $old_parent_form_id ) { |
| 362 | - if ( isset( $imported_forms[ $old_parent_form_id ] ) && (int) $imported_forms[ $old_parent_form_id ] !== (int) $old_parent_form_id ) { |
|
| 362 | + if ( isset( $imported_forms[$old_parent_form_id] ) && (int) $imported_forms[$old_parent_form_id] !== (int) $old_parent_form_id ) { |
|
| 363 | 363 | // Update all children with this old parent_form_id |
| 364 | - $new_parent_form_id = (int) $imported_forms[ $old_parent_form_id ]; |
|
| 364 | + $new_parent_form_id = (int) $imported_forms[$old_parent_form_id]; |
|
| 365 | 365 | FrmForm::update( $child_form_id, array( 'parent_form_id' => $new_parent_form_id ) ); |
| 366 | 366 | do_action( 'frm_update_child_form_parent_id', $child_form_id, $new_parent_form_id ); |
| 367 | 367 | } |
@@ -391,27 +391,27 @@ discard block |
||
| 391 | 391 | |
| 392 | 392 | if ( ! empty( $this_form ) ) { |
| 393 | 393 | // check for field to edit by field id |
| 394 | - if ( isset( $form_fields[ $f['id'] ] ) ) { |
|
| 394 | + if ( isset( $form_fields[$f['id']] ) ) { |
|
| 395 | 395 | FrmField::update( $f['id'], $f ); |
| 396 | 396 | $imported['updated']['fields'] ++; |
| 397 | 397 | |
| 398 | - unset( $form_fields[ $f['id'] ] ); |
|
| 398 | + unset( $form_fields[$f['id']] ); |
|
| 399 | 399 | |
| 400 | 400 | //unset old field key |
| 401 | - if ( isset( $form_fields[ $f['field_key'] ] ) ) { |
|
| 402 | - unset( $form_fields[ $f['field_key'] ] ); |
|
| 401 | + if ( isset( $form_fields[$f['field_key']] ) ) { |
|
| 402 | + unset( $form_fields[$f['field_key']] ); |
|
| 403 | 403 | } |
| 404 | - } elseif ( isset( $form_fields[ $f['field_key'] ] ) ) { |
|
| 405 | - $keys_by_original_field_id[ $f['id'] ] = $f['field_key']; |
|
| 404 | + } elseif ( isset( $form_fields[$f['field_key']] ) ) { |
|
| 405 | + $keys_by_original_field_id[$f['id']] = $f['field_key']; |
|
| 406 | 406 | |
| 407 | 407 | // check for field to edit by field key |
| 408 | 408 | unset( $f['id'] ); |
| 409 | 409 | |
| 410 | - FrmField::update( $form_fields[ $f['field_key'] ], $f ); |
|
| 410 | + FrmField::update( $form_fields[$f['field_key']], $f ); |
|
| 411 | 411 | $imported['updated']['fields'] ++; |
| 412 | 412 | |
| 413 | - unset( $form_fields[ $form_fields[ $f['field_key'] ] ] ); //unset old field id |
|
| 414 | - unset( $form_fields[ $f['field_key'] ] ); //unset old field key |
|
| 413 | + unset( $form_fields[$form_fields[$f['field_key']]] ); //unset old field id |
|
| 414 | + unset( $form_fields[$f['field_key']] ); //unset old field key |
|
| 415 | 415 | } else { |
| 416 | 416 | // if no matching field id or key in this form, create the field |
| 417 | 417 | self::create_imported_field( $f, $imported ); |
@@ -520,8 +520,8 @@ discard block |
||
| 520 | 520 | if ( $f['type'] == 'form' || ( $f['type'] == 'divider' && FrmField::is_option_true( $f['field_options'], 'repeat' ) ) ) { |
| 521 | 521 | if ( FrmField::is_option_true( $f['field_options'], 'form_select' ) ) { |
| 522 | 522 | $form_select = (int) $f['field_options']['form_select']; |
| 523 | - if ( isset( $imported['forms'][ $form_select ] ) ) { |
|
| 524 | - $f['field_options']['form_select'] = $imported['forms'][ $form_select ]; |
|
| 523 | + if ( isset( $imported['forms'][$form_select] ) ) { |
|
| 524 | + $f['field_options']['form_select'] = $imported['forms'][$form_select]; |
|
| 525 | 525 | } |
| 526 | 526 | } |
| 527 | 527 | } |
@@ -542,8 +542,8 @@ discard block |
||
| 542 | 542 | |
| 543 | 543 | if ( FrmField::is_option_true_in_array( $f['field_options'], 'get_values_form' ) ) { |
| 544 | 544 | $old_form = $f['field_options']['get_values_form']; |
| 545 | - if ( isset( $imported['forms'][ $old_form ] ) ) { |
|
| 546 | - $f['field_options']['get_values_form'] = $imported['forms'][ $old_form ]; |
|
| 545 | + if ( isset( $imported['forms'][$old_form] ) ) { |
|
| 546 | + $f['field_options']['get_values_form'] = $imported['forms'][$old_form]; |
|
| 547 | 547 | } |
| 548 | 548 | } |
| 549 | 549 | } |
@@ -564,12 +564,12 @@ discard block |
||
| 564 | 564 | private static function migrate_placeholders( &$f ) { |
| 565 | 565 | $update_values = self::migrate_field_placeholder( $f, 'clear_on_focus' ); |
| 566 | 566 | foreach ( $update_values as $k => $v ) { |
| 567 | - $f[ $k ] = $v; |
|
| 567 | + $f[$k] = $v; |
|
| 568 | 568 | } |
| 569 | 569 | |
| 570 | 570 | $update_values = self::migrate_field_placeholder( $f, 'default_blank' ); |
| 571 | 571 | foreach ( $update_values as $k => $v ) { |
| 572 | - $f[ $k ] = $v; |
|
| 572 | + $f[$k] = $v; |
|
| 573 | 573 | } |
| 574 | 574 | } |
| 575 | 575 | |
@@ -583,7 +583,7 @@ discard block |
||
| 583 | 583 | public static function migrate_field_placeholder( $field, $type ) { |
| 584 | 584 | $field = (array) $field; |
| 585 | 585 | $field_options = $field['field_options']; |
| 586 | - if ( empty( $field_options[ $type ] ) || empty( $field['default_value'] ) ) { |
|
| 586 | + if ( empty( $field_options[$type] ) || empty( $field['default_value'] ) ) { |
|
| 587 | 587 | return array(); |
| 588 | 588 | } |
| 589 | 589 | |
@@ -609,7 +609,7 @@ discard block |
||
| 609 | 609 | } |
| 610 | 610 | |
| 611 | 611 | if ( $opt == $default_value ) { |
| 612 | - unset( $options[ $opt_key ] ); |
|
| 612 | + unset( $options[$opt_key] ); |
|
| 613 | 613 | break; |
| 614 | 614 | } |
| 615 | 615 | } |
@@ -664,10 +664,10 @@ discard block |
||
| 664 | 664 | $field_object->type = 'file'; // Fake the file type as FrmProImport::import_attachment checks for file type. |
| 665 | 665 | |
| 666 | 666 | $image_id = FrmProFileImport::import_attachment( $option['src'], $field_object ); |
| 667 | - unset( $field['options'][ $key ]['src'] ); // Remove the src from options as it isn't required after import. |
|
| 667 | + unset( $field['options'][$key]['src'] ); // Remove the src from options as it isn't required after import. |
|
| 668 | 668 | |
| 669 | 669 | if ( is_numeric( $image_id ) ) { |
| 670 | - $field['options'][ $key ]['image'] = $image_id; |
|
| 670 | + $field['options'][$key]['image'] = $image_id; |
|
| 671 | 671 | } |
| 672 | 672 | } |
| 673 | 673 | |
@@ -837,8 +837,8 @@ discard block |
||
| 837 | 837 | } else { |
| 838 | 838 | if ( $post['post_type'] === 'frm_display' ) { |
| 839 | 839 | $post['post_content'] = self::maybe_prepare_json_view_content( $post['post_content'] ); |
| 840 | - } elseif ( 'page' === $post['post_type'] && isset( $imported['posts'][ $post['post_parent'] ] ) ) { |
|
| 841 | - $post['post_parent'] = $imported['posts'][ $post['post_parent'] ]; |
|
| 840 | + } elseif ( 'page' === $post['post_type'] && isset( $imported['posts'][$post['post_parent']] ) ) { |
|
| 841 | + $post['post_parent'] = $imported['posts'][$post['post_parent']]; |
|
| 842 | 842 | } |
| 843 | 843 | // Create/update post now |
| 844 | 844 | $post_id = wp_insert_post( $post ); |
@@ -849,27 +849,27 @@ discard block |
||
| 849 | 849 | } |
| 850 | 850 | |
| 851 | 851 | if ( false !== strpos( $post['post_content'], '[display-frm-data' ) || false !== strpos( $post['post_content'], '[formidable' ) ) { |
| 852 | - $posts_with_shortcodes[ $post_id ] = $post; |
|
| 852 | + $posts_with_shortcodes[$post_id] = $post; |
|
| 853 | 853 | } |
| 854 | 854 | |
| 855 | 855 | self::update_postmeta( $post, $post_id ); |
| 856 | 856 | self::update_layout( $post, $post_id ); |
| 857 | 857 | |
| 858 | 858 | $this_type = 'posts'; |
| 859 | - if ( isset( $post_types[ $post['post_type'] ] ) ) { |
|
| 860 | - $this_type = $post_types[ $post['post_type'] ]; |
|
| 859 | + if ( isset( $post_types[$post['post_type']] ) ) { |
|
| 860 | + $this_type = $post_types[$post['post_type']]; |
|
| 861 | 861 | } |
| 862 | 862 | |
| 863 | 863 | if ( isset( $post['ID'] ) && $post_id == $post['ID'] ) { |
| 864 | - $imported['updated'][ $this_type ] ++; |
|
| 864 | + $imported['updated'][$this_type] ++; |
|
| 865 | 865 | } else { |
| 866 | - $imported['imported'][ $this_type ] ++; |
|
| 866 | + $imported['imported'][$this_type] ++; |
|
| 867 | 867 | } |
| 868 | 868 | |
| 869 | - $imported['posts'][ (int) $old_id ] = $post_id; |
|
| 869 | + $imported['posts'][(int) $old_id] = $post_id; |
|
| 870 | 870 | |
| 871 | 871 | if ( $post['post_type'] === 'frm_display' ) { |
| 872 | - $view_ids[ (int) $old_id ] = $post_id; |
|
| 872 | + $view_ids[(int) $old_id] = $post_id; |
|
| 873 | 873 | } |
| 874 | 874 | |
| 875 | 875 | do_action( 'frm_after_import_view', $post_id, $post ); |
@@ -996,9 +996,9 @@ discard block |
||
| 996 | 996 | $post['attachment_url'] = (string) $item->attachment_url; |
| 997 | 997 | } |
| 998 | 998 | |
| 999 | - if ( $post['post_type'] == FrmFormActionsController::$action_post_type && isset( $imported['forms'][ (int) $post['menu_order'] ] ) ) { |
|
| 999 | + if ( $post['post_type'] == FrmFormActionsController::$action_post_type && isset( $imported['forms'][(int) $post['menu_order']] ) ) { |
|
| 1000 | 1000 | // update to new form id |
| 1001 | - $post['menu_order'] = $imported['forms'][ (int) $post['menu_order'] ]; |
|
| 1001 | + $post['menu_order'] = $imported['forms'][(int) $post['menu_order']]; |
|
| 1002 | 1002 | } |
| 1003 | 1003 | |
| 1004 | 1004 | // Don't allow default styles to take over a site's default style |
@@ -1035,8 +1035,8 @@ discard block |
||
| 1035 | 1035 | ); |
| 1036 | 1036 | |
| 1037 | 1037 | //switch old form and field ids to new ones |
| 1038 | - if ( 'frm_form_id' === $m['key'] && isset( $imported['forms'][ (int) $m['value'] ] ) ) { |
|
| 1039 | - $m['value'] = $imported['forms'][ (int) $m['value'] ]; |
|
| 1038 | + if ( 'frm_form_id' === $m['key'] && isset( $imported['forms'][(int) $m['value']] ) ) { |
|
| 1039 | + $m['value'] = $imported['forms'][(int) $m['value']]; |
|
| 1040 | 1040 | } else { |
| 1041 | 1041 | $m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] ); |
| 1042 | 1042 | |
@@ -1047,15 +1047,15 @@ discard block |
||
| 1047 | 1047 | } elseif ( 'frm_options' === $m['key'] ) { |
| 1048 | 1048 | |
| 1049 | 1049 | foreach ( array( 'date_field_id', 'edate_field_id' ) as $setting_name ) { |
| 1050 | - if ( isset( $m['value'][ $setting_name ] ) && is_numeric( $m['value'][ $setting_name ] ) && isset( $frm_duplicate_ids[ $m['value'][ $setting_name ] ] ) ) { |
|
| 1051 | - $m['value'][ $setting_name ] = $frm_duplicate_ids[ $m['value'][ $setting_name ] ]; |
|
| 1050 | + if ( isset( $m['value'][$setting_name] ) && is_numeric( $m['value'][$setting_name] ) && isset( $frm_duplicate_ids[$m['value'][$setting_name]] ) ) { |
|
| 1051 | + $m['value'][$setting_name] = $frm_duplicate_ids[$m['value'][$setting_name]]; |
|
| 1052 | 1052 | } |
| 1053 | 1053 | } |
| 1054 | 1054 | |
| 1055 | 1055 | $check_dup_array = array(); |
| 1056 | 1056 | if ( isset( $m['value']['order_by'] ) && ! empty( $m['value']['order_by'] ) ) { |
| 1057 | - if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[ $m['value']['order_by'] ] ) ) { |
|
| 1058 | - $m['value']['order_by'] = $frm_duplicate_ids[ $m['value']['order_by'] ]; |
|
| 1057 | + if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[$m['value']['order_by']] ) ) { |
|
| 1058 | + $m['value']['order_by'] = $frm_duplicate_ids[$m['value']['order_by']]; |
|
| 1059 | 1059 | } elseif ( is_array( $m['value']['order_by'] ) ) { |
| 1060 | 1060 | $check_dup_array[] = 'order_by'; |
| 1061 | 1061 | } |
@@ -1066,9 +1066,9 @@ discard block |
||
| 1066 | 1066 | } |
| 1067 | 1067 | |
| 1068 | 1068 | foreach ( $check_dup_array as $check_k ) { |
| 1069 | - foreach ( (array) $m['value'][ $check_k ] as $mk => $mv ) { |
|
| 1070 | - if ( isset( $frm_duplicate_ids[ $mv ] ) ) { |
|
| 1071 | - $m['value'][ $check_k ][ $mk ] = $frm_duplicate_ids[ $mv ]; |
|
| 1069 | + foreach ( (array) $m['value'][$check_k] as $mk => $mv ) { |
|
| 1070 | + if ( isset( $frm_duplicate_ids[$mv] ) ) { |
|
| 1071 | + $m['value'][$check_k][$mk] = $frm_duplicate_ids[$mv]; |
|
| 1072 | 1072 | } |
| 1073 | 1073 | unset( $mk, $mv ); |
| 1074 | 1074 | } |
@@ -1081,11 +1081,11 @@ discard block |
||
| 1081 | 1081 | $m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] ); |
| 1082 | 1082 | } |
| 1083 | 1083 | |
| 1084 | - $post['postmeta'][ (string) $meta->meta_key ] = $m['value']; |
|
| 1084 | + $post['postmeta'][(string) $meta->meta_key] = $m['value']; |
|
| 1085 | 1085 | } |
| 1086 | 1086 | |
| 1087 | 1087 | private static function populate_layout( &$post, $layout ) { |
| 1088 | - $post['layout'][ (string) $layout->type ] = (string) $layout->data; |
|
| 1088 | + $post['layout'][(string) $layout->type] = (string) $layout->data; |
|
| 1089 | 1089 | } |
| 1090 | 1090 | |
| 1091 | 1091 | /** |
@@ -1113,11 +1113,11 @@ discard block |
||
| 1113 | 1113 | $name = (string) $c; |
| 1114 | 1114 | } |
| 1115 | 1115 | |
| 1116 | - if ( ! isset( $post['tax_input'][ $taxonomy ] ) ) { |
|
| 1117 | - $post['tax_input'][ $taxonomy ] = array(); |
|
| 1116 | + if ( ! isset( $post['tax_input'][$taxonomy] ) ) { |
|
| 1117 | + $post['tax_input'][$taxonomy] = array(); |
|
| 1118 | 1118 | } |
| 1119 | 1119 | |
| 1120 | - $post['tax_input'][ $taxonomy ][] = $name; |
|
| 1120 | + $post['tax_input'][$taxonomy][] = $name; |
|
| 1121 | 1121 | unset( $name ); |
| 1122 | 1122 | } |
| 1123 | 1123 | } |
@@ -1250,7 +1250,7 @@ discard block |
||
| 1250 | 1250 | |
| 1251 | 1251 | $message = '<ul>'; |
| 1252 | 1252 | foreach ( $result as $type => $results ) { |
| 1253 | - if ( ! isset( $t_strings[ $type ] ) ) { |
|
| 1253 | + if ( ! isset( $t_strings[$type] ) ) { |
|
| 1254 | 1254 | // only print imported and updated |
| 1255 | 1255 | continue; |
| 1256 | 1256 | } |
@@ -1262,7 +1262,7 @@ discard block |
||
| 1262 | 1262 | } |
| 1263 | 1263 | |
| 1264 | 1264 | if ( ! empty( $s_message ) ) { |
| 1265 | - $message .= '<li><strong>' . $t_strings[ $type ] . ':</strong> '; |
|
| 1265 | + $message .= '<li><strong>' . $t_strings[$type] . ':</strong> '; |
|
| 1266 | 1266 | $message .= implode( ', ', $s_message ); |
| 1267 | 1267 | $message .= '</li>'; |
| 1268 | 1268 | } |
@@ -1314,8 +1314,8 @@ discard block |
||
| 1314 | 1314 | 'actions' => sprintf( _n( '%1$s Form Action', '%1$s Form Actions', $m, 'formidable' ), $m ), |
| 1315 | 1315 | ); |
| 1316 | 1316 | |
| 1317 | - if ( isset( $strings[ $type ] ) ) { |
|
| 1318 | - $s_message[] = $strings[ $type ]; |
|
| 1317 | + if ( isset( $strings[$type] ) ) { |
|
| 1318 | + $s_message[] = $strings[$type]; |
|
| 1319 | 1319 | } else { |
| 1320 | 1320 | $string = ' ' . $m . ' ' . ucfirst( $type ); |
| 1321 | 1321 | |
@@ -1463,7 +1463,7 @@ discard block |
||
| 1463 | 1463 | |
| 1464 | 1464 | foreach ( $options as $key => $option ) { |
| 1465 | 1465 | if ( is_array( $option ) && ! empty( $option['image'] ) ) { |
| 1466 | - $options[ $key ]['src'] = wp_get_attachment_url( $option['image'] ); |
|
| 1466 | + $options[$key]['src'] = wp_get_attachment_url( $option['image'] ); |
|
| 1467 | 1467 | $updated = true; |
| 1468 | 1468 | } |
| 1469 | 1469 | } |
@@ -1492,8 +1492,8 @@ discard block |
||
| 1492 | 1492 | */ |
| 1493 | 1493 | private static function remove_defaults( $defaults, &$saved ) { |
| 1494 | 1494 | foreach ( $saved as $key => $value ) { |
| 1495 | - if ( isset( $defaults[ $key ] ) && $defaults[ $key ] === $value ) { |
|
| 1496 | - unset( $saved[ $key ] ); |
|
| 1495 | + if ( isset( $defaults[$key] ) && $defaults[$key] === $value ) { |
|
| 1496 | + unset( $saved[$key] ); |
|
| 1497 | 1497 | } |
| 1498 | 1498 | } |
| 1499 | 1499 | } |
@@ -1504,14 +1504,14 @@ discard block |
||
| 1504 | 1504 | * @since 3.06 |
| 1505 | 1505 | */ |
| 1506 | 1506 | private static function remove_default_html( $html_name, $defaults, &$options ) { |
| 1507 | - if ( ! isset( $options[ $html_name ] ) || ! isset( $defaults[ $html_name ] ) ) { |
|
| 1507 | + if ( ! isset( $options[$html_name] ) || ! isset( $defaults[$html_name] ) ) { |
|
| 1508 | 1508 | return; |
| 1509 | 1509 | } |
| 1510 | 1510 | |
| 1511 | - $old_html = str_replace( "\r\n", "\n", $options[ $html_name ] ); |
|
| 1512 | - $default_html = $defaults[ $html_name ]; |
|
| 1511 | + $old_html = str_replace( "\r\n", "\n", $options[$html_name] ); |
|
| 1512 | + $default_html = $defaults[$html_name]; |
|
| 1513 | 1513 | if ( $old_html == $default_html ) { |
| 1514 | - unset( $options[ $html_name ] ); |
|
| 1514 | + unset( $options[$html_name] ); |
|
| 1515 | 1515 | |
| 1516 | 1516 | return; |
| 1517 | 1517 | } |
@@ -1519,7 +1519,7 @@ discard block |
||
| 1519 | 1519 | // Account for some of the older field default HTML. |
| 1520 | 1520 | $default_html = str_replace( ' id="frm_desc_field_[key]"', '', $default_html ); |
| 1521 | 1521 | if ( $old_html == $default_html ) { |
| 1522 | - unset( $options[ $html_name ] ); |
|
| 1522 | + unset( $options[$html_name] ); |
|
| 1523 | 1523 | } |
| 1524 | 1524 | } |
| 1525 | 1525 | |
@@ -1606,8 +1606,8 @@ discard block |
||
| 1606 | 1606 | ); |
| 1607 | 1607 | |
| 1608 | 1608 | foreach ( $post_settings as $post_setting ) { |
| 1609 | - if ( isset( $form_options[ $post_setting ] ) ) { |
|
| 1610 | - $new_action['post_content'][ $post_setting ] = $form_options[ $post_setting ]; |
|
| 1609 | + if ( isset( $form_options[$post_setting] ) ) { |
|
| 1610 | + $new_action['post_content'][$post_setting] = $form_options[$post_setting]; |
|
| 1611 | 1611 | } |
| 1612 | 1612 | unset( $post_setting ); |
| 1613 | 1613 | } |
@@ -1678,11 +1678,11 @@ discard block |
||
| 1678 | 1678 | foreach ( $post_content as $key => $setting ) { |
| 1679 | 1679 | if ( ! is_array( $setting ) && in_array( $key, $basic_fields ) ) { |
| 1680 | 1680 | // Replace old IDs with new IDs |
| 1681 | - $post_content[ $key ] = str_replace( $old, $new, $setting ); |
|
| 1681 | + $post_content[$key] = str_replace( $old, $new, $setting ); |
|
| 1682 | 1682 | } elseif ( is_array( $setting ) && in_array( $key, $array_fields ) ) { |
| 1683 | 1683 | foreach ( $setting as $k => $val ) { |
| 1684 | 1684 | // Replace old IDs with new IDs |
| 1685 | - $post_content[ $key ][ $k ] = str_replace( $old, $new, $val ); |
|
| 1685 | + $post_content[$key][$k] = str_replace( $old, $new, $val ); |
|
| 1686 | 1686 | } |
| 1687 | 1687 | } |
| 1688 | 1688 | unset( $key, $setting ); |
@@ -1758,8 +1758,8 @@ discard block |
||
| 1758 | 1758 | private static function remove_deprecated_notification_settings( $form_id, $form_options ) { |
| 1759 | 1759 | $delete_settings = array( 'notification', 'autoresponder', 'email_to' ); |
| 1760 | 1760 | foreach ( $delete_settings as $index ) { |
| 1761 | - if ( isset( $form_options[ $index ] ) ) { |
|
| 1762 | - unset( $form_options[ $index ] ); |
|
| 1761 | + if ( isset( $form_options[$index] ) ) { |
|
| 1762 | + unset( $form_options[$index] ); |
|
| 1763 | 1763 | } |
| 1764 | 1764 | } |
| 1765 | 1765 | FrmForm::update( $form_id, array( 'options' => $form_options ) ); |
@@ -1812,12 +1812,12 @@ discard block |
||
| 1812 | 1812 | 'reply_to_name' => '', |
| 1813 | 1813 | ); |
| 1814 | 1814 | foreach ( $reply_fields as $f => $val ) { |
| 1815 | - if ( isset( $notification[ $f ] ) ) { |
|
| 1816 | - $atts[ $f ] = $notification[ $f ]; |
|
| 1817 | - if ( 'custom' == $notification[ $f ] ) { |
|
| 1818 | - $atts[ $f ] = $notification[ 'cust_' . $f ]; |
|
| 1819 | - } elseif ( is_numeric( $atts[ $f ] ) && ! empty( $atts[ $f ] ) ) { |
|
| 1820 | - $atts[ $f ] = '[' . $atts[ $f ] . ']'; |
|
| 1815 | + if ( isset( $notification[$f] ) ) { |
|
| 1816 | + $atts[$f] = $notification[$f]; |
|
| 1817 | + if ( 'custom' == $notification[$f] ) { |
|
| 1818 | + $atts[$f] = $notification['cust_' . $f]; |
|
| 1819 | + } elseif ( is_numeric( $atts[$f] ) && ! empty( $atts[$f] ) ) { |
|
| 1820 | + $atts[$f] = '[' . $atts[$f] . ']'; |
|
| 1821 | 1821 | } |
| 1822 | 1822 | } |
| 1823 | 1823 | unset( $f, $val ); |
@@ -1848,13 +1848,13 @@ discard block |
||
| 1848 | 1848 | foreach ( $atts['email_to'] as $key => $email_field ) { |
| 1849 | 1849 | |
| 1850 | 1850 | if ( is_numeric( $email_field ) ) { |
| 1851 | - $atts['email_to'][ $key ] = '[' . $email_field . ']'; |
|
| 1851 | + $atts['email_to'][$key] = '[' . $email_field . ']'; |
|
| 1852 | 1852 | } |
| 1853 | 1853 | |
| 1854 | 1854 | if ( strpos( $email_field, '|' ) ) { |
| 1855 | 1855 | $email_opt = explode( '|', $email_field ); |
| 1856 | 1856 | if ( isset( $email_opt[0] ) ) { |
| 1857 | - $atts['email_to'][ $key ] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']'; |
|
| 1857 | + $atts['email_to'][$key] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']'; |
|
| 1858 | 1858 | } |
| 1859 | 1859 | unset( $email_opt ); |
| 1860 | 1860 | } |
@@ -1875,12 +1875,12 @@ discard block |
||
| 1875 | 1875 | // Add more fields to the new notification |
| 1876 | 1876 | $add_fields = array( 'email_message', 'email_subject', 'plain_text', 'inc_user_info', 'conditions' ); |
| 1877 | 1877 | foreach ( $add_fields as $add_field ) { |
| 1878 | - if ( isset( $notification[ $add_field ] ) ) { |
|
| 1879 | - $new_notification['post_content'][ $add_field ] = $notification[ $add_field ]; |
|
| 1878 | + if ( isset( $notification[$add_field] ) ) { |
|
| 1879 | + $new_notification['post_content'][$add_field] = $notification[$add_field]; |
|
| 1880 | 1880 | } elseif ( in_array( $add_field, array( 'plain_text', 'inc_user_info' ) ) ) { |
| 1881 | - $new_notification['post_content'][ $add_field ] = 0; |
|
| 1881 | + $new_notification['post_content'][$add_field] = 0; |
|
| 1882 | 1882 | } else { |
| 1883 | - $new_notification['post_content'][ $add_field ] = ''; |
|
| 1883 | + $new_notification['post_content'][$add_field] = ''; |
|
| 1884 | 1884 | } |
| 1885 | 1885 | unset( $add_field ); |
| 1886 | 1886 | } |
@@ -1904,7 +1904,7 @@ discard block |
||
| 1904 | 1904 | if ( isset( $post_content['conditions'] ) && is_array( $post_content['conditions'] ) ) { |
| 1905 | 1905 | foreach ( $post_content['conditions'] as $email_key => $val ) { |
| 1906 | 1906 | if ( is_numeric( $email_key ) ) { |
| 1907 | - $post_content['conditions'][ $email_key ] = self::switch_action_field_ids( $val, array( 'hide_field' ) ); |
|
| 1907 | + $post_content['conditions'][$email_key] = self::switch_action_field_ids( $val, array( 'hide_field' ) ); |
|
| 1908 | 1908 | } |
| 1909 | 1909 | unset( $email_key, $val ); |
| 1910 | 1910 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | //validate the number format |
| 55 | 55 | if ( ! is_numeric( $args['value'] ) && '' !== $args['value'] ) { |
| 56 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' ); |
|
| 56 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' ); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | // validate number settings |
@@ -65,9 +65,9 @@ discard block |
||
| 65 | 65 | if ( $frm_settings->use_html && $maxnum !== '' && $minnum !== '' ) { |
| 66 | 66 | $value = (float) $args['value']; |
| 67 | 67 | if ( $value < $minnum ) { |
| 68 | - $errors[ 'field' . $args['id'] ] = __( 'Please select a higher number', 'formidable' ); |
|
| 68 | + $errors['field' . $args['id']] = __( 'Please select a higher number', 'formidable' ); |
|
| 69 | 69 | } elseif ( $value > $maxnum ) { |
| 70 | - $errors[ 'field' . $args['id'] ] = __( 'Please select a lower number', 'formidable' ); |
|
| 70 | + $errors['field' . $args['id']] = __( 'Please select a lower number', 'formidable' ); |
|
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * @param array $args Validation args. |
| 87 | 87 | */ |
| 88 | 88 | private function validate_step( &$errors, $args ) { |
| 89 | - if ( isset( $errors[ 'field' . $args['id'] ] ) ) { |
|
| 89 | + if ( isset( $errors['field' . $args['id']] ) ) { |
|
| 90 | 90 | return; // Don't need to check if value is invalid before. |
| 91 | 91 | } |
| 92 | 92 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | return; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - $errors[ 'field' . $args['id'] ] = sprintf( |
|
| 103 | + $errors['field' . $args['id']] = sprintf( |
|
| 104 | 104 | // Translators: %1$s: the first nearest value; %2$s: the second nearest value. |
| 105 | 105 | __( 'Please enter a valid value. Two nearest valid values are %1$s and %2$s', 'formidable' ), |
| 106 | 106 | floatval( $result[0] ), |
@@ -18,17 +18,17 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | foreach ( $type as $tb_type ) { |
| 20 | 20 | |
| 21 | - if ( ! isset( $tables[ $tb_type ] ) ) { |
|
| 21 | + if ( ! isset( $tables[$tb_type] ) ) { |
|
| 22 | 22 | do_action( 'frm_xml_import_' . $tb_type, $args ); |
| 23 | 23 | continue; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - if ( ! isset( $records[ $tb_type ] ) ) { |
|
| 26 | + if ( ! isset( $records[$tb_type] ) ) { |
|
| 27 | 27 | // No records. |
| 28 | 28 | continue; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - $item_ids = $records[ $tb_type ]; |
|
| 31 | + $item_ids = $records[$tb_type]; |
|
| 32 | 32 | |
| 33 | 33 | if ( in_array( $tb_type, array( 'styles', 'actions' ), true ) ) { |
| 34 | 34 | include dirname( __FILE__ ) . '/posts_xml.php'; |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | include FrmProAppHelper::plugin_path() . '/classes/views/xml/' . $tb_type . '_xml.php'; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - unset( $item_ids, $records[ $tb_type ], $tb_type ); |
|
| 41 | + unset( $item_ids, $records[$tb_type], $tb_type ); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | * |
| 39 | 39 | * @param array $keys |
| 40 | 40 | */ |
| 41 | - self::$keys = apply_filters( |
|
| 41 | + self::$keys = apply_filters( |
|
| 42 | 42 | 'frm_application_data_keys', |
| 43 | 43 | array( 'key', 'name', 'description', 'link', 'categories', 'views', 'forms' ) |
| 44 | 44 | ); |
@@ -100,17 +100,17 @@ discard block |
||
| 100 | 100 | public function as_js_object() { |
| 101 | 101 | $application = array(); |
| 102 | 102 | foreach ( self::$keys as $key ) { |
| 103 | - if ( ! isset( $this->api_data[ $key ] ) ) { |
|
| 103 | + if ( ! isset( $this->api_data[$key] ) ) { |
|
| 104 | 104 | continue; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - $value = $this->api_data[ $key ]; |
|
| 107 | + $value = $this->api_data[$key]; |
|
| 108 | 108 | |
| 109 | 109 | if ( 'icon' === $key ) { |
| 110 | 110 | // Icon is an array. The first array item is the image URL. |
| 111 | - $application[ $key ] = reset( $value ); |
|
| 111 | + $application[$key] = reset( $value ); |
|
| 112 | 112 | } elseif ( 'categories' === $key ) { |
| 113 | - $application[ $key ] = array_values( |
|
| 113 | + $application[$key] = array_values( |
|
| 114 | 114 | array_filter( |
| 115 | 115 | $value, |
| 116 | 116 | function( $category ) { |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | // Strip off the " Template" text at the end of the name as it takes up space. |
| 130 | 130 | $value = substr( $value, 0, -9 ); |
| 131 | 131 | } |
| 132 | - $application[ $key ] = $value; |
|
| 132 | + $application[$key] = $value; |
|
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | 135 | |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | $this->id = $new_instance['ID']; |
| 58 | 58 | // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 59 | 59 | if ( $id != $this->id || ! $_POST || ! isset( $_POST['frm_style_setting'] ) ) { |
| 60 | - $all_instances[ $number ] = $new_instance; |
|
| 60 | + $all_instances[$number] = $new_instance; |
|
| 61 | 61 | |
| 62 | 62 | // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 63 | 63 | if ( $new_instance['menu_order'] && $_POST && empty( $_POST['prev_menu_order'] ) && isset( $_POST['frm_style_setting']['menu_order'] ) ) { |
@@ -83,27 +83,27 @@ discard block |
||
| 83 | 83 | $default_settings = $this->get_defaults(); |
| 84 | 84 | |
| 85 | 85 | foreach ( $default_settings as $setting => $default ) { |
| 86 | - if ( ! isset( $new_instance['post_content'][ $setting ] ) ) { |
|
| 87 | - $new_instance['post_content'][ $setting ] = $default; |
|
| 86 | + if ( ! isset( $new_instance['post_content'][$setting] ) ) { |
|
| 87 | + $new_instance['post_content'][$setting] = $default; |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | if ( $this->is_color( $setting ) ) { |
| 91 | - $color_val = $new_instance['post_content'][ $setting ]; |
|
| 91 | + $color_val = $new_instance['post_content'][$setting]; |
|
| 92 | 92 | if ( $color_val !== '' && 0 === strpos( $color_val, 'rgb' ) ) { |
| 93 | 93 | // maybe sanitize if invalid rgba value is entered |
| 94 | 94 | $this->maybe_sanitize_rgba_value( $color_val ); |
| 95 | 95 | } |
| 96 | - $new_instance['post_content'][ $setting ] = str_replace( '#', '', $color_val ); |
|
| 96 | + $new_instance['post_content'][$setting] = str_replace( '#', '', $color_val ); |
|
| 97 | 97 | } elseif ( in_array( $setting, array( 'submit_style', 'important_style', 'auto_width' ) ) |
| 98 | - && ! isset( $new_instance['post_content'][ $setting ] ) |
|
| 98 | + && ! isset( $new_instance['post_content'][$setting] ) |
|
| 99 | 99 | ) { |
| 100 | - $new_instance['post_content'][ $setting ] = 0; |
|
| 100 | + $new_instance['post_content'][$setting] = 0; |
|
| 101 | 101 | } elseif ( $setting == 'font' ) { |
| 102 | - $new_instance['post_content'][ $setting ] = $this->force_balanced_quotation( $new_instance['post_content'][ $setting ] ); |
|
| 102 | + $new_instance['post_content'][$setting] = $this->force_balanced_quotation( $new_instance['post_content'][$setting] ); |
|
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - $all_instances[ $number ] = $new_instance; |
|
| 106 | + $all_instances[$number] = $new_instance; |
|
| 107 | 107 | |
| 108 | 108 | $action_ids[] = $this->save( $new_instance ); |
| 109 | 109 | |
@@ -215,10 +215,10 @@ discard block |
||
| 215 | 215 | $valid_keys = array_keys( $defaults ); |
| 216 | 216 | $sanitized_settings = array(); |
| 217 | 217 | foreach ( $valid_keys as $key ) { |
| 218 | - if ( isset( $settings[ $key ] ) ) { |
|
| 219 | - $sanitized_settings[ $key ] = sanitize_textarea_field( $settings[ $key ] ); |
|
| 218 | + if ( isset( $settings[$key] ) ) { |
|
| 219 | + $sanitized_settings[$key] = sanitize_textarea_field( $settings[$key] ); |
|
| 220 | 220 | } else { |
| 221 | - $sanitized_settings[ $key ] = $defaults[ $key ]; |
|
| 221 | + $sanitized_settings[$key] = $defaults[$key]; |
|
| 222 | 222 | } |
| 223 | 223 | } |
| 224 | 224 | return $sanitized_settings; |
@@ -385,13 +385,13 @@ discard block |
||
| 385 | 385 | $style->post_content = $this->override_defaults( $style->post_content ); |
| 386 | 386 | $style->post_content = wp_parse_args( $style->post_content, $default_values ); |
| 387 | 387 | |
| 388 | - $styles[ $style->ID ] = $style; |
|
| 388 | + $styles[$style->ID] = $style; |
|
| 389 | 389 | } |
| 390 | 390 | |
| 391 | 391 | if ( ! $default_style ) { |
| 392 | 392 | $default_style = reset( $styles ); |
| 393 | 393 | |
| 394 | - $styles[ $default_style->ID ]->menu_order = 1; |
|
| 394 | + $styles[$default_style->ID]->menu_order = 1; |
|
| 395 | 395 | } |
| 396 | 396 | |
| 397 | 397 | return $styles; |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | if ( $new_val !== $value ) { |
| 212 | - $new_values[ $key ] = $new_val; |
|
| 212 | + $new_values[$key] = $new_val; |
|
| 213 | 213 | } |
| 214 | 214 | } |
| 215 | 215 | |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | |
| 241 | 241 | foreach ( $values as $value_key => $value ) { |
| 242 | 242 | if ( $value_key && in_array( $value_key, $form_fields ) ) { |
| 243 | - $new_values[ $value_key ] = $value; |
|
| 243 | + $new_values[$value_key] = $value; |
|
| 244 | 244 | } |
| 245 | 245 | } |
| 246 | 246 | |
@@ -328,15 +328,15 @@ discard block |
||
| 328 | 328 | $existing_keys = array_keys( $values['item_meta'] ); |
| 329 | 329 | foreach ( $all_fields as $fid ) { |
| 330 | 330 | if ( ! in_array( $fid->id, $existing_keys ) && ( isset( $values['frm_fields_submitted'] ) && in_array( $fid->id, $values['frm_fields_submitted'] ) ) || isset( $values['options'] ) ) { |
| 331 | - $values['item_meta'][ $fid->id ] = ''; |
|
| 331 | + $values['item_meta'][$fid->id] = ''; |
|
| 332 | 332 | } |
| 333 | - $field_array[ $fid->id ] = $fid; |
|
| 333 | + $field_array[$fid->id] = $fid; |
|
| 334 | 334 | } |
| 335 | 335 | unset( $all_fields ); |
| 336 | 336 | |
| 337 | 337 | foreach ( $values['item_meta'] as $field_id => $default_value ) { |
| 338 | - if ( isset( $field_array[ $field_id ] ) ) { |
|
| 339 | - $field = $field_array[ $field_id ]; |
|
| 338 | + if ( isset( $field_array[$field_id] ) ) { |
|
| 339 | + $field = $field_array[$field_id]; |
|
| 340 | 340 | } else { |
| 341 | 341 | $field = FrmField::getOne( $field_id ); |
| 342 | 342 | } |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | continue; |
| 346 | 346 | } |
| 347 | 347 | |
| 348 | - $is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options'][ 'custom_html_' . $field_id ] ) ); |
|
| 348 | + $is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options']['custom_html_' . $field_id] ) ); |
|
| 349 | 349 | if ( $is_settings_page ) { |
| 350 | 350 | self::get_settings_page_html( $values, $field ); |
| 351 | 351 | |
@@ -360,15 +360,15 @@ discard block |
||
| 360 | 360 | $update_options = apply_filters( 'frm_field_options_to_update', $update_options ); |
| 361 | 361 | |
| 362 | 362 | foreach ( $update_options as $opt => $default ) { |
| 363 | - $field->field_options[ $opt ] = isset( $values['field_options'][ $opt . '_' . $field_id ] ) ? $values['field_options'][ $opt . '_' . $field_id ] : $default; |
|
| 364 | - self::sanitize_field_opt( $opt, $field->field_options[ $opt ] ); |
|
| 363 | + $field->field_options[$opt] = isset( $values['field_options'][$opt . '_' . $field_id] ) ? $values['field_options'][$opt . '_' . $field_id] : $default; |
|
| 364 | + self::sanitize_field_opt( $opt, $field->field_options[$opt] ); |
|
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | $field->field_options = apply_filters( 'frm_update_field_options', $field->field_options, $field, $values ); |
| 368 | 368 | |
| 369 | 369 | $new_field = array( |
| 370 | 370 | 'field_options' => $field->field_options, |
| 371 | - 'default_value' => isset( $values[ 'default_value_' . $field_id ] ) ? FrmAppHelper::maybe_json_encode( $values[ 'default_value_' . $field_id ] ) : '', |
|
| 371 | + 'default_value' => isset( $values['default_value_' . $field_id] ) ? FrmAppHelper::maybe_json_encode( $values['default_value_' . $field_id] ) : '', |
|
| 372 | 372 | ); |
| 373 | 373 | |
| 374 | 374 | self::prepare_field_update_values( $field, $values, $new_field ); |
@@ -430,11 +430,11 @@ discard block |
||
| 430 | 430 | * Updating the settings page |
| 431 | 431 | */ |
| 432 | 432 | private static function get_settings_page_html( $values, &$field ) { |
| 433 | - if ( isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ) { |
|
| 433 | + if ( isset( $values['field_options']['custom_html_' . $field->id] ) ) { |
|
| 434 | 434 | $prev_opts = array(); |
| 435 | 435 | $fallback_html = isset( $field->field_options['custom_html'] ) ? $field->field_options['custom_html'] : FrmFieldsHelper::get_default_html( $field->type ); |
| 436 | 436 | |
| 437 | - $field->field_options['custom_html'] = isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ? $values['field_options'][ 'custom_html_' . $field->id ] : $fallback_html; |
|
| 437 | + $field->field_options['custom_html'] = isset( $values['field_options']['custom_html_' . $field->id] ) ? $values['field_options']['custom_html_' . $field->id] : $fallback_html; |
|
| 438 | 438 | } elseif ( $field->type == 'hidden' || $field->type == 'user_id' ) { |
| 439 | 439 | $prev_opts = $field->field_options; |
| 440 | 440 | } |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | foreach ( $field_cols as $col => $default ) { |
| 461 | 461 | $default = ( $default === '' ) ? $field->{$col} : $default; |
| 462 | 462 | |
| 463 | - $new_field[ $col ] = isset( $values['field_options'][ $col . '_' . $field->id ] ) ? $values['field_options'][ $col . '_' . $field->id ] : $default; |
|
| 463 | + $new_field[$col] = isset( $values['field_options'][$col . '_' . $field->id] ) ? $values['field_options'][$col . '_' . $field->id] : $default; |
|
| 464 | 464 | } |
| 465 | 465 | |
| 466 | 466 | // Don't save the template option. |
@@ -874,8 +874,8 @@ discard block |
||
| 874 | 874 | self::maybe_get_form( $form ); |
| 875 | 875 | } |
| 876 | 876 | |
| 877 | - if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][ $form->id ] ) ) { |
|
| 878 | - return $frm_vars['form_params'][ $form->id ]; |
|
| 877 | + if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][$form->id] ) ) { |
|
| 878 | + return $frm_vars['form_params'][$form->id]; |
|
| 879 | 879 | } |
| 880 | 880 | |
| 881 | 881 | $action_var = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; // phpcs:ignore WordPress.Security.NonceVerification.Missing |
@@ -904,15 +904,15 @@ discard block |
||
| 904 | 904 | //if there are two forms on the same page, make sure not to submit both |
| 905 | 905 | foreach ( $default_values as $var => $default ) { |
| 906 | 906 | if ( $var == 'action' ) { |
| 907 | - $values[ $var ] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
| 907 | + $values[$var] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
| 908 | 908 | } else { |
| 909 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 909 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 910 | 910 | } |
| 911 | 911 | unset( $var, $default ); |
| 912 | 912 | } |
| 913 | 913 | } else { |
| 914 | 914 | foreach ( $default_values as $var => $default ) { |
| 915 | - $values[ $var ] = $default; |
|
| 915 | + $values[$var] = $default; |
|
| 916 | 916 | unset( $var, $default ); |
| 917 | 917 | } |
| 918 | 918 | } |
@@ -938,7 +938,7 @@ discard block |
||
| 938 | 938 | 'sdir' => '', |
| 939 | 939 | ); |
| 940 | 940 | foreach ( $defaults as $var => $default ) { |
| 941 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 941 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 942 | 942 | } |
| 943 | 943 | |
| 944 | 944 | return $values; |
@@ -966,7 +966,7 @@ discard block |
||
| 966 | 966 | 'keep_post' => '', |
| 967 | 967 | ); |
| 968 | 968 | foreach ( $defaults as $var => $default ) { |
| 969 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 969 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 970 | 970 | } |
| 971 | 971 | |
| 972 | 972 | return $values; |
@@ -1069,7 +1069,7 @@ discard block |
||
| 1069 | 1069 | $form = $atts['form']; |
| 1070 | 1070 | $default = isset( $atts['default'] ) ? $atts['default'] : ''; |
| 1071 | 1071 | |
| 1072 | - return isset( $form->options[ $atts['option'] ] ) ? $form->options[ $atts['option'] ] : $default; |
|
| 1072 | + return isset( $form->options[$atts['option']] ) ? $form->options[$atts['option']] : $default; |
|
| 1073 | 1073 | } |
| 1074 | 1074 | |
| 1075 | 1075 | /** |
@@ -132,8 +132,8 @@ discard block |
||
| 132 | 132 | $field_val = ''; |
| 133 | 133 | if ( is_object( $this->field ) ) { |
| 134 | 134 | $field_val = $this->field->{$column}; |
| 135 | - } elseif ( is_array( $this->field ) && isset( $this->field[ $column ] ) ) { |
|
| 136 | - $field_val = $this->field[ $column ]; |
|
| 135 | + } elseif ( is_array( $this->field ) && isset( $this->field[$column] ) ) { |
|
| 136 | + $field_val = $this->field[$column]; |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | return $field_val; |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | if ( is_object( $this->field ) ) { |
| 148 | 148 | $this->field->{$column} = $value; |
| 149 | 149 | } elseif ( is_array( $this->field ) ) { |
| 150 | - $this->field[ $column ] = $value; |
|
| 150 | + $this->field[$column] = $value; |
|
| 151 | 151 | } |
| 152 | 152 | } |
| 153 | 153 | |
@@ -469,7 +469,7 @@ discard block |
||
| 469 | 469 | printf( |
| 470 | 470 | /* translators: %s: Field type */ |
| 471 | 471 | esc_html__( '%s Options', 'formidable' ), |
| 472 | - esc_html( $all_field_types[ $args['display']['type'] ]['name'] ) |
|
| 472 | + esc_html( $all_field_types[$args['display']['type']]['name'] ) |
|
| 473 | 473 | ); |
| 474 | 474 | ?> |
| 475 | 475 | <i class="frm_icon_font frm_arrowdown6_icon"></i> |
@@ -592,8 +592,8 @@ discard block |
||
| 592 | 592 | $fields = FrmField::field_selection(); |
| 593 | 593 | $fields = array_merge( $fields, FrmField::pro_field_selection() ); |
| 594 | 594 | |
| 595 | - if ( isset( $fields[ $this->type ] ) ) { |
|
| 596 | - $name = is_array( $fields[ $this->type ] ) ? $fields[ $this->type ]['name'] : $fields[ $this->type ]; |
|
| 595 | + if ( isset( $fields[$this->type] ) ) { |
|
| 596 | + $name = is_array( $fields[$this->type] ) ? $fields[$this->type]['name'] : $fields[$this->type]; |
|
| 597 | 597 | } |
| 598 | 598 | |
| 599 | 599 | return $name; |
@@ -604,7 +604,7 @@ discard block |
||
| 604 | 604 | } |
| 605 | 605 | |
| 606 | 606 | public function get_default_field_options() { |
| 607 | - $opts = array( |
|
| 607 | + $opts = array( |
|
| 608 | 608 | 'size' => '', |
| 609 | 609 | 'max' => '', |
| 610 | 610 | 'label' => '', |
@@ -946,7 +946,7 @@ discard block |
||
| 946 | 946 | } |
| 947 | 947 | } else { |
| 948 | 948 | $args['save_array'] = $this->is_readonly_array(); |
| 949 | - $hidden .= $this->show_single_hidden( $selected_value, $args ); |
|
| 949 | + $hidden .= $this->show_single_hidden( $selected_value, $args ); |
|
| 950 | 950 | } |
| 951 | 951 | |
| 952 | 952 | return $hidden; |
@@ -955,7 +955,7 @@ discard block |
||
| 955 | 955 | protected function show_single_hidden( $selected, $args ) { |
| 956 | 956 | if ( $args['save_array'] ) { |
| 957 | 957 | $args['field_name'] .= '[]'; |
| 958 | - $id = ''; |
|
| 958 | + $id = ''; |
|
| 959 | 959 | } else { |
| 960 | 960 | $id = ' id="' . esc_attr( $args['html_id'] ) . '"'; |
| 961 | 961 | } |
@@ -971,8 +971,8 @@ discard block |
||
| 971 | 971 | $selected = $values['field_value']; |
| 972 | 972 | |
| 973 | 973 | if ( isset( $values['combo_name'] ) ) { |
| 974 | - $options = $options[ $values['combo_name'] ]; |
|
| 975 | - $selected = ( is_array( $selected ) && isset( $selected[ $values['combo_name'] ] ) ) ? $selected[ $values['combo_name'] ] : ''; |
|
| 974 | + $options = $options[$values['combo_name']]; |
|
| 975 | + $selected = ( is_array( $selected ) && isset( $selected[$values['combo_name']] ) ) ? $selected[$values['combo_name']] : ''; |
|
| 976 | 976 | } |
| 977 | 977 | |
| 978 | 978 | $input = $this->select_tag( $values ); |
@@ -1023,7 +1023,7 @@ discard block |
||
| 1023 | 1023 | } |
| 1024 | 1024 | |
| 1025 | 1025 | protected function fill_display_field_values( $args = array() ) { |
| 1026 | - $defaults = array( |
|
| 1026 | + $defaults = array( |
|
| 1027 | 1027 | 'field_name' => 'item_meta[' . $this->get_field_column( 'id' ) . ']', |
| 1028 | 1028 | 'field_id' => $this->get_field_column( 'id' ), |
| 1029 | 1029 | 'field_plus_id' => '', |
@@ -1074,7 +1074,7 @@ discard block |
||
| 1074 | 1074 | } |
| 1075 | 1075 | } |
| 1076 | 1076 | |
| 1077 | - if ( isset( $args['errors'][ 'field' . $args['field_id'] ] ) && ! $custom_error_fields ) { |
|
| 1077 | + if ( isset( $args['errors']['field' . $args['field_id']] ) && ! $custom_error_fields ) { |
|
| 1078 | 1078 | if ( $error_comes_first ) { |
| 1079 | 1079 | array_unshift( $describedby, 'frm_error_' . $args['html_id'] ); |
| 1080 | 1080 | } else { |
@@ -1149,11 +1149,11 @@ discard block |
||
| 1149 | 1149 | |
| 1150 | 1150 | $field_id = $this->get_field_column( 'id' ); |
| 1151 | 1151 | if ( ! array_key_exists( $field_id, $frm_validated_unique_values ) ) { |
| 1152 | - $frm_validated_unique_values[ $field_id ] = array(); |
|
| 1152 | + $frm_validated_unique_values[$field_id] = array(); |
|
| 1153 | 1153 | return false; |
| 1154 | 1154 | } |
| 1155 | 1155 | |
| 1156 | - $already_validated_this_value = in_array( $value, $frm_validated_unique_values[ $field_id ], true ); |
|
| 1156 | + $already_validated_this_value = in_array( $value, $frm_validated_unique_values[$field_id], true ); |
|
| 1157 | 1157 | return $already_validated_this_value; |
| 1158 | 1158 | } |
| 1159 | 1159 | |
@@ -1178,7 +1178,7 @@ discard block |
||
| 1178 | 1178 | private function value_validated_as_unique( $value ) { |
| 1179 | 1179 | global $frm_validated_unique_values; |
| 1180 | 1180 | $field_id = $this->get_field_column( 'id' ); |
| 1181 | - $frm_validated_unique_values[ $field_id ][] = $value; |
|
| 1181 | + $frm_validated_unique_values[$field_id][] = $value; |
|
| 1182 | 1182 | } |
| 1183 | 1183 | |
| 1184 | 1184 | public function get_value_to_save( $value, $atts ) { |
@@ -1210,8 +1210,8 @@ discard block |
||
| 1210 | 1210 | $value = $this->prepare_display_value( $value, $atts ); |
| 1211 | 1211 | |
| 1212 | 1212 | if ( is_array( $value ) ) { |
| 1213 | - if ( isset( $atts['show'] ) && $atts['show'] && isset( $value[ $atts['show'] ] ) ) { |
|
| 1214 | - $value = $value[ $atts['show'] ]; |
|
| 1213 | + if ( isset( $atts['show'] ) && $atts['show'] && isset( $value[$atts['show']] ) ) { |
|
| 1214 | + $value = $value[$atts['show']]; |
|
| 1215 | 1215 | } elseif ( ! isset( $atts['return_array'] ) || ! $atts['return_array'] ) { |
| 1216 | 1216 | $sep = isset( $atts['sep'] ) ? $atts['sep'] : ', '; |
| 1217 | 1217 | $value = implode( $sep, $value ); |
@@ -1280,8 +1280,8 @@ discard block |
||
| 1280 | 1280 | $saved_entries = $atts['ids']; |
| 1281 | 1281 | $new_value = array(); |
| 1282 | 1282 | foreach ( (array) $value as $old_child_id ) { |
| 1283 | - if ( isset( $saved_entries[ $old_child_id ] ) ) { |
|
| 1284 | - $new_value[] = $saved_entries[ $old_child_id ]; |
|
| 1283 | + if ( isset( $saved_entries[$old_child_id] ) ) { |
|
| 1284 | + $new_value[] = $saved_entries[$old_child_id]; |
|
| 1285 | 1285 | } |
| 1286 | 1286 | } |
| 1287 | 1287 | |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | $max_length = intval( FrmField::get_option( $this->field, 'max' ) ); |
| 35 | 35 | |
| 36 | 36 | if ( $max_length && strlen( $args['value'] ) > $max_length ) { |
| 37 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' ); |
|
| 37 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' ); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | return $errors; |
@@ -173,12 +173,12 @@ discard block |
||
| 173 | 173 | * @return array |
| 174 | 174 | */ |
| 175 | 175 | private function prepare_array_property( $index, $atts ) { |
| 176 | - if ( isset( $atts[ $index ] ) && ! empty( $atts[ $index ] ) ) { |
|
| 176 | + if ( isset( $atts[$index] ) && ! empty( $atts[$index] ) ) { |
|
| 177 | 177 | |
| 178 | - if ( is_array( $atts[ $index ] ) ) { |
|
| 179 | - $property = $atts[ $index ]; |
|
| 178 | + if ( is_array( $atts[$index] ) ) { |
|
| 179 | + $property = $atts[$index]; |
|
| 180 | 180 | } else { |
| 181 | - $property = explode( ',', $atts[ $index ] ); |
|
| 181 | + $property = explode( ',', $atts[$index] ); |
|
| 182 | 182 | } |
| 183 | 183 | } else { |
| 184 | 184 | $property = array(); |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | ); |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | - $ip = array( |
|
| 255 | + $ip = array( |
|
| 256 | 256 | 'label' => __( 'IP Address', 'formidable' ), |
| 257 | 257 | 'value' => $this->entry->ip, |
| 258 | 258 | ); |
@@ -330,6 +330,6 @@ discard block |
||
| 330 | 330 | * @param stdClass $field |
| 331 | 331 | */ |
| 332 | 332 | protected function add_field_values( $field ) { |
| 333 | - $this->field_values[ $field->id ] = new FrmFieldValue( $field, $this->entry ); |
|
| 333 | + $this->field_values[$field->id] = new FrmFieldValue( $field, $this->entry ); |
|
| 334 | 334 | } |
| 335 | 335 | } |