Confirm Submission<\/a><\/p> <\/p>
If you received this email by mistake, simply delete it. Your form submission won\'t proceed if you don\'t click the confirmation link above.<\/p>\",\"email_field\":\"\",\"skip_if_logged_in\":\"yes\",\"skip_if_fc_subscribed\":\"no\"}"}]}]',
'[{"id":"8","title":"Subscription Form","status":"published","appearance_settings":null,"form_fields":{"fields":[{"index":1,"element":"container","attributes":[],"settings":{"container_class":"","conditional_logics":{"type":"any","status":false,"conditions":[{"field":"","value":"","operator":""}]}},"columns":[{"fields":[{"index":1,"element":"input_email","attributes":{"type":"email","name":"email","value":"","id":"","class":"","placeholder":"Your Email Address"},"settings":{"container_class":"","label":"","label_placement":"","help_message":"","admin_field_label":"Email","validation_rules":{"required":{"value":true,"message":"This field is required"},"email":{"value":true,"message":"This field must contain a valid email"}},"conditional_logics":[],"is_unique":"no","unique_validation_message":"Email address need to be unique."},"editor_options":{"title":"Email Address","icon_class":"ff-edit-email","template":"inputText"},"uniqElKey":"el_16231279686950.8779857923682932"}]},{"fields":[{"index":15,"element":"custom_submit_button","attributes":{"class":"","type":"submit"},"settings":{"button_style":"","button_size":"md","align":"left","container_class":"","current_state":"normal_styles","background_color":"","color":"","hover_styles":{"backgroundColor":"#ffffff","borderColor":"#1a7efb","color":"#1a7efb","borderRadius":"","minWidth":"100%"},"normal_styles":{"backgroundColor":"#1a7efb","borderColor":"#1a7efb","color":"#ffffff","borderRadius":"","minWidth":"100%"},"button_ui":{"text":"Subscribe","type":"default","img_url":""},"conditional_logics":{"type":"any","status":false,"conditions":[{"field":"","value":"","operator":""}]}},"editor_options":{"title":"Custom Submit Button","icon_class":"dashicons dashicons-arrow-right-alt","template":"customButton"},"uniqElKey":"el_16231279798380.5947400167493171"}]}],"editor_options":{"title":"Two Column Container","icon_class":"ff-edit-column-2"},"uniqElKey":"el_16231279284710.40955091024524304"}],"submitButton":{"uniqElKey":"el_1524065200616","element":"button","attributes":{"type":"submit","class":""},"settings":{"align":"left","button_style":"default","container_class":"","help_message":"","background_color":"#1a7efb","button_size":"md","color":"#ffffff","button_ui":{"type":"default","text":"Subscribe","img_url":""}},"editor_options":{"title":"Submit Button"}}},"has_payment":"0","type":"form","conditions":null,"created_by":"1","created_at":"2021-06-08 04:51:36","updated_at":"2021-06-08 04:54:02","metas":[{"meta_key": "template_name","value": "inline_subscription"},{"meta_key":"formSettings","value":"{\"confirmation\":{\"redirectTo\":\"samePage\",\"messageToShow\":\"Thank you for your message. We will get in touch with you shortly\",\"customPage\":null,\"samePageFormBehavior\":\"hide_form\",\"customUrl\":null},\"restrictions\":{\"limitNumberOfEntries\":{\"enabled\":false,\"numberOfEntries\":null,\"period\":\"total\",\"limitReachedMsg\":\"Maximum number of entries exceeded.\"},\"scheduleForm\":{\"enabled\":false,\"start\":null,\"end\":null,\"pendingMsg\":\"Form submission is not started yet.\",\"expiredMsg\":\"Form submission is now closed.\"},\"requireLogin\":{\"enabled\":false,\"requireLoginMsg\":\"You must be logged in to submit the form.\"},\"denyEmptySubmission\":{\"enabled\":false,\"message\":\"Sorry, you cannot submit an empty form. Let\'s hear what you wanna say.\"}},\"layout\":{\"labelPlacement\":\"top\",\"helpMessagePlacement\":\"with_label\",\"errorMessagePlacement\":\"inline\",\"asteriskPlacement\":\"asterisk-right\"}}"},{"meta_key":"notifications","value":"{\"name\":\"Admin Notification Email\",\"sendTo\":{\"type\":\"email\",\"email\":\"{wp.admin_email}\",\"field\":\"email\",\"routing\":[{\"email\":null,\"field\":null,\"operator\":\"=\",\"value\":null}]},\"fromName\":\"\",\"fromEmail\":\"\",\"replyTo\":\"\",\"bcc\":\"\",\"subject\":\"[{inputs.names}] New Form Submission\",\"message\":\"
{all_data}<\\\/p>\\n
This form submitted at: {embed_post.permalink}<\\\/p>\",\"conditionals\":{\"status\":false,\"type\":\"all\",\"conditions\":[{\"field\":null,\"operator\":\"=\",\"value\":null}]},\"enabled\":false,\"email_template\":\"\"}"},{"meta_key":"step_data_persistency_status","value":"no"},{"meta_key":"_primary_email_field","value":"email"}]}]',
];
foreach ($forms as $index => $formJson) {
$structure = json_decode($formJson, true)[0];
$insertData = [
'title' => $structure['title'],
'type' => $structure['type'],
'status' => 'published',
'created_by' => get_current_user_id(),
'created_at' => current_time('mysql'),
'updated_at' => current_time('mysql'),
'form_fields' => json_encode($structure['form_fields']),
];
$wpdb->insert($formsTable, $insertData, [
'%s',
'%s',
'%s',
'%d',
'%s',
'%s',
'%s',
]);
$formId = $wpdb->insert_id;
foreach ($structure['metas'] as $meta) {
$meta['value'] = trim(preg_replace('/\s+/', ' ', $meta['value']));
$wpdb->insert($wpdb->prefix . 'fluentform_form_meta', [
'form_id' => $formId,
'meta_key' => $meta['meta_key'],
'value' => $meta['value'],
], [
'%d',
'%s',
'%s',
]);
}
}
}
}
public function setCronSchedule()
{
add_filter('cron_schedules', function ($schedules) {
$schedules['ff_every_five_minutes'] = [
'interval' => 300,
'display' => esc_html__('Every 5 Minutes (FluentForm)', 'fluentform'),
];
return $schedules;
}, 10, 1);
$hookName = 'fluentform_do_scheduled_tasks';
if (!wp_next_scheduled($hookName)) {
wp_schedule_event(time(), 'ff_every_five_minutes', $hookName);
}
$emailReportHookName = 'fluentform_do_email_report_scheduled_tasks';
if (!wp_next_scheduled($emailReportHookName)) {
wp_schedule_event(time(), 'daily', $emailReportHookName);
}
}
}
GlobalNotificationHandler.php 0000644 00000016336 15073226730 0012340 0 ustar 00 app = $app;
$this->globalNotificationService = new GlobalNotificationService();
}
public function globalNotify($insertId, $formData, $form)
{
// Let's find the feeds that are available for this form
$feeds = apply_filters_deprecated(
'fluentform_global_notification_active_types',
[
[],
$form->id
],
FLUENTFORM_FRAMEWORK_UPGRADE,
'fluentform/global_notification_active_types',
'Use fluentform/global_notification_active_types instead of fluentform_global_notification_active_types.'
);
$feedKeys = apply_filters('fluentform/global_notification_active_types', $feeds, $form->id);
if (! $feedKeys) {
do_action_deprecated(
'fluentform_global_notify_completed',
[
$insertId,
$form
],
FLUENTFORM_FRAMEWORK_UPGRADE,
'fluentform/global_notify_completed',
'Use fluentform/global_notify_completed instead of fluentform_global_notify_completed.'
);
do_action('fluentform/global_notify_completed', $insertId, $form);
return;
}
$feedMetaKeys = array_keys($feedKeys);
$feeds = $this->globalNotificationService->getNotificationFeeds($form, $feedMetaKeys);
if (! $feeds) {
do_action_deprecated(
'fluentform_global_notify_completed',
[
$insertId,
$form
],
FLUENTFORM_FRAMEWORK_UPGRADE,
'fluentform/global_notify_completed',
'Use fluentform/global_notify_completed instead of fluentform_global_notify_completed.'
);
do_action('fluentform/global_notify_completed', $insertId, $form);
return;
}
// Now we have to filter the feeds which are enabled
$enabledFeeds = $this->globalNotificationService->getEnabledFeeds($feeds, $formData, $insertId);
if (!$enabledFeeds) {
do_action_deprecated(
'fluentform_global_notify_completed',
[
$insertId,
$form
],
FLUENTFORM_FRAMEWORK_UPGRADE,
'fluentform/global_notify_completed',
'Use fluentform/global_notify_completed instead of fluentform_global_notify_completed.'
);
do_action('fluentform/global_notify_completed', $insertId, $form);
return;
}
$entry = false;
$asyncFeeds = [];
$scheduler = $this->app['fluentFormAsyncRequest'];
foreach ($enabledFeeds as $feed) {
// We will decide if this feed will run on async or sync
$integrationKey = ArrayHelper::get($feedKeys, $feed['meta_key']);
$oldAction = 'fluentform_integration_notify_' . $feed['meta_key'];
$newAction = 'fluentform/integration_notify_' . $feed['meta_key'];
if (! $entry) {
$entry = $this->globalNotificationService->getEntry($insertId, $form);
}
// skip emails which will be sent on payment form submit otherwise email is sent after payment success
if (!! $form->has_payment && ('notifications' == $feed['meta_key'])) {
if (('payment_form_submit' == ArrayHelper::get($feed, 'settings.feed_trigger_event'))) {
continue;
}
}
// It's sync
$processedValues = $feed['settings'];
unset($processedValues['conditionals']);
$processedValues = ShortCodeParser::parse($processedValues, $insertId, $formData, $form, false, $feed['meta_key']);
$feed['processedValues'] = $processedValues;
$isAsync = apply_filters_deprecated(
'fluentform_notifying_async_' . $integrationKey,
[
true,
$form->id
],
FLUENTFORM_FRAMEWORK_UPGRADE,
'fluentform/notifying_async_' . $integrationKey,
'Use fluentform/notifying_async_' . $integrationKey . ' instead of fluentform_notifying_async_' . $integrationKey
);
$scheduleAction = [
'action' => $newAction,
'form_id' => $form->id,
'origin_id' => $insertId,
'feed_id' => $feed['id'],
'type' => 'submission_action',
'status' => 'pending',
'data' => maybe_serialize($feed),
'created_at' => current_time('mysql'),
'updated_at' => current_time('mysql'),
];
if (apply_filters('fluentform/notifying_async_' . $integrationKey, $isAsync, $form->id)) {
// It's async
$asyncFeeds[] = $scheduleAction;
$queueId = $scheduler->queue($scheduleAction);
as_enqueue_async_action('fluentform/schedule_feed', ['queueId' => $queueId], 'fluentform');
} else {
$isSyncFeedLogsEnable = apply_filters("fluentform/notifying_sync_{$integrationKey}_api_logs", false, $form->id);
if ($isSyncFeedLogsEnable) {
$scheduleAction['status'] = 'processing';
$feed['scheduled_action_id'] = wpFluent()->table('ff_scheduled_actions')->insertGetId($scheduleAction);
}
do_action_deprecated(
$oldAction,
[
$feed,
$formData,
$entry,
$form
],
FLUENTFORM_FRAMEWORK_UPGRADE,
$newAction,
'Use ' . $newAction . ' instead of ' . $oldAction
);
do_action($newAction, $feed, $formData, $entry, $form);
}
}
if (! $asyncFeeds) {
do_action_deprecated(
'fluentform_global_notify_completed',
[
$insertId,
$form
],
FLUENTFORM_FRAMEWORK_UPGRADE,
'fluentform/global_notify_completed',
'Use fluentform/global_notify_completed instead of fluentform_global_notify_completed.'
);
do_action('fluentform/global_notify_completed', $insertId, $form);
return;
}
}
}
DeactivationHandler.php 0000644 00000000547 15073226730 0011200 0 ustar 00 disableCronSchedule();
}
private function disableCronSchedule()
{
wp_clear_scheduled_hook('fluentform_do_scheduled_tasks');
wp_clear_scheduled_hook('fluentform_do_email_report_scheduled_tasks');
}
}