admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( 'zeq_nonce' ), 'turnstileSiteKey' => ZEQ_TURNSTILE_SITE_KEY, 'whatsappNumber' => ZEQ_WHATSAPP_NUMBER, 'maxFileSize' => 10 * 1024 * 1024, ]); } /* ── Shortcode ── */ add_shortcode( 'zero_effort_quote', 'zeq_render_trigger_button' ); function zeq_render_trigger_button( $atts ) { $atts = shortcode_atts(['label'=>'Get a Zero Effort Quote','class'=>''], $atts); ob_start(); ?> 'Please fill in all required fields with valid data.']); } $attachment = zeq_handle_file_upload('zeq_file'); $subject = 'New Zero Effort Quote Lead - Email Upload'; $body = zeq_build_email_body($name, $email, $phone, 'Email Upload'); $headers = ['Content-Type: text/html; charset=UTF-8', "Reply-To: {$name} <{$email}>"]; $sent = wp_mail(ZEQ_LEAD_EMAIL, $subject, $body, $headers, $attachment ? [$attachment] : []); if ($attachment) @unlink($attachment); if ($sent) { wp_send_json_success(['message'=>"Thanks! We'll analyse your bill and call you within 1 hour."]); } else { wp_send_json_error(['message'=>'Sorry, there was an issue. Please try WhatsApp instead.']); } } /* ── AJAX: Attach ── */ add_action('wp_ajax_zeq_submit_attach', 'zeq_handle_attach_submit'); add_action('wp_ajax_nopriv_zeq_submit_attach', 'zeq_handle_attach_submit'); function zeq_handle_attach_submit() { zeq_verify_request(); $attachment = zeq_handle_file_upload('zeq_file'); if ( ! $attachment ) { wp_send_json_error(['message'=>'Please attach a valid bill file (PDF, JPG, or PNG, max 10 MB).']); } $subject = 'New Zero Effort Quote Lead - File Attachment'; $body = zeq_build_email_body('Anonymous','','','File Attachment'); $headers = ['Content-Type: text/html; charset=UTF-8']; $sent = wp_mail(ZEQ_LEAD_EMAIL, $subject, $body, $headers, [$attachment]); @unlink($attachment); if ($sent) { wp_send_json_success(['message'=>"Bill received! We'll compare rates and be in touch shortly."]); } else { wp_send_json_error(['message'=>'Sorry, there was an issue. Please try another upload method.']); } } /* ── Turnstile + Nonce verify ── */ function zeq_verify_request() { if ( ! check_ajax_referer('zeq_nonce','nonce',false) ) { wp_send_json_error(['message'=>'Security check failed. Please refresh the page.']); } $token = sanitize_text_field($_POST['cf-turnstile-response'] ?? ''); if ( empty($token) ) { wp_send_json_error(['message'=>'Please complete the security challenge.']); } $res = wp_remote_post('https://challenges.cloudflare.com/turnstile/v0/siteverify',[ 'body' => ['secret'=>ZEQ_TURNSTILE_SECRET,'response'=>$token,'remoteip'=>$_SERVER['REMOTE_ADDR']??''], 'timeout' => 10, ]); if ( is_wp_error($res) ) { wp_send_json_error(['message'=>'Could not verify security challenge. Please try again.']); } $data = json_decode(wp_remote_retrieve_body($res), true); if ( empty($data['success']) ) { wp_send_json_error(['message'=>'Security verification failed. Please try again.']); } } /* ── File upload handler ── */ function zeq_handle_file_upload($field) { if ( empty($_FILES[$field]['tmp_name']) ) return false; $file = $_FILES[$field]; $allowed = ['application/pdf'=>'pdf','image/jpeg'=>'jpg','image/png'=>'png']; if ( $file['error'] !== UPLOAD_ERR_OK ) return false; if ( $file['size'] > 10*1024*1024 ) return false; $finfo = finfo_open(FILEINFO_MIME_TYPE); $mime = finfo_file($finfo, $file['tmp_name']); finfo_close($finfo); if ( ! array_key_exists($mime, $allowed) ) return false; $tmp = sys_get_temp_dir().'/zeq_bill_'.wp_generate_password(12,false).'.'.$allowed[$mime]; return move_uploaded_file($file['tmp_name'], $tmp) ? $tmp : false; } /* ── Email body builder ── */ function zeq_build_email_body($name,$email,$phone,$method) { $rows = ''; foreach([ 'Method' => $method, 'Name' => $name ?: '—', 'Email' => $email ?: '—', 'Phone' => $phone ?: '—', 'Date/Time' => current_time('Y-m-d H:i:s'), 'IP' => sanitize_text_field($_SERVER['REMOTE_ADDR']??'Unknown'), 'Page URL' => sanitize_text_field($_POST['page_url']??'—'), ] as $k=>$v) { $rows .= ''.esc_html($k).'' . ''.esc_html($v).''; } return ' ZERO EFFORT QUOTE New Lead Received A new lead via '.esc_html($method).'. '.$rows.' '.(!empty($_FILES['zeq_file']['name'])? ' 📎 Bill attached. ':'').' Sent by Zero Effort Quote • '.esc_html(get_bloginfo('name')).' '; } ?>Page not found |

It looks like the link pointing here was faulty. Maybe try searching?