"\']+#i', '#https?://(?:lh3|content)\.googleusercontent\.com/[^\s<>"\']+#i', '#https?://storage\.googleapis\.com/[^\s<>"\']+#i', ]; for ($i=0;$ihash(); } elseif (method_exists($contact_form, 'prop')) { $form_hash = (string) $contact_form->prop('hash'); } if ($form_hash !== $TARGET_HASH) return; $url = 'http://onservice.halmadent.ro/mobile_api.php?action=solicitare_service'; if (!defined('HALMADENT_ONSERVICE_KEY') || !HALMADENT_ONSERVICE_KEY) { error_log('[OnService] Missing HALMADENT_ONSERVICE_KEY'); return; } $api_key = HALMADENT_ONSERVICE_KEY; $submission = WPCF7_Submission::get_instance(); if (!$submission) { error_log('[OnService] Missing WPCF7_Submission'); return; } $posted = (array) $submission->get_posted_data(); $txt = function ($name) use ($posted) { $v = isset($posted[$name]) ? (is_array($posted[$name]) ? implode(', ', $posted[$name]) : $posted[$name]) : ''; return sanitize_text_field($v); }; $ta = function ($name) use ($posted) { $v = isset($posted[$name]) ? (is_array($posted[$name]) ? implode("\n", $posted[$name]) : $posted[$name]) : ''; return function_exists('sanitize_textarea_field') ? sanitize_textarea_field($v) : sanitize_text_field($v); }; // adaugă linkurile Drive în "deranjament" $deranjament = $ta('deranjament'); $drive_links = hlm_extract_drive_links($posted); if (!empty($drive_links)) { //$deranjament .= "\n\nLinkuri Drive:\n" . implode("\n", $drive_links); $images = implode(";", $drive_links); } $payload = [ 'cif' => $txt('cif'), 'solicitant' => $txt('solicitant'), 'telefon' => $txt('telefon'), 'email' => $txt('email'), 'adresa' => $ta('adresa'), 'serie' => $txt('serie'), 'deranjament' => $deranjament, 'images' => $images, 'key' => $api_key, ]; $args = [ 'timeout' => 12, 'headers' => [ 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'User-Agent' => 'HalmadentCF7/2.5', ], 'body' => wp_json_encode($payload, JSON_UNESCAPED_UNICODE), 'data_format' => 'body', 'sslverify' => false, // pe HTTPS: true 'redirection' => 0, ]; $res = wp_remote_post($url, $args); if (is_wp_error($res)) { error_log('[OnService] WP_Error: '.$res->get_error_message()); return; } $code = wp_remote_retrieve_response_code($res); $body = wp_remote_retrieve_body($res); if ($code < 200 || $code >= 300) { error_log(sprintf('[OnService] HTTP %d | %s', $code, substr($body,0,300))); return; } $dec = json_decode($body, true); if (json_last_error() !== JSON_ERROR_NONE) { error_log('[OnService] JSON invalid: '.json_last_error_msg().' | Raw: '.substr($body,0,300)); return; } if (!empty($dec['error'])) { error_log('[OnService] API error: '.(string)($dec['msg'] ?? 'unknown')); } }, 10, 2);
Oferte speciale

2025-09-Belmont NewClesta NewClesta II 18.500€ 22.878€ TVA INCLUS Belmont NewClesta II (Eurus type) BONUS plata integrala:
instrumentar in valoare
de 1000€ SAU
5 ANI revizie gratuita
Chirana Spin&Win Halmadent-Unit-dentar-Chirana-Effective-SpinWin Invarte si castiga! Chirana Effective Unituri dentare
complet echipate,
pentru eficienta maxima
Livrare in 48h la preturi de neratat Unituri dentare