public function user_update()
 {
     if (!tribe_is_event($this->event_id)) {
         return;
     }
     $notice = __('Recurring event data is still being generated for this event. Don’t worry, you can safely navigate away – the process will resume in a bit in the background.', 'tribe-events-pro');
     $percent = $this->sanitize_progress($this->queue->progress_percentage());
     $spinner = '<img src="' . get_admin_url(null, '/images/spinner.gif') . '">';
     $indicator = '<div> <div class="progress" title="' . sprintf(__('%d%% complete', 'tribe-events-pro'), $percent) . '"> <div class="bar"></div> </div>' . $spinner . '</div>';
     return "<p> {$notice} </p> {$indicator}";
 }
Ejemplo n.º 2
0
 public function ajax()
 {
     $event_id = (int) $_POST['event'];
     // Nonce check
     if (!wp_verify_nonce($_POST['check'], 'generate_recurring_instances_' . $event_id . get_current_user_id())) {
         exit(json_encode(array('html' => __('Unable to continue processing recurring event data. Please reload this page to continue/try again.', 'tribe-events-pro'), 'progress' => false, 'continue' => false, 'complete' => false)));
     }
     // Load the queue
     $queue = new Tribe__Events__Pro__Recurrence__Queue($event_id);
     if (!$queue->is_empty()) {
         Tribe__Events__Pro__Main::instance()->queue_processor->process_batch($event_id);
     }
     $done = $queue->is_empty();
     $percentage = $queue->progress_percentage();
     exit(json_encode(array('html' => false, 'progress' => $percentage, 'progressText' => sprintf(__('%d%% complete', 'tribe-events-pro'), $percentage), 'continue' => !$done, 'complete' => $done)));
 }