if (isset($_POST['es_form_submit']) && $_POST['es_form_submit'] == 'yes') {
    //	Just security thingy that wordpress offers us
    check_admin_referer('es_form_edit');
    $form['es_templ_heading'] = isset($_POST['es_templ_heading']) ? $_POST['es_templ_heading'] : '';
    if ($form['es_templ_heading'] == '') {
        $es_errors[] = __('Please enter template heading.', 'email-subscribers');
        $es_error_found = TRUE;
    }
    $form['es_templ_body'] = isset($_POST['es_templ_body']) ? $_POST['es_templ_body'] : '';
    $form['es_templ_status'] = isset($_POST['es_templ_status']) ? $_POST['es_templ_status'] : '';
    $form['es_email_type'] = isset($_POST['es_email_type']) ? $_POST['es_email_type'] : '';
    $form['es_templ_id'] = isset($_POST['es_templ_id']) ? $_POST['es_templ_id'] : '0';
    //	No errors found, we can add this Group to the table
    if ($es_error_found == FALSE) {
        $action = "";
        $action = es_cls_compose::es_template_ins($form, $action = "update");
        if ($action == "sus") {
            $es_success = __('Template was successfully updated.', 'email-subscribers');
        }
    }
}
if ($es_error_found == TRUE && isset($es_errors[0]) == TRUE) {
    ?>
<div class="error fade"><p><strong><?php 
    echo $es_errors[0];
    ?>
</strong></p></div><?php 
}
if ($es_error_found == FALSE && strlen($es_success) > 0) {
    ?>
?>
				<p class="description"><?php 
_e('Select a mail subject from available list. Go to Compose page to create new mail.', ES_TDOMAIN);
?>
</p>
			</label>
		</th>
		<td>
			<select name="es_templ_heading" id="es_templ_heading">
			<option value=''><?php 
_e('Select', ES_TDOMAIN);
?>
</option>
			<?php 
$subject = array();
$subject = es_cls_compose::es_template_select_type($type = "Static Template");
$thisselected = "";
if (count($subject) > 0) {
    $i = 1;
    foreach ($subject as $sub) {
        if ($sub["es_templ_id"] == $es_templ_heading) {
            $thisselected = "selected='selected'";
        }
        ?>
<option value='<?php 
        echo $sub["es_templ_id"];
        ?>
' <?php 
        echo $thisselected;
        ?>
><?php 
Example #3
0
 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);
             }
         }
     }
 }
Example #4
0
// Form submitted, check the data
if (isset($_POST['es_form_submit']) && $_POST['es_form_submit'] == 'yes') {
    //	Just security thingy that wordpress offers us
    check_admin_referer('es_form_add');
    $form['es_templ_heading'] = isset($_POST['es_templ_heading']) ? $_POST['es_templ_heading'] : '';
    if ($form['es_templ_heading'] == '') {
        $es_errors[] = __('Please enter template heading.', 'email-subscribers');
        $es_error_found = TRUE;
    }
    $form['es_templ_body'] = isset($_POST['es_templ_body']) ? $_POST['es_templ_body'] : '';
    $form['es_templ_status'] = isset($_POST['es_templ_status']) ? $_POST['es_templ_status'] : '';
    $form['es_email_type'] = isset($_POST['es_email_type']) ? $_POST['es_email_type'] : '';
    //	No errors found, we can add this Group to the table
    if ($es_error_found == FALSE) {
        $action = false;
        $action = es_cls_compose::es_template_ins($form, $action = "insert");
        if ($action) {
            $es_success = __('Template was successfully created.', 'email-subscribers');
        }
        // Reset the form fields
        $form = array('es_templ_heading' => '', 'es_templ_body' => '', 'es_templ_status' => '', 'es_email_type' => '');
    }
}
if ($es_error_found == TRUE && isset($es_errors[0]) == TRUE) {
    ?>
<div class="error fade"><p><strong><?php 
    echo $es_errors[0];
    ?>
</strong></p></div><?php 
}
if ($es_error_found == FALSE && strlen($es_success) > 0) {
</h2>
	<h3><?php 
_e('Compose Mail', 'email-subscribers');
?>
  
	<a class="add-new-h2" href="<?php 
echo ES_ADMINURL;
?>
?page=es-compose&amp;ac=add"><?php 
_e('Add New', 'email-subscribers');
?>
</a></h3>
    <div class="tool-box">
	<?php 
$myData = array();
$myData = es_cls_compose::es_template_select(0);
?>
	<form name="frm_es_display" method="post">
      <table width="100%" class="widefat" id="straymanage">
        <thead>
          <tr>
			<th scope="col"><?php 
_e('Email subject', 'email-subscribers');
?>
</th>
			<th scope="col"><?php 
_e('Status', 'email-subscribers');
?>
</th>
            <th scope="col"><?php 
_e('Type', 'email-subscribers');
Example #6
0
$displayisthere = FALSE;
if (count($myData) > 0) {
    $i = 1;
    foreach ($myData as $data) {
        ?>
					<tr class="<?php 
        if ($i & 1) {
            echo 'alternate';
        } else {
            echo '';
        }
        ?>
">
					  	<td>
						<?php 
        $template = es_cls_compose::es_template_select($data['es_note_templ']);
        if (count($template) > 0) {
            echo $template['es_templ_heading'];
        }
        ?>
						<div class="row-actions">
							<span class="edit">
							<a title="Edit" href="<?php 
        echo ES_ADMINURL;
        ?>
?page=es-notification&amp;ac=edit&amp;did=<?php 
        echo $data['es_note_id'];
        ?>
"><?php 
        _e('Edit', 'email-subscribers');
        ?>
Example #7
0
?>
compose/compose.js"></script>
<div class="wrap">
  <div id="icon-plugins" class="icon32"></div>
    <h2><?php 
_e(ES_PLUGIN_DISPLAY, ES_TDOMAIN);
?>
</h2>
	<h3><?php 
_e('Preview Mail', ES_TDOMAIN);
?>
</h3>
    <div class="tool-box">
	<div style="padding:15px;background-color:#FFFFFF;">
	<?php 
$preview = es_cls_compose::es_template_select($did);
$es_templ_body = $preview["es_templ_body"];
$es_templ_body = nl2br($es_templ_body);
echo stripslashes($es_templ_body);
?>
	</div>
	<div class="tablenav">
	  <h2>
		<a class="button add-new-h2" href="<?php 
echo ES_ADMINURL;
?>
?page=es-compose"><?php 
_e('Back', ES_TDOMAIN);
?>
</a>
		<a class="button add-new-h2" href="<?php 
 public static function es_template_default()
 {
     $result = es_cls_compose::es_template_count(0);
     if ($result == 0) {
         // XTEC ************ MODIFICAT - Support localization
         // 2015.10.09 @dgras
         $form['es_templ_heading'] = "S'ha publicat un article nou:  ###POSTTITLE###";
         $es_b = "Hola ###NAME###,\r\n\r\n";
         $es_b = $es_b . "Hem publicat un article nou al nostre lloc web. ###POSTTITLE###\r\n";
         $es_b = $es_b . "###POSTDESC###\r\n";
         $es_b = $es_b . "Podeu veure l'últim article a ";
         $es_b = $es_b . "###POSTLINK###\r\n";
         $es_b = $es_b . "Heu rebut aquest correu perquè vau demanar que se us notifiqués la publicació d'articles nous\r\n\r\n";
         $es_b = $es_b . "Gràcies i salutacions\r\n";
         // @Comment: The code below would be the right way to do but it does not work
         /*
                     $form['es_templ_heading'] = __('New post published ###POSTTITLE###', 'email-subscribers');
                     $es_b = __("Hello ###NAME###", 'email-subscribers').",\r\n\r\n";
                     $es_b = $es_b . __("We have published new blog in our website. ###POSTTITLE###", 'email-subscribers')."\r\n";
                     $es_b = $es_b . "###POSTDESC###\r\n";
                     $es_b = $es_b . __("You may view the latest post at ", 'email-subscribers');
                     $es_b = $es_b . "###POSTLINK###\r\n";
                     $es_b = $es_b . __("You received this e-mail because you asked to be notified when new updates are posted.", 'email-subscribers')."\r\n\r\n";
                     $es_b = $es_b . __("Thanks & Regards", 'email-subscribers')."\r\n";
         */
         $es_b = $es_b . "Admin";
         $form['es_templ_body'] = $es_b;
         $form['es_templ_status'] = 'Published';
         $form['es_email_type'] = 'Dynamic Template';
         $action = es_cls_compose::es_template_ins($form, $action = "insert");
         $form['es_templ_heading'] = "Notificació d'article nou ###POSTTITLE###";
         $es_b = "Hola ###EMAIL###,\r\n\r\n";
         $es_b = $es_b . "Hem publicat un article nou al nostre lloc web. ###POSTTITLE###\r\n";
         $es_b = $es_b . "###POSTIMAGE###\r\n";
         $es_b = $es_b . "###POSTFULL###\r\n";
         $es_b = $es_b . "Podeu veure l'últim article a ";
         $es_b = $es_b . "###POSTLINK###\r\n";
         $es_b = $es_b . "Heu rebut aquest correu perquè vau demanar que se us notifiqués la publicació d'articles nous\r\n\r\n";
         $es_b = $es_b . "Gràcies i salutacions\r\n";
         // @Comment: The code below would be the right way to do but it does not work
         /*
                     $form['es_templ_heading'] = __('Post notification ###POSTTITLE###', 'email-subscribers');
                     $es_b = __("Hello ###EMAIL###", 'email-subscribers').",\r\n\r\n";
                     $es_b = $es_b . __("We have published new blog in our website. ###POSTTITLE###", 'email-subscribers')."\r\n";
                     $es_b = $es_b . "###POSTIMAGE###\r\n";
                     $es_b = $es_b . "###POSTFULL###\r\n";
                     $es_b = $es_b . __("You may view the latest post at ", 'email-subscribers');
                     $es_b = $es_b . "###POSTLINK###\r\n";
                     $es_b = $es_b . __("You received this e-mail because you asked to be notified when new updates are posted.", 'email-subscribers')."\r\n\r\n";
                     $es_b = $es_b . __("Thanks & Regards", 'email-subscribers')."\r\n";
         */
         $es_b = $es_b . "Admin";
         $form['es_templ_body'] = $es_b;
         $form['es_templ_status'] = 'Published';
         $form['es_email_type'] = 'Dynamic Template';
         $action = es_cls_compose::es_template_ins($form, $action = "insert");
         $Sample = '<strong style="color: #990000"> Subscriptors de correu</strong>';
         $Sample .= "<p>\r\n\t\t\t\t\t\t\tL\\'extensió subscripcions de correu de correu té diferents opcions per enviar butlletins als subscriptors.\r\n\t\t\t\t\t\t\tTé una pàgina separada amb un editor HTML per crear\tun butlletí amb aquest format.\r\n\t\t\t\t\t\t\tL\\'extensió disposa d\\'opcions per enviar correus de notificació als subscriptors quan es publiquen articles nous al lloc web. També té una pàgina per poder afegir i eliminar les categories a les que s\\'enviaran les notificacions.\r\n\t\t\t\t\t\t\tUtilitzant les opcions de l\\'extensió d\\'importació i exportació els administradors podran importar fàcilment els usuaris registrats.\r\n\t\t\t\t\t\t</p>";
         $Sample .= ' <strong style="color: #990000">Característiques de l\'extensió</strong><ol>';
         $Sample .= " <li>Correu de notificació als subscriptors quan es publiquin articles nous.</li>";
         $Sample .= " <li>Giny de subscripció</li><li>Correu de subscripció amb confirmació per correu i subscripció simple per facilitar la subscripció.</li>";
         $Sample .= " <li>Notificació per correu electrònic a l\\'administrador quan els usuaris es subscriguin (Opcional)</li>";
         $Sample .= " <li>Correu de benvinguda automàtic als subscriptors (Opcional).</li>";
         $Sample .= " <li>Enllaç per donar-se de baixa del correu.</li>";
         $Sample .= " <li>Importació / Exportació dels correus dels subscriptors.</li>";
         $Sample .= " <li>Editor d\\'HTML per redactar el butlletí.</li>";
         $Sample .= " </ol>";
         $Sample .= " <strong>Gràcies i salutacions</strong><br>Admin";
         $form['es_templ_heading'] = 'Butlletí Hola Món';
         // @Comment: The code below would be the right way to do but it does not work
         /*
                     $Sample = '<strong style="color: #990000"> '. __("Email subscribers",'email-subscribers') .'</strong><p>'.__("Email subscribers plugin has options to send newsletters to subscribers. It has a separate page with HTML editor to create a HTML newsletter.",'email-subscribers');
                     $Sample .= __('Also have options to send notification email to subscribers when new posts are published to your blog. Separate page available to include and exclude categories to send notifications.','email-subscribers');
                     $Sample .= __("Using plugin Import and Export options admins can easily import registered users and commenters to subscriptions list.",'email-subscribers').'</p>';
                     $Sample .= ' <strong style="color: #990000">'.__("Plugin Features",'email-subscribers').'</strong><ol>';
                     $Sample .= ' <li>'.__("Send notification email to subscribers when new posts are published.",'email-subscribers').'</li>';
                     $Sample .= ' <li>'.__("Subscription box",'email-subscribers').'</li><li>'.__("Double opt-in and single opt-in facility for subscriber.",'email-subscribers') .'</li>';
                     $Sample .= ' <li>'.__("Email notification to admin when user signs up (Optional).",'email-subscribers').'</li>';
                     $Sample .= ' <li>'.__("Automatic welcome mail to subscriber (Optional).",'email-subscribers').'</li>';
                     $Sample .= ' <li>'.__("Unsubscribe link in the mail.",'email-subscribers') .'</li>';
                     $Sample .= ' <li>'.__("Import/Export subscriber emails.",'email-subscribers') .'</li>';
                     $Sample .= ' <li>'.__("HTML editor to compose newsletter.",'email-subscribers') .'</li>';
                     $Sample .= ' </ol>';
                     $Sample .= ' <p>'.__("Plugin live demo and video tutorial available on the official website. Check official website for more information.",'email-subscribers') .'</p>';
                     $Sample .= ' <strong>'.__("Thanks & Regards",'email-subscribers') .'</strong><br>Admin';
         
                     $form['es_templ_heading'] = __('Hello World Newsletter','email-subscribers');
         */
         $form['es_templ_body'] = $Sample;
         $form['es_templ_status'] = 'Published';
         $form['es_email_type'] = 'Static Template';
         //************ ORIGINAL
         /*
         			$form['es_templ_heading'] = 'New post published ###POSTTITLE###';
         			$es_b = "Hello ###NAME###,\r\n\r\n";
         			$es_b = $es_b . "We have published new blog in our website. ###POSTTITLE###\r\n";
         			$es_b = $es_b . "###POSTDESC###\r\n";
         			$es_b = $es_b . "You may view the latest post at ";
         			$es_b = $es_b . "###POSTLINK###\r\n";
         			$es_b = $es_b . "You received this e-mail because you asked to be notified when new updates are posted.\r\n\r\n";
         			$es_b = $es_b . "Thanks & Regards\r\n";
         			$es_b = $es_b . "Admin";
         			$form['es_templ_body'] = $es_b;
         			$form['es_templ_status'] = 'Published';
         			$form['es_email_type'] = 'Dynamic Template';
         			$action = es_cls_compose::es_template_ins($form, $action = "insert");
         
         			$form['es_templ_heading'] = 'Post notification ###POSTTITLE###';
         			$es_b = "Hello ###EMAIL###,\r\n\r\n";
         			$es_b = $es_b . "We have published new blog in our website. ###POSTTITLE###\r\n";
         			$es_b = $es_b . "###POSTIMAGE###\r\n";
         			$es_b = $es_b . "###POSTFULL###\r\n";
         			$es_b = $es_b . "You may view the latest post at ";
         			$es_b = $es_b . "###POSTLINK###\r\n";
         			$es_b = $es_b . "You received this e-mail because you asked to be notified when new updates are posted.\r\n\r\n";
         			$es_b = $es_b . "Thanks & Regards\r\n";
         			$es_b = $es_b . "Admin";
         			$form['es_templ_body'] = $es_b;
         			$form['es_templ_status'] = 'Published';
         			$form['es_email_type'] = 'Dynamic Template';
         			$action = es_cls_compose::es_template_ins($form, $action = "insert");
         
         			$Sample = '<strong style="color: #990000"> Email subscribersr</strong><p>Email subscribers plugin has options to send newsletters to subscribers. It has a separate page with HTML editor to create a HTML newsletter.';
         			$Sample .= ' Also have options to send notification email to subscribers when new posts are published to your blog. Separate page available to include and exclude categories to send notifications.';
         			$Sample .= ' Using plugin Import and Export options admins can easily import registered users and commenters to subscriptions list.</p>';
         			$Sample .= ' <strong style="color: #990000">Plugin Features</strong><ol>';
         			$Sample .= ' <li>Send notification email to subscribers when new posts are published.</li>';
         			$Sample .= ' <li>Subscription box.</li><li>Double opt-in and single opt-in facility for subscriber.</li>';
         			$Sample .= ' <li>Email notification to admin when user signs up (Optional).</li>';
         			$Sample .= ' <li>Automatic welcome mail to subscriber (Optional).</li>';
         			$Sample .= ' <li>Unsubscribe link in the mail.</li>';
         			$Sample .= ' <li>Import/Export subscriber emails.</li>';
         			$Sample .= ' <li>HTML editor to compose newsletter.</li>';
         			$Sample .= ' </ol>';
         			$Sample .= ' <p>Plugin live demo and video tutorial available on the official website. Check official website for more information.</p>';
         			$Sample .= ' <strong>Thanks & Regards</strong><br>Admin';
         
         			$form['es_templ_heading'] = 'Hello World Newsletter';
         			$form['es_templ_body'] = $Sample;
         			$form['es_templ_status'] = 'Published';
         			$form['es_email_type'] = 'Static Template';
         */
         //************ FI
         $action = es_cls_compose::es_template_ins($form, $action = "insert");
     }
     return true;
 }
 public static function es_template_default()
 {
     $result = es_cls_compose::es_template_count(0);
     if ($result == 0) {
         $form['es_templ_heading'] = 'New post published ###POSTTITLE###';
         $es_b = "Hello ###NAME###,\r\n\r\n";
         $es_b = $es_b . "We have published new blog in our website. ###POSTTITLE###\r\n";
         $es_b = $es_b . "###POSTDESC###\r\n";
         $es_b = $es_b . "You may view the latest post at ";
         $es_b = $es_b . "###POSTLINK###\r\n";
         $es_b = $es_b . "You received this e-mail because you asked to be notified when new updates are posted.\r\n\r\n";
         $es_b = $es_b . "Thanks & Regards\r\n";
         $es_b = $es_b . "Admin";
         $form['es_templ_body'] = $es_b;
         $form['es_templ_status'] = 'Published';
         $form['es_email_type'] = 'Dynamic Template';
         $action = es_cls_compose::es_template_ins($form, $action = "insert");
         $form['es_templ_heading'] = 'Post notification ###POSTTITLE###';
         $es_b = "Hello ###EMAIL###,\r\n\r\n";
         $es_b = $es_b . "We have published new blog in our website. ###POSTTITLE###\r\n";
         $es_b = $es_b . "###POSTIMAGE###\r\n";
         $es_b = $es_b . "###POSTFULL###\r\n";
         $es_b = $es_b . "You may view the latest post at ";
         $es_b = $es_b . "###POSTLINK###\r\n";
         $es_b = $es_b . "You received this e-mail because you asked to be notified when new updates are posted.\r\n\r\n";
         $es_b = $es_b . "Thanks & Regards\r\n";
         $es_b = $es_b . "Admin";
         $form['es_templ_body'] = $es_b;
         $form['es_templ_status'] = 'Published';
         $form['es_email_type'] = 'Dynamic Template';
         $action = es_cls_compose::es_template_ins($form, $action = "insert");
         $Sample = '<strong style="color: #990000"> Email Subscribers</strong><p>Email Subscribers plugin has options to send newsletters to subscribers. It has a separate page with HTML editor to create a HTML newsletter.';
         $Sample .= ' Also have options to send notification email to subscribers when new posts are published to your blog. Separate page available to include and exclude categories to send notifications.';
         $Sample .= ' Using plugin Import and Export options admins can easily import registered users and commenters to subscriptions list.</p>';
         $Sample .= ' <strong style="color: #990000">Plugin Features</strong><ol>';
         $Sample .= ' <li>Send notification email to subscribers when new posts are published.</li>';
         $Sample .= ' <li>Subscription box.</li><li>Double opt-in and single opt-in facility for subscriber.</li>';
         $Sample .= ' <li>Email notification to admin when user signs up (Optional).</li>';
         $Sample .= ' <li>Automatic welcome mail to subscriber (Optional).</li>';
         $Sample .= ' <li>Unsubscribe link in the mail.</li>';
         $Sample .= ' <li>Import/Export subscriber emails.</li>';
         $Sample .= ' <li>HTML editor to compose newsletter.</li>';
         $Sample .= ' </ol>';
         $Sample .= ' <p>Plugin live demo and video tutorial available on the official website. Check official website for more information.</p>';
         $Sample .= ' <strong>Thanks & Regards</strong><br>Admin';
         $form['es_templ_heading'] = 'Hello World Newsletter';
         $form['es_templ_body'] = $Sample;
         $form['es_templ_status'] = 'Published';
         $form['es_email_type'] = 'Static Template';
         $action = es_cls_compose::es_template_ins($form, $action = "insert");
     }
     return true;
 }