MailMunch – Grow your Email List - Version 3.0.8

Version Description

Download this release

Release Info

Developer mailmunch
Plugin Icon 128x128 MailMunch – Grow your Email List
Version 3.0.8
Comparing to
See all releases

Code changes from version 3.0.7 to 3.0.8

admin/class-mailmunch-admin.php CHANGED
@@ -133,6 +133,18 @@ class Mailmunch_Admin {
133
  echo json_encode($this->mailmunch_api->deleteWidget($_POST['widget_id']));
134
  exit;
135
  }
 
 
 
 
 
 
 
 
 
 
 
 
136
 
137
  /**
138
  * Register menu for the admin area
@@ -150,6 +162,7 @@ class Mailmunch_Admin {
150
  add_submenu_page( MAILMUNCH_SLUG, $this->integration_name. ' Landing Pages', 'Landing Pages', 'manage_options', 'edit.php?post_type='. MAILMUNCH_POST_TYPE );
151
  }
152
 
 
153
  add_submenu_page( MAILMUNCH_SLUG, $this->integration_name. ' Settings', 'Settings', 'manage_options', MAILMUNCH_SLUG. '-settings', array($this, 'settings_page') );
154
  }
155
 
@@ -267,6 +280,16 @@ class Mailmunch_Admin {
267
  }
268
  }
269
 
 
 
 
 
 
 
 
 
 
 
270
  /**
271
  * Dashboard Widget
272
  *
@@ -287,10 +310,11 @@ class Mailmunch_Admin {
287
  $html .= '<div class="mailmunch-dash-widget-inner">';
288
  $html .= '<p>Welcome to MailMunch! The #1 plugin to grow your email list.</p>';
289
  $html .= '<div>';
290
- $html .= '<a class="mailmunch-dash-option" href="'. admin_url('admin.php?page='.MAILMUNCH_SLUG) .'"><span class="dashicons dashicons-editor-table"></span><span class="mailmunch-dash-text">Forms</span></a>';
291
  if (empty($landingPagesEnabled) || $landingPagesEnabled == 'yes') {
292
  $html .= '<a class="mailmunch-dash-option" href="'. admin_url('edit.php?post_type='.MAILMUNCH_POST_TYPE) .'"><span class="dashicons dashicons-admin-page"></span><span class="mailmunch-dash-text">Landing Pages</span></a>';
293
  }
 
294
  $html .= '</div>';
295
  $html .= '</div>';
296
  $html .= '</div>';
133
  echo json_encode($this->mailmunch_api->deleteWidget($_POST['widget_id']));
134
  exit;
135
  }
136
+
137
+ public function change_email_status() {
138
+ $this->initiate_api();
139
+ echo json_encode($this->mailmunch_api->changeEmailStatus($_POST['email_id'], $_POST['email_status']));
140
+ exit;
141
+ }
142
+
143
+ public function delete_email() {
144
+ $this->initiate_api();
145
+ echo json_encode($this->mailmunch_api->deleteEmail($_POST['email_id']));
146
+ exit;
147
+ }
148
 
149
  /**
150
  * Register menu for the admin area
162
  add_submenu_page( MAILMUNCH_SLUG, $this->integration_name. ' Landing Pages', 'Landing Pages', 'manage_options', 'edit.php?post_type='. MAILMUNCH_POST_TYPE );
163
  }
164
 
165
+ add_submenu_page( MAILMUNCH_SLUG, $this->integration_name. ' Autoresponders', 'Autoresponders', 'manage_options', MAILMUNCH_SLUG. '-autoresponders', array($this, 'autoresponders_page') );
166
  add_submenu_page( MAILMUNCH_SLUG, $this->integration_name. ' Settings', 'Settings', 'manage_options', MAILMUNCH_SLUG. '-settings', array($this, 'settings_page') );
167
  }
168
 
280
  }
281
  }
282
 
283
+ /**
284
+ * Autoresponders Page
285
+ *
286
+ * @since 3.0.7
287
+ */
288
+ public function autoresponders_page() {
289
+ $this->initiate_api();
290
+ require_once(plugin_dir_path(__FILE__) . 'partials/mailmunch-autoresponders.php');
291
+ }
292
+
293
  /**
294
  * Dashboard Widget
295
  *
310
  $html .= '<div class="mailmunch-dash-widget-inner">';
311
  $html .= '<p>Welcome to MailMunch! The #1 plugin to grow your email list.</p>';
312
  $html .= '<div>';
313
+ $html .= '<a class="mailmunch-dash-option" href="'. admin_url('admin.php?page='.MAILMUNCH_SLUG) .'"><span class="dashicons dashicons-editor-table"></span><span class="mailmunch-dash-text">Forms & Popups</span></a>';
314
  if (empty($landingPagesEnabled) || $landingPagesEnabled == 'yes') {
315
  $html .= '<a class="mailmunch-dash-option" href="'. admin_url('edit.php?post_type='.MAILMUNCH_POST_TYPE) .'"><span class="dashicons dashicons-admin-page"></span><span class="mailmunch-dash-text">Landing Pages</span></a>';
316
  }
317
+ $html .= '<a class="mailmunch-dash-option" href="'. admin_url('admin.php?page='.MAILMUNCH_SLUG.'-autoresponders') .'"><span class="dashicons dashicons-email-alt"></span><span class="mailmunch-dash-text">Autoresponders</span></a>';
318
  $html .= '</div>';
319
  $html .= '</div>';
320
  $html .= '</div>';
admin/css/mailmunch-admin.css CHANGED
@@ -498,19 +498,18 @@ label.mailmunch-form-label {
498
  }
499
 
500
  .mailmunch-dash-option {
501
- display: inline-block;
502
- width: 100px;
503
- height: 80px;
504
  vertical-align: middle;
505
  border: 1px solid #EEE;
506
  border-radius: 10px;
507
  background-color: #FFF;
508
- text-align: center;
509
- padding: 20px;
510
- margin-right: 15px;
511
- margin-bottom: 15px;
512
  cursor: pointer;
513
- font-size: 14px;
514
  }
515
 
516
  .mailmunch-dash-option:hover {
@@ -518,16 +517,10 @@ label.mailmunch-form-label {
518
  }
519
 
520
  .mailmunch-dash-option .dashicons {
521
- font-size: 60px;
522
- width: 60px;
523
- height: 60px;
524
- display: block;
525
- margin: 0 auto;
526
- text-align: center;
527
- }
528
-
529
- .mailmunch-dash-option .mailmunch-dash-text {
530
- display: block;
531
- margin: 0 auto;
532
- text-align: center;
533
  }
498
  }
499
 
500
  .mailmunch-dash-option {
501
+ display: block;
502
+ width: 200px;
503
+ height: 35px;
504
  vertical-align: middle;
505
  border: 1px solid #EEE;
506
  border-radius: 10px;
507
  background-color: #FFF;
508
+ text-align: left;
509
+ padding: 10px 20px;
510
+ margin: 0 auto 15px;
 
511
  cursor: pointer;
512
+ font-size: 16px;
513
  }
514
 
515
  .mailmunch-dash-option:hover {
517
  }
518
 
519
  .mailmunch-dash-option .dashicons {
520
+ font-size: 35px;
521
+ width: 35px;
522
+ height: 35px;
523
+ display: inline-block;
524
+ vertical-align: middle;
525
+ margin-right: 5px;
 
 
 
 
 
 
526
  }
admin/js/mailmunch-admin.js CHANGED
@@ -51,6 +51,50 @@
51
  })
52
  return false;
53
  })
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
 
55
  $('#signup_form').submit(function(e) {
56
  e.preventDefault();
51
  })
52
  return false;
53
  })
54
+
55
+ $('.change-email-status').click(function() {
56
+ if (!confirm('Are you sure you want to change the status for this email?')) return false;
57
+ $.ajax({
58
+ url: ajaxurl,
59
+ type: 'POST',
60
+ data: {action: 'change_email_status', email_status: $(this).data('email-status'), email_id: $(this).data('email-id')},
61
+ dataType: 'json',
62
+ success: function(data) {
63
+ if (data.success) {
64
+ window.location.reload();
65
+ }
66
+ else {
67
+ alert('There was an error. Please try again later.');
68
+ }
69
+ }.bind(this),
70
+ error: function(data) {
71
+ alert('There was an error. Please try again later.');
72
+ }
73
+ })
74
+ return false;
75
+ })
76
+
77
+ $('.delete-email').click(function() {
78
+ if (!confirm('Are you sure you want to delete this email?')) return false;
79
+ $.ajax({
80
+ url: ajaxurl,
81
+ type: 'POST',
82
+ data: {action: 'delete_email', email_id: $(this).data('email-id')},
83
+ dataType: 'json',
84
+ success: function(data) {
85
+ if (data.success) {
86
+ $(this).parents('tr').slideUp();
87
+ }
88
+ else {
89
+ alert('There was an error. Please try again later.');
90
+ }
91
+ }.bind(this),
92
+ error: function(data) {
93
+ alert('There was an error. Please try again later.');
94
+ }
95
+ })
96
+ return false;
97
+ })
98
 
99
  $('#signup_form').submit(function(e) {
100
  e.preventDefault();
admin/partials/mailmunch-autoresponders.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Provide a autoresponders admin area view for the plugin
5
+ *
6
+ * @link http://www.mailmunch.co
7
+ * @since 3.0.8
8
+ *
9
+ * @package Mailmunch
10
+ * @subpackage Mailmunch/admin/partials
11
+ */
12
+ ?>
13
+
14
+ <?php echo $this->mailmunch_api->getAutorespondersHtml(); ?>
includes/class-mailmunch-api.php CHANGED
@@ -264,6 +264,19 @@
264
  $body = str_replace('{{TOKEN}}', $this->getUserToken(), $request['body']);
