Version Description
- Curl safe mode fix
Download this release
Release Info
Developer | mailerlite |
Plugin | Official MailerLite Sign Up Forms |
Version | 1.0.9 |
Comparing to | |
See all releases |
Code changes from version 1.0.8 to 1.0.9
- include/mailerlite-admin.php +89 -120
- libs/mailerlite_rest/base/ML_Rest_Base.php +4 -1
- mailerlite.php +2 -2
- readme.txt +5 -1
include/mailerlite-admin.php
CHANGED
@@ -21,15 +21,13 @@ class MailerLite_Admin
|
|
21 |
|
22 |
self::$api_key = get_option('mailerlite_api_key');
|
23 |
|
24 |
-
if ( ! self::$initiated)
|
25 |
-
{
|
26 |
self::init_hooks();
|
27 |
}
|
28 |
|
29 |
if (isset($_POST['action'])
|
30 |
&& $_POST['action'] == 'enter-mailerlite-key'
|
31 |
-
)
|
32 |
-
{
|
33 |
self::set_api_key();
|
34 |
}
|
35 |
}
|
@@ -44,16 +42,18 @@ class MailerLite_Admin
|
|
44 |
|
45 |
add_action(
|
46 |
'admin_init',
|
47 |
-
|
48 |
);
|
49 |
add_action(
|
50 |
-
'admin_menu',
|
51 |
-
|
|
|
|
|
52 |
);
|
53 |
|
54 |
wp_register_style(
|
55 |
'mailerlite.css',
|
56 |
-
MAILERLITE_PLUGIN_URL . '/assets/css/mailerlite.css',
|
57 |
MAILERLITE_VERSION
|
58 |
);
|
59 |
wp_enqueue_style('mailerlite.css');
|
@@ -73,13 +73,13 @@ class MailerLite_Admin
|
|
73 |
add_submenu_page(
|
74 |
'mailerlite_main', __('Forms', 'mailerlite'),
|
75 |
__('Signup forms', 'mailerlite'), 'manage_options',
|
76 |
-
'mailerlite_main',
|
77 |
);
|
78 |
add_submenu_page(
|
79 |
'mailerlite_main', __('Settings', 'mailerlite'),
|
80 |
__('Settings', 'mailerlite'), 'manage_options',
|
81 |
'mailerlite_settings',
|
82 |
-
|
83 |
);
|
84 |
}
|
85 |
|
@@ -95,10 +95,9 @@ class MailerLite_Admin
|
|
95 |
{
|
96 |
global $mailerlite_error;
|
97 |
|
98 |
-
if (self::$api_key == false)
|
99 |
-
{
|
100 |
include(MAILERLITE_PLUGIN_DIR
|
101 |
-
|
102 |
exit;
|
103 |
}
|
104 |
|
@@ -118,20 +117,15 @@ class MailerLite_Admin
|
|
118 |
$result = '';
|
119 |
|
120 |
//Create new signup form view
|
121 |
-
if (isset($_GET['view']) && $_GET['view'] == 'create')
|
122 |
-
|
123 |
-
if (isset($_POST['create_signup_form']))
|
124 |
-
{
|
125 |
self::create_new_form($_POST);
|
126 |
wp_redirect(
|
127 |
'admin.php?page=mailerlite_main&view=edit&id='
|
128 |
. $wpdb->insert_id
|
129 |
);
|
130 |
-
}
|
131 |
-
|
132 |
-
{
|
133 |
-
if (isset($_GET['noheader']))
|
134 |
-
{
|
135 |
require_once(ABSPATH . 'wp-admin/admin-header.php');
|
136 |
}
|
137 |
}
|
@@ -141,16 +135,14 @@ class MailerLite_Admin
|
|
141 |
$webforms = json_decode($webforms);
|
142 |
|
143 |
include(MAILERLITE_PLUGIN_DIR
|
144 |
-
|
145 |
|
146 |
|
147 |
-
}
|
148 |
-
//Edit signup form view
|
149 |
else if (isset($_GET['view']) && isset($_GET['id'])
|
150 |
-
|
151 |
-
|
152 |
-
)
|
153 |
-
{
|
154 |
$form_id = absint($_GET['id']);
|
155 |
|
156 |
$form = $wpdb->get_row(
|
@@ -158,12 +150,10 @@ class MailerLite_Admin
|
|
158 |
. "mailerlite_forms WHERE id = " . $form_id
|
159 |
);
|
160 |
|
161 |
-
if (isset($form->data))
|
162 |
-
{
|
163 |
$form->data = unserialize($form->data);
|
164 |
|
165 |
-
if ($form->type == 1)
|
166 |
-
{
|
167 |
add_filter(
|
168 |
'wp_default_editor',
|
169 |
create_function('', 'return "tinymce";')
|
@@ -174,88 +164,84 @@ class MailerLite_Admin
|
|
174 |
$lists = json_decode($lists);
|
175 |
|
176 |
$fields = $ML_Lists->setId($lists->Results[0]->id)
|
177 |
-
|
178 |
$fields = json_decode($fields);
|
179 |
|
180 |
-
if (isset($_POST['save_custom_signup_form']))
|
181 |
-
{
|
182 |
$form_name = isset($_POST['form_name'])
|
183 |
-
|
184 |
? sanitize_text_field($_POST['form_name'])
|
185 |
: __(
|
186 |
'Subscribe for newsletter!', 'mailerlite'
|
187 |
);
|
188 |
$form_title = isset($_POST['form_title'])
|
189 |
-
|
190 |
? sanitize_text_field($_POST['form_title'])
|
191 |
: __(
|
192 |
'Newsletter signup', 'mailerlite'
|
193 |
);
|
194 |
$form_description = isset($_POST['form_description'])
|
195 |
-
|
196 |
? $_POST['form_description']
|
197 |
: __(
|
198 |
'Just simple MailerLite form!', 'mailerlite'
|
199 |
);
|
200 |
$button_name = isset($_POST['button_name'])
|
201 |
-
|
202 |
? sanitize_text_field($_POST['button_name'])
|
203 |
: __(
|
204 |
'Subscribe', 'mailerlite'
|
205 |
);
|
206 |
|
207 |
$selected_fields = isset($_POST['form_selected_field'])
|
208 |
-
|
209 |
$_POST['form_selected_field']
|
210 |
-
) ? $_POST['form_selected_field'] :
|
211 |
$field_titles = isset($_POST['form_field'])
|
212 |
-
|
213 |
$_POST['form_field']
|
214 |
-
) ? $_POST['form_field'] :
|
215 |
|
216 |
if ( ! isset($field_titles['email'])
|
217 |
-
|
218 |
-
)
|
219 |
-
{
|
220 |
$field_titles['email'] = __('Email', 'mailerlite');
|
221 |
}
|
222 |
|
223 |
$form_lists = isset($_POST['form_lists'])
|
224 |
-
|
225 |
$_POST['form_lists']
|
226 |
-
) ? $_POST['form_lists'] :
|
227 |
|
228 |
-
$prepared_fields =
|
229 |
|
230 |
//Force to use email
|
231 |
$prepared_fields['email'] = $field_titles['email'];
|
232 |
|
233 |
-
foreach ($selected_fields as $field)
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
$prepared_fields[ $field ]
|
238 |
-
= $field_titles[ $field ];
|
239 |
}
|
240 |
}
|
241 |
|
242 |
-
$form_data =
|
243 |
'title' => $form_title,
|
244 |
'description' => wpautop($form_description, true),
|
245 |
'button' => $button_name,
|
246 |
'lists' => $form_lists,
|
247 |
'fields' => $prepared_fields
|
248 |
-
|
249 |
|
250 |
$wpdb->update(
|
251 |
$wpdb->prefix . 'mailerlite_forms',
|
252 |
-
|
253 |
'name' => $form_name,
|
254 |
'data' => serialize($form_data)
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
);
|
260 |
|
261 |
$form->data = $form_data;
|
@@ -264,47 +250,43 @@ class MailerLite_Admin
|
|
264 |
}
|
265 |
|
266 |
include(MAILERLITE_PLUGIN_DIR
|
267 |
-
|
268 |
-
}
|
269 |
-
else if ($form->type == 2)
|
270 |
-
{
|
271 |
$ML_Webforms = new ML_Webforms($api_key);
|
272 |
$webforms = $ML_Webforms->getAll();
|
273 |
$webforms = json_decode($webforms);
|
274 |
|
275 |
-
$parsed_webforms =
|
276 |
|
277 |
-
foreach ($webforms->Results as $webform)
|
278 |
-
|
279 |
-
$parsed_webforms[ $webform->id ] = $webform->code;
|
280 |
}
|
281 |
|
282 |
-
if (isset($_POST['save_embedded_signup_form']))
|
283 |
-
{
|
284 |
$form_name = isset($_POST['form_name'])
|
285 |
-
|
286 |
? sanitize_text_field($_POST['form_name'])
|
287 |
: __(
|
288 |
'Embedded webform', 'mailerlite'
|
289 |
);
|
290 |
$form_webform_id = isset($_POST['form_webform_id'])
|
291 |
-
|
292 |
? $_POST['form_webform_id'] : 0;
|
293 |
|
294 |
-
$form_data =
|
295 |
'id' => $form_webform_id,
|
296 |
-
'code' => $parsed_webforms[
|
297 |
-
|
298 |
|
299 |
$wpdb->update(
|
300 |
$wpdb->prefix . 'mailerlite_forms',
|
301 |
-
|
302 |
'name' => $form_name,
|
303 |
'data' => serialize($form_data)
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
);
|
309 |
|
310 |
$form->data = $form_data;
|
@@ -313,34 +295,28 @@ class MailerLite_Admin
|
|
313 |
}
|
314 |
|
315 |
include(MAILERLITE_PLUGIN_DIR
|
316 |
-
|
317 |
}
|
318 |
-
}
|
319 |
-
else
|
320 |
-
{
|
321 |
$forms_data = $wpdb->get_results(
|
322 |
"SELECT * FROM " . $wpdb->prefix
|
323 |
. "mailerlite_forms ORDER BY time DESC"
|
324 |
);
|
325 |
|
326 |
include(MAILERLITE_PLUGIN_DIR
|
327 |
-
|
328 |
}
|
329 |
-
}
|
330 |
-
//Delete signup form view
|
331 |
else if (isset($_GET['view']) && isset($_GET['id'])
|
332 |
-
|
333 |
-
|
334 |
-
)
|
335 |
-
{
|
336 |
$wpdb->delete(
|
337 |
-
$wpdb->prefix . 'mailerlite_forms',
|
338 |
);
|
339 |
wp_redirect('admin.php?page=mailerlite_main');
|
340 |
-
}
|
341 |
-
|
342 |
-
else
|
343 |
-
{
|
344 |
$forms_data = $wpdb->get_results(
|
345 |
"SELECT * FROM " . $wpdb->prefix
|
346 |
. "mailerlite_forms ORDER BY time DESC"
|
@@ -375,8 +351,7 @@ class MailerLite_Admin
|
|
375 |
&& ! current_user_can(
|
376 |
'manage_options'
|
377 |
)
|
378 |
-
)
|
379 |
-
{
|
380 |
die(__('You not allowed to do that', 'mailerlite'));
|
381 |
}
|
382 |
|
@@ -386,12 +361,9 @@ class MailerLite_Admin
|
|
386 |
$ML_Lists->getAll();
|
387 |
$response = $ML_Lists->getResponseInfo();
|
388 |
|
389 |
-
if ($response['http_code'] == 401)
|
390 |
-
{
|
391 |
$mailerlite_error = __('Wrong MailerLite API key', 'mailerlite');
|
392 |
-
}
|
393 |
-
else
|
394 |
-
{
|
395 |
update_option('mailerlite_api_key', $key);
|
396 |
update_option('mailerlite_enabled', true);
|
397 |
self::$api_key = $key;
|
@@ -407,39 +379,36 @@ class MailerLite_Admin
|
|
407 |
{
|
408 |
global $wpdb;
|
409 |
|
410 |
-
$form_type = in_array($data['form_type'],
|
411 |
? $data['form_type'] : 1;
|
412 |
|
413 |
-
if ($form_type == 1)
|
414 |
-
{
|
415 |
$form_name = __('New custom signup form', 'mailerlite');
|
416 |
-
$form_data =
|
417 |
'title' => __('Newsletter signup', 'mailerlite'),
|
418 |
'description' => __(
|
419 |
'Just simple MailerLite form!', 'mailerlite'
|
420 |
),
|
421 |
'button' => __('Subscribe', 'mailerlite'),
|
422 |
-
'lists' =>
|
423 |
-
'fields' =>
|
424 |
-
|
425 |
-
}
|
426 |
-
else
|
427 |
-
{
|
428 |
$form_name = __('New embedded signup form', 'mailerlite');
|
429 |
-
$form_data =
|
430 |
'id' => 0,
|
431 |
'code' => 0
|
432 |
-
|
433 |
}
|
434 |
|
435 |
$wpdb->insert(
|
436 |
$wpdb->prefix . 'mailerlite_forms',
|
437 |
-
|
438 |
'name' => $form_name,
|
439 |
'time' => date('Y-m-d h:i:s'),
|
440 |
'type' => $form_type,
|
441 |
'data' => serialize($form_data)
|
442 |
-
|
443 |
);
|
444 |
}
|
445 |
}
|
21 |
|
22 |
self::$api_key = get_option('mailerlite_api_key');
|
23 |
|
24 |
+
if ( ! self::$initiated) {
|
|
|
25 |
self::init_hooks();
|
26 |
}
|
27 |
|
28 |
if (isset($_POST['action'])
|
29 |
&& $_POST['action'] == 'enter-mailerlite-key'
|
30 |
+
) {
|
|
|
31 |
self::set_api_key();
|
32 |
}
|
33 |
}
|
42 |
|
43 |
add_action(
|
44 |
'admin_init',
|
45 |
+
['MailerLite_Admin', 'mailerlite_admin_init_setting']
|
46 |
);
|
47 |
add_action(
|
48 |
+
'admin_menu', [
|
49 |
+
'MailerLite_Admin',
|
50 |
+
'mailerlite_admin_generate_menu_link'
|
51 |
+
]
|
52 |
);
|
53 |
|
54 |
wp_register_style(
|
55 |
'mailerlite.css',
|
56 |
+
MAILERLITE_PLUGIN_URL . '/assets/css/mailerlite.css', [],
|
57 |
MAILERLITE_VERSION
|
58 |
);
|
59 |
wp_enqueue_style('mailerlite.css');
|
73 |
add_submenu_page(
|
74 |
'mailerlite_main', __('Forms', 'mailerlite'),
|
75 |
__('Signup forms', 'mailerlite'), 'manage_options',
|
76 |
+
'mailerlite_main', ['MailerLite_Admin', 'mailerlite_main']
|
77 |
);
|
78 |
add_submenu_page(
|
79 |
'mailerlite_main', __('Settings', 'mailerlite'),
|
80 |
__('Settings', 'mailerlite'), 'manage_options',
|
81 |
'mailerlite_settings',
|
82 |
+
['MailerLite_Admin', 'mailerlite_settings']
|
83 |
);
|
84 |
}
|
85 |
|
95 |
{
|
96 |
global $mailerlite_error;
|
97 |
|
98 |
+
if (self::$api_key == false) {
|
|
|
99 |
include(MAILERLITE_PLUGIN_DIR
|
100 |
+
. 'include/templates/admin/api_key.php');
|
101 |
exit;
|
102 |
}
|
103 |
|
117 |
$result = '';
|
118 |
|
119 |
//Create new signup form view
|
120 |
+
if (isset($_GET['view']) && $_GET['view'] == 'create') {
|
121 |
+
if (isset($_POST['create_signup_form'])) {
|
|
|
|
|
122 |
self::create_new_form($_POST);
|
123 |
wp_redirect(
|
124 |
'admin.php?page=mailerlite_main&view=edit&id='
|
125 |
. $wpdb->insert_id
|
126 |
);
|
127 |
+
} else {
|
128 |
+
if (isset($_GET['noheader'])) {
|
|
|
|
|
|
|
129 |
require_once(ABSPATH . 'wp-admin/admin-header.php');
|
130 |
}
|
131 |
}
|
135 |
$webforms = json_decode($webforms);
|
136 |
|
137 |
include(MAILERLITE_PLUGIN_DIR
|
138 |
+
. 'include/templates/admin/create.php');
|
139 |
|
140 |
|
141 |
+
} //Edit signup form view
|
|
|
142 |
else if (isset($_GET['view']) && isset($_GET['id'])
|
143 |
+
&& $_GET['view'] == 'edit'
|
144 |
+
&& absint($_GET['id'])
|
145 |
+
) {
|
|
|
146 |
$form_id = absint($_GET['id']);
|
147 |
|
148 |
$form = $wpdb->get_row(
|
150 |
. "mailerlite_forms WHERE id = " . $form_id
|
151 |
);
|
152 |
|
153 |
+
if (isset($form->data)) {
|
|
|
154 |
$form->data = unserialize($form->data);
|
155 |
|
156 |
+
if ($form->type == 1) {
|
|
|
157 |
add_filter(
|
158 |
'wp_default_editor',
|
159 |
create_function('', 'return "tinymce";')
|
164 |
$lists = json_decode($lists);
|
165 |
|
166 |
$fields = $ML_Lists->setId($lists->Results[0]->id)
|
167 |
+
->getFields();
|
168 |
$fields = json_decode($fields);
|
169 |
|
170 |
+
if (isset($_POST['save_custom_signup_form'])) {
|
|
|
171 |
$form_name = isset($_POST['form_name'])
|
172 |
+
&& $_POST['form_name'] != ''
|
173 |
? sanitize_text_field($_POST['form_name'])
|
174 |
: __(
|
175 |
'Subscribe for newsletter!', 'mailerlite'
|
176 |
);
|
177 |
$form_title = isset($_POST['form_title'])
|
178 |
+
&& $_POST['form_title'] != ''
|
179 |
? sanitize_text_field($_POST['form_title'])
|
180 |
: __(
|
181 |
'Newsletter signup', 'mailerlite'
|
182 |
);
|
183 |
$form_description = isset($_POST['form_description'])
|
184 |
+
&& $_POST['form_description'] != ''
|
185 |
? $_POST['form_description']
|
186 |
: __(
|
187 |
'Just simple MailerLite form!', 'mailerlite'
|
188 |
);
|
189 |
$button_name = isset($_POST['button_name'])
|
190 |
+
&& $_POST['button_name'] != ''
|
191 |
? sanitize_text_field($_POST['button_name'])
|
192 |
: __(
|
193 |
'Subscribe', 'mailerlite'
|
194 |
);
|
195 |
|
196 |
$selected_fields = isset($_POST['form_selected_field'])
|
197 |
+
&& is_array(
|
198 |
$_POST['form_selected_field']
|
199 |
+
) ? $_POST['form_selected_field'] : [];
|
200 |
$field_titles = isset($_POST['form_field'])
|
201 |
+
&& is_array(
|
202 |
$_POST['form_field']
|
203 |
+
) ? $_POST['form_field'] : [];
|
204 |
|
205 |
if ( ! isset($field_titles['email'])
|
206 |
+
|| $field_titles['email'] == ''
|
207 |
+
) {
|
|
|
208 |
$field_titles['email'] = __('Email', 'mailerlite');
|
209 |
}
|
210 |
|
211 |
$form_lists = isset($_POST['form_lists'])
|
212 |
+
&& is_array(
|
213 |
$_POST['form_lists']
|
214 |
+
) ? $_POST['form_lists'] : [];
|
215 |
|
216 |
+
$prepared_fields = [];
|
217 |
|
218 |
//Force to use email
|
219 |
$prepared_fields['email'] = $field_titles['email'];
|
220 |
|
221 |
+
foreach ($selected_fields as $field) {
|
222 |
+
if (isset($field_titles[$field])) {
|
223 |
+
$prepared_fields[$field]
|
224 |
+
= $field_titles[$field];
|
|
|
|
|
225 |
}
|
226 |
}
|
227 |
|
228 |
+
$form_data = [
|
229 |
'title' => $form_title,
|
230 |
'description' => wpautop($form_description, true),
|
231 |
'button' => $button_name,
|
232 |
'lists' => $form_lists,
|
233 |
'fields' => $prepared_fields
|
234 |
+
];
|
235 |
|
236 |
$wpdb->update(
|
237 |
$wpdb->prefix . 'mailerlite_forms',
|
238 |
+
[
|
239 |
'name' => $form_name,
|
240 |
'data' => serialize($form_data)
|
241 |
+
],
|
242 |
+
['id' => $form_id],
|
243 |
+
[],
|
244 |
+
['%d']
|
245 |
);
|
246 |
|
247 |
$form->data = $form_data;
|
250 |
}
|
251 |
|
252 |
include(MAILERLITE_PLUGIN_DIR
|
253 |
+
. 'include/templates/admin/edit_custom.php');
|
254 |
+
} else if ($form->type == 2) {
|
|
|
|
|
255 |
$ML_Webforms = new ML_Webforms($api_key);
|
256 |
$webforms = $ML_Webforms->getAll();
|
257 |
$webforms = json_decode($webforms);
|
258 |
|
259 |
+
$parsed_webforms = [];
|
260 |
|
261 |
+
foreach ($webforms->Results as $webform) {
|
262 |
+
$parsed_webforms[$webform->id] = $webform->code;
|
|
|
263 |
}
|
264 |
|
265 |
+
if (isset($_POST['save_embedded_signup_form'])) {
|
|
|
266 |
$form_name = isset($_POST['form_name'])
|
267 |
+
&& $_POST['form_name'] != ''
|
268 |
? sanitize_text_field($_POST['form_name'])
|
269 |
: __(
|
270 |
'Embedded webform', 'mailerlite'
|
271 |
);
|
272 |
$form_webform_id = isset($_POST['form_webform_id'])
|
273 |
+
&& isset($parsed_webforms[$_POST['form_webform_id']])
|
274 |
? $_POST['form_webform_id'] : 0;
|
275 |
|
276 |
+
$form_data = [
|
277 |
'id' => $form_webform_id,
|
278 |
+
'code' => $parsed_webforms[$form_webform_id]
|
279 |
+
];
|
280 |
|
281 |
$wpdb->update(
|
282 |
$wpdb->prefix . 'mailerlite_forms',
|
283 |
+
[
|
284 |
'name' => $form_name,
|
285 |
'data' => serialize($form_data)
|
286 |
+
],
|
287 |
+
['id' => $form_id],
|
288 |
+
[],
|
289 |
+
['%d']
|
290 |
);
|
291 |
|
292 |
$form->data = $form_data;
|
295 |
}
|
296 |
|
297 |
include(MAILERLITE_PLUGIN_DIR
|
298 |
+
. 'include/templates/admin/edit_embedded.php');
|
299 |
}
|
300 |
+
} else {
|
|
|
|
|
301 |
$forms_data = $wpdb->get_results(
|
302 |
"SELECT * FROM " . $wpdb->prefix
|
303 |
. "mailerlite_forms ORDER BY time DESC"
|
304 |
);
|
305 |
|
306 |
include(MAILERLITE_PLUGIN_DIR
|
307 |
+
. 'include/templates/admin/main.php');
|
308 |
}
|
309 |
+
} //Delete signup form view
|
|
|
310 |
else if (isset($_GET['view']) && isset($_GET['id'])
|
311 |
+
&& $_GET['view'] == 'delete'
|
312 |
+
&& absint($_GET['id'])
|
313 |
+
) {
|
|
|
314 |
$wpdb->delete(
|
315 |
+
$wpdb->prefix . 'mailerlite_forms', ['id' => $_GET['id']]
|
316 |
);
|
317 |
wp_redirect('admin.php?page=mailerlite_main');
|
318 |
+
} //Signup forms list
|
319 |
+
else {
|
|
|
|
|
320 |
$forms_data = $wpdb->get_results(
|
321 |
"SELECT * FROM " . $wpdb->prefix
|
322 |
. "mailerlite_forms ORDER BY time DESC"
|
351 |
&& ! current_user_can(
|
352 |
'manage_options'
|
353 |
)
|
354 |
+
) {
|
|
|
355 |
die(__('You not allowed to do that', 'mailerlite'));
|
356 |
}
|
357 |
|
361 |
$ML_Lists->getAll();
|
362 |
$response = $ML_Lists->getResponseInfo();
|
363 |
|
364 |
+
if ($response['http_code'] == 401) {
|
|
|
365 |
$mailerlite_error = __('Wrong MailerLite API key', 'mailerlite');
|
366 |
+
} else {
|
|
|
|
|
367 |
update_option('mailerlite_api_key', $key);
|
368 |
update_option('mailerlite_enabled', true);
|
369 |
self::$api_key = $key;
|
379 |
{
|
380 |
global $wpdb;
|
381 |
|
382 |
+
$form_type = in_array($data['form_type'], [1, 2])
|
383 |
? $data['form_type'] : 1;
|
384 |
|
385 |
+
if ($form_type == 1) {
|
|
|
386 |
$form_name = __('New custom signup form', 'mailerlite');
|
387 |
+
$form_data = [
|
388 |
'title' => __('Newsletter signup', 'mailerlite'),
|
389 |
'description' => __(
|
390 |
'Just simple MailerLite form!', 'mailerlite'
|
391 |
),
|
392 |
'button' => __('Subscribe', 'mailerlite'),
|
393 |
+
'lists' => [],
|
394 |
+
'fields' => ['email' => __('Email', 'mailerlite')]
|
395 |
+
];
|
396 |
+
} else {
|
|
|
|
|
397 |
$form_name = __('New embedded signup form', 'mailerlite');
|
398 |
+
$form_data = [
|
399 |
'id' => 0,
|
400 |
'code' => 0
|
401 |
+
];
|
402 |
}
|
403 |
|
404 |
$wpdb->insert(
|
405 |
$wpdb->prefix . 'mailerlite_forms',
|
406 |
+
[
|
407 |
'name' => $form_name,
|
408 |
'time' => date('Y-m-d h:i:s'),
|
409 |
'type' => $form_type,
|
410 |
'data' => serialize($form_data)
|
411 |
+
]
|
412 |
);
|
413 |
}
|
414 |
}
|
libs/mailerlite_rest/base/ML_Rest_Base.php
CHANGED
@@ -157,7 +157,10 @@ class ML_Rest_Base
|
|
157 |
|
158 |
curl_setopt($curlHandle, CURLOPT_SSL_VERIFYHOST, false );
|
159 |
curl_setopt($curlHandle, CURLOPT_SSL_VERIFYPEER, false );
|
160 |
-
|
|
|
|
|
|
|
161 |
}
|
162 |
|
163 |
protected function setAuth (&$curlHandle)
|
157 |
|
158 |
curl_setopt($curlHandle, CURLOPT_SSL_VERIFYHOST, false );
|
159 |
curl_setopt($curlHandle, CURLOPT_SSL_VERIFYPEER, false );
|
160 |
+
if (!ini_get('open_basedir') && !ini_get('safe_mode'))
|
161 |
+
{
|
162 |
+
url_setopt($curlHandle, CURLOPT_FOLLOWLOCATION, true );
|
163 |
+
}
|
164 |
}
|
165 |
|
166 |
protected function setAuth (&$curlHandle)
|
mailerlite.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin Name: Official MailerLite Sign Up Forms
|
5 |
* Description: Official MailerLite Sign Up Forms plugin for WordPress. Ability
|
6 |
* to embed MailerLite webforms and create custom ones just with few clicks.
|
7 |
-
* Version: 1.0.
|
8 |
* Author: MailerGroup
|
9 |
* Author URI: https://www.mailerlite.com
|
10 |
* License: GPLv2 or later
|
@@ -28,7 +28,7 @@
|
|
28 |
define('MAILERLITE_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
29 |
define('MAILERLITE_PLUGIN_URL', plugins_url('', __FILE__));
|
30 |
|
31 |
-
define('MAILERLITE_VERSION', '1.0.
|
32 |
|
33 |
function mailerlite_load_plugin_textdomain()
|
34 |
{
|
4 |
* Plugin Name: Official MailerLite Sign Up Forms
|
5 |
* Description: Official MailerLite Sign Up Forms plugin for WordPress. Ability
|
6 |
* to embed MailerLite webforms and create custom ones just with few clicks.
|
7 |
+
* Version: 1.0.9
|
8 |
* Author: MailerGroup
|
9 |
* Author URI: https://www.mailerlite.com
|
10 |
* License: GPLv2 or later
|
28 |
define('MAILERLITE_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
29 |
define('MAILERLITE_PLUGIN_URL', plugins_url('', __FILE__));
|
30 |
|
31 |
+
define('MAILERLITE_VERSION', '1.0.9');
|
32 |
|
33 |
function mailerlite_load_plugin_textdomain()
|
34 |
{
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.mailerlite.com/
|
|
4 |
Tags: mailerlite, newsletter, subscribe, form, webform
|
5 |
Requires at least: 3.0.1
|
6 |
Tested up to: 4.1
|
7 |
-
Stable tag: 1.0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -127,6 +127,8 @@ Add your custom CSS rules to the end of your theme stylesheet, /wp-content/theme
|
|
127 |
|
128 |
== Changelog ==
|
129 |
|
|
|
|
|
130 |
= 1.0.8 =
|
131 |
* Fix shortcode popup
|
132 |
= 1.0.7 =
|
@@ -148,6 +150,8 @@ Add your custom CSS rules to the end of your theme stylesheet, /wp-content/theme
|
|
148 |
|
149 |
== Upgrade Notice ==
|
150 |
|
|
|
|
|
151 |
= 1.0.8 =
|
152 |
* Fix shortcode popup
|
153 |
= 1.0.7 =
|
4 |
Tags: mailerlite, newsletter, subscribe, form, webform
|
5 |
Requires at least: 3.0.1
|
6 |
Tested up to: 4.1
|
7 |
+
Stable tag: 1.0.9
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
127 |
|
128 |
== Changelog ==
|
129 |
|
130 |
+
= 1.0.9 =
|
131 |
+
* Curl safe mode fix
|
132 |
= 1.0.8 =
|
133 |
* Fix shortcode popup
|
134 |
= 1.0.7 =
|
150 |
|
151 |
== Upgrade Notice ==
|
152 |
|
153 |
+
= 1.0.9 =
|
154 |
+
* Curl safe mode fix
|
155 |
= 1.0.8 =
|
156 |
* Fix shortcode popup
|
157 |
= 1.0.7 =
|