@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | return; |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - $selected_xml = isset( $form['xml'] ) && isset( $form['xml'][ $selected_form ] ) ? $form['xml'][ $selected_form ] : ''; |
|
| 166 | + $selected_xml = isset( $form['xml'] ) && isset( $form['xml'][$selected_form] ) ? $form['xml'][$selected_form] : ''; |
|
| 167 | 167 | if ( empty( $selected_xml ) || strpos( $selected_xml, 'http' ) !== 0 ) { |
| 168 | 168 | return; |
| 169 | 169 | } |
@@ -178,8 +178,8 @@ discard block |
||
| 178 | 178 | * @param string $value |
| 179 | 179 | */ |
| 180 | 180 | private static function get_selected_in_form( $form, $value = 'form' ) { |
| 181 | - if ( ! empty( $form ) && ! empty( $form[ $value ] ) ) { |
|
| 182 | - return $form[ $value ]; |
|
| 181 | + if ( ! empty( $form ) && ! empty( $form[$value] ) ) { |
|
| 182 | + return $form[$value]; |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | return ''; |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | if ( $for === 'view' ) { |
| 211 | - $item_key = is_array( $view_keys ) ? $view_keys[ $form_key ] : $view_keys; |
|
| 211 | + $item_key = is_array( $view_keys ) ? $view_keys[$form_key] : $view_keys; |
|
| 212 | 212 | $shortcode = '[display-frm-data id=%1$s filter=limited]'; |
| 213 | 213 | } elseif ( $for === 'form' ) { |
| 214 | 214 | $item_key = $form_key; |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | continue; |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | - $page_ids[ $for ] = wp_insert_post( |
|
| 226 | + $page_ids[$for] = wp_insert_post( |
|
| 227 | 227 | array( |
| 228 | 228 | 'post_title' => $name, |
| 229 | 229 | 'post_type' => 'page', |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.NonceVerification.Missing |
| 377 | 377 | $file_type = sanitize_option( 'upload_path', $_FILES['frm_import_file']['name'] ); |
| 378 | 378 | $file_type = strtolower( pathinfo( $file_type, PATHINFO_EXTENSION ) ); |
| 379 | - if ( 'xml' !== $file_type && isset( $export_format[ $file_type ] ) ) { |
|
| 379 | + if ( 'xml' !== $file_type && isset( $export_format[$file_type] ) ) { |
|
| 380 | 380 | // allow other file types to be imported |
| 381 | 381 | do_action( 'frm_before_import_' . $file_type ); |
| 382 | 382 | |
@@ -470,7 +470,7 @@ discard block |
||
| 470 | 470 | foreach ( $type as $tb_type ) { |
| 471 | 471 | $where = array(); |
| 472 | 472 | $join = ''; |
| 473 | - $table = $tables[ $tb_type ]; |
|
| 473 | + $table = $tables[$tb_type]; |
|
| 474 | 474 | |
| 475 | 475 | $select = $table . '.id'; |
| 476 | 476 | $query_vars = array(); |
@@ -485,7 +485,7 @@ discard block |
||
| 485 | 485 | $table . '.parent_form_id' => $args['ids'], |
| 486 | 486 | ); |
| 487 | 487 | } else { |
| 488 | - $where[ $table . '.status !' ] = 'draft'; |
|
| 488 | + $where[$table . '.status !'] = 'draft'; |
|
| 489 | 489 | } |
| 490 | 490 | break; |
| 491 | 491 | case 'actions': |
@@ -498,7 +498,7 @@ discard block |
||
| 498 | 498 | case 'items': |
| 499 | 499 | // $join = "INNER JOIN {$wpdb->prefix}frm_item_metas im ON ($table.id = im.item_id)"; |
| 500 | 500 | if ( $args['ids'] ) { |
| 501 | - $where[ $table . '.form_id' ] = $args['ids']; |
|
| 501 | + $where[$table . '.form_id'] = $args['ids']; |
|
| 502 | 502 | } |
| 503 | 503 | break; |
| 504 | 504 | case 'styles': |
@@ -539,7 +539,7 @@ discard block |
||
| 539 | 539 | } |
| 540 | 540 | }//end switch |
| 541 | 541 | |
| 542 | - $records[ $tb_type ] = FrmDb::get_col( $table . $join, $where, $select ); |
|
| 542 | + $records[$tb_type] = FrmDb::get_col( $table . $join, $where, $select ); |
|
| 543 | 543 | unset( $tb_type ); |
| 544 | 544 | }//end foreach |
| 545 | 545 | |
@@ -734,7 +734,7 @@ discard block |
||
| 734 | 734 | $no_export_fields = FrmField::no_save_fields(); |
| 735 | 735 | foreach ( $csv_fields as $k => $f ) { |
| 736 | 736 | if ( in_array( $f->type, $no_export_fields, true ) ) { |
| 737 | - unset( $csv_fields[ $k ] ); |
|
| 737 | + unset( $csv_fields[$k] ); |
|
| 738 | 738 | } |
| 739 | 739 | } |
| 740 | 740 | |
@@ -126,7 +126,8 @@ |
||
| 126 | 126 | |
| 127 | 127 | if ( empty( $imported['form_status'] ) ) { |
| 128 | 128 | // Check for an error message in the XML. |
| 129 | - if ( isset( $xml->Code ) && isset( $xml->Message ) ) { // phpcs:ignore WordPress.NamingConventions |
|
| 129 | + if ( isset( $xml->Code ) && isset( $xml->Message ) ) { |
|
| 130 | +// phpcs:ignore WordPress.NamingConventions |
|
| 130 | 131 | $imported['error'] = (string) $xml->Message; // phpcs:ignore WordPress.NamingConventions |
| 131 | 132 | } |
| 132 | 133 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | $content_before_channel_tag, |
| 93 | 93 | 1 |
| 94 | 94 | ); |
| 95 | - $xml_string = $content_before_channel_tag . substr( $xml_string, $channel_start_position ); |
|
| 95 | + $xml_string = $content_before_channel_tag . substr( $xml_string, $channel_start_position ); |
|
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | |
@@ -176,8 +176,8 @@ discard block |
||
| 176 | 176 | ); |
| 177 | 177 | |
| 178 | 178 | if ( $term && is_array( $term ) ) { |
| 179 | - ++$imported['imported']['terms']; |
|
| 180 | - $imported['terms'][ (int) $t->term_id ] = $term['term_id']; |
|
| 179 | + ++ $imported['imported']['terms']; |
|
| 180 | + $imported['terms'][(int) $t->term_id] = $term['term_id']; |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | unset( $term, $t ); |
@@ -229,11 +229,11 @@ discard block |
||
| 229 | 229 | if ( $form_id ) { |
| 230 | 230 | if ( empty( $form['parent_form_id'] ) ) { |
| 231 | 231 | // Don't include the repeater form in the imported count. |
| 232 | - ++$imported['imported']['forms']; |
|
| 232 | + ++ $imported['imported']['forms']; |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | // Keep track of whether this specific form was updated or not. |
| 236 | - $imported['form_status'][ $form_id ] = 'imported'; |
|
| 236 | + $imported['form_status'][$form_id] = 'imported'; |
|
| 237 | 237 | } |
| 238 | 238 | } |
| 239 | 239 | |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | // Update field ids/keys to new ones. |
| 249 | 249 | do_action( 'frm_after_duplicate_form', $form_id, $form, array( 'old_id' => $old_id ) ); |
| 250 | 250 | |
| 251 | - $imported['forms'][ (int) $item->id ] = $form_id; |
|
| 251 | + $imported['forms'][(int) $item->id] = $form_id; |
|
| 252 | 252 | |
| 253 | 253 | // Send pre 2.0 form options through function that creates actions. |
| 254 | 254 | self::migrate_form_settings_to_actions( $form['options'], $form_id, $imported, true ); |
@@ -318,19 +318,19 @@ discard block |
||
| 318 | 318 | FrmForm::update( $form_id, $form ); |
| 319 | 319 | if ( empty( $form['parent_form_id'] ) ) { |
| 320 | 320 | // Don't include the repeater form in the updated count. |
| 321 | - ++$imported['updated']['forms']; |
|
| 321 | + ++ $imported['updated']['forms']; |
|
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | // Keep track of whether this specific form was updated or not |
| 325 | - $imported['form_status'][ $form_id ] = 'updated'; |
|
| 325 | + $imported['form_status'][$form_id] = 'updated'; |
|
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | private static function get_form_fields( $form_id ) { |
| 329 | 329 | $form_fields = FrmField::get_all_for_form( $form_id, '', 'exclude', 'exclude' ); |
| 330 | 330 | $old_fields = array(); |
| 331 | 331 | foreach ( $form_fields as $f ) { |
| 332 | - $old_fields[ $f->id ] = $f; |
|
| 333 | - $old_fields[ $f->field_key ] = $f->id; |
|
| 332 | + $old_fields[$f->id] = $f; |
|
| 333 | + $old_fields[$f->field_key] = $f->id; |
|
| 334 | 334 | unset( $f ); |
| 335 | 335 | } |
| 336 | 336 | $form_fields = $old_fields; |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | */ |
| 388 | 388 | private static function track_imported_child_forms( $form_id, $parent_form_id, &$child_forms ) { |
| 389 | 389 | if ( $parent_form_id ) { |
| 390 | - $child_forms[ $form_id ] = $parent_form_id; |
|
| 390 | + $child_forms[$form_id] = $parent_form_id; |
|
| 391 | 391 | } |
| 392 | 392 | } |
| 393 | 393 | |
@@ -402,9 +402,9 @@ discard block |
||
| 402 | 402 | */ |
| 403 | 403 | private static function maybe_update_child_form_parent_id( $imported_forms, $child_forms ) { |
| 404 | 404 | foreach ( $child_forms as $child_form_id => $old_parent_form_id ) { |
| 405 | - if ( isset( $imported_forms[ $old_parent_form_id ] ) && (int) $imported_forms[ $old_parent_form_id ] !== (int) $old_parent_form_id ) { |
|
| 405 | + if ( isset( $imported_forms[$old_parent_form_id] ) && (int) $imported_forms[$old_parent_form_id] !== (int) $old_parent_form_id ) { |
|
| 406 | 406 | // Update all children with this old parent_form_id |
| 407 | - $new_parent_form_id = (int) $imported_forms[ $old_parent_form_id ]; |
|
| 407 | + $new_parent_form_id = (int) $imported_forms[$old_parent_form_id]; |
|
| 408 | 408 | FrmForm::update( $child_form_id, array( 'parent_form_id' => $new_parent_form_id ) ); |
| 409 | 409 | do_action( 'frm_update_child_form_parent_id', $child_form_id, $new_parent_form_id ); |
| 410 | 410 | } |
@@ -434,34 +434,34 @@ discard block |
||
| 434 | 434 | |
| 435 | 435 | if ( ! empty( $this_form ) ) { |
| 436 | 436 | // check for field to edit by field id |
| 437 | - if ( isset( $form_fields[ $f['id'] ] ) ) { |
|
| 437 | + if ( isset( $form_fields[$f['id']] ) ) { |
|
| 438 | 438 | FrmField::update( $f['id'], $f ); |
| 439 | - ++$imported['updated']['fields']; |
|
| 439 | + ++ $imported['updated']['fields']; |
|
| 440 | 440 | |
| 441 | - unset( $form_fields[ $f['id'] ] ); |
|
| 441 | + unset( $form_fields[$f['id']] ); |
|
| 442 | 442 | |
| 443 | 443 | // Unset old field key. |
| 444 | - if ( isset( $form_fields[ $f['field_key'] ] ) ) { |
|
| 445 | - unset( $form_fields[ $f['field_key'] ] ); |
|
| 444 | + if ( isset( $form_fields[$f['field_key']] ) ) { |
|
| 445 | + unset( $form_fields[$f['field_key']] ); |
|
| 446 | 446 | } |
| 447 | - } elseif ( isset( $form_fields[ $f['field_key'] ] ) ) { |
|
| 448 | - $keys_by_original_field_id[ $f['id'] ] = $f['field_key']; |
|
| 447 | + } elseif ( isset( $form_fields[$f['field_key']] ) ) { |
|
| 448 | + $keys_by_original_field_id[$f['id']] = $f['field_key']; |
|
| 449 | 449 | |
| 450 | 450 | $old_field_id = $f['id']; |
| 451 | 451 | |
| 452 | 452 | // check for field to edit by field key |
| 453 | 453 | unset( $f['id'] ); |
| 454 | 454 | |
| 455 | - FrmField::update( $form_fields[ $f['field_key'] ], $f ); |
|
| 456 | - ++$imported['updated']['fields']; |
|
| 455 | + FrmField::update( $form_fields[$f['field_key']], $f ); |
|
| 456 | + ++ $imported['updated']['fields']; |
|
| 457 | 457 | |
| 458 | 458 | self::do_after_field_imported_action( $f, $form_fields, $old_field_id ); |
| 459 | 459 | |
| 460 | 460 | // Unset old field id. |
| 461 | - unset( $form_fields[ $form_fields[ $f['field_key'] ] ] ); |
|
| 461 | + unset( $form_fields[$form_fields[$f['field_key']]] ); |
|
| 462 | 462 | |
| 463 | 463 | // Unset old field key. |
| 464 | - unset( $form_fields[ $f['field_key'] ] ); |
|
| 464 | + unset( $form_fields[$f['field_key']] ); |
|
| 465 | 465 | } else { |
| 466 | 466 | // If no matching field id or key in this form, create the field. |
| 467 | 467 | self::create_imported_field( $f, $imported ); |
@@ -501,7 +501,7 @@ discard block |
||
| 501 | 501 | */ |
| 502 | 502 | private static function do_after_field_imported_action( $field_array, $form_fields, $old_field_id ) { |
| 503 | 503 | // Assign field array the update field's ID. |
| 504 | - $field_array['id'] = $form_fields[ $field_array['field_key'] ]; |
|
| 504 | + $field_array['id'] = $form_fields[$field_array['field_key']]; |
|
| 505 | 505 | |
| 506 | 506 | /** |
| 507 | 507 | * Fires when an existing field is imported. |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | * @param int $field_id |
| 513 | 513 | * @param int $old_field_id |
| 514 | 514 | */ |
| 515 | - do_action( 'frm_after_existing_field_is_imported', $field_array, $form_fields[ $field_array['field_key'] ], $old_field_id ); |
|
| 515 | + do_action( 'frm_after_existing_field_is_imported', $field_array, $form_fields[$field_array['field_key']], $old_field_id ); |
|
| 516 | 516 | } |
| 517 | 517 | |
| 518 | 518 | private static function fill_field( $field, $form_id ) { |
@@ -608,8 +608,8 @@ discard block |
||
| 608 | 608 | if ( $f['type'] === 'form' || ( $f['type'] === 'divider' && FrmField::is_option_true( $f['field_options'], 'repeat' ) ) ) { |
| 609 | 609 | if ( FrmField::is_option_true( $f['field_options'], 'form_select' ) ) { |
| 610 | 610 | $form_select = (int) $f['field_options']['form_select']; |
| 611 | - if ( isset( $imported['forms'][ $form_select ] ) ) { |
|
| 612 | - $f['field_options']['form_select'] = $imported['forms'][ $form_select ]; |
|
| 611 | + if ( isset( $imported['forms'][$form_select] ) ) { |
|
| 612 | + $f['field_options']['form_select'] = $imported['forms'][$form_select]; |
|
| 613 | 613 | } |
| 614 | 614 | } |
| 615 | 615 | } |
@@ -630,8 +630,8 @@ discard block |
||
| 630 | 630 | |
| 631 | 631 | if ( FrmField::is_option_true_in_array( $f['field_options'], 'get_values_form' ) ) { |
| 632 | 632 | $old_form = $f['field_options']['get_values_form']; |
| 633 | - if ( isset( $imported['forms'][ $old_form ] ) ) { |
|
| 634 | - $f['field_options']['get_values_form'] = $imported['forms'][ $old_form ]; |
|
| 633 | + if ( isset( $imported['forms'][$old_form] ) ) { |
|
| 634 | + $f['field_options']['get_values_form'] = $imported['forms'][$old_form]; |
|
| 635 | 635 | } |
| 636 | 636 | } |
| 637 | 637 | } |
@@ -652,12 +652,12 @@ discard block |
||
| 652 | 652 | private static function migrate_placeholders( &$f ) { |
| 653 | 653 | $update_values = self::migrate_field_placeholder( $f, 'clear_on_focus' ); |
| 654 | 654 | foreach ( $update_values as $k => $v ) { |
| 655 | - $f[ $k ] = $v; |
|
| 655 | + $f[$k] = $v; |
|
| 656 | 656 | } |
| 657 | 657 | |
| 658 | 658 | $update_values = self::migrate_field_placeholder( $f, 'default_blank' ); |
| 659 | 659 | foreach ( $update_values as $k => $v ) { |
| 660 | - $f[ $k ] = $v; |
|
| 660 | + $f[$k] = $v; |
|
| 661 | 661 | } |
| 662 | 662 | } |
| 663 | 663 | |
@@ -671,7 +671,7 @@ discard block |
||
| 671 | 671 | public static function migrate_field_placeholder( $field, $type ) { |
| 672 | 672 | $field = (array) $field; |
| 673 | 673 | $field_options = $field['field_options']; |
| 674 | - if ( empty( $field_options[ $type ] ) || empty( $field['default_value'] ) ) { |
|
| 674 | + if ( empty( $field_options[$type] ) || empty( $field['default_value'] ) ) { |
|
| 675 | 675 | return array(); |
| 676 | 676 | } |
| 677 | 677 | |
@@ -697,7 +697,7 @@ discard block |
||
| 697 | 697 | } |
| 698 | 698 | |
| 699 | 699 | if ( $opt == $default_value ) { |
| 700 | - unset( $options[ $opt_key ] ); |
|
| 700 | + unset( $options[$opt_key] ); |
|
| 701 | 701 | break; |
| 702 | 702 | } |
| 703 | 703 | } |
@@ -724,7 +724,7 @@ discard block |
||
| 724 | 724 | |
| 725 | 725 | $new_id = FrmField::create( $f ); |
| 726 | 726 | if ( $new_id != false ) { |
| 727 | - ++$imported['imported']['fields']; |
|
| 727 | + ++ $imported['imported']['fields']; |
|
| 728 | 728 | do_action( 'frm_after_field_is_imported', $f, $new_id ); |
| 729 | 729 | } |
| 730 | 730 | } |
@@ -753,10 +753,10 @@ discard block |
||
| 753 | 753 | |
| 754 | 754 | $image_id = FrmProFileImport::import_attachment( $option['src'], $field_object ); |
| 755 | 755 | // Remove the src from options as it isn't required after import. |
| 756 | - unset( $field['options'][ $key ]['src'] ); |
|
| 756 | + unset( $field['options'][$key]['src'] ); |
|
| 757 | 757 | |
| 758 | 758 | if ( is_numeric( $image_id ) ) { |
| 759 | - $field['options'][ $key ]['image'] = $image_id; |
|
| 759 | + $field['options'][$key]['image'] = $image_id; |
|
| 760 | 760 | } |
| 761 | 761 | } |
| 762 | 762 | |
@@ -924,8 +924,8 @@ discard block |
||
| 924 | 924 | } else { |
| 925 | 925 | if ( $post['post_type'] === 'frm_display' ) { |
| 926 | 926 | $post['post_content'] = self::maybe_prepare_json_view_content( $post['post_content'] ); |
| 927 | - } elseif ( 'page' === $post['post_type'] && isset( $imported['posts'][ $post['post_parent'] ] ) ) { |
|
| 928 | - $post['post_parent'] = $imported['posts'][ $post['post_parent'] ]; |
|
| 927 | + } elseif ( 'page' === $post['post_type'] && isset( $imported['posts'][$post['post_parent']] ) ) { |
|
| 928 | + $post['post_parent'] = $imported['posts'][$post['post_parent']]; |
|
| 929 | 929 | } |
| 930 | 930 | // Create/update post now |
| 931 | 931 | $post_id = wp_insert_post( $post ); |
@@ -936,27 +936,27 @@ discard block |
||
| 936 | 936 | } |
| 937 | 937 | |
| 938 | 938 | if ( false !== strpos( $post['post_content'], '[display-frm-data' ) || false !== strpos( $post['post_content'], '[formidable' ) ) { |
| 939 | - $posts_with_shortcodes[ $post_id ] = $post; |
|
| 939 | + $posts_with_shortcodes[$post_id] = $post; |
|
| 940 | 940 | } |
| 941 | 941 | |
| 942 | 942 | self::update_postmeta( $post, $post_id ); |
| 943 | 943 | self::update_layout( $post, $post_id ); |
| 944 | 944 | |
| 945 | 945 | $this_type = 'posts'; |
| 946 | - if ( isset( $post_types[ $post['post_type'] ] ) ) { |
|
| 947 | - $this_type = $post_types[ $post['post_type'] ]; |
|
| 946 | + if ( isset( $post_types[$post['post_type']] ) ) { |
|
| 947 | + $this_type = $post_types[$post['post_type']]; |
|
| 948 | 948 | } |
| 949 | 949 | |
| 950 | 950 | if ( isset( $post['ID'] ) && $post_id == $post['ID'] ) { |
| 951 | - ++$imported['updated'][ $this_type ]; |
|
| 951 | + ++ $imported['updated'][$this_type]; |
|
| 952 | 952 | } else { |
| 953 | - ++$imported['imported'][ $this_type ]; |
|
| 953 | + ++ $imported['imported'][$this_type]; |
|
| 954 | 954 | } |
| 955 | 955 | |
| 956 | - $imported['posts'][ $old_id ] = $post_id; |
|
| 956 | + $imported['posts'][$old_id] = $post_id; |
|
| 957 | 957 | |
| 958 | 958 | if ( $post['post_type'] === 'frm_display' ) { |
| 959 | - $view_ids[ $old_id ] = $post_id; |
|
| 959 | + $view_ids[$old_id] = $post_id; |
|
| 960 | 960 | } |
| 961 | 961 | |
| 962 | 962 | do_action( 'frm_after_import_view', $post_id, $post ); |
@@ -1117,9 +1117,9 @@ discard block |
||
| 1117 | 1117 | $post['attachment_url'] = (string) $item->attachment_url; |
| 1118 | 1118 | } |
| 1119 | 1119 | |
| 1120 | - if ( $post['post_type'] == FrmFormActionsController::$action_post_type && isset( $imported['forms'][ (int) $post['menu_order'] ] ) ) { |
|
| 1120 | + if ( $post['post_type'] == FrmFormActionsController::$action_post_type && isset( $imported['forms'][(int) $post['menu_order']] ) ) { |
|
| 1121 | 1121 | // update to new form id |
| 1122 | - $post['menu_order'] = $imported['forms'][ (int) $post['menu_order'] ]; |
|
| 1122 | + $post['menu_order'] = $imported['forms'][(int) $post['menu_order']]; |
|
| 1123 | 1123 | } |
| 1124 | 1124 | |
| 1125 | 1125 | // Don't allow default styles to take over a site's default style |
@@ -1156,8 +1156,8 @@ discard block |
||
| 1156 | 1156 | ); |
| 1157 | 1157 | |
| 1158 | 1158 | // Switch old form and field ids to new ones. |
| 1159 | - if ( 'frm_form_id' === $m['key'] && isset( $imported['forms'][ (int) $m['value'] ] ) ) { |
|
| 1160 | - $m['value'] = $imported['forms'][ (int) $m['value'] ]; |
|
| 1159 | + if ( 'frm_form_id' === $m['key'] && isset( $imported['forms'][(int) $m['value']] ) ) { |
|
| 1160 | + $m['value'] = $imported['forms'][(int) $m['value']]; |
|
| 1161 | 1161 | } else { |
| 1162 | 1162 | $m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] ); |
| 1163 | 1163 | |
@@ -1168,15 +1168,15 @@ discard block |
||
| 1168 | 1168 | } elseif ( 'frm_options' === $m['key'] ) { |
| 1169 | 1169 | |
| 1170 | 1170 | foreach ( array( 'date_field_id', 'edate_field_id' ) as $setting_name ) { |
| 1171 | - if ( isset( $m['value'][ $setting_name ] ) && is_numeric( $m['value'][ $setting_name ] ) && isset( $frm_duplicate_ids[ $m['value'][ $setting_name ] ] ) ) { |
|
| 1172 | - $m['value'][ $setting_name ] = $frm_duplicate_ids[ $m['value'][ $setting_name ] ]; |
|
| 1171 | + if ( isset( $m['value'][$setting_name] ) && is_numeric( $m['value'][$setting_name] ) && isset( $frm_duplicate_ids[$m['value'][$setting_name]] ) ) { |
|
| 1172 | + $m['value'][$setting_name] = $frm_duplicate_ids[$m['value'][$setting_name]]; |
|
| 1173 | 1173 | } |
| 1174 | 1174 | } |
| 1175 | 1175 | |
| 1176 | 1176 | $check_dup_array = array(); |
| 1177 | 1177 | if ( ! empty( $m['value']['order_by'] ) ) { |
| 1178 | - if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[ $m['value']['order_by'] ] ) ) { |
|
| 1179 | - $m['value']['order_by'] = $frm_duplicate_ids[ $m['value']['order_by'] ]; |
|
| 1178 | + if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[$m['value']['order_by']] ) ) { |
|
| 1179 | + $m['value']['order_by'] = $frm_duplicate_ids[$m['value']['order_by']]; |
|
| 1180 | 1180 | } elseif ( is_array( $m['value']['order_by'] ) ) { |
| 1181 | 1181 | $check_dup_array[] = 'order_by'; |
| 1182 | 1182 | } |
@@ -1187,9 +1187,9 @@ discard block |
||
| 1187 | 1187 | } |
| 1188 | 1188 | |
| 1189 | 1189 | foreach ( $check_dup_array as $check_k ) { |
| 1190 | - foreach ( (array) $m['value'][ $check_k ] as $mk => $mv ) { |
|
| 1191 | - if ( isset( $frm_duplicate_ids[ $mv ] ) ) { |
|
| 1192 | - $m['value'][ $check_k ][ $mk ] = $frm_duplicate_ids[ $mv ]; |
|
| 1190 | + foreach ( (array) $m['value'][$check_k] as $mk => $mv ) { |
|
| 1191 | + if ( isset( $frm_duplicate_ids[$mv] ) ) { |
|
| 1192 | + $m['value'][$check_k][$mk] = $frm_duplicate_ids[$mv]; |
|
| 1193 | 1193 | } |
| 1194 | 1194 | unset( $mk, $mv ); |
| 1195 | 1195 | } |
@@ -1202,11 +1202,11 @@ discard block |
||
| 1202 | 1202 | $m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] ); |
| 1203 | 1203 | } |
| 1204 | 1204 | |
| 1205 | - $post['postmeta'][ (string) $meta->meta_key ] = $m['value']; |
|
| 1205 | + $post['postmeta'][(string) $meta->meta_key] = $m['value']; |
|
| 1206 | 1206 | } |
| 1207 | 1207 | |
| 1208 | 1208 | private static function populate_layout( &$post, $layout ) { |
| 1209 | - $post['layout'][ (string) $layout->type ] = (string) $layout->data; |
|
| 1209 | + $post['layout'][(string) $layout->type] = (string) $layout->data; |
|
| 1210 | 1210 | } |
| 1211 | 1211 | |
| 1212 | 1212 | /** |
@@ -1234,11 +1234,11 @@ discard block |
||
| 1234 | 1234 | $name = (string) $c; |
| 1235 | 1235 | } |
| 1236 | 1236 | |
| 1237 | - if ( ! isset( $post['tax_input'][ $taxonomy ] ) ) { |
|
| 1238 | - $post['tax_input'][ $taxonomy ] = array(); |
|
| 1237 | + if ( ! isset( $post['tax_input'][$taxonomy] ) ) { |
|
| 1238 | + $post['tax_input'][$taxonomy] = array(); |
|
| 1239 | 1239 | } |
| 1240 | 1240 | |
| 1241 | - $post['tax_input'][ $taxonomy ][] = $name; |
|
| 1241 | + $post['tax_input'][$taxonomy][] = $name; |
|
| 1242 | 1242 | unset( $name ); |
| 1243 | 1243 | }//end foreach |
| 1244 | 1244 | } |
@@ -1378,7 +1378,7 @@ discard block |
||
| 1378 | 1378 | |
| 1379 | 1379 | $message = '<ul>'; |
| 1380 | 1380 | foreach ( $result as $type => $results ) { |
| 1381 | - if ( ! isset( $t_strings[ $type ] ) ) { |
|
| 1381 | + if ( ! isset( $t_strings[$type] ) ) { |
|
| 1382 | 1382 | // only print imported and updated |
| 1383 | 1383 | continue; |
| 1384 | 1384 | } |
@@ -1390,7 +1390,7 @@ discard block |
||
| 1390 | 1390 | } |
| 1391 | 1391 | |
| 1392 | 1392 | if ( ! empty( $s_message ) ) { |
| 1393 | - $message .= '<li><strong>' . $t_strings[ $type ] . ':</strong> '; |
|
| 1393 | + $message .= '<li><strong>' . $t_strings[$type] . ':</strong> '; |
|
| 1394 | 1394 | $message .= implode( ', ', $s_message ); |
| 1395 | 1395 | $message .= '</li>'; |
| 1396 | 1396 | } |
@@ -1442,8 +1442,8 @@ discard block |
||
| 1442 | 1442 | 'actions' => sprintf( _n( '%1$s Form Action', '%1$s Form Actions', $m, 'formidable' ), $m ), |
| 1443 | 1443 | ); |
| 1444 | 1444 | |
| 1445 | - if ( isset( $strings[ $type ] ) ) { |
|
| 1446 | - $s_message[] = $strings[ $type ]; |
|
| 1445 | + if ( isset( $strings[$type] ) ) { |
|
| 1446 | + $s_message[] = $strings[$type]; |
|
| 1447 | 1447 | } else { |
| 1448 | 1448 | $string = ' ' . $m . ' ' . ucfirst( $type ); |
| 1449 | 1449 | |
@@ -1591,7 +1591,7 @@ discard block |
||
| 1591 | 1591 | |
| 1592 | 1592 | foreach ( $options as $key => $option ) { |
| 1593 | 1593 | if ( is_array( $option ) && ! empty( $option['image'] ) ) { |
| 1594 | - $options[ $key ]['src'] = wp_get_attachment_url( $option['image'] ); |
|
| 1594 | + $options[$key]['src'] = wp_get_attachment_url( $option['image'] ); |
|
| 1595 | 1595 | $updated = true; |
| 1596 | 1596 | } |
| 1597 | 1597 | } |
@@ -1620,8 +1620,8 @@ discard block |
||
| 1620 | 1620 | */ |
| 1621 | 1621 | private static function remove_defaults( $defaults, &$saved ) { |
| 1622 | 1622 | foreach ( $saved as $key => $value ) { |
| 1623 | - if ( isset( $defaults[ $key ] ) && $defaults[ $key ] === $value ) { |
|
| 1624 | - unset( $saved[ $key ] ); |
|
| 1623 | + if ( isset( $defaults[$key] ) && $defaults[$key] === $value ) { |
|
| 1624 | + unset( $saved[$key] ); |
|
| 1625 | 1625 | } |
| 1626 | 1626 | } |
| 1627 | 1627 | } |
@@ -1632,14 +1632,14 @@ discard block |
||
| 1632 | 1632 | * @since 3.06 |
| 1633 | 1633 | */ |
| 1634 | 1634 | private static function remove_default_html( $html_name, $defaults, &$options ) { |
| 1635 | - if ( ! isset( $options[ $html_name ] ) || ! isset( $defaults[ $html_name ] ) ) { |
|
| 1635 | + if ( ! isset( $options[$html_name] ) || ! isset( $defaults[$html_name] ) ) { |
|
| 1636 | 1636 | return; |
| 1637 | 1637 | } |
| 1638 | 1638 | |
| 1639 | - $old_html = str_replace( "\r\n", "\n", $options[ $html_name ] ); |
|
| 1640 | - $default_html = $defaults[ $html_name ]; |
|
| 1639 | + $old_html = str_replace( "\r\n", "\n", $options[$html_name] ); |
|
| 1640 | + $default_html = $defaults[$html_name]; |
|
| 1641 | 1641 | if ( $old_html == $default_html ) { |
| 1642 | - unset( $options[ $html_name ] ); |
|
| 1642 | + unset( $options[$html_name] ); |
|
| 1643 | 1643 | |
| 1644 | 1644 | return; |
| 1645 | 1645 | } |
@@ -1647,7 +1647,7 @@ discard block |
||
| 1647 | 1647 | // Account for some of the older field default HTML. |
| 1648 | 1648 | $default_html = str_replace( ' id="frm_desc_field_[key]"', '', $default_html ); |
| 1649 | 1649 | if ( $old_html == $default_html ) { |
| 1650 | - unset( $options[ $html_name ] ); |
|
| 1650 | + unset( $options[$html_name] ); |
|
| 1651 | 1651 | } |
| 1652 | 1652 | } |
| 1653 | 1653 | |
@@ -1738,8 +1738,8 @@ discard block |
||
| 1738 | 1738 | ); |
| 1739 | 1739 | |
| 1740 | 1740 | foreach ( $post_settings as $post_setting ) { |
| 1741 | - if ( isset( $form_options[ $post_setting ] ) ) { |
|
| 1742 | - $new_action['post_content'][ $post_setting ] = $form_options[ $post_setting ]; |
|
| 1741 | + if ( isset( $form_options[$post_setting] ) ) { |
|
| 1742 | + $new_action['post_content'][$post_setting] = $form_options[$post_setting]; |
|
| 1743 | 1743 | } |
| 1744 | 1744 | unset( $post_setting ); |
| 1745 | 1745 | } |
@@ -1777,7 +1777,7 @@ discard block |
||
| 1777 | 1777 | if ( ! $exists ) { |
| 1778 | 1778 | // this isn't an email, but we need to use a class that will always be included |
| 1779 | 1779 | FrmDb::save_json_post( $new_action ); |
| 1780 | - ++$imported['imported']['actions']; |
|
| 1780 | + ++ $imported['imported']['actions']; |
|
| 1781 | 1781 | } |
| 1782 | 1782 | } |
| 1783 | 1783 | |
@@ -1810,11 +1810,11 @@ discard block |
||
| 1810 | 1810 | foreach ( $post_content as $key => $setting ) { |
| 1811 | 1811 | if ( ! is_array( $setting ) && in_array( $key, $basic_fields ) ) { |
| 1812 | 1812 | // Replace old IDs with new IDs |
| 1813 | - $post_content[ $key ] = str_replace( $old, $new, $setting ); |
|
| 1813 | + $post_content[$key] = str_replace( $old, $new, $setting ); |
|
| 1814 | 1814 | } elseif ( is_array( $setting ) && in_array( $key, $array_fields ) ) { |
| 1815 | 1815 | foreach ( $setting as $k => $val ) { |
| 1816 | 1816 | // Replace old IDs with new IDs |
| 1817 | - $post_content[ $key ][ $k ] = str_replace( $old, $new, $val ); |
|
| 1817 | + $post_content[$key][$k] = str_replace( $old, $new, $val ); |
|
| 1818 | 1818 | } |
| 1819 | 1819 | } |
| 1820 | 1820 | unset( $key, $setting ); |
@@ -1871,7 +1871,7 @@ discard block |
||
| 1871 | 1871 | |
| 1872 | 1872 | if ( empty( $exists ) ) { |
| 1873 | 1873 | FrmDb::save_json_post( $new_notification ); |
| 1874 | - ++$imported['imported']['actions']; |
|
| 1874 | + ++ $imported['imported']['actions']; |
|
| 1875 | 1875 | } |
| 1876 | 1876 | unset( $new_notification ); |
| 1877 | 1877 | }//end foreach |
@@ -1890,8 +1890,8 @@ discard block |
||
| 1890 | 1890 | private static function remove_deprecated_notification_settings( $form_id, $form_options ) { |
| 1891 | 1891 | $delete_settings = array( 'notification', 'autoresponder', 'email_to' ); |
| 1892 | 1892 | foreach ( $delete_settings as $index ) { |
| 1893 | - if ( isset( $form_options[ $index ] ) ) { |
|
| 1894 | - unset( $form_options[ $index ] ); |
|
| 1893 | + if ( isset( $form_options[$index] ) ) { |
|
| 1894 | + unset( $form_options[$index] ); |
|
| 1895 | 1895 | } |
| 1896 | 1896 | } |
| 1897 | 1897 | FrmForm::update( $form_id, array( 'options' => $form_options ) ); |
@@ -1944,12 +1944,12 @@ discard block |
||
| 1944 | 1944 | 'reply_to_name' => '', |
| 1945 | 1945 | ); |
| 1946 | 1946 | foreach ( $reply_fields as $f => $val ) { |
| 1947 | - if ( isset( $notification[ $f ] ) ) { |
|
| 1948 | - $atts[ $f ] = $notification[ $f ]; |
|
| 1949 | - if ( 'custom' == $notification[ $f ] ) { |
|
| 1950 | - $atts[ $f ] = $notification[ 'cust_' . $f ]; |
|
| 1951 | - } elseif ( is_numeric( $atts[ $f ] ) && ! empty( $atts[ $f ] ) ) { |
|
| 1952 | - $atts[ $f ] = '[' . $atts[ $f ] . ']'; |
|
| 1947 | + if ( isset( $notification[$f] ) ) { |
|
| 1948 | + $atts[$f] = $notification[$f]; |
|
| 1949 | + if ( 'custom' == $notification[$f] ) { |
|
| 1950 | + $atts[$f] = $notification['cust_' . $f]; |
|
| 1951 | + } elseif ( is_numeric( $atts[$f] ) && ! empty( $atts[$f] ) ) { |
|
| 1952 | + $atts[$f] = '[' . $atts[$f] . ']'; |
|
| 1953 | 1953 | } |
| 1954 | 1954 | } |
| 1955 | 1955 | unset( $f, $val ); |
@@ -1980,13 +1980,13 @@ discard block |
||
| 1980 | 1980 | foreach ( $atts['email_to'] as $key => $email_field ) { |
| 1981 | 1981 | |
| 1982 | 1982 | if ( is_numeric( $email_field ) ) { |
| 1983 | - $atts['email_to'][ $key ] = '[' . $email_field . ']'; |
|
| 1983 | + $atts['email_to'][$key] = '[' . $email_field . ']'; |
|
| 1984 | 1984 | } |
| 1985 | 1985 | |
| 1986 | 1986 | if ( strpos( $email_field, '|' ) ) { |
| 1987 | 1987 | $email_opt = explode( '|', $email_field ); |
| 1988 | 1988 | if ( isset( $email_opt[0] ) ) { |
| 1989 | - $atts['email_to'][ $key ] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']'; |
|
| 1989 | + $atts['email_to'][$key] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']'; |
|
| 1990 | 1990 | } |
| 1991 | 1991 | unset( $email_opt ); |
| 1992 | 1992 | } |
@@ -2007,12 +2007,12 @@ discard block |
||
| 2007 | 2007 | // Add more fields to the new notification |
| 2008 | 2008 | $add_fields = array( 'email_message', 'email_subject', 'plain_text', 'inc_user_info', 'conditions' ); |
| 2009 | 2009 | foreach ( $add_fields as $add_field ) { |
| 2010 | - if ( isset( $notification[ $add_field ] ) ) { |
|
| 2011 | - $new_notification['post_content'][ $add_field ] = $notification[ $add_field ]; |
|
| 2010 | + if ( isset( $notification[$add_field] ) ) { |
|
| 2011 | + $new_notification['post_content'][$add_field] = $notification[$add_field]; |
|
| 2012 | 2012 | } elseif ( in_array( $add_field, array( 'plain_text', 'inc_user_info' ) ) ) { |
| 2013 | - $new_notification['post_content'][ $add_field ] = 0; |
|
| 2013 | + $new_notification['post_content'][$add_field] = 0; |
|
| 2014 | 2014 | } else { |
| 2015 | - $new_notification['post_content'][ $add_field ] = ''; |
|
| 2015 | + $new_notification['post_content'][$add_field] = ''; |
|
| 2016 | 2016 | } |
| 2017 | 2017 | unset( $add_field ); |
| 2018 | 2018 | } |
@@ -2036,7 +2036,7 @@ discard block |
||
| 2036 | 2036 | if ( isset( $post_content['conditions'] ) && is_array( $post_content['conditions'] ) ) { |
| 2037 | 2037 | foreach ( $post_content['conditions'] as $email_key => $val ) { |
| 2038 | 2038 | if ( is_numeric( $email_key ) ) { |
| 2039 | - $post_content['conditions'][ $email_key ] = self::switch_action_field_ids( $val, array( 'hide_field' ) ); |
|
| 2039 | + $post_content['conditions'][$email_key] = self::switch_action_field_ids( $val, array( 'hide_field' ) ); |
|
| 2040 | 2040 | } |
| 2041 | 2041 | unset( $email_key, $val ); |
| 2042 | 2042 | } |
@@ -177,12 +177,12 @@ discard block |
||
| 177 | 177 | * @return array |
| 178 | 178 | */ |
| 179 | 179 | private function prepare_array_property( $index, $atts ) { |
| 180 | - if ( ! empty( $atts[ $index ] ) ) { |
|
| 180 | + if ( ! empty( $atts[$index] ) ) { |
|
| 181 | 181 | |
| 182 | - if ( is_array( $atts[ $index ] ) ) { |
|
| 183 | - $property = $atts[ $index ]; |
|
| 182 | + if ( is_array( $atts[$index] ) ) { |
|
| 183 | + $property = $atts[$index]; |
|
| 184 | 184 | } else { |
| 185 | - $property = explode( ',', $atts[ $index ] ); |
|
| 185 | + $property = explode( ',', $atts[$index] ); |
|
| 186 | 186 | } |
| 187 | 187 | } else { |
| 188 | 188 | $property = array(); |
@@ -262,11 +262,11 @@ discard block |
||
| 262 | 262 | ); |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | - $ip = array( |
|
| 265 | + $ip = array( |
|
| 266 | 266 | 'label' => __( 'IP Address', 'formidable' ), |
| 267 | 267 | 'value' => $this->entry->ip, |
| 268 | 268 | ); |
| 269 | - $browser = array( |
|
| 269 | + $browser = array( |
|
| 270 | 270 | 'label' => __( 'User-Agent (Browser/OS)', 'formidable' ), |
| 271 | 271 | 'value' => isset( $entry_description['browser'] ) ? FrmEntriesHelper::get_browser( $entry_description['browser'] ) : '', |
| 272 | 272 | ); |
@@ -353,6 +353,6 @@ discard block |
||
| 353 | 353 | * @return void |
| 354 | 354 | */ |
| 355 | 355 | protected function add_field_values( $field ) { |
| 356 | - $this->field_values[ $field->id ] = new FrmFieldValue( $field, $this->entry ); |
|
| 356 | + $this->field_values[$field->id] = new FrmFieldValue( $field, $this->entry ); |
|
| 357 | 357 | } |
| 358 | 358 | } |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | |
| 235 | 235 | // This may occassionally skip one level/order e.g. after adding a |
| 236 | 236 | // list field, as field_order would already be prepared to be used. |
| 237 | - ++$field_order; |
|
| 237 | + ++ $field_order; |
|
| 238 | 238 | |
| 239 | 239 | if ( ! empty( $new_field['fields'] ) && is_array( $new_field['fields'] ) ) { |
| 240 | 240 | // we have (inner) fields to merge |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | |
| 273 | 273 | $order = 0; |
| 274 | 274 | foreach ( $fields as $field ) { |
| 275 | - ++$order; |
|
| 275 | + ++ $order; |
|
| 276 | 276 | $type = $this->get_field_type( $field ); |
| 277 | 277 | $new_type = $this->convert_field_type( $type, $field ); |
| 278 | 278 | if ( ! in_array( $new_type, $with_end ) && $new_type !== 'break' ) { |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | $sub['name'] = __( 'Section Buttons', 'formidable' ); |
| 303 | 303 | $subs = array( $sub ); |
| 304 | 304 | $this->insert_fields_in_array( $subs, $order, 0, $fields ); |
| 305 | - ++$order; |
|
| 305 | + ++ $order; |
|
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | /** |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | protected function create_fields( $form_id, &$form ) { |
| 400 | 400 | foreach ( $form['fields'] as $key => $new_field ) { |
| 401 | 401 | $new_field['form_id'] = $form_id; |
| 402 | - $form['fields'][ $key ]['id'] = FrmField::create( $new_field ); |
|
| 402 | + $form['fields'][$key]['id'] = FrmField::create( $new_field ); |
|
| 403 | 403 | } |
| 404 | 404 | } |
| 405 | 405 | |
@@ -433,9 +433,9 @@ discard block |
||
| 433 | 433 | } elseif ( $key === 'the_post_title' ) { |
| 434 | 434 | $new_action->post_content['post_title'] = $value; |
| 435 | 435 | } elseif ( is_string( $value ) ) { |
| 436 | - $new_action->post_content[ $key ] = $this->replace_smart_tags( $value, $form['fields'] ); |
|
| 436 | + $new_action->post_content[$key] = $this->replace_smart_tags( $value, $form['fields'] ); |
|
| 437 | 437 | } else { |
| 438 | - $new_action->post_content[ $key ] = $value; |
|
| 438 | + $new_action->post_content[$key] = $value; |
|
| 439 | 439 | } |
| 440 | 440 | } |
| 441 | 441 | |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | |
| 455 | 455 | $imported = $this->get_tracked_import(); |
| 456 | 456 | |
| 457 | - $imported[ $this->slug ][ $new_form_id ] = $source_id; |
|
| 457 | + $imported[$this->slug][$new_form_id] = $source_id; |
|
| 458 | 458 | |
| 459 | 459 | update_option( $this->tracking, $imported, false ); |
| 460 | 460 | } |
@@ -474,11 +474,11 @@ discard block |
||
| 474 | 474 | private function is_imported( $source_id ) { |
| 475 | 475 | $imported = $this->get_tracked_import(); |
| 476 | 476 | $new_form_id = 0; |
| 477 | - if ( ! isset( $imported[ $this->slug ] ) || ! in_array( $source_id, $imported[ $this->slug ] ) ) { |
|
| 477 | + if ( ! isset( $imported[$this->slug] ) || ! in_array( $source_id, $imported[$this->slug] ) ) { |
|
| 478 | 478 | return $new_form_id; |
| 479 | 479 | } |
| 480 | 480 | |
| 481 | - $new_form_id = array_search( $source_id, array_reverse( $imported[ $this->slug ], true ) ); |
|
| 481 | + $new_form_id = array_search( $source_id, array_reverse( $imported[$this->slug], true ) ); |
|
| 482 | 482 | if ( ! empty( $new_form_id ) && empty( FrmForm::get_key_by_id( $new_form_id ) ) ) { |
| 483 | 483 | // Allow reimport if the form was deleted. |
| 484 | 484 | $new_form_id = 0; |
@@ -89,12 +89,12 @@ |
||
| 89 | 89 | $string->skip_next_character(); |
| 90 | 90 | |
| 91 | 91 | $val = array(); |
| 92 | - for ( $i = 0; $i < $count; $i++ ) { |
|
| 92 | + for ( $i = 0; $i < $count; $i ++ ) { |
|
| 93 | 93 | $array_key = $this->do_parse( $string ); |
| 94 | 94 | $array_value = $this->do_parse( $string ); |
| 95 | 95 | |
| 96 | 96 | if ( ! is_array( $array_key ) ) { |
| 97 | - $val[ $array_key ] = $array_value; |
|
| 97 | + $val[$array_key] = $array_value; |
|
| 98 | 98 | } |
| 99 | 99 | } |
| 100 | 100 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | public function read_until( $char ) { |
| 52 | 52 | $value = ''; |
| 53 | - while ( $this->pos <= $this->max && ( $one = $this->string[ $this->pos++ ] ) !== $char ) { |
|
| 53 | + while ( $this->pos <= $this->max && ( $one = $this->string[$this->pos ++] ) !== $char ) { |
|
| 54 | 54 | $value .= $one; |
| 55 | 55 | } |
| 56 | 56 | return $value; |
@@ -67,10 +67,10 @@ discard block |
||
| 67 | 67 | public function read( $count ) { |
| 68 | 68 | $value = ''; |
| 69 | 69 | |
| 70 | - while ( $count > 0 && $this->pos <= $this->max && ( ( $one = $this->string[ $this->pos ] ) || '0' === $one ) ) { |
|
| 70 | + while ( $count > 0 && $this->pos <= $this->max && ( ( $one = $this->string[$this->pos] ) || '0' === $one ) ) { |
|
| 71 | 71 | $value .= $one; |
| 72 | 72 | $this->pos += 1; |
| 73 | - --$count; |
|
| 73 | + -- $count; |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | return; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - if ( isset( self::$messages[ $message['key'] ] ) && ! isset( $message['force'] ) ) { |
|
| 108 | + if ( isset( self::$messages[$message['key']] ) && ! isset( $message['force'] ) ) { |
|
| 109 | 109 | // Don't replace messages unless required. |
| 110 | 110 | return; |
| 111 | 111 | } |
@@ -114,13 +114,13 @@ discard block |
||
| 114 | 114 | return; |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - if ( isset( self::$messages[ $message['key'] ] ) ) { |
|
| 117 | + if ( isset( self::$messages[$message['key']] ) ) { |
|
| 118 | 118 | // Move up and mark as new. |
| 119 | - unset( self::$messages[ $message['key'] ] ); |
|
| 119 | + unset( self::$messages[$message['key']] ); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | $this->fill_message( $message ); |
| 123 | - self::$messages[ $message['key'] ] = $message; |
|
| 123 | + self::$messages[$message['key']] = $message; |
|
| 124 | 124 | |
| 125 | 125 | $this->update_list(); |
| 126 | 126 | |
@@ -157,11 +157,11 @@ discard block |
||
| 157 | 157 | private function clean_messages() { |
| 158 | 158 | $removed = false; |
| 159 | 159 | foreach ( self::$messages as $t => $message ) { |
| 160 | - $read = ! empty( $message['read'] ) && isset( $message['read'][ get_current_user_id() ] ) && $message['read'][ get_current_user_id() ] < strtotime( '-1 month' ); |
|
| 161 | - $dismissed = ! empty( $message['dismissed'] ) && isset( $message['dismissed'][ get_current_user_id() ] ) && $message['dismissed'][ get_current_user_id() ] < strtotime( '-1 week' ); |
|
| 160 | + $read = ! empty( $message['read'] ) && isset( $message['read'][get_current_user_id()] ) && $message['read'][get_current_user_id()] < strtotime( '-1 month' ); |
|
| 161 | + $dismissed = ! empty( $message['dismissed'] ) && isset( $message['dismissed'][get_current_user_id()] ) && $message['dismissed'][get_current_user_id()] < strtotime( '-1 week' ); |
|
| 162 | 162 | $expired = $this->is_expired( $message ); |
| 163 | 163 | if ( $read || $expired || $dismissed ) { |
| 164 | - unset( self::$messages[ $t ] ); |
|
| 164 | + unset( self::$messages[$t] ); |
|
| 165 | 165 | $removed = true; |
| 166 | 166 | } |
| 167 | 167 | } |
@@ -179,11 +179,11 @@ discard block |
||
| 179 | 179 | public function filter_messages( &$messages, $type = 'unread' ) { |
| 180 | 180 | $user_id = get_current_user_id(); |
| 181 | 181 | foreach ( $messages as $k => $message ) { |
| 182 | - $dismissed = isset( $message['dismissed'] ) && isset( $message['dismissed'][ $user_id ] ); |
|
| 182 | + $dismissed = isset( $message['dismissed'] ) && isset( $message['dismissed'][$user_id] ); |
|
| 183 | 183 | if ( empty( $k ) || $this->is_expired( $message ) || ( $type === 'dismissed' ) !== $dismissed ) { |
| 184 | - unset( $messages[ $k ] ); |
|
| 184 | + unset( $messages[$k] ); |
|
| 185 | 185 | } elseif ( ! $this->is_for_user( $message ) ) { |
| 186 | - unset( $messages[ $k ] ); |
|
| 186 | + unset( $messages[$k] ); |
|
| 187 | 187 | } |
| 188 | 188 | } |
| 189 | 189 | $messages = apply_filters( 'frm_filter_inbox', $messages ); |
@@ -241,14 +241,14 @@ discard block |
||
| 241 | 241 | * @return void |
| 242 | 242 | */ |
| 243 | 243 | public function mark_read( $key ) { |
| 244 | - if ( ! $key || ! isset( self::$messages[ $key ] ) ) { |
|
| 244 | + if ( ! $key || ! isset( self::$messages[$key] ) ) { |
|
| 245 | 245 | return; |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | - if ( ! isset( self::$messages[ $key ]['read'] ) ) { |
|
| 249 | - self::$messages[ $key ]['read'] = array(); |
|
| 248 | + if ( ! isset( self::$messages[$key]['read'] ) ) { |
|
| 249 | + self::$messages[$key]['read'] = array(); |
|
| 250 | 250 | } |
| 251 | - self::$messages[ $key ]['read'][ get_current_user_id() ] = time(); |
|
| 251 | + self::$messages[$key]['read'][get_current_user_id()] = time(); |
|
| 252 | 252 | |
| 253 | 253 | $this->update_list(); |
| 254 | 254 | } |
@@ -260,9 +260,9 @@ discard block |
||
| 260 | 260 | * @return void |
| 261 | 261 | */ |
| 262 | 262 | public function mark_unread( $key ) { |
| 263 | - $is_read = isset( self::$messages[ $key ] ) && isset( self::$messages[ $key ]['read'] ) && isset( self::$messages[ $key ]['read'][ get_current_user_id() ] ); |
|
| 263 | + $is_read = isset( self::$messages[$key] ) && isset( self::$messages[$key]['read'] ) && isset( self::$messages[$key]['read'][get_current_user_id()] ); |
|
| 264 | 264 | if ( $is_read ) { |
| 265 | - unset( self::$messages[ $key ]['read'][ get_current_user_id() ] ); |
|
| 265 | + unset( self::$messages[$key]['read'][get_current_user_id()] ); |
|
| 266 | 266 | $this->update_list(); |
| 267 | 267 | } |
| 268 | 268 | } |
@@ -278,14 +278,14 @@ discard block |
||
| 278 | 278 | return; |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | - if ( ! isset( self::$messages[ $key ] ) ) { |
|
| 281 | + if ( ! isset( self::$messages[$key] ) ) { |
|
| 282 | 282 | return; |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | - if ( ! isset( self::$messages[ $key ]['dismissed'] ) ) { |
|
| 286 | - self::$messages[ $key ]['dismissed'] = array(); |
|
| 285 | + if ( ! isset( self::$messages[$key]['dismissed'] ) ) { |
|
| 286 | + self::$messages[$key]['dismissed'] = array(); |
|
| 287 | 287 | } |
| 288 | - self::$messages[ $key ]['dismissed'][ get_current_user_id() ] = time(); |
|
| 288 | + self::$messages[$key]['dismissed'][get_current_user_id()] = time(); |
|
| 289 | 289 | |
| 290 | 290 | $this->update_list(); |
| 291 | 291 | } |
@@ -299,11 +299,11 @@ discard block |
||
| 299 | 299 | $user_id = get_current_user_id(); |
| 300 | 300 | foreach ( self::$messages as $key => $message ) { |
| 301 | 301 | if ( ! isset( $message['dismissed'] ) ) { |
| 302 | - self::$messages[ $key ]['dismissed'] = array(); |
|
| 302 | + self::$messages[$key]['dismissed'] = array(); |
|
| 303 | 303 | } |
| 304 | 304 | |
| 305 | - if ( ! isset( $message['dismissed'][ $user_id ] ) ) { |
|
| 306 | - self::$messages[ $key ]['dismissed'][ $user_id ] = time(); |
|
| 305 | + if ( ! isset( $message['dismissed'][$user_id] ) ) { |
|
| 306 | + self::$messages[$key]['dismissed'][$user_id] = time(); |
|
| 307 | 307 | } |
| 308 | 308 | } |
| 309 | 309 | $this->update_list(); |
@@ -313,8 +313,8 @@ discard block |
||
| 313 | 313 | $messages = $this->get_messages( 'filter' ); |
| 314 | 314 | $user_id = get_current_user_id(); |
| 315 | 315 | foreach ( $messages as $t => $message ) { |
| 316 | - if ( isset( $message['read'] ) && isset( $message['read'][ $user_id ] ) ) { |
|
| 317 | - unset( $messages[ $t ] ); |
|
| 316 | + if ( isset( $message['read'] ) && isset( $message['read'][$user_id] ) ) { |
|
| 317 | + unset( $messages[$t] ); |
|
| 318 | 318 | } |
| 319 | 319 | } |
| 320 | 320 | return $messages; |
@@ -353,8 +353,8 @@ discard block |
||
| 353 | 353 | * @return void |
| 354 | 354 | */ |
| 355 | 355 | public function remove( $key ) { |
| 356 | - if ( isset( self::$messages[ $key ] ) ) { |
|
| 357 | - unset( self::$messages[ $key ] ); |
|
| 356 | + if ( isset( self::$messages[$key] ) ) { |
|
| 357 | + unset( self::$messages[$key] ); |
|
| 358 | 358 | $this->update_list(); |
| 359 | 359 | } |
| 360 | 360 | } |
@@ -400,7 +400,7 @@ discard block |
||
| 400 | 400 | * @param array $matches The regex results for a single match. |
| 401 | 401 | * @return string |
| 402 | 402 | */ |
| 403 | - function ( $matches ) { |
|
| 403 | + function( $matches ) { |
|
| 404 | 404 | $url = $matches[2]; |
| 405 | 405 | $parts = parse_url( $url ); |
| 406 | 406 | |
@@ -463,8 +463,8 @@ discard block |
||
| 463 | 463 | $inbox = new self(); |
| 464 | 464 | return array_filter( |
| 465 | 465 | $inbox->get_messages( 'filter' ), |
| 466 | - function ( $message ) use ( $key ) { |
|
| 467 | - return ! empty( $message[ $key ] ); |
|
| 466 | + function( $message ) use ( $key ) { |
|
| 467 | + return ! empty( $message[$key] ); |
|
| 468 | 468 | } |
| 469 | 469 | ); |
| 470 | 470 | } |
@@ -510,8 +510,8 @@ discard block |
||
| 510 | 510 | |
| 511 | 511 | return array_reduce( |
| 512 | 512 | $keys_to_return, |
| 513 | - function ( $total, $key ) use ( $message ) { |
|
| 514 | - $total[ $key ] = isset( $message[ $key ] ) ? $message[ $key ] : ''; |
|
| 513 | + function( $total, $key ) use ( $message ) { |
|
| 514 | + $total[$key] = isset( $message[$key] ) ? $message[$key] : ''; |
|
| 515 | 515 | return $total; |
| 516 | 516 | }, |
| 517 | 517 | array() |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | $_GET['page'] = 'formidable'; |
| 27 | 27 | |
| 28 | - $values = array( |
|
| 28 | + $values = array( |
|
| 29 | 29 | 'id' => FrmAppHelper::get_post_param( 'form_id', '', 'absint' ), |
| 30 | 30 | 'doing_ajax' => true, |
| 31 | 31 | ); |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | ob_start(); |
| 50 | 50 | self::load_single_field( $field, $values ); |
| 51 | - $field_html[ absint( $field->id ) ] = ob_get_contents(); |
|
| 51 | + $field_html[absint( $field->id )] = ob_get_contents(); |
|
| 52 | 52 | ob_end_clean(); |
| 53 | 53 | } |
| 54 | 54 | |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | foreach ( $opts as $opt_key => $opt ) { |
| 259 | 259 | if ( strpos( $opt, '|' ) !== false ) { |
| 260 | 260 | $vals = explode( '|', $opt ); |
| 261 | - $opts[ $opt_key ] = array( |
|
| 261 | + $opts[$opt_key] = array( |
|
| 262 | 262 | 'label' => trim( $vals[0] ), |
| 263 | 263 | 'value' => trim( $vals[1] ), |
| 264 | 264 | ); |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | $other_array = array(); |
| 274 | 274 | foreach ( $field['options'] as $opt_key => $opt ) { |
| 275 | 275 | if ( FrmFieldsHelper::is_other_opt( $opt_key ) ) { |
| 276 | - $other_array[ $opt_key ] = $opt; |
|
| 276 | + $other_array[$opt_key] = $opt; |
|
| 277 | 277 | } |
| 278 | 278 | unset( $opt_key, $opt ); |
| 279 | 279 | } |
@@ -315,18 +315,18 @@ discard block |
||
| 315 | 315 | $frm_settings = FrmAppHelper::get_settings(); |
| 316 | 316 | $field_types = FrmFieldTypeOptionData::get_field_types( $field['type'] ); |
| 317 | 317 | |
| 318 | - if ( ! isset( $all_field_types[ $field['type'] ] ) ) { |
|
| 318 | + if ( ! isset( $all_field_types[$field['type']] ) ) { |
|
| 319 | 319 | // Add fallback for an add-on field type that has been deactivated. |
| 320 | - $all_field_types[ $field['type'] ] = array( |
|
| 320 | + $all_field_types[$field['type']] = array( |
|
| 321 | 321 | 'name' => ucfirst( $field['type'] ), |
| 322 | 322 | 'icon' => 'frm_icon_font frm_pencil_icon', |
| 323 | 323 | ); |
| 324 | - } elseif ( ! is_array( $all_field_types[ $field['type'] ] ) ) { |
|
| 324 | + } elseif ( ! is_array( $all_field_types[$field['type']] ) ) { |
|
| 325 | 325 | // Fallback for fields added in a more basic way. |
| 326 | - FrmFormsHelper::prepare_field_type( $all_field_types[ $field['type'] ] ); |
|
| 326 | + FrmFormsHelper::prepare_field_type( $all_field_types[$field['type']] ); |
|
| 327 | 327 | } |
| 328 | 328 | |
| 329 | - $type_name = $all_field_types[ $field['type'] ]['name']; |
|
| 329 | + $type_name = $all_field_types[$field['type']]['name']; |
|
| 330 | 330 | if ( $field['type'] === 'divider' && FrmField::is_option_true( $field, 'repeat' ) ) { |
| 331 | 331 | $type_name = $all_field_types['divider|repeat']['name']; |
| 332 | 332 | } |
@@ -400,13 +400,13 @@ discard block |
||
| 400 | 400 | $active = 'default_value'; |
| 401 | 401 | |
| 402 | 402 | foreach ( $settings as $type ) { |
| 403 | - if ( ! empty( $field[ $type ] ) ) { |
|
| 403 | + if ( ! empty( $field[$type] ) ) { |
|
| 404 | 404 | $active = $type; |
| 405 | 405 | } |
| 406 | 406 | } |
| 407 | 407 | |
| 408 | - $types[ $active ]['class'] .= ' current'; |
|
| 409 | - $types[ $active ]['current'] = true; |
|
| 408 | + $types[$active]['class'] .= ' current'; |
|
| 409 | + $types[$active]['current'] = true; |
|
| 410 | 410 | |
| 411 | 411 | return $types; |
| 412 | 412 | } |
@@ -420,8 +420,8 @@ discard block |
||
| 420 | 420 | 'website' => 'url', |
| 421 | 421 | 'image' => 'url', |
| 422 | 422 | ); |
| 423 | - if ( isset( $type_switch[ $type ] ) ) { |
|
| 424 | - $type = $type_switch[ $type ]; |
|
| 423 | + if ( isset( $type_switch[$type] ) ) { |
|
| 424 | + $type = $type_switch[$type]; |
|
| 425 | 425 | } |
| 426 | 426 | |
| 427 | 427 | $pro_fields = FrmField::pro_field_selection(); |
@@ -556,11 +556,11 @@ discard block |
||
| 556 | 556 | // include "col" for valid html |
| 557 | 557 | $unit = trim( preg_replace( '/[0-9]+/', '', $field['size'] ) ); |
| 558 | 558 | |
| 559 | - if ( ! isset( $calc[ $unit ] ) ) { |
|
| 559 | + if ( ! isset( $calc[$unit] ) ) { |
|
| 560 | 560 | return; |
| 561 | 561 | } |
| 562 | 562 | |
| 563 | - $size = (float) str_replace( $unit, '', $field['size'] ) / $calc[ $unit ]; |
|
| 563 | + $size = (float) str_replace( $unit, '', $field['size'] ) / $calc[$unit]; |
|
| 564 | 564 | |
| 565 | 565 | $add_html['cols'] = 'cols="' . absint( $size ) . '"'; |
| 566 | 566 | } |
@@ -792,11 +792,11 @@ discard block |
||
| 792 | 792 | private static function get_form_for_js_validation( $field ) { |
| 793 | 793 | global $frm_vars; |
| 794 | 794 | if ( ! empty( $frm_vars['js_validate_forms'] ) ) { |
| 795 | - if ( isset( $frm_vars['js_validate_forms'][ $field['form_id'] ] ) ) { |
|
| 796 | - return $frm_vars['js_validate_forms'][ $field['form_id'] ]; |
|
| 795 | + if ( isset( $frm_vars['js_validate_forms'][$field['form_id']] ) ) { |
|
| 796 | + return $frm_vars['js_validate_forms'][$field['form_id']]; |
|
| 797 | 797 | } |
| 798 | - if ( ! empty( $field['parent_form_id'] ) && isset( $frm_vars['js_validate_forms'][ $field['parent_form_id'] ] ) ) { |
|
| 799 | - return $frm_vars['js_validate_forms'][ $field['parent_form_id'] ]; |
|
| 798 | + if ( ! empty( $field['parent_form_id'] ) && isset( $frm_vars['js_validate_forms'][$field['parent_form_id']] ) ) { |
|
| 799 | + return $frm_vars['js_validate_forms'][$field['parent_form_id']]; |
|
| 800 | 800 | } |
| 801 | 801 | } |
| 802 | 802 | return false; |
@@ -881,10 +881,10 @@ discard block |
||
| 881 | 881 | |
| 882 | 882 | if ( is_numeric( $k ) && strpos( $v, '=' ) ) { |
| 883 | 883 | $add_html[] = $v; |
| 884 | - } elseif ( ! empty( $k ) && isset( $add_html[ $k ] ) ) { |
|
| 885 | - $add_html[ $k ] = str_replace( $k . '="', $k . '="' . $v, $add_html[ $k ] ); |
|
| 884 | + } elseif ( ! empty( $k ) && isset( $add_html[$k] ) ) { |
|
| 885 | + $add_html[$k] = str_replace( $k . '="', $k . '="' . $v, $add_html[$k] ); |
|
| 886 | 886 | } else { |
| 887 | - $add_html[ $k ] = $k . '="' . esc_attr( $v ) . '"'; |
|
| 887 | + $add_html[$k] = $k . '="' . esc_attr( $v ) . '"'; |
|
| 888 | 888 | } |
| 889 | 889 | |
| 890 | 890 | unset( $k, $v ); |
@@ -19,9 +19,9 @@ |
||
| 19 | 19 | * @return array |
| 20 | 20 | */ |
| 21 | 21 | public static function get_field_types( $type ) { |
| 22 | - if ( ! isset( self::$data[ $type ] ) ) { |
|
| 23 | - self::$data[ $type ] = FrmFieldsHelper::get_field_types( $type ); |
|
| 22 | + if ( ! isset( self::$data[$type] ) ) { |
|
| 23 | + self::$data[$type] = FrmFieldsHelper::get_field_types( $type ); |
|
| 24 | 24 | } |
| 25 | - return self::$data[ $type ]; |
|
| 25 | + return self::$data[$type]; |
|
| 26 | 26 | } |
| 27 | 27 | } |