コード例 #1
0
ファイル: es-af-register.php プロジェクト: phuocdungit/fundy
 public static function es_af_preparation($es_af_name = "", $es_af_email = "", $es_af_group = array())
 {
     $sts = "";
     $data = es_cls_settings::es_setting_select(1);
     $form = array('es_email_name' => '', 'es_email_status' => '', 'es_email_group' => '', 'es_email_mail' => '');
     $email_saved_single_opt_in = 0;
     $email_saved_double_opt_in = 0;
     $email_already_exists = 0;
     $es_af_group_count = count($es_af_group);
     if ($es_af_group_count > 0) {
         for ($i = 0; $i < $es_af_group_count; $i++) {
             $form['es_email_name'] = $es_af_name;
             $form['es_email_mail'] = $es_af_email;
             $form['es_email_group'] = $es_af_group[$i];
             if ($data['es_c_optinoption'] == "Double Opt In") {
                 $form['es_email_status'] = "Unconfirmed";
             } else {
                 $form['es_email_status'] = "Single Opt In";
             }
             $action = es_cls_dbquery::es_view_subscriber_widget($form);
             if ($action == "sus") {
                 $subscribers = array();
                 $subscribers = es_cls_dbquery::es_view_subscriber_one($form['es_email_mail']);
                 if ($data['es_c_optinoption'] == "Double Opt In") {
                     if ($email_saved_double_opt_in == 0) {
                         es_cls_sendmail::es_sendmail("optin", $template = 0, $subscribers, "optin", 0);
                     }
                     $email_saved_double_opt_in = $email_saved_double_opt_in + 1;
                 } else {
                     if ($data['es_c_usermailoption'] == "YES") {
                         if ($email_saved_single_opt_in == 0) {
                             es_cls_sendmail::es_sendmail("welcome", $template = 0, $subscribers, "welcome", 0);
                         }
                     }
                     $email_saved_single_opt_in = $email_saved_single_opt_in + 1;
                 }
             } elseif ($action == "ext") {
                 $email_already_exists = $email_already_exists + 1;
             }
         }
     }
     if ($email_saved_double_opt_in > 0) {
         $sts = "double_opt_in_saved";
     } elseif ($email_saved_single_opt_in > 0) {
         $sts = "single_opt_in_saved";
     } elseif ($email_already_exists > 0) {
         $sts = "emails_already_exists";
     } else {
         $sts = "no_email_saved";
     }
     return $sts;
 }
