MailChimp for WordPress - Version 2.0

Version Description

  • April 29, 2014 =

Improvements

  • CSS is now served as static CSS instead of being served through PHP.
  • The anti-spam honeypot is now added to the sign-up checkbox as well.
  • Improved object-oriented code architecture and better class documentation
  • Better CSS reset for the various form themes to increase theme compatibility
  • Added class autoloading to the plugin
  • Various minor code improvements

Additions

  • You can now add a captcha field to your sign-up forms by installing the BWS Captcha plugin and using [captcha] inside your form mark-up.
  • All settings pages are now fully translatable. The plugin has just 2 translations available yet (en_US and nl_NL) so if you're good at translating, please send me your language pack for the plugin.
  • You can now use tab indentation in the form markup textarea
Download this release

Release Info

Developer DvanKooten
Plugin Icon 128x128 MailChimp for WordPress
Version 2.0
Comparing to
See all releases

Code changes from version 1.5.8 to 2.0

Files changed (49) hide show
  1. README.md +35 -0
  2. assets/css/checkbox.css +1 -24
  3. assets/css/css.php +0 -32
  4. assets/css/form-reset.css +0 -108
  5. assets/css/form-theme-blue.css +1 -27
  6. assets/css/form-theme-dark.css +1 -23
  7. assets/css/form-theme-green.css +1 -23
  8. assets/css/form-theme-light.css +1 -13
  9. assets/css/form-theme-red.css +1 -23
  10. assets/css/form.css +1 -0
  11. assets/js/admin.js +27 -1
  12. assets/sass/checkbox.scss +26 -0
  13. assets/sass/form-theme-blue.scss +30 -0
  14. assets/sass/form-theme-dark.scss +30 -0
  15. assets/sass/form-theme-green.scss +30 -0
  16. assets/sass/form-theme-light.scss +20 -0
  17. assets/sass/form-theme-red.scss +32 -0
  18. assets/sass/form.scss +2 -0
  19. assets/sass/index.php +6 -0
  20. assets/sass/partials/_form-reset.scss +108 -0
  21. assets/{css/form-theme-base.css → sass/partials/_form-theme-base.scss} +119 -119
  22. assets/sass/partials/index.php +6 -0
  23. includes/class-admin.php +115 -84
  24. includes/class-api.php +25 -9
  25. includes/class-checkbox-manager.php +74 -0
  26. includes/class-checkbox.php +0 -523
  27. includes/{class-form.php → class-form-manager.php} +33 -21
  28. includes/class-plugin.php +48 -22
  29. includes/class-widget.php +1 -1
  30. includes/{functions.php → functions/general.php} +14 -6
  31. includes/{template-functions.php → functions/template.php} +5 -5
  32. includes/integrations/class-bbpress.php +67 -0
  33. includes/integrations/class-buddypress.php +49 -0
  34. includes/integrations/class-cf7.php +64 -0
  35. includes/integrations/class-comment-form.php +55 -0
  36. includes/integrations/class-general.php +139 -0
  37. includes/integrations/class-integration.php +167 -0
  38. includes/integrations/class-multisite.php +102 -0
  39. includes/integrations/class-registration-form.php +61 -0
  40. includes/views/api-settings.php +35 -24
  41. includes/views/checkbox-settings.php +32 -31
  42. includes/views/form-settings.php +56 -48
  43. includes/views/parts/admin-field-wizard.php +14 -12
  44. languages/mailchimp-for-wp-nl_NL.mo +0 -0
  45. languages/mailchimp-for-wp-nl_NL.po +440 -0
  46. languages/mailchimp-for-wp.mo +0 -0
  47. languages/mailchimp-for-wp.po +401 -0
  48. mailchimp-for-wp.php +7 -4
  49. readme.txt +31 -181
