Beispiel #1
0
 /**
  * Deactivation (captain) hook
  */
 public static function deactivate()
 {
     \SimpleSubscribe\Cron::unscheduleCronEvents();
 }
Beispiel #2
0
 /**
  * What shall we do, what shall we do? :D
  *
  * @param $post
  */
 public function onPublish($post)
 {
     // settings
     $timing = $this->settings->getTiming();
     $inCategory = $this->settings->inCategory($post);
     if ($post->post_type == 'post' && $inCategory) {
         switch ($timing) {
             case 1:
                 \SimpleSubscribe\Cron::scheduleCron(Utils::NINE_AM, $post->ID);
                 $this->log->add(1, 'Cron scheduled, 9AM for Post ID: ' . $post->ID);
                 break;
             case 2:
                 \SimpleSubscribe\Cron::scheduleCron(Utils::NINE_PM, $post->ID);
                 $this->log->add(1, 'Cron scheduled, 9PM for Post ID: ' . $post->ID);
                 break;
             case 0:
             default:
                 $this->email->onPublish($post);
                 break;
         }
     }
 }