Skip to content

Commit 3df57c4

Browse files
Merge pull request #383 from contactashish13/3.1.3
3.1.3
2 parents 548dcc8 + 122d8f7 commit 3df57c4

File tree

9 files changed

+41
-6
lines changed

9 files changed

+41
-6
lines changed

classes/Visualizer/Module/Chart.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,34 @@ public function deleteChart() {
237237
exit;
238238
}
239239

240+
/**
241+
* Delete charts that are still in auto-draft mode.
242+
*/
243+
private function deleteOldCharts() {
244+
$query = new WP_Query(
245+
array(
246+
'post_type' => Visualizer_Plugin::CPT_VISUALIZER,
247+
'post_status' => 'auto-draft',
248+
'fields' => 'ids',
249+
'update_post_meta_cache' => false,
250+
'update_post_term_cache' => false,
251+
'posts_per_page' => 50,
252+
'date_query' => array(
253+
array(
254+
'before' => 'today',
255+
),
256+
),
257+
)
258+
);
259+
260+
if ( $query->have_posts() ) {
261+
$ids = array();
262+
while ( $query->have_posts() ) {
263+
wp_delete_post( $query->next_post(), true );
264+
}
265+
}
266+
}
267+
240268
/**
241269
* Renders appropriate page for chart builder. Creates new auto draft chart
242270
* if no chart has been specified.
@@ -250,6 +278,7 @@ public function renderChartPages() {
250278
// check chart, if chart not exists, will create new one and redirects to the same page with proper chart id
251279
$chart_id = isset( $_GET['chart'] ) ? filter_var( $_GET['chart'], FILTER_VALIDATE_INT ) : '';
252280
if ( ! $chart_id || ! ( $chart = get_post( $chart_id ) ) || $chart->post_type != Visualizer_Plugin::CPT_VISUALIZER ) {
281+
$this->deleteOldCharts();
253282
$default_type = isset( $_GET['type'] ) && ! empty( $_GET['type'] ) ? $_GET['type'] : 'line';
254283
$source = new Visualizer_Source_Csv( VISUALIZER_ABSPATH . DIRECTORY_SEPARATOR . 'samples' . DIRECTORY_SEPARATOR . $default_type . '.csv' );
255284
$source->fetch();

classes/Visualizer/Module/Setup.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@ public function activate() {
150150
* On activation of the plugin
151151
*/
152152
public function onActivation( $plugin ) {
153+
if ( defined( 'TI_UNIT_TESTING' ) ) {
154+
return;
155+
}
156+
153157
if ( $plugin == VISUALIZER_BASENAME ) {
154158
wp_redirect( admin_url( 'upload.php?page=' . Visualizer_Plugin::NAME ) );
155159
exit();

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.1.2';
31+
const VERSION = '3.1.3';
3232

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

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.1.2
2+
Version: 3.1.3
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: Tables and Charts Manager for WordPress (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.1.2
7+
Version: 3.1.3
88
Author: Themeisle
99
Author URI: http://themeisle.com
1010
License: GPL v2.0 or later

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "visualizer",
3-
"version": "3.1.2",
3+
"version": "3.1.3",
44
"description": "Visualizer Lite",
55
"repository": {
66
"type": "git",

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
**Contributors:** [codeinwp](https://profiles.wordpress.org/codeinwp), [marius2012](https://profiles.wordpress.org/marius2012), [marius_codeinwp](https://profiles.wordpress.org/marius_codeinwp), [hardeepasrani](https://profiles.wordpress.org/hardeepasrani), [themeisle](https://profiles.wordpress.org/themeisle), [Madalin_ThemeIsle](https://profiles.wordpress.org/Madalin_ThemeIsle), [contactashish13](https://profiles.wordpress.org/contactashish13)
33
**Tags:** chart, charts, charting, graph, graphs, graphing, visualisation, visualise data, visualization, visualize data, HTML5, canvas, pie chart, line chart, bar chart, column chart, gauge chart, area chart, scatter chart, candlestick chart, geo chart, google visualization api, data tables
44
**Requires at least:** 3.5
5-
**Tested up to:** 5.0
5+
**Tested up to:** 5.1
66
**Stable tag:** trunk
77
**License:** GPL v2.0 or later
88
**License URI:** http://www.opensource.org/licenses/gpl-license.php

readme.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Contributors: codeinwp,marius2012,marius_codeinwp,hardeepasrani,themeisle,Madalin_ThemeIsle,contactashish13
33
Tags: chart, charts, charting, graph, graphs, graphing, visualisation, visualise data, visualization, visualize data, HTML5, canvas, pie chart, line chart, bar chart, column chart, gauge chart, area chart, scatter chart, candlestick chart, geo chart, google visualization api, data tables
44
Requires at least: 3.5
5-
Tested up to: 5.0
5+
Tested up to: 5.1
66
Stable tag: trunk
77
License: GPL v2.0 or later
88
License URI: http://www.opensource.org/licenses/gpl-license.php

tests/bootstrap.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
*/
1414
define( 'WP_USE_THEMES', false );
1515
define( 'WP_TESTS_FORCE_KNOWN_BUGS', true );
16+
define( 'TI_UNIT_TESTING', true );
17+
1618
// Give access to tests_add_filter() function.
1719
require_once $_tests_dir . '/includes/functions.php';
1820
/**

0 commit comments

Comments
 (0)