265
  return $body;
266
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
267
 
268
  function getSiteId() {
269
  return get_option($this->getPrefix(). 'site_id');
@@ -289,6 +302,28 @@
289
  }
290
  return array('success' => true);
291
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
292
 
293
  function signInUser($email, $password) {
294
  $this->requestType = 'post';
@@ -366,13 +401,21 @@
366
  'timeout' => 120,
367
  );
368
 
369
- if ($type != 'post') {
370
- $request = wp_remote_get($url, $args);
371
- }
372
- else {
373
  $args = array_merge($args, array('method' => 'POST', 'body' => $options));
374
  $request = wp_remote_post($url, $args);
375
  }
 
 
 
 
 
 
 
 
 
 
 
376
 
377
  if ( !is_wp_error( $request ) && ( $request['response']['code'] == 500 || $request['response']['code'] == 503 ) ) {
378
  return new WP_Error( 'broke', "Internal Server Error" );
264
  $body = str_replace('{{TOKEN}}', $this->getUserToken(), $request['body']);
265
  return $body;
266
  }
267
+
268
+ function getAutorespondersHtml($siteId=null) {
269
+ if (empty($siteId)) { $siteId = $this->getSiteId(); }
270
+
271
+ $this->requestType = 'get';
272
+ $request = $this->ping('/sites/'.$siteId.'/autoresponders/wordpress?plugin=mailmunch');
273
+ if( is_wp_error( $request ) ) {
274
+ return $request->get_error_message();
275
+ }
276
+
277
+ $body = str_replace('{{TOKEN}}', $this->getUserToken(), $request['body']);
278
+ return $body;
279
+ }
280
 
