MailChimp List Subscribe Form - Version 1.5.5

Version Description

If you are updating from v1.4.x, you will need to re-authorize with an API key.

Download this release

Release Info

Developer MailChimp
Plugin Icon wp plugin MailChimp List Subscribe Form
Version 1.5.5
Comparing to
See all releases

Code changes from version 1.5.3 to 1.5.5

README.md DELETED
@@ -1,225 +0,0 @@
1
- === MailChimp List Subscribe Form ===
2
- Contributors: crowdfavorite
3
- Tags: mailchimp, email, newsletter, signup, marketing, plugin, widget
4
- Requires at least: 2.8
5
- Tested up to: 4.0
6
- Stable tag: 1.5
7
-
8
- == Description ==
9
-
10
- Use the MailChimp List Subscribe plugin to quickly add a MailChimp signup form widget to your WordPress 2.8 or higher site.
11
-
12
- After installation, you’ll log in with your API key, select your MailChimp list, choose merge fields and groups, and add the widget to your site. Typically, installation and setup will take about 5-10 minutes, and absolutely everything can be done via the WordPress Setting GUI, with no file editing at all.
13
-
14
- == Installation ==
15
-
16
- This section describes how to install the plugin and get started using it.
17
-
18
- = Version 2.8+ =
19
- 1. Unzip our archive and upload the entire mailchimp directory to your `/wp-content/plugins/ directory`
20
- 2. Activate the plugin through the **Plugins** menu in WordPress
21
- 3. Navigate to **Settings** click **MailChimp Setup**.
22
- 4. Enter your MailChimp API Key and let the plugin verify it.
23
- 5. Select the list where you want to send new MailChimp subscribers.
24
- 6. Optional: turn **MonkeyRewards** on or off.
25
- 7. Optional: Turn **Merge Fields** and **Groups** on or off. Navigate to **Appearance**, and click **Widgets**. Drag the MailChimp Widget into one of your Widget Areas.
26
-
27
-
28
- = Advanced =
29
- If you have a custom coded sidebar or bells and whistles that prevent enabling widgets through the WordPress GUI, complete these steps instead.
30
-
31
- WordPress v2.8 or higher:
32
- ` [mailchimpsf_form] `
33
-
34
- If you are adding it inside a php code block, pop this in:
35
-
36
- ` mailchimpSF_signup_form(); `
37
-
38
- Or, if you are dropping it in between a bunch of HTML, use this:
39
-
40
- `<?php mailchimpSF_signup_form(); ?>`
41
-
42
- Where ever you want it to show up.
43
-
44
- Note: in some environments you will need to install the Exec_PHP plugin to use that method of display. It can be found here: http://wordpress.org/extend/plugins/exec-php/
45
-
46
- == Upgrading ==
47
-
48
- If you are upgrading to version 1.2.1 and you used the widget in your sidebar previously, all you need to do is drag the `MailChimp Widget` back into the sidebar, visit the MailChimp settings page (which will have maintained your prior settings), click the "Update List" button, and you're done!
49
-
50
- == Internationalization (i18n) ==
51
- Currently we have the plugin configured so it can be easily translated and the following languages supported:
52
-
53
- * bg_BG - Bulgarian in Bulgaria (thanks to [SiteGround](http://www.siteground.com/wordpress-hosting.htm) for contributing)
54
- * cs_CZ - Czech in the Czech Republic (thanks to [Peter Kahoun](http://kahi.cz/) for contributing)
55
- * da_DK - Danish in Denmark (thanks to Jan Lund for contributing)
56
- * de_DE - German in Germany (thanks to Michael Jaekel for contributing)
57
- * el_GR - Modern Greek in Greece (thanks to Ιωάννης Δημοφέρλιας (John Dimoferlias) for contributing)
58
- * en_US - English in the U.S.
59
- * es_CL - Spanish in Chile (thanks to Tomás Nader for contributing)
60
- * es_ES - Spanish in Spain (thanks to [Claudia Mansilla](http://cricava.com/) for contributing)
61
- * et_ET - Estonian in Estonia (thanks to [Helen Urbanik](http://www.motomaania.ee/) for contributing)
62
- * fr_FR - French in France (thanks to [Maxime Toulliou](http://www.maximetoulliou.com/) for contributing)
63
- * he_IL - Hebrew in Israel (thanks to [שגיב בית](http://www.sagive.co.il) for contributing)
64
- * hu_HU - Hungarian in Hungary (thanks to Okostobi for contributing)
65
- * it_IT - Italian in Italy (thanks to [Stefan Des](http://www.stefandes.com) for contributing)
66
- * ko_KR - Korean (thanks to 백선기 (SK Baek) for contributing)
67
- * nb_NO - Norwegian (thanks to [Alexander Roterud aka Defrag](http://www.tigerpews.com) for contributing)
68
- * nl_BE - Dutch (thanks to [Filip Stas](http://suddenelfilio.net/) for contributing)
69
- * pt_BR - Portuguese in Brazil (thanks to Maria Manoela Porto for contributing)
70
- * pt_PT - Portuguese in Portugal (thanks to [Tiago Faria](http://xroot.org) for contributing)
71
- * ro_RO - Romanian in Romania (thanks to Alexandru Armin Roșu for contributing)
72
- * ru_RU - Russian in the Russian Federation (thanks to [Илья](http://fatcow.com) for contributing)
73
- * sv_SE - Swedish in Sweden (thanks to [Sebastian Johnsson](http://www.agiley.se/) for contributing)
74
- * tr_TR - Turkish in Turkey (thanks to [Hakan E.](http://kazancexpert.com/) for contributing)
75
-
76
- If your language is not listed above, feel free to create a translation. Here are the basic steps:
77
-
78
- 1. Copy "mailchimp_i18n-en_US.po" to "mailchimp_i18n-LANG_COUNTRY.po" - fill in LANG and COUNTRY with whatever you use for WPLANG in wp-config.php
79
- 2. Grab a transalation editor. [POedit](http://www.poedit.net/) works for us
80
- 3. Translate each line - if you need some context, just open up mailchimp.php and search for the line number or text
81
- 4. [Fork](http://help.github.com/fork-a-repo/) the [repository on github](https://github.com/crowdfavorite/wp-mailchimp)
82
- 5. [Clone](http://help.github.com/remotes/#clone) the _develop_ branch
83
- 6. Add the appropriately named files to the /po/ directory and edit the /readme.txt to include how you'd like to be attributed
84
- 7. Make a [pull request](http://help.github.com/send-pull-requests/)
85
-
86
-
87
- == Frequently Asked Questions ==
88
-
89
- = What in the world is MailChimp? =
90
-
91
- Good question! [MailChimp](http://mailchimp.com/features/all/) is full of useful, powerful email marketing features that are easy to use and even a little fun (that's right---we said fun), whether you're an email marketing expert, or a small business just getting started.
92
-
93
- To learn more, just check out our site: [MailChimp](http://mailchimp.com/features/all/)
94
-
95
-
96
- = Wait a minute, you want me to pay to try this? =
97
-
98
- *Absolutely not!* We welcome you to come signup for a [FREE Trial Account](http://mailchimp.com/signup/) and see if you find it useful.
99
-
100
- = I want this in my language, do you have a translation? =
101
- Maybe! Look in the /po/ directory in our plugin package and see if your language is in there. If it is, great! If it is not, feel from to create one. Here are the basic steps:
102
-
103
- 1. Copy "mailchimp_i18n-en_US.po" to "mailchimp_i18n-LANG_COUNTRY.po" - fill in LANG and COUNTRY with whatever you use for WPLANG in wp-config.php
104
- 2. Grab a transalation editor. [POedit](http://www.poedit.net/) works for us
105
- 3. Translate each line - if you need some context, just open up mailchimp.php and search for the line number or text
106
- 4. [Fork](http://help.github.com/fork-a-repo/) the [repository on github](https://github.com/crowdfavorite/wp-mailchimp)
107
- 5. [Clone](http://help.github.com/remotes/#clone) the _develop_ branch
108
- 6. Add the appropriately named files to the /po/ directory and edit the /readme.txt to include how you'd like to be attributed
109
- 7. Make a [pull request](http://help.github.com/send-pull-requests/)
110
-
111
-
112
- == Screenshots ==
113
-
114
- 1. Entering your MailChimp login info
115
- 2. Selecting your MailChimp list
116
- 3. Configuring your Signup Form display format (optional)
117
- 4. Configuring extra fields on your Signup Form (optional)
118
- 5. An example Signup Form Widget
119
-
120
- == Upgrade Notice ==
121
-
122
- = 1.5 =
123
- Updates the MailChimp API version, adds double/single opt-in toggle.
124
-
125
- = 1.4.2 =
126
- add customized wp_nonces functions for post-back behavior to fix 4.0 callbacks
127
-
128
- = 1.4.1 =
129
- Fix for checkbox weirdness on 3.8
130
-
131
- = 1.4 =
132
- Added Developer Mode "Kitchen Sink" to aid in styling without having to authenticate a MailChimp account.
133
-
134
- = 1.3 =
135
- Now using OAuth flow within plugin for user authentication
136
-
137
- Admin UI refresh
138
-
139
- = 1.2.11 =
140
- Merged pull request from https://github.com/headshift/wp-mailchimp adding additional translation strings.
141
-
142
- = 1.2.10 =
143
- Fixed submission error when apostrophes are present
144
-
145
- = 1.2.8=
146
- Fixes bug where entire phone numbers were only being deposited in the area code portion
147
-
148
- = 1.2.6 =
149
- Fixes major bug with "Settings" link on Plugins screen.
150
-
151
- = 1.2.5 =
152
- Added support for multiple interest groups, field formatting based on type and date picker.
153
-
154
- == Changelog ==
155
-
156
- = 1.5 =
157
- * Upgrade to MailChimp API v3.0
158
- * Remove OAuth2 middle layer and use MailChimp API keys
159
- * Include double/single opt-in toggle.
160
-
161
- = 1.4.1 =
162
- * Update styles to be compatible with upcoming 3.8 wp-admin changes
163
-
164
- = 1.4 =
165
- * Developer Mode "Kitchen Sink" takes over plugin for local development
166
- * Developer Mode has filters of changable content
167
- * Fix bug related to required US phone validation
168
-
169
- = 1.3 =
170
- * Now using OAuth flow for user authentication
171
- * Admin UI refresh
172
-
173
- = 1.2.14 =
174
- * Add link to edit profile within error when duplicate signup occurs
175
-
176
- = 1.2.13 =
177
- * Fixed bug preventing address fields from submitting correctly.
178
-
179
- = 1.2.12 =
180
- * Update spanish language files (es_ES and es_MX)
181
-
182
- = 1.2.9 =
183
- * Fixed bug where multiple checkbox type interest groups were returning an invalid error
184
- * Fixed bug where assets were not enqueueing properly if the plugin directory was not set to 'mailchimp'. Now supports any directory name.
185
-
186
- = 1.2.8 =
187
- * Fixed bug where entire phone numbers were only being deposited in the area code portion
188
-
189
- = 1.2.7 =
190
- * CSS should now always load correctly on the front end
191
- * Adding Hebrew and Romanian language support
192
- * Updating translation contribution instructions
193
- * Tested version is now 3.3.1
194
-
195
- = 1.2.6 =
196
- * Fixed bug with "Settings" link appearing on all plugins (props Jason Lane)
197
- * Resolved issue with unnecessary calls to the MailChimp API during upgrade check
198
- * Resolved PHP warning when there weren't any interest groups
199
-
200
- = 1.2.5 =
201
- * Field formatting based on type
202
- * Support for multiple interest groups (a data upgrade procedure must be run by visiting the WordPress dashboard)
203
- * Added jQuery datepicker option to be used with dates.
204
- * Added a handful of new translations
205
- * Fixing various PHP notices and deprecated functions (props Jeffry Ghazally)
206
-
207
- = 1.2.4 =
208
- * Version bump for proper listing on wordpress.org
209
-
210
- = 1.2.3 =
211
- * Change mailchimpSF_where_am_i() to use plugins_url() in place of WP_PLUGIN_URL to take SSL into account when delivering assets (props John LeBlanc)
212
- * Update MCAPI wrapper to bring back PHP4 support (note: PHP 5.2 to be required starting with WordPress 3.2)
213
-
214
- = 1.2.2 =
215
- * Change MCAPI wrapper to use a more unique class name, v1.3 of the API, and a much lighter client library
216
-
217
- = 1.2.1 =
218
- * Fixed internationalization path bug.
219
- * Fixed instances where i18n functions weren't necessary in admin.
220
- * Added more strings to be translated.
221
-
222
- = 1.2 =
223
- * Recommended Upgrade, please see "Upgrading" section of readme.
224
- * Security and various other improvements
225
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/mailchimp/mailchimp.php CHANGED
@@ -18,20 +18,21 @@ class MailChimp_API {
18
  return;
19
  }
20
 
21
- public function get($endpoint, $count=10, $fields) {
 
22
  $url = $this->api_url . $endpoint;
23
 
24
- if($count) {
25
  $query_params = 'count=' . $count . '&';
26
  }
27
 
28
- if(!empty($fields)) {
29
- foreach($fields as $field => $value) {
30
  $query_params .= $field . '=' . $value . '&';
31
  }
32
  }
33
 
34
- if($query_params){
35
  $url .= "?{$query_params}";
36
  }
37
 
@@ -39,15 +40,15 @@ class MailChimp_API {
39
  'timeout' => 5,
40
  'redirection' => 5,
41
  'httpversion' => '1.1',
42
- 'user-agent' => 'MailChimp WordPress Plugin/' . get_bloginfo( 'url' ),
43
  'headers' => array("Authorization" => 'apikey ' . $this->key)
44
  );
45
 
46
  $request = wp_remote_get($url, $args);
47
 
48
- if(is_array($request) && $request['response']['code'] == 200) {
49
  return json_decode($request['body'], true);
50
- } elseif(is_array($request) && $request['response']['code']) {
51
  $error = json_decode($request['body'], true);
52
  $error = new WP_Error('mailchimp-get-error', $error['detail']);
53
  return $error;
@@ -56,7 +57,7 @@ class MailChimp_API {
56
  }
57
  }
58
 
59
- public function post($endpoint, $body, $method='POST') {
60
  $url = $this->api_url . $endpoint;
61
 
62
  $args = array(
18
  return;
19
  }
20
 
21
+ public function get($endpoint, $count = 10, $fields = [])
22
+ {
23
  $url = $this->api_url . $endpoint;
24
 
25
+ if ($count) {
26
  $query_params = 'count=' . $count . '&';
27
  }
28
 
29
+ if (!empty($fields)) {
30
+ foreach ($fields as $field => $value) {
31
  $query_params .= $field . '=' . $value . '&';
32
  }
33
  }
34
 
35
+ if ($query_params) {
36
  $url .= "?{$query_params}";
37
  }
38
 
40
  'timeout' => 5,
41
  'redirection' => 5,
42
  'httpversion' => '1.1',
43
+ 'user-agent' => 'MailChimp WordPress Plugin/' . get_bloginfo('url'),
44
  'headers' => array("Authorization" => 'apikey ' . $this->key)
45
  );
46
 
47
  $request = wp_remote_get($url, $args);
48
 
49
+ if (is_array($request) && $request['response']['code'] == 200) {
50
  return json_decode($request['body'], true);
51
+ } elseif (is_array($request) && $request['response']['code']) {
52
  $error = json_decode($request['body'], true);
53
  $error = new WP_Error('mailchimp-get-error', $error['detail']);
54
  return $error;
57
  }
58
  }
59
 
60
+ public function post($endpoint, $body, $method = 'POST') {
61
  $url = $this->api_url . $endpoint;
62
 
63
  $args = array(
mailchimp.js DELETED
@@ -1,38 +0,0 @@
1
- /* Form submission functions for the MailChimp Widget */
2
- ;(function($){
3
- $(function($) {
4
- // Change our submit type from HTML (default) to JS
5
- $('#mc_submit_type').val('js');
6
-
7
- // Attach our form submitter action
8
- $('#mc_signup_form').ajaxForm({
9
- url: mailchimpSF.ajax_url,
10
- type: 'POST',
11
- dataType: 'text',
12
- beforeSubmit: mc_beforeForm,
13
- success: mc_success
14
- });
15
- });
16
-
17
- function mc_beforeForm(){
18
- // Disable the submit button
19
- $('#mc_signup_submit').attr("disabled","disabled");
20
- }
21
- function mc_success(data){
22
- // Re-enable the submit button
23
- $('#mc_signup_submit').removeAttr("disabled");
24
-
25
- // Put the response in the message div
26
- $('#mc_message').html(data);
27
-
28
- // See if we're successful, if so, wipe the fields
29
- var reg = new RegExp("class='mc_success_msg'", 'i');
30
- if (reg.test(data)){
31
- $('#mc_signup_form').each(function(){
32
- this.reset();
33
- });
34
- $('#mc_submit_type').val('js');
35
- }
36
- $.scrollTo('#mc_signup', {offset: {top: -28}});
37
- }
38
- })(jQuery);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
mailchimp.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: MailChimp
4
  Plugin URI: http://www.mailchimp.com/plugins/mailchimp-wordpress-plugin/
5
  Description: The MailChimp plugin allows you to quickly and easily add a signup form for your MailChimp list.
6
- Version: 1.5.3
7
  Author: MailChimp
8
  Author URI: https://mailchimp.com/
9
  */
@@ -25,7 +25,7 @@ Author URI: https://mailchimp.com/
25
  */
26
 
27
  // Version constant for easy CSS refreshes
28
- define('MCSF_VER', '1.5.3');
29
 
30
  // What's our permission (capability) threshold
31
  define('MCSF_CAP_THRESHOLD', 'manage_options');
@@ -59,8 +59,7 @@ function mailchimpSF_plugin_init() {
59
  $locale = apply_filters( 'plugin_locale', get_locale(), $textdomain);
60
  load_textdomain('mailchimp_i18n', MCSF_LANG_DIR.$textdomain.'-'.$locale.'.mo');
61
 
62
- // Check for mc_api_key or sopresto key and continue if neither
63
- mailchimpSF_migrate_sopresto();
64
 
65
  if (get_option('mc_list_id') && get_option('mc_merge_field_migrate') != true && mailchimpSF_get_api() !== false) {
66
  mailchimpSF_update_merge_fields(get_option('mc_list_id'));
3
  Plugin Name: MailChimp
4
  Plugin URI: http://www.mailchimp.com/plugins/mailchimp-wordpress-plugin/
5
  Description: The MailChimp plugin allows you to quickly and easily add a signup form for your MailChimp list.
6
+ Version: 1.5.5
7
  Author: MailChimp
8
  Author URI: https://mailchimp.com/
9
  */
25
  */
26
 
27
  // Version constant for easy CSS refreshes
28
+ define('MCSF_VER', '1.5.5');
29
 
30
  // What's our permission (capability) threshold
31
  define('MCSF_CAP_THRESHOLD', 'manage_options');
59
  $locale = apply_filters( 'plugin_locale', get_locale(), $textdomain);
60
  load_textdomain('mailchimp_i18n', MCSF_LANG_DIR.$textdomain.'-'.$locale.'.mo');
61
 
62
+ // Remove Sopresto check. If user does not have API key, make them authenticate.
 
63
 
64
  if (get_option('mc_list_id') && get_option('mc_merge_field_migrate') != true && mailchimpSF_get_api() !== false) {
65
  mailchimpSF_update_merge_fields(get_option('mc_list_id'));
phpunit.xml.dist DELETED
@@ -1,14 +0,0 @@
1
- <phpunit
2
- bootstrap="tests/bootstrap.php"
3
- backupGlobals="false"
4
- colors="true"
5
- convertErrorsToExceptions="true"
6
- convertNoticesToExceptions="true"
7
- convertWarningsToExceptions="true"
8
- >
9
- <testsuites>
10
- <testsuite>
11
- <directory prefix="test-" suffix=".php">./tests/</directory>
12
- </testsuite>
13
- </testsuites>
14
- </phpunit>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: MailChimp
3
  Tags: mailchimp, email, newsletter, signup, marketing, plugin, widget
4
  Requires at least: 2.8
5
  Tested up to: 4.5
6
- Stable tag: 1.5.3
7
 
8
  == Description ==
9
 
@@ -93,6 +93,9 @@ If your language is not listed above, feel free to create a translation. Here ar
93
 
94
  == Upgrade Notice ==
95
 
 
 
 
96
  = 1.5 =
97
  Updates the MailChimp API version, adds double/single opt-in toggle.
98
 
@@ -127,6 +130,12 @@ Added support for multiple interest groups, field formatting based on type and d
127
 
128
  == Changelog ==
129
 
 
 
 
 
 
 
130
  = 1.5.3 =
131
  * Fix PHP7 compatibility issue
132
  * Cut down on size of API requests for users with large lists.
3
  Tags: mailchimp, email, newsletter, signup, marketing, plugin, widget
4
  Requires at least: 2.8
5
  Tested up to: 4.5
6
+ Stable tag: 1.5.5
7
 
8
  == Description ==
9
 
93
 
94
  == Upgrade Notice ==
95
 
96
+ = 1.5.5 =
97
+ If you are updating from v1.4.x, you will need to re-authorize with an API key.
98
+
99
  = 1.5 =
100
  Updates the MailChimp API version, adds double/single opt-in toggle.
101
 
130
 
131
  == Changelog ==
132
 
133
+ = 1.5.5 =
134
+ * Fix timeout error on activation.
135
+
136
+ = 1.5.4 =
137
+ * Set optional value for API wrapper.
138
+
139
  = 1.5.3 =
140
  * Fix PHP7 compatibility issue
141
  * Cut down on size of API requests for users with large lists.
scrollTo.js DELETED
@@ -1,11 +0,0 @@
1
- /**
2
- * jQuery.ScrollTo - Easy element scrolling using jQuery.
3
- * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
4
- * Dual licensed under MIT and GPL.
5
- * Date: 5/25/2009
6
- * @author Ariel Flesler
7
- * @version 1.4.2
8
- *
9
- * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
10
- */
11
- ;(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)};k.defaults={axis:'xy',duration:parseFloat(d.fn.jquery)>=1.3?0:1};k.window=function(a){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!i)return a;var e=(a.contentWindow||a).document||a.ownerDocument||a;return d.browser.safari||e.compatMode=='BackCompat'?e.body:e.documentElement})};d.fn.scrollTo=function(n,j,b){if(typeof j=='object'){b=j;j=0}if(typeof b=='function')b={onAfter:b};if(n=='max')n=9e9;b=d.extend({},k.defaults,b);j=j||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue)j/=2;b.offset=p(b.offset);b.over=p(b.over);return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is('html,body');switch(typeof f){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);break}f=d(f,this);case'object':if(f.is||f.style)s=(f=d(f)).offset()}d.each(b.axis.split(''),function(a,i){var e=i=='x'?'Left':'Top',h=e.toLowerCase(),c='scroll'+e,l=q[c],m=k.max(q,i);if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);if(b.margin){g[c]-=parseInt(f.css('margin'+e))||0;g[c]-=parseInt(f.css('border'+e+'Width'))||0}g[c]+=b.offset[h]||0;if(b.over[h])g[c]+=f[i=='x'?'width':'height']()*b.over[h]}else{var o=f[h];g[c]=o.slice&&o.slice(-1)=='%'?parseFloat(o)/100*m:o}if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],m);if(!a&&b.queue){if(l!=g[c])t(b.onAfterFirst);delete g[c]}});t(b.onAfter);function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)})}}).end()};k.max=function(a,i){var e=i=='x'?'Width':'Height',h='scroll'+e;if(!d(a).is('html,body'))return a[h]-d(a)[e.toLowerCase()]();var c='client'+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;return Math.max(l[h],m[h])-Math.min(l[c],m[c])};function p(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);
 
 
 
 
 
 
 
 
 
 
 
test.php DELETED
@@ -1,3 +0,0 @@
1
- <?php
2
- $phone = array('area' => '123', 'base' => '456','ext' => '0000');
3
- var_dump(array_filter($phone));
 
 
 
tests/bootstrap.php DELETED
@@ -1,25 +0,0 @@
1
- <?php
2
- /**
3
- * PHPUnit bootstrap file
4
- *
5
- * @package mailchimp
6
- */
7
-
8
- $_tests_dir = getenv( 'WP_TESTS_DIR' );
9
- if ( ! $_tests_dir ) {
10
- $_tests_dir = '/tmp/wordpress-tests-lib';
11
- }
12
-
13
- // Give access to tests_add_filter() function.
14
- require_once $_tests_dir . '/includes/functions.php';
15
-
16
- /**
17
- * Manually load the plugin being tested.
18
- */
19
- function _manually_load_plugin() {
20
- require dirname( dirname( __FILE__ ) ) . '/mailchimp.php';
21
- }
22
- tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );
23
-
24
- // Start up the WP testing environment.
25
- require $_tests_dir . '/includes/bootstrap.php';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/test-sample.php DELETED
@@ -1,167 +0,0 @@
1
- <?php
2
- /**
3
- * Class SampleTest
4
- *
5
- * @package
6
- */
7
-
8
- /**
9
- * Sample test case.
10
- */
11
- class SampleTest extends WP_UnitTestCase {
12
- public $apikey = 'a885bcc7f6edcd28f0060ac9b336312d-us3';
13
- public $list_id = '';
14
-
15
- function test_missing_apikey() {
16
- $apikey = 'asdf';
17
- $api = new MailChimp_API($apikey);
18
- $key = mailchimpSF_verify_key($api);
19
-
20
- $this->assertTrue(is_wp_error($key));
21
- }
22
-
23
- function test_correct_apikey() {
24
- $apikey = $this->apikey; // REMOVE ME.
25
- try {
26
- $api = new MailChimp_API($apikey);
27
- $value = true;
28
- } catch (Exception $e) {
29
- $value = false;
30
- }
31
-
32
- $this->assertTrue($value);
33
- }
34
-
35
- function test_missing_required_merge_vars() {
36
- $fname = array(
37
- 'tag' => 'FNAME',
38
- 'name' => 'First Name',
39
- 'type' => 'text',
40
- 'required' => 'Y'
41
- );
42
-
43
- $merge_vars[] = $fname;
44
-
45
- $submit = mailchimpSF_merge_submit($merge_vars);
46
-
47
- // Merge value defaults to empty string, which should error
48
- $this->assertTrue(is_wp_error($submit));
49
- $this->assertTrue(is_object($submit));
50
- }
51
-
52
- function test_required_merge_var() {
53
- $name = 'mc_mv_FNAME';
54
- $fname = array(
55
- 'tag' => 'FNAME',
56
- 'name' => 'First Name',
57
- 'type' => 'text',
58
- 'required' => 'Y'
59
- );
60
- $merge_vars[] = $fname;
61
- $_POST[$name] = 'Hello World';
62
-
63
- $submit = mailchimpSF_merge_submit($merge_vars);
64
-
65
- $this->assertFalse(is_wp_error($submit));
66
- $this->assertTrue(is_object($submit));
67
- }
68
-
69
- function test_invalid_phone_number() {
70
- $var['name'] = 'Phone';
71
- $value = array('asd','555','1234');
72
- $phone = mailchimpSF_merge_validate_phone($value, $var);
73
-
74
- $this->assertTrue(is_wp_error($phone));
75
- $this->assertTrue(is_object($phone));
76
- }
77
-
78
- function test_valid_phone_number() {
79
- $var['name'] = 'Phone';
80
- $value = array('123','456','7890');
81
- $phone = mailchimpSF_merge_validate_phone($value, $var);
82
-
83
- $this->assertFalse(is_wp_error($phone));
84
- $this->assertTrue(is_string($phone));
85
- }
86
-
87
- function test_invalid_address() {
88
- $var = array(
89
- 'tag' => 'ADDRESS',
90
- 'name' => 'Address',
91
- 'type' => 'Address',
92
- 'required' => 'Y'
93
- );
94
- $value = array(
95
- 'addr1' => '123 Magic Street'
96
- );
97
- $submit = mailchimpSF_merge_validate_address($value, $var);
98
-
99
- $this->assertTrue(is_wp_error($submit));
100
- $this->assertTrue(is_object($submit));
101
- }
102
-
103
- function test_remove_empty_merge_feilds() {
104
- $merge = new StdClass();
105
- $merge->fname = 'test';
106
- $merge->test = ' ';
107
- $merge->hello = null;
108
-
109
- $submit = mailchimpSF_merge_remove_empty($merge);
110
-
111
- $this->assertTrue($merge->fname === $submit->fname);
112
- $this->assertTrue(empty($submit->test));
113
- $this->assertTrue(empty($submit->hello));
114
- }
115
-
116
- function test_delete_everything() {
117
- $fname = array(
118
- 'tag' => 'FNAME',
119
- 'name' => 'First Name',
120
- 'type' => 'text',
121
- 'required' => 'Y'
122
- );
123
-
124
- $ig = array(
125
- 'id' => '123'
126
- );
127
-
128
- $igs[] = $ig;
129
-
130
- update_option('mc_list_id', '123');
131
- update_option('mc_list_name', 'asdf');
132
- update_option('mc_interest_groups', $igs);
133
- update_option('mc_merge_vars', array($fname));
134
- update_option('mc_show_interest_groups_123', 'on');
135
- update_option('mc_mv_FNAME', $fname);
136
-
137
- $this->assertTrue(is_string(get_option('mc_list_id')));
138
- $this->assertTrue(is_string(get_option('mc_list_name')));
139
- $this->assertTrue(is_string(get_option('mc_show_interest_groups_123')));
140
- $this->assertTrue(is_array(get_option('mc_mv_FNAME')));
141
-
142
- mailchimpSF_delete_setup();
143
-
144
- $this->assertFalse(get_option('mc_list_id'));
145
- $this->assertFalse(get_option('mc_list_name'));
146
- $this->assertFalse(get_option('mc_show_interest_groups_123'));
147
- $this->assertFalse(get_option('mc_mv_FNAME'));
148
- }
149
-
150
- function test_add_email_field() {
151
- $merge = array(
152
- array(
153
- 'tag' => 'TEST',
154
- 'name' => 'test',
155
- 'type' => 'text',
156
- 'required' => false,
157
- 'public' => true,
158
- 'display_order' => 2,
159
- 'default_value' => null
160
- )
161
- );
162
- $merge = mailchimpSF_add_email_field($merge);
163
-
164
- $this->assertTrue($merge[0]['tag'] == 'EMAIL');
165
- }
166
-
167
- }