/** * Send email by list email * * @param Object $dataTemplates Data tempalte * * @param Array $listEmail List email * * @param Array $fileAttach File Attach * * @return boolean */ private function send_email_list($dataTemplates, $listEmail, $fileAttach = null) { $regex = '/^[_a-zA-Z0-9-]+(\\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)*(\\.[a-zA-Z]{2,6})$/'; add_filter('wp_mail_content_type', array(&$this, 'set_html_content_type')); if (!empty($listEmail) && is_array($listEmail) && count($listEmail)) { $headers[] = 'From: ' . $dataTemplates['from']; $subject = $dataTemplates['subject']; $body = $dataTemplates['message']; $to = ''; $attachments = array(); $message = stripslashes($body); if (!empty($dataTemplates['reply']) && preg_match($regex, $dataTemplates['reply'])) { $headers[] = 'Reply-To: ' . $dataTemplates['reply'] . ' <' . $dataTemplates['reply'] . '>'; } if (!empty($dataTemplates['attach']) && !empty($fileAttach)) { $attach = $dataTemplates['attach']; if (!empty($attach)) { foreach ($attach as $file) { if (!empty($fileAttach[$file])) { foreach ($fileAttach[$file] as $f) { $attachments[] = $f; } } } } } // Add filter wp_mail global $wr_contactform_mail_args; if (empty($dataTemplates['from'])) { $wr_contactform_mail_args['from'] = get_option('wr_contactform_default_mail_from', WR_Contactform_Helpers_Contactform::get_default_mail_from()); } else { $wr_contactform_mail_args['from'] = $dataTemplates['from']; } $wr_contactform_mail_args['from_name'] = $dataTemplates['from']; add_filter('wp_mail_from', array($this, 'set_mail_from'), 9, 1); add_filter('wp_mail_from_name', array($this, 'set_mail_from_name'), 9, 1); foreach ($listEmail as $email) { if (preg_match($regex, $email)) { wp_mail($email, $subject, $message, $headers, $attachments); } } // Reset content-type to avoid conflicts -- http://core.trac.wordpress.org/ticket/23578 remove_filter('wp_mail_content_type', array(&$this, 'set_html_content_type')); } }
$autoload = 'no'; add_option($key, $value, $deprecated, $autoload); } } } $loadBootstrapCss = get_option('wr_contactform_load_bootstrap_css', 1); $checkLoadCssBootstrap = ''; if ($loadBootstrapCss != '0' && $loadBootstrapCss != 0) { $checkLoadCssBootstrap = 'checked="checked" '; } $loadBootstrapJs = get_option('wr_contactform_load_bootstrap_js', 1); $checkLoadJsBootstrap = ''; if ($loadBootstrapJs != '0' && $loadBootstrapJs != 0) { $checkLoadJsBootstrap = 'checked="checked" '; } $default_mail_from = get_option('wr_contactform_default_mail_from', WR_Contactform_Helpers_Contactform::get_default_mail_from()); // Captcha setting $global_captcha_setting = get_option('wr_contactform_global_captcha_setting', 2); $check_enable_captcha_all = ''; $check_disable_captcha_all = ''; $check_use_individual_setting = ''; switch ($global_captcha_setting) { case 1: $check_enable_captcha_all = ' checked="checked"'; break; case 0: $check_disable_captcha_all = ' checked="checked"'; break; default: $check_use_individual_setting = ' checked="checked"'; }