Changeset 3323377
- Timestamp:
- 07/07/2025 09:39:33 AM (8 months ago)
- File:
-
- 1 edited
-
avacy/trunk/src/Integrations/ElementorForms.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
avacy/trunk/src/Integrations/ElementorForms.php
r3305818 r3323377 20 20 public static function convertToFormSubmission($contact_form) : FormSubmission { 21 21 $form_id = sanitize_text_field($contact_form['id']); 22 $identifier = get_option('avacy_elementor_forms_' . $form_id . '_form_user_identifier'); // TODO: get identifier from settings 22 $identifierKey = get_option('avacy_elementor_forms_' . $form_id . '_form_user_identifier'); 23 $identifier = $contact_form[$identifierKey]; 23 24 $remoteAddr = sanitize_text_field( $_SERVER['REMOTE_ADDR'] ); 24 25 $ipAddress = $remoteAddr ?: '0.0.0.0'; … … 27 28 $fields = self::getFields($form_id); 28 29 $selectedFields = []; 29 30 30 foreach($fields as $field) { 31 if(isset($submittedData[$field])) { 32 $selectedFields[$field] = sanitize_text_field($submittedData[$field]); 31 if(!empty($field)) { 32 $selectedFields[] = [ 33 'label' => $field, 34 'value' => $contact_form[$field] 35 ]; 33 36 } 34 37 } 35 38 36 $proofs = sanitize_text_field($contact_form['source']); 39 $proof = sanitize_text_field($contact_form['source']); 40 $consentData = wp_json_encode($selectedFields); 37 41 38 // TODO: get legal notices from settings 39 $legalNotices = [ 40 ["name" => "privacy_policy"], 41 ["name" => "cookie_policy"] 42 $consentFeatures = [ 43 'privacy_policy', 44 'cookie_policy' 42 45 ]; 43 46 44 // TODO: get preferences from settings 45 $preferences = [ 46 [ 47 "name" => "newsletter", 48 "accepted" => true 49 ], 50 [ 51 "name" => "updates", 52 "accepted" => true 53 ] 54 ]; 47 $sub = new FormSubmission( 48 $ipAddress, 49 'form', 50 'accepted', 51 $consentData, 52 $identifier, 53 'plugin', 54 $consentFeatures, 55 $proof 56 ); 55 57 56 return new FormSubmission( 57 $selectedFields, 58 $identifier, 59 $ipAddress, 60 $proofs, 61 $legalNotices, 62 $preferences 63 ); 58 return $sub; 64 59 } 65 60
Note: See TracChangeset
for help on using the changeset viewer.