rendered paste body/*Wrapper function which calls the form.*/function wpcf_callback( $content ){ global $wpcf_strings; /* Run the input check. */@@ if(false===strpos($content, '<!--contact form-->')) { 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 = '<div style="font-weight: bold;">' . $success_msg . '</div>'; echo $results; } else // Else show the form. If there are errors the strings will have updated during running the inputcheck. { $form = '<div class="contactform"> ' . $wpcf_strings['error'] . ' <form action="' . get_permalink() . '" method="post"> <div class="contactleft"><label for="wpcf_your_name">' . __('Your Name: ', 'wpcf') . '</label></div>' . $wpcf_strings['name'] . ' <div class="contactleft"><label for="wpcf_email">' . __('Your Email:', 'wpcf') . '</label></div>' . $wpcf_strings['email'] . ' <div class="contactleft"><label for="wpcf_website">' . __('Your Website:', 'wpcf') . '</label></div><div class="contactright"><input type="text" name="wpcf_website" id="wpcf_website" size="30" maxlength="100" value="' . $_POST['wpcf_website'] . '" /></div> <div class="contactleft"><label for="wpcf_msg">' . __('Your Message: ', 'wpcf') . '</label></div>' . $wpcf_strings['msg'] . ' <div class="contactright"><input type="submit" name="Submit" value="' . __('Submit', 'wpcf') . '" id="contactsubmit" /><input type="hidden" name="wpcf_stage" value="process" /></div> </form> </div> <div style="clear:both; height:1px;"> </div>'; return str_replace('<!--contact form-->', $form, $content); }}