Version Description
- Fix MailChimp Double Opt-In issue
Download this release
Release Info
Developer | techjewel |
Plugin | Contact Form Plugin – Fastest Contact Form Builder Plugin for WordPress by Fluent Forms |
Version | 1.1.2 |
Comparing to | |
See all releases |
Code changes from version 1.1.1 to 1.1.2
- app/Hooks/Backend.php +21 -4
- app/Modules/Activator.php +1 -1
- app/Modules/Component/Component.php +10 -10
- app/Modules/Form/FormHandler.php +2 -1
- app/Modules/Integration/MailChimpIntegration.php +166 -161
- app/Modules/Integration/MailChimpSubscriber.php +83 -0
- app/Modules/Registerer/Menu.php +1 -1
- fluentform.php +3 -1
- public/js/form-submission.js +1 -1
- readme.txt +4 -1
- resources/views/admin/form/editor.php +1 -1
app/Hooks/Backend.php
CHANGED
@@ -26,10 +26,27 @@ $app->addfilter('fluentform_response_render_select', function ($response) {
|
|
26 |
}, 10, 1);
|
27 |
|
28 |
$app->addfilter('fluentform_response_render_input_name', function ($response) {
|
29 |
-
|
30 |
}, 10, 1);
|
31 |
|
32 |
// On form submission register slack notifier
|
33 |
-
|
34 |
-
|
35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
}, 10, 1);
|
27 |
|
28 |
$app->addfilter('fluentform_response_render_input_name', function ($response) {
|
29 |
+
return \FluentForm\App\Services\FormResponseParser::transformNameField($response);
|
30 |
}, 10, 1);
|
31 |
|
32 |
// On form submission register slack notifier
|
33 |
+
use FluentForm\App\Services\Slack;
|
34 |
+
|
35 |
+
$app->addAction(
|
36 |
+
'fluentform_submission_inserted',
|
37 |
+
function ($submissionId, $formData, $form) {
|
38 |
+
Slack::notify($submissionId, $formData, $form);
|
39 |
+
},
|
40 |
+
10, 3
|
41 |
+
);
|
42 |
+
|
43 |
+
// On form submission register MailChimp subscriber.
|
44 |
+
use FluentForm\App\Modules\Integration\MailChimpIntegration as MailChimp;
|
45 |
+
|
46 |
+
$app->addAction(
|
47 |
+
'fluentform_submission_inserted',
|
48 |
+
function ($submissionId, $formData, $form) use ($app) {
|
49 |
+
(new MailChimp($app))->subscribe($formData);
|
50 |
+
},
|
51 |
+
10, 3
|
52 |
+
);
|
app/Modules/Activator.php
CHANGED
@@ -39,6 +39,6 @@ class Activator
|
|
39 |
|
40 |
private function setCurrentVersion()
|
41 |
{
|
42 |
-
update_option('_fluentform_installed_version', '1.1.
|
43 |
}
|
44 |
}
|
39 |
|
40 |
private function setCurrentVersion()
|
41 |
{
|
42 |
+
update_option('_fluentform_installed_version', '1.1.2');
|
43 |
}
|
44 |
}
|
app/Modules/Component/Component.php
CHANGED
@@ -58,6 +58,7 @@ class Component
|
|
58 |
private function getDisabledComponents()
|
59 |
{
|
60 |
$isReCaptchaDisabled = !get_option('_fluentform_reCaptcha_keys_status', false);
|
|
|
61 |
$disabled = array(
|
62 |
'recaptcha' => array(
|
63 |
'contentComponent' => 'recaptcha',
|
@@ -86,7 +87,7 @@ class Component
|
|
86 |
)
|
87 |
);
|
88 |
|
89 |
-
return $disabled;
|
90 |
}
|
91 |
|
92 |
/**
|
@@ -131,14 +132,14 @@ class Component
|
|
131 |
}
|
132 |
|
133 |
$form->settings = json_decode($formSettings->value, true);
|
134 |
-
$form =
|
135 |
|
136 |
$isRenderable = array(
|
137 |
'status' => true,
|
138 |
'message' => ''
|
139 |
);
|
140 |
|
141 |
-
$isRenderable =
|
142 |
|
143 |
if(is_array($isRenderable) && !$isRenderable['status']) {
|
144 |
return "<div id='ff_form_{$form->id}' class='ff_form_not_render'>{$isRenderable['message']}</div>";
|
@@ -169,7 +170,7 @@ class Component
|
|
169 |
'id' => $form->id,
|
170 |
'settings' => $form->settings,
|
171 |
'rules' => $formBuilder->validationRules,
|
172 |
-
'do_analytics' =>
|
173 |
);
|
174 |
|
175 |
if ($conditionals = $formBuilder->conditions) {
|
@@ -184,14 +185,13 @@ class Component
|
|
184 |
$form_vars['conditionals'] = $conditionals;
|
185 |
}
|
186 |
|
187 |
-
|
188 |
-
$this->addInlineVars(json_encode($form_vars), $form->id);
|
189 |
-
|
190 |
wp_localize_script('fluent-form-submission', 'fluentFormVars', array(
|
191 |
'ajaxUrl' => admin_url('admin-ajax.php'),
|
192 |
'forms' => (Object) array()
|
193 |
));
|
194 |
|
|
|
|
|
195 |
return $output;
|
196 |
}
|
197 |
});
|
@@ -418,7 +418,7 @@ class Component
|
|
418 |
* @return void
|
419 |
*/
|
420 |
private function addInlineVars($vars, $form_id) {
|
421 |
-
if (
|
422 |
wp_add_inline_script(
|
423 |
'fluent-form-submission',
|
424 |
'window.fluentFormVars.forms["fluentform_'.$form_id.'"] = '.$vars.';'
|
@@ -539,7 +539,7 @@ class Component
|
|
539 |
continue;
|
540 |
}
|
541 |
|
542 |
-
$formattedProperties['inputs.'.$formProperty] =
|
543 |
'fluentform_response_render_'.$field['element'],
|
544 |
$data[$formProperty],
|
545 |
$field,
|
@@ -599,7 +599,7 @@ class Component
|
|
599 |
continue;
|
600 |
}
|
601 |
|
602 |
-
$formattedProperties[$other] =
|
603 |
'fluentform_other_shortcodes_'.$other, $other, $data, $form
|
604 |
);
|
605 |
}
|
58 |
private function getDisabledComponents()
|
59 |
{
|
60 |
$isReCaptchaDisabled = !get_option('_fluentform_reCaptcha_keys_status', false);
|
61 |
+
|
62 |
$disabled = array(
|
63 |
'recaptcha' => array(
|
64 |
'contentComponent' => 'recaptcha',
|
87 |
)
|
88 |
);
|
89 |
|
90 |
+
return $this->app->applyFilters('disabled_components', $disabled);
|
91 |
}
|
92 |
|
93 |
/**
|
132 |
}
|
133 |
|
134 |
$form->settings = json_decode($formSettings->value, true);
|
135 |
+
$form = $this->app->applyFilters('fluentform_rendering_form', $form);
|
136 |
|
137 |
$isRenderable = array(
|
138 |
'status' => true,
|
139 |
'message' => ''
|
140 |
);
|
141 |
|
142 |
+
$isRenderable = $this->app->applyFilters('fluentform_is_form_renderable', $isRenderable, $form);
|
143 |
|
144 |
if(is_array($isRenderable) && !$isRenderable['status']) {
|
145 |
return "<div id='ff_form_{$form->id}' class='ff_form_not_render'>{$isRenderable['message']}</div>";
|
170 |
'id' => $form->id,
|
171 |
'settings' => $form->settings,
|
172 |
'rules' => $formBuilder->validationRules,
|
173 |
+
'do_analytics' => $this->app->applyFilters('fluentform_do_analytics', true)
|
174 |
);
|
175 |
|
176 |
if ($conditionals = $formBuilder->conditions) {
|
185 |
$form_vars['conditionals'] = $conditionals;
|
186 |
}
|
187 |
|
|
|
|
|
|
|
188 |
wp_localize_script('fluent-form-submission', 'fluentFormVars', array(
|
189 |
'ajaxUrl' => admin_url('admin-ajax.php'),
|
190 |
'forms' => (Object) array()
|
191 |
));
|
192 |
|
193 |
+
$this->addInlineVars(json_encode($form_vars), $form->id);
|
194 |
+
|
195 |
return $output;
|
196 |
}
|
197 |
});
|
418 |
* @return void
|
419 |
*/
|
420 |
private function addInlineVars($vars, $form_id) {
|
421 |
+
if (function_exists('wp_add_inline_script')) {
|
422 |
wp_add_inline_script(
|
423 |
'fluent-form-submission',
|
424 |
'window.fluentFormVars.forms["fluentform_'.$form_id.'"] = '.$vars.';'
|
539 |
continue;
|
540 |
}
|
541 |
|
542 |
+
$formattedProperties['inputs.'.$formProperty] = $this->app->applyFilters(
|
543 |
'fluentform_response_render_'.$field['element'],
|
544 |
$data[$formProperty],
|
545 |
$field,
|
599 |
continue;
|
600 |
}
|
601 |
|
602 |
+
$formattedProperties[$other] = $this->app->applyFilters(
|
603 |
'fluentform_other_shortcodes_'.$other, $other, $data, $form
|
604 |
);
|
605 |
}
|
app/Modules/Form/FormHandler.php
CHANGED
@@ -65,7 +65,8 @@ class FormHandler
|
|
65 |
// Prepare the data to be inserted to the DB.
|
66 |
$insertData = $this->prepareInsertData($formId);
|
67 |
|
68 |
-
$insertId = wpFluent()->table('fluentform_submissions')->insert($insertData);
|
|
|
69 |
|
70 |
try {
|
71 |
$this->app->doAction('fluentform_submission_inserted', $insertId, $this->formData, $form);
|
65 |
// Prepare the data to be inserted to the DB.
|
66 |
$insertData = $this->prepareInsertData($formId);
|
67 |
|
68 |
+
// $insertId = wpFluent()->table('fluentform_submissions')->insert($insertData);
|
69 |
+
$insertId = 12;
|
70 |
|
71 |
try {
|
72 |
$this->app->doAction('fluentform_submission_inserted', $insertId, $this->formData, $form);
|
app/Modules/Integration/MailChimpIntegration.php
CHANGED
@@ -1,167 +1,172 @@
|
|
1 |
-
<?php
|
|
|
|
|
2 |
|
3 |
-
use FluentForm\App\Services\Integrations\MailChimp;
|
4 |
use FluentForm\Framework\Foundation\Application;
|
5 |
-
use
|
|
|
6 |
|
7 |
class MailChimpIntegration extends BaseIntegration
|
8 |
{
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
|
|
|
|
|
|
167 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace FluentForm\App\Modules\Integration;
|
4 |
|
|
|
5 |
use FluentForm\Framework\Foundation\Application;
|
6 |
+
use FluentForm\App\Services\Integrations\MailChimp;
|
7 |
+
use FluentForm\App\Modules\Integration\MailChimpSubscriber as Subscriber;
|
8 |
|
9 |
class MailChimpIntegration extends BaseIntegration
|
10 |
{
|
11 |
+
/**
|
12 |
+
* MailChimp Subscriber that handles & process all the subscribing logics.
|
13 |
+
*/
|
14 |
+
use Subscriber;
|
15 |
+
|
16 |
+
private $key = '_mailchimp_feeds';
|
17 |
+
|
18 |
+
private $app;
|
19 |
+
|
20 |
+
public function __construct(Application $application)
|
21 |
+
{
|
22 |
+
parent::__construct($this->key, $application->request->get('form_id', false), true);
|
23 |
+
$this->app = $application;
|
24 |
+
}
|
25 |
+
|
26 |
+
public function getMailChimpSettings()
|
27 |
+
{
|
28 |
+
$globalStatus = $this->isConfigured();
|
29 |
+
$integrations = $this->getAll();
|
30 |
+
|
31 |
+
wp_send_json_success(array(
|
32 |
+
'global_status' => $globalStatus,
|
33 |
+
'integrations' => $integrations,
|
34 |
+
'configure_url' => admin_url('admin.php?page=fluent_forms_settings#mailchimp')
|
35 |
+
), 200);
|
36 |
+
|
37 |
+
}
|
38 |
+
|
39 |
+
public function getMailChimpLists()
|
40 |
+
{
|
41 |
+
if (! $this->isConfigured()) {
|
42 |
+
wp_send_json_error(array(
|
43 |
+
'error' => __('MailChimp is not configured yet', 'fluentform')
|
44 |
+
), 400);
|
45 |
+
}
|
46 |
+
$settings = get_option('_fluentform_mailchimp_details');
|
47 |
+
|
48 |
+
try {
|
49 |
+
$MailChimp = new MailChimp($settings['apiKey']);
|
50 |
+
$lists = $MailChimp->get('lists', array('count' => 9999));
|
51 |
+
if (! $MailChimp->success()) {
|
52 |
+
throw new \Exception($MailChimp->getLastError());
|
53 |
+
}
|
54 |
+
} catch (\Exception $exception) {
|
55 |
+
wp_send_json_error(array(
|
56 |
+
'message' => $exception->getMessage()
|
57 |
+
), 400);
|
58 |
+
}
|
59 |
+
|
60 |
+
$formattedLists = array();
|
61 |
+
|
62 |
+
foreach ($lists['lists'] as $list) {
|
63 |
+
$formattedLists[$list['id']] = $list;
|
64 |
+
}
|
65 |
+
|
66 |
+
wp_send_json_success(array(
|
67 |
+
'lists' => $formattedLists
|
68 |
+
), 200);
|
69 |
+
|
70 |
+
}
|
71 |
+
|
72 |
+
public function getMailChimpList()
|
73 |
+
{
|
74 |
+
if (! $this->isConfigured()) {
|
75 |
+
wp_send_json_error(array(
|
76 |
+
'error' => __('MailChimp is not configured yet', 'fluentform')
|
77 |
+
), 400);
|
78 |
+
}
|
79 |
+
$settings = get_option('_fluentform_mailchimp_details');
|
80 |
+
$list_id = $this->app->request->get('listId');
|
81 |
+
|
82 |
+
try {
|
83 |
+
$MailChimp = new MailChimp($settings['apiKey']);
|
84 |
+
$list = $MailChimp->get('lists/'.$list_id.'/merge-fields', array('count' => 9999));
|
85 |
+
if (! $MailChimp->success()) {
|
86 |
+
throw new \Exception($MailChimp->getLastError());
|
87 |
+
}
|
88 |
+
} catch (\Exception $exception) {
|
89 |
+
wp_send_json_error(array(
|
90 |
+
'message' => $exception->getMessage()
|
91 |
+
), 400);
|
92 |
+
}
|
93 |
+
|
94 |
+
$mergedFields = $list['merge_fields'];
|
95 |
+
$fields = array();
|
96 |
+
|
97 |
+
foreach ($mergedFields as $merged_field) {
|
98 |
+
$fields[$merged_field['tag']] = $merged_field['name'];
|
99 |
+
}
|
100 |
+
|
101 |
+
wp_send_json_success(array(
|
102 |
+
'merge_fields' => $fields
|
103 |
+
), 200);
|
104 |
+
}
|
105 |
+
|
106 |
+
public function saveNotification()
|
107 |
+
{
|
108 |
+
if (! $this->isConfigured()) {
|
109 |
+
wp_send_json_error(array(
|
110 |
+
'error' => __('MailChimp is not configured yet', 'fluentform')
|
111 |
+
), 400);
|
112 |
+
}
|
113 |
+
$notification = $this->app->request->get('notification');
|
114 |
+
$notification_id = $this->app->request->get('notification_id');
|
115 |
+
$notification = json_decode($notification, true);
|
116 |
+
|
117 |
+
// validate notification now
|
118 |
+
$this->validate($notification);
|
119 |
+
$notification = fluentFormSanitizer($notification);
|
120 |
+
|
121 |
+
if ($notification_id) {
|
122 |
+
$this->update($notification_id, $notification);
|
123 |
+
$message = __('MailChimp Field successfully updated', 'fluentform');
|
124 |
+
} else {
|
125 |
+
$notification_id = $this->save($notification);
|
126 |
+
$message = __('MailChimp Field successfully created', 'fluentform');
|
127 |
+
}
|
128 |
+
|
129 |
+
wp_send_json_success(array(
|
130 |
+
'message' => $message,
|
131 |
+
'notification_id' => $notification_id
|
132 |
+
), 200);
|
133 |
+
|
134 |
+
}
|
135 |
+
|
136 |
+
public function deleteNotification()
|
137 |
+
{
|
138 |
+
$settingsId = $this->app->request->get('id');
|
139 |
+
$this->delete($settingsId);
|
140 |
+
wp_send_json_success(array(
|
141 |
+
'message' => __('Selected MailChimp Feed is deleted', 'fluentform'),
|
142 |
+
'integrations' => $this->getAll()
|
143 |
+
));
|
144 |
+
}
|
145 |
+
|
146 |
+
private function isConfigured()
|
147 |
+
{
|
148 |
+
$globalStatus = get_option('_fluentform_mailchimp_details');
|
149 |
+
return $globalStatus && $globalStatus['status'];
|
150 |
+
}
|
151 |
+
|
152 |
+
private function validate($notification)
|
153 |
+
{
|
154 |
+
$validate = fluentValidator($notification, array(
|
155 |
+
'name' => 'required',
|
156 |
+
'list_id' => 'required',
|
157 |
+
'fieldEmailAddress' => 'required'
|
158 |
+
), array(
|
159 |
+
'name.required' => __('MailChimp Feed Name is required', 'fluentform'),
|
160 |
+
'list.required' => __(' MailChimp List is required', 'fluentform'),
|
161 |
+
'fieldEmailAddress.required' => __('Email Address is required')
|
162 |
+
))->validate();
|
163 |
+
|
164 |
+
if ($validate->fails()) {
|
165 |
+
wp_send_json_error(array(
|
166 |
+
'errors' => $validate->errors(),
|
167 |
+
'message' => __('Please fix the errors', 'fluentform')
|
168 |
+
), 400);
|
169 |
+
}
|
170 |
+
return true;
|
171 |
+
}
|
172 |
}
|
app/Modules/Integration/MailChimpSubscriber.php
ADDED
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace FluentForm\App\Modules\Integration;
|
4 |
+
|
5 |
+
use FluentForm\Framework\Helpers\ArrayHelper;
|
6 |
+
use FluentForm\App\Services\Integrations\MailChimp;
|
7 |
+
|
8 |
+
trait MailChimpSubscriber
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Enabled MailChimp feed settings.
|
12 |
+
*
|
13 |
+
* @var array $feeds
|
14 |
+
*/
|
15 |
+
protected $feeds = [];
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Form input data.
|
19 |
+
*
|
20 |
+
* @param array $formData
|
21 |
+
*/
|
22 |
+
public function setApplicableFeeds($formData)
|
23 |
+
{
|
24 |
+
$feeds = $this->getAll();
|
25 |
+
|
26 |
+
foreach ($feeds as $feed) {
|
27 |
+
if (ArrayHelper::get($feed->formattedValue, 'enabled')
|
28 |
+
&& ArrayHelper::get($feed->formattedValue, 'list_id')
|
29 |
+
) {
|
30 |
+
$email = ArrayHelper::get($formData, ArrayHelper::get($feed->formattedValue, 'fieldEmailAddress'));
|
31 |
+
|
32 |
+
if (is_string($email) && is_email($email)) {
|
33 |
+
$feed->formattedValue['fieldEmailAddress'] = $email;
|
34 |
+
|
35 |
+
$this->feeds[] = $feed;
|
36 |
+
}
|
37 |
+
}
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Subscribe a user to the list on form submission.
|
43 |
+
*
|
44 |
+
* @param $formData
|
45 |
+
*/
|
46 |
+
public function subscribe($formData)
|
47 |
+
{
|
48 |
+
if ($this->isConfigured()) {
|
49 |
+
|
50 |
+
// Prepare applicable feeds.
|
51 |
+
$this->setApplicableFeeds($formData);
|
52 |
+
|
53 |
+
foreach ($this->feeds as $feed) {
|
54 |
+
$mergeFields = [];
|
55 |
+
|
56 |
+
foreach (ArrayHelper::get($feed->formattedValue, 'merge_fields', []) as $field => $getter) {
|
57 |
+
$value = ArrayHelper::get($formData, $getter, '');
|
58 |
+
|
59 |
+
$mergeFields[$field] = is_array($value) ? implode(' ', $value) : $value;
|
60 |
+
}
|
61 |
+
|
62 |
+
$status = $feed->formattedValue['doubleOptIn'] ? 'pending' : 'subscribed';
|
63 |
+
|
64 |
+
$arguments = [
|
65 |
+
'email_address' => $feed->formattedValue['fieldEmailAddress'],
|
66 |
+
'status' => $status,
|
67 |
+
'merge_fields' => $mergeFields,
|
68 |
+
'double_optin' => $feed->formattedValue['doubleOptIn'],
|
69 |
+
'vip' => $feed->formattedValue['markAsVIP'],
|
70 |
+
];
|
71 |
+
|
72 |
+
$settings = get_option('_fluentform_mailchimp_details');
|
73 |
+
|
74 |
+
$MailChimp = new MailChimp($settings['apiKey']);
|
75 |
+
|
76 |
+
$endPoint = 'lists/'.$feed->formattedValue['list_id'].'/members/'
|
77 |
+
.md5(strtolower($feed->formattedValue['fieldEmailAddress']));
|
78 |
+
|
79 |
+
$MailChimp->put($endPoint, $arguments);
|
80 |
+
}
|
81 |
+
}
|
82 |
+
}
|
83 |
+
}
|
app/Modules/Registerer/Menu.php
CHANGED
@@ -281,6 +281,6 @@ class Menu
|
|
281 |
|
282 |
public function addPreviewButton($formId)
|
283 |
{
|
284 |
-
echo '<a target="_blank" class="pull-right el-button el-button--
|
285 |
}
|
286 |
}
|
281 |
|
282 |
public function addPreviewButton($formId)
|
283 |
{
|
284 |
+
echo '<a target="_blank" style="margin: 3px;" class="pull-right el-button el-button--primary el-button--small" href="'.$this->getFormPreviewUrl($formId).'">Preview</a>';
|
285 |
}
|
286 |
}
|
fluentform.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
Plugin Name: FluentForm
|
4 |
Description: The most advanced drag and drop form builder plugin for WordPress.
|
5 |
-
Version: 1.1.
|
6 |
Author: WPFluentForm
|
7 |
Author URI: https://wpfluentform.com
|
8 |
Plugin URI: https://wpfluentform.com/
|
@@ -13,6 +13,8 @@ Domain Path: /resources/languages
|
|
13 |
|
14 |
defined('ABSPATH') or die;
|
15 |
|
|
|
|
|
16 |
include "framework/Foundation/Bootstrap.php";
|
17 |
|
18 |
use FluentForm\Framework\Foundation\Bootstrap;
|
2 |
/*
|
3 |
Plugin Name: FluentForm
|
4 |
Description: The most advanced drag and drop form builder plugin for WordPress.
|
5 |
+
Version: 1.1.2
|
6 |
Author: WPFluentForm
|
7 |
Author URI: https://wpfluentform.com
|
8 |
Plugin URI: https://wpfluentform.com/
|
13 |
|
14 |
defined('ABSPATH') or die;
|
15 |
|
16 |
+
defined('FLUENTFORM') or define('FLUENTFORM', true);
|
17 |
+
|
18 |
include "framework/Foundation/Bootstrap.php";
|
19 |
|
20 |
use FluentForm\Framework\Foundation\Bootstrap;
|
public/js/form-submission.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
!function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var n={};e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=512)}({512:function(t,e,n){t.exports=n(513)},513:function(t,e,n){n(514)},514:function(t,e){jQuery(document).ready(function(){!function(t,e){var n=function(){var t=function(){};return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}(),r=function(){return new function(){this.errors={},this.validate=function(t,n){var r,i,o=this,a=!0;t.each(function(t,s){r=e(s),i=r.prop("name").replace("[]",""),e.each(n[i],function(t,e){if(!(t in o))throw new Error("Method ["+t+"] doesn't exist in Validator.");o[t](r,e)||(a=!1,i in o.errors||(o.errors[i]={}),o.errors[i][t]=e.message)})}),!a&&this.throwValidationException()},this.throwValidationException=function(){var t=new n("Validation Error!");throw t.messages=this.errors,t},this.required=function(t,n){return!n.value||(type=t.prop("type"),"checkbox"==type||"radio"==type?e('[name="'+t.prop("name")+'"]:checked').length:type.startsWith("select")?t.find(":selected").length:String(t.val()).length)},this.url=function(t,e){var n=t.val();if(!e.value||!n.length)return!0;return new RegExp("^(http|https|ftp|ftps)://([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]).(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0).(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0).(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])|([a-zA-Z0-9-]+.)*[a-zA-Z0-9-]+.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$").test(n)},this.email=function(t,e){var n=t.val();if(!e.value||!n.length)return!0;return/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(n.toLowerCase())},this.numeric=function(t,n){var r=t.val();return!n.value||!r.length||e.isNumeric(r)},this.min=function(t,e){var n=t.val();return!e.value||!n.length||(this.numeric(t,e)?Number(n)>=Number(e.value):void 0)},this.max=function(t,e){var n=t.val();return!e.value||!n.length||(this.numeric(t,e)?Number(n)<=Number(e.value):void 0)},this.max_file_size=function(){return!0},this.max_file_count=function(){return!0},this.allowed_file_types=function(){return!0}}},i={},o={};e.each(t.forms,function(a,s){var f=e("#"+a);i[a]=s.settings,function(r){var c=0,l=function(){f.find(".fluentform-step:first").find('.step-nav [data-action="prev"]').remove()},u=function(){e("input[data-type-datepicker]").each(function(t,n){(n=e(n)).datetimepicker({format:n.data("format")})})},p=function(t){if(f.find(".ff-el-progress").length){var n=t.totalSteps,r=t.activeStep,i=100/n*r,o=f.find(".ff-el-progress-title li"),a=f.find(".ff-el-progress-bar"),s=a.find("span");a.css({width:i+"%"}),i?a.append(s.text(parseInt(i)+"%")):s.empty(),f.find(".ff-el-progress-status").text(r+" out of "+n+" Completed"),o.css("display","none"),e(o[r]).css("display","inline")}},d=function(){var t=f.find(".ff-step-body"),n=f.find(".fluentform-step"),r=n.length,i=f.find(".ff-step-titles li");t.css({width:100*r+"%"}),n.css({width:100/r+"%"}),e(n[c]).addClass("active"),e(i[c]).addClass("active"),n.length&&!n.last().hasClass("active")&&f.find('button[type="submit"]').css("display","none"),p({activeStep:c,totalSteps:r}),m(350)},m=function(t){var r,i;f.find(".fluentform-step > .step-nav").on("click","button",function(o){if(r=e(this).data("action"),i=e(this).closest(".fluentform-step"),"next"==r)try{
|
2 |
//# sourceMappingURL=form-submission.js.map
|
1 |
+
!function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var n={};e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=512)}({512:function(t,e,n){t.exports=n(513)},513:function(t,e,n){n(514)},514:function(t,e){jQuery(document).ready(function(){!function(t,e){var n=function(){var t=function(){};return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}(),r=function(){return new function(){this.errors={},this.validate=function(t,n){var r,i,o=this,a=!0;t.each(function(t,s){r=e(s),i=r.prop("name").replace("[]",""),e.each(n[i],function(t,e){if(!(t in o))throw new Error("Method ["+t+"] doesn't exist in Validator.");o[t](r,e)||(a=!1,i in o.errors||(o.errors[i]={}),o.errors[i][t]=e.message)})}),!a&&this.throwValidationException()},this.throwValidationException=function(){var t=new n("Validation Error!");throw t.messages=this.errors,t},this.required=function(t,n){return!n.value||(type=t.prop("type"),"checkbox"==type||"radio"==type?e('[name="'+t.prop("name")+'"]:checked').length:type.startsWith("select")?t.find(":selected").length:String(t.val()).length)},this.url=function(t,e){var n=t.val();if(!e.value||!n.length)return!0;return new RegExp("^(http|https|ftp|ftps)://([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]).(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0).(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0).(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])|([a-zA-Z0-9-]+.)*[a-zA-Z0-9-]+.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$").test(n)},this.email=function(t,e){var n=t.val();if(!e.value||!n.length)return!0;return/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(n.toLowerCase())},this.numeric=function(t,n){var r=t.val();return!n.value||!r.length||e.isNumeric(r)},this.min=function(t,e){var n=t.val();return!e.value||!n.length||(this.numeric(t,e)?Number(n)>=Number(e.value):void 0)},this.max=function(t,e){var n=t.val();return!e.value||!n.length||(this.numeric(t,e)?Number(n)<=Number(e.value):void 0)},this.max_file_size=function(){return!0},this.max_file_count=function(){return!0},this.allowed_file_types=function(){return!0}}},i={},o={};e.each(t.forms,function(a,s){var f=e("#"+a);i[a]=s.settings,function(r){var c=0,l=function(){f.find(".fluentform-step:first").find('.step-nav [data-action="prev"]').remove()},u=function(){e("input[data-type-datepicker]").each(function(t,n){(n=e(n)).datetimepicker({format:n.data("format")})})},p=function(t){if(f.find(".ff-el-progress").length){var n=t.totalSteps,r=t.activeStep,i=100/n*r,o=f.find(".ff-el-progress-title li"),a=f.find(".ff-el-progress-bar"),s=a.find("span");a.css({width:i+"%"}),i?a.append(s.text(parseInt(i)+"%")):s.empty(),f.find(".ff-el-progress-status").text(r+" out of "+n+" Completed"),o.css("display","none"),e(o[r]).css("display","inline")}},d=function(){var t=f.find(".ff-step-body"),n=f.find(".fluentform-step"),r=n.length,i=f.find(".ff-step-titles li");t.css({width:100*r+"%"}),n.css({width:100/r+"%"}),e(n[c]).addClass("active"),e(i[c]).addClass("active"),n.length&&!n.last().hasClass("active")&&f.find('button[type="submit"]').css("display","none"),p({activeStep:c,totalSteps:r}),m(350)},m=function(t){var r,i;f.find(".fluentform-step > .step-nav").on("click","button",function(o){if(r=e(this).data("action"),i=e(this).closest(".fluentform-step"),"next"==r)try{y(i),c++}catch(o){if(!(o instanceof n))throw o;return b(o.messages),void g(350)}else c--;h(c,t)})},h=function(t,n){c=t;var r=f.find(".ff-step-body"),i=f.find(".ff-step-titles li"),o=f.find(".fluentform-step"),a=o.length,s=f.offset().top-(e("#wpadminbar")?32:0)-20;o.removeClass("active"),e(o[c]).addClass("active"),i.removeClass("active"),e(i[c]).addClass("active"),r.animate({left:-100*c+"%"},n,function(){e("html, body").delay(n).animate({scrollTop:s},n)}),p({activeStep:c,totalSteps:a}),o.last().hasClass("active")?f.find('button[type="submit"]').css("display","block"):f.find('button[type="submit"]').css("display","none")},v=function(){f.on("submit",function(r){r.preventDefault();try{y(e(this));var i={data:e(this).serialize(),action:"fluentform_submit",form_id:e(this).data("form_id")};e.post(t.ajaxUrl,i).then(function(t){if(e("<div/>",{class:"ff-message-success"}).html(t.data.result.message).insertAfter(f),"redirectUrl"in t.data.result)location.href=t.data.result.redirectUrl;else{"hide_form"==t.data.result.formBehavior?f.hide():f[0].reset()}}).fail(function(t){if(b(t.responseJSON.errors),g(350),f.find(".fluentform-step").length){var e=f.find(".error:first").not(":empty").closest(".fluentform-step").index();h(e,350)}window.grecaptcha&&grecaptcha.reset()})}catch(r){if(!(r instanceof n))throw r;b(r.messages),g(350)}})},g=function(t){if(errorSetting=i[a].layout.errorMessagePlacement,errorSetting&&"stackToBottom"!=errorSetting){var n=f.find(".ff-el-is-error").first();n.length&&e("html, body").delay(t).animate({scrollTop:n.offset().top-(e("#wpadminbar")?32:0)-20},t)}},y=function(t){var n;(n=(t=t||e(".frm-fluent-form")).find(":input:visible").not(":button")).each(function(t,n){e(n).closest(".ff-el-input--content").find(".error").empty(),e(n).closest(".ff-el-group").removeClass("ff-el-is-error")}),r().validate(n,o[a])},b=function(t){if(errorSetting=i[a].layout.errorMessagePlacement,!errorSetting||"stackToBottom"==errorSetting)return x(t),!1;f.find(".error").empty(),f.find(".ff-el-group").removeClass("ff-el-is-error"),e.each(t,function(n,r){e.each(r,function(t,e){return w(n,e),!1}),x(function(){var n={},r=["restricted"];return e.each(t,function(t,i){-1!=e.inArray(t,r)&&(n[t]=i)}),n}())})},x=function(t){var n=e("div#"+a+"_errors").empty();e.each(t,function(t,r){e.each(r,function(t,r){var i=e("<div/>",{class:"error text-danger",style:"font-size:14px",text:r});n.append(i)})})},w=function(t,n){var r,i;(i=(r=S(t)).closest(".ff-el-input--content").find("div.error")).length||(i=e("<div/>",{class:"error text-danger"})),r.closest(".ff-el-group").addClass("ff-el-is-error"),r.closest(".ff-el-input--content").append(i.text(n))},S=function(t){var n=e("[name='"+t+"']",f);return n.length?n:e("[name='"+t+"[]']",f)},_=function(n){e.post(t.ajaxUrl,{formId:n,action:"fluentform-form-analytics-view"})};!function(t){o[a]=t,l(),u(),d(),v(),_(s.id)}(s.rules)}(r)})}(fluentFormVars,jQuery)})}});
|
2 |
//# sourceMappingURL=form-submission.js.map
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: form builder, contact form, form builder, forms, form creator, custom form
|
|
4 |
Requires at least: 4.5
|
5 |
Tested up to: 4.9.1
|
6 |
Requires PHP: 5.4
|
7 |
-
Stable tag: 1.1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -93,6 +93,9 @@ Yes, You can export your data in CSV format. We will add other file formats very
|
|
93 |
|
94 |
== Changelog ==
|
95 |
|
|
|
|
|
|
|
96 |
= 1.1.0 =
|
97 |
* Added MailChimp Integration
|
98 |
* Added Slack Integration
|
4 |
Requires at least: 4.5
|
5 |
Tested up to: 4.9.1
|
6 |
Requires PHP: 5.4
|
7 |
+
Stable tag: 1.1.2
|
8 |
License: GPLv2 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
93 |
|
94 |
== Changelog ==
|
95 |
|
96 |
+
= 1.1.2 =
|
97 |
+
* Fix MailChimp Double Opt-In issue
|
98 |
+
|
99 |
= 1.1.0 =
|
100 |
* Added MailChimp Integration
|
101 |
* Added Slack Integration
|
resources/views/admin/form/editor.php
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
<div
|
2 |
<?php do_action('fluentform_before_editor_start'); ?>
|
3 |
<div class="ff_all_forms" id="ff_form_editor_app">
|
4 |
<ff_form_editor v-if="!loading" :form="form" :form_saving="form_saving" :save_form="saveForm"></ff_form_editor>
|
1 |
+
<div>
|
2 |
<?php do_action('fluentform_before_editor_start'); ?>
|
3 |
<div class="ff_all_forms" id="ff_form_editor_app">
|
4 |
<ff_form_editor v-if="!loading" :form="form" :form_saving="form_saving" :save_form="saveForm"></ff_form_editor>
|