Email Subscribers & Newsletters - Version 3.5.8

Version Description

(05.09.2018) =

  • Update: Added "Test Email" functionality to confirm email deliverability.
Download this release

Release Info

Developer Icegram
Plugin Icon 128x128 Email Subscribers & Newsletters
Version 3.5.8
Comparing to
See all releases

Code changes from version 3.5.7 to 3.5.8

changelog.txt CHANGED
@@ -4,6 +4,10 @@ Author : Icegram
4
  Author URI : https://www.icegram.com/
5
  License : GPLv3
6
 
 
 
 
 
7
  ***********************************************************Version 3.5.7************************************************************
8
 
9
  * Fix: Post notification sent to multiple times.
4
  Author URI : https://www.icegram.com/
5
  License : GPLv3
6
 
7
+ ***********************************************************Version 3.5.8***********************************************************************************************************************Version 3.5.7************************************************************
8
+
9
+ * Update: Added "Test Email" functionality to confirm email deliverability.
10
+
11
  ***********************************************************Version 3.5.7************************************************************
12
 
13
  * Fix: Post notification sent to multiple times.
classes/es-intermediate.php CHANGED
@@ -92,4 +92,8 @@ class es_cls_intermediate {
92
  public static function es_pricing() {
93
  require_once(ES_DIR.'pricing'.DIRECTORY_SEPARATOR.'pricing.php');
94
  }
 
 
 
 
95
  }
92
  public static function es_pricing() {
93
  require_once(ES_DIR.'pricing'.DIRECTORY_SEPARATOR.'pricing.php');
94
  }
95
+
96
+ public static function es_tools() {
97
+ require_once(ES_DIR.'tools'.DIRECTORY_SEPARATOR.'tools.php');
98
+ }
99
  }
classes/es-register.php CHANGED
@@ -201,6 +201,9 @@ class es_cls_registerhook {
201
  add_submenu_page( 'es-view-subscribers', __( 'Settings', ES_TDOMAIN ),
202
  __( 'Settings', ES_TDOMAIN ), 'manage_options', 'es-settings', array( 'es_cls_intermediate', 'es_settings' ) );
203
 
 
 
 
204
  add_submenu_page( 'es-view-subscribers', __( 'Reports', ES_TDOMAIN ),
205
  __( 'Reports', ES_TDOMAIN ), $es_roles_sentmail, 'es-sentmail', array( 'es_cls_intermediate', 'es_sentmail' ) );
206
 
201
  add_submenu_page( 'es-view-subscribers', __( 'Settings', ES_TDOMAIN ),
202
  __( 'Settings', ES_TDOMAIN ), 'manage_options', 'es-settings', array( 'es_cls_intermediate', 'es_settings' ) );
203
 
204
+ add_submenu_page( 'es-view-subscribers', __( 'Tools', ES_TDOMAIN ),
205
+ __( 'Tools', ES_TDOMAIN ), 'manage_options', 'es-tools', array( 'es_cls_intermediate', 'es_tools' ) );
206
+
207
  add_submenu_page( 'es-view-subscribers', __( 'Reports', ES_TDOMAIN ),
208
  __( 'Reports', ES_TDOMAIN ), $es_roles_sentmail, 'es-sentmail', array( 'es_cls_intermediate', 'es_sentmail' ) );
209
 
classes/es-sendmail.php CHANGED
@@ -348,6 +348,7 @@ class es_cls_sendmail {
348
  $content = str_replace('{{POSTEXCERPT}}', $post_excerpt, $content);
349
  $content = str_replace('{{POSTFULL}}', $post_full, $content);
350
  $content = str_replace('{{DATE}}', $post_date, $content);
 
351
  break;
352
  }
353
 
348
  $content = str_replace('{{POSTEXCERPT}}', $post_excerpt, $content);
349
  $content = str_replace('{{POSTFULL}}', $post_full, $content);
350
  $content = str_replace('{{DATE}}', $post_date, $content);
351
+
352
  break;
353
  }
354
 
email-subscribers.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Email Subscribers & Newsletters
4
  * Plugin URI: https://www.icegram.com/
5
  * Description: Add subscription forms on website, send HTML newsletters & automatically notify subscribers about new blog posts once it is published.
6
- * Version: 3.5.7
7
  * Author: Icegram
8
  * Author URI: https://www.icegram.com/
9
  * Requires at least: 3.9
3
  * Plugin Name: Email Subscribers & Newsletters
4
  * Plugin URI: https://www.icegram.com/
5
  * Description: Add subscription forms on website, send HTML newsletters & automatically notify subscribers about new blog posts once it is published.
6
+ * Version: 3.5.8
7
  * Author: Icegram
8
  * Author URI: https://www.icegram.com/
9
  * Requires at least: 3.9
