WP Mail Bank: WordPress SMTP Plugin & Email Logs - Version 1.9

Version Description

  • Implemented New Feature - Automatic Mail Bank Plugin Update Enable/Disable.
  • Bug Fix From From name Field.
Download this release

Release Info

Developer contact-banker
Plugin Icon 128x128 WP Mail Bank: WordPress SMTP Plugin & Email Logs
Version 1.9
Comparing to
See all releases

Code changes from version 1.8 to 1.9

lib/add_mail_class_file.php CHANGED
@@ -37,7 +37,7 @@ else
37
  {
38
  $insert = new save_data();
39
  $email_setup = array();
40
- $email_setup["from_name"] = esc_attr($_REQUEST["ux_email_from_name"]);
41
  $email_setup["from_email"] = esc_attr($_REQUEST["ux_email_from_email"]);
42
  $email_setup["mailer_type"] = intval($_REQUEST["ux_rdl_ends"]);
43
  $email_setup["return_path"] = isset($_REQUEST["ux_chk_return_path"]) ? intval($_REQUEST["ux_chk_return_path"]) : 0;
@@ -95,6 +95,15 @@ else
95
  }
96
  die();
97
  }
 
 
 
 
 
 
 
 
 
98
  }
99
  }
100
  ?>
37
  {
38
  $insert = new save_data();
39
  $email_setup = array();
40
+ $email_setup["from_name"] = htmlspecialchars_decode(esc_attr($_REQUEST["from_name"]));
41
  $email_setup["from_email"] = esc_attr($_REQUEST["ux_email_from_email"]);
42
  $email_setup["mailer_type"] = intval($_REQUEST["ux_rdl_ends"]);
43
  $email_setup["return_path"] = isset($_REQUEST["ux_chk_return_path"]) ? intval($_REQUEST["ux_chk_return_path"]) : 0;
95
  }
96
  die();
97
  }
98
+ elseif($_REQUEST["param"] == "mail_bank_plugin_updates")
99
+ {
100
+ if(wp_verify_nonce( $_REQUEST["_wpnonce"], "update_plugin_nonce"))
101
+ {
102
+ $plugin_update = esc_attr($_REQUEST["mail_bank_updates"]);
103
+ update_option("mail-bank-automatic-update",$plugin_update);
104
+ die();
105
+ }
106
+ }
107
  }
108
  }
109
  ?>
lib/wp-include-menus.php CHANGED
@@ -15,6 +15,7 @@ else
15
  add_submenu_page("smtp_mail", "Settings", __("Settings", mail_bank), "read", "smtp_mail","smtp_mail");
16
  add_submenu_page("smtp_mail", "Send Test Email", __("Send Test Email", mail_bank), "read", "send_test_email","send_test_email");
17
  add_submenu_page("", "", "", "read", "send_test_email", "send_test_email");
 
18
  add_submenu_page("smtp_mail", "Recommendations", __("Recommendations", mail_bank), "read", "recommended_plugins", "recommended_plugins" );
19
  add_submenu_page("smtp_mail", "Our Other Services", __("Our Other Services", mail_bank), "read", "other_services", "other_services" );
20
  add_submenu_page("smtp_mail", "System Status", __("System Status", mail_bank), "read", "mail_system_status", "mail_system_status" );
@@ -24,6 +25,7 @@ else
24
  add_submenu_page("smtp_mail", "Settings", __("Settings", mail_bank), "read", "smtp_mail","smtp_mail");
25
  add_submenu_page("smtp_mail", "Send Test Email", __("Send Test Email", mail_bank), "read", "send_test_email","send_test_email");
26
  add_submenu_page("", "", "", "read", "send_test_email", "send_test_email");
 
27
  add_submenu_page("smtp_mail", "Recommendations", __("Recommendations", mail_bank), "read", "recommended_plugins", "recommended_plugins" );
28
  add_submenu_page("smtp_mail", "Our Other Services", __("Our Other Services", mail_bank), "read", "other_services", "other_services" );
29
  add_submenu_page("smtp_mail", "System Status", __("System Status", mail_bank), "read", "mail_system_status", "mail_system_status" );
@@ -33,6 +35,7 @@ else
33
  add_submenu_page("smtp_mail", "Settings", __("Settings", mail_bank), "read", "smtp_mail","smtp_mail");
34
  add_submenu_page("smtp_mail", "Send Test Email", __("Send Test Email", mail_bank), "read", "send_test_email","send_test_email");
35
  add_submenu_page("", "", "", "read", "send_test_email", "send_test_email");
 
