[ Index ]

MailPress 544

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

title

Body

[close]

/mp-admin/includes/install/ -> newsletter.php (source)

   1  <?php
   2  
   3  /* Newsletter install */
   4  
   5  global $wpdb, $mp_general;
   6  $mp_general = get_option(MailPress::option_name_general);
   7  
   8  //////////////////////////////////
   9  //// Install                  ////
  10  //////////////////////////////////
  11  
  12  //    To avoid mailing existing published post
  13  $post_meta = '_MailPress_prior_to_install';
  14  $ids = $wpdb->get_results( "SELECT ID FROM $wpdb->posts WHERE post_status = 'publish' ;" );
  15  if ($ids) 
  16      foreach ($ids as $id) 
  17          if (!get_post_meta($id->ID, $post_meta, true)) add_post_meta($id->ID, $post_meta, 'yes', true);
  18  
  19  //////////////////////////////////
  20  //// From older versions      ////
  21  //////////////////////////////////
  22  
  23  $older_versions = false;
  24  
  25  if (!isset($mp_general['newsletters']))
  26  {
  27      $x = array('new_post','daily','weekly','monthly');
  28      $newsletters = array();
  29  
  30      foreach ($x as $n)
  31      {
  32          if (isset($mp_general[$n]))
  33          {
  34              $older_versions = true;
  35              $newsletters[$n] = true;
  36              unset($mp_general[$n]);
  37          }
  38      }
  39  
  40      if ($older_versions)
  41      {
  42          $mp_general['newsletters'] = $newsletters;
  43          update_option ('MailPress_general', $mp_general);
  44      }
  45  }
  46  
  47  $x = false;
  48  $x = get_option ('MailPress_daily');
  49  if ($x && !is_array($x)) update_option('MailPress_daily', array('threshold'=>$x));
  50  $x = false;
  51  $x = get_option ('MailPress_weekly');
  52  if ($x && !is_array($x)) update_option('MailPress_weekly', array('threshold'=>$x));
  53  $x = false;
  54  $x = get_option ('MailPress_monthly');
  55  if ($x && !is_array($x)) update_option('MailPress_monthly', array('threshold'=>$x));
  56  
  57  //////////////////////////////////
  58  //// Upgrade to MailPress 4.0 ////
  59  //////////////////////////////////
  60  
  61  // done in mailpress install
  62  
  63  //////////////////////////////////
  64  //// Upgrade to MailPress 5.0 ////
  65  //////////////////////////////////


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