[ Index ]

MailPress 544

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

title

Body

[close]

/mp-includes/class/ -> MP_newsletter_.class.php (source)

   1  <?php
   2  abstract class MP_newsletter_
   3  {
   4  	function __construct($desc)
   5      {
   6          $this->desc = $desc;
   7  
   8          $this->time = current_time('timestamp');
   9  
  10          $this->date  = gmdate('Y-m-d H:i:s', $this->time);
  11          $this->year  = (int) gmdate('Y', $this->time);
  12          $this->month = (int) gmdate('m', $this->time);
  13          $this->day   = (int) gmdate('j', $this->time);
  14          $this->hour  = (int) gmdate('H', $this->time);
  15          $this->minute= (int) gmdate('i', $this->time);
  16  
  17          $this->wday  = (int) gmdate('w', $this->time);
  18  
  19          add_filter('MailPress_newsletter_' . $this->args . 's_register',    array($this, 'register'), 8, 1);
  20      }
  21  
  22  	function register($x) { $x[$this->id] = $this->desc; return $x; }
  23  
  24  	function get_day($y, $m) 
  25      {
  26          $d = (isset($this->newsletter[$this->args]['args']['day'])) ? (int) $this->newsletter[$this->args]['args']['day'] : 1;
  27  
  28          $max_days = array(31,((($y%4==0)&&((!($y%100==0))||($y%400==0)))?29:28),31,30,31,30,31,31,30,31,30,31);
  29          $max_day  = $max_days[$m - 1];
  30  
  31          return (!is_numeric($d)) ? 1 : (($d <= 0 || $d > $max_day) ? $max_day : $d);
  32      }
  33  
  34  	function get_wday() 
  35      {
  36          $w = (isset($this->newsletter[$this->args]['args']['wday']) && is_numeric($this->newsletter[$this->args]['args']['wday'])) ? $this->newsletter[$this->args]['args']['wday'] : get_option('start_of_week');
  37          if ( $w === false)     $w = 1;
  38          if ( $w == 7 )         $w = 0;
  39          return (!is_numeric($w) || $w < 0 || $w > 6) ? 1 : $w;
  40      }
  41  
  42  	function get_hour() 
  43      {
  44          $h = (isset($this->newsletter[$this->args]['args']['hour'])) ? (int) $this->newsletter[$this->args]['args']['hour'] : 0;
  45          return (!is_numeric($h) || $h < 0 || $h > 23) ? 0 : $h;
  46      }
  47  
  48  	function get_minute() 
  49      {
  50          $i = (isset($this->newsletter[$this->args]['args']['minute'])) ? (int) $this->newsletter[$this->args]['args']['minute'] : 0;
  51          return (!is_numeric($i) || $i < 0 || $i > 59) ? 0 : $i;
  52      }
  53  
  54  	function mktime( $h, $i, $s, $m, $d, $y )
  55      {
  56          return gmmktime( $h, $i, $s, $m, $d, $y ) - get_option('gmt_offset') * 3600;
  57      }
  58  }


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