Version Description
- Fix - wp_nonce for cached pages
Download this release
Release Info
Developer | mailerlite |
Plugin | Official MailerLite Sign Up Forms |
Version | 1.5.5 |
Comparing to | |
See all releases |
Code changes from version 1.5.4 to 1.5.5
- mailerlite.php +2 -2
- readme.txt +4 -1
- src/Helper.php +15 -0
- src/Modules/Form.php +9 -0
- src/Views/CustomForm.php +10 -0
mailerlite.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Plugin Name: MailerLite - Signup forms (official)
|
4 |
* Description: Official MailerLite Signup forms plugin for WordPress. Ability to embed MailerLite webforms and create custom ones just with few clicks.
|
5 |
-
* Version: 1.5.
|
6 |
* Author: MailerLite
|
7 |
* Author URI: https://www.mailerlite.com
|
8 |
* License: GPLv2 or later
|
@@ -33,7 +33,7 @@ define( 'MAILERLITE_PLUGIN_URL', plugins_url( '', __FILE__ ) );
|
|
33 |
// Plugin basename
|
34 |
define( 'MAILERLITE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
35 |
|
36 |
-
define( 'MAILERLITE_VERSION', '1.5.
|
37 |
|
38 |
define( 'MAILERLITE_PHP_VERSION', '7.2.5' );
|
39 |
define( 'MAILERLITE_WP_VERSION', '3.0.1' );
|
2 |
/**
|
3 |
* Plugin Name: MailerLite - Signup forms (official)
|
4 |
* Description: Official MailerLite Signup forms plugin for WordPress. Ability to embed MailerLite webforms and create custom ones just with few clicks.
|
5 |
+
* Version: 1.5.5
|
6 |
* Author: MailerLite
|
7 |
* Author URI: https://www.mailerlite.com
|
8 |
* License: GPLv2 or later
|
33 |
// Plugin basename
|
34 |
define( 'MAILERLITE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
35 |
|
36 |
+
define( 'MAILERLITE_VERSION', '1.5.5' );
|
37 |
|
38 |
define( 'MAILERLITE_PHP_VERSION', '7.2.5' );
|
39 |
define( 'MAILERLITE_WP_VERSION', '3.0.1' );
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: mailerlite, newsletter, subscribe, form, webform
|
|
5 |
Requires at least: 3.0.1
|
6 |
Tested up to: 5.9.3
|
7 |
Requires PHP: 7.2.5
|
8 |
-
Stable tag: 1.5.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -130,6 +130,9 @@ Add your custom CSS rules to the end of your theme stylesheet, /wp-content/theme
|
|
130 |
|
131 |
== Changelog ==
|
132 |
|
|
|
|
|
|
|
133 |
= 1.5.4 =
|
134 |
* Fix - Input validation
|
135 |
* Tested up to latest WP version
|
5 |
Requires at least: 3.0.1
|
6 |
Tested up to: 5.9.3
|
7 |
Requires PHP: 7.2.5
|
8 |
+
Stable tag: 1.5.5
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
130 |
|
131 |
== Changelog ==
|
132 |
|
133 |
+
= 1.5.5 =
|
134 |
+
* Fix - wp_nonce for cached pages
|
135 |
+
|
136 |
= 1.5.4 =
|
137 |
* Fix - Input validation
|
138 |
* Tested up to latest WP version
|
src/Helper.php
CHANGED
@@ -168,5 +168,20 @@ class Helper
|
|
168 |
|
169 |
return $default;
|
170 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
|
172 |
}
|
168 |
|
169 |
return $default;
|
170 |
}
|
171 |
+
|
172 |
+
/**
|
173 |
+
* Helper to create a unique nonce
|
174 |
+
*
|
175 |
+
* @return string
|
176 |
+
*/
|
177 |
+
public static function create_nonce() {
|
178 |
+
|
179 |
+
if ( isset($_POST['ml_nonce']) ) {
|
180 |
+
|
181 |
+
wp_send_json_success( [
|
182 |
+
'ml_nonce' => wp_create_nonce('mailerlite_form')
|
183 |
+
] );
|
184 |
+
}
|
185 |
+
}
|
186 |
|
187 |
}
|
src/Modules/Form.php
CHANGED
@@ -52,6 +52,15 @@ class Form
|
|
52 |
[ '\MailerLiteForms\Modules\Form', 'save_form_data' ]
|
53 |
);
|
54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
}
|
56 |
|
57 |
/**
|
52 |
[ '\MailerLiteForms\Modules\Form', 'save_form_data' ]
|
53 |
);
|
54 |
|
55 |
+
add_action(
|
56 |
+
'wp_ajax_ml_create_nonce',
|
57 |
+
[ 'MailerLiteForms\Helper', 'create_nonce' ]
|
58 |
+
);
|
59 |
+
|
60 |
+
add_action(
|
61 |
+
'wp_ajax_nopriv_ml_create_nonce',
|
62 |
+
[ 'MailerLiteForms\Helper', 'create_nonce' ]
|
63 |
+
);
|
64 |
}
|
65 |
|
66 |
/**
|
src/Views/CustomForm.php
CHANGED
@@ -97,6 +97,16 @@ class CustomForm
|
|
97 |
if(jQuery) {
|
98 |
var form_container = jQuery("#mailerlite-form_<?php echo $form_id; ?>[data-temp-id=<?php echo $unique_id; ?>] form");
|
99 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
if ( typeof form_container.validate == 'function' ) {
|
101 |
form_container.submit(function (e) {
|
102 |
e.preventDefault();
|
97 |
if(jQuery) {
|
98 |
var form_container = jQuery("#mailerlite-form_<?php echo $form_id; ?>[data-temp-id=<?php echo $unique_id; ?>] form");
|
99 |
|
100 |
+
jQuery(".mailerlite-subscribe-submit", form_container).prop('disabled', true);
|
101 |
+
|
102 |
+
jQuery.post('<?php echo admin_url('admin-ajax.php'); ?>', { "action" : "ml_create_nonce", "ml_nonce" : jQuery("input[name='ml_nonce']", form_container).val() }, function (response) {
|
103 |
+
|
104 |
+
if(response.success) {
|
105 |
+
jQuery("input[name='ml_nonce']", form_container).val(response.data.ml_nonce);
|
106 |
+
jQuery(".mailerlite-subscribe-submit", form_container).prop('disabled', false);
|
107 |
+
}
|
108 |
+
});
|
109 |
+
|
110 |
if ( typeof form_container.validate == 'function' ) {
|
111 |
form_container.submit(function (e) {
|
112 |
e.preventDefault();
|