281
  function getSiteId() {
282
  return get_option($this->getPrefix(). 'site_id');
302
  }
303
  return array('success' => true);
304
  }
305
+
306
+ function changeEmailStatus($emailId, $emailStatus) {
307
+ $this->requestType = 'put';
308
+ $request = $this->ping('/sites/'.$this->getSiteId().'/emails/'.$emailId, array(
309
+ 'email' => array(
310
+ 'status' => $emailStatus
311
+ )
312
+ ));
313
+ if ( is_wp_error( $request ) ) {
314
+ return array('success' => false);
315
+ }
316
+ return array('success' => true);
317
+ }
318
+
319
+ function deleteEmail($emailId) {
320
+ $this->requestType = 'delete';
321
+ $request = $this->ping('/sites/'.$this->getSiteId().'/emails/'.$emailId);
322
+ if ( is_wp_error( $request ) ) {
323
+ return array('success' => false);
324
+ }
325
+ return array('success' => true);
326
+ }
327
 
328
  function signInUser($email, $password) {
329
  $this->requestType = 'post';
401
  'timeout' => 120,
402
  );
403
 
404
+ if ($type == 'post') {
 
 
 
405
  $args = array_merge($args, array('method' => 'POST', 'body' => $options));
406
  $request = wp_remote_post($url, $args);
407
  }
408
+ else if ($type == 'put') {
409
+ $args = array_merge($args, array('method' => 'PUT', 'body' => $options));
410
+ $request = wp_remote_request($url, $args);
411
+ }
412
+ else if ($type == 'delete') {
413
+ $args = array_merge($args, array('method' => 'DELETE', 'body' => $options));
414
+ $request = wp_remote_request($url, $args);
415
+ }
416
+ else {
417
+ $request = wp_remote_get($url, $args);
418
+ }
419
 
