/*Wrapper function which calls the form.*/ function wpcf_callback( $content ) { global $wpcf_strings; /* Run the input check. */ @@ if(false===strpos($content, '')) { return $content; } if(wpcf_check_input()) // If the input check returns true (ie. there has been a submission & input is ok) { $recipient = get_option('wpcf_email'); $subject = get_option('wpcf_subject'); $success_msg = get_option('wpcf_success_msg'); $success_msg = stripslashes($success_msg); $name = $_POST['wpcf_your_name']; $email = $_POST['wpcf_email']; $website = $_POST['wpcf_website']; $msg = $_POST['wpcf_msg']; $headers = "MIME-Version: 1.0\n"; $headers .= "From: $name <$email>\n"; $headers .= "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n"; $fullmsg = "$name wrote:\n"; $fullmsg .= wordwrap($msg, 80, "\n") . "\n\n"; $fullmsg .= "Website: " . $website . "\n"; $fullmsg .= "IP: " . getip(); mail($recipient, $subject, $fullmsg, $headers); $results = '
' . $success_msg . '
'; echo $results; } else // Else show the form. If there are errors the strings will have updated during running the inputcheck. { $form = '
' . $wpcf_strings['error'] . '
' . $wpcf_strings['name'] . '
' . $wpcf_strings['email'] . '
' . $wpcf_strings['msg'] . '
 
'; return str_replace('', $form, $content); } }