[ Index ]

MailPress 544

[ Index ]     [ Classes ]     [ Functions ]     [ Variables ]     [ Constants ]     [ Statistics ]    

title

Body

[close]

/mp-includes/class/options/newsletter/processors/ -> day-1.php (source)

   1  <?php
   2  class MP_Newsletter_processor_day_1 extends MP_newsletter_processor_
   3  {
   4      const day_in_sec  = 86400;  // 24*60*60
   5  
   6      public $id = 'day-1';
   7  
   8  	function get_bounds() 
   9      {
  10          $d = $this->time;
  11  
  12          $h = $this->get_hour();
  13          $i = $this->get_minute();
  14  
  15          $format = 'Y-m-d ' . zeroise($h, 2) . ':' . zeroise($i, 2) . ':00';
  16  
  17          $this->upper_bound = date($format, $d);
  18  
  19          if ($this->upper_bound > $this->date)
  20          {
  21              $d -= self::day_in_sec;
  22              $this->upper_bound = date($format, $d);
  23          }
  24  
  25          $this->lower_bound = date($format, $d - self::day_in_sec);
  26  
  27          switch (true)
  28          {
  29              case (isset($this->options['threshold'])) :            // old format
  30                  $y = substr($this->options['threshold'], 0, 4);
  31                  $m = substr($this->options['threshold'], 4, 2);
  32                  $j = substr($this->options['threshold'], 6, 2);
  33                  $this->old_lower_bound = "{$y}-{$m}-{$j} 00:00:00";
  34              break;
  35              default :
  36                  $this->get_old_lower_bound();
  37              break;
  38          }
  39      }
  40  
  41  	function query_posts($query_posts = array()) 
  42      { 
  43          if (    substr($this->lower_bound, 11, 8) == '00:00:00' && 
  44              substr($this->upper_bound, 11, 8) == '00:00:00'    )
  45          {
  46              $query_posts['m'] = date('Ymd', $this->time - self::day_in_sec);
  47              return $query_posts;
  48          }
  49  
  50          $this->add_filter();
  51          return $query_posts;
  52      }
  53  }
  54  new MP_Newsletter_processor_day_1(__('Previous day', MP_TXTDOM));


Generated: Thu Apr 28 18:38:52 2016 Cross-referenced by PHPXref 0.7.1