'; echo '
';
echo '
';
echo '';
echo '
';
echo '
';
echo '';
echo '
';
echo '
';
echo '';
echo '
'; echo '
'; echo ''; echo ''; echo ''; } /* Validate contact form input and ReCaptcha solution and mail contents to admin mail @since 0.0.1 @changed 0.1.0 */ function arcf_validation() { if (isset($_POST['arcf-submitted'])) { $name = sanitize_text_field($_POST["arcf-name"]); $email = sanitize_email($_POST["arcf-email"]); $message = esc_textarea($_POST["arcf-message"]); $to = esc_attr(get_option('arcf_mailto')); $subject = esc_attr(get_option('arcf_subject')); $privatekey = esc_attr(get_option('arcf_privatekey')); $headers = "From: $name <$email>" . "\r\n"; $headers .= "Reply-To: <$email>"; $captcha; if (isset($_POST['g-recaptcha-response'])) { $captcha = $_POST['g-recaptcha-response']; } if (!$captcha) { echo '' . __('The form was successfully sent.', 'antirobot-contact-form') . '
'; echo '' . __('An unexpected error occured. If this problem persists, please contact the webmaster.', 'antirobot-contact-form') . '
'; } } } } /* Register recaptcha_2_contact_form shortcode to use in pages or posts @since 0.0.1 */ function arcf_shortcode() { ob_start(); arcf_add_recaptcha(); arcf_validation(); arcf_frontend(); return ob_get_clean(); } add_shortcode('antirobot_contact_form', 'arcf_shortcode'); /* Register backend option page @since 0.0.2 @changed 0.1.0 */ add_action('admin_menu', 'arcf_setup_menu'); add_action('admin_init', 'arcf_register_settings'); function arcf_register_settings() { register_setting('arcf-option-group', 'arcf_publickey'); register_setting('arcf-option-group', 'arcf_privatekey'); register_setting('arcf-option-group', 'arcf_mailto'); register_setting('arcf-option-group', 'arcf_subject'); } function arcf_setup_menu() { add_options_page('AntiRobot Contact Form', 'AntiRobot Contact Form', 'manage_options', 'antirobot-contact-form', 'arcf_init'); } /* Display backend settings page @since 0.0.2 @changed 0.1.0 */ function arcf_init() { ?>[antirobot_contact_form] on pages or posts to display the contact form.', 'antirobot-contact-form'); ?>