$form['required'] = $required;
            $options['forms'][] = $form;
        }
    case '1.3.4.4':
    case '1.3.4.5':
    case '1.3.5':
    case '1.3.6':
    case '1.3.6.1':
        add_action('shutdown', array($mymail_templates, 'renew_default_template'));
    case '1.4.0':
    case '1.4.0.1':
        $lists = isset($options['newusers']) ? $options['newusers'] : array();
        $options['register_other_lists'] = $options['register_comment_form_lists'] = $options['register_signup_lists'] = $lists;
        $options['register_comment_form_status'] = array('1', '0');
        if (!empty($lists)) {
            $options['register_other'] = true;
        }
        $texts['newsletter_signup'] = __('Sign up to our newsletter', 'mymail');
        mymail_notice('[1.4.1] New option for WordPress Users! Please <a href="options-general.php?page=newsletter-settings#subscribers">update your settings</a>!');
        mymail_notice('[1.4.1] New text for newsletter sign up Please <a href="options-general.php?page=newsletter-settings#texts">update your settings</a>!');
    default:
}
//do stuff every update
$options['text'] = $texts;
//update options
update_option('mymail_options', $options);
//update caps
$mymail_settings->update_capabilities();
//clear cache
mymail_clear_cache('', true);
flush_rewrite_rules();
 private function flushjobs_autoresponder($id)
 {
     $crons = get_option('cron');
     $count = 0;
     foreach ($crons as $timestamp => $hook) {
         if (!is_array($hook)) {
             continue;
         }
         foreach ($hook as $hash => $args) {
             if ($hash == 'mymail_autoresponder') {
                 foreach ($args as $job) {
                     if (isset($job['args']['campaign_id']) && $job['args']['campaign_id'] == $id) {
                         $count++;
                     }
                     unset($crons[$timestamp]);
                 }
             }
         }
     }
     update_option('cron', $crons);
     mymail_notice(sprintf(_n('%d job deleted', '%d jobs deleted', $count, 'mymail'), $count), NULL, true, 'autorespond-deleted');
     return true;
 }
 /**
  * deactivate function.
  *
  * @access public
  * @return void
  */
 public function deactivate()
 {
     d;
     if (defined('MYMAIL_VERSION') && function_exists('mymail_option') && version_compare(MYMAIL_POSTMAN_REQUIRED_VERSION, MYMAIL_VERSION, '<=')) {
         if (mymail_option('deliverymethod') == MYMAIL_POSTMAN_ID) {
             mymail_update_option('deliverymethod', 'simple');
             /* Translators where %s is the name of the page */
             mymail_notice(sprintf(__('MyMail: Change the delivery method in the %s!', Postman::TEXT_DOMAIN), sprintf('<a href="options-general.php?page=newsletter-settings&mymail_remove_notice=mymail_delivery_method#delivery">%s</a>', __('Settings', 'postman-smtp'))), '', false, 'delivery_method');
         }
     }
 }
 private function __construct()
 {
     $this->deliverymethod = mymail_option('deliverymethod', 'simple');
     $this->dkim = mymail_option('dkim');
     require_once MYMAIL_DIR . '/classes/mail.helper.class.php';
     $this->mailer = new mymail_mail_helper(true);
     if ($this->deliverymethod == 'smtp') {
         $this->mailer->IsSMTP();
         $this->mailer->Host = mymail_option('smtp_host');
         $this->mailer->Port = mymail_option('smtp_port', 25);
         $this->mailer->Timeout = mymail_option('smtp_timeout', 10);
         $this->mailer->SMTPAuth = mymail_option('smtp_auth', false);
         if ($this->mailer->SMTPAuth) {
             $this->mailer->Username = mymail_option('smtp_user');
             $this->mailer->Password = mymail_option('smtp_pwd');
         }
         $this->mailer->SMTPSecure = mymail_option('smtp_secure', '');
         $this->mailer->SMTPKeepAlive = true;
         add_action('mymail_presend', array(&$this, 'pre_send'));
         add_action('mymail_dosend', array(&$this, 'do_send'));
     } else {
         if ($this->deliverymethod == 'gmail') {
             $this->mailer->IsSMTP();
             $this->mailer->Host = 'smtp.googlemail.com';
             $this->mailer->Port = 587;
             $this->mailer->SMTPAuth = true;
             $this->mailer->Username = mymail_option('gmail_user');
             $this->mailer->Password = mymail_option('gmail_pwd');
             $this->mailer->SMTPSecure = 'tls';
             $this->mailer->SMTPKeepAlive = true;
             add_action('mymail_presend', array(&$this, 'pre_send'));
             add_action('mymail_dosend', array(&$this, 'do_send'));
         } else {
             if ($this->deliverymethod == 'simple') {
                 $method = mymail_option('simplemethod', 'sendmail');
                 if ($method == 'sendmail') {
                     $this->mailer->Sendmail = mymail_option('sendmail_path');
                     if (empty($this->mailer->Sendmail)) {
                         $this->mailer->Sendmail = '/usr/sbin/sendmail';
                     }
                     $this->mailer->IsSendmail();
                 } else {
                     if ($method == 'qmail') {
                         $this->mailer->IsQmail();
                     } else {
                         $this->mailer->IsMail();
                     }
                 }
                 add_action('mymail_presend', array(&$this, 'pre_send'));
                 add_action('mymail_dosend', array(&$this, 'do_send'));
             } else {
                 do_action('mymail_initsend', $this);
             }
         }
     }
     if ($this->dkim) {
         $this->mailer->DKIM_selector = mymail_option('dkim_selector');
         $this->mailer->DKIM_domain = mymail_option('dkim_domain');
         $folder = MYMAIL_UPLOAD_DIR . '/dkim';
         $this->mailer->DKIM_private = $folder . '/' . mymail_option('dkim_private_hash') . '.pem';
         $this->mailer->DKIM_passphrase = mymail_option('dkim_passphrase');
         $this->mailer->DKIM_identity = mymail_option('dkim_identity');
     }
     $this->from = mymail_option('from');
     $this->from_name = mymail_option('from_name');
     $this->send_limit = mymail_option('send_limit');
     if (!get_transient('_mymail_send_period_timeout')) {
         set_transient('_mymail_send_period_timeout', true, mymail_option('send_period') * 3600);
     } else {
         $this->sent_within_period = get_transient('_mymail_send_period');
         if (!$this->sent_within_period) {
             $this->sent_within_period = 0;
         }
     }
     $this->sentlimitreached = $this->sent_within_period >= $this->send_limit;
     if ($this->sentlimitreached) {
         $msg = sprintf(__('Sent limit of %1$s reached! You have to wait %2$s before you can send more mails!', 'mymail'), '<strong>' . $this->send_limit . '</strong>', '<strong>' . human_time_diff(get_option('_transient_timeout__mymail_send_period_timeout')) . '</strong>');
         mymail_notice($msg, 'error', false, 'dailylimit');
     } else {
         mymail_remove_notice('dailylimit');
     }
 }
 private function check_homepage()
 {
     $hp = get_permalink(mymail_option('homepage'));
     if (!$hp) {
         mymail_notice(sprintf('<strong>' . __('You haven\'t defined a homepage for the newsletter. This is required to make the subscription form work correctly. Please check the %s', 'mymail'), '<a href="options-general.php?page=newsletter-settings#frontend">' . __('frontend settings page', 'mymail') . '</a>') . '</strong>', 'error', false, 'no-homepage');
     }
 }
 /**
  * deactivate function.
  *
  * @access public
  * @return void
  */
 public function deactivate()
 {
     if (defined('MYMAIL_VERSION') && function_exists('mymail_option') && version_compare(MYMAIL_POSTMAN_REQUIRED_VERSION, MYMAIL_VERSION, '<=')) {
         if (mymail_option('deliverymethod') == MYMAIL_POSTMAN_ID) {
             mymail_update_option('deliverymethod', 'simple');
             mymail_notice(sprintf(__('Change the delivery method on the %s!', 'MYMAIL_POSTMAN'), '<a href="options-general.php?page=newsletter-settings&mymail_remove_notice=mymail_delivery_method#delivery">Settings Page</a>'), '', false, 'delivery_method');
         }
     }
 }