36
  add_submenu_page("smtp_mail", "Recommendations", __("Recommendations", mail_bank), "read", "recommended_plugins", "recommended_plugins" );
37
  add_submenu_page("smtp_mail", "Our Other Services", __("Our Other Services", mail_bank), "read", "other_services", "other_services" );
38
  add_submenu_page("smtp_mail", "System Status", __("System Status", mail_bank), "read", "mail_system_status", "mail_system_status" );
@@ -149,5 +152,30 @@ else
149
  }
150
  }
151
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
  }
153
  ?>
15
  add_submenu_page("smtp_mail", "Settings", __("Settings", mail_bank), "read", "smtp_mail","smtp_mail");
16
  add_submenu_page("smtp_mail", "Send Test Email", __("Send Test Email", mail_bank), "read", "send_test_email","send_test_email");
17
  add_submenu_page("", "", "", "read", "send_test_email", "send_test_email");
18
+ add_submenu_page("smtp_mail", "Plugin Updates", __("Plugin Updates",mail_bank), "read", "mail_plugin_updates", "mail_plugin_updates");
19
  add_submenu_page("smtp_mail", "Recommendations", __("Recommendations", mail_bank), "read", "recommended_plugins", "recommended_plugins" );
20
  add_submenu_page("smtp_mail", "Our Other Services", __("Our Other Services", mail_bank), "read", "other_services", "other_services" );
21
  add_submenu_page("smtp_mail", "System Status", __("System Status", mail_bank), "read", "mail_system_status", "mail_system_status" );
25
  add_submenu_page("smtp_mail", "Settings", __("Settings", mail_bank), "read", "smtp_mail","smtp_mail");
26
  add_submenu_page("smtp_mail", "Send Test Email", __("Send Test Email", mail_bank), "read", "send_test_email","send_test_email");
27
  add_submenu_page("", "", "", "read", "send_test_email", "send_test_email");
28
+ add_submenu_page("smtp_mail", "Plugin Updates", __("Plugin Updates",mail_bank), "read", "mail_plugin_updates", "mail_plugin_updates");
29
  add_submenu_page("smtp_mail", "Recommendations", __("Recommendations", mail_bank), "read", "recommended_plugins", "recommended_plugins" );
30
  add_submenu_page("smtp_mail", "Our Other Services", __("Our Other Services", mail_bank), "read", "other_services", "other_services" );
31
  add_submenu_page("smtp_mail", "System Status", __("System Status", mail_bank), "read", "mail_system_status", "mail_system_status" );
35
  add_submenu_page("smtp_mail", "Settings", __("Settings", mail_bank), "read", "smtp_mail","smtp_mail");
36
  add_submenu_page("smtp_mail", "Send Test Email", __("Send Test Email", mail_bank), "read", "send_test_email","send_test_email");
37
  add_submenu_page("", "", "", "read", "send_test_email", "send_test_email");
38
+ add_submenu_page("smtp_mail", "Plugin Updates", __("Plugin Updates",mail_bank), "read", "mail_plugin_updates", "mail_plugin_updates");
39
  add_submenu_page("smtp_mail", "Recommendations", __("Recommendations", mail_bank), "read", "recommended_plugins", "recommended_plugins" );
40
  add_submenu_page("smtp_mail", "Our Other Services", __("Our Other Services", mail_bank), "read", "other_services", "other_services" );
41
  add_submenu_page("smtp_mail", "System Status", __("System Status", mail_bank), "read", "mail_system_status", "mail_system_status" );
152
  }
153
  }
154
  }
155
+ if(!function_exists( "mail_plugin_updates" ))
156
+ {
157
+ function mail_plugin_updates()
158
+ {
159
+ global $wpdb,$current_user,$user_role_permission,$wp_version;
160
+ if(is_super_admin())
161
+ {
162
+ $role = "administrator";
163
+ }
164
+ else
165
+ {
166
+ $role = $wpdb->prefix . "capabilities";
167
+ $current_user->role = array_keys($current_user->$role);
168
+ $role = $current_user->role[0];
169
+ }
170
+ if(file_exists(MAIL_BK_PLUGIN_DIR."/views/mail_header.php"))
171
+ {
172
+ include_once MAIL_BK_PLUGIN_DIR."/views/mail_header.php";
173
+ }
174
+ if (file_exists(MAIL_BK_PLUGIN_DIR ."/views/automatic-plugin-update.php"))
175
+ {
176
+ include_once MAIL_BK_PLUGIN_DIR ."/views/automatic-plugin-update.php";
177
+ }
178
+ }
179
+ }
180
  }