README.md ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MailChimp for WordPress
2
+ ======================
3
+
4
+ Here you can browse the source of the [MailChimp for WordPress Plugin](http://wordpress.org/plugins/mailchimp-for-wp/) project, find and discuss open issues or contribute yourself.
5
+
6
+ Installation
7
+ ------------
8
+
9
+ Here's a [guide on how to install the plugin in your WordPress site](http://wordpress.org/plugins/mailchimp-for-wp/installation/).
10
+ If you want to run the Git version, you have two options:
11
+
12
+ * You can clone the GitHub repository: `https://github.com/dannyvankooten/mailchimp-for-wordpress.git`
13
+ * You can download the repository .zip file: [mailchimp-for-wordpress.zip](https://github.com/dannyvankooten/mailchimp-for-wordpress/archive/master.zip)
14
+
15
+ This will download the latest development version of the MailChimp for WordPress plugin. While this version is usually stable,
16
+ it is not recommended for use in a production environment.
17
+
18
+ Bugs
19
+ ----
20
+ If you find an issue, [let us know here](https://github.com/dannyvankooten/mailchimp-for-wordpress/issues?state=open)!
21
+
22
+ Support
23
+ -------
24
+ This is a developer's portal for the MailChimp for WordPress plugin and should not be used for support. Please visit the
25
+ [plugin support forums on WordPress.org](http://wordpress.org/support/plugin/mailchimp-for-wp).
26
+
27
+ If you need priority support, please consider upgrading to [MailChimp for WordPress Pro](http://dannyvankooten.com/mailchimp-for-wordpress/).
28
+
29
+ Contributions
30
+ -------------
31
+ Anyone is welcome to contribute to the plugin. There are various ways you can contribute:
32
+
33
+ * [Raise an issue](https://github.com/dannyvankooten/mailchimp-for-wordpress/issues) on GitHub.
34
+ * Send us a Pull Request with your bug fixes and/or new features.
35
+ * Provide feedback and [suggestions on enhancements](https://github.com/dannyvankooten/mailchimp-for-wordpress/issues?direction=desc&labels=Enhancement&page=1&sort=created&state=open).
assets/css/checkbox.css CHANGED
@@ -1,24 +1 @@
1
- /* MailChimp for WP - Default Checkbox Styles */
2
- #mc4wp-checkbox{
3
- clear: both;
4
- display: block;
5
- }
6
-
7
- #mc4wp-checkbox input{
8
- position: relative;
9
- margin: 0 6px 0 0;
10
- padding: 0;
11
- vertical-align: middle;
12
- display: inline-block !important;
13
- max-width: 20px;
14
- }
15
-
16
- #mc4wp-checkbox label{
17
- display: block;
18
- cursor: pointer;
19
- width: auto;
20
- }
21
-
22
- #registerform #mc4wp-checkbox{
23
- margin-bottom: 10px;
24
- }
1
+ #mc4wp-checkbox{clear:both;display:block}#mc4wp-checkbox input{position:relative;margin:0 6px 0 0;padding:0;vertical-align:middle;display:inline-block !important;max-width:21px}#mc4wp-checkbox label{display:block;cursor:pointer;width:auto}#registerform #mc4wp-checkbox{margin-bottom:10px}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/css/css.php DELETED
@@ -1,32 +0,0 @@
1
- <?php
2
- // Set headers to serve CSS and encourage browser caching
3
- $expires = 31536000; // cache time: 1 year
4
- header( 'Content-Type: text/css' );
5
- header( "Cache-Control: max-age=" . $expires );
6
- header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', time() + $expires ) . ' GMT' );
7
-
8
- if( isset( $_GET['checkbox'] ) ) {
9
- readfile( dirname( __FILE__ ) . '/checkbox.css' );
10
- }
11
-
12
- // load form reset
13
- if( isset( $_GET['form'] ) ) {
14
- readfile( dirname( __FILE__ ) . '/form-reset.css' );
15
- }
16
-
17
- // should we load a form theme?
18
- if( isset( $_GET['form-theme'] ) ) {
19
- $form_theme = strtolower( trim( $_GET['form-theme'] ) );
20
-
21
- // only load themes we actually have
22
- if( in_array( $form_theme, array( 'blue', 'green', 'dark', 'light', 'red' ) ) ) {
23
- // load theme base file
24
- readfile( dirname( __FILE__ ) . '/form-theme-base.css' );
25
-
26
- // load theme file
27
- readfile( dirname( __FILE__ ) . '/form-theme-'. $form_theme .'.css' );
28
- }
29
-
30
- }
31
-
32
- exit;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/css/form-reset.css DELETED
@@ -1,108 +0,0 @@
1
-
2
- /* MailChimp for WP - Default Form Styles */
3
- .mc4wp-form{
4
- margin: 1em 0;
5
- }
6
-
7
- .mc4wp-form label{
8
- display: block;
9
- font-weight: bold;
10
- margin-bottom: 5px;
11
- }
12
-
13
- .mc4wp-form ul,
14
- .mc4wp-form li {
15
- list-style: none;
16
- margin: 0;
17
- padding: 0;
18
- }
19
-
20
- .mc4wp-form label > span,
21
- .mc4wp-form li > label {
22
- font-weight: normal;
23
- }
24
-
25
- .mc4wp-form p > label:nth-child(2) {
26
- margin-top: 10px;
27
- }
28
-
29
- .mc4wp-form input {
30
- vertical-align: baseline;
31
- }
32
-
33
- .mc4wp-form input.placeholdersjs {
34
- color: #aaa !important;
35
- }
36
-
37
- .mc4wp-form input[type="text"],
38
- .mc4wp-form input[type="email"],
39
- .mc4wp-form input[type="tel"],
40
- .mc4wp-form input[type="url"],
41
- .mc4wp-form input[type="date"],
42
- .mc4wp-form textarea,
43
- .mc4wp-form select {
44
- cursor: auto;
45
- display: block;
46
- width: 100%;
47
- height: auto;
48
- box-sizing: border-box;
49
- -webkit-box-sizing: border-box;
50
- -moz-box-sizing: border-box;
51
- }
52
-
53
- .mc4wp-form input[type="checkbox"],
54
- .mc4wp-form input[type="radio"] {
55
- position: relative;
56
- margin: 0 6px 0 0;
57
- padding: 0;
58
- height: 13px;
59
- width: 13px;
60
- display: inline-block;
61
- border: 0;
62
- }
63
-
64
- .mc4wp-form input[type="checkbox"] {
65
- -webkit-appearance: checkbox;
66
- }
67
-
68
- .mc4wp-form input[type="radio"] {
69
- -webkit-appearance: radio;
70
- }
71
-
72
- .mc4wp-form input[type="submit"],
73
- .mc4wp-form button,
74
- .mc4wp-form input[type="button"] {
75
- cursor: pointer;
76
- display: inline-block;
77
- }
78
-
79
- .mc4wp-alert{
80
- margin: 1em 0;
81
- padding: 10px 15px;
82
- color: #c09853;
83
- background-color: #fcf8e3;
84
- border: 1px solid #fbeed5;
85
- border-radius: 2px;
86
- -moz-border-radius: 2px;
87
- -webkit-border-radius: 2px;
88
- display: block;
89
- position: relative;
90
- }
91
-
92
- .mc4wp-success {
93
- color: #468847;
94
- background-color: #dff0d8;
95
- border-color: #d6e9c6;
96
- }
97
-
98
- .mc4wp-notice {
99
- color: #3a87ad;
100
- background-color: #d9edf7;
101
- border-color: #bce8f1;
102
- }
103
-
104
- .mc4wp-error {
105
- color: #b94a48;
106
- background-color: #f2dede;
107
- border-color: #eed3d7;
108
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/css/form-theme-blue.css CHANGED
@@ -1,27 +1 @@
1
- .mc4wp-form input[type="submit"],
2
- .mc4wp-form button {
3
- color: #ffffff !important;
4
- background-color: #428bca;
5
- border-color: #357ebd;
6
- }
7
-
8
- .mc4wp-form input[type="submit"]:hover,
9
- .mc4wp-form button:hover,
10
- .mc4wp-form input[type="submit"]:active,
11
- .mc4wp-form button:active,
12
- .mc4wp-form input[type="submit"]:focus,
13
- .mc4wp-form button:focus {
14
- color: #ffffff;
15
- background-color: #3276b1;
16
- border-color: #285e8e;
17
- }
18
-
19
- .mc4wp-form input[type="text"]:focus,
20
- .mc4wp-form input[type="email"]:focus,
21
- .mc4wp-form input[type="tel"]:focus,
22
- .mc4wp-form input[type="url"]:focus,
23
- .mc4wp-form input[type="date"]:focus,
24
- .mc4wp-form textarea:focus,
25
- .mc4wp-form select:focus {
26
- border-color: #428bca;
27
- }
1
+ .mc4wp-form{margin:1em 0}.mc4wp-form label{display:block;font-weight:bold;margin-bottom:5px}.mc4wp-form ul,.mc4wp-form li{list-style:none;margin:0;padding:0}.mc4wp-form label>span,.mc4wp-form li>label{font-weight:normal}.mc4wp-form p>label:nth-child(2){margin-top:10px}.mc4wp-form input{vertical-align:baseline}.mc4wp-form input.placeholdersjs{color:#aaa !important}.mc4wp-form input[type="text"],.mc4wp-form input[type="email"],.mc4wp-form input[type="tel"],.mc4wp-form input[type="url"],.mc4wp-form input[type="date"],.mc4wp-form textarea,.mc4wp-form select{cursor:auto;display:block;width:100%;height:auto;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box}.mc4wp-form input[type="checkbox"],.mc4wp-form input[type="radio"]{position:relative;margin:0 6px 0 0;padding:0;height:13px;width:13px;display:inline-block;border:0}.mc4wp-form input[type="checkbox"]{-webkit-appearance:checkbox}.mc4wp-form input[type="radio"]{-webkit-appearance:radio}.mc4wp-form input[type="submit"],.mc4wp-form button,.mc4wp-form input[type="button"]{cursor:pointer;display:inline-block}.mc4wp-alert{margin:1em 0;padding:10px 15px;color:#c09853;background-color:#fcf8e3;border:1px solid #fbeed5;border-radius:2px;-moz-border-radius:2px;-webkit-border-radius:2px;display:block;position:relative}.mc4wp-success{color:#468847;background-color:#dff0d8;border-color:#d6e9c6}.mc4wp-notice{color:#3a87ad;background-color:#d9edf7;border-color:#bce8f1}.mc4wp-error{color:#b94a48;background-color:#f2dede;border-color:#eed3d7}.mc4wp-form{box-shadow:none !important;-webkit-box-shadow:none;-moz-box-shadow:none}.mc4wp-form p{margin:0 0 15px !important;padding:0}.mc4wp-form label{font-size:1em;margin:6px 0}.mc4wp-form input[type="text"],.mc4wp-form input[type="email"],.mc4wp-form input[type="tel"],.mc4wp-form input[type="url"],.mc4wp-form input[type="date"],.mc4wp-form textarea,.mc4wp-form select{width:100%;height:34px;margin:0;padding:6px 12px;font-size:14px;line-height:1.428571429;color:#555555;vertical-align:middle;background-color:#ffffff;border:1px solid #cccccc;-moz-border-radius:2px;-webkit-border-radius:2px;border-radius:2px;-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-moz-transition:border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;-webkit-transition:border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;transition:border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;background-image:none;text-shadow:none}.mc4wp-form input[type="text"]:focus,.mc4wp-form input[type="email"]:focus,.mc4wp-form input[type="tel"]:focus,.mc4wp-form input[type="url"]:focus,.mc4wp-form textarea:focus,.mc4wp-form select:focus{border-color:#66afe9;outline:0;-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(102,175,233,0.6);-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(102,175,233,0.6);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(102,175,233,0.6)}.mc4wp-form textarea{height:auto}.mc4wp-form input[readonly],.mc4wp-form input[disabled]{background-color:#eeeeee}.mc4wp-form input[type="submit"],.mc4wp-form button{display:inline-block;padding:6px 12px;margin:0;font-size:14px;font-weight:normal;line-height:1.428571429;text-align:center;white-space:nowrap;vertical-align:middle;cursor:pointer;border:1px solid transparent;border-radius:2px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none;box-shadow:none;background:none;text-shadow:none;filter:none;height:auto;width:auto}.mc4wp-form input[type="submit"]:focus,.mc4wp-form button:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.mc4wp-form input[type="submit"]:hover,.mc4wp-form button:hover,.mc4wp-form input[type="submit"]:focus,.mc4wp-form button:focus{color:#333333;text-decoration:none;background:none}.mc4wp-form input[type="submit"]:active,.mc4wp-form button:active{background-image:none;outline:0;-moz-box-shadow:inset 0 3px 5px rgba(0,0,0,0.125);-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,0.125);box-shadow:inset 0 3px 5px rgba(0,0,0,0.125)}.mc4wp-form input[type="submit"],.mc4wp-form button{color:#ffffff !important;background-color:#428bca;border-color:#357ebd}.mc4wp-form input[type="submit"]:hover,.mc4wp-form button:hover,.mc4wp-form input[type="submit"]:active,.mc4wp-form button:active,.mc4wp-form input[type="submit"]:focus,.mc4wp-form button:focus{color:#ffffff;background-color:#3276b1;border-color:#285e8e}.mc4wp-form input[type="text"]:focus,.mc4wp-form input[type="email"]:focus,.mc4wp-form input[type="tel"]:focus,.mc4wp-form input[type="url"]:focus,.mc4wp-form input[type="date"]:focus,.mc4wp-form textarea:focus,.mc4wp-form select:focus{border-color:#428bca}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/css/form-theme-dark.css CHANGED
@@ -1,23 +1 @@
1
- .mc4wp-form input[type="submit"], .mc4wp-form button {
2
- color: #ffffff !important;
3
- background-color: #333333;
4
- border-color: #2E2E2E;
5
- }
6
-
7
- .mc4wp-form input[type="submit"]:hover, .mc4wp-form button:hover,
8
- .mc4wp-form input[type="submit"]:active, .mc4wp-form button:active,
9
- .mc4wp-form input[type="submit"]:focus, .mc4wp-form button:focus {
10
- color: #ffffff;
11
- background-color: #2E2E2E;
12
- border-color: #292929;
13
- }
14
-
15
- .mc4wp-form input[type="text"]:focus,
16
- .mc4wp-form input[type="email"]:focus,
17
- .mc4wp-form input[type="tel"]:focus,
18
- .mc4wp-form input[type="url"]:focus,
19
- .mc4wp-form input[type="date"]:focus,
20
- .mc4wp-form textarea:focus,
21
- .mc4wp-form select:focus {
22
- border-color: #333333;
23
- }
1
+ .mc4wp-form{margin:1em 0}.mc4wp-form label{display:block;font-weight:bold;margin-bottom:5px}.mc4wp-form ul,.mc4wp-form li{list-style:none;margin:0;padding:0}.mc4wp-form label>span,.mc4wp-form li>label{font-weight:normal}.mc4wp-form p>label:nth-child(2){margin-top:10px}.mc4wp-form input{vertical-align:baseline}.mc4wp-form input.placeholdersjs{color:#aaa !important}.mc4wp-form input[type="text"],.mc4wp-form input[type="email"],.mc4wp-form input[type="tel"],.mc4wp-form input[type="url"],.mc4wp-form input[type="date"],.mc4wp-form textarea,.mc4wp-form select{cursor:auto;display:block;width:100%;height:auto;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box}.mc4wp-form input[type="checkbox"],.mc4wp-form input[type="radio"]{position:relative;margin:0 6px 0 0;padding:0;height:13px;width:13px;display:inline-block;border:0}.mc4wp-form input[type="checkbox"]{-webkit-appearance:checkbox}.mc4wp-form input[type="radio"]{-webkit-appearance:radio}.mc4wp-form input[type="submit"],.mc4wp-form button,.mc4wp-form input[type="button"]{cursor:pointer;display:inline-block}.mc4wp-alert{margin:1em 0;padding:10px 15px;color:#c09853;background-color:#fcf8e3;border:1px solid #fbeed5;border-radius:2px;-moz-border-radius:2px;-webkit-border-radius:2px;display:block;position:relative}.mc4wp-success{color:#468847;background-color:#dff0d8;border-color:#d6e9c6}.mc4wp-notice{color:#3a87ad;background-color:#d9edf7;border-color:#bce8f1}.mc4wp-error{color:#b94a48;background-color:#f2dede;border-color:#eed3d7}.mc4wp-form{box-shadow:none !important;-webkit-box-shadow:none;-moz-box-shadow:none}.mc4wp-form p{margin:0 0 15px !important;padding:0}.mc4wp-form label{font-size:1em;margin:6px 0}.mc4wp-form input[type="text"],.mc4wp-form input[type="email"],.mc4wp-form input[type="tel"],.mc4wp-form input[type="url"],.mc4wp-form input[type="date"],.mc4wp-form textarea,.mc4wp-form select{width:100%;height:34px;margin:0;padding:6px 12px;font-size:14px;line-height:1.428571429;color:#555555;vertical-align:middle;background-color:#ffffff;border:1px solid #cccccc;-moz-border-radius:2px;-webkit-border-radius:2px;border-radius:2px;-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-moz-transition:border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;-webkit-transition:border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;transition:border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;background-image:none;text-shadow:none}.mc4wp-form input[type="text"]:focus,.mc4wp-form input[type="email"]:focus,.mc4wp-form input[type="tel"]:focus,.mc4wp-form input[type="url"]:focus,.mc4wp-form textarea:focus,.mc4wp-form select:focus{border-color:#66afe9;outline:0;-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(102,175,233,0.6);-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(102,175,233,0.6);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(102,175,233,0.6)}.mc4wp-form textarea{height:auto}.mc4wp-form input[readonly],.mc4wp-form input[disabled]{background-color:#eeeeee}.mc4wp-form input[type="submit"],.mc4wp-form button{display:inline-block;padding:6px 12px;margin:0;font-size:14px;font-weight:normal;line-height:1.428571429;text-align:center;white-space:nowrap;vertical-align:middle;cursor:pointer;border:1px solid transparent;border-radius:2px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none;box-shadow:none;background:none;text-shadow:none;filter:none;height:auto;width:auto}.mc4wp-form input[type="submit"]:focus,.mc4wp-form button:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.mc4wp-form input[type="submit"]:hover,.mc4wp-form button:hover,.mc4wp-form input[type="submit"]:focus,.mc4wp-form button:focus{color:#333333;text-decoration:none;background:none}.mc4wp-form input[type="submit"]:active,.mc4wp-form button:active{background-image:none;outline:0;-moz-box-shadow:inset 0 3px 5px rgba(0,0,0,0.125);-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,0.125);box-shadow:inset 0 3px 5px rgba(0,0,0,0.125)}.mc4wp-form input[type="submit"],.mc4wp-form button{color:#ffffff !important;background-color:#444444;border-color:#282828}.mc4wp-form input[type="submit"]:hover,.mc4wp-form button:hover,.mc4wp-form input[type="submit"]:active,.mc4wp-form button:active,.mc4wp-form input[type="submit"]:focus,.mc4wp-form button:focus{color:#ffffff;background-color:#282828;border-color:#111111}.mc4wp-form input[type="text"]:focus,.mc4wp-form input[type="email"]:focus,.mc4wp-form input[type="tel"]:focus,.mc4wp-form input[type="url"]:focus,.mc4wp-form input[type="date"]:focus,.mc4wp-form textarea:focus,.mc4wp-form select:focus{border-color:#444444}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/css/form-theme-green.css CHANGED
@@ -1,23 +1 @@
1
- .mc4wp-form input[type="submit"], .mc4wp-form button {
2
- color: #ffffff !important;
3
- background-color: #5cb85c;
4
- border-color: #4cae4c;
5
- }
6
-
7
- .mc4wp-form input[type="submit"]:hover, .mc4wp-form button:hover,
8
- .mc4wp-form input[type="submit"]:active, .mc4wp-form button:active,
9
- .mc4wp-form input[type="submit"]:focus, .mc4wp-form button:focus {
10
- color: #ffffff;
11
- background-color: #47a447;
12
- border-color: #398439;
13
- }
14
-
15
- .mc4wp-form input[type="text"]:focus,
16
- .mc4wp-form input[type="email"]:focus,
17
- .mc4wp-form input[type="tel"]:focus,
18
- .mc4wp-form input[type="url"]:focus,
19
- .mc4wp-form input[type="date"]:focus,
20
- .mc4wp-form textarea:focus,
21
- .mc4wp-form select:focus {
22
- border-color: #5cb85c;
23
- }
1
+ .mc4wp-form{margin:1em 0}.mc4wp-form label{display:block;font-weight:bold;margin-bottom:5px}.mc4wp-form ul,.mc4wp-form li{list-style:none;margin:0;padding:0}.mc4wp-form label>span,.mc4wp-form li>label{font-weight:normal}.mc4wp-form p>label:nth-child(2){margin-top:10px}.mc4wp-form input{vertical-align:baseline}.mc4wp-form input.placeholdersjs{color:#aaa !important}.mc4wp-form input[type="text"],.mc4wp-form input[type="email"],.mc4wp-form input[type="tel"],.mc4wp-form input[type="url"],.mc4wp-form input[type="date"],.mc4wp-form textarea,.mc4wp-form select{cursor:auto;display:block;width:100%;height:auto;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box}.mc4wp-form input[type="checkbox"],.mc4wp-form input[type="radio"]{position:relative;margin:0 6px 0 0;padding:0;height:13px;width:13px;display:inline-block;border:0}.mc4wp-form input[type="checkbox"]{-webkit-appearance:checkbox}.mc4wp-form input[type="radio"]{-webkit-appearance:radio}.mc4wp-form input[type="submit"],.mc4wp-form button,.mc4wp-form input[type="button"]{cursor:pointer;display:inline-block}.mc4wp-alert{margin:1em 0;padding:10px 15px;color:#c09853;background-color:#fcf8e3;border:1px solid #fbeed5;border-radius:2px;-moz-border-radius:2px;-webkit-border-radius:2px;display:block;position:relative}.mc4wp-success{color:#468847;background-color:#dff0d8;border-color:#d6e9c6}.mc4wp-notice{color:#3a87ad;background-color:#d9edf7;border-color:#bce8f1}.mc4wp-error{color:#b94a48;background-color:#f2dede;border-color:#eed3d7}.mc4wp-form{box-shadow:none !important;-webkit-box-shadow:none;-moz-box-shadow:none}.mc4wp-form p{margin:0 0 15px !important;padding:0}.mc4wp-form label{font-size:1em;margin:6px 0}.mc4wp-form input[type="text"],.mc4wp-form input[type="email"],.mc4wp-form input[type="tel"],.mc4wp-form input[type="url"],.mc4wp-form input[type="date"],.mc4wp-form textarea,.mc4wp-form select{width:100%;height:34px;margin:0;padding:6px 12px;font-size:14px;line-height:1.428571429;color:#555555;vertical-align:middle;background-color:#ffffff;border:1px solid #cccccc;-moz-border-radius:2px;-webkit-border-radius:2px;border-radius:2px;-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-moz-transition:border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;-webkit-transition:border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;transition:border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;background-image:none;text-shadow:none}.mc4wp-form input[type="text"]:focus,.mc4wp-form input[type="email"]:focus,.mc4wp-form input[type="tel"]:focus,.mc4wp-form input[type="url"]:focus,.mc4wp-form textarea:focus,.mc4wp-form select:focus{border-color:#66afe9;outline:0;-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(102,175,233,0.6);-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(102,175,233,0.6);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(102,175,233,0.6)}.mc4wp-form textarea{height:auto}.mc4wp-form input[readonly],.mc4wp-form input[disabled]{background-color:#eeeeee}.mc4wp-form input[type="submit"],.mc4wp-form button{display:inline-block;padding:6px 12px;margin:0;font-size:14px;font-weight:normal;line-height:1.428571429;text-align:center;white-space:nowrap;vertical-align:middle;cursor:pointer;border:1px solid transparent;border-radius:2px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none;box-shadow:none;background:none;text-shadow:none;filter:none;height:auto;width:auto}.mc4wp-form input[type="submit"]:focus,.mc4wp-form button:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.mc4wp-form input[type="submit"]:hover,.mc4wp-form button:hover,.mc4wp-form input[type="submit"]:focus,.mc4wp-form button:focus{color:#333333;text-decoration:none;background:none}.mc4wp-form input[type="submit"]:active,.mc4wp-form button:active{background-image:none;outline:0;-moz-box-shadow:inset 0 3px 5px rgba(0,0,0,0.125);-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,0.125);box-shadow:inset 0 3px 5px rgba(0,0,0,0.125)}.mc4wp-form input[type="submit"],.mc4wp-form button{color:#ffffff !important;background-color:#5cb85c;border-color:#4cae4c}.mc4wp-form input[type="submit"]:hover,.mc4wp-form button:hover,.mc4wp-form input[type="submit"]:active,.mc4wp-form button:active,.mc4wp-form input[type="submit"]:focus,.mc4wp-form button:focus{color:#ffffff;background-color:#47a447;border-color:#398439}.mc4wp-form input[type="text"]:focus,.mc4wp-form input[type="email"]:focus,.mc4wp-form input[type="tel"]:focus,.mc4wp-form input[type="url"]:focus,.mc4wp-form input[type="date"]:focus,.mc4wp-form textarea:focus,.mc4wp-form select:focus{border-color:#5cb85c}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/css/form-theme-light.css CHANGED
@@ -1,13 +1 @@
1
- .mc4wp-form input[type="submit"], .mc4wp-form button {
2
- color: #333333 !important;
3
- background-color: #ffffff;
4
- border-color: #E6E6E6;
5
- }
6
-
7
- .mc4wp-form input[type="submit"]:hover, .mc4wp-form button:hover,
8
- .mc4wp-form input[type="submit"]:active, .mc4wp-form button:active,
9
- .mc4wp-form input[type="submit"]:focus, .mc4wp-form button:focus {
10
- color: #E6E6E6;
11
- background-color: #ebebeb;
12
- border-color: #CCCCCC;
13
- }
1
+ .mc4wp-form{margin:1em 0}.mc4wp-form label{display:block;font-weight:bold;margin-bottom:5px}.mc4wp-form ul,.mc4wp-form li{list-style:none;margin:0;padding:0}.mc4wp-form label>span,.mc4wp-form li>label{font-weight:normal}.mc4wp-form p>label:nth-child(2){margin-top:10px}.mc4wp-form input{vertical-align:baseline}.mc4wp-form input.placeholdersjs{color:#aaa !important}.mc4wp-form input[type="text"],.mc4wp-form input[type="email"],.mc4wp-form input[type="tel"],.mc4wp-form input[type="url"],.mc4wp-form input[type="date"],.mc4wp-form textarea,.mc4wp-form select{cursor:auto;display:block;width:100%;height:auto;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box}.mc4wp-form input[type="checkbox"],.mc4wp-form input[type="radio"]{position:relative;margin:0 6px 0 0;padding:0;height:13px;width:13px;display:inline-block;border:0}.mc4wp-form input[type="checkbox"]{-webkit-appearance:checkbox}.mc4wp-form input[type="radio"]{-webkit-appearance:radio}.mc4wp-form input[type="submit"],.mc4wp-form button,.mc4wp-form input[type="button"]{cursor:pointer;display:inline-block}.mc4wp-alert{margin:1em 0;padding:10px 15px;color:#c09853;background-color:#fcf8e3;border:1px solid #fbeed5;border-radius:2px;-moz-border-radius:2px;-webkit-border-radius:2px;display:block;position:relative}.mc4wp-success{color:#468847;background-color:#dff0d8;border-color:#d6e9c6}.mc4wp-notice{color:#3a87ad;background-color:#d9edf7;border-color:#bce8f1}.mc4wp-error{color:#b94a48;background-color:#f2dede;border-color:#eed3d7}.mc4wp-form{box-shadow:none !important;-webkit-box-shadow:none;-moz-box-shadow:none}.mc4wp-form p{margin:0 0 15px !important;padding:0}.mc4wp-form label{font-size:1em;margin:6px 0}.mc4wp-form input[type="text"],.mc4wp-form input[type="email"],.mc4wp-form input[type="tel"],.mc4wp-form input[type="url"],.mc4wp-form input[type="date"],.mc4wp-form textarea,.mc4wp-form select{width:100%;height:34px;margin:0;padding:6px 12px;font-size:14px;line-height:1.428571429;color:#555555;vertical-align:middle;background-color:#ffffff;border:1px solid #cccccc;-moz-border-radius:2px;-webkit-border-radius:2px;border-radius:2px;-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-moz-transition:border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;-webkit-transition:border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;transition:border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;background-image:none;text-shadow:none}.mc4wp-form input[type="text"]:focus,.mc4wp-form input[type="email"]:focus,.mc4wp-form input[type="tel"]:focus,.mc4wp-form input[type="url"]:focus,.mc4wp-form textarea:focus,.mc4wp-form select:focus{border-color:#66afe9;outline:0;-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(102,175,233,0.6);-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(102,175,233,0.6);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(102,175,233,0.6)}.mc4wp-form textarea{height:auto}.mc4wp-form input[readonly],.mc4wp-form input[disabled]{background-color:#eeeeee}.mc4wp-form input[type="submit"],.mc4wp-form button{display:inline-block;padding:6px 12px;margin:0;font-size:14px;font-weight:normal;line-height:1.428571429;text-align:center;white-space:nowrap;vertical-align:middle;cursor:pointer;border:1px solid transparent;border-radius:2px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none;box-shadow:none;background:none;text-shadow:none;filter:none;height:auto;width:auto}.mc4wp-form input[type="submit"]:focus,.mc4wp-form button:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.mc4wp-form input[type="submit"]:hover,.mc4wp-form button:hover,.mc4wp-form input[type="submit"]:focus,.mc4wp-form button:focus{color:#333333;text-decoration:none;background:none}.mc4wp-form input[type="submit"]:active,.mc4wp-form button:active{background-image:none;outline:0;-moz-box-shadow:inset 0 3px 5px rgba(0,0,0,0.125);-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,0.125);box-shadow:inset 0 3px 5px rgba(0,0,0,0.125)}.mc4wp-form input[type="submit"],.mc4wp-form button{color:#333333 !important;background-color:#ffffff;border-color:#E6E6E6}.mc4wp-form input[type="submit"]:hover,.mc4wp-form button:hover,.mc4wp-form input[type="submit"]:active,.mc4wp-form button:active,.mc4wp-form input[type="submit"]:focus,.mc4wp-form button:focus{color:#E6E6E6;background-color:#ebebeb;border-color:#CCCCCC}
 
 
 
 
 
 
 
 
 
 
 
 
assets/css/form-theme-red.css CHANGED
@@ -1,23 +1 @@
1
- .mc4wp-form input[type="submit"], .mc4wp-form button {
2
- color: #ffffff !important;
3
- background-color: #d9534f;
4
- border-color: #d43f3a;
5
- }
6
-
7
- .mc4wp-form input[type="submit"]:hover, .mc4wp-form button:hover,
8
- .mc4wp-form input[type="submit"]:active, .mc4wp-form button:active,
9
- .mc4wp-form input[type="submit"]:focus, .mc4wp-form button:focus {
10
- color: #ffffff;
11
- background-color: #d2322d;
12
- border-color: #ac2925;
13
- }
14
-
15
- .mc4wp-form input[type="text"]:focus,
16
- .mc4wp-form input[type="email"]:focus,
17
- .mc4wp-form input[type="tel"]:focus,
18
- .mc4wp-form input[type="url"]:focus,
19
- .mc4wp-form input[type="date"]:focus,
20
- .mc4wp-form textarea:focus,
21
- .mc4wp-form select:focus {
22
- border-color: #d9534f;
23
- }
1
+ .mc4wp-form{margin:1em 0}.mc4wp-form label{display:block;font-weight:bold;margin-bottom:5px}.mc4wp-form ul,.mc4wp-form li{list-style:none;margin:0;padding:0}.mc4wp-form label>span,.mc4wp-form li>label{font-weight:normal}.mc4wp-form p>label:nth-child(2){margin-top:10px}.mc4wp-form input{vertical-align:baseline}.mc4wp-form input.placeholdersjs{color:#aaa !important}.mc4wp-form input[type="text"],.mc4wp-form input[type="email"],.mc4wp-form input[type="tel"],.mc4wp-form input[type="url"],.mc4wp-form input[type="date"],.mc4wp-form textarea,.mc4wp-form select{cursor:auto;display:block;width:100%;height:auto;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box}.mc4wp-form input[type="checkbox"],.mc4wp-form input[type="radio"]{position:relative;margin:0 6px 0 0;padding:0;height:13px;width:13px;display:inline-block;border:0}.mc4wp-form input[type="checkbox"]{-webkit-appearance:checkbox}.mc4wp-form input[type="radio"]{-webkit-appearance:radio}.mc4wp-form input[type="submit"],.mc4wp-form button,.mc4wp-form input[type="button"]{cursor:pointer;display:inline-block}.mc4wp-alert{margin:1em 0;padding:10px 15px;color:#c09853;background-color:#fcf8e3;border:1px solid #fbeed5;border-radius:2px;-moz-border-radius:2px;-webkit-border-radius:2px;display:block;position:relative}.mc4wp-success{color:#468847;background-color:#dff0d8;border-color:#d6e9c6}.mc4wp-notice{color:#3a87ad;background-color:#d9edf7;border-color:#bce8f1}.mc4wp-error{color:#b94a48;background-color:#f2dede;border-color:#eed3d7}.mc4wp-form{box-shadow:none !important;-webkit-box-shadow:none;-moz-box-shadow:none}.mc4wp-form p{margin:0 0 15px !important;padding:0}.mc4wp-form label{font-size:1em;margin:6px 0}.mc4wp-form input[type="text"],.mc4wp-form input[type="email"],.mc4wp-form input[type="tel"],.mc4wp-form input[type="url"],.mc4wp-form input[type="date"],.mc4wp-form textarea,.mc4wp-form select{width:100%;height:34px;margin:0;padding:6px 12px;font-size:14px;line-height:1.428571429;color:#555555;vertical-align:middle;background-color:#ffffff;border:1px solid #cccccc;-moz-border-radius:2px;-webkit-border-radius:2px;border-radius:2px;-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-moz-transition:border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;-webkit-transition:border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;transition:border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;background-image:none;text-shadow:none}.mc4wp-form input[type="text"]:focus,.mc4wp-form input[type="email"]:focus,.mc4wp-form input[type="tel"]:focus,.mc4wp-form input[type="url"]:focus,.mc4wp-form textarea:focus,.mc4wp-form select:focus{border-color:#66afe9;outline:0;-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(102,175,233,0.6);-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(102,175,233,0.6);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(102,175,233,0.6)}.mc4wp-form textarea{height:auto}.mc4wp-form input[readonly],.mc4wp-form input[disabled]{background-color:#eeeeee}.mc4wp-form input[type="submit"],.mc4wp-form button{display:inline-block;padding:6px 12px;margin:0;font-size:14px;font-weight:normal;line-height:1.428571429;text-align:center;white-space:nowrap;vertical-align:middle;cursor:pointer;border:1px solid transparent;border-radius:2px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none;box-shadow:none;background:none;text-shadow:none;filter:none;height:auto;width:auto}.mc4wp-form input[type="submit"]:focus,.mc4wp-form button:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.mc4wp-form input[type="submit"]:hover,.mc4wp-form button:hover,.mc4wp-form input[type="submit"]:focus,.mc4wp-form button:focus{color:#333333;text-decoration:none}.mc4wp-form input[type="submit"]:active,.mc4wp-form button:active{background-image:none;outline:0;-moz-box-shadow:inset 0 3px 5px rgba(0,0,0,0.125);-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,0.125);box-shadow:inset 0 3px 5px rgba(0,0,0,0.125)}.mc4wp-form input[type="submit"],.mc4wp-form button{color:#ffffff !important;background-color:#d9534f;border-color:#d43f3a}.mc4wp-form input[type="submit"]:hover,.mc4wp-form button:hover,.mc4wp-form input[type="submit"]:active,.mc4wp-form button:active,.mc4wp-form input[type="submit"]:focus,.mc4wp-form button:focus{color:#ffffff;background-color:#d2322d;border-color:#ac2925}.mc4wp-form input[type="text"]:focus,.mc4wp-form input[type="email"]:focus,.mc4wp-form input[type="tel"]:focus,.mc4wp-form input[type="url"]:focus,.mc4wp-form input[type="date"]:focus,.mc4wp-form textarea:focus,.mc4wp-form select:focus{border-color:#d9534f}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/css/form.css ADDED
@@ -0,0 +1 @@
 
1
+ .mc4wp-form{margin:1em 0}.mc4wp-form label{display:block;font-weight:bold;margin-bottom:5px}.mc4wp-form ul,.mc4wp-form li{list-style:none;margin:0;padding:0}.mc4wp-form label>span,.mc4wp-form li>label{font-weight:normal}.mc4wp-form p>label:nth-child(2){margin-top:10px}.mc4wp-form input{vertical-align:baseline}.mc4wp-form input.placeholdersjs{color:#aaa !important}.mc4wp-form input[type="text"],.mc4wp-form input[type="email"],.mc4wp-form input[type="tel"],.mc4wp-form input[type="url"],.mc4wp-form input[type="date"],.mc4wp-form textarea,.mc4wp-form select{cursor:auto;display:block;width:100%;height:auto;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box}.mc4wp-form input[type="checkbox"],.mc4wp-form input[type="radio"]{position:relative;margin:0 6px 0 0;padding:0;height:13px;width:13px;display:inline-block;border:0}.mc4wp-form input[type="checkbox"]{-webkit-appearance:checkbox}.mc4wp-form input[type="radio"]{-webkit-appearance:radio}.mc4wp-form input[type="submit"],.mc4wp-form button,.mc4wp-form input[type="button"]{cursor:pointer;display:inline-block}.mc4wp-alert{margin:1em 0;padding:10px 15px;color:#c09853;background-color:#fcf8e3;border:1px solid #fbeed5;border-radius:2px;-moz-border-radius:2px;-webkit-border-radius:2px;display:block;position:relative}.mc4wp-success{color:#468847;background-color:#dff0d8;border-color:#d6e9c6}.mc4wp-notice{color:#3a87ad;background-color:#d9edf7;border-color:#bce8f1}.mc4wp-error{color:#b94a48;background-color:#f2dede;border-color:#eed3d7}
assets/js/admin.js CHANGED
@@ -11,14 +11,40 @@
11
  event.stopPropagation();
12
  });
13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
 
15
  // Add buttons to QTags editor
16
  (function() {
17
- if(window.QTags == undefined) { return; }
 
 
 
18
 
19
  QTags.addButton( 'mc4wp_paragraph', '<p>', '<p>', '</p>', 'p', 'Paragraph tag', 1 );
20
  QTags.addButton( 'mc4wp_label', 'label', '<label>', '</label>', 'l', 'Label tag', 2 );
21
  QTags.addButton( 'mc4wp_subscriber_count', '# of subscribers', '{subscriber_count}', '', 's', 'Shows number of subscribers of selected list(s)' );
 
 
 
 
22
  })();
23
 
24
 
11
  event.stopPropagation();
12
  });
13
 
14
+ $(document).delegate('#mc4wpformmarkup', 'keydown', function(e) {
15
+ var keyCode = e.keyCode || e.which;
16
+
17
+ if (keyCode == 9) {
18
+ e.preventDefault();
19
+ var start = this.selectionStart;
20
+ var end = this.selectionEnd;
21
+
22
+ // set textarea value to: text before caret + tab + text after caret
23
+ $(this).val($(this).val().substring(0, start)
24
+ + "\t"
25
+ + $(this).val().substring(end));
26
+
27
+ // put caret at right position again
28
+ this.selectionStart =
29
+ this.selectionEnd = start + 1;
30
+ }
31
+ });
32
+
33
 
34
  // Add buttons to QTags editor
35
  (function() {
36
+
37
+ if( window.QTags == undefined ) {
38
+ return;
39
+ }
40
 
41
  QTags.addButton( 'mc4wp_paragraph', '<p>', '<p>', '</p>', 'p', 'Paragraph tag', 1 );
42
  QTags.addButton( 'mc4wp_label', 'label', '<label>', '</label>', 'l', 'Label tag', 2 );
43
  QTags.addButton( 'mc4wp_subscriber_count', '# of subscribers', '{subscriber_count}', '', 's', 'Shows number of subscribers of selected list(s)' );
44
+ if( window.mc4wp.has_captcha_plugin == true ) {
45
+ QTags.addButton( 'mc4wp_captcha', 'CAPTCHA', '[captcha]', '', 'c', 'Display a CAPTCHA field' );
46
+ }
47
+
48
  })();
49
 
50
 
assets/sass/checkbox.scss ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* MailChimp for WP - Checkbox Styles */
2
+ #mc4wp-checkbox{
3
+
4
+ clear: both;
5
+ display: block;
6
+
7
+ input {
8
+ position: relative;
9
+ margin: 0 6px 0 0;
10
+ padding: 0;
11
+ vertical-align: middle;
12
+ display: inline-block !important;
13
+ max-width: 21px;
14
+ }
15
+
16
+ label {
17
+ display: block;
18
+ cursor: pointer;
19
+ width: auto;
20
+ }
21
+
22
+ }
23
+
24
+ #registerform #mc4wp-checkbox{
25
+ margin-bottom: 10px;
26
+ }
assets/sass/form-theme-blue.scss ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @import "form-reset";
2
+ @import "form-theme-base";
3
+
4
+ .mc4wp-form input[type="submit"],
5
+ .mc4wp-form button {
6
+ color: #ffffff !important;
7
+ background-color: #428bca;
8
+ border-color: #357ebd;
9
+ }
10
+
11
+ .mc4wp-form input[type="submit"]:hover,
12
+ .mc4wp-form button:hover,
13
+ .mc4wp-form input[type="submit"]:active,
14
+ .mc4wp-form button:active,
15
+ .mc4wp-form input[type="submit"]:focus,
16
+ .mc4wp-form button:focus {
17
+ color: #ffffff;
18
+ background-color: #3276b1;
19
+ border-color: #285e8e;
20
+ }
21
+
22
+ .mc4wp-form input[type="text"]:focus,
23
+ .mc4wp-form input[type="email"]:focus,
24
+ .mc4wp-form input[type="tel"]:focus,
25
+ .mc4wp-form input[type="url"]:focus,
26
+ .mc4wp-form input[type="date"]:focus,
27
+ .mc4wp-form textarea:focus,
28
+ .mc4wp-form select:focus {
29
+ border-color: #428bca;
30
+ }
assets/sass/form-theme-dark.scss ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @import "form-reset";
2
+ @import "form-theme-base";
3
+
4
+ .mc4wp-form input[type="submit"],
5
+ .mc4wp-form button {
6
+ color: #ffffff !important;
7
+ background-color: #444444;
8
+ border-color: #282828;
9
+ }
10
+
11
+ .mc4wp-form input[type="submit"]:hover,
12
+ .mc4wp-form button:hover,
13
+ .mc4wp-form input[type="submit"]:active,
14
+ .mc4wp-form button:active,
15
+ .mc4wp-form input[type="submit"]:focus,
16
+ .mc4wp-form button:focus {
17
+ color: #ffffff;
18
+ background-color: #282828;
19
+ border-color: #111111;
20
+ }
21
+
22
+ .mc4wp-form input[type="text"]:focus,
23
+ .mc4wp-form input[type="email"]:focus,
24
+ .mc4wp-form input[type="tel"]:focus,
25
+ .mc4wp-form input[type="url"]:focus,
26
+ .mc4wp-form input[type="date"]:focus,
27
+ .mc4wp-form textarea:focus,
28
+ .mc4wp-form select:focus {
29
+ border-color: #444444;
30
+ }
assets/sass/form-theme-green.scss ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @import "form-reset";
2
+ @import "form-theme-base";
3
+
4
+ .mc4wp-form input[type="submit"],
5
+ .mc4wp-form button {
6
+ color: #ffffff !important;
7
+ background-color: #5cb85c;
8
+ border-color: #4cae4c;
9
+ }
10
+
11
+ .mc4wp-form input[type="submit"]:hover,
12
+ .mc4wp-form button:hover,
13
+ .mc4wp-form input[type="submit"]:active,
14
+ .mc4wp-form button:active,
15
+ .mc4wp-form input[type="submit"]:focus,
16
+ .mc4wp-form button:focus {
17
+ color: #ffffff;
18
+ background-color: #47a447;
19
+ border-color: #398439;
20
+ }
21
+
22
+ .mc4wp-form input[type="text"]:focus,
23
+ .mc4wp-form input[type="email"]:focus,
24
+ .mc4wp-form input[type="tel"]:focus,
25
+ .mc4wp-form input[type="url"]:focus,
26
+ .mc4wp-form input[type="date"]:focus,
27
+ .mc4wp-form textarea:focus,
28
+ .mc4wp-form select:focus {
29
+ border-color: #5cb85c;
30
+ }
assets/sass/form-theme-light.scss ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @import "form-reset";
2
+ @import "form-theme-base";
3
+
4
+ .mc4wp-form input[type="submit"],
5
+ .mc4wp-form button {
6
+ color: #333333 !important;
7
+ background-color: #ffffff;
8
+ border-color: #E6E6E6;
9
+ }
10
+
11
+ .mc4wp-form input[type="submit"]:hover,
12
+ .mc4wp-form button:hover,
13
+ .mc4wp-form input[type="submit"]:active,
14
+ .mc4wp-form button:active,
15
+ .mc4wp-form input[type="submit"]:focus,
16
+ .mc4wp-form button:focus {
17
+ color: #E6E6E6;
18
+ background-color: #ebebeb;
19
+ border-color: #CCCCCC;
20
+ }
assets/sass/form-theme-red.scss ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @import "form-reset";
2
+ @import "form-theme-base";
3
+
4
+
5
+
6
+ .mc4wp-form input[type="submit"],
7
+ .mc4wp-form button {
8
+ color: #ffffff !important;
9
+ background-color: #d9534f;
10
+ border-color: #d43f3a;
11
+ }
12
+
13
+ .mc4wp-form input[type="submit"]:hover,
14
+ .mc4wp-form button:hover,
15
+ .mc4wp-form input[type="submit"]:active,
16
+ .mc4wp-form button:active,
17
+ .mc4wp-form input[type="submit"]:focus,
18
+ .mc4wp-form button:focus {
19
+ color: #ffffff;
20
+ background-color: #d2322d;
21
+ border-color: #ac2925;
22
+ }
23
+
24
+ .mc4wp-form input[type="text"]:focus,
25
+ .mc4wp-form input[type="email"]:focus,
26
+ .mc4wp-form input[type="tel"]:focus,
27
+ .mc4wp-form input[type="url"]:focus,
28
+ .mc4wp-form input[type="date"]:focus,
29
+ .mc4wp-form textarea:focus,
30
+ .mc4wp-form select:focus {
31
+ border-color: #d9534f;
32
+ }
assets/sass/form.scss ADDED
@@ -0,0 +1,2 @@
 
 
1
+ @import "form-reset";
2
+
assets/sass/index.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+ if( ! defined("MC4WP_LITE_VERSION") ) {
3
+ header( 'Status: 403 Forbidden' );
4
+ header( 'HTTP/1.1 403 Forbidden' );
5
+ exit;
6
+ }
assets/sass/partials/_form-reset.scss ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ /* MailChimp for WP - Default Form Styles */
3
+ .mc4wp-form{
4
+ margin: 1em 0;
5
+ }
6
+
7
+ .mc4wp-form label{
8
+ display: block;
9
+ font-weight: bold;
10
+ margin-bottom: 5px;
11
+ }
12
+
13
+ .mc4wp-form ul,
14
+ .mc4wp-form li {
15
+ list-style: none;
16
+ margin: 0;
17
+ padding: 0;
18
+ }
19
+
20
+ .mc4wp-form label > span,
21
+ .mc4wp-form li > label {
22
+ font-weight: normal;
23
+ }
24
+
25
+ .mc4wp-form p > label:nth-child(2) {
26
+ margin-top: 10px;
27
+ }
28
+
29
+ .mc4wp-form input {
30
+ vertical-align: baseline;
31
+ }
32
+
33
+ .mc4wp-form input.placeholdersjs {
34
+ color: #aaa !important;
35
+ }
36
+
37
+ .mc4wp-form input[type="text"],
38
+ .mc4wp-form input[type="email"],
39
+ .mc4wp-form input[type="tel"],
40
+ .mc4wp-form input[type="url"],
41
+ .mc4wp-form input[type="date"],
42
+ .mc4wp-form textarea,
43
+ .mc4wp-form select {
44
+ cursor: auto;
45
+ display: block;
46
+ width: 100%;
47
+ height: auto;
48
+ box-sizing: border-box;
49
+ -webkit-box-sizing: border-box;
50
+ -moz-box-sizing: border-box;
51
+ }
52
+
53
+ .mc4wp-form input[type="checkbox"],
54
+ .mc4wp-form input[type="radio"] {
55
+ position: relative;
56
+ margin: 0 6px 0 0;
57
+ padding: 0;
58
+ height: 13px;
59
+ width: 13px;
60
+ display: inline-block;
61
+ border: 0;
62
+ }
63
+
64
+ .mc4wp-form input[type="checkbox"] {
65
+ -webkit-appearance: checkbox;
66
+ }
67
+
68
+ .mc4wp-form input[type="radio"] {
69
+ -webkit-appearance: radio;
70
+ }
71
+
72
+ .mc4wp-form input[type="submit"],
73
+ .mc4wp-form button,
74
+ .mc4wp-form input[type="button"] {
75
+ cursor: pointer;
76
+ display: inline-block;
77
+ }
78
+
79
+ .mc4wp-alert{
80
+ margin: 1em 0;
81
+ padding: 10px 15px;
82
+ color: #c09853;
83
+ background-color: #fcf8e3;
84
+ border: 1px solid #fbeed5;
85
+ border-radius: 2px;
86
+ -moz-border-radius: 2px;
87
+ -webkit-border-radius: 2px;
88
+ display: block;
89
+ position: relative;
90
+ }
91
+
92
+ .mc4wp-success {
93
+ color: #468847;
94
+ background-color: #dff0d8;
95
+ border-color: #d6e9c6;
96
+ }
97
+
98
+ .mc4wp-notice {
99
+ color: #3a87ad;
100
+ background-color: #d9edf7;
101
+ border-color: #bce8f1;
102
+ }
103
+
104
+ .mc4wp-error {
105
+ color: #b94a48;
106
+ background-color: #f2dede;
107
+ border-color: #eed3d7;
108
+ }
assets/{css/form-theme-base.css → sass/partials/_form-theme-base.scss} RENAMED
@@ -1,120 +1,120 @@
1
-
2
- /* Form base theme */
3
- .mc4wp-form {
4
- box-shadow: none !important;
5
- -webkit-box-shadow: none;
6
- -moz-box-shadow: none;
7
- }
8
-
9
- .mc4wp-form p {
10
- margin: 0 0 15px !important;
11
- padding: 0;
12
- }
13
-
14
- .mc4wp-form label{
15
- font-size:1em;
16
- margin:6px 0;
17
- }
18
-
19
- .mc4wp-form input[type="text"],
20
- .mc4wp-form input[type="email"],
21
- .mc4wp-form input[type="tel"],
22
- .mc4wp-form input[type="url"],
23
- .mc4wp-form input[type="date"],
24
- .mc4wp-form textarea,
25
- .mc4wp-form select {
26
- width: 100%;
27
- height: 34px;
28
- margin: 0;
29
- padding: 6px 12px;
30
- font-size: 14px;
31
- line-height: 1.428571429;
32
- color: #555555;
33
- vertical-align: middle;
34
- background-color: #ffffff;
35
- border: 1px solid #cccccc;
36
- -moz-border-radius: 2px;
37
- -webkit-border-radius: 2px;
38
- border-radius: 2px;
39
- -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
40
- -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
41
- box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
42
- -moz-transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
43
- -webkit-transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
44
- transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
45
- background-image: none;
46
- text-shadow: none;
47
- }
48
-
49
- .mc4wp-form input[type="text"]:focus,
50
- .mc4wp-form input[type="email"]:focus,
51
- .mc4wp-form input[type="tel"]:focus,
52
- .mc4wp-form input[type="url"]:focus,
53
- .mc4wp-form textarea:focus,
54
- .mc4wp-form select:focus {
55
- border-color: #66afe9;
56
- outline: 0;
57
- -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
58
- -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
59
- box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
60
- }
61
-
62
- .mc4wp-form textarea{
63
- height: auto;
64
- }
65
-
66
- .mc4wp-form input[readonly],
67
- .mc4wp-form input[disabled] {
68
- background-color: #eeeeee;
69
- }
70
-
71
- .mc4wp-form input[type="submit"],
72
- .mc4wp-form button {
73
- display: inline-block;
74
- padding: 6px 12px;
75
- margin: 0;
76
- font-size: 14px;
77
- font-weight: normal;
78
- line-height: 1.428571429;
79
- text-align: center;
80
- white-space: nowrap;
81
- vertical-align: middle;
82
- cursor: pointer;
83
- border: 1px solid transparent;
84
- border-radius: 2px;
85
- -webkit-user-select: none;
86
- -moz-user-select: none;
87
- -ms-user-select: none;
88
- -o-user-select: none;
89
- user-select: none;
90
- box-shadow: none;
91
- background: none;
92
- text-shadow: none;
93
- filter: none;
94
- height: auto;
95
- width: auto;
96
- }
97
-
98
- .mc4wp-form input[type="submit"]:focus,
99
- .mc4wp-form button:focus {
100
- outline: thin dotted #333;
101
- outline: 5px auto -webkit-focus-ring-color;
102
- outline-offset: -2px;
103
- }
104
-
105
- .mc4wp-form input[type="submit"]:hover,
106
- .mc4wp-form button:hover,
107
- .mc4wp-form input[type="submit"]:focus,
108
- .mc4wp-form button:focus {
109
- color: #333333;
110
- text-decoration: none;
111
- }
112
-
113
- .mc4wp-form input[type="submit"]:active,
114
- .mc4wp-form button:active {
115
- background-image: none;
116
- outline: 0;
117
- -moz-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
118
- -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
119
- box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
120
  }
1
+ /* Form base theme */
2
+ .mc4wp-form {
3
+ box-shadow: none !important;
4
+ -webkit-box-shadow: none;
5
+ -moz-box-shadow: none;
6
+ }
7
+
8
+ .mc4wp-form p {
9
+ margin: 0 0 15px !important;
10
+ padding: 0;
11
+ }
12
+
13
+ .mc4wp-form label{
14
+ font-size:1em;
15
+ margin:6px 0;
16
+ }
17
+
18
+ .mc4wp-form input[type="text"],
19
+ .mc4wp-form input[type="email"],
20
+ .mc4wp-form input[type="tel"],
21
+ .mc4wp-form input[type="url"],
22
+ .mc4wp-form input[type="date"],
23
+ .mc4wp-form textarea,
24
+ .mc4wp-form select {
25
+ width: 100%;
26
+ height: 34px;
27
+ margin: 0;
28
+ padding: 6px 12px;
29
+ font-size: 14px;
30
+ line-height: 1.428571429;
31
+ color: #555555;
32
+ vertical-align: middle;
33
+ background-color: #ffffff;
34
+ border: 1px solid #cccccc;
35
+ -moz-border-radius: 2px;
36
+ -webkit-border-radius: 2px;
37
+ border-radius: 2px;
38
+ -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
39
+ -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
40
+ box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
41
+ -moz-transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
42
+ -webkit-transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
43
+ transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
44
+ background-image: none;
45
+ text-shadow: none;
46
+ }
47
+
48
+ .mc4wp-form input[type="text"]:focus,
49
+ .mc4wp-form input[type="email"]:focus,
50
+ .mc4wp-form input[type="tel"]:focus,
51
+ .mc4wp-form input[type="url"]:focus,
52
+ .mc4wp-form textarea:focus,
53
+ .mc4wp-form select:focus {
54
+ border-color: #66afe9;
55
+ outline: 0;
56
+ -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
57
+ -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
58
+ box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
59
+ }
60
+
61
+ .mc4wp-form textarea{
62
+ height: auto;
63
+ }
64
+
65
+ .mc4wp-form input[readonly],
66
+ .mc4wp-form input[disabled] {
67
+ background-color: #eeeeee;
68
+ }
69
+
70
+ .mc4wp-form input[type="submit"],
71
+ .mc4wp-form button {
72
+ display: inline-block;
73
+ padding: 6px 12px;
74
+ margin: 0;
75
+ font-size: 14px;
76
+ font-weight: normal;
77
+ line-height: 1.428571429;
78
+ text-align: center;
79
+ white-space: nowrap;
80
+ vertical-align: middle;
81
+ cursor: pointer;
82
+ border: 1px solid transparent;
83
+ border-radius: 2px;
84
+ -webkit-user-select: none;
85
+ -moz-user-select: none;
86
+ -ms-user-select: none;
87
+ -o-user-select: none;
88
+ user-select: none;
89
+ box-shadow: none;
90
+ background: none;
91
+ text-shadow: none;
92
+ filter: none;
93
+ height: auto;
94
+ width: auto;
95
+ }
96
+
97
+ .mc4wp-form input[type="submit"]:focus,
98
+ .mc4wp-form button:focus {
99
+ outline: thin dotted #333;
100
+ outline: 5px auto -webkit-focus-ring-color;
101
+ outline-offset: -2px;
102
+ }
103
+
104
+ .mc4wp-form input[type="submit"]:hover,
105
+ .mc4wp-form button:hover,
106
+ .mc4wp-form input[type="submit"]:focus,
107
+ .mc4wp-form button:focus {
108
+ color: #333333;
109
+ text-decoration: none;
110
+ background: none;
111
+ }
112
+
113
+ .mc4wp-form input[type="submit"]:active,
114
+ .mc4wp-form button:active {
115
+ background-image: none;
116
+ outline: 0;
117
+ -moz-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
118
+ -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
119
+ box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
120
  }
assets/sass/partials/index.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+ if( ! defined("MC4WP_LITE_VERSION") ) {
3
+ header( 'Status: 403 Forbidden' );
4
+ header( 'HTTP/1.1 403 Forbidden' );
5
+ exit;
6
+ }
includes/class-admin.php CHANGED
@@ -8,54 +8,72 @@ if( ! defined( "MC4WP_LITE_VERSION" ) ) {
8
 
9
  class MC4WP_Lite_Admin
10
  {
11
-
 
 
 
 
 
 
 
 
 
 
12
  public function __construct()
13
  {
14
- add_action('admin_init', array($this, 'register_settings'));
15
- add_action('admin_menu', array($this, 'build_menu'));
16
- add_action( 'admin_enqueue_scripts', array($this, 'load_css_and_js') );
17
-
18
- register_activation_hook( 'mailchimp-for-wp/mailchimp-for-wp.php', array( $this, 'delete_transients' ) );
19
- register_deactivation_hook( 'mailchimp-for-wp/mailchimp-for-wp.php', array( $this, 'delete_transients' ) );
20
 
21
- add_filter( "plugin_action_links_mailchimp-for-wp/mailchimp-for-wp.php", array( $this, 'add_settings_link' ) );
22
-
23
- // did the user click on upgrade to pro link?
24
- if( isset( $_GET['page'] ) ) {
25
 
26
- if( $_GET['page'] == 'mc4wp-lite-upgrade' && ! headers_sent() ) {
27
- header("Location: http://dannyvankooten.com/mailchimp-for-wordpress/?utm_source=lite-plugin&utm_medium=link&utm_campaign=menu-upgrade-link");
28
- exit;
29
- }
30
 
31
- if( $_GET['page'] == 'mc4wp-lite-form-settings' ) {
32
- add_filter( 'quicktags_settings', array( $this, 'set_quicktags_buttons' ), 10, 2 );
33
- }
 
34
  }
 
35
  }
36
 
37
  /**
38
- * Delete the list transients on plugin (de)activation
39
- */
40
- public function delete_transients()
41
- {
42
- delete_transient( 'mc4wp_mailchimp_lists' );
43
- delete_transient( 'mc4wp_mailchimp_lists_fallback' );
 
 
 
 
 
 
 
 
 
 
 
 
44
  }
45
 
46
  /**
47
- * Set which Quicktag buttons should appear in the form mark-up editor
48
- * @param array $settings
49
- * @param string $editor_id
50
- * @return array
51
- */
52
- public function set_quicktags_buttons( $settings, $editor_id = '')
 
53
  {
54
  if( $editor_id !== 'mc4wpformmarkup' ) {
55
  return $settings;
56
  }
57
 
58
- $settings['buttons'] = 'strong,em,link,block,img,ul,ol,li,close';
59
 
60
  return $settings;
61
  }
@@ -65,22 +83,33 @@ class MC4WP_Lite_Admin
65
  * @param array $links
66
  * @return array
67
  */
68
- public function add_settings_link( $links )
69
  {
70
- $settings_link = '<a href="admin.php?page=mc4wp-lite">'. __('Settings') . '</a>';
71
- $upgrade_link = '<a href="http://dannyvankooten.com/mailchimp-for-wordpress/">Upgrade to Pro</a>';
72
- array_unshift( $links, $upgrade_link, $settings_link );
 
 
 
73
  return $links;
74
  }
75
 
76
  /**
77
- * Register the various MailChimp for WordPress settings
78
- */
79
- public function register_settings()
80
- {
81
- register_setting( 'mc4wp_lite_settings', 'mc4wp_lite', array( $this, 'validate_settings' ) );
82
- register_setting( 'mc4wp_lite_checkbox_settings', 'mc4wp_lite_checkbox');
83
- register_setting( 'mc4wp_lite_form_settings', 'mc4wp_lite_form', array( $this, 'validate_form_settings' ) );
 
 
 
 
 
 
 
 
84
  }
85
 
86
  /**
@@ -121,10 +150,8 @@ class MC4WP_Lite_Admin
121
  public function validate_form_settings( $settings ) {
122
 
123
  if( isset( $settings['markup'] ) ) {
124
-
125
  // strip form tags (to prevent people from adding them)
126
  $settings['markup'] = preg_replace( '/<\/?form(.|\s)*?>/i', '', $settings['markup'] );
127
-
128
  }
129
 
130
  return $settings;
@@ -135,8 +162,8 @@ class MC4WP_Lite_Admin
135
  */
136
  public function load_css_and_js( $hook )
137
  {
138
- // only load files on the MailChimp for WordPress page
139
- if( ! isset( $_GET['page'] ) || stristr( $_GET['page'], 'mc4wp-lite' ) == false ) {
140
  return;
141
  }
142
 
@@ -145,27 +172,46 @@ class MC4WP_Lite_Admin
145
 
146
  // js
147
  wp_register_script( 'mc4wp-beautifyhtml', MC4WP_LITE_PLUGIN_URL . 'assets/js/beautify-html.js', array( 'jquery' ), MC4WP_LITE_VERSION, true );
148
- wp_register_script( 'mc4wp-admin-js', MC4WP_LITE_PLUGIN_URL . 'assets/js/admin.js', array( 'jquery' ), false, true );
149
- wp_enqueue_script( array( 'jquery', 'mc4wp-beautifyhtml', 'mc4wp-admin-js' ) );
 
 
 
 
 
150
  }
151
 
152
  /**
153
- * Returns available checkbox integrations
154
- * @return array
155
- */
 
156
  public function get_checkbox_compatible_plugins()
157
  {
158
  $checkbox_plugins = array(
159
- 'comment_form' => "Comment form",
160
- "registration_form" => "Registration form"
161
  );
162
 
163
- if(is_multisite()) $checkbox_plugins['multisite_form'] = "MultiSite forms";
164
- if(class_exists("BuddyPress")) $checkbox_plugins['buddypress_form'] = "BuddyPress registration";
165
- if(class_exists('bbPress')) $checkbox_plugins['bbpress_forms'] = "bbPress";
 
 
 
 
166
 
167
- if ( class_exists( 'Easy_Digital_Downloads' ) ) $checkbox_plugins['_edd_checkout'] = "(PRO ONLY) Easy Digital Downloads checkout";
168
- if ( class_exists( 'Woocommerce' ) ) $checkbox_plugins['_woocommerce_checkout'] = "(PRO ONLY) WooCommerce checkout";
 
 
 
 
 
 
 
 
 
169
 
170
  return $checkbox_plugins;
171
  }
@@ -175,7 +221,7 @@ class MC4WP_Lite_Admin
175
  */
176
  public function redirect_to_pro()
177
  {
178
- ?><script>window.location.replace('http://dannyvankooten.com/mailchimp-for-wordpress/'); </script><?php
179
  }
180
 
181
  /**
@@ -185,15 +231,10 @@ class MC4WP_Lite_Admin
185
  {
186
  $opts = mc4wp_get_options( 'general' );
187
  $tab = 'api-settings';
188
-
189
- if( empty( $opts['api_key'] ) ) {
190
- $connected = false;
191
- } else {
192
- $connected = ( mc4wp_get_api()->is_connected() );
193
- }
194
 
195
  $lists = $this->get_mailchimp_lists();
196
- include_once MC4WP_LITE_PLUGIN_DIR . 'includes/views/api-settings.php';
197
  }
198
 
199
  /**
@@ -205,7 +246,7 @@ class MC4WP_Lite_Admin
205
  $lists = $this->get_mailchimp_lists();
206
 
207
  $tab = 'checkbox-settings';
208
- include_once MC4WP_LITE_PLUGIN_DIR . 'includes/views/checkbox-settings.php';
209
  }
210
 
211
  /**
@@ -216,7 +257,7 @@ class MC4WP_Lite_Admin
216
  $opts = mc4wp_get_options( 'form' );
217
  $lists = $this->get_mailchimp_lists();
218
  $tab = 'form-settings';
219
- include_once MC4WP_LITE_PLUGIN_DIR . 'includes/views/form-settings.php';
220
  }
221
 
222
  /**
@@ -228,19 +269,9 @@ class MC4WP_Lite_Admin
228
  private function get_mailchimp_lists()
229
  {
230
  $cached_lists = get_transient( 'mc4wp_mailchimp_lists' );
231
- $refresh_cache = ( isset( $_REQUEST['renew-cached-data'] ) );
232
-
233
- // force cache refresh if merge_vars are not set (deprecated)
234
- if( ! $refresh_cache && $cached_lists ) {
235
- if( ! is_array( $cached_lists ) ) {
236
- $refresh_cache = true;
237
- } else {
238
- $first_list = reset( $cached_lists );
239
- $refresh_cache = ! isset( $first_list->merge_vars );
240
- }
241
- }
242
 
243
- if( $refresh_cache || !$cached_lists ) {
244
  // make api request for lists
245
  $api = mc4wp_get_api();
246
  $lists = array();
@@ -277,11 +308,11 @@ class MC4WP_Lite_Admin
277
  }
278
 
279
  // cache renewal triggered manually?
280
- if( isset( $_POST['renew-cached-data'] ) ) {
281
- if( $lists ) {
282
- add_settings_error( "mc4wp", "cache-renewed", 'Renewed MailChimp cache.', 'updated' );
283
  } else {
284
- add_settings_error( "mc4wp", "cache-renew-failed", 'Failed to renew MailChimp cache - please try again later.' );
285
  }
286
  }
287
 
8
 
9
  class MC4WP_Lite_Admin
10
  {
11
+
12
+ /**
13
+ * @var bool True if the BWS Captcha plugin is activated.
14
+ */
15
+ private $has_captcha_plugin = false;
16
+
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->plugin_file = plugin_basename( MC4WP_LITE_PLUGIN_FILE );
 
 
 
 
 
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
+ add_filter( 'plugin_action_links', array( $this, 'add_plugin_settings_link' ), 10, 2 );
31
+ add_filter( 'plugin_row_meta', array( $this, 'add_plugin_meta_links'), 10, 2 );
32
+ add_filter( 'quicktags_settings', array( $this, 'set_quicktags_buttons' ), 10, 2 );
 
33
 
34
+ // did the user click on upgrade to pro link?
35
+ if( isset( $_GET['page'] ) && $_GET['page'] == 'mc4wp-lite-upgrade' && false == headers_sent() ) {
36
+ header("Location: http://dannyvankooten.com/mailchimp-for-wordpress/#utm_source=lite-plugin&utm_medium=link&utm_campaign=menu-upgrade-link");
37
+ exit;
38
  }
39
+
40
  }
41
 
42
  /**
43
+ * Initializes various stuff used in WP Admin
44
+ *
45
+ * - Registers settings
46
+ * - Checks if the Captcha plugin is activated
47
+ * - Loads the plugin text domain
48
+ */
49
+ public function initialize() {
50
+
51
+ // register settings
52
+ register_setting( 'mc4wp_lite_settings', 'mc4wp_lite', array( $this, 'validate_settings' ) );
53
+ register_setting( 'mc4wp_lite_checkbox_settings', 'mc4wp_lite_checkbox');
54
+ register_setting( 'mc4wp_lite_form_settings', 'mc4wp_lite_form', array( $this, 'validate_form_settings' ) );
55
+
56
+ // load the plugin text domain
57
+ load_plugin_textdomain( 'mailchimp-for-wp', false, dirname( $this->plugin_file ) . '/languages/' );
58
+
59
+ // store whether this plugin has the BWS captcha plugin running (http://wordpress.org/plugins/captcha/)
60
+ $this->has_captcha_plugin = function_exists( 'cptch_display_captcha_custom' );
61
  }
62
 
63
  /**
64
+ * Set which Quicktag buttons should appear in the form mark-up editor
65
+ *
66
+ * @param array $settings
67
+ * @param string $editor_id
68
+ * @return array
69
+ */
70
+ public function set_quicktags_buttons( $settings, $editor_id = '' )
71
  {
72
  if( $editor_id !== 'mc4wpformmarkup' ) {
73
  return $settings;
74
  }
75
 
76
+ $settings['buttons'] = 'strong,em,link,img,ul,li,close';
77
 
78
  return $settings;
79
  }
83
  * @param array $links
84
  * @return array
85
  */
86
+ public function add_plugin_settings_link( $links, $file )
87
  {
88
+ if( $file !== $this->plugin_file ) {
89
+ return $links;
90
+ }
91
+
92
+ $settings_link = '<a href="admin.php?page=mc4wp-lite">'. __( 'Settings' ) . '</a>';
93
+ array_unshift( $links, $settings_link );
94
  return $links;
95
  }
96
 
97
  /**
98
+ * Adds meta links to the plugin in the WP Admin > Plugins screen
99
+ *
100
+ * @param array $links
101
+ * @param string $file
102
+ *
103
+ * @return array
104
+ */
105
+ public function add_plugin_meta_links( $links, $file ) {
106
+ if( $file !== $this->plugin_file ) {
107
+ return $links;
108
+ }
109
+
110
+ $links[] = '<a href="http://wordpress.org/plugins/mailchimp-for-wp/faq/">FAQ</a>';
111
+ $links[] = '<a href="http://dannyvankooten.com/mailchimp-for-wordpress/#utm_source=lite-plugin&utm_medium=link&utm_campaign=plugins-upgrade-link">' . __( 'Upgrade to Pro', 'mailchimp-for-wp' ) . '</a>';
112
+ return $links;
113
  }
114
 
115
  /**
150
  public function validate_form_settings( $settings ) {
151
 
152
  if( isset( $settings['markup'] ) ) {
 
153
  // strip form tags (to prevent people from adding them)
154
  $settings['markup'] = preg_replace( '/<\/?form(.|\s)*?>/i', '', $settings['markup'] );
 
155
  }
156
 
157
  return $settings;
162
  */
163
  public function load_css_and_js( $hook )
164
  {
165
+ // only load asset files on the MailChimp for WordPress settings pages
166
+ if( false === isset( $_GET['page'] ) || false === stristr( $_GET['page'], 'mc4wp-lite' ) ) {
167
  return;
168
  }
169
 
172
 
173
  // js
174
  wp_register_script( 'mc4wp-beautifyhtml', MC4WP_LITE_PLUGIN_URL . 'assets/js/beautify-html.js', array( 'jquery' ), MC4WP_LITE_VERSION, true );
175
+ wp_register_script( 'mc4wp-admin', MC4WP_LITE_PLUGIN_URL . 'assets/js/admin.js', array( 'jquery' ), MC4WP_LITE_VERSION, true );
176
+ wp_enqueue_script( array( 'jquery', 'mc4wp-beautifyhtml', 'mc4wp-admin' ) );
177
+ wp_localize_script( 'mc4wp-admin', 'mc4wp',
178
+ array(
179
+ 'has_captcha_plugin' => $this->has_captcha_plugin
180
+ )
181
+ );
182
  }
183
 
184
  /**
185
+ * Returns available checkbox integrations
186
+ *
187
+ * @return array
188
+ */
189
  public function get_checkbox_compatible_plugins()
190
  {
191
  $checkbox_plugins = array(
192
+ 'comment_form' => __( "Comment form", 'mailchimp-for-wp' ),
193
+ "registration_form" => __( "Registration form", 'mailchimp-for-wp' )
194
  );
195
 
196
+ if( is_multisite() ) {
197
+ $checkbox_plugins['multisite_form'] = __( "MultiSite forms", 'mailchimp-for-wp' );
198
+ }
199
+
200
+ if( class_exists("BuddyPress") ) {
201
+ $checkbox_plugins['buddypress_form'] = __( "BuddyPress registration", 'mailchimp-for-wp' );
202
+ }
203
 
204
+ if( class_exists('bbPress') ) {
205
+ $checkbox_plugins['bbpress_forms'] = "bbPress";
206
+ }
207
+
208
+ if ( class_exists( 'Easy_Digital_Downloads' ) ) {
209
+ $checkbox_plugins['_edd_checkout'] = "(PRO ONLY) Easy Digital Downloads checkout";
210
+ }
211
+
212
+ if ( class_exists( 'Woocommerce' ) ) {
213
+ $checkbox_plugins['_woocommerce_checkout'] = "(PRO ONLY) WooCommerce checkout";
214
+ }
215
 
216
  return $checkbox_plugins;
217
  }
221
  */
222
  public function redirect_to_pro()
223
  {
224
+ ?><script type="text/javascript">window.location.replace('http://dannyvankooten.com/mailchimp-for-wordpress/#utm_source=lite-plugin&utm_medium=link&utm_campaign=menu-upgrade-link'); </script><?php
225
  }
226
 
227
  /**
231
  {
232
  $opts = mc4wp_get_options( 'general' );
233
  $tab = 'api-settings';
234
+ $connected = ( mc4wp_get_api()->is_connected() );
 
 
 
 
 
235
 
236
  $lists = $this->get_mailchimp_lists();
237
+ require MC4WP_LITE_PLUGIN_DIR . 'includes/views/api-settings.php';
238
  }
239
 
240
  /**
246
  $lists = $this->get_mailchimp_lists();
247
 
248
  $tab = 'checkbox-settings';
249
+ require MC4WP_LITE_PLUGIN_DIR . 'includes/views/checkbox-settings.php';
250
  }
251
 
252
  /**
257
  $opts = mc4wp_get_options( 'form' );
258
  $lists = $this->get_mailchimp_lists();
259
  $tab = 'form-settings';
260
+ require MC4WP_LITE_PLUGIN_DIR . 'includes/views/form-settings.php';
261
  }
262
 
263
  /**
269
  private function get_mailchimp_lists()
270
  {
271
  $cached_lists = get_transient( 'mc4wp_mailchimp_lists' );
272
+ $refresh_cache = ( isset( $_POST['mc4wp-renew-cache'] ) && $_POST['mc4wp-renew-cache'] == 1 );
 
 
 
 
 
 
 
 
 
 
273
 
274
+ if( true === $refresh_cache || false === $cached_lists || empty( $cached_lists ) ) {
275
  // make api request for lists
276
  $api = mc4wp_get_api();
277
  $lists = array();
308
  }
309
 
310
  // cache renewal triggered manually?
311
+ if( $refresh_cache ) {
312
+ if( false === empty( $lists ) ) {
313
+ add_settings_error( "mc4wp", "cache-renewed", __('MailChimp cache successfully renewed.', 'mailchimp-for-wp' ), 'updated' );
314
  } else {
315
+ add_settings_error( "mc4wp", "cache-renew-failed", __('Failed to renew MailChimp cache - please try again later.', 'mailchimp-for-wp' ) );
316
  }
317
  }
318
 
includes/class-api.php CHANGED
@@ -12,10 +12,25 @@ if( ! defined("MC4WP_LITE_VERSION") ) {
12
  * @uses WP_HTTP
13
  */
14
  class MC4WP_Lite_API {
15
-
 
 
 
16
  private $api_url = 'https://api.mailchimp.com/2.0/';
 
 
 
 
17
  private $api_key = '';
 
 
 
 
18
  private $error_message = '';
 
 
 
 
19
  private $connected = null;
20
 
21
  /**
@@ -53,7 +68,7 @@ class MC4WP_Lite_API {
53
  */
54
  public function is_connected()
55
  {
56
- if( $this->connected == null ) {
57
 
58
  $this->connected = false;
59
  $result = $this->call( 'helper/ping' );
@@ -61,7 +76,7 @@ class MC4WP_Lite_API {
61
  if( $result !== false ) {
62
  if( isset( $result->msg ) && $result->msg === "Everything's Chimpy!" ) {
63
  $this->connected = true;
64
- } else {
65
  $this->show_error( "MailChimp Error: " . $result->error );
66
  }
67
  }
@@ -233,18 +248,19 @@ class MC4WP_Lite_API {
233
  'sslverify' => false
234
  )
235
  );
236
-
 
237
  if( is_wp_error( $response ) ) {
238
-
239
  // show error message to admins
240
  $this->show_error( "HTTP Error: " . $response->get_error_message() );
241
-
242
  return false;
243
  }
244
 
245
- // dirty fix for older WP version
246
- if($method == 'helper/ping' && isset( $response['headers']['content-length'] ) && (int) $response['headers']['content-length'] == 44 ) {
247
- return (object) array( 'msg' => "Everything's Chimpy!");
 
 
248
  }
249
 
250
  $body = wp_remote_retrieve_body( $response );
12
  * @uses WP_HTTP
13
  */
14
  class MC4WP_Lite_API {
15
+
16
+ /**
17
+ * @var string
18
+ */
19
  private $api_url = 'https://api.mailchimp.com/2.0/';
20
+
21
+ /**
22
+ * @var string
23
+ */
24
  private $api_key = '';
25
+
26
+ /**
27
+ * @var string
28
+ */
29
  private $error_message = '';
30
+
31
+ /**
32
+ * @var boolean
33
+ */
34
  private $connected = null;
35
 
36
  /**
68
  */
69
  public function is_connected()
70
  {
71
+ if( $this->connected === null ) {
72
 
73
  $this->connected = false;
74
  $result = $this->call( 'helper/ping' );
76
  if( $result !== false ) {
77
  if( isset( $result->msg ) && $result->msg === "Everything's Chimpy!" ) {
78
  $this->connected = true;
79
+ } elseif( isset( $result->error ) ) {
80
  $this->show_error( "MailChimp Error: " . $result->error );
81
  }
82
  }
248
  'sslverify' => false
249
  )
250
  );
251
+
252
+ // test for wp errors
253
  if( is_wp_error( $response ) ) {
 
254
  // show error message to admins
255
  $this->show_error( "HTTP Error: " . $response->get_error_message() );
 
256
  return false;
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
+ );
264
  }
265
 
266
  $body = wp_remote_retrieve_body( $response );
includes/class-checkbox-manager.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if( ! defined("MC4WP_LITE_VERSION") ) {
4
+ header( 'Status: 403 Forbidden' );
5
+ header( 'HTTP/1.1 403 Forbidden' );
6
+ exit;
7
+ }
8
+
9
+ class MC4WP_Lite_Checkbox_Manager
10
+ {
11
+
12
+ /**
13
+ * Constructor
14
+ */
15
+ public function __construct()
16
+ {
17
+
18
+ $opts = mc4wp_get_options( 'checkbox' );
19
+
20
+ // load checkbox css if necessary
21
+ add_action( 'wp_enqueue_scripts', array( $this, 'load_stylesheet' ) );
22
+ add_action( 'login_enqueue_scripts', array( $this, 'load_stylesheet' ) );
23
+
24
+ // Load WP Comment Form Integration
25
+ if ( $opts['show_at_comment_form'] ) {
26
+ new MC4WP_Comment_Form_Integration();
27
+ }
28
+
29
+ // Load WordPress Registration Form Integration
30
+ if ( $opts['show_at_registration_form'] ) {
31
+ new MC4WP_Registration_Form_Integration();
32
+ }
33
+
34
+ // Load BuddyPress Integration
35
+ if ( $opts['show_at_buddypress_form'] ) {
36
+ new MC4WP_BuddyPress_Integration();
37
+ }
38
+
39
+ // Load MultiSite Integration
40
+ if ( $opts['show_at_multisite_form'] ) {
41
+ new MC4WP_MultiSite_Integration();
42
+ }
43
+
44
+ // Load bbPress Integration
45
+ if ( $opts['show_at_bbpress_forms'] ) {
46
+ new MC4WP_bbPress_Integration();
47
+ }
48
+
49
+ // Load CF7 Integration
50
+ if( function_exists( 'wpcf7_add_shortcode' ) ) {
51
+ new MC4WP_CF7_Integration();
52
+ }
53
+
54
+ // Always load General Integration
55
+ new MC4WP_General_Integration();
56
+
57
+ }
58
+
59
+ /**
60
+ * Loads the checkbox stylesheet
61
+ */
62
+ public function load_stylesheet( ) {
63
+
64
+ $opts = mc4wp_get_options('checkbox');
65
+
66
+ if( $opts['css'] == false ) {
67
+ return false;
68
+ }
69
+
70
+ wp_enqueue_style( 'mailchimp-for-wp-checkbox', MC4WP_LITE_PLUGIN_URL . 'assets/css/checkbox.css', array(), MC4WP_LITE_VERSION, 'all' );
71
+ return true;
72
+ }
73
+
74
+ }
includes/class-checkbox.php DELETED
@@ -1,523 +0,0 @@
1
- <?php
2
-
3
- if( ! defined("MC4WP_LITE_VERSION") ) {
4
- header( 'Status: 403 Forbidden' );
5
- header( 'HTTP/1.1 403 Forbidden' );
6
- exit;
7
- }
8
-
9
- class MC4WP_Lite_Checkbox
10
- {
11
- /**
12
- * @var boolean
13
- */
14
- private $showed_checkbox = false;
15
-
16
- /**
17
- * Constructor
18
- */
19
- public function __construct()
20
- {
21
- $opts = mc4wp_get_options('checkbox');
22
-
23
- add_action('init', array( $this, 'initialize' ) );
24
-
25
- // load checkbox css if necessary
26
- if ( $opts['css'] ) {
27
- add_filter( 'mc4wp_stylesheets', array( $this, 'add_stylesheet' ) );
28
- }
29
-
30
- /* Comment Form Actions */
31
- if($opts['show_at_comment_form']) {
32
- // hooks for checking if we should subscribe the commenter
33
- add_action('comment_post', array($this, 'subscribe_from_comment'), 20, 2);
34
-
35
- // hooks for outputting the checkbox
36
- add_action('thesis_hook_after_comment_box', array($this,'output_checkbox'), 20);
37
- add_action('comment_form', array($this,'output_checkbox'), 20);
38
- }
39
-
40
- /* Registration Form Actions */
41
- if($opts['show_at_registration_form']) {
42
- add_action('register_form',array($this, 'output_checkbox'),20);
43
- add_action('user_register',array($this, 'subscribe_from_registration'), 80, 1);
44
- }
45
-
46
- /* BuddyPress Form Actions */
47
- if($opts['show_at_buddypress_form']) {
48
- add_action('bp_before_registration_submit_buttons', array($this, 'output_checkbox'), 20);
49
- add_action('bp_complete_signup', array($this, 'subscribe_from_buddypress'), 20);
50
- }
51
-
52
- /* Multisite Form Actions */
53
- if($opts['show_at_multisite_form']) {
54
- add_action('signup_extra_fields', array($this, 'output_checkbox'), 20);
55
- add_action('signup_blogform', array($this, 'add_multisite_hidden_checkbox'), 20);
56
- add_action('wpmu_activate_blog', array($this, 'on_multisite_blog_signup'), 20, 5);
57
- add_action('wpmu_activate_user', array($this, 'on_multisite_user_signup'), 20, 3);
58
-
59
- add_filter('add_signup_meta', array($this, 'add_multisite_usermeta'));
60
- }
61
-
62
- /* bbPress actions */
63
- if($opts['show_at_bbpress_forms']) {
64
- add_action('bbp_theme_after_topic_form_subscriptions', array($this, 'output_checkbox'), 10);
65
- add_action('bbp_theme_after_reply_form_subscription', array($this, 'output_checkbox'), 10);
66
- add_action('bbp_theme_anonymous_form_extras_bottom', array($this, 'output_checkbox'), 10);
67
- add_action('bbp_new_topic', array($this, 'subscribe_from_bbpress_new_topic'), 10, 4);
68
- add_action('bbp_new_reply', array($this, 'subscribe_from_bbpress_new_reply'), 10, 5);
69
- }
70
-
71
- }
72
-
73
- public function initialize()
74
- {
75
- if( function_exists( "wpcf7_add_shortcode" ) ) {
76
- wpcf7_add_shortcode( 'mc4wp_checkbox', array( $this, 'get_checkbox') );
77
- add_action( 'wpcf7_posted_data', array( $this, 'alter_cf7_data') );
78
- add_action( 'wpcf7_mail_sent', array( $this, 'subscribe_from_cf7' ) );
79
- }
80
-
81
- // catch-all (for manual integrations with third-party forms)
82
- if( isset( $_POST['mc4wp-try-subscribe'] ) && $_POST['mc4wp-try-subscribe'] ) {
83
- $this->subscribe_from_whatever();
84
- }
85
- }
86
-
87
- public function get_checkbox( $args = array() )
88
- {
89
- $opts = mc4wp_get_options('checkbox');
90
-
91
- $label = isset( $args['labels'][0] ) ? $args['labels'][0] : $opts['label'];
92
- $checked = $opts['precheck'] ? "checked" : '';
93
-
94
- // CF7 checkbox?
95
- if( is_array( $args ) && isset( $args['type'] ) ) {
96
-
97
- // check for default:0 or default:1 to set the checked attribute
98
- if( in_array( 'default:1', $args['options'] ) ) {
99
- $checked = 'checked';
100
- } else if( in_array( 'default:0', $args['options'] ) ) {
101
- $checked = '';
102
- }
103
-
104
- }
105
-
106
- $content = "\n<!-- Checkbox by MailChimp for WordPress plugin v". MC4WP_LITE_VERSION ." - http://dannyvankooten.com/mailchimp-for-wordpress/ -->\n";
107
-
108
- do_action('mc4wp_before_checkbox');
109
-
110
- $content .= '<p id="mc4wp-checkbox">';
111
- $content .= '<label><input type="checkbox" name="mc4wp-do-subscribe" value="1" '. $checked . ' /> ' . __($label) . '</label>';
112
- $content .= '</p>';
113
-
114
- do_action('mc4wp_after_checkbox');
115
-
116
- $content .= "\n<!-- / MailChimp for WP Plugin -->\n";
117
- return $content;
118
- }
119
-
120
- /**
121
- * Outputs a sign-up checkbox
122
- */
123
- public function output_checkbox()
124
- {
125
- if( $this->showed_checkbox ) {
126
- return;
127
- }
128
-
129
- // echo the sign-up checkbox
130
- echo $this->get_checkbox();
131
-
132
- $this->showed_checkbox = true;
133
- }
134
-
135
- /**
136
- * Adds the checkbox stylesheet to the array
137
- * @param array $stylesheets
138
- * @return array
139
- */
140
- public function add_stylesheet( $stylesheets ) {
141
- $stylesheets['checkbox'] = 1;
142
- return $stylesheets;
143
- }
144
-
145
-
146
- /* Start comment form functions */
147
- public function subscribe_from_comment( $cid, $comment_approved = '' ) {
148
- if( ! isset( $_POST['mc4wp-do-subscribe'] ) || $_POST['mc4wp-do-subscribe'] != 1 ) {
149
- return false;
150
- }
151
-
152
- if( $comment_approved === 'spam' ) {
153
- return false;
154
- }
155
-
156
- $comment = get_comment( $cid );
157
-
158
- $email = $comment->comment_author_email;
159
- $merge_vars = array(
160
- 'OPTINIP' => $comment->comment_author_IP,
161
- 'NAME' => $comment->comment_author
162
- );
163
-
164
- return $this->subscribe( $email, $merge_vars );
165
- }
166
-
167
- public function add_comment_meta( $comment_id ) {
168
- add_comment_meta($comment_id, 'mc4wp_subscribe', $_POST['mc4wp-do-subscribe'], true );
169
- }
170
- /* End comment form functions */
171
-
172
- /* Start registration form functions */
173
- public function subscribe_from_registration( $user_id ) {
174
-
175
- if( ! isset( $_POST['mc4wp-do-subscribe'] ) || $_POST['mc4wp-do-subscribe'] != 1 ) {
176
- return false;
177
- }
178
-
179
- // gather emailadress from user who WordPress registered
180
- $user = get_userdata( $user_id );
181
- if( $user == false ) {
182
- return false;
183
- }
184
-
185
- $email = $user->user_email;
186
- $merge_vars = array(
187
- 'NAME' => $user->user_login
188
- );
189
-
190
- if( isset( $user->user_firstname ) && ! empty( $user->user_firstname ) ) {
191
- $merge_vars['FNAME'] = $user->user_firstname;
192
- }
193
-
194
- if( isset( $user->user_lastname ) && ! empty( $user->user_lastname ) ) {
195
- $merge_vars['LNAME'] = $user->user_lastname;
196
- }
197
-
198
- $result = $this->subscribe( $email, $merge_vars );
199
- }
200
- /* End registration form functions */
201
-
202
- /* Start BuddyPress functions */
203
- public function subscribe_from_buddypress()
204
- {
205
- if( ! isset( $_POST['mc4wp-do-subscribe'] ) || $_POST['mc4wp-do-subscribe'] != 1 ) {
206
- return false;
207
- }
208
-
209
- // gather emailadress and name from user who BuddyPress registered
210
- $email = $_POST['signup_email'];
211
- $merge_vars = array(
212
- 'NAME' => $_POST['signup_username']
213
- );
214
-
215
- return $this->subscribe( $email, $merge_vars );
216
- }
217
- /* End BuddyPress functions */
218
-
219
- /* Start Multisite functions */
220
- public function add_multisite_hidden_checkbox()
221
- {
222
- ?><input type="hidden" name="mc4wp-do-subscribe" value="<?php echo ( isset( $_POST['mc4wp-do-subscribe'] ) ) ? 1 : 0; ?>" /><?php
223
- }
224
-
225
- public function on_multisite_blog_signup( $blog_id, $user_id, $a, $b ,$meta = null )
226
- {
227
- if( ! isset($meta['mc4wp-do-subscribe'] ) || $meta['mc4wp-do-subscribe'] != 1) {
228
- return false;
229
- }
230
-
231
- return $this->subscribe_from_multisite($user_id);
232
- }
233
-
234
- public function on_multisite_user_signup($user_id, $password = NULL, $meta = NULL)
235
- {
236
- if( ! isset( $meta['mc4wp-do-subscribe'] ) || $meta['mc4wp-do-subscribe'] != 1 ) {
237
- return false;
238
- }
239
-
240
- return $this->subscribe_from_multisite($user_id);
241
- }
242
-
243
- /**
244
- * Adds the checked state of the sign-up checkbox to the $meta array of Multisite sign-ups
245
- *
246
- * @param array $meta
247
- * @return array
248
- */
249
- public function add_multisite_usermeta( $meta = array() )
250
- {
251
- $meta['mc4wp-do-subscribe'] = ( isset( $_POST['mc4wp-do-subscribe'] ) ) ? 1 : 0;
252
- return $meta;
253
- }
254
-
255
- /**
256
- * Subscribes from Multisite sign-ups
257
- * @param int $user_id
258
- */
259
- public function subscribe_from_multisite( $user_id )
260
- {
261
- $user = get_userdata( $user_id );
262
-
263
- if( ! is_object( $user ) ) {
264
- return false;
265
- }
266
-
267
- $email = $user->user_email;
268
- $merge_vars = array(
269
- 'NAME' => $user->first_name . ' ' . $user->last_name
270
- );
271
- $result = $this->subscribe( $email, $merge_vars );
272
- }
273
- /* End Multisite functions */
274
-
275
- /* Start Contact Form 7 functions */
276
-
277
- /**
278
- * Adds the checkbox state to CF7 email data
279
- * @param array $data
280
- * @return array
281
- */
282
- public function alter_cf7_data( $data = array() ) {
283
- $data['mc4wp_checkbox'] = ( isset( $_POST['mc4wp-do-subscribe'] ) && $_POST['mc4wp-do-subscribe'] == 1 ) ? __("Yes") : __("No");
284
- return $data;
285
- }
286
-
287
- /**
288
- * Subscribe from Contact Form 7 submissions
289
- * @param array $args (optional)
290
- */
291
- public function subscribe_from_cf7( $args = null )
292
- {
293
- // check if CF7 "mc4wp" checkbox was checked
294
- if( ! isset( $_POST['mc4wp-do-subscribe'] ) || ! $_POST['mc4wp-do-subscribe'] ) {
295
- return false;
296
- }
297
-
298
- $_POST['mc4wp-try-subscribe'] = 1;
299
- unset( $_POST['mc4wp-do-subscribe'] );
300
-
301
- return $this->subscribe_from_whatever();
302
- }
303
- /* End Contact Form 7 functions */
304
-
305
- /* Start whatever functions */
306
- public function subscribe_from_whatever()
307
- {
308
- if(! isset( $_POST['mc4wp-try-subscribe'] ) || ! $_POST['mc4wp-try-subs