[ Index ]

MailPress 544

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

title

Body

[close]

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

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


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