[ Index ]

MailPress 544

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

title

Body

[close]

/mp-admin/includes/settings/ -> batches.php (source)

   1  <?php
   2  $mp_general['tab'] = 'batches';
   3  $message = false;
   4  
   5  if (class_exists('MailPress_batch_send'))
   6  {
   7      $batch_send    = $_POST['batch_send'];
   8  
   9      $old_batch_send = get_option(MailPress_batch_send::option_name);
  10  
  11      update_option(MailPress_batch_send::option_name, $batch_send);
  12  
  13      if (!isset($old_batch_send['batch_mode'])) $old_batch_send['batch_mode'] = '';
  14      if ($old_batch_send['batch_mode'] != $batch_send['batch_mode'])
  15      {
  16          if ('wpcron' != $batch_send['batch_mode']) wp_clear_scheduled_hook('mp_process_batch_send');
  17          else                             MailPress_batch_send::schedule();
  18      }
  19  }
  20  
  21  if (class_exists('MailPress_batch_spool_send'))
  22  {
  23      $batch_spool_send = $_POST['batch_spool_send'];
  24       $batch_spool_send['path'] = trim(stripslashes($batch_spool_send['path']));
  25  
  26      $old_batch_spool_send = get_option(MailPress_batch_spool_send::option_name);
  27  
  28      switch (true)
  29      {
  30          case ( !empty($batch_spool_send['path']) && !MailPress_batch_spool_send::is_path($batch_spool_send['path']) ) :
  31              $spoolpath = true;
  32              $message = __('path is invalid', MP_TXTDOM); $no_error = false;
  33          break;
  34          default :
  35              update_option(MailPress_batch_spool_send::option_name, $batch_spool_send);
  36      
  37              if (empty($batch_spool_send['path']) && !is_dir(MP_ABSPATH . 'tmp/spool')) mkdir(MP_ABSPATH . 'tmp/spool');
  38  
  39              if (!isset($old_batch_spool_send['batch_mode'])) $old_batch_spool_send['batch_mode'] = '';
  40              if ($old_batch_spool_send['batch_mode'] != $batch_spool_send['batch_mode'])
  41              {
  42                  if ('wpcron' != $batch_spool_send['batch_mode']) wp_clear_scheduled_hook('mp_process_batch_spool_send');
  43                  else                                      MailPress_batch_spool_send::schedule();
  44              }
  45          break;
  46      }
  47  
  48  }
  49  
  50  if (class_exists('MailPress_bounce_handling'))
  51  {
  52      $bounce_handling    = $_POST['bounce_handling'];
  53  
  54      $old_bounce_handling = get_option(MailPress_bounce_handling::option_name);
  55  
  56      update_option(MailPress_bounce_handling::option_name, $bounce_handling);
  57  
  58      if (!isset($old_bounce_handling['batch_mode'])) $old_bounce_handling['batch_mode'] = '';
  59      if ($old_bounce_handling['batch_mode'] != $bounce_handling['batch_mode'])
  60      {
  61          if ('wpcron' != $bounce_handling['batch_mode']) wp_clear_scheduled_hook('mp_process_bounce_handling');
  62          else                                 MailPress_bounce_handling::schedule();
  63      }
  64  }
  65  
  66  if (class_exists('MailPress_bounce_handling_II'))
  67  {
  68      $bounce_handling_II    = $_POST['bounce_handling_II'];
  69  
  70      $old_bounce_handling = get_option(MailPress_bounce_handling_II::option_name);
  71  
  72      update_option(MailPress_bounce_handling_II::option_name, $bounce_handling_II);
  73  
  74      if (!isset($old_bounce_handling['batch_mode'])) $old_bounce_handling['batch_mode'] = '';
  75      if ($old_bounce_handling['batch_mode'] != $bounce_handling_II['batch_mode'])
  76      {
  77          if ('wpcron' != $bounce_handling_II['batch_mode']) wp_clear_scheduled_hook('mp_process_bounce_handling_II');
  78          else                                 MailPress_bounce_handling_II::schedule();
  79      }
  80  }
  81  
  82  if (class_exists('MailPress_delete_old_mails'))
  83  {
  84      $batch_delete_old_mails    = $_POST['batch_delete_old_mails'];
  85  
  86      $old_delete_old_mails = get_option(MailPress_delete_old_mails::option_name);
  87  
  88      update_option(MailPress_delete_old_mails::option_name, $batch_delete_old_mails);
  89  
  90      if (!isset($old_delete_old_mails['batch_mode'])) $old_delete_old_mails['batch_mode'] = '';
  91      if ($old_delete_old_mails['batch_mode'] != $batch_delete_old_mails['batch_mode'])
  92      {
  93          if ('wpcron' != $batch_delete_old_mails['batch_mode'])     wp_clear_scheduled_hook('mp_process_delete_old_mails');
  94          else                                         MailPress_delete_old_mails::schedule();
  95      }
  96  }
  97  
  98  update_option(MailPress::option_name_general, $mp_general);
  99  
 100  if (!$message) $message = __("'Batches' settings saved", MP_TXTDOM);


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