Skip to content

Commit d3bb753

Browse files
authored
Merge pull request #212 from Codeinwp/development
Fix dependency for composer dependencies.
2 parents 6654a4b + 66f674e commit d3bb753

File tree

8 files changed

+22
-5727
lines changed

8 files changed

+22
-5727
lines changed

classes/Visualizer/Module.php

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -249,18 +249,25 @@ private function _getCSV( $rows, $filename ) {
249249
* @param string $filename The name of the file to use.
250250
*/
251251
private function _getExcel( $rows, $filename ) {
252-
$chart = $filename;
252+
// PHPExcel does not like sheet names longer than 31 characters.
253+
$chart = substr( $filename, 0, 30 );
253254
$filename .= '.xlsx';
254255

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();
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+
}
264271
return array(
265272
'csv' => 'data:application/vnd.ms-excel;base64,' . base64_encode( $xlsData ),
266273
'name' => $filename,

classes/Visualizer/Plugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
class Visualizer_Plugin {
2929

3030
const NAME = 'visualizer';
31-
const VERSION = '3.0.1';
31+
const VERSION = '3.0.2';
3232

3333
// custom post types
3434
const CPT_VISUALIZER = 'visualizer';

classes/Visualizer/Render/Sidebar.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ protected function _renderActionSettings() {
208208
esc_html__( 'To enable downloading the data as a CSV.', 'visualizer' )
209209
);
210210

211-
$disabled = ! ( extension_loaded( 'zip' ) && extension_loaded( 'xml' ) && version_compare( PHP_VERSION, '5.2.0', '>' ) );
211+
$disabled = ! ( class_exists( 'PHPExcel' ) && extension_loaded( 'zip' ) && extension_loaded( 'xml' ) && version_compare( PHP_VERSION, '5.2.0', '>' ) );
212212
self::_renderCheckboxItem(
213213
esc_html__( 'Excel', 'visualizer' ),
214214
'actions[]',

composer.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@
66
"charts",
77
"visualization"
88
],
9-
"repositories": [
10-
{
11-
"type": "vcs",
12-
"url": "https://github.com/Codeinwp/themeisle-sdk"
13-
}
14-
],
159
"homepage": "https://themeisle.com/plugins/visualizer/",
1610
"license": "GPL-2.0+",
1711
"authors": [

css/media.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Version: 3.0.1
2+
Version: 3.0.2
33
*/
44
#visualizer-library-view {
55
padding: 30px 10px 10px 30px;

index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Plugin Name: Visualizer: Charts and Graphs Lite
55
Plugin URI: https://themeisle.com/plugins/visualizer-charts-and-graphs-lite/
66
Description: A simple, easy to use and quite powerful tool to create, manage and embed interactive charts into your WordPress posts and pages. The plugin uses Google Visualization API to render charts, which supports cross-browser compatibility (adopting VML for older IE versions) and cross-platform portability to iOS and new Android releases.
7-
Version: 3.0.1
7+
Version: 3.0.2
88
Author: Themeisle
99
Author URI: http://themeisle.com
1010
License: GPL v2.0 or later

0 commit comments

Comments
 (0)