require_once MYMAIL_DIR . '/classes/manage.class.php';
require_once MYMAIL_DIR . '/classes/templates.class.php';
require_once MYMAIL_DIR . '/classes/widget.class.php';
require_once MYMAIL_DIR . '/classes/autoresponder.class.php';
global $mymail_options, $mymail, $mymail_subscriber, $mymail_templates, $mymail_settings, $mymail_manage, $mymail_autoresponder, $mymail_notices, $mymail_mytags;
$mymail_options = get_option('mymail_options');
$mymail = new mymail();
$mymail_subscriber = new mymail_subscriber();
$mymail_templates = new mymail_templates();
$mymail_autoresponder = new mymail_autoresponder();
$mymail_manage = new mymail_manage();
$mymail_settings = new mymail_settings();
add_action('widgets_init', create_function('', 'register_widget( "mymail_signup" );register_widget( "mymail_list_newsletter" );'));
if (mymail_option('system_mail')) {
    if (function_exists('wp_mail')) {
        mymail_notice('function <strong>wp_mail</strong> already exists from a different plugin! Please disable it before using MyMails wp_mail alternative!', 'error', true);
    } else {
        function wp_mail($to, $subject, $message, $headers = '', $attachments = array())
        {
            $message = str_replace(array('<br>', '<br />'), "\n", $message);
            $message = preg_replace('/(?:(?:\\r\\n|\\r|\\n)\\s*){2}/s', "\n", $message);
            $message = wpautop($message, true);
            $template = mymail_option('system_mail_template', 'notification.html');
            return mymail_wp_mail($to, $subject, $message, $headers, $attachments, $template);
        }
        function mymail_password_reset_link_fix($message, $key)
        {
            $str = network_site_url("wp-login.php?action=rp&key={$key}");
            return str_replace('<' . $str, $str, $message);
        }
        add_filter('retrieve_password_message', 'mymail_password_reset_link_fix', 10, 2);