PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.0.2
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.0.2
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 3.10.4 All 148 releases
← All changes | classes/Visualizer/Module.php +1 -73 3.0.93.0.2 View file →
@@ -62,12 +62,8 @@
62 62 global $wpdb;
63 63
64 64 $this->_wpdb = $wpdb;
65 65 $this->_plugin = $plugin;
66 -
67 - $this->_addFilter( Visualizer_Plugin::FILTER_UNDO_REVISIONS, 'undoRevisions', 10, 2 );
68 - $this->_addFilter( Visualizer_Plugin::FILTER_HANDLE_REVISIONS, 'handleExistingRevisions', 10, 2 );
69 -
70 66 }
71 67
72 68 /**
73 69 * Registers an action hook.
@@ -260,9 +256,9 @@
260 256 $xlsData = '';
261 257 if ( class_exists( 'PHPExcel' ) ) {
262 258 $doc = new PHPExcel();
263 259 $doc->getActiveSheet()->fromArray( $rows, null, 'A1' );
264 - $doc->getActiveSheet()->setTitle( sanitize_title( $chart ) );
260 + $doc->getActiveSheet()->setTitle( $chart );
265 261 $doc = apply_filters( 'visualizer_excel_doc', $doc );
266 262 $writer = PHPExcel_IOFactory::createWriter( $doc, 'Excel2007' );
267 263 ob_start();
268 264 $writer->save( 'php://output' );
@@ -324,75 +320,7 @@
324 320 </html>';
325 321 return array(
326 322 'csv' => $html,
327 323 );
328 - }
329 -
330 - /**
331 - * Undo revisions for the chart, and if necessary, restore the earliest version.
332 - *
333 - * @return bool If any revisions were found.
334 - */
335 - public final function undoRevisions( $chart_id, $restore = false ) {
336 - do_action( 'themeisle_log_event', Visualizer_Plugin::NAME, sprintf( 'undoRevisions for %d with%s restore', $chart_id, ( $restore ? '' : 'out' ) ), 'debug', __FILE__, __LINE__ );
337 -
338 - $revisions = wp_get_post_revisions( $chart_id, array( 'order' => 'ASC' ) );
339 - if ( count( $revisions ) > 1 ) {
340 - $revision_ids = array_keys( $revisions );
341 -
342 - do_action( 'themeisle_log_event', Visualizer_Plugin::NAME, sprintf( 'found %d revisions = %s', count( $revisions ), print_r( $revision_ids, true ) ), 'debug', __FILE__, __LINE__ );
343 -
344 - // when we restore, a new revision is likely to be created. so, let's disable revisions for the time being.
345 - add_filter( 'wp_revisions_to_keep', '__return_false' );
346 -
347 - if ( $restore ) {
348 - // restore to the oldest one i.e. the first one.
349 - wp_restore_post_revision( array_shift( $revision_ids ) );
350 - }
351 -
352 - // delete all revisions.
353 - foreach ( $revision_ids as $id ) {
354 - wp_delete_post_revision( $id );
355 - }
356 -
357 - return true;
358 - }
359 - return false;
360 - }
361 -
362 - /**
363 - * If existing revisions exist for the chart, restore the earliest version and then create a new revision to initiate editing.
364 - */
365 - public final function handleExistingRevisions( $chart_id, $chart ) {
366 - do_action( 'themeisle_log_event', Visualizer_Plugin::NAME, sprintf( 'handleExistingRevisions for %d', $chart_id ), 'debug', __FILE__, __LINE__ );
367 -
368 - // undo revisions.
369 - $revisions_found = $this->undoRevisions( $chart_id, true );
370 -
371 - // create revision for the edit action.
372 - wp_save_post_revision( $chart_id );
373 -
374 - if ( $revisions_found ) {
375 - // fetch chart data again in case it was updated by an earlier revision.
376 - $chart = get_post( $chart_id );
377 - }
378 - return $chart;
379 - }
380 -
381 - /**
382 - * Returns the language of the locale.
383 - *
384 - * @access protected
385 - */
386 - protected function get_language() {
387 - $locale = get_locale();
388 - if ( empty( $locale ) ) {
389 - return '';
390 - }
391 - $array = explode( '_', $locale );
392 - if ( count( $array ) < 2 ) {
393 - return '';
394 - }
395 - return reset( $array );
396 324 }
397 325
398 326 }