| @@ -76,13 +76,8 @@ | ||
| 76 | 76 | // read series types |
| 77 | 77 | $types = fgetcsv( $handle, 0, VISUALIZER_CSV_DELIMITER, VISUALIZER_CSV_ENCLOSURE ); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - if ( ! is_array( $labels ) || ! is_array( $types ) ) { | |
| 81 | - $this->_error = esc_html__( 'File should have a heading row (1st row) and a data type row (2nd row). Please try again.', 'visualizer' ); | |
| 82 | - return false; | |
| 83 | - } | |
| 84 | - | |
| 85 | 80 | $labels = array_filter( $labels ); |
| 86 | 81 | $types = array_filter( $types ); |
| 87 | 82 | |
| 88 | 83 | if ( ! $labels || ! $types ) { |
| @@ -101,9 +96,9 @@ | ||
| 101 | 96 | |
| 102 | 97 | $labels[ $i ] = $this->toUTF8( $labels[ $i ] ); |
| 103 | 98 | |
| 104 | 99 | $this->_series[] = array( |
| 105 | - 'label' => sanitize_text_field( wp_strip_all_tags( $labels[ $i ] ) ), | |
| 100 | + 'label' => $labels[ $i ], | |
| 106 | 101 | 'type' => isset( $types[ $i ] ) ? $types[ $i ] : $default_type, |
| 107 | 102 | ); |
| 108 | 103 | } |
| 109 | 104 | |
| @@ -147,12 +142,11 @@ | ||
| 147 | 142 | return false; |
| 148 | 143 | } |
| 149 | 144 | |
| 150 | 145 | // fetch data |
| 151 | - $data = fgetcsv( $handle, 0, VISUALIZER_CSV_DELIMITER, VISUALIZER_CSV_ENCLOSURE ); | |
| 152 | - while ( $data !== false ) { | |
| 146 | + // phpcs:ignore WordPress.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition | |
| 147 | + while ( ( $data = fgetcsv( $handle, 0, VISUALIZER_CSV_DELIMITER, VISUALIZER_CSV_ENCLOSURE ) ) !== false ) { | |
| 153 | 148 | $this->_data[] = $this->_normalizeData( $data ); |
| 154 | - $data = fgetcsv( $handle, 0, VISUALIZER_CSV_DELIMITER, VISUALIZER_CSV_ENCLOSURE ); | |
| 155 | 149 | } |
| 156 | 150 | |
| 157 | 151 | // close file handle |
| 158 | 152 | fclose( $handle ); |