181
  ?>
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: contact-banker, Gallery-Bank
3
  Tags: admin, ajax, email, gmail, mail, mail smtp, mailer, outgoing mail, phpmailer, plugin, Post, posts, privacy, security, sendmail, smtp, ssl, tls, wordpress smtp, wp smtp, wp-phpmailer, wp_mail, wp mail, mailer
4
  Requires at least: 2.7
5
- Tested up to: 4.0.1
6
- Stable tag: 1.8
7
 
8
  WP Mail Bank reconfigures the PHPMailer and make it more enhanced with advanced smtp settings options.
9
 
@@ -15,9 +15,7 @@ This plugin reconfigures the wp_mail() function nd make it more enhanced to use
15
 
16
  The Plugin has options to choose between your custom smtp server or the inbuilt phpmailer.
17
 
18
- ###IMPORTANT: If you think you found a bug in WP Mail Bank or have any problem or question concerning WP Mail Bank, do not hesitate to contact us at [support@tech-banker.com](mailto:support@tech-banker.com).
19
-
20
- ***August 23, 2014: We're happy to announce that WP Mail Bank reached 2400+ plugin downloads in only 3 weeks. We frequently receive positive feedback from people using our WP Mail Bank Plugin for WordPress. Thanks so much for your support!***
21
 
22
  ###Key Features :
23
 
@@ -223,6 +221,11 @@ If any problem occurs, please contact us at [support@tech-banker.com](mailto:sup
223
  4. Debugging Output Console Log
224
  == Changelog ==
225
 
 
 
 
 
 
226
  = 1.8 =
227
 
228
  * Bug Fixed in WP Mail Bank
2
  Contributors: contact-banker, Gallery-Bank
3
  Tags: admin, ajax, email, gmail, mail, mail smtp, mailer, outgoing mail, phpmailer, plugin, Post, posts, privacy, security, sendmail, smtp, ssl, tls, wordpress smtp, wp smtp, wp-phpmailer, wp_mail, wp mail, mailer
4
  Requires at least: 2.7
5
+ Tested up to: 4.1
6
+ Stable tag: 1.9
7
 
8
  WP Mail Bank reconfigures the PHPMailer and make it more enhanced with advanced smtp settings options.
9
 
15
 
16
  The Plugin has options to choose between your custom smtp server or the inbuilt phpmailer.
17
 
18
+ ###IMPORTANT: If you think you found a bug in WP Mail Bank or have any problem or question concerning WP Mail Bank, do not hesitate to contact us at [support@tech-banker.com](mailto:support@tech-banker.com).
 
 
19
 
20
  ###Key Features :
21
 
221
  4. Debugging Output Console Log
222
  == Changelog ==
223
 
224
+ = 1.9 =
225
+
226
+ * Implemented New Feature - Automatic Mail Bank Plugin Update Enable/Disable.
227
+ * Bug Fix From From name Field.
228
+
229
  = 1.8 =
230
 
231
  * Bug Fixed in WP Mail Bank
views/automatic-plugin-update.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (!is_user_logged_in())
3
+ {
4
+ return;
5
+ }
6
+ else
7
+ {
8
+ switch($gmb_role)
9
+ {
10
+ case "administrator":
11
+ $user_role_permission = "manage_options";
12
+ break;
13
+ case "editor":
14
+ $user_role_permission = "publish_pages";
15
+ break;
16
+ case "author":
17
+ $user_role_permission = "publish_posts";
18
+ break;
19
+ }
20
+ if (!current_user_can($user_role_permission))
21
+ {
22
+ return;
23
+ }
24
+ else
25
+ {
26
+ $plugin_update_nonce = wp_create_nonce( "update_plugin_nonce" );
27
+ $mail_bank_updates = get_option("mail-bank-automatic-update");
28
+ ?>
29
+ <form id="frm_auto_update" class="layout-form" style = "max-width:1000px">
30
+ <div class="fluid-layout">
31
+ <div class="layout-span12">
32
+ <div class="widget-layout">
33
+ <div class="widget-layout-title">
34
+ <h4>
35
+ <?php _e("Plugin Updates", mail_bank); ?>
36
+ </h4>
37
+ </div>
38
+ <div class="widget-layout-body">
39
+ <div class="layout-control-group" style="margin: 10px 0 0 0 ;">
40
+ <label class="layout-control-label"><?php _e("Plugin Updates", mail_bank); ?> :</label>
41
+ <div class="layout-controls-radio">
42
+ <input type="radio" name="ux_cleanup_update" id="ux_enable_update" onclick="mail_bank_autoupdate(this);" <?php echo $mail_bank_updates == "1" ? "checked=\"checked\"" : "";?> value="1">
43
+ <label style="vertical-align: baseline;">
44
+ <?php _e("Enable", mail_bank); ?>
45
+ </label>
46
+ <input type="radio" name="ux_cleanup_update" id="ux_disable_update" onclick="mail_bank_autoupdate(this);" <?php echo $mail_bank_updates == "0" ? "checked=\"checked\"" : "";?> style="margin-left: 10px;" value="0">
47
+ <label style="vertical-align: baseline;">
48
+ <?php _e("Disable", mail_bank); ?>
49
+ </label>
50
+ </div>
51
+ </div>
52
+ <div class="layout-control-group" style="margin:10px 0 10px 0 ;">
53
+ <strong><i>This feature allows the plugin to update itself automatically when a new version is available on WordPress Repository.<br/>This allows to stay updated to the latest features. If you would like to disable automatic updates, choose the disable option above.</i></strong>
54
+ </div>
55
+ </div>
56
+ </div>
57
+ </div>
58
+ </div>
59
+ </form>
60
+ <script type="text/javascript">
61
+ function mail_bank_autoupdate(control)
62
+ {
63
+ var mail_bank_updates = jQuery(control).val();
64
+ jQuery.post(ajaxurl, "mail_bank_updates="+mail_bank_updates+"&param=mail_bank_plugin_updates&action=add_mail_library&_wpnonce=<?php echo $plugin_update_nonce ;?>", function(data)
65
+ {
66
+ });
67
+ }
68
+ </script>
69
+ <?php
70
+ }
71
+ }
72
+ ?>
views/mail_settings.php CHANGED
@@ -24,6 +24,8 @@ else
24
  "SELECT * FROM ".wp_mail_bank()
25
  );
