app = $application; } public function renderHoneyPot($form) { if (!$this->isEnabled($form->id)) { return; } $fieldName = $this->getFieldName($form->id); $fieldId = 'ff_' . $form->id . '_item_sf' ; $labels = ['Newsletter', 'Updates', 'Contact', 'Subscribe', 'Notify']; $randomLabel = $labels[array_rand($labels)]; ?>
isEnabled($formId) || ( Helper::isConversionForm($formId) && ArrayHelper::isTrue($requestData, 'isFFConversational') )) { return; } $honeyPotName = $this->getFieldName($formId); if ( !ArrayHelper::exists($requestData, $honeyPotName) || !empty(ArrayHelper::get($requestData, $honeyPotName)) ) { $message = apply_filters( 'fluentform/honeypot_spam_message', __('Sorry! You can not submit this form at this moment!', 'fluentform'), $formId ); wp_send_json(['errors' => $message], 422); } return; } public function isEnabled($formId = false) { $option = get_option('_fluentform_global_form_settings'); $status = 'yes' == ArrayHelper::get($option, 'misc.honeypotStatus'); return apply_filters('fluentform/honeypot_status', $status, $formId); } private function getFieldName($formId) { $honeyPotName = 'item_' . $formId . '__fluent_sf'; return apply_filters('fluentform/honeypot_name', $honeyPotName, $formId); } }