Version Description
Download this release
Release Info
Developer | mailmunch |
Plugin | MailChimp Forms by MailMunch |
Version | 2.0.6 |
Comparing to | |
See all releases |
Code changes from version 2.0.5 to 2.0.6
admin/class-mailchimp-mailmunch-admin.php
CHANGED
@@ -64,7 +64,6 @@ class Mailchimp_Mailmunch_Admin {
|
|
64 |
$this->plugin_name = $plugin_name;
|
65 |
$this->integration_name = $integration_name;
|
66 |
$this->version = $version;
|
67 |
-
$this->mailmunch_api = new Mailmunch_Api();
|
68 |
}
|
69 |
|
70 |
/**
|
@@ -114,6 +113,7 @@ class Mailchimp_Mailmunch_Admin {
|
|
114 |
}
|
115 |
|
116 |
public function sign_up() {
|
|
|
117 |
$email = $_POST['email'];
|
118 |
$password = $_POST['password'];
|
119 |
echo json_encode($this->mailmunch_api->signUpUser($email, $password, $_POST['site_name'], $_POST['site_url']));
|
@@ -121,6 +121,7 @@ class Mailchimp_Mailmunch_Admin {
|
|
121 |
}
|
122 |
|
123 |
public function sign_in() {
|
|
|
124 |
$email = $_POST['email'];
|
125 |
$password = $_POST['password'];
|
126 |
echo json_encode($this->mailmunch_api->signInUser($email, $password));
|
@@ -128,6 +129,7 @@ class Mailchimp_Mailmunch_Admin {
|
|
128 |
}
|
129 |
|
130 |
public function delete_widget() {
|
|
|
131 |
echo json_encode($this->mailmunch_api->deleteWidget($_POST['widget_id']));
|
132 |
exit;
|
133 |
}
|
@@ -177,6 +179,12 @@ class Mailchimp_Mailmunch_Admin {
|
|
177 |
return $step;
|
178 |
}
|
179 |
|
|
|
|
|
|
|
|
|
|
|
|
|
180 |
/**
|
181 |
* Get Dashboard HTML
|
182 |
*
|
@@ -184,6 +192,8 @@ class Mailchimp_Mailmunch_Admin {
|
|
184 |
*/
|
185 |
public function get_dashboard_html() {
|
186 |
|
|
|
|
|
187 |
switch ($this->getStep()) {
|
188 |
case 'sign_out':
|
189 |
$this->mailmunch_api->signOutUser();
|
64 |
$this->plugin_name = $plugin_name;
|
65 |
$this->integration_name = $integration_name;
|
66 |
$this->version = $version;
|
|
|
67 |
}
|
68 |
|
69 |
/**
|
113 |
}
|
114 |
|
115 |
public function sign_up() {
|
116 |
+
$this->initiate_api();
|
117 |
$email = $_POST['email'];
|
118 |
$password = $_POST['password'];
|
119 |
echo json_encode($this->mailmunch_api->signUpUser($email, $password, $_POST['site_name'], $_POST['site_url']));
|
121 |
}
|
122 |
|
123 |
public function sign_in() {
|
124 |
+
$this->initiate_api();
|
125 |
$email = $_POST['email'];
|
126 |
$password = $_POST['password'];
|
127 |
echo json_encode($this->mailmunch_api->signInUser($email, $password));
|
129 |
}
|
130 |
|
131 |
public function delete_widget() {
|
132 |
+
$this->initiate_api();
|
133 |
echo json_encode($this->mailmunch_api->deleteWidget($_POST['widget_id']));
|
134 |
exit;
|
135 |
}
|
179 |
return $step;
|
180 |
}
|
181 |
|
182 |
+
public function initiate_api() {
|
183 |
+
if (empty($this->mailmunch_api)) {
|
184 |
+
$this->mailmunch_api = new Mailmunch_Api();
|
185 |
+
}
|
186 |
+
return $this->mailmunch_api;
|
187 |
+
}
|
188 |
/**
|
189 |
* Get Dashboard HTML
|
190 |
*
|
192 |
*/
|
193 |
public function get_dashboard_html() {
|
194 |
|
195 |
+
$this->initiate_api();
|
196 |
+
|
197 |
switch ($this->getStep()) {
|
198 |
case 'sign_out':
|
199 |
$this->mailmunch_api->signOutUser();
|
admin/css/mailchimp-mailmunch-admin.css
CHANGED
@@ -63,6 +63,10 @@
|
|
63 |
margin-bottom: 25px;
|
64 |
}
|
65 |
|
|
|
|
|
|
|
|
|
66 |
#connect-mailchimp {
|
67 |
text-align: center;
|
68 |
display: inline-block;
|
63 |
margin-bottom: 25px;
|
64 |
}
|
65 |
|
66 |
+
.integrate-step .inside-container .skip-link-container {
|
67 |
+
margin-top: 25px;
|
68 |
+
}
|
69 |
+
|
70 |
#connect-mailchimp {
|
71 |
text-align: center;
|
72 |
display: inline-block;
|
admin/partials/mailchimp-mailmunch-integrate.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
MailChimp Forms
|
9 |
</h2>
|
10 |
|
11 |
-
<table class="wp-list-table widefat fixed posts integration-steps">
|
12 |
<thead>
|
13 |
<tr>
|
14 |
<th>
|
@@ -28,11 +28,6 @@
|
|
28 |
<td colspan="3">
|
29 |
<div class="inside-container">
|
30 |
<?php if ($lists['total'] > 0) { ?>
|
31 |
-
<div class="mailchimp-status">
|
32 |
-
<img src="<?php echo plugins_url( 'img/check.png', dirname(__FILE__) ) ?>" />
|
33 |
-
<div>Connected to MailChimp</div>
|
34 |
-
</div>
|
35 |
-
|
36 |
<p>Choose a list to save your subscribers in:</p>
|
37 |
<form action="<?php echo add_query_arg( array('step' => 'final') ); ?>" method="POST">
|
38 |
<select name="list_id">
|
@@ -46,6 +41,10 @@
|
|
46 |
<img src="<?php echo plugins_url( 'img/warning.png', dirname(__FILE__) ) ?>" />
|
47 |
<div class="warning">You do not have a list on MailChimp. Please create one and refresh this page.</div>
|
48 |
<?php } ?>
|
|
|
|
|
|
|
|
|
49 |
</div>
|
50 |
</td>
|
51 |
</tr>
|
8 |
MailChimp Forms
|
9 |
</h2>
|
10 |
|
11 |
+
<table class="wp-list-table widefat fixed posts integration-steps integrate-step">
|
12 |
<thead>
|
13 |
<tr>
|
14 |
<th>
|
28 |
<td colspan="3">
|
29 |
<div class="inside-container">
|
30 |
<?php if ($lists['total'] > 0) { ?>
|
|
|
|
|
|
|
|
|
|
|
31 |
<p>Choose a list to save your subscribers in:</p>
|
32 |
<form action="<?php echo add_query_arg( array('step' => 'final') ); ?>" method="POST">
|
33 |
<select name="list_id">
|
41 |
<img src="<?php echo plugins_url( 'img/warning.png', dirname(__FILE__) ) ?>" />
|
42 |
<div class="warning">You do not have a list on MailChimp. Please create one and refresh this page.</div>
|
43 |
<?php } ?>
|
44 |
+
|
45 |
+
<div class="skip-link-container">
|
46 |
+
<a id="skip-onboarding" href="<?php echo add_query_arg( array('step' => 'skip_onboarding') ); ?>">skip this and create a form</a>
|
47 |
+
</div>
|
48 |
</div>
|
49 |
</td>
|
50 |
</tr>
|
includes/class-mailmunch-api.php
CHANGED
@@ -5,12 +5,11 @@
|
|
5 |
protected $requestType = 'get';
|
6 |
protected $mailmunch_prefix;
|
7 |
protected $referral = 'mailchimp-wordpress-plugin';
|
8 |
-
protected $site = null;
|
9 |
|
10 |
function __construct() {
|
11 |
$this->mailmunch_prefix = MAILCHIMP_MAILMUNCH_PREFIX.'_';
|
12 |
$this->ensureUser();
|
13 |
-
$this->
|
14 |
}
|
15 |
|
16 |
function ensureUser() {
|
@@ -62,6 +61,8 @@
|
|
62 |
|
63 |
function getSite($siteId=null) {
|
64 |
if (empty($siteId)) $siteId = $this->getSiteId();
|
|
|
|
|
65 |
$sites = $this->getSites();
|
66 |
$s = false;
|
67 |
if (count($sites)) {
|
@@ -96,10 +97,10 @@
|
|
96 |
}
|
97 |
|
98 |
function findOrCreateSite() {
|
99 |
-
$site = $this->getSite(
|
100 |
if (empty($site)) {
|
101 |
$site = $this->createSite(get_bloginfo(), home_url());
|
102 |
-
$this->setSiteId($site->id);
|
103 |
}
|
104 |
return $site;
|
105 |
}
|
@@ -144,7 +145,6 @@
|
|
144 |
}
|
145 |
|
146 |
$site = json_decode($request['body']);
|
147 |
-
update_option($this->getPrefix(). 'site_id', $site->id);
|
148 |
return $site;
|
149 |
}
|
150 |
|
@@ -206,13 +206,13 @@
|
|
206 |
$this->setUserToken($request->token);
|
207 |
|
208 |
// Migrate Site ID
|
209 |
-
$old_data =
|
210 |
if (isset($old_data["site_id"])) {
|
211 |
$this->setSiteId($old_data["site_id"]);
|
|
|
212 |
}
|
213 |
|
214 |
// Delete options for old site
|
215 |
-
delete_option($this->getPrefix(). 'data');
|
216 |
delete_option($this->getPrefix(). 'user_email');
|
217 |
delete_option($this->getPrefix(). 'user_password');
|
218 |
delete_option($this->getPrefix(). 'guest_user');
|
@@ -226,6 +226,17 @@
|
|
226 |
return false;
|
227 |
}
|
228 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
229 |
function generateUserToken() {
|
230 |
if ($this->isLegacyUser()) {
|
231 |
if ($this->migrateUser()) {
|
5 |
protected $requestType = 'get';
|
6 |
protected $mailmunch_prefix;
|
7 |
protected $referral = 'mailchimp-wordpress-plugin';
|
|
|
8 |
|
9 |
function __construct() {
|
10 |
$this->mailmunch_prefix = MAILCHIMP_MAILMUNCH_PREFIX.'_';
|
11 |
$this->ensureUser();
|
12 |
+
$this->findOrCreateSite();
|
13 |
}
|
14 |
|
15 |
function ensureUser() {
|
61 |
|
62 |
function getSite($siteId=null) {
|
63 |
if (empty($siteId)) $siteId = $this->getSiteId();
|
64 |
+
if (empty($siteId)) return false;
|
65 |
+
|
66 |
$sites = $this->getSites();
|
67 |
$s = false;
|
68 |
if (count($sites)) {
|
97 |
}
|
98 |
|
99 |
function findOrCreateSite() {
|
100 |
+
$site = $this->getSite();
|
101 |
if (empty($site)) {
|
102 |
$site = $this->createSite(get_bloginfo(), home_url());
|
103 |
+
if (!empty($site)) $this->setSiteId($site->id);
|
104 |
}
|
105 |
return $site;
|
106 |
}
|
145 |
}
|
146 |
|
147 |
$site = json_decode($request['body']);
|
|
|
148 |
return $site;
|
149 |
}
|
150 |
|
206 |
$this->setUserToken($request->token);
|
207 |
|
208 |
// Migrate Site ID
|
209 |
+
$old_data = $this->deep_unserialize(get_option($this->getPrefix(). "data"));
|
210 |
if (isset($old_data["site_id"])) {
|
211 |
$this->setSiteId($old_data["site_id"]);
|
212 |
+
delete_option($this->getPrefix(). 'data');
|
213 |
}
|
214 |
|
215 |
// Delete options for old site
|
|
|
216 |
delete_option($this->getPrefix(). 'user_email');
|
217 |
delete_option($this->getPrefix(). 'user_password');
|
218 |
delete_option($this->getPrefix(). 'guest_user');
|
226 |
return false;
|
227 |
}
|
228 |
|
229 |
+
function deep_unserialize($value, $retries=0) {
|
230 |
+
$retries++;
|
231 |
+
if ($retries > 3) return $value;
|
232 |
+
|
233 |
+
if (is_string($value)) {
|
234 |
+
$value = unserialize($value);
|
235 |
+
if (is_string($value)) $value = $this->deep_unserialize($value, $retries);
|
236 |
+
}
|
237 |
+
return $value;
|
238 |
+
}
|
239 |
+
|
240 |
function generateUserToken() {
|
241 |
if ($this->isLegacyUser()) {
|
242 |
if ($this->migrateUser()) {
|
mailchimp-mailmunch.php
CHANGED
@@ -16,7 +16,7 @@
|
|
16 |
* Plugin Name: MailChimp Forms by MailMunch
|
17 |
* Plugin URI: http://connect.mailchimp.com/integrations/mailmunch-email-list-builder
|
18 |
* Description: The MailChimp plugin allows you to quickly and easily add signup forms for your MailChimp lists. Popup, Embedded, Top Bar and a variety of different options available.
|
19 |
-
* Version: 2.0.
|
20 |
* Author: MailMunch
|
21 |
* Author URI: http://www.mailmunch.co
|
22 |
* License: GPL-2.0+
|
16 |
* Plugin Name: MailChimp Forms by MailMunch
|
17 |
* Plugin URI: http://connect.mailchimp.com/integrations/mailmunch-email-list-builder
|
18 |
* Description: The MailChimp plugin allows you to quickly and easily add signup forms for your MailChimp lists. Popup, Embedded, Top Bar and a variety of different options available.
|
19 |
+
* Version: 2.0.6
|
20 |
* Author: MailMunch
|
21 |
* Author URI: http://www.mailmunch.co
|
22 |
* License: GPL-2.0+
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: mailchimp,mailchimp form,mailchimp newsletter,mailchimp plugin,newsletter,
|
|
4 |
|
5 |
Requires at least: 3.0.1
|
6 |
Tested up to: 4.2
|
7 |
-
Stable tag: 2.0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
4 |
|
5 |
Requires at least: 3.0.1
|
6 |
Tested up to: 4.2
|
7 |
+
Stable tag: 2.0.6
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|