26
  $admin_email = get_option( 'admin_email' );
 
 
27
  ?>
28
  <form id="ux_frm_email" class="layout-form" style="max-width:1000px;">
29
  <div id="message" class="top-right message" style="display: none;">
@@ -44,7 +46,7 @@ else
44
  <div class="layout-control-group">
45
  <label class="layout-control-label"><?php _e("From Name", mail_bank); ?> : <span class="error">*</span></label>
46
  <div class="layout-controls">
47
- <input type="text" name="ux_email_from_name" class="layout-span12" id="ux_email_from_name" placeholder="Please enter your From Name" value="<?php echo isset($email_data->from_name) ? $email_data->from_name : "WordPress" ;?>"/><br>
48
  <p class="wpib-desc-italic"><?php _e("You can specify the name that emails should be sent from.", mail_bank); ?></p>
49
  </div>
50
  </div>
@@ -320,8 +322,9 @@ jQuery("#ux_frm_email").validate
320
  jQuery("body").append(overlay);
321
 
322
  var password= encodeURIComponent(jQuery("#ux_txt_password").val());
 
323
  jQuery("#form_success_message").css("display","block");
324
- jQuery.post(ajaxurl, jQuery(form).serialize() +"&password="+password+"&param=add_mail_detail&action=add_mail_library", function(data)
325
  {
326
  setTimeout(function () {
327
  jQuery("#message").css("display", "block");
24
  "SELECT * FROM ".wp_mail_bank()
25
  );
26
  $admin_email = get_option( 'admin_email' );
27
+ echo stripcslashes(htmlspecialchars_decode($email_data->from_name));
28
+
29
  ?>
30
  <form id="ux_frm_email" class="layout-form" style="max-width:1000px;">
31
  <div id="message" class="top-right message" style="display: none;">
46
  <div class="layout-control-group">
47
  <label class="layout-control-label"><?php _e("From Name", mail_bank); ?> : <span class="error">*</span></label>
48
  <div class="layout-controls">
49
+ <input type="text" name="ux_email_from_name" class="layout-span12" id="ux_email_from_name" placeholder="Please enter your From Name" value="<?php echo isset($email_data->from_name) ? stripcslashes(htmlspecialchars_decode($email_data->from_name)) : "WordPress" ;?>"/><br>
50
  <p class="wpib-desc-italic"><?php _e("You can specify the name that emails should be sent from.", mail_bank); ?></p>
51
  </div>
52
  </div>
322
  jQuery("body").append(overlay);
323
 
324
  var password= encodeURIComponent(jQuery("#ux_txt_password").val());
325
+ var from_name= encodeURIComponent(jQuery("#ux_email_from_name").val());
326
  jQuery("#form_success_message").css("display","block");
327
+ jQuery.post(ajaxurl, jQuery(form).serialize() +"&password="+password+"&from_name="+from_name+"&param=add_mail_detail&action=add_mail_library", function(data)
328
  {
329
  setTimeout(function () {
330
  jQuery("#message").css("display", "block");
wp-mail-bank.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Wp Mail Bank
4
  Plugin URI: http://tech-banker.com
5
  Description: WP Mail Bank reconfigures the wp_mail() function and make it more enhanced.
6
  Author: Tech Banker
7
- Version: 1.8
8
  Author URI: http://tech-banker.com
9
  */
10
 
@@ -64,7 +64,7 @@ function wp_mail_bank_configure($phpmailer)
64
  );
65
  $mail_type = $data->mailer_type;
66
  $phpmailer->Mailer = $data->mailer_type == 0 ? "smtp" : "mail";
67
- $phpmailer->FromName = $data->from_name;
68
  $phpmailer->From = $data->from_email;
69
  $phpmailer->Sender = $data->return_path == 0 ? $data->return_email : $data->from_email;
70
  $phpmailer->WordWrap = $data->word_wrap;
@@ -136,9 +136,8 @@ function mail_bank_plugin_load_text_domain()
136
 
137
  function add_mail_icon($meta = TRUE)
138
  {
139
-
140
  global $wp_admin_bar, $wpdb, $current_user;
141
- if (!is_user_logged_in())
142
  {
143
  if(is_super_admin())
144
  {
@@ -172,6 +171,12 @@ function add_mail_icon($meta = TRUE)
172
  "href" => site_url() . "/wp-admin/admin.php?page=send_test_email",
173
  "title" => __("Send Test Email", mail_bank))
174
  );
 
 
 
 
 
 
175
  $wp_admin_bar->add_menu(array(
176
  "parent" => "mail_bank",
177
  "id" => "recommended",
@@ -211,6 +216,12 @@ function add_mail_icon($meta = TRUE)
211
  "href" => site_url() . "/wp-admin/admin.php?page=send_test_email",
212
  "title" => __("Send Test Email", mail_bank))
213
  );
 
 
 
 
 
 
214
  $wp_admin_bar->add_menu(array(
215
  "parent" => "mail_bank",
216
  "id" => "recommended",
@@ -250,6 +261,12 @@ function add_mail_icon($meta = TRUE)
250
  "href" => site_url() . "/wp-admin/admin.php?page=send_test_email",
251
  "title" => __("Send Test Email", mail_bank))
252
  );
 
 
 
 
 
 
253
  $wp_admin_bar->add_menu(array(
254
  "parent" => "mail_bank",
255
  "id" => "recommended",
@@ -322,7 +339,52 @@ function mail_bank_plugin_update_message($args)
322
  }
323
  }
324
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
325
 
 
 
 
 
 
 
 
 
326
 
327
 
328
  add_action("network_admin_menu", "create_global_menus_for_mail_bank" );
@@ -333,5 +395,6 @@ add_action("admin_menu","create_global_menus_for_mail_bank");
333
  add_action("admin_init","backend_plugin_js_scripts_mail_bank");
334
  add_action("admin_init","backend_plugin_css_scripts_mail_bank");
335
  register_activation_hook(__FILE__, "plugin_install_script_for_mail_bank");
 
336
  add_action("in_plugin_update_message-".MAIL_FILE,"mail_bank_plugin_update_message" );
337
  ?>
4
  Plugin URI: http://tech-banker.com
5
  Description: WP Mail Bank reconfigures the wp_mail() function and make it more enhanced.
6
  Author: Tech Banker
7
+ Version: 1.9
8
  Author URI: http://tech-banker.com
9
  */
10
 
64
  );
65
  $mail_type = $data->mailer_type;
66
  $phpmailer->Mailer = $data->mailer_type == 0 ? "smtp" : "mail";
67
+ $phpmailer->FromName = stripslashes(htmlspecialchars_decode($data->from_name, ENT_QUOTES));
68
  $phpmailer->From = $data->from_email;
69
  $phpmailer->Sender = $data->return_path == 0 ? $data->return_email : $data->from_email;
70
  $phpmailer->WordWrap = $data->word_wrap;
136
 
137
  function add_mail_icon($meta = TRUE)
138
  {
 
139
  global $wp_admin_bar, $wpdb, $current_user;
140
+ if (is_user_logged_in())
141
  {
142
  if(is_super_admin())
143
  {
171
  "href" => site_url() . "/wp-admin/admin.php?page=send_test_email",
172
  "title" => __("Send Test Email", mail_bank))
173
  );
174
+ $wp_admin_bar->add_menu(array(
175
+ "parent" => "mail_bank",
176
+ "id" => "mail_plugin_update",
177
+ "href" => site_url() . "/wp-admin/admin.php?page=mail_plugin_updates",
178
+ "title" => __("Plugin Updates", mail_bank))
179
+ );
180
  $wp_admin_bar->add_menu(array(
181
  "parent" => "mail_bank",
182
  "id" => "recommended",
216
  "href" => site_url() . "/wp-admin/admin.php?page=send_test_email",
217
  "title" => __("Send Test Email", mail_bank))
218
  );
219
+ $wp_admin_bar->add_menu(array(
220
+ "parent" => "mail_bank",
221
+ "id" => "mail_plugin_update",
222
+ "href" => site_url() . "/wp-admin/admin.php?page=mail_plugin_updates",
223
+ "title" => __("Plugin Updates", mail_bank))
224
+ );
225
  $wp_admin_bar->add_menu(array(
226
  "parent" => "mail_bank",
227
  "id" => "recommended",
261
  "href" => site_url() . "/wp-admin/admin.php?page=send_test_email",
262
  "title" => __("Send Test Email", mail_bank))
263
  );
264
+ $wp_admin_bar->add_menu(array(
265
+ "parent" => "mail_bank",
266
+ "id" => "mail_plugin_update",
267
+ "href" => site_url() . "/wp-admin/admin.php?page=mail_plugin_updates",
268
+ "title" => __("Plugin Updates", mail_bank))
269
+ );
270
  $wp_admin_bar->add_menu(array(
271
  "parent" => "mail_bank",
272
  "id" => "recommended",
339
  }
340
  }
341
 
342
+ $is_option_auto_update = get_option("mail-bank-automatic-update");
343
+
344
+ if($is_option_auto_update == "" || $is_option_auto_update == "1")
345
+ {
346
+ if (!wp_next_scheduled("mail_bank_auto_update"))
347
+ {
348
+ wp_schedule_event(time(), "daily", "mail_bank_auto_update");
349
+ }
350
+ add_action("mail_bank_auto_update", "mail_bank_plugin_autoUpdate");
351
+ }
352
+ else
353
+ {
354
+ wp_clear_scheduled_hook("mail_bank_auto_update");
355
+ }
356
+ if(!function_exists( "mail_bank_plugin_autoUpdate" ))
357
+ {
358
+ function mail_bank_plugin_autoUpdate()
359
+ {
360
+ try
361
+ {
362
+ require_once(ABSPATH . "wp-admin/includes/class-wp-upgrader.php");
363
+ require_once(ABSPATH . "wp-admin/includes/misc.php");
364
+ define("FS_METHOD", "direct");
365
+ require_once(ABSPATH . "wp-includes/update.php");
366
+ require_once(ABSPATH . "wp-admin/includes/file.php");
367
+ wp_update_plugins();
368
+ ob_start();
369
+ $plugin_upgrader = new Plugin_Upgrader();
370
+ $plugin_upgrader->upgrade("wp-mail-bank/wp-mail-bank.php");
371
+ $output = @ob_get_contents();
372
+ @ob_end_clean();
373
+ }
374
+ catch(Exception $e)
375
+ {
376
+ }
377
+ }
378
+ }
379
 
380
+ if(!function_exists( "plugin_uninstall_hook_for_mail_bank" ))
381
+ {
382
+ function plugin_uninstall_hook_for_mail_bank()
383
+ {
384
+ delete_option("mail-bank-automatic-update");
385
+ wp_clear_scheduled_hook("mail_bank_auto_update");
386
+ }
387
+ }
388
 
389
 
390
  add_action("network_admin_menu", "create_global_menus_for_mail_bank" );
395
  add_action("admin_init","backend_plugin_js_scripts_mail_bank");
396
  add_action("admin_init","backend_plugin_css_scripts_mail_bank");
397
  register_activation_hook(__FILE__, "plugin_install_script_for_mail_bank");
398
+ register_uninstall_hook(__FILE__, "plugin_uninstall_hook_for_mail_bank");
399
  add_action("in_plugin_update_message-".MAIL_FILE,"mail_bank_plugin_update_message" );
400
  ?>