PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 2.2.0
Visualizer – Tables & Charts Manager with Built-in AI Generator v2.2.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 +12 -19 3.0.52.2.0 View file →
@@ -145,13 +145,13 @@
145 145
146 146 /**
147 147 * Extracts the data for a chart and prepares it for the given type.
148 148 *
149 - * @access public
149 + * @access protected
150 150 * @param int $chart_id The chart id.
151 151 * @param string $type The exported type.
152 152 */
153 - public function _getDataAs( $chart_id, $type ) {
153 + protected function _getDataAs( $chart_id, $type ) {
154 154 $final = null;
155 155 $success = false;
156 156 if ( $chart_id ) {
157 157 $chart = get_post( $chart_id );
@@ -248,27 +248,20 @@
248 248 * @param array $rows The array of data.
249 249 * @param string $filename The name of the file to use.
250 250 */
251 251 private function _getExcel( $rows, $filename ) {
252 - // PHPExcel does not like sheet names longer than 31 characters.
253 - $chart = substr( $filename, 0, 30 );
252 + $chart = $filename;
254 253 $filename .= '.xlsx';
255 254
256 - $xlsData = '';
257 - if ( class_exists( 'PHPExcel' ) ) {
258 - $doc = new PHPExcel();
259 - $doc->getActiveSheet()->fromArray( $rows, null, 'A1' );
260 - $doc->getActiveSheet()->setTitle( $chart );
261 - $doc = apply_filters( 'visualizer_excel_doc', $doc );
262 - $writer = PHPExcel_IOFactory::createWriter( $doc, 'Excel2007' );
263 - ob_start();
264 - $writer->save( 'php://output' );
265 - $xlsData = ob_get_contents();
266 - ob_end_clean();
267 - } else {
268 - do_action( 'themeisle_log_event', Visualizer_Plugin::NAME, 'Class PHPExcel does not exist!', 'error', __FILE__, __LINE__ );
269 - error_log( 'Class PHPExcel does not exist!' );
270 - }
255 + $doc = new PHPExcel();
256 + $doc->getActiveSheet()->fromArray( $rows, null, 'A1' );
257 + $doc->getActiveSheet()->setTitle( $chart );
258 + $doc = apply_filters( 'visualizer_excel_doc', $doc );
259 + $writer = PHPExcel_IOFactory::createWriter( $doc, 'Excel2007' );
260 + ob_start();
261 + $writer->save( 'php://output' );
262 + $xlsData = ob_get_contents();
263 + ob_end_clean();
271 264 return array(
272 265 'csv' => 'data:application/vnd.ms-excel;base64,' . base64_encode( $xlsData ),
273 266 'name' => $filename,
274 267 );