/**
  * Constructor
  *
  * @mvc Controller
  */
 protected function __construct()
 {
     $this->register_hook_callbacks();
     $this->modules = array('settings' => WPEM_Settings::get_instance(), 'email_templates' => WPEM_Email_Template::get_instance(), 'cron' => WPEM_Cron::get_instance(), 'schedules' => WPEM_Schedules::get_instance(), 'notifications' => WPEM_Notifications::get_instance());
     add_action('wp_ajax_wpem_all_ajax', array($this, 'all_ajax'));
     add_action('wp_ajax_nopriv_wpem_all_ajax', array($this, 'all_ajax'));
 }
예제 #2
0
 /**
  * Fires a cron job at a specific time of day, rather than on an interval
  *
  */
 public static function fire_schedule_jobs()
 {
     $send_time = WPEM()->modules['settings']->settings['schedule']['send_time'];
     $now = current_time('timestamp');
     $trigger_time = strtotime(date('Y-m-d')) + $send_time['hh'] * 3600 + $send_time['mn'] * 60;
     $time_passed = $now - $trigger_time;
     if ($time_passed > 0 && $time_passed < 3600) {
         if (!get_transient('wpem_schedules_cron_job_complete')) {
             WPEM_Schedules::process_schedules();
             set_transient('wpem_schedules_cron_job_complete', true, 60 * 70);
             //1 hour and 10 minutes transient
         }
     }
 }
 function next_send($start_date_str, $frequency, $end_date_str)
 {
     if ($end_date_str + $this->send_time < time()) {
         return false;
     }
     $next_send_str = WPEM_Schedules::next_send($start_date_str, $frequency, $end_date_str, $this->send_time);
     if ($next_send_str) {
         return $next_send_str;
     } else {
         return false;
     }
 }