/**
  * Return a DateTime object of when the event is next scheduled to fire.
  *
  * This method tries to convert the scheduled at time to match a user
  * defined timezone_string. Should timezone be missing it will ues
  * whatever is default.
  * 
  * @param  string $event_name Name of the wp_cron event.
  * @return object|bool		A DateTime instance or false.
  */
 public static function next_sheduled($event_name = '')
 {
     if (false !== ($time = wp_next_scheduled($event_name))) {
         $dt = new \DateTime("@{$time}", new \DateTimeZone('UTC'));
         $tz = Options::get('timezone_string', false);
         return empty($tz) ? $dt : $dt->setTimezone(new \DateTimeZone($tz));
     }
     return false;
 }
 public function build_message($posts, $test)
 {
     $message = __('Hello,', 'drafty-in-here');
     $message .= "\r\n\r\n";
     if ($posts) {
         $message .= sprintf(_n('Right now on %s you have one draft post:', 'Right now on %s you have %s draft posts:', $posts->post_count, 'drafty-in-here'), Options::get('blogname'), $posts->post_count);
     }
     if (!$posts && $test) {
         $message .= sprintf(__('Right now on %s you have zero draft posts:', 'drafty-in-here'), Options::get('blogname'));
     }
     $message .= "\r\n\r\n";
     if ($posts) {
         while ($posts->have_posts()) {
             $posts->the_post();
             $message .= "* " . get_the_title() . " - " . __('last updated', 'drafty-in-here') . ' ' . get_the_date() . "\r\n";
         }
     }
     $message .= "\r\n";
     $message .= __('So what are you waiting for?', 'drafty-in-here');
     $message .= "\r\n";
     if ($posts) {
         $message .= _n('Login and publish it today - like a boss! :-)', 'Login and publish them today - like a boss! :-)', $posts->post_count, 'drafty-in-here');
     }
     if (!$posts && $test) {
         $message .= __('Login and write a new post today - like a boss! :-)', 'drafty-in-here');
     }
     $message .= "\r\n\r\n" . admin_url();
     $message .= "\r\n\r\n-------------------------------------------------------------\r\n\r\n";
     $message .= sprintf(__('E-mail generated by %s', 'drafty-in-here'), 'Drafty In Here');
     return $message;
 }