| @@ -265,8 +265,12 @@ | ||
| 265 | 265 | $filename .= '.csv'; |
| 266 | 266 | |
| 267 | 267 | $bom = chr( 0xEF ) . chr( 0xBB ) . chr( 0xBF ); |
| 268 | 268 | $fp = tmpfile(); |
| 269 | + if ( ! apply_filters( 'vizualizer_export_include_series_type', true ) ) { | |
| 270 | + unset( $rows[1] ); | |
| 271 | + $rows = array_values( $rows ); | |
| 272 | + } | |
| 269 | 273 | // support for MS Excel |
| 270 | 274 | fprintf( $fp, $bom ); |
| 271 | 275 | foreach ( $rows as $row ) { |
| 272 | 276 | fputcsv( $fp, $row ); |
| @@ -311,14 +315,22 @@ | ||
| 311 | 315 | private function _getExcel( $rows, $filename ) { |
| 312 | 316 | // PHPExcel did not like sheet names longer than 31 characters and we will assume the same with PhpSpreadsheet |
| 313 | 317 | $chart = substr( $filename, 0, 30 ); |
| 314 | 318 | $filename .= '.xlsx'; |
| 315 | - | |
| 319 | + if ( ! apply_filters( 'vizualizer_export_include_series_type', true ) ) { | |
| 320 | + unset( $rows[1] ); | |
| 321 | + $rows = array_values( $rows ); | |
| 322 | + $rows = array_map( | |
| 323 | + function( $r ) { | |
| 324 | + return array_map( 'strval', $r ); | |
| 325 | + }, | |
| 326 | + $rows | |
| 327 | + ); | |
| 328 | + } | |
| 316 | 329 | $vendor_file = VISUALIZER_ABSPATH . '/vendor/autoload.php'; |
| 317 | 330 | if ( is_readable( $vendor_file ) ) { |
| 318 | 331 | include_once( $vendor_file ); |
| 319 | 332 | } |
| 320 | - | |
| 321 | 333 | $xlsData = ''; |
| 322 | 334 | if ( class_exists( 'PhpOffice\PhpSpreadsheet\Spreadsheet' ) ) { |
| 323 | 335 | $doc = new PhpOffice\PhpSpreadsheet\Spreadsheet(); |
| 324 | 336 | $doc->getActiveSheet()->fromArray( $rows, null, 'A1' ); |