Version Description
- July 21, 2014 =
Improvements
- Ignore Captcha fields in sign-up data
- Updated Spanish translations
- Minor improvements to Admin and MailChimp API class
- Show field tag and required status in Lists overview table
Additions
- Add visitor IP address to sign-up data
Download this release
Release Info
Developer | DvanKooten |
Plugin | MailChimp for WordPress |
Version | 2.0.5 |
Comparing to | |
See all releases |
Code changes from version 2.0.4 to 2.0.5
- assets/css/admin.css +7 -0
- includes/class-admin.php +28 -9
- includes/class-api.php +58 -26
- includes/class-form-manager.php +17 -8
- includes/class-mailchimp.php +52 -7
- includes/functions/template.php +3 -52
- includes/integrations/class-integration.php +5 -0
- includes/views/api-settings.php +2 -2
- includes/views/parts/admin-need-support.php +5 -5
- languages/mailchimp-for-wp-es_ES.mo +0 -0
- languages/mailchimp-for-wp-es_ES.po +3 -3
- mailchimp-for-wp.php +6 -6
- readme.txt +18 -4
assets/css/admin.css
CHANGED
@@ -158,6 +158,10 @@ table.mc4wp-help tr:hover {
|
|
158 |
background-color: #ddd;
|
159 |
}
|
160 |
|
|
|
|
|
|
|
|
|
161 |
@media(max-width: 1279px) {
|
162 |
|
163 |
#mc4wp-sidebar,
|
@@ -174,6 +178,9 @@ table.mc4wp-help tr:hover {
|
|
174 |
margin-top:25px;
|
175 |
padding-top: 25px;
|
176 |
}
|
|
|
|
|
|
|
177 |
|
178 |
}
|
179 |
|
158 |
background-color: #ddd;
|
159 |
}
|
160 |
|
161 |
+
#mc4wp .wp-list-table code {
|
162 |
+
float:right;
|
163 |
+
}
|
164 |
+
|
165 |
@media(max-width: 1279px) {
|
166 |
|
167 |
#mc4wp-sidebar,
|
178 |
margin-top:25px;
|
179 |
padding-top: 25px;
|
180 |
}
|
181 |
+
#mc4wp .wp-list-table code {
|
182 |
+
float: none;
|
183 |
+
}
|
184 |
|
185 |
}
|
186 |
|
includes/class-admin.php
CHANGED
@@ -17,24 +17,43 @@ class MC4WP_Lite_Admin
|
|
17 |
/**
|
18 |
* @var string The relative path to the main plugin file from the plugins dir
|
19 |
*/
|
20 |
-
private $plugin_file = '';
|
21 |
|
22 |
public function __construct()
|
23 |
{
|
24 |
-
$this->
|
25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
add_action( 'admin_init', array( $this, 'initialize' ) );
|
27 |
add_action( 'admin_menu', array( $this, 'build_menu' ) );
|
28 |
add_action( 'admin_enqueue_scripts', array( $this, 'load_css_and_js' ) );
|
29 |
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
|
|
|
|
|
|
38 |
}
|
39 |
|
40 |
}
|
17 |
/**
|
18 |
* @var string The relative path to the main plugin file from the plugins dir
|
19 |
*/
|
20 |
+
private $plugin_file = 'mailchimp-for-wp/mailchimp-for-wp.php';
|
21 |
|
22 |
public function __construct()
|
23 |
{
|
24 |
+
$this->setup_hooks();
|
25 |
|
26 |
+
// did the user click on upgrade to pro link?
|
27 |
+
if( isset( $_GET['page'] ) && $_GET['page'] === 'mc4wp-lite-upgrade' && false === headers_sent() ) {
|
28 |
+
header("Location: https://dannyvankooten.com/mailchimp-for-wordpress/#utm_source=lite-plugin&utm_medium=link&utm_campaign=menu-upgrade-link");
|
29 |
+
exit;
|
30 |
+
}
|
31 |
+
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Registers all hooks
|
36 |
+
*/
|
37 |
+
private function setup_hooks() {
|
38 |
+
|
39 |
+
global $pagenow;
|
40 |
+
|
41 |
+
// Actions used throughout WP Admin
|
42 |
add_action( 'admin_init', array( $this, 'initialize' ) );
|
43 |
add_action( 'admin_menu', array( $this, 'build_menu' ) );
|
44 |
add_action( 'admin_enqueue_scripts', array( $this, 'load_css_and_js' ) );
|
45 |
|
46 |
+
// Hooks for Plugins overview
|
47 |
+
if( isset( $pagenow ) && $pagenow === 'plugins.php' ) {
|
48 |
+
$this->plugin_file = plugin_basename( MC4WP_LITE_PLUGIN_FILE );
|
49 |
|
50 |
+
add_filter( 'plugin_action_links_' . $this->plugin_file, array( $this, 'add_plugin_settings_link' ), 10, 2 );
|
51 |
+
add_filter( 'plugin_row_meta', array( $this, 'add_plugin_meta_links'), 10, 2 );
|
52 |
+
}
|
53 |
+
|
54 |
+
// Hooks for Form settings page
|
55 |
+
if( isset( $_GET['page'] ) && $_GET['page'] === 'mc4wp-lite-form-settings' ) {
|
56 |
+
add_filter( 'quicktags_settings', array( $this, 'set_quicktags_buttons' ), 10, 2 );
|
57 |
}
|
58 |
|
59 |
}
|
includes/class-api.php
CHANGED
@@ -114,15 +114,15 @@ class MC4WP_Lite_API {
|
|
114 |
);
|
115 |
|
116 |
$result = $this->call( 'lists/subscribe', $data );
|
117 |
-
|
118 |
-
if( $result ) {
|
119 |
|
120 |
if( ! isset( $result->error ) ) {
|
121 |
return true;
|
122 |
} else {
|
123 |
|
124 |
// check error
|
125 |
-
if( $result->code
|
126 |
return 'already_subscribed';
|
127 |
}
|
128 |
|
@@ -131,9 +131,9 @@ class MC4WP_Lite_API {
|
|
131 |
return 'error';
|
132 |
}
|
133 |
|
134 |
-
} else {
|
135 |
-
return 'error';
|
136 |
}
|
|
|
|
|
137 |
}
|
138 |
|
139 |
/**
|
@@ -144,11 +144,12 @@ class MC4WP_Lite_API {
|
|
144 |
public function get_list_groupings( $list_id )
|
145 |
{
|
146 |
$result = $this->call( 'lists/interest-groupings', array( 'id' => $list_id ) );
|
147 |
-
|
|
|
148 |
return $result;
|
149 |
-
} else {
|
150 |
-
return false;
|
151 |
}
|
|
|
|
|
152 |
}
|
153 |
|
154 |
/**
|
@@ -157,18 +158,17 @@ class MC4WP_Lite_API {
|
|
157 |
*/
|
158 |
public function get_lists()
|
159 |
{
|
160 |
-
$
|
161 |
-
'
|
162 |
-
array(
|
163 |
-
'limit' => 100
|
164 |
-
)
|
165 |
);
|
166 |
|
167 |
-
|
|
|
|
|
168 |
return $result->data;
|
169 |
-
} else {
|
170 |
-
return false;
|
171 |
}
|
|
|
|
|
172 |
}
|
173 |
|
174 |
/**
|
@@ -180,11 +180,11 @@ class MC4WP_Lite_API {
|
|
180 |
{
|
181 |
$result = $this->call( 'lists/merge-vars', array('id' => $list_ids ) );
|
182 |
|
183 |
-
if( $result && isset( $result->data ) ) {
|
184 |
return $result->data;
|
185 |
-
} else {
|
186 |
-
return false;
|
187 |
}
|
|
|
|
|
188 |
}
|
189 |
|
190 |
/**
|
@@ -196,12 +196,12 @@ class MC4WP_Lite_API {
|
|
196 |
*/
|
197 |
public function get_member_info( $list_id, $emails ) {
|
198 |
$result = $this->call( 'lists/member-info', array( 'id' => $list_id, 'emails' => $emails ) );
|
199 |
-
|
200 |
-
if( $result && isset( $result->data ) ) {
|
201 |
return $result->data;
|
202 |
-
} else {
|
203 |
-
return false;
|
204 |
}
|
|
|
|
|
205 |
}
|
206 |
|
207 |
/**
|
@@ -214,13 +214,45 @@ class MC4WP_Lite_API {
|
|
214 |
public function list_has_subscriber( $list_id, $email ) {
|
215 |
$member_info = $this->get_member_info( $list_id, array( array( 'email' => $email ) ) );
|
216 |
|
217 |
-
if( $member_info &&
|
218 |
return ( $member_info[0]->status == "subscribed" );
|
219 |
}
|
220 |
|
221 |
return false;
|
222 |
}
|
223 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
224 |
/**
|
225 |
* Calls the MailChimp API
|
226 |
*
|
@@ -243,7 +275,7 @@ class MC4WP_Lite_API {
|
|
243 |
|
244 |
$response = wp_remote_post( $url, array(
|
245 |
'body' => $data,
|
246 |
-
'timeout' =>
|
247 |
'headers' => array('Accept-Encoding' => ''),
|
248 |
'sslverify' => false
|
249 |
)
|
@@ -257,7 +289,7 @@ class MC4WP_Lite_API {
|
|
257 |
}
|
258 |
|
259 |
// dirty fix for older WP versions
|
260 |
-
if( $method === 'helper/ping' && isset( $response['headers']['content-length'] ) && (int) $response['headers']['content-length'] === 44 ) {
|
261 |
return (object) array(
|
262 |
'msg' => "Everything's Chimpy!"
|
263 |
);
|
114 |
);
|
115 |
|
116 |
$result = $this->call( 'lists/subscribe', $data );
|
117 |
+
|
118 |
+
if( is_object( $result ) ) {
|
119 |
|
120 |
if( ! isset( $result->error ) ) {
|
121 |
return true;
|
122 |
} else {
|
123 |
|
124 |
// check error
|
125 |
+
if( (int) $result->code === 214 ) {
|
126 |
return 'already_subscribed';
|
127 |
}
|
128 |
|
131 |
return 'error';
|
132 |
}
|
133 |
|
|
|
|
|
134 |
}
|
135 |
+
|
136 |
+
return 'error';
|
137 |
}
|
138 |
|
139 |
/**
|
144 |
public function get_list_groupings( $list_id )
|
145 |
{
|
146 |
$result = $this->call( 'lists/interest-groupings', array( 'id' => $list_id ) );
|
147 |
+
|
148 |
+
if( is_array( $result ) ) {
|
149 |
return $result;
|
|
|
|
|
150 |
}
|
151 |
+
|
152 |
+
return false;
|
153 |
}
|
154 |
|
155 |
/**
|
158 |
*/
|
159 |
public function get_lists()
|
160 |
{
|
161 |
+
$args = array(
|
162 |
+
'limit' => 100
|
|
|
|
|
|
|
163 |
);
|
164 |
|
165 |
+
$result = $this->call( 'lists/list', $args );
|
166 |
+
|
167 |
+
if( is_object( $result ) && isset( $result->data ) ) {
|
168 |
return $result->data;
|
|
|
|
|
169 |
}
|
170 |
+
|
171 |
+
return false;
|
172 |
}
|
173 |
|
174 |
/**
|
180 |
{
|
181 |
$result = $this->call( 'lists/merge-vars', array('id' => $list_ids ) );
|
182 |
|
183 |
+
if( is_object( $result ) && isset( $result->data ) ) {
|
184 |
return $result->data;
|
|
|
|
|
185 |
}
|
186 |
+
|
187 |
+
return false;
|
188 |
}
|
189 |
|
190 |
/**
|
196 |
*/
|
197 |
public function get_member_info( $list_id, $emails ) {
|
198 |
$result = $this->call( 'lists/member-info', array( 'id' => $list_id, 'emails' => $emails ) );
|
199 |
+
|
200 |
+
if( is_object( $result ) && isset( $result->data ) ) {
|
201 |
return $result->data;
|
|
|
|
|
202 |
}
|
203 |
+
|
204 |
+
return false;
|
205 |
}
|
206 |
|
207 |
/**
|
214 |
public function list_has_subscriber( $list_id, $email ) {
|
215 |
$member_info = $this->get_member_info( $list_id, array( array( 'email' => $email ) ) );
|
216 |
|
217 |
+
if( is_array( $member_info ) && isset( $member_info[0] ) ) {
|
218 |
return ( $member_info[0]->status == "subscribed" );
|
219 |
}
|
220 |
|
221 |
return false;
|
222 |
}
|
223 |
|
224 |
+
/**
|
225 |
+
* Unsubscribes the given email from the given MailChimp list
|
226 |
+
*
|
227 |
+
* @param string $list_id
|
228 |
+
* @param string $email
|
229 |
+
*
|
230 |
+
* @return bool
|
231 |
+
*/
|
232 |
+
public function unsubscribe( $list_id, $email ) {
|
233 |
+
|
234 |
+
$result = $this->call( 'lists/unsubscribe', array(
|
235 |
+
'id' => $list_id,
|
236 |
+
'email' => array(
|
237 |
+
'email' => $email
|
238 |
+
)
|
239 |
+
)
|
240 |
+
);
|
241 |
+
|
242 |
+
if( is_object( $result ) ) {
|
243 |
+
|
244 |
+
if ( isset( $result->complete ) && $result->complete ) {
|
245 |
+
return true;
|
246 |
+
}
|
247 |
+
|
248 |
+
if( isset( $result->error ) ) {
|
249 |
+
$this->error_message = $result->error;
|
250 |
+
}
|
251 |
+
}
|
252 |
+
|
253 |
+
return false;
|
254 |
+
}
|
255 |
+
|
256 |
/**
|
257 |
* Calls the MailChimp API
|
258 |
*
|
275 |
|
276 |
$response = wp_remote_post( $url, array(
|
277 |
'body' => $data,
|
278 |
+
'timeout' => 15,
|
279 |
'headers' => array('Accept-Encoding' => ''),
|
280 |
'sslverify' => false
|
281 |
)
|
289 |
}
|
290 |
|
291 |
// dirty fix for older WP versions
|
292 |
+
if( $method === 'helper/ping' && is_array( $response ) && isset( $response['headers']['content-length'] ) && (int) $response['headers']['content-length'] === 44 ) {
|
293 |
return (object) array(
|
294 |
'msg' => "Everything's Chimpy!"
|
295 |
);
|
includes/class-form-manager.php
CHANGED
@@ -287,20 +287,24 @@ class MC4WP_Lite_Form_Manager {
|
|
287 |
}
|
288 |
|
289 |
/**
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
public function get_posted_form_data() {
|
297 |
|
298 |
$data = array();
|
|
|
299 |
|
300 |
foreach( $_POST as $name => $value ) {
|
301 |
-
|
302 |
-
|
|
|
303 |
}
|
|
|
|
|
304 |
}
|
305 |
|
306 |
// store data somewhere safe
|
@@ -455,6 +459,11 @@ class MC4WP_Lite_Form_Manager {
|
|
455 |
}
|
456 |
}
|
457 |
|
|
|
|
|
|
|
|
|
|
|
458 |
$api = mc4wp_get_api();
|
459 |
$opts = mc4wp_get_options( 'form' );
|
460 |
|
287 |
}
|
288 |
|
289 |
/**
|
290 |
+
* Get posted form data
|
291 |
+
*
|
292 |
+
* Strips internal MailChimp for WP variables from the posted data array
|
293 |
+
*
|
294 |
+
* @return array
|
295 |
+
*/
|
296 |
public function get_posted_form_data() {
|
297 |
|
298 |
$data = array();
|
299 |
+
$ignored_fields = array( 'CPTCH_NUMBER', 'CNTCTFRM_CONTACT_ACTION', 'CPTCH_RESULT', 'CPTCH_TIME' );
|
300 |
|
301 |
foreach( $_POST as $name => $value ) {
|
302 |
+
|
303 |
+
if( $name[0] === '_' || in_array( strtoupper( $name ), $ignored_fields ) ) {
|
304 |
+
continue;
|
305 |
}
|
306 |
+
|
307 |
+
$data[$name] = $value;
|
308 |
}
|
309 |
|
310 |
// store data somewhere safe
|
459 |
}
|
460 |
}
|
461 |
|
462 |
+
// set ip address
|
463 |
+
if( ! isset( $merge_vars['OPTIN_IP'] ) && isset( $_SERVER['REMOTE_ADDR'] ) ) {
|
464 |
+
$merge_vars['OPTIN_IP'] = $_SERVER['REMOTE_ADDR'];
|
465 |
+
}
|
466 |
+
|
467 |
$api = mc4wp_get_api();
|
468 |
$opts = mc4wp_get_options( 'form' );
|
469 |
|
includes/class-mailchimp.php
CHANGED
@@ -21,11 +21,9 @@ class MC4WP_MailChimp {
|
|
21 |
|
22 |
// make api request for lists
|
23 |
$api = mc4wp_get_api();
|
24 |
-
$lists = array();
|
25 |
-
|
26 |
$lists_data = $api->get_lists();
|
27 |
|
28 |
-
if ( $lists_data ) {
|
29 |
|
30 |
$lists = array();
|
31 |
|
@@ -85,10 +83,8 @@ class MC4WP_MailChimp {
|
|
85 |
public function get_list( $list_id ) {
|
86 |
$lists = $this->get_lists();
|
87 |
|
88 |
-
|
89 |
-
|
90 |
-
return $list;
|
91 |
-
}
|
92 |
}
|
93 |
|
94 |
return false;
|
@@ -110,6 +106,55 @@ class MC4WP_MailChimp {
|
|
110 |
return '';
|
111 |
}
|
112 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
/**
|
114 |
* Build the group array object which will be stored in cache
|
115 |
* @return object
|
21 |
|
22 |
// make api request for lists
|
23 |
$api = mc4wp_get_api();
|
|
|
|
|
24 |
$lists_data = $api->get_lists();
|
25 |
|
26 |
+
if ( is_array( $lists_data ) ) {
|
27 |
|
28 |
$lists = array();
|
29 |
|
83 |
public function get_list( $list_id ) {
|
84 |
$lists = $this->get_lists();
|
85 |
|
86 |
+
if( isset( $lists[$list_id] ) ) {
|
87 |
+
return $lists[$list_id];
|
|
|
|
|
88 |
}
|
89 |
|
90 |
return false;
|
106 |
return '';
|
107 |
}
|
108 |
|
109 |
+
/**
|
110 |
+
* Returns number of subscribers on given lists.
|
111 |
+
*
|
112 |
+
* @param array $list_ids of list id's.
|
113 |
+
* @return int Sum of subscribers for given lists.
|
114 |
+
*/
|
115 |
+
public function get_subscriber_count( $list_ids ) {
|
116 |
+
|
117 |
+
// don't count when $list_ids is empty or not an array
|
118 |
+
if( ! is_array( $list_ids ) || count( $list_ids ) === 0 ) {
|
119 |
+
return 0;
|
120 |
+
}
|
121 |
+
|
122 |
+
$list_counts = get_transient( 'mc4wp_list_counts' );
|
123 |
+
|
124 |
+
if ( false === $list_counts ) {
|
125 |
+
// make api call
|
126 |
+
$api = mc4wp_get_api();
|
127 |
+
$lists = $api->get_lists();
|
128 |
+
$list_counts = array();
|
129 |
+
|
130 |
+
if ( is_array( $lists ) ) {
|
131 |
+
|
132 |
+
foreach ( $lists as $list ) {
|
133 |
+
$list_counts["{$list->id}"] = $list->stats->member_count;
|
134 |
+
}
|
135 |
+
|
136 |
+
$transient_lifetime = apply_filters( 'mc4wp_lists_count_cache_time', 1200 ); // 20 mins by default
|
137 |
+
|
138 |
+
set_transient( 'mc4wp_list_counts', $list_counts, $transient_lifetime );
|
139 |
+
set_transient( 'mc4wp_list_counts_fallback', $list_counts, 86400 ); // 1 day
|
140 |
+
} else {
|
141 |
+
// use fallback transient
|
142 |
+
$list_counts = get_transient( 'mc4wp_list_counts_fallback' );
|
143 |
+
if ( false === $list_counts ) {
|
144 |
+
return 0;
|
145 |
+
}
|
146 |
+
}
|
147 |
+
}
|
148 |
+
|
149 |
+
// start calculating subscribers count for all list combined
|
150 |
+
$count = 0;
|
151 |
+
foreach ( $list_ids as $id ) {
|
152 |
+
$count += ( isset( $list_counts[$id] ) ) ? $list_counts[$id] : 0;
|
153 |
+
}
|
154 |
+
|
155 |
+
return apply_filters( 'mc4wp_subscriber_count', $count );
|
156 |
+
}
|
157 |
+
|
158 |
/**
|
159 |
* Build the group array object which will be stored in cache
|
160 |
* @return object
|
includes/functions/template.php
CHANGED
@@ -58,8 +58,9 @@ function mc4wp_replace_variables( $text, $list_ids = array() ) {
|
|
58 |
$text = str_ireplace( $needles, $replacements, $text );
|
59 |
|
60 |
// subscriber count? only fetch these if the tag is actually used
|
61 |
-
if ( stristr( $text, '{subscriber_count}' )
|
62 |
-
$
|
|
|
63 |
$text = str_ireplace( '{subscriber_count}', $subscriber_count, $text );
|
64 |
}
|
65 |
|
@@ -77,56 +78,6 @@ function mc4wp_replace_variables( $text, $list_ids = array() ) {
|
|
77 |
return $text;
|
78 |
}
|
79 |
|
80 |
-
/**
|
81 |
-
* Returns number of subscribers on given lists.
|
82 |
-
*
|
83 |
-
* @param array $list_ids of list id's.
|
84 |
-
* @return int Sum of subscribers for given lists.
|
85 |
-
*/
|
86 |
-
function mc4wp_get_subscriber_count( $list_ids ) {
|
87 |
-
|
88 |
-
// don't count when $list_ids is empty or not an array
|
89 |
-
if( ! is_array( $list_ids ) || count( $list_ids ) === 0 ) {
|
90 |
-
return 0;
|
91 |
-
}
|
92 |
-
|
93 |
-
$list_counts = get_transient( 'mc4wp_list_counts' );
|
94 |
-
|
95 |
-
if ( false === $list_counts ) {
|
96 |
-
// make api call
|
97 |
-
$api = mc4wp_get_api();
|
98 |
-
$lists = $api->get_lists();
|
99 |
-
$list_counts = array();
|
100 |
-
|
101 |
-
if ( $lists ) {
|
102 |
-
|
103 |
-
foreach ( $lists as $list ) {
|
104 |
-
$list_counts["{$list->id}"] = $list->stats->member_count;
|
105 |
-
}
|
106 |
-
|
107 |
-
$transient_lifetime = apply_filters( 'mc4wp_lists_count_cache_time', 1200 ); // 20 mins by default
|
108 |
-
|
109 |
-
set_transient( 'mc4wp_list_counts', $list_counts, $transient_lifetime );
|
110 |
-
set_transient( 'mc4wp_list_counts_fallback', $list_counts, 86400 ); // 1 day
|
111 |
-
} else {
|
112 |
-
// use fallback transient
|
113 |
-
$list_counts = get_transient( 'mc4wp_list_counts_fallback' );
|
114 |
-
|
115 |
-
if ( ! $list_counts ) {
|
116 |
-
return 0;
|
117 |
-
}
|
118 |
-
}
|
119 |
-
}
|
120 |
-
|
121 |
-
// start calculating subscribers count for all list combined
|
122 |
-
$count = 0;
|
123 |
-
foreach ( $list_ids as $id ) {
|
124 |
-
$count += ( isset( $list_counts[$id] ) ) ? $list_counts[$id] : 0;
|
125 |
-
}
|
126 |
-
|
127 |
-
return apply_filters( 'mc4wp_subscriber_count', $count );
|
128 |
-
}
|
129 |
-
|
130 |
/**
|
131 |
* Retrieves the URL of the current WordPress page
|
132 |
*
|
58 |
$text = str_ireplace( $needles, $replacements, $text );
|
59 |
|
60 |
// subscriber count? only fetch these if the tag is actually used
|
61 |
+
if ( stristr( $text, '{subscriber_count}' ) !== false ) {
|
62 |
+
$mailchimp = new MC4WP_MailChimp();
|
63 |
+
$subscriber_count = $mailchimp->get_subscriber_count( $list_ids );
|
64 |
$text = str_ireplace( '{subscriber_count}', $subscriber_count, $text );
|
65 |
}
|
66 |
|
78 |
return $text;
|
79 |
}
|
80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
/**
|
82 |
* Retrieves the URL of the current WordPress page
|
83 |
*
|
includes/integrations/class-integration.php
CHANGED
@@ -184,6 +184,11 @@ abstract class MC4WP_Integration {
|
|
184 |
}
|
185 |
}
|
186 |
|
|
|
|
|
|
|
|
|
|
|
187 |
$result = false;
|
188 |
$merge_vars = apply_filters( 'mc4wp_merge_vars', $merge_vars, $signup_type );
|
189 |
$email_type = apply_filters( 'mc4wp_email_type', 'html' );
|
184 |
}
|
185 |
}
|
186 |
|
187 |
+
// set ip address
|
188 |
+
if( ! isset( $merge_vars['OPTIN_IP'] ) && isset( $_SERVER['REMOTE_ADDR'] ) ) {
|
189 |
+
$merge_vars['OPTIN_IP'] = $_SERVER['REMOTE_ADDR'];
|
190 |
+
}
|
191 |
+
|
192 |
$result = false;
|
193 |
$merge_vars = apply_filters( 'mc4wp_merge_vars', $merge_vars, $signup_type );
|
194 |
$email_type = apply_filters( 'mc4wp_email_type', 'html' );
|
includes/views/api-settings.php
CHANGED
@@ -60,7 +60,7 @@ if( ! defined("MC4WP_LITE_VERSION") ) {
|
|
60 |
<tr>
|
61 |
<th class="mc4wp-hide-smallscreens" scope="col">List ID</th>
|
62 |
<th scope="col">List Name</th>
|
63 |
-
<th scope="col">Merge Fields</th>
|
64 |
<th scope="col">Groupings</th>
|
65 |
<th class="mc4wp-hide-smallscreens" scope="col">Subscribers</th>
|
66 |
</tr>
|
@@ -78,7 +78,7 @@ if( ! defined("MC4WP_LITE_VERSION") ) {
|
|
78 |
<?php if( ! empty( $list->merge_vars ) && is_array( $list->merge_vars ) ) { ?>
|
79 |
<ul class="ul-square" style="margin-top: 0;">
|
80 |
<?php foreach( $list->merge_vars as $merge_var ) { ?>
|
81 |
-
<li><?php echo esc_html( $merge_var->name ); ?> <code><?php echo esc_html( $merge_var->tag ); ?></code></li>
|
82 |
<?php } ?>
|
83 |
</ul>
|
84 |
<?php } ?>
|
60 |
<tr>
|
61 |
<th class="mc4wp-hide-smallscreens" scope="col">List ID</th>
|
62 |
<th scope="col">List Name</th>
|
63 |
+
<th scope="col">Merge Fields <code>TAG</code></th>
|
64 |
<th scope="col">Groupings</th>
|
65 |
<th class="mc4wp-hide-smallscreens" scope="col">Subscribers</th>
|
66 |
</tr>
|
78 |
<?php if( ! empty( $list->merge_vars ) && is_array( $list->merge_vars ) ) { ?>
|
79 |
<ul class="ul-square" style="margin-top: 0;">
|
80 |
<?php foreach( $list->merge_vars as $merge_var ) { ?>
|
81 |
+
<li><?php echo esc_html( $merge_var->name ); if( $merge_var->req ) echo '<span style="color:red;">*</span>'; ?> <code><?php echo esc_html( $merge_var->tag ); ?></code></li>
|
82 |
<?php } ?>
|
83 |
</ul>
|
84 |
<?php } ?>
|
includes/views/parts/admin-need-support.php
CHANGED
@@ -21,9 +21,9 @@ if( ! defined("MC4WP_LITE_VERSION") ) {
|
|
21 |
</ul>
|
22 |
</div>
|
23 |
<div class="mc4wp-box">
|
24 |
-
<h4 class="mc4wp-title">About
|
25 |
-
<p>
|
26 |
-
<p>
|
27 |
-
<p><iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.facebook.com%
|
28 |
-
<p>You should follow
|
29 |
</div>
|
21 |
</ul>
|
22 |
</div>
|
23 |
<div class="mc4wp-box">
|
24 |
+
<h4 class="mc4wp-title">About 12notions</h4>
|
25 |
+
<p>12notions is the brand new company with which <a href="http://dannyvankooten.com/?utm_source=lite-plugin&utm_medium=link&utm_campaign=about">Danny van Kooten</a>, the developer of this plugin, strives to develop more and even better plugins.</p>
|
26 |
+
<p>If you like Danny's work, please "like" the 12notions Facebook page to stay updated or have a look at <a href="http://dannyvankooten.com/wordpress-plugins/#utm_source=lite-plugin&utm_medium=link&utm_campaign=about">his other WordPress plugins</a>.</p>
|
27 |
+
<p><iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.facebook.com%2F12notions&width&layout=standard&action=like&show_faces=true&share=false&appId=225994527565061" scrolling="no" frameborder="0" style="border:none; width: 100%; overflow:hidden; height: 80px;" allowTransparency="true"></iframe></p>
|
28 |
+
<p>You should follow <a href="http://twitter.com/12notions">@12notions</a> or <a href="http://twitter.com/dannyvankooten">@DannyvanKooten</a> on Twitter.</p>
|
29 |
</div>
|
languages/mailchimp-for-wp-es_ES.mo
CHANGED
Binary file
|
languages/mailchimp-for-wp-es_ES.po
CHANGED
@@ -2,14 +2,14 @@ msgid ""
|
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: MailChimp for WordPress\n"
|
4 |
"POT-Creation-Date: 2014-05-14 22:19+0100\n"
|
5 |
-
"PO-Revision-Date: 2014-
|
6 |
"Last-Translator: Danny <hi@dannyvankooten.com>\n"
|
7 |
"Language-Team: Danny van Kooten <hi@dannyvankooten.com>\n"
|
8 |
"Language: en_EN\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"X-Generator: Poedit 1.
|
13 |
"X-Poedit-KeywordsList: _;gettext;gettext_noop;__;_e\n"
|
14 |
"X-Poedit-Basepath: .\n"
|
15 |
"X-Poedit-SearchPath-0: ..\n"
|
@@ -549,7 +549,7 @@ msgid ""
|
|
549 |
"value will be used."
|
550 |
msgstr ""
|
551 |
"Los ajustes que especifiques aquí anularán la <a href=\"%s\"> configuración "
|
552 |
-
"general de los formularios</
|
553 |
"utilizará el valor de ajuste general correspondiente."
|
554 |
|
555 |
#: ../includes/views/metaboxes/optional-form-settings.php:10
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: MailChimp for WordPress\n"
|
4 |
"POT-Creation-Date: 2014-05-14 22:19+0100\n"
|
5 |
+
"PO-Revision-Date: 2014-07-16 21:29+0100\n"
|
6 |
"Last-Translator: Danny <hi@dannyvankooten.com>\n"
|
7 |
"Language-Team: Danny van Kooten <hi@dannyvankooten.com>\n"
|
8 |
"Language: en_EN\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"X-Generator: Poedit 1.6.6\n"
|
13 |
"X-Poedit-KeywordsList: _;gettext;gettext_noop;__;_e\n"
|
14 |
"X-Poedit-Basepath: .\n"
|
15 |
"X-Poedit-SearchPath-0: ..\n"
|
549 |
"value will be used."
|
550 |
msgstr ""
|
551 |
"Los ajustes que especifiques aquí anularán la <a href=\"%s\"> configuración "
|
552 |
+
"general de los formularios</a>. Si no se especifica ningún valor, se "
|
553 |
"utilizará el valor de ajuste general correspondiente."
|
554 |
|
555 |
#: ../includes/views/metaboxes/optional-form-settings.php:10
|
mailchimp-for-wp.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: MailChimp for WordPress Lite
|
4 |
Plugin URI: https://dannyvankooten.com/mailchimp-for-wordpress/
|
5 |
Description: Lite version of MailChimp for WordPress. Adds various sign-up methods to your website.
|
6 |
-
Version: 2.0.
|
7 |
Author: Danny van Kooten
|
8 |
Author URI: http://dannyvankooten.com
|
9 |
Text Domain: mailchimp-for-wp
|
@@ -42,15 +42,15 @@ if( ! defined( 'ABSPATH' ) ) {
|
|
42 |
function mc4wp_load_plugin() {
|
43 |
|
44 |
// don't load plugin if user has the premium version installed and activated
|
45 |
-
if( defined(
|
46 |
return false;
|
47 |
}
|
48 |
|
49 |
// bootstrap the lite plugin
|
50 |
-
define(
|
51 |
-
define(
|
52 |
-
define(
|
53 |
-
define(
|
54 |
|
55 |
require_once MC4WP_LITE_PLUGIN_DIR . 'includes/functions/general.php';
|
56 |
require_once MC4WP_LITE_PLUGIN_DIR . 'includes/functions/template.php';
|
3 |
Plugin Name: MailChimp for WordPress Lite
|
4 |
Plugin URI: https://dannyvankooten.com/mailchimp-for-wordpress/
|
5 |
Description: Lite version of MailChimp for WordPress. Adds various sign-up methods to your website.
|
6 |
+
Version: 2.0.5
|
7 |
Author: Danny van Kooten
|
8 |
Author URI: http://dannyvankooten.com
|
9 |
Text Domain: mailchimp-for-wp
|
42 |
function mc4wp_load_plugin() {
|
43 |
|
44 |
// don't load plugin if user has the premium version installed and activated
|
45 |
+
if( defined( 'MC4WP_VERSION' ) ) {
|
46 |
return false;
|
47 |
}
|
48 |
|
49 |
// bootstrap the lite plugin
|
50 |
+
define( 'MC4WP_LITE_VERSION', '2.0.5' );
|
51 |
+
define( 'MC4WP_LITE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
52 |
+
define( 'MC4WP_LITE_PLUGIN_URL', plugins_url( '/' , __FILE__ ) );
|
53 |
+
define( 'MC4WP_LITE_PLUGIN_FILE', __FILE__ );
|
54 |
|
55 |
require_once MC4WP_LITE_PLUGIN_DIR . 'includes/functions/general.php';
|
56 |
require_once MC4WP_LITE_PLUGIN_DIR . 'includes/functions/template.php';
|
readme.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
=== MailChimp for WordPress ===
|
2 |
-
Contributors: DvanKooten
|
3 |
Donate link: https://dannyvankooten.com/mailchimp-for-wordpress/
|
4 |
Tags: mailchimp,form,shortcode,widget,checkbox,comment,newsletter,buddypress,multisite,bbpress,woocommerce,easy digital downloads,contact form,contact form 7
|
5 |
Requires at least: 3.6
|
6 |
Tested up to: 3.9.1
|
7 |
-
Stable tag: 2.0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -217,6 +217,20 @@ Your theme folder can be found by browsing to `/wp-content/themes/your-theme-nam
|
|
217 |
|
218 |
== Changelog ==
|
219 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
220 |
= 2.0.4 - July 2, 2014 =
|
221 |
|
222 |
**Fixes**
|
@@ -446,5 +460,5 @@ Your theme folder can be found by browsing to `/wp-content/themes/your-theme-nam
|
|
446 |
|
447 |
== Upgrade Notice ==
|
448 |
|
449 |
-
= 2.0.
|
450 |
-
|
1 |
=== MailChimp for WordPress ===
|
2 |
+
Contributors: DvanKooten, 12notions
|
3 |
Donate link: https://dannyvankooten.com/mailchimp-for-wordpress/
|
4 |
Tags: mailchimp,form,shortcode,widget,checkbox,comment,newsletter,buddypress,multisite,bbpress,woocommerce,easy digital downloads,contact form,contact form 7
|
5 |
Requires at least: 3.6
|
6 |
Tested up to: 3.9.1
|
7 |
+
Stable tag: 2.0.5
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
217 |
|
218 |
== Changelog ==
|
219 |
|
220 |
+
= 2.0.5 - July 21, 2014 =
|
221 |
+
|
222 |
+
**Improvements**
|
223 |
+
|
224 |
+
- Ignore Captcha fields in sign-up data
|
225 |
+
- Updated Spanish translations
|
226 |
+
- Minor improvements to Admin and MailChimp API class
|
227 |
+
- Show field tag and required status in Lists overview table
|
228 |
+
|
229 |
+
**Additions**
|
230 |
+
|
231 |
+
- Add visitor IP address to sign-up data
|
232 |
+
|
233 |
+
|
234 |
= 2.0.4 - July 2, 2014 =
|
235 |
|
236 |
**Fixes**
|
460 |
|
461 |
== Upgrade Notice ==
|
462 |
|
463 |
+
= 2.0.5 =
|
464 |
+
Various minor improvements code and usability improvements.
|