420
  if ( !is_wp_error( $request ) && ( $request['response']['code'] == 500 || $request['response']['code'] == 503 ) ) {
421
  return new WP_Error( 'broke', "Internal Server Error" );
includes/class-mailmunch.php CHANGED
@@ -22,7 +22,7 @@ define( 'MAILMUNCH_SLUG', "mailmunch" );
22
  define( 'MAILMUNCH_PREFIX', 'mailmunch' );
23
  define( 'MAILMUNCH_POST_TYPE', 'mailmunch_page' );
24
  define( 'MAILMUNCH_PLUGIN_DIRECTORY', 'mailmunch' );
25
- define( 'MAILMUNCH_VERSION', '3.0.7' );
26
 
27
  /**
28
  * The core plugin class.
@@ -218,6 +218,8 @@ class Mailmunch {
218
  $this->loader->add_action( 'wp_ajax_sign_up', $plugin_admin, 'sign_up' );
219
  $this->loader->add_action( 'wp_ajax_sign_in', $plugin_admin, 'sign_in' );
220
  $this->loader->add_action( 'wp_ajax_delete_widget', $plugin_admin, 'delete_widget' );
 
 
221
 
222
  // Dashboard
223
  $this->loader->add_action( 'wp_dashboard_setup', $plugin_admin, 'dashboard_setup' );
22
  define( 'MAILMUNCH_PREFIX', 'mailmunch' );
23
  define( 'MAILMUNCH_POST_TYPE', 'mailmunch_page' );
24
  define( 'MAILMUNCH_PLUGIN_DIRECTORY', 'mailmunch' );
25
+ define( 'MAILMUNCH_VERSION', '3.0.8' );
26
 
27
  /**
28
  * The core plugin class.
218
  $this->loader->add_action( 'wp_ajax_sign_up', $plugin_admin, 'sign_up' );
219
  $this->loader->add_action( 'wp_ajax_sign_in', $plugin_admin, 'sign_in' );
220
  $this->loader->add_action( 'wp_ajax_delete_widget', $plugin_admin, 'delete_widget' );
221
+ $this->loader->add_action( 'wp_ajax_delete_email', $plugin_admin, 'delete_email' );
222
+ $this->loader->add_action( 'wp_ajax_change_email_status', $plugin_admin, 'change_email_status' );
223
 
224
  // Dashboard
225
  $this->loader->add_action( 'wp_dashboard_setup', $plugin_admin, 'dashboard_setup' );
mailmunch.php CHANGED
@@ -16,7 +16,7 @@
16
  * Plugin Name: MailMunch - Grow Your Email List
17
  * Plugin URI: http://www.mailmunch.co
18
  * Description: The best free plugin to get more email subscribers. Beautiful signup forms and landing pages that integrate with MailChimp, Constant Contact, AWeber, Campaign Monitor and more.
19
- * Version: 3.0.7
20
  * Author: MailMunch
21
  * Author URI: http://www.mailmunch.co
22
  * License: GPL-2.0+
16
  * Plugin Name: MailMunch - Grow Your Email List
17
  * Plugin URI: http://www.mailmunch.co
18
  * Description: The best free plugin to get more email subscribers. Beautiful signup forms and landing pages that integrate with MailChimp, Constant Contact, AWeber, Campaign Monitor and more.
19
+ * Version: 3.0.8
20
  * Author: MailMunch
21
  * Author URI: http://www.mailmunch.co
22
  * License: GPL-2.0+
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: mailmunch, lizgannes
3
  Tags: signup form, newsletter, newsletters, subscribe, popup, exit popup, exit intent, subscribers, subscription, popover, lightbox, analytics, collect email, optin, optin form, optin forms, double optin, list builder, email form, lead, leads, mailchimp, mailchimp form, mailchimp newsletter, mailchimp plugin, mailchimp signup, mailchimp signup forms, mailchimp signup form, mailchimp widget, mailchimp subscribe, constant contact, contact contact form, constant contact newsletter, constant contact plugin, constant contact signup, constant contact signup forms, constant contact signup form, constant contact widget, constant contact subscribe, aweber, aweber form, aweber forms, aweber signup form, aweber plugin
4
  Requires at least: 3.0.1
5
- Tested up to: 4.8
6
- Stable tag: 3.0.7
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
2
  Contributors: mailmunch, lizgannes
3
  Tags: signup form, newsletter, newsletters, subscribe, popup, exit popup, exit intent, subscribers, subscription, popover, lightbox, analytics, collect email, optin, optin form, optin forms, double optin, list builder, email form, lead, leads, mailchimp, mailchimp form, mailchimp newsletter, mailchimp plugin, mailchimp signup, mailchimp signup forms, mailchimp signup form, mailchimp widget, mailchimp subscribe, constant contact, contact contact form, constant contact newsletter, constant contact plugin, constant contact signup, constant contact signup forms, constant contact signup form, constant contact widget, constant contact subscribe, aweber, aweber form, aweber forms, aweber signup form, aweber plugin
4
  Requires at least: 3.0.1
5
+ Tested up to: 4.9
6
+ Stable tag: 3.0.8
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9