| @@ -1,5 +1,5 @@ | ||
| 1 | -<?php // phpcs:ignore Standard.Category.SniffName.ErrorCode | |
| 1 | +<?php | |
| 2 | 2 | |
| 3 | 3 | namespace WPDataAccess\CSV_Files { |
| 4 | 4 | |
| 5 | 5 | use WPDataAccess\Data_Dictionary\WPDA_Dictionary_Lists; |
| @@ -101,14 +101,14 @@ | ||
| 101 | 101 | isset( $_REQUEST['csv_id'] ) ? |
| 102 | 102 | sanitize_text_field( wp_unslash( $_REQUEST['csv_id'] ) ) : ''; // input var okay. |
| 103 | 103 | |
| 104 | 104 | if ( null === $this->csv_id ) { |
| 105 | - wp_die( __( 'ERROR: Missing argument', 'wp-data-access' ) ); // phpcs:ignore WordPress.Security.EscapeOutput | |
| 105 | + wp_die( esc_html__( 'ERROR: Missing argument', 'wp-data-access' ) ); | |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | $wp_nonce = isset( $_REQUEST['_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['_wpnonce'] ) ) : ''; // input var okay. |
| 109 | 109 | if ( ! wp_verify_nonce( $wp_nonce, "wpda-mapping-{$this->csv_id}" ) ) { |
| 110 | - wp_die( __( 'ERROR: Not authorized', 'wp-data-access' ) ); // phpcs:ignore WordPress.Security.EscapeOutput | |
| 110 | + wp_die( esc_html__( 'ERROR: Not authorized', 'wp-data-access' ) ); | |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | $this->csv_upload = WPDA_CSV_Uploads_Model::query( $this->csv_id ); |
| 114 | 114 | if ( isset( $this->csv_upload[0]->csv_name ) ) { |
| @@ -152,9 +152,9 @@ | ||
| 152 | 152 | */ |
| 153 | 153 | public function show() { |
| 154 | 154 | $upload_dir = WPDA::get_plugin_upload_dir(); |
| 155 | 155 | if ( ! isset( $this->csv_upload[0]->csv_real_file_name ) ) { |
| 156 | - wp_die( __( 'ERROR: CSV file not found', 'wp-data-access' ) ); // phpcs:ignore WordPress.Security.EscapeOutput | |
| 156 | + wp_die( esc_html__( 'ERROR: CSV file not found', 'wp-data-access' ) ); | |
| 157 | 157 | } |
| 158 | 158 | $file_name = $upload_dir . $this->csv_upload[0]->csv_real_file_name; |
| 159 | 159 | |
| 160 | 160 | $table_list = WPDA_Dictionary_Lists::get_tables( false, $this->schema_name_mapping ); |
| @@ -253,9 +253,9 @@ | ||
| 253 | 253 | var jsonData = JSON.parse(data); |
| 254 | 254 | jQuery('#csv_table_columns').empty(); |
| 255 | 255 | if (!init) { |
| 256 | 256 | jQuery('.csv_column').empty().append( |
| 257 | - '<li class="wpda_csv_column_init"><?php echo __( 'Drag column here...', 'wp-data-access' ); // phpcs:ignore WordPress.Security.EscapeOutput ?></li>' | |
| 257 | + '<li class="wpda_csv_column_init"><?php esc_html_e( 'Drag column here...', 'wp-data-access' ); ?></li>' | |
| 258 | 258 | ); |
| 259 | 259 | } |
| 260 | 260 | for (i = 0; i < jsonData.length; i++) { |
| 261 | 261 | add_column = true; |
| @@ -302,9 +302,9 @@ | ||
| 302 | 302 | csv_column_name = jQuery(this).attr('data-csv-column-name'); |
| 303 | 303 | if (csv_column_name!==undefined) { |
| 304 | 304 | dbs_column_name = jQuery(this).find('li').first().text().trim(); |
| 305 | 305 | if (dbs_column_name!=='' && |
| 306 | - dbs_column_name!=='<?php echo __( 'Drag column here...', 'wp-data-access' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>' | |
| 306 | + dbs_column_name!=='<?php esc_html_e( 'Drag column here...', 'wp-data-access' ); ?>' | |
| 307 | 307 | ) { |
| 308 | 308 | columns[i] = dbs_column_name; |
| 309 | 309 | } |
| 310 | 310 | } |
| @@ -397,9 +397,9 @@ | ||
| 397 | 397 | }, |
| 398 | 398 | receive: function( event, ui ) { |
| 399 | 399 | if (wpda_moving_item.childElementCount===0) { |
| 400 | 400 | jQuery(wpda_moving_item).empty().append( |
| 401 | - '<li class="wpda_csv_column_init"><?php echo __( 'Drag column here...', 'wp-data-access' ); // phpcs:ignore WordPress.Security.EscapeOutput ?></li>' | |
| 401 | + '<li class="wpda_csv_column_init"><?php esc_html_e( 'Drag column here...', 'wp-data-access' ); ?></li>' | |
| 402 | 402 | ); |
| 403 | 403 | } |
| 404 | 404 | } |
| 405 | 405 | }); |
| @@ -432,9 +432,9 @@ | ||
| 432 | 432 | } |
| 433 | 433 | } |
| 434 | 434 | if (wpda_moving_item.childElementCount===0) { |
| 435 | 435 | jQuery(wpda_moving_item).append( |
| 436 | - '<li class="wpda_csv_column_init"><?php echo __( 'Drag column here...', 'wp-data-access' ); // phpcs:ignore WordPress.Security.EscapeOutput ?></li>' | |
| 436 | + '<li class="wpda_csv_column_init"><?php esc_html_e( 'Drag column here...', 'wp-data-access' ); ?></li>' | |
| 437 | 437 | ); |
| 438 | 438 | } |
| 439 | 439 | } |
| 440 | 440 | }); |
| @@ -445,9 +445,9 @@ | ||
| 445 | 445 | <form method="post" action="?page=wpda&page_action=wpda_import_csv"> |
| 446 | 446 | <br/> |
| 447 | 447 | <fieldset class="wpda_fieldset"> |
| 448 | 448 | <legend> |
| 449 | - <?php echo __( 'Settings', 'wp-data-access' ); // phpcs:ignore WordPress.Security.EscapeOutput ?> | |
| 449 | + <?php esc_html_e( 'Settings', 'wp-data-access' ); ?> | |
| 450 | 450 | </legend> |
| 451 | 451 | <div id="wpda_csv_settings"> |
| 452 | 452 | <label for="csv_delimiter" style="line-height: 2; vertical-align: text-top;"> |
| 453 | 453 | <span>Field separator</span> |
| @@ -483,9 +483,9 @@ | ||
| 483 | 483 | </label> |
| 484 | 484 | |
| 485 | 485 | <button type="button" class="button" onclick="change_delimiter()"> |
| 486 | 486 | <i class="fas fa-check wpda_icon_on_button"></i> |
| 487 | - <?php echo __( 'Apply settings' ); // phpcs:ignore WordPress.Security.EscapeOutput ?> | |
| 487 | + <?php esc_html_e( 'Apply settings', 'wp-data-access' ); ?> | |
| 488 | 488 | </button> |
| 489 | 489 | </div> |
| 490 | 490 | </fieldset> |
| 491 | 491 | <br/> |
| @@ -490,9 +490,9 @@ | ||
| 490 | 490 | </fieldset> |
| 491 | 491 | <br/> |
| 492 | 492 | <fieldset class="wpda_fieldset"> |
| 493 | 493 | <legend> |
| 494 | - <?php echo __( 'Destination database and table', 'wp-data-access' ); // phpcs:ignore WordPress.Security.EscapeOutput ?> | |
| 494 | + <?php esc_html_e( 'Destination database and table', 'wp-data-access' ); ?> | |
| 495 | 495 | </legend> |
| 496 | 496 | <div> |
| 497 | 497 | <select id="csv_schema_name" name="csv_schema_name" style="margin-left: 0; vertical-align: top;" onchange="wpda_get_tables()"> |
| 498 | 498 | <?php |
| @@ -525,25 +525,25 @@ | ||
| 525 | 525 | @ini_set( 'auto_detect_line_endings', true ); // phpcs:ignore |
| 526 | 526 | if ( false !== ( $fp = fopen( $file_name, 'r' ) ) ) { // phpcs:ignore |
| 527 | 527 | $index = 0; |
| 528 | 528 | while ( false !== ( $data = fgetcsv( $fp, 0, $this->delimiter ) ) ) { // phpcs:ignore |
| 529 | - for ( $column = 0; $column < count( $data ); $column ++ ) { // phpcs:ignore - 8.1 proof | |
| 529 | + for ( $column = 0; $column < count( $data ); $column ++ ) { // phpcs:ignore | |
| 530 | 530 | if ( $this->has_header_columns ) { |
| 531 | - array_push( $csv_columns, $data[ $column ] );//phpcs:ignore - 8.1 proof | |
| 531 | + array_push( $csv_columns, $data[ $column ] ); // phpcs:ignore -- 8.1 proof | |
| 532 | 532 | } else { |
| 533 | - array_push( $csv_columns, "column_{$index}" );//phpcs:ignore - 8.1 proof | |
| 533 | + array_push( $csv_columns, "column_{$index}" ); // phpcs:ignore -- 8.1 proof | |
| 534 | 534 | $index++; |
| 535 | 535 | } |
| 536 | 536 | } |
| 537 | 537 | break; |
| 538 | 538 | } |
| 539 | - fclose( $fp ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fclose | |
| 539 | + fclose( $fp ); // phpcs:ignore | |
| 540 | 540 | } |
| 541 | 541 | ?> |
| 542 | 542 | <br/> |
| 543 | 543 | <fieldset class="wpda_fieldset"> |
| 544 | 544 | <legend> |
| 545 | - <?php echo __( 'Column mapping', 'wp-data-access' ); // phpcs:ignore WordPress.Security.EscapeOutput ?> | |
| 545 | + <?php esc_html_e( 'Column mapping', 'wp-data-access' ); ?> | |
| 546 | 546 | <a href="javascript:void(0)"> |
| 547 | 547 | <span class="dashicons dashicons-editor-help wpda_tooltip" title="Drag columns from Table to Mapped" style="cursor:pointer;vertical-align:bottom;text-decoration:none;"></span> |
| 548 | 548 | </a> |
| 549 | 549 | </legend> |
| @@ -579,9 +579,9 @@ | ||
| 579 | 579 | <?php |
| 580 | 580 | } else { |
| 581 | 581 | ?> |
| 582 | 582 | <li class="wpda_csv_column_init"> |
| 583 | - <?php echo __( 'Drag column here...', 'wp-data-access' ); // phpcs:ignore WordPress.Security.EscapeOutput ?> | |
| 583 | + <?php esc_html_e( 'Drag column here...', 'wp-data-access' ); ?> | |
| 584 | 584 | </li> |
| 585 | 585 | <?php |
| 586 | 586 | } |
| 587 | 587 | ?> |
| @@ -590,9 +590,9 @@ | ||
| 590 | 590 | <td></td> |
| 591 | 591 | <?php |
| 592 | 592 | if ( $first_row ) { |
| 593 | 593 | ?> |
| 594 | - <td rowspan="<?php echo esc_attr( count( $csv_columns ) + 1 ); //phpcs:ignore - 8.1 proof ?>" style="vertical-align: top;"> | |
| 594 | + <td rowspan="<?php echo esc_attr( count( $csv_columns ) + 1 ); // phpcs:ignore -- 8.1 proof ?>" style="vertical-align: top;"> | |
| 595 | 595 | <ul id="csv_table_columns"> |
| 596 | 596 | </ul> |
| 597 | 597 | </td> |
| 598 | 598 | <?php |
| @@ -627,20 +627,20 @@ | ||
| 627 | 627 | <input type="hidden" name="_wpnonce" value="<?php echo esc_attr( $wp_nonce ); ?>" /> |
| 628 | 628 | </form> |
| 629 | 629 | <br/> |
| 630 | 630 | <a href="javascript:void(0)" onclick="save_mapping()" class="button"> |
| 631 | - <span class="dashicons dashicons-yes-alt" style="padding-top: 4px; padding-right: 4px;"></span> | |
| 631 | + <span class="dashicons dashicons-yes-alt" style="padding-top: 4px; padding-right: 4px; min-height: 30px;"></span> | |
| 632 | 632 | Save mapping |
| 633 | 633 | </a> |
| 634 | 634 | <a href="javascript:void(0)" onclick="jQuery('#import_form').submit()" class="button"> |
| 635 | - <span class="dashicons dashicons-upload" style="padding-top: 4px; padding-right: 4px;"></span> | |
| 635 | + <span class="dashicons dashicons-upload" style="padding-top: 4px; padding-right: 4px; min-height: 30px;"></span> | |
| 636 | 636 | Import CSV file |
| 637 | 637 | </a> |
| 638 | 638 | <a id="wpda_preview_visible" href="javascript:void(0)" onclick="toggle_preview()" class="button"> |
| 639 | - <span class="dashicons dashicons-visibility" style="padding-top: 4px; padding-right: 4px;"></span> | |
| 639 | + <span class="dashicons dashicons-visibility" style="padding-top: 4px; padding-right: 4px; min-height: 30px;"></span> | |
| 640 | 640 | Preview CSV file |
| 641 | 641 | </a> |
| 642 | - <a id="wpda_preview_hidden" href="javascript:void(0)" onclick="toggle_preview()" class="button" style="display: none;"> | |
| 642 | + <a id="wpda_preview_hidden" href="javascript:void(0)" onclick="toggle_preview()" class="button" style="display: none; min-height: 30px;"> | |
| 643 | 643 | <span class="dashicons dashicons-hidden" style="padding-top: 4px; padding-right: 4px;"></span> |
| 644 | 644 | Hide CSV file |
| 645 | 645 | </a> |
| 646 | 646 | <?php |