Version Description
Download this release
Release Info
Developer | DvanKooten |
Plugin | MailChimp for WordPress |
Version | 3.0.11 |
Comparing to | |
See all releases |
Code changes from version 3.0.10 to 3.0.11
- CHANGELOG.md +17 -0
- includes/admin/class-ads.php +0 -1
- includes/class-api.php +38 -1
- includes/class-field-formatter.php +94 -0
- includes/class-field-guesser.php +28 -6
- includes/class-field-map.php +8 -37
- includes/forms/class-form-listener.php +15 -13
- includes/forms/views/js/date-fields.js +1 -1
- includes/integrations/class-integration.php +3 -2
- integrations/ninja-forms/class-ninja-forms.php +15 -5
- languages/mailchimp-for-wp-it_IT.mo +0 -0
- languages/mailchimp-for-wp-it_IT.po +9 -8
- mailchimp-for-wp.php +2 -2
- readme.txt +18 -1
- vendor/autoload_52.php +1 -1
- vendor/composer/autoload_classmap.php +1 -0
- vendor/composer/autoload_real_52.php +3 -3
CHANGELOG.md
CHANGED
@@ -1,6 +1,23 @@
|
|
1 |
Changelog
|
2 |
=========
|
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
#### 3.0.10 - January 6, 2016
|
5 |
|
6 |
**Fixes**
|
1 |
Changelog
|
2 |
=========
|
3 |
|
4 |
+
#### 3.0.11 - January 14, 2015
|
5 |
+
|
6 |
+
**Fixes**
|
7 |
+
|
8 |
+
- Incorrect hooks being fired for successful and unsuccessful form sign-ups.
|
9 |
+
|
10 |
+
**Improvements**
|
11 |
+
|
12 |
+
- Allow splitting up "birthday" and "date" fields into separate fields with `day`, `month` and `year` index.
|
13 |
+
- Improved algorithm for finding fields when integrating with Contact Form 7 or other custom forms.
|
14 |
+
- Ninja Forms integration can now automatically find name-fields.
|
15 |
+
- Ninja Forms integration can now use `mc4wp-` prefixed admin labels.
|
16 |
+
|
17 |
+
**Additions**
|
18 |
+
|
19 |
+
- `add_ecommerce_order()` and `delete_ecommerce_order()` methods to API class.
|
20 |
+
|
21 |
#### 3.0.10 - January 6, 2016
|
22 |
|
23 |
**Fixes**
|
includes/admin/class-ads.php
CHANGED
@@ -97,7 +97,6 @@ class MC4WP_Admin_Ads {
|
|
97 |
|
98 |
echo '<div class="mc4wp-box">';
|
99 |
$block = new MC4WP_Remote_Content_Block( 'https://mc4wp.com/api/content-blocks?id=106689' );
|
100 |
-
$block->refresh();
|
101 |
echo $block;
|
102 |
echo '</div>';
|
103 |
|
97 |
|
98 |
echo '<div class="mc4wp-box">';
|
99 |
$block = new MC4WP_Remote_Content_Block( 'https://mc4wp.com/api/content-blocks?id=106689' );
|
|
|
100 |
echo $block;
|
101 |
echo '</div>';
|
102 |
|
includes/class-api.php
CHANGED
@@ -330,22 +330,59 @@ class MC4WP_API {
|
|
330 |
}
|
331 |
|
332 |
/**
|
333 |
-
* @param array $order_data
|
334 |
* @see https://apidocs.mailchimp.com/api/2.0/ecomm/order-add.php
|
|
|
|
|
|
|
335 |
* @return boolean
|
336 |
*/
|
337 |
public function add_ecommerce_order( array $order_data ) {
|
338 |
$response = $this->call( 'ecomm/order-add', array( 'order' => $order_data ) );
|
339 |
|
340 |
if( is_object( $response ) ) {
|
|
|
|
|
341 |
if ( isset( $response->complete ) && $response->complete ) {
|
342 |
return true;
|
343 |
}
|
|
|
|
|
|
|
|
|
|
|
344 |
}
|
345 |
|
346 |
return false;
|
347 |
}
|
348 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
349 |
/**
|
350 |
* Calls the MailChimp API
|
351 |
*
|
330 |
}
|
331 |
|
332 |
/**
|
|
|
333 |
* @see https://apidocs.mailchimp.com/api/2.0/ecomm/order-add.php
|
334 |
+
*
|
335 |
+
* @param array $order_data
|
336 |
+
*
|
337 |
* @return boolean
|
338 |
*/
|
339 |
public function add_ecommerce_order( array $order_data ) {
|
340 |
$response = $this->call( 'ecomm/order-add', array( 'order' => $order_data ) );
|
341 |
|
342 |
if( is_object( $response ) ) {
|
343 |
+
|
344 |
+
// complete means success
|
345 |
if ( isset( $response->complete ) && $response->complete ) {
|
346 |
return true;
|
347 |
}
|
348 |
+
|
349 |
+
// 330 means order was already added: great
|
350 |
+
if( isset( $response->code ) && $response->code == 330 ) {
|
351 |
+
return true;
|
352 |
+
}
|
353 |
}
|
354 |
|
355 |
return false;
|
356 |
}
|
357 |
|
358 |
+
/**
|
359 |
+
* @see https://apidocs.mailchimp.com/api/2.0/ecomm/order-del.php
|
360 |
+
*
|
361 |
+
* @param string $store_id
|
362 |
+
* @param string $order_id
|
363 |
+
*
|
364 |
+
* @return bool
|
365 |
+
*/
|
366 |
+
public function delete_ecommerce_order( $store_id, $order_id ) {
|
367 |
+
|
368 |
+
$data = array(
|
369 |
+
'store_id' => $store_id,
|
370 |
+
'order_id' => $order_id
|
371 |
+
);
|
372 |
+
|
373 |
+
$response = $this->call( 'ecomm/order-del', $data );
|
374 |
+
|
375 |
+
if( is_object( $response ) ) {
|
376 |
+
if ( isset( $response->complete ) && $response->complete ) {
|
377 |
+
return true;
|
378 |
+
}
|
379 |
+
}
|
380 |
+
|
381 |
+
return false;
|
382 |
+
}
|
383 |
+
|
384 |
+
|
385 |
+
|
386 |
/**
|
387 |
* Calls the MailChimp API
|
388 |
*
|
includes/class-field-formatter.php
ADDED
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class MC4WP_Field_Formatter
|
5 |
+
*
|
6 |
+
* Formats values based on what the MailChimp API expects or accepts for the given field types.
|
7 |
+
*/
|
8 |
+
class MC4WP_Field_Formatter {
|
9 |
+
|
10 |
+
/**
|
11 |
+
* @param mixed $value
|
12 |
+
*
|
13 |
+
* @return array
|
14 |
+
*/
|
15 |
+
public function address( $value ) {
|
16 |
+
// auto-format if this is a string
|
17 |
+
if( is_string( $value ) ) {
|
18 |
+
|
19 |
+
// addr1, addr2, city, state, zip, country
|
20 |
+
$address_pieces = explode( ',', $value );
|
21 |
+
$address_pieces = array_filter( $address_pieces );
|
22 |
+
$address_pieces = array_values( $address_pieces );
|
23 |
+
|
24 |
+
// try to fill it.... this is a long shot
|
25 |
+
$value = array(
|
26 |
+
'addr1' => $address_pieces[0],
|
27 |
+
'city' => isset( $address_pieces[1] ) ? $address_pieces[1] : '',
|
28 |
+
'state' => isset( $address_pieces[2] ) ? $address_pieces[2] : '',
|
29 |
+
'zip' => isset( $address_pieces[3] ) ? $address_pieces[3] : '',
|
30 |
+
);
|
31 |
+
|
32 |
+
if( ! empty( $address_pieces[4] ) ) {
|
33 |
+
$value['country'] = $address_pieces[4];
|
34 |
+
}
|
35 |
+
|
36 |
+
} elseif( is_array( $value ) ) {
|
37 |
+
// merge with array of empty defaults to allow skipping certain fields
|
38 |
+
$default = array_fill_keys( array( 'addr1', 'city', 'state', 'zip' ), '' );
|
39 |
+
$value = array_merge( $default, $value );
|
40 |
+
}
|
41 |
+
|
42 |
+
return $value;
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* @param mixed $value
|
47 |
+
*
|
48 |
+
* @return string
|
49 |
+
*/
|
50 |
+
public function birthday( $value ) {
|
51 |
+
if( is_array( $value ) ) {
|
52 |
+
// allow for "day" and "month" fields
|
53 |
+
if( isset( $value['month'] ) && isset( $value['day'] ) ) {
|
54 |
+
$value = $value['month'] . '/' . $value['day'];
|
55 |
+
} else {
|
56 |
+
|
57 |
+
// if other array, just join together
|
58 |
+
$value = join( '/', $value );
|
59 |
+
}
|
60 |
+
}
|
61 |
+
|
62 |
+
// if first part looks like a day, flip order so month (or even year) comes first
|
63 |
+
// this allows `strtotime` to understand `dd/mm` values
|
64 |
+
$values = explode( '/', $value );
|
65 |
+
if( $values[0] > 12 && $values[0] <= 31 ) {
|
66 |
+
$values = array_reverse ( $values );
|
67 |
+
$value = join( '/', $values );
|
68 |
+
}
|
69 |
+
|
70 |
+
$value = (string) date( 'm/d', strtotime( $value ) );
|
71 |
+
return $value;
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* @param mixed $value
|
76 |
+
*
|
77 |
+
* @return string
|
78 |
+
*/
|
79 |
+
public function date( $value ) {
|
80 |
+
|
81 |
+
if( is_array( $value ) ) {
|
82 |
+
|
83 |
+
// allow for "year", "month" and "day" keys
|
84 |
+
if( isset( $value['year'] ) && isset( $value['month'] ) && isset( $value['day'] ) ) {
|
85 |
+
$value = $value['year'] . '/' . $value['month'] . '/' . $value['day'];
|
86 |
+
} else {
|
87 |
+
// if other array, just join together
|
88 |
+
$value = join( '/', $value );
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
return (string) date('Y-m-d', strtotime( $value ) );
|
93 |
+
}
|
94 |
+
}
|
includes/class-field-guesser.php
CHANGED
@@ -56,17 +56,17 @@ class MC4WP_Field_Guesser {
|
|
56 |
}
|
57 |
|
58 |
// remove special characters from field name
|
59 |
-
$simple_key = str_replace( array( '-', '_' ), '', $field );
|
60 |
|
61 |
-
if( empty( $guessed['
|
62 |
-
// find name field
|
63 |
-
$guessed['NAME'] = $value;
|
64 |
-
} elseif( empty( $guessed['FNAME'] ) && in_array( $simple_key, array( 'FIRSTNAME', 'FNAME', 'GIVENNAME', 'FORENAME' ) ) ) {
|
65 |
// find first name field
|
66 |
$guessed['FNAME'] = $value;
|
67 |
-
} elseif( empty( $guessed['LNAME'] ) &&
|
68 |
// find last name field
|
69 |
$guessed['LNAME'] = $value;
|
|
|
|
|
|
|
70 |
}
|
71 |
|
72 |
}
|
@@ -90,4 +90,26 @@ class MC4WP_Field_Guesser {
|
|
90 |
|
91 |
return $combined;
|
92 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
}
|
56 |
}
|
57 |
|
58 |
// remove special characters from field name
|
59 |
+
$simple_key = str_replace( array( '-', '_', ' ' ), '', $field );
|
60 |
|
61 |
+
if( empty( $guessed['FNAME'] ) && $this->string_contains( $simple_key, array( 'FIRSTNAME', 'FNAME', 'GIVENNAME', 'FORENAME' ) ) ) {
|
|
|
|
|
|
|
62 |
// find first name field
|
63 |
$guessed['FNAME'] = $value;
|
64 |
+
} elseif( empty( $guessed['LNAME'] ) && $this->string_contains( $simple_key, array( 'LASTNAME', 'LNAME', 'SURNAME', 'FAMILYNAME' ) ) ) {
|
65 |
// find last name field
|
66 |
$guessed['LNAME'] = $value;
|
67 |
+
} elseif( empty( $guessed['NAME'] ) && $this->string_contains( $simple_key, 'NAME' ) ){
|
68 |
+
// find name field
|
69 |
+
$guessed['NAME'] = $value;
|
70 |
}
|
71 |
|
72 |
}
|
90 |
|
91 |
return $combined;
|
92 |
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* @param $haystack
|
96 |
+
* @param $needles
|
97 |
+
*
|
98 |
+
* @return bool
|
99 |
+
*/
|
100 |
+
private function string_contains( $haystack, $needles ) {
|
101 |
+
|
102 |
+
if( ! is_array( $needles ) ) {
|
103 |
+
$needles = array( $needles );
|
104 |
+
}
|
105 |
+
|
106 |
+
foreach( $needles as $needle ) {
|
107 |
+
|
108 |
+
if( strpos( $haystack, $needle ) !== false ) {
|
109 |
+
return true;
|
110 |
+
}
|
111 |
+
}
|
112 |
+
|
113 |
+
return false;
|
114 |
+
}
|
115 |
}
|
includes/class-field-map.php
CHANGED
@@ -59,12 +59,18 @@ class MC4WP_Field_Map {
|
|
59 |
*/
|
60 |
public $custom_fields = array();
|
61 |
|
|
|
|
|
|
|
|
|
|
|
62 |
/**
|
63 |
* @param array $raw_data
|
64 |
* @param array $list_ids
|
65 |
*/
|
66 |
public function __construct( array $raw_data, array $list_ids ) {
|
67 |
|
|
|
68 |
$this->raw_data = $raw_data;
|
69 |
$this->lists = $this->fetch_lists( $list_ids );
|
70 |
|
@@ -247,43 +253,8 @@ class MC4WP_Field_Map {
|
|
247 |
|
248 |
$field_type = strtolower( $field_type );
|
249 |
|
250 |
-
|
251 |
-
|
252 |
-
case 'number':
|
253 |
-
$field_value = floatval( $field_value );
|
254 |
-
break;
|
255 |
-
|
256 |
-
case 'date':
|
257 |
-
$field_value = (string) date('Y-m-d', strtotime( $field_value ) );
|
258 |
-
break;
|
259 |
-
|
260 |
-
// birthday fields need to be MM/DD for the MailChimp API
|
261 |
-
case 'birthday':
|
262 |
-
$field_value = (string) date( 'm/d', strtotime( $field_value ) );
|
263 |
-
break;
|
264 |
-
|
265 |
-
case 'address':
|
266 |
-
|
267 |
-
// auto-format if this is a string
|
268 |
-
if( is_string( $field_value ) ) {
|
269 |
-
|
270 |
-
// addr1, addr2, city, state, zip, country
|
271 |
-
$address_pieces = explode( ',', $field_value );
|
272 |
-
|
273 |
-
// try to fill it.... this is a long shot
|
274 |
-
$field_value = array(
|
275 |
-
'addr1' => $address_pieces[0],
|
276 |
-
'city' => ( isset( $address_pieces[1] ) ) ? $address_pieces[1] : '',
|
277 |
-
'state' => ( isset( $address_pieces[2] ) ) ? $address_pieces[2] : '',
|
278 |
-
'zip' => ( isset( $address_pieces[3] ) ) ? $address_pieces[3] : ''
|
279 |
-
);
|
280 |
-
} elseif( is_array( $field_value ) ) {
|
281 |
-
// merge with array of empty defaults to allow skipping certain fields
|
282 |
-
$default = array_fill_keys( array( 'addr1', 'city', 'state', 'zip' ), '' );
|
283 |
-
$field_value = array_merge( $default, $field_value );
|
284 |
-
}
|
285 |
-
|
286 |
-
break;
|
287 |
}
|
288 |
|
289 |
/**
|
59 |
*/
|
60 |
public $custom_fields = array();
|
61 |
|
62 |
+
/**
|
63 |
+
* @var MC4WP_Field_Formatter
|
64 |
+
*/
|
65 |
+
private $formatter;
|
66 |
+
|
67 |
/**
|
68 |
* @param array $raw_data
|
69 |
* @param array $list_ids
|
70 |
*/
|
71 |
public function __construct( array $raw_data, array $list_ids ) {
|
72 |
|
73 |
+
$this->formatter = new MC4WP_Field_Formatter();
|
74 |
$this->raw_data = $raw_data;
|
75 |
$this->lists = $this->fetch_lists( $list_ids );
|
76 |
|
253 |
|
254 |
$field_type = strtolower( $field_type );
|
255 |
|
256 |
+
if( method_exists( $this->formatter, $field_type ) ) {
|
257 |
+
$field_value = call_user_func( array( $this->formatter, $field_type ), $field_value );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
258 |
}
|
259 |
|
260 |
/**
|
includes/forms/class-form-listener.php
CHANGED
@@ -149,10 +149,21 @@ class MC4WP_Form_Listener {
|
|
149 |
*/
|
150 |
public function respond( MC4WP_Form $form ) {
|
151 |
|
152 |
-
$success =
|
153 |
|
154 |
if( $success ) {
|
155 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
/**
|
157 |
* Fires right after a form is submitted with errors.
|
158 |
*
|
@@ -168,7 +179,7 @@ class MC4WP_Form_Listener {
|
|
168 |
/**
|
169 |
* Fires right after a form was submitted with errors.
|
170 |
*
|
171 |
-
* The dynamic portion of the hook, `$error`, refers to the error that
|
172 |
*
|
173 |
* Default errors give us the following possible hooks:
|
174 |
*
|
@@ -186,15 +197,6 @@ class MC4WP_Form_Listener {
|
|
186 |
do_action( 'mc4wp_form_error_' . $error, $form );
|
187 |
}
|
188 |
|
189 |
-
} else {
|
190 |
-
/**
|
191 |
-
* Fires right after a form is submitted without any errors (success).
|
192 |
-
*
|
193 |
-
* @since 3.0
|
194 |
-
*
|
195 |
-
* @param MC4WP_Form $form Instance of the submitted form
|
196 |
-
*/
|
197 |
-
do_action( 'mc4wp_form_success', $form );
|
198 |
}
|
199 |
|
200 |
/**
|
@@ -206,13 +208,13 @@ class MC4WP_Form_Listener {
|
|
206 |
*/
|
207 |
do_action( 'mc4wp_form_respond', $form );
|
208 |
|
209 |
-
// do stuff on success (non-AJAX)
|
210 |
if( $success && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) {
|
211 |
|
212 |
// do we want to redirect?
|
213 |
$redirect_url = $form->get_redirect_url();
|
214 |
if ( ! empty( $redirect_url ) ) {
|
215 |
-
wp_redirect( $
|
216 |
exit;
|
217 |
}
|
218 |
}
|
149 |
*/
|
150 |
public function respond( MC4WP_Form $form ) {
|
151 |
|
152 |
+
$success = $form->has_errors();
|
153 |
|
154 |
if( $success ) {
|
155 |
|
156 |
+
/**
|
157 |
+
* Fires right after a form is submitted without any errors (success).
|
158 |
+
*
|
159 |
+
* @since 3.0
|
160 |
+
*
|
161 |
+
* @param MC4WP_Form $form Instance of the submitted form
|
162 |
+
*/
|
163 |
+
do_action( 'mc4wp_form_success', $form );
|
164 |
+
|
165 |
+
} else {
|
166 |
+
|
167 |
/**
|
168 |
* Fires right after a form is submitted with errors.
|
169 |
*
|
179 |
/**
|
180 |
* Fires right after a form was submitted with errors.
|
181 |
*
|
182 |
+
* The dynamic portion of the hook, `$error`, refers to the error that occurred.
|
183 |
*
|
184 |
* Default errors give us the following possible hooks:
|
185 |
*
|
197 |
do_action( 'mc4wp_form_error_' . $error, $form );
|
198 |
}
|
199 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
}
|
201 |
|
202 |
/**
|
208 |
*/
|
209 |
do_action( 'mc4wp_form_respond', $form );
|
210 |
|
211 |
+
// do stuff on success (non-AJAX only)
|
212 |
if( $success && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) {
|
213 |
|
214 |
// do we want to redirect?
|
215 |
$redirect_url = $form->get_redirect_url();
|
216 |
if ( ! empty( $redirect_url ) ) {
|
217 |
+
wp_redirect( $redirect_url );
|
218 |
exit;
|
219 |
}
|
220 |
}
|
includes/forms/views/js/date-fields.js
CHANGED
@@ -10,7 +10,7 @@ if( testInput.type !== 'date') {
|
|
10 |
dateFields[i].placeholder = 'YYYY-MM-DD';
|
11 |
}
|
12 |
if(!dateFields[i].pattern) {
|
13 |
-
dateFields[i].pattern = '
|
14 |
}
|
15 |
}
|
16 |
}
|
10 |
dateFields[i].placeholder = 'YYYY-MM-DD';
|
11 |
}
|
12 |
if(!dateFields[i].pattern) {
|
13 |
+
dateFields[i].pattern = '[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])';
|
14 |
}
|
15 |
}
|
16 |
}
|
includes/integrations/class-integration.php
CHANGED
@@ -359,7 +359,7 @@ abstract class MC4WP_Integration {
|
|
359 |
$result = $api->subscribe( $list_id, $email, $list_field_data, $email_type, $this->options['double_optin'], $this->options['update_existing'], $this->options['replace_interests'], $this->options['send_welcome'] );
|
360 |
}
|
361 |
|
362 |
-
// if result failed, show error message
|
363 |
if ( ! $result && $api->has_error() ) {
|
364 |
error_log( sprintf( 'MailChimp for WordPres (%s): %s', $this->slug, $api->get_error_message() ) );
|
365 |
return false;
|
@@ -436,7 +436,8 @@ abstract class MC4WP_Integration {
|
|
436 |
*/
|
437 |
public function get_data() {
|
438 |
$request = mc4wp('request');
|
439 |
-
|
|
|
440 |
}
|
441 |
|
442 |
}
|
359 |
$result = $api->subscribe( $list_id, $email, $list_field_data, $email_type, $this->options['double_optin'], $this->options['update_existing'], $this->options['replace_interests'], $this->options['send_welcome'] );
|
360 |
}
|
361 |
|
362 |
+
// if result failed, show error message
|
363 |
if ( ! $result && $api->has_error() ) {
|
364 |
error_log( sprintf( 'MailChimp for WordPres (%s): %s', $this->slug, $api->get_error_message() ) );
|
365 |
return false;
|
436 |
*/
|
437 |
public function get_data() {
|
438 |
$request = mc4wp('request');
|
439 |
+
$data = $request->params->all();
|
440 |
+
return $data;
|
441 |
}
|
442 |
|
443 |
}
|
integrations/ninja-forms/class-ninja-forms.php
CHANGED
@@ -48,7 +48,7 @@ class MC4WP_Ninja_Forms_Integration extends MC4WP_Integration {
|
|
48 |
'edit_req' => false,
|
49 |
);
|
50 |
|
51 |
-
ninja_forms_register_field('mc4wp-subscribe', $args);
|
52 |
}
|
53 |
|
54 |
/**
|
@@ -66,12 +66,23 @@ class MC4WP_Ninja_Forms_Integration extends MC4WP_Integration {
|
|
66 |
* @var Ninja_Forms_Processing $ninja_forms_processing
|
67 |
*/
|
68 |
global $ninja_forms_processing;
|
|
|
|
|
69 |
$fields = $ninja_forms_processing->get_all_submitted_fields();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
|
71 |
-
|
|
|
72 |
|
73 |
// guess mailchimp variables
|
74 |
-
$parser = new MC4WP_Field_Guesser( $
|
75 |
$data = $parser->combine( array( 'guessed', 'namespaced' ) );
|
76 |
|
77 |
// do nothing if no email was found
|
@@ -79,8 +90,7 @@ class MC4WP_Ninja_Forms_Integration extends MC4WP_Integration {
|
|
79 |
return false;
|
80 |
}
|
81 |
|
82 |
-
|
83 |
-
return $this->subscribe( $data['EMAIL'], $data );
|
84 |
}
|
85 |
|
86 |
|
48 |
'edit_req' => false,
|
49 |
);
|
50 |
|
51 |
+
ninja_forms_register_field( 'mc4wp-subscribe', $args );
|
52 |
}
|
53 |
|
54 |
/**
|
66 |
* @var Ninja_Forms_Processing $ninja_forms_processing
|
67 |
*/
|
68 |
global $ninja_forms_processing;
|
69 |
+
|
70 |
+
// generate an array of field label => field value
|
71 |
$fields = $ninja_forms_processing->get_all_submitted_fields();
|
72 |
+
$pretty = array();
|
73 |
+
foreach( $fields as $field_id => $field_value ) {
|
74 |
+
|
75 |
+
// try admin label for "mc4wp-" prefixed fields, otherwise use general label
|
76 |
+
$label = $ninja_forms_processing->get_field_setting( $field_id, 'admin_label' );
|
77 |
+
if( empty( $label ) || stripos( $label, 'mc4wp-' ) !== 0 ) {
|
78 |
+
$label = $ninja_forms_processing->get_field_setting( $field_id, 'label' );
|
79 |
+
}
|
80 |
|
81 |
+
$pretty[ $label ] = $field_value;
|
82 |
+
}
|
83 |
|
84 |
// guess mailchimp variables
|
85 |
+
$parser = new MC4WP_Field_Guesser( $pretty );
|
86 |
$data = $parser->combine( array( 'guessed', 'namespaced' ) );
|
87 |
|
88 |
// do nothing if no email was found
|
90 |
return false;
|
91 |
}
|
92 |
|
93 |
+
return $this->subscribe( $data['EMAIL'], $data, $ninja_forms_processing->get_form_ID() );
|
|
|
94 |
}
|
95 |
|
96 |
|
languages/mailchimp-for-wp-it_IT.mo
CHANGED
Binary file
|
languages/mailchimp-for-wp-it_IT.po
CHANGED
@@ -5,14 +5,15 @@
|
|
5 |
# Adriano Genovese <adrygese@gmail.com>, 2015
|
6 |
# andrea.gatopoulos <andrea.gatopoulos@gmail.com>, 2015
|
7 |
# Dan <d.murtas@gmail.com>, 2014
|
8 |
-
# francesca mecca <meccafrancesca@gmail.com>, 2015
|
|
|
9 |
msgid ""
|
10 |
msgstr ""
|
11 |
"Project-Id-Version: MailChimp for WordPress\n"
|
12 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/mailchimp-for-wp\n"
|
13 |
"POT-Creation-Date: 2015-11-30 10:15:18+00:00\n"
|
14 |
-
"PO-Revision-Date:
|
15 |
-
"Last-Translator:
|
16 |
"Language-Team: Italian (Italy) (http://www.transifex.com/ibericode/mailchimp-for-wordpress/language/it_IT/)\n"
|
17 |
"MIME-Version: 1.0\n"
|
18 |
"Content-Type: text/plain; charset=UTF-8\n"
|
@@ -597,7 +598,7 @@ msgstr "Sostituire gruppi di interesse?"
|
|
597 |
msgid ""
|
598 |
"Select \"no\" if you want to add the selected groupings to any previously "
|
599 |
"selected groupings when updating a subscriber."
|
600 |
-
msgstr ""
|
601 |
|
602 |
#: includes/forms/views/tabs/form-settings.php:93
|
603 |
#: includes/integrations/views/integration-settings.php:207
|
@@ -715,7 +716,7 @@ msgid ""
|
|
715 |
"fields</a> or <a href=\"%s\">log into your MailChimp account</a> and make "
|
716 |
"sure only the email & name fields are marked as required fields for the "
|
717 |
"selected list(s)."
|
718 |
-
msgstr ""
|
719 |
|
720 |
#: includes/integrations/views/integrations.php:30
|
721 |
msgid "Enabled"
|
@@ -779,7 +780,7 @@ msgstr "Monitoraggio dell'utilizzo"
|
|
779 |
msgid ""
|
780 |
"Allow us to anonymously track how this plugin is used to help us make it "
|
781 |
"better fit your needs."
|
782 |
-
msgstr ""
|
783 |
|
784 |
#: includes/views/general-settings.php:73
|
785 |
msgid "This is what we track."
|
@@ -807,7 +808,7 @@ msgid ""
|
|
807 |
"The table below shows your MailChimp lists and their details. If you just "
|
808 |
"applied changes to your MailChimp lists, please use the following button to "
|
809 |
"renew the cached lists configuration."
|
810 |
-
msgstr ""
|
811 |
|
812 |
#: includes/views/parts/lists-overview.php:14
|
813 |
msgid "No lists were found in your MailChimp account"
|
@@ -871,7 +872,7 @@ msgstr "https://mc4wp.com/#utm_source=wp-plugin&utm_medium=mailchimp-for-wp&utm_
|
|
871 |
msgid ""
|
872 |
"MailChimp for WordPress by ibericode. Adds various highly effective sign-up "
|
873 |
"methods to your site."
|
874 |
-
msgstr ""
|
875 |
|
876 |
#. Author of the plugin/theme
|
877 |
msgid "ibericode"
|
5 |
# Adriano Genovese <adrygese@gmail.com>, 2015
|
6 |
# andrea.gatopoulos <andrea.gatopoulos@gmail.com>, 2015
|
7 |
# Dan <d.murtas@gmail.com>, 2014
|
8 |
+
# francesca mecca <meccafrancesca@gmail.com>, 2015-2016
|
9 |
+
# Martina <martina@missmarpol.it>, 2016
|
10 |
msgid ""
|
11 |
msgstr ""
|
12 |
"Project-Id-Version: MailChimp for WordPress\n"
|
13 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/mailchimp-for-wp\n"
|
14 |
"POT-Creation-Date: 2015-11-30 10:15:18+00:00\n"
|
15 |
+
"PO-Revision-Date: 2016-01-13 16:43+0000\n"
|
16 |
+
"Last-Translator: francesca mecca <meccafrancesca@gmail.com>\n"
|
17 |
"Language-Team: Italian (Italy) (http://www.transifex.com/ibericode/mailchimp-for-wordpress/language/it_IT/)\n"
|
18 |
"MIME-Version: 1.0\n"
|
19 |
"Content-Type: text/plain; charset=UTF-8\n"
|
598 |
msgid ""
|
599 |
"Select \"no\" if you want to add the selected groupings to any previously "
|
600 |
"selected groupings when updating a subscriber."
|
601 |
+
msgstr "Selezionare \"no\" se si vuole aggiungere i gruppi selezionati a dei gruppi precedentemente selezionati durante l'aggiornamento di un iscritto."
|
602 |
|
603 |
#: includes/forms/views/tabs/form-settings.php:93
|
604 |
#: includes/integrations/views/integration-settings.php:207
|
716 |
"fields</a> or <a href=\"%s\">log into your MailChimp account</a> and make "
|
717 |
"sure only the email & name fields are marked as required fields for the "
|
718 |
"selected list(s)."
|
719 |
+
msgstr "Per favore assicurati di <a href=\"%s\">configurare il plugin per l'invio di tutti i campi obbligatori</a> oppure <a href=\"%s\">effettua il login nel tuo account MailChimp</a> e assicurati soltanto di aver settato come obbligatori per la lista/e selezionata, i soli campi E-mail e nome."
|
720 |
|
721 |
#: includes/integrations/views/integrations.php:30
|
722 |
msgid "Enabled"
|
780 |
msgid ""
|
781 |
"Allow us to anonymously track how this plugin is used to help us make it "
|
782 |
"better fit your needs."
|
783 |
+
msgstr "Consenti di tracciare anonimamente come viene usato il plugin per aiutarci a renderlo piu' adatto alle tue esigenze."
|
784 |
|
785 |
#: includes/views/general-settings.php:73
|
786 |
msgid "This is what we track."
|
808 |
"The table below shows your MailChimp lists and their details. If you just "
|
809 |
"applied changes to your MailChimp lists, please use the following button to "
|
810 |
"renew the cached lists configuration."
|
811 |
+
msgstr "La tabella sottostante mostra mostra le tue liste MailChimp e i loro dettagli. Se hai appena effettuato delle modifiche a questi elenchi, usa il seguente tasto per riaggiornare la configurazione delle liste memorizzate nella cache."
|
812 |
|
813 |
#: includes/views/parts/lists-overview.php:14
|
814 |
msgid "No lists were found in your MailChimp account"
|
872 |
msgid ""
|
873 |
"MailChimp for WordPress by ibericode. Adds various highly effective sign-up "
|
874 |
"methods to your site."
|
875 |
+
msgstr "MailChimp per Wordpress by ibericode. Aggiunge differenti ed estremamente efficaci metodi di iscrizione al tuo sito."
|
876 |
|
877 |
#. Author of the plugin/theme
|
878 |
msgid "ibericode"
|
mailchimp-for-wp.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: MailChimp for WordPress
|
4 |
Plugin URI: https://mc4wp.com/#utm_source=wp-plugin&utm_medium=mailchimp-for-wp&utm_campaign=plugins-page
|
5 |
Description: MailChimp for WordPress by ibericode. Adds various highly effective sign-up methods to your site.
|
6 |
-
Version: 3.0.
|
7 |
Author: ibericode
|
8 |
Author URI: https://ibericode.com/
|
9 |
Text Domain: mailchimp-for-wp
|
@@ -47,7 +47,7 @@ function __mc4wp_load_plugin() {
|
|
47 |
}
|
48 |
|
49 |
// bootstrap the core plugin
|
50 |
-
define( 'MC4WP_VERSION', '3.0.
|
51 |
define( 'MC4WP_PLUGIN_DIR', dirname( __FILE__ ) . '/' );
|
52 |
define( 'MC4WP_PLUGIN_URL', plugins_url( '/' , __FILE__ ) );
|
53 |
define( 'MC4WP_PLUGIN_FILE', __FILE__ );
|
3 |
Plugin Name: MailChimp for WordPress
|
4 |
Plugin URI: https://mc4wp.com/#utm_source=wp-plugin&utm_medium=mailchimp-for-wp&utm_campaign=plugins-page
|
5 |
Description: MailChimp for WordPress by ibericode. Adds various highly effective sign-up methods to your site.
|
6 |
+
Version: 3.0.11
|
7 |
Author: ibericode
|
8 |
Author URI: https://ibericode.com/
|
9 |
Text Domain: mailchimp-for-wp
|
47 |
}
|
48 |
|
49 |
// bootstrap the core plugin
|
50 |
+
define( 'MC4WP_VERSION', '3.0.11' );
|
51 |
define( 'MC4WP_PLUGIN_DIR', dirname( __FILE__ ) . '/' );
|
52 |
define( 'MC4WP_PLUGIN_URL', plugins_url( '/' , __FILE__ ) );
|
53 |
define( 'MC4WP_PLUGIN_FILE', __FILE__ );
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://mc4wp.com/#utm_source=wp-plugin-repo&utm_medium=mailchimp-f
|
|
4 |
Tags: mailchimp, mc4wp, email, marketing, newsletter, subscribe, widget, mc4wp, contact form 7, woocommerce, buddypress, ibericode, mailchimp forms, mailchimp integrations
|
5 |
Requires at least: 3.7
|
6 |
Tested up to: 4.4
|
7 |
-
Stable tag: 3.0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -175,6 +175,23 @@ MailChimp for WordPress is being developed on GitHub. If you want to collaborate
|
|
175 |
== Changelog ==
|
176 |
|
177 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
#### 3.0.10 - January 6, 2016
|
179 |
|
180 |
**Fixes**
|
4 |
Tags: mailchimp, mc4wp, email, marketing, newsletter, subscribe, widget, mc4wp, contact form 7, woocommerce, buddypress, ibericode, mailchimp forms, mailchimp integrations
|
5 |
Requires at least: 3.7
|
6 |
Tested up to: 4.4
|
7 |
+
Stable tag: 3.0.11
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
175 |
== Changelog ==
|
176 |
|
177 |
|
178 |
+
#### 3.0.11 - January 14, 2015
|
179 |
+
|
180 |
+
**Fixes**
|
181 |
+
|
182 |
+
- Incorrect hooks being fired for successful and unsuccessful form sign-ups.
|
183 |
+
|
184 |
+
**Improvements**
|
185 |
+
|
186 |
+
- Allow splitting up "birthday" and "date" fields into separate fields with `day`, `month` and `year` index.
|
187 |
+
- Improved algorithm for finding fields when integrating with Contact Form 7 or other custom forms.
|
188 |
+
- Ninja Forms integration can now automatically find name-fields.
|
189 |
+
- Ninja Forms integration can now use `mc4wp-` prefixed admin labels.
|
190 |
+
|
191 |
+
**Additions**
|
192 |
+
|
193 |
+
- `add_ecommerce_order()` and `delete_ecommerce_order()` methods to API class.
|
194 |
+
|
195 |
#### 3.0.10 - January 6, 2016
|
196 |
|
197 |
**Fixes**
|
vendor/autoload_52.php
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
|
5 |
require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
|
6 |
|
7 |
-
return
|
4 |
|
5 |
require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
|
6 |
|
7 |
+
return ComposerAutoloaderInitd4f80adc9ee17e27f4c7250206fa7118::getLoader();
|
vendor/composer/autoload_classmap.php
CHANGED
@@ -20,6 +20,7 @@ return array(
|
|
20 |
'MC4WP_Dynamic_Content_Tags' => $baseDir . '/includes/class-dynamic-content-tags.php',
|
21 |
'MC4WP_Easy_Digital_Downloads_Integration' => $baseDir . '/integrations/easy-digital-downloads/class-easy-digital-downloads.php',
|
22 |
'MC4WP_Events_Manager_Integration' => $baseDir . '/integrations/events-manager/class-events-manager.php',
|
|
|
23 |
'MC4WP_Field_Guesser' => $baseDir . '/includes/class-field-guesser.php',
|
24 |
'MC4WP_Field_Map' => $baseDir . '/includes/class-field-map.php',
|
25 |
'MC4WP_Form' => $baseDir . '/includes/forms/class-form.php',
|
20 |
'MC4WP_Dynamic_Content_Tags' => $baseDir . '/includes/class-dynamic-content-tags.php',
|
21 |
'MC4WP_Easy_Digital_Downloads_Integration' => $baseDir . '/integrations/easy-digital-downloads/class-easy-digital-downloads.php',
|
22 |
'MC4WP_Events_Manager_Integration' => $baseDir . '/integrations/events-manager/class-events-manager.php',
|
23 |
+
'MC4WP_Field_Formatter' => $baseDir . '/includes/class-field-formatter.php',
|
24 |
'MC4WP_Field_Guesser' => $baseDir . '/includes/class-field-guesser.php',
|
25 |
'MC4WP_Field_Map' => $baseDir . '/includes/class-field-map.php',
|
26 |
'MC4WP_Form' => $baseDir . '/includes/forms/class-form.php',
|
vendor/composer/autoload_real_52.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
// autoload_real_52.php generated by xrstf/composer-php52
|
4 |
|
5 |
-
class
|
6 |
private static $loader;
|
7 |
|
8 |
public static function loadClassLoader($class) {
|
@@ -19,9 +19,9 @@ class ComposerAutoloaderInit1d0cebbfd4e3e45fd41f5526206ddec8 {
|
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
-
spl_autoload_register(array('
|
23 |
self::$loader = $loader = new xrstf_Composer52_ClassLoader();
|
24 |
-
spl_autoload_unregister(array('
|
25 |
|
26 |
$vendorDir = dirname(dirname(__FILE__));
|
27 |
$baseDir = dirname($vendorDir);
|
2 |
|
3 |
// autoload_real_52.php generated by xrstf/composer-php52
|
4 |
|
5 |
+
class ComposerAutoloaderInitd4f80adc9ee17e27f4c7250206fa7118 {
|
6 |
private static $loader;
|
7 |
|
8 |
public static function loadClassLoader($class) {
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInitd4f80adc9ee17e27f4c7250206fa7118', 'loadClassLoader'), true /*, true */);
|
23 |
self::$loader = $loader = new xrstf_Composer52_ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInitd4f80adc9ee17e27f4c7250206fa7118', 'loadClassLoader'));
|
25 |
|
26 |
$vendorDir = dirname(dirname(__FILE__));
|
27 |
$baseDir = dirname($vendorDir);
|