PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.11.7
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.11.7
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/Setup.php +7 -67 4.0.43.11.7 View file →
@@ -122,9 +122,9 @@
122 122 $charts['scheduled'] = $charts['scheduled'] + 1;
123 123 }
124 124
125 125 if ( Visualizer_Module::is_pro() ) {
126 - $permissions = get_post_meta( $chart_id, Visualizer_Pro::CF_PERMISSIONS, true );
126 + $permissions = get_post_meta( $chart_id, Visualizer_PRO::CF_PERMISSIONS, true );
127 127 if ( empty( $permissions ) ) {
128 128 continue;
129 129 }
130 130 $permissions = $permissions['permissions'];
@@ -208,12 +208,13 @@
208 208 /**
209 209 * Activates the plugin on a particular blog instance (supports multisite and single site).
210 210 */
211 211 private function activate_on_site() {
212 - $this->schedule_refresh_db_action();
212 + wp_clear_scheduled_hook( 'visualizer_schedule_refresh_db' );
213 + wp_schedule_event( strtotime( 'midnight' ) - get_option( 'gmt_offset' ) * HOUR_IN_SECONDS, apply_filters( 'visualizer_chart_schedule_interval', 'visualizer_ten_minutes' ), 'visualizer_schedule_refresh_db' );
213 214 add_option( 'visualizer-activated', true );
214 215 $is_fresh_install = get_option( 'visualizer_fresh_install', false );
215 - if ( ! defined( 'TI_E2E_TESTING' ) && false === $is_fresh_install ) {
216 + if ( ! defined( 'TI_CYPRESS_TESTING' ) && false === $is_fresh_install ) {
216 217 update_option( 'visualizer_fresh_install', '1' );
217 218 }
218 219 }
219 220
@@ -235,9 +236,9 @@
235 236 /**
236 237 * Deactivates the plugin on a particular blog instance (supports multisite and single site).
237 238 */
238 239 private function deactivate_on_site() {
239 - $this->unschedule_refresh_db_action();
240 + wp_clear_scheduled_hook( 'visualizer_schedule_refresh_db' );
240 241 delete_option( 'visualizer-activated', true );
241 242 }
242 243
243 244 /**
@@ -251,23 +252,12 @@
251 252 define( 'VISUALIZER_SURVEY', Visualizer_Module::is_pro() ? 'https://forms.gle/7Zo7FuZbvQ8DTvRi6' : 'https://forms.gle/muMtbcyvHn1aTvmJ7' );
252 253 // fire any upgrades necessary.
253 254 Visualizer_Module_Upgrade::upgrade();
254 255
255 - $activated_flag = get_option( 'visualizer-activated' );
256 - $fresh_install = get_option( 'visualizer_fresh_install', false );
257 - $is_pro = Visualizer_Module::is_pro();
258 - if ( $activated_flag ) {
259 - if ( function_exists( 'wp_doing_ajax' ) && wp_doing_ajax() ) {
260 - // Defer redirect until a normal admin request.
261 - return;
262 - }
263 - if ( wp_doing_cron() ) {
264 - // Defer redirect during cron requests.
265 - return;
266 - }
256 + if ( get_option( 'visualizer-activated' ) ) {
267 257 delete_option( 'visualizer-activated' );
268 258 if ( ! headers_sent() ) {
269 - if ( ! $is_pro && ! empty( $fresh_install ) ) {
259 + if ( ! Visualizer_Module::is_pro() && ! empty( get_option( 'visualizer_fresh_install', false ) ) ) {
270 260 $redirect_url = array(
271 261 'page' => 'visualizer-setup-wizard',
272 262 'tab' => '#step-1',
273 263 );
@@ -477,56 +467,6 @@
477 467 'display' => __( 'Every 10 minutes', 'visualizer' ),
478 468 );
479 469
480 470 return $schedules;
481 - }
482 -
483 - /**
484 - * Schedule the recurring DB refresh action.
485 - */
486 - private function schedule_refresh_db_action(): void {
487 - $hook = 'visualizer_schedule_refresh_db';
488 - $group = 'visualizer';
489 - $interval_key = apply_filters( 'visualizer_chart_schedule_interval', 'visualizer_ten_minutes' );
490 - $interval = $this->get_schedule_interval_seconds( $interval_key );
491 - $timestamp = strtotime( 'midnight' ) - get_option( 'gmt_offset' ) * HOUR_IN_SECONDS;
492 -
493 - if ( function_exists( 'as_next_scheduled_action' ) && function_exists( 'as_schedule_recurring_action' ) ) {
494 - $next = as_next_scheduled_action( $hook, array(), $group );
495 - if ( false === $next ) {
496 - as_schedule_recurring_action( $timestamp, $interval, $hook, array(), $group );
497 - }
498 - wp_clear_scheduled_hook( $hook );
499 - return;
500 - }
501 -
502 - wp_clear_scheduled_hook( $hook );
503 - wp_schedule_event( $timestamp, $interval_key, $hook );
504 - }
505 -
506 - /**
507 - * Unschedule the recurring DB refresh action.
508 - */
509 - private function unschedule_refresh_db_action(): void {
510 - $hook = 'visualizer_schedule_refresh_db';
511 - $group = 'visualizer';
512 - if ( function_exists( 'as_unschedule_all_actions' ) ) {
513 - as_unschedule_all_actions( $hook, array(), $group );
514 - }
515 - wp_clear_scheduled_hook( $hook );
516 - }
517 -
518 - /**
519 - * Resolve a cron schedule key to seconds.
520 - *
521 - * @param string $interval_key Cron schedule key.
522 - * @return int Interval in seconds.
523 - */
524 - private function get_schedule_interval_seconds( $interval_key ) {
525 - $schedules = wp_get_schedules();
526 - if ( isset( $schedules[ $interval_key ]['interval'] ) ) {
527 - return (int) $schedules[ $interval_key ]['interval'];
528 - }
529 -
530 - return 600;
531 471 }
532 472 }