コード例 #2
0
 public static function es_pluginconfig_default()
 {
     global $wpdb;
     $prefix = $wpdb->prefix;
     $result = es_cls_settings::es_setting_count(0);
     if ($result == 0) {
         $admin_email = get_option('admin_email');
         $blogname = get_option('blogname');
         if ($admin_email == "") {
             $admin_email = "*****@*****.**";
         }
         $home_url = home_url('/');
         $optinlink = $home_url . "?es=optin&db=###DBID###&email=###EMAIL###&guid=###GUID###";
         $unsublink = $home_url . "?es=unsubscribe&db=###DBID###&email=###EMAIL###&guid=###GUID###";
         $es_c_fromname = "Admin";
         $es_c_fromemail = $admin_email;
         $es_c_mailtype = "WP HTML MAIL";
         $es_c_adminmailoption = "YES";
         $es_c_adminemail = $admin_email;
         $es_c_adminmailsubject = $blogname . " New email subscription";
         $es_c_adminmailcontant = "Hi Admin, \r\n\r\nWe have received a request to subscribe new email address to receive emails from our website. \r\n\r\nEmail: ###EMAIL### \r\nName : ###NAME### \r\n\r\nThank You\r\n" . $blogname;
         $es_c_usermailoption = "YES";
         $es_c_usermailsubject = $blogname . " Welcome to our newsletter";
         $es_c_usermailcontant = "Hi ###NAME###, \r\n\r\nWe have received a request to subscribe this email address to receive newsletter from our website. \r\n\r\nThank You\r\n" . $blogname . " \r\n\r\n No longer interested email from " . $blogname . "?. Please <a href='###LINK###'>click here</a> to unsubscribe";
         $es_c_optinoption = "Double Opt In";
         $es_c_optinsubject = $blogname . " confirm subscription";
         $es_c_optincontent = "Hi ###NAME###, \r\n\r\nA newsletter subscription request for this email address was received. Please confirm it by <a href='###LINK###'>clicking here</a>.\r\n\r\nIf you still cannot subscribe, please click this link : \r\n ###LINK### \r\n\r\nThank You\r\n" . $blogname;
         $es_c_optinlink = $optinlink;
         $es_c_unsublink = $unsublink;
         $es_c_unsubtext = "No longer interested email from " . $blogname . "?. Please <a href='###LINK###'>click here</a> to unsubscribe";
         $es_c_unsubhtml = "Thank You, You have been successfully unsubscribed. You will no longer hear from us.";
         $es_c_subhtml = "Thank You, You have been successfully subscribed to our newsletter.";
         $es_c_message1 = "Oops.. This subscription cant be completed, sorry. The email address is blocked or already subscribed. Thank you.";
         $es_c_message2 = "Oops.. We are getting some technical error. Please try again or contact admin.";
         $sSql = $wpdb->prepare("INSERT INTO `" . $prefix . "es_pluginconfig` \r\n\t\t\t\t\t(`es_c_fromname`,`es_c_fromemail`, `es_c_mailtype`, `es_c_adminmailoption`, `es_c_adminemail`, `es_c_adminmailsubject`,\r\n\t\t\t\t\t`es_c_adminmailcontant`,`es_c_usermailoption`, `es_c_usermailsubject`, `es_c_usermailcontant`, `es_c_optinoption`, `es_c_optinsubject`,\r\n\t\t\t\t\t`es_c_optincontent`,`es_c_optinlink`, `es_c_unsublink`, `es_c_unsubtext`, `es_c_unsubhtml`, `es_c_subhtml`, `es_c_message1`, `es_c_message2`)\r\n\t\t\t\t\tVALUES(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", array($es_c_fromname, $es_c_fromemail, $es_c_mailtype, $es_c_adminmailoption, $es_c_adminemail, $es_c_adminmailsubject, $es_c_adminmailcontant, $es_c_usermailoption, $es_c_usermailsubject, $es_c_usermailcontant, $es_c_optinoption, $es_c_optinsubject, $es_c_optincontent, $es_c_optinlink, $es_c_unsublink, $es_c_unsubtext, $es_c_unsubhtml, $es_c_subhtml, $es_c_message1, $es_c_message2));
         $wpdb->query($sSql);
     }
     return true;
 }
コード例 #3
0
 $form['email'] = isset($_GET['email']) ? $_GET['email'] : '';
 $form['guid'] = isset($_GET['guid']) ? $_GET['guid'] : '';
 // Check errors in the query string
 if ($form['db'] == '' || $form['email'] == '' || $form['guid'] == '') {
     $noerror = false;
 } else {
     if (!is_numeric($form['db'])) {
         $noerror = false;
     }
     if (!filter_var($form['email'], FILTER_VALIDATE_EMAIL)) {
         $noerror = false;
     }
 }
 // Load default message
 $data = array();
 $data = es_cls_settings::es_setting_select(1);
 if ($noerror) {
     $result = es_cls_dbquery::es_view_subscriber_job("Unsubscribed", $form['db'], $form['guid'], $form['email']);
     if ($result) {
         $message = esc_html(stripslashes($data['es_c_unsubhtml']));
         $message = str_replace("\r\n", "<br />", $message);
     } else {
         $message = esc_html(stripslashes($data['es_c_message2']));
     }
     if ($message == "") {
         $message = __('Oops.. We are getting some technical error. Please try again or contact admin.', 'email-subscribers');
     }
     echo $message;
 } else {
     $message = esc_html(stripslashes($data['es_c_message2']));
     $message = str_replace("\r\n", "<br />", $message);
コード例 #4
0
                $es_success_msg = TRUE;
                $es_success = __('Selected record was successfully deleted.', ES_TDOMAIN);
            } else {
                ?>
				<div class="error fade">
				  <p><strong><?php 
                _e('Oops, No record was selected.', ES_TDOMAIN);
                ?>
</strong></p>
				</div>
				<?php 
            }
        } elseif (isset($_POST['frm_es_bulkaction']) && $_POST['frm_es_bulkaction'] == 'resend') {
            $chk_delete = isset($_POST['chk_delete']) ? $_POST['chk_delete'] : '';
            $setting = array();
            $setting = es_cls_settings::es_setting_select(1);
            if ($setting['es_c_optinoption'] != "Double Opt In") {
                ?>
				<div class="error fade">
				  <p><strong><?php 
                _e('To send confirmation mail, Please change the Opt-in option to Double Opt In.', ES_TDOMAIN);
                ?>
</strong></p>
				</div>
				<?php 
            } else {
                if (!empty($chk_delete)) {
                    $count = count($chk_delete);
                    $idlist = "";
                    for ($i = 0; $i < $count; $i++) {
                        $del_id = $chk_delete[$i];
コード例 #5
0
    $form['es_c_optinsubject'] = isset($_POST['es_c_optinsubject']) ? $_POST['es_c_optinsubject'] : '';
    $form['es_c_optincontent'] = isset($_POST['es_c_optincontent']) ? $_POST['es_c_optincontent'] : '';
    $form['es_c_optinlink'] = $optinlink;
    //isset($_POST['es_c_optinlink']) ? $_POST['es_c_optinlink'] : '';
    $form['es_c_unsublink'] = $unsublink;
    //isset($_POST['es_c_unsublink']) ? $_POST['es_c_unsublink'] : '';
    $form['es_c_unsubtext'] = isset($_POST['es_c_unsubtext']) ? $_POST['es_c_unsubtext'] : '';
    $form['es_c_unsubhtml'] = isset($_POST['es_c_unsubhtml']) ? $_POST['es_c_unsubhtml'] : '';
    $form['es_c_subhtml'] = isset($_POST['es_c_subhtml']) ? $_POST['es_c_subhtml'] : '';
    $form['es_c_message1'] = isset($_POST['es_c_message1']) ? $_POST['es_c_message1'] : '';
    $form['es_c_message2'] = isset($_POST['es_c_message2']) ? $_POST['es_c_message2'] : '';
    $form['es_c_id'] = isset($_POST['es_c_id']) ? $_POST['es_c_id'] : '1';
    //	No errors found, we can add this Group to the table
    if ($es_error_found == FALSE) {
        $action = "";
        $action = es_cls_settings::es_setting_update($form);
        if ($action == "sus") {
            $es_success = __('Details was successfully updated.', 'email-subscribers');
        } else {
            $es_error_found == TRUE;
            $es_errors[] = __('Oops, details not update.', 'email-subscribers');
        }
    }
    $form['es_c_sentreport'] = isset($_POST['es_c_sentreport']) ? $_POST['es_c_sentreport'] : '';
    update_option('es_c_sentreport', $form['es_c_sentreport']);
    $form['es_c_sentreport_subject'] = isset($_POST['es_c_sentreport_subject']) ? $_POST['es_c_sentreport_subject'] : '';
    update_option('es_c_sentreport_subject', $form['es_c_sentreport_subject']);
}
if ($es_error_found == TRUE && isset($es_errors[0]) == TRUE) {
    ?>
		<div class="error fade">
コード例 #6
0
ファイル: es-sendmail.php プロジェクト: venturepact/blog
 public static function es_sendmail($type = "", $template = 0, $subscribers = array(), $action = "", $post_id = 0)
 {
     $data = array();
     $htmlmail = true;
     $wpmail = true;
     $unsublink = "";
     $unsubtext = "";
     $sendguid = "";
     $viewstatus = "";
     $viewstslink = "";
     $adminmail = "";
     $adminmailsubject = "";
     $adminmailcontant = "";
     $reportmail = "";
     $currentdate = date('Y-m-d G:i:s');
     $cacheid = es_cls_common::es_generate_guid(100);
     $replacefrom = array("<ul><br />", "</ul><br />", "<li><br />", "</li><br />", "<ol><br />", "</ol><br />", "</h2><br />", "</h1><br />");
     $replaceto = array("<ul>", "</ul>", "<li>", "</li>", "<ol>", "</ol>", "</h2>", "</h1>");
     $settings = es_cls_settings::es_setting_select(1);
     $adminmail = $settings['es_c_adminemail'];
     $es_c_adminmailoption = $settings['es_c_adminmailoption'];
     $es_c_usermailoption = $settings['es_c_usermailoption'];
     if (trim($settings['es_c_fromname']) == "" || trim($settings['es_c_fromemail']) == '') {
         get_currentuserinfo();
         $sender_name = $user_login;
         $sender_email = $user_email;
     } else {
         $sender_name = $settings['es_c_fromname'];
         $sender_email = $settings['es_c_fromemail'];
     }
     if ($settings['es_c_mailtype'] == "WP HTML MAIL" || $settings['es_c_mailtype'] == "PHP HTML MAIL") {
         $htmlmail = true;
     } else {
         $htmlmail = false;
     }
     if ($settings['es_c_mailtype'] == "WP HTML MAIL" || $settings['es_c_mailtype'] == "WP PLAINTEXT MAIL") {
         $wpmail = true;
     } else {
         $wpmail = false;
     }
     $headers = "From: \"{$sender_name}\" <{$sender_email}>\n";
     $headers .= "Return-Path: <" . $sender_email . ">\n";
     $headers .= "Reply-To: \"" . $sender_name . "\" <" . $sender_email . ">\n";
     $headers .= "X-Mailer: PHP" . phpversion() . "\n";
     if ($htmlmail) {
         $headers .= "MIME-Version: 1.0\n";
         $headers .= "Content-Type: " . get_bloginfo('html_type') . "; charset=\"" . get_bloginfo('charset') . "\"\n";
         $headers .= "Content-type: text/html\r\n";
     } else {
         $headers .= "MIME-Version: 1.0\n";
         $headers .= "Content-Type: text/plain; charset=\"" . get_bloginfo('charset') . "\"\n";
     }
     switch ($type) {
         case 'optin':
             $subject = stripslashes($settings['es_c_optinsubject']);
             $content = stripslashes($settings['es_c_optincontent']);
             break;
         case 'welcome':
             $subject = stripslashes($settings['es_c_usermailsubject']);
             $content = stripslashes($settings['es_c_usermailcontant']);
             break;
         case 'newsletter':
             $template = es_cls_compose::es_template_select($template);
             $subject = stripslashes($template['es_templ_heading']);
             $content = stripslashes($template['es_templ_body']);
             break;
         case 'notification':
             $template = es_cls_compose::es_template_select($template);
             $subject = stripslashes($template['es_templ_heading']);
             $content = stripslashes($template['es_templ_body']);
             $post_title = "";
             $post_excerpt = "";
             $post_link = "";
             $post_thumbnail = "";
             $post_thumbnail_link = "";
             $post = get_post($post_id);
             $excerpt_length = 50;
             // Change this value to increase the content length in newsletter.
             $post_title = $post->post_title;
             $subject = str_replace('###POSTTITLE###', $post_title, $subject);
             $post_link = get_permalink($post_id);
             $subject = str_replace('###POSTLINK###', $post_link, $subject);
             $post_date = $post->post_modified;
             // Get full post
             $post_full = $post->post_content;
             $post_full = wpautop($post_full);
             // Get post excerpt
             $the_excerpt = $post->post_content;
             $the_excerpt = strip_tags(strip_shortcodes($the_excerpt));
             $words = explode(' ', $the_excerpt, $excerpt_length + 1);
             if (count($words) > $excerpt_length) {
                 array_pop($words);
                 array_push($words, '...');
                 $the_excerpt = implode(' ', $words);
             }
             if (function_exists('has_post_thumbnail') && has_post_thumbnail($post_id)) {
                 $post_thumbnail = get_the_post_thumbnail($post_id, 'thumbnail');
             }
             if ($post_thumbnail != "") {
                 $post_thumbnail_link = "<a href='" . $post_link . "' target='_blank'>" . $post_thumbnail . "</a>";
             }
             $content = str_replace('###POSTLINK-ONLY###', $post_link, $content);
             if ($post_link != "") {
                 $post_link_with_title = "<a href='" . $post_link . "' target='_blank'>" . $post_title . "</a>";
                 $content = str_replace('###POSTLINK-WITHTITLE###', $post_link_with_title, $content);
                 $post_link = "<a href='" . $post_link . "' target='_blank'>" . $post_link . "</a>";
             }
             $content = str_replace('###POSTTITLE###', $post_title, $content);
             $content = str_replace('###POSTLINK###', $post_link, $content);
             $content = str_replace('###POSTIMAGE###', $post_thumbnail_link, $content);
             $content = str_replace('###POSTDESC###', $the_excerpt, $content);
             $content = str_replace('###POSTFULL###', $post_full, $content);
             $content = str_replace('###DATE###', $post_date, $content);
             break;
     }
     if ($settings['es_c_mailtype'] == "WP HTML MAIL" || $settings['es_c_mailtype'] == "PHP HTML MAIL") {
         $content = str_replace("\r\n", "<br />", $content);
     } else {
         $content = str_replace("<br />", "\r\n", $content);
     }
     if ($type == "newsletter" || $type == "notification") {
         $sendguid = es_cls_common::es_generate_guid(60);
         $url = home_url('/');
         $viewstatus = '<img src="' . $url . '?es=viewstatus&delvid=###DELVIID###" width="1" height="1" />';
         es_cls_sentmail::es_sentmail_ins($sendguid, $qstring = 0, $action, $currentdate, $enddt = "", count($subscribers), $content);
     }
     $count = 1;
     if (count($subscribers) > 0) {
         foreach ($subscribers as $subscriber) {
             $to = $subscriber['es_email_mail'];
             $name = $subscriber['es_email_name'];
             if ($name == "") {
                 $name = $to;
             }
             switch ($type) {
                 case 'optin':
                     $content_send = str_replace("###NAME###", $name, $content);
                     $content_send = str_replace("###EMAIL###", $to, $content_send);
                     $optinlink = $settings['es_c_optinlink'];
                     $optinlink = str_replace("###DBID###", $subscriber["es_email_id"], $optinlink);
                     $optinlink = str_replace("###EMAIL###", $subscriber["es_email_mail"], $optinlink);
                     $optinlink = str_replace("###GUID###", $subscriber["es_email_guid"], $optinlink);
                     $optinlink = $optinlink . "&cache=" . $cacheid;
                     $content_send = str_replace("###LINK###", $optinlink, $content_send);
                     break;
                 case 'welcome':
                     $content_send = str_replace("###NAME###", $name, $content);
                     $content_send = str_replace("###EMAIL###", $to, $content_send);
                     $adminmailsubject = stripslashes($settings['es_c_adminmailsubject']);
                     $adminmailcontant = stripslashes($settings['es_c_adminmailcontant']);
                     $adminmailcontant = str_replace("###NAME###", $name, $adminmailcontant);
                     $adminmailcontant = str_replace("###EMAIL###", $to, $adminmailcontant);
                     if ($settings['es_c_mailtype'] == "WP HTML MAIL" || $settings['es_c_mailtype'] == "PHP HTML MAIL") {
                         $adminmailcontant = nl2br($adminmailcontant);
                         $content_send = str_replace($replacefrom, $replaceto, $content_send);
                     } else {
                         $adminmailcontant = str_replace("<br />", "\r\n", $adminmailcontant);
                         $adminmailcontant = str_replace("<br>", "\r\n", $adminmailcontant);
                     }
                     break;
                 case 'newsletter':
                     $unsublink = $settings['es_c_unsublink'];
                     $unsublink = str_replace("###DBID###", $subscriber["es_email_id"], $unsublink);
                     $unsublink = str_replace("###EMAIL###", $subscriber["es_email_mail"], $unsublink);
                     $unsublink = str_replace("###GUID###", $subscriber["es_email_guid"], $unsublink);
                     $unsublink = $unsublink . "&cache=" . $cacheid;
                     $unsubtext = stripslashes($settings['es_c_unsubtext']);
                     $unsubtext = str_replace("###LINK###", $unsublink, $unsubtext);
                     if ($settings['es_c_mailtype'] == "WP HTML MAIL" || $settings['es_c_mailtype'] == "PHP HTML MAIL") {
                         $unsubtext = '<br><br>' . $unsubtext;
                     } else {
                         $unsubtext = '\\n\\n' . $unsubtext;
                     }
                     $returnid = es_cls_delivery::es_delivery_ins($sendguid, $subscriber["es_email_id"], $subscriber["es_email_mail"]);
                     $viewstslink = str_replace("###DELVIID###", $returnid, $viewstatus);
                     $content_send = str_replace("###EMAIL###", $subscriber["es_email_mail"], $content);
                     $content_send = str_replace("###NAME###", $subscriber["es_email_name"], $content_send);
                     if ($settings['es_c_mailtype'] == "WP HTML MAIL" || $settings['es_c_mailtype'] == "PHP HTML MAIL") {
                         $content_send = nl2br($content_send);
                         $content_send = str_replace($replacefrom, $replaceto, $content_send);
                     } else {
                         $content_send = str_replace("<br />", "\r\n", $content_send);
                         $content_send = str_replace("<br>", "\r\n", $content_send);
                     }
                     break;
                 case 'notification':
                     // notification mail to subscribers
                     $unsublink = $settings['es_c_unsublink'];
                     $unsublink = str_replace("###DBID###", $subscriber["es_email_id"], $unsublink);
                     $unsublink = str_replace("###EMAIL###", $subscriber["es_email_mail"], $unsublink);
                     $unsublink = str_replace("###GUID###", $subscriber["es_email_guid"], $unsublink);
                     $unsublink = $unsublink . "&cache=" . $cacheid;
                     $unsubtext = stripslashes($settings['es_c_unsubtext']);
                     $unsubtext = str_replace("###LINK###", $unsublink, $unsubtext);
                     if ($settings['es_c_mailtype'] == "WP HTML MAIL" || $settings['es_c_mailtype'] == "PHP HTML MAIL") {
                         $unsubtext = '<br><br>' . $unsubtext;
                     } else {
                         $unsubtext = '\\n\\n' . $unsubtext;
                     }
                     $returnid = es_cls_delivery::es_delivery_ins($sendguid, $subscriber["es_email_id"], $subscriber["es_email_mail"]);
                     $viewstslink = str_replace("###DELVIID###", $returnid, $viewstatus);
                     $content_send = str_replace("###EMAIL###", $subscriber["es_email_mail"], $content);
                     $content_send = str_replace("###NAME###", $subscriber["es_email_name"], $content_send);
                     if ($settings['es_c_mailtype'] == "WP HTML MAIL" || $settings['es_c_mailtype'] == "PHP HTML MAIL") {
                         $content_send = nl2br($content_send);
                         $content_send = str_replace($replacefrom, $replaceto, $content_send);
                     } else {
                         $content_send = str_replace("<br />", "\r\n", $content_send);
                         $content_send = str_replace("<br>", "\r\n", $content_send);
                     }
                     break;
             }
             if ($wpmail) {
                 // Users mails
                 if ($type == "welcome") {
                     if ($es_c_usermailoption == "YES") {
                         wp_mail($to, $subject, $content_send . $unsubtext . $viewstslink, $headers);
                     }
                 } else {
                     wp_mail($to, $subject, $content_send . $unsubtext . $viewstslink, $headers);
                 }
                 // Admin mails
                 if ($type == "welcome" && $adminmail != "" && $es_c_adminmailoption == "YES") {
                     wp_mail($adminmail, $adminmailsubject, $adminmailcontant, $headers);
                 }
             } else {
                 // Users mails
                 if ($type == "welcome") {
                     if ($es_c_usermailoption == "YES") {
                         mail($to, $subject, $content_send . $unsubtext . $viewstslink, $headers);
                     }
                 } else {
                     mail($to, $subject, $content_send . $unsubtext . $viewstslink, $headers);
                 }
                 // Admin mails
                 if ($type == "welcome" && $adminmail != "" && $es_c_adminmailoption == "YES") {
                     mail($adminmail, $adminmailsubject, $adminmailcontant, $headers);
                 }
             }
             $count = $count + 1;
         }
     }
     if ($type == "newsletter" || $type == "notification") {
         $count = $count - 1;
         es_cls_sentmail::es_sentmail_ups($sendguid);
         if ($adminmail != "") {
             $subject = get_option('es_c_sentreport_subject', 'nosubjectexists');
             if ($subject == "" || $subject == "nosubjectexists") {
                 $subject = es_cls_common::es_sent_report_subject();
             }
             if ($htmlmail) {
                 $reportmail = get_option('es_c_sentreport', 'nooptionexists');
                 if ($reportmail == "" || $reportmail == "nooptionexists") {
                     $reportmail = es_cls_common::es_sent_report_html();
                 }
                 $reportmail = nl2br($reportmail);
             } else {
                 $reportmail = get_option('es_c_sentreport', 'nooptionexists');
                 if ($reportmail == "" || $reportmail == "nooptionexists") {
                     $reportmail = es_cls_common::es_sent_report_plain();
                 }
                 $reportmail = str_replace("<br />", "\r\n", $reportmail);
                 $reportmail = str_replace("<br>", "\r\n", $reportmail);
             }
             $enddate = date('Y-m-d G:i:s');
             $reportmail = str_replace("###COUNT###", $count, $reportmail);
             $reportmail = str_replace("###UNIQUE###", $sendguid, $reportmail);
             $reportmail = str_replace("###STARTTIME###", $currentdate, $reportmail);
             $reportmail = str_replace("###ENDTIME###", $enddate, $reportmail);
             if ($wpmail) {
                 wp_mail($adminmail, $subject, $reportmail, $headers);
             } else {
                 mail($adminmail, $subject, $reportmail, $headers);
             }
         }
     }
 }
コード例 #7
0
 public static function es_pluginconfig_default()
 {
     global $wpdb;
     $prefix = $wpdb->prefix;
     $result = es_cls_settings::es_setting_count(0);
     if ($result == 0) {
         $admin_email = get_option('admin_email');
         $blogname = get_option('blogname');
         if ($admin_email == "") {
             $admin_email = "*****@*****.**";
         }
         $home_url = home_url('/');
         $optinlink = $home_url . "?es=optin&db=###DBID###&email=###EMAIL###&guid=###GUID###";
         $unsublink = $home_url . "?es=unsubscribe&db=###DBID###&email=###EMAIL###&guid=###GUID###";
         $es_c_fromname = "Admin";
         $es_c_fromemail = $admin_email;
         $es_c_mailtype = "WP HTML MAIL";
         $es_c_adminmailoption = "YES";
         $es_c_adminemail = $admin_email;
         // XTEC ************ MODIFICAT - Support localization
         // 2015.10.09 @dgras
         $es_c_adminmailsubject = $blogname . " Subscripci&oacute; nova de correu";
         $es_c_adminmailcontant = "Hola Administrador, \r\n\r\n Hem rebut una sol·licitud de subscripci&oacute; d'aquesta adre&ccedil;a de correu electr&ograve;nic per rebre els articles del nostre lloc web. \r\n\r\n Correu electr&ograve;nic : ###EMAIL### \r\n Nom : ###NAME### \r\n\r\nGr&agrave;cies\r\n" . $blogname;
         $es_c_usermailoption = "YES";
         $es_c_usermailsubject = $blogname . " Benvingut al nostre butlletí";
         $es_c_usermailcontant = "Hola ###NAME###, \r\n\r\n Hem rebut una sol·licitud de subscripci&oacute; d'aquesta adre&ccedil;a de correu electr&ograve;nic per rebre el bullet&iacute; del nostre lloc web.\r\n\r\nGr&agrave;cies\r\n" . $blogname;
         $es_c_optinoption = "Double Opt In";
         $es_c_optinsubject = $blogname . " confirmeu la subscripció";
         $es_c_optincontent = "Hola ###NAME###,\r\n\r\n Hem rebut una petici&oacute; de subscripci&oacute; d'aquesta adre&ccedil;a de correu electr&ograve;nic. Confirmeu <a href='###LINK###'>fent clic aqu&iacute;</a>. Si no podeu fer clic a l'enlla&ccedil; anterior, si us plau, utilitzeu l'URL seg&uuml;ent.\r\n\r\n ###LINK### \r\n\r\nGr&agrave;cies\r\n" . $blogname;
         $es_c_optinlink = $optinlink;
         $es_c_unsublink = $unsublink;
         $es_c_unsubtext = "Si no esteu interessats en rebre correus des de " . $blogname . " <a href='###LINK###'>feu clic aqu&iacute;</a> per donar-vos de baixa";
         $es_c_unsubhtml = "Gr&agrave;cies, heu estat donat de baixa amb &egrave;xit. Ja no haur&iacute;eu de rebre not&iacute;cies nostres.";
         $es_c_subhtml = "Gr&agrave;cies, heu estat subscrit amb &egrave;xit al nostre butllet&iacute; de not&iacute;cies.";
         $es_c_message1 = "Vaja... Aquesta subscripci&oacute; no s'ha pogut completar, ho sentim. L'adre&ccedil;a de correu electr&ograve;nic est&agrave; bloquejada o ja est&agrave; subscrita. Gr&agrave;cies.";
         $es_c_message2 = "Vaja... Estem tenint algun error t&egrave;cnic. Torneu-ho a provar o contacteu amb l'administrador.";
         // @Comment: The code below would be the right way to do but it does not work
         /*
                     $es_c_adminmailsubject = $blogname . __(" New email subscription", 'email-subscribers');
                     $es_c_adminmailcontant = __("Hi Admin,", 'email-subscribers')." \r\n\r\n". __("We have received a request to subscribe new email address to receive emails from our website.", 'email-subscribers')." \r\n\r\n". __("Email", 'email-subscribers').": ###EMAIL### \r\n".__("Name", 'email-subscribers'). ": ###NAME### \r\n\r\n". __("Thank You", 'email-subscribers')."\r\n".$blogname;
                     $es_c_usermailoption = "YES";
                     $es_c_usermailsubject = $blogname . __(" Welcome to our newsletter", 'email-subscribers');
                     $es_c_usermailcontant = __("Hi ###NAME###,", 'email-subscribers'). "\r\n\r\n" . __("We have received a request to subscribe this email address to receive newsletter from our website.", 'email-subscribers'). "\r\n\r\n". __("Thank You", 'email-subscribers')."\r\n".$blogname;
                     $es_c_optinoption = "Double Opt In";
                     $es_c_optinsubject = $blogname . __(" confirm subscription",'email-subscribers');
                     $es_c_optincontent = __("Hi ###NAME###,", 'email-subscribers'). "\r\n\r\n". __("A newsletter subscription request for this email address was received. Please confirm it by <a href='###LINK###'>clicking here</a>. If you cannot click the link, please use the following link.", 'email-subscribers')."\r\n\r\n ###LINK### \r\n\r\n".__("Thank You", 'email-subscribers')."\r\n".$blogname;
                     $es_c_optinlink = $optinlink;
                     $es_c_unsublink = $unsublink;
                     $es_c_unsubtext = sprintf(__("No longer interested email from %s?. Please <a href='###LINK###'>click here</a> to unsubscribe", 'email-subscribers'), $blogname);
                     $es_c_unsubhtml = __("Thank You, You have been successfully unsubscribed. You will no longer hear from us.", 'email-subscribers');
                     $es_c_subhtml = __("Thank You, You have been successfully subscribed to our newsletter.", 'email-subscribers');
                     $es_c_message1 = __("Oops.. This subscription cant be completed, sorry. The email address is blocked or already subscribed. Thank you.", 'email-subscribers');
                     $es_c_message2 = __("Oops.. We are getting some technical error. Please try again or contact admin.", 'email-subscribers');
         */
         //************ ORIGINAL
         /*
         			$es_c_adminmailsubject = $blogname . " New email subscription";
         			$es_c_adminmailcontant = "Hi Admin, \r\n\r\nWe have received a request to subscribe new email address to receive emails from our website. \r\n\r\nEmail: ###EMAIL### \r\nName : ###NAME### \r\n\r\nThank You\r\n".$blogname;
         			$es_c_usermailoption = "YES";
         			$es_c_usermailsubject = $blogname . " Welcome to our newsletter";
         			$es_c_usermailcontant = "Hi ###NAME###, \r\n\r\nWe have received a request to subscribe this email address to receive newsletter from our website. \r\n\r\nThank You\r\n".$blogname;
         			$es_c_optinoption = "Double Opt In";
         			$es_c_optinsubject = $blogname . " confirm subscription";
         			$es_c_optincontent = "Hi ###NAME###, \r\n\r\nA newsletter subscription request for this email address was received. Please confirm it by <a href='###LINK###'>clicking here</a>. If you cannot click the link, please use the following link. \r\n\r\n ###LINK### \r\n\r\nThank You\r\n".$blogname;
         			$es_c_optinlink = $optinlink;
         			$es_c_unsublink = $unsublink;
         			$es_c_unsubtext = "No longer interested email from ".$blogname."?. Please <a href='###LINK###'>click here</a> to unsubscribe";
         			$es_c_unsubhtml = "Thank You, You have been successfully unsubscribed. You will no longer hear from us.";
         			$es_c_subhtml = "Thank You, You have been successfully subscribed to our newsletter.";
         			$es_c_message1 = "Oops.. This subscription cant be completed, sorry. The email address is blocked or already subscribed. Thank you.";
         			$es_c_message2 = "Oops.. We are getting some technical error. Please try again or contact admin.";
         */
         //************ FI
         $sSql = $wpdb->prepare("INSERT INTO `" . $prefix . "es_pluginconfig`\r\n\t\t\t\t\t(`es_c_fromname`,`es_c_fromemail`, `es_c_mailtype`, `es_c_adminmailoption`, `es_c_adminemail`, `es_c_adminmailsubject`,\r\n\t\t\t\t\t`es_c_adminmailcontant`,`es_c_usermailoption`, `es_c_usermailsubject`, `es_c_usermailcontant`, `es_c_optinoption`, `es_c_optinsubject`,\r\n\t\t\t\t\t`es_c_optincontent`,`es_c_optinlink`, `es_c_unsublink`, `es_c_unsubtext`, `es_c_unsubhtml`, `es_c_subhtml`, `es_c_message1`, `es_c_message2`)\r\n\t\t\t\t\tVALUES(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", array($es_c_fromname, $es_c_fromemail, $es_c_mailtype, $es_c_adminmailoption, $es_c_adminemail, $es_c_adminmailsubject, $es_c_adminmailcontant, $es_c_usermailoption, $es_c_usermailsubject, $es_c_usermailcontant, $es_c_optinoption, $es_c_optinsubject, $es_c_optincontent, $es_c_optinlink, $es_c_unsublink, $es_c_unsubtext, $es_c_unsubhtml, $es_c_subhtml, $es_c_message1, $es_c_message2));
         $wpdb->query($sSql);
     }
     return true;
 }