PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.1.0
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.1.0
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14 3.10.15 3.10.2 3.10.3 All 149 releases
← All changes | classes/Visualizer/Module.php +6 -11 3.1.33.1.0 View file →
@@ -252,31 +252,26 @@
252 252 * @param array $rows The array of data.
253 253 * @param string $filename The name of the file to use.
254 254 */
255 255 private function _getExcel( $rows, $filename ) {
256 - // PHPExcel did not like sheet names longer than 31 characters and we will assume the same with PhpSpreadsheet
256 + // PHPExcel does not like sheet names longer than 31 characters.
257 257 $chart = substr( $filename, 0, 30 );
258 258 $filename .= '.xlsx';
259 259
260 - $vendor_file = VISUALIZER_ABSPATH . '/vendor/autoload.php';
261 - if ( is_readable( $vendor_file ) ) {
262 - include_once( $vendor_file );
263 - }
264 -
265 260 $xlsData = '';
266 - if ( class_exists( 'PhpOffice\PhpSpreadsheet\Spreadsheet' ) ) {
267 - $doc = new PhpOffice\PhpSpreadsheet\Spreadsheet();
261 + if ( class_exists( 'PHPExcel' ) ) {
262 + $doc = new PHPExcel();
268 263 $doc->getActiveSheet()->fromArray( $rows, null, 'A1' );
269 264 $doc->getActiveSheet()->setTitle( sanitize_title( $chart ) );
270 265 $doc = apply_filters( 'visualizer_excel_doc', $doc );
271 - $writer = PhpOffice\PhpSpreadsheet\IOFactory::createWriter( $doc, 'Xlsx' );
266 + $writer = PHPExcel_IOFactory::createWriter( $doc, 'Excel2007' );
272 267 ob_start();
273 268 $writer->save( 'php://output' );
274 269 $xlsData = ob_get_contents();
275 270 ob_end_clean();
276 271 } else {
277 - do_action( 'themeisle_log_event', Visualizer_Plugin::NAME, 'Class PhpOffice\PhpSpreadsheet\Spreadsheet does not exist!', 'error', __FILE__, __LINE__ );
278 - error_log( 'Class PhpOffice\PhpSpreadsheet\Spreadsheet does not exist!' );
272 + do_action( 'themeisle_log_event', Visualizer_Plugin::NAME, 'Class PHPExcel does not exist!', 'error', __FILE__, __LINE__ );
273 + error_log( 'Class PHPExcel does not exist!' );
279 274 }
280 275 return array(
281 276 'csv' => 'data:application/vnd.ms-excel;base64,' . base64_encode( $xlsData ),
282 277 'name' => $filename,