[ Index ]

MailPress 7.2

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

title

Body

[close]

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

   1  <?php
   2  class MP_Newsletter_processor_week_1 extends MP_newsletter_processor_
   3  {
   4      public $id = 'week-1';
   5  
   6  	function get_bounds() 
   7      {
   8          $time = $this->time;
   9  
  10          $format = 'Y-m-d ' . zeroise( $this->get_hour(), 2 ) . ':' . zeroise( $this->get_minute(), 2 ) . ':00';
  11  
  12          $first_wday = $this->get_wday();
  13  
  14          while ( wp_date( 'w', $time ) != $first_wday ) $time -= DAY_IN_SECONDS;
  15  
  16          $this->upper_bound = wp_date( $format, $time );
  17  
  18          if ( $this->upper_bound > $this->date )
  19          {
  20              $time -= WEEK_IN_SECONDS;
  21              $this->upper_bound = date( $format, $time );
  22          }
  23  
  24          $this->lower_bound = wp_date( $format, $time - WEEK_IN_SECONDS );
  25  
  26          switch ( true )
  27          {
  28              case ( isset( $this->options['threshold'] ) ) :            // old old format
  29                  $y = substr( $this->options['threshold'], 0, 4 );
  30                  $w = substr( $this->options['threshold'], 4, 2 );
  31                  $this->old_lower_bound = date( 'Y-m-d 00:00:00', strtotime( "{$y}W{$w}1" ) );
  32              break;
  33              case ( isset( $this->options['end_of_week'] ) ) :         // old format
  34                  $this->old_lower_bound = date( 'Y-m-d 00:00:00', $this->options['end_of_week'] + DAY_IN_SECONDS );
  35              break;
  36              default :
  37                  $this->get_old_lower_bound();
  38              break;
  39          }
  40      }
  41  }
  42  new MP_Newsletter_processor_week_1( __( 'Previous week', 'MailPress' ) );


Generated: Tue May 19 15:55:14 2020 Cross-referenced by PHPXref 0.7.1