readme.txt CHANGED
@@ -5,7 +5,7 @@ Author URI: https://www.icegram.com/
5
  Tags: subscription, newsletter, email marketing, post notification, email newsletter form, email signup, email widget, newsletter signup, subscribe, subscription form, bulk emails, signup form, list builder, lead generation
6
  Requires at least: 3.9
7
  Tested up to: 4.9.8
8
- Stable tag: 3.5.7
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses
11
 
@@ -342,6 +342,10 @@ Use our free plugin [Email Subscribers - Group Selector](https://wordpress.org/p
342
 
343
  == Changelog ==
344
 
 
 
 
 
345
  = 3.5.7 (30.08.2018) =
346
 
347
  * Fix: Post notification sent to multiple times.
5
  Tags: subscription, newsletter, email marketing, post notification, email newsletter form, email signup, email widget, newsletter signup, subscribe, subscription form, bulk emails, signup form, list builder, lead generation
6
  Requires at least: 3.9
7
  Tested up to: 4.9.8
8
+ Stable tag: 3.5.8
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses
11
 
342
 
343
  == Changelog ==
344
 
345
+ = 3.5.8 (05.09.2018) =
346
+
347
+ * Update: Added "Test Email" functionality to confirm email deliverability.
348
+
349
  = 3.5.7 (30.08.2018) =
350
 
351
  * Fix: Post notification sent to multiple times.
tools/tools.php ADDED
@@ -0,0 +1,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Exit if accessed directly
4
+ if ( ! defined( 'ABSPATH' ) ) {
5
+ exit;
6
+ }
7
+
8
+ if ( ! class_exists( 'ES_Tools' ) ) {
9
+
10
+ class ES_Tools {
11
+
12
+ public $nav_tabs, $form = array();
13
+
14
+ public function __construct() {
15
+ $this->nav_tabs = $this->es_get_tabs_list();
16
+ $this->es_display_nav_tabs();
17
+ $this->form = $this->es_process_tools_data();
18
+ $this->es_display_settings();
19
+ }
20
+
21
+ public function es_get_tabs_list() {
22
+ $tabs = array(
23
+ 'test-email' => __( 'Test Email', ES_TDOMAIN )
24
+ );
25
+
26
+ return apply_filters( 'es_tools_tabs', $tabs );
27
+ }
28
+
29
+ public function es_display_nav_tabs() {
30
+ ?>
31
+ <style>
32
+ .form-table th {
33
+ width: 450px;
34
+ }
35
+ </style>
36
+
37
+ <div class="wrap">
38
+ <h2>
39
+ <?php echo __( 'Tools', ES_TDOMAIN ); ?>
40
+ <a class="add-new-h2" target="_blank" href="<?php echo ES_FAV; ?>"><?php echo __( 'Help', ES_TDOMAIN ); ?></a>
41
+ </h2>
42
+ <div id="icon-options-general" class="icon32"><br /></div>
43
+ <h2 id="es-tabs" class="nav-tab-wrapper">
44
+ <?php foreach ( $this->nav_tabs as $tab => $name ) { ?>
45
+ <a class="nav-tab active" id=<?php echo $tab; ?> href='#'><?php echo $name; ?></a>
46
+ <?php } ?>
47
+ </h2>
48
+ <?php
49
+ }
50
+
51
+ public function es_display_settings() {
52
+ ?>
53
+ <form name="es_form" id="es_form" method="post" action="#">
54
+ <table class="es-settings form-table">
55
+ <tbody>
56
+ <?php $this->display_test_email(); ?>
57
+ </tbody>
58
+ </table>
59
+ <input type="hidden" name="es_form_submit" value="yes"/>
60
+ <p style="padding-top:10px;">
61
+ <input type="submit" name="publish" id="es-save-settings" class="button-primary" value="<?php echo __( 'Send Email', ES_TDOMAIN ); ?>" />
62
+ </p>
63
+ <?php wp_nonce_field('es_form_edit'); ?>
64
+ </form>
65
+ <?php
66
+ }
67
+
68
+ public function display_test_email() {
69
+ ?>
70
+ <tr class="es-admin test-email">
71
+ <th scope="row">
72
+ <label for="elp"><?php echo __( 'Sende a Test Email', ES_TDOMAIN ); ?>
73
+ <p class="description"><?php echo __( 'Type an email address here and then click a button below to generate a test email.', ES_TDOMAIN ); ?></p>
74
+ </label>
75
+ </th>
76
+ <td>
77
+ <input name="es_c_toemail" type="text" id="es_c_toemail" value="<?php echo stripslashes($this->form['ig_es_toemail']); ?>" size="35" maxlength="225" />
78
+ </td>
79
+ </tr>
80
+ <?php
81
+ }
82
+
83
+ public function es_process_tools_data() {
84
+
85
+ $es_error = '';
86
+ $es_success = '';
87
+ $es_error_found = false;
88
+
89
+ $form = array(
90
+ 'ig_es_toemail' => ''
91
+ );
92
+
93
+
94
+ // Form submitted, check & update the data in options table
95
+ if (isset($_POST['es_form_submit']) && $_POST['es_form_submit'] == 'yes') {
96
+
97
+ // Just security thingy that wordpress offers us
98
+ check_admin_referer('es_form_edit');
99
+
100
+ // Fetch submitted Admin Data
101
+ $form['ig_es_toemail'] = isset($_POST['es_c_toemail']) ? $_POST['es_c_toemail'] : '';
102
+ if ($form['ig_es_toemail'] == '') {
103
+ $es_error = __( 'Please enter email.', ES_TDOMAIN );
104
+ $es_error_found = true;
105
+ } else {
106
+
107
+ $result = $this->send_test_email( $form['ig_es_toemail'] );
108
+ $status = $result['status'];
109
+
110
+ if('ERROR' === $status) {
111
+ $es_error_found = true;
112
+ $es_error = __( sprintf("Error Sending Email: %s", $result['message']), ES_TDOMAIN );
113
+ } else {
114
+ $es_success = __( 'Email have been sent successfully.', ES_TDOMAIN );
115
+ }
116
+
117
+ }
118
+
119
+
120
+ if ($es_error_found == true) {
121
+ ?><div class="error fade">
122
+ <p><strong>
123
+ <?php echo $es_error; ?>
124
+ </strong></p>
125
+ </div><?php
126
+ } else {
127
+ ?><div class="notice notice-success is-dismissible">
128
+ <p><strong>
129
+ <?php echo $es_success; ?>
130
+ </strong></p>
131
+ </div><?php
132
+ }
133
+
134
+
135
+ }
136
+
137
+
138
+ return $form;
139
+ }
140
+
141
+ public function es_settings_update( $form = '', $roles = '' ) {
142
+ if ( ! empty( $form ) ) {
143
+ foreach ( $form as $key => $value ) {
144
+ update_option( $key, $value );
145
+ }
146
+ }
147
+ if ( ! empty( $roles ) ) {
148
+ update_option( 'ig_es_rolesandcapabilities', $roles );
149
+ }
150
+
151
+ return 'sus';
152
+ }
153
+
154
+ public function send_test_email( $email ) {
155
+
156
+ global $phpmailer;
157
+
158
+ if ( ! is_object( $phpmailer ) || ! is_a( $phpmailer, 'PHPMailer' ) ) {
159
+ require_once ABSPATH . WPINC . '/class-phpmailer.php';
160
+ $phpmailer = new PHPMailer( true );
161
+ }
162
+
163
+ ob_start();
164
+
165
+ $settings = es_cls_settings::es_get_all_settings();
166
+
167
+ if( trim($settings['ig_es_fromname']) == "" || trim($settings['ig_es_fromemail']) == '' ) {
168
+ $current_user = ( function_exists('wp_get_current_user') ) ? wp_get_current_user() : get_currentuserinfo();
169
+ $sender_name = $current_user->user_login;
170
+ $sender_email = $current_user->user_email;
171
+ } else {
172
+ $sender_name = stripslashes($settings['ig_es_fromname']);
173
+ $sender_email = $settings['ig_es_fromemail'];
174
+ }
175
+
176
+ $headers = "From: \"$sender_name\" <$sender_email>\n";
177
+ $headers .= "Return-Path: <" . $sender_email . ">\n";
178
+ $headers .= "Reply-To: \"" . $sender_name . "\" <" . $sender_email . ">\n";
179
+ $headers .= "Content-Type: text/html; charset=\"". get_bloginfo('charset') . "\"\n";
180
+
181
+ $send_mail = wp_mail(
182
+ $email,
183
+ /* translators: %s - email address a test email will be sent to. */
184
+ 'Email Subscribers: ' . sprintf( esc_html__( 'Test email to %s', ES_TDOMAIN ), $email ),
185
+ sprintf( esc_html__( 'This email was generated by the Email Subscribers WordPress plugin.', ES_TDOMAIN )),
186
+ $headers
187
+ );
188
+
189
+ $smtp_debug = ob_get_clean();
190
+
191
+ $result = array('status' => 'SUCCESS');
192
+
193
+ if(!$send_mail) {
194
+
195
+ $result = array(
196
+ 'status' => 'ERROR',
197
+ 'message' => wp_strip_all_tags( $phpmailer->ErrorInfo )
198
+ );
199
+
200
+ }
201
+
202
+ return $result;
203
+ }
204
+
205
+ }
206
+ }
207
+
208
+ new ES_Tools();