/** * Check form input * * @param $captcha * @param $errors * * @return mixed */ function wpmtst_captcha_check($captcha, $errors) { switch ($captcha) { // Captcha by BestWebSoft case 'bwsmath': if (function_exists('cptch_check_custom_form') && cptch_check_custom_form() !== true) { $errors['captcha'] = __('The Captcha failed. Please try again.', 'strong-testimonials'); } break; // Really Simple Captcha by Takayuki Miyoshi // Really Simple Captcha by Takayuki Miyoshi case 'miyoshi': if (class_exists('ReallySimpleCaptcha')) { $captcha_instance = new ReallySimpleCaptcha(); $prefix = isset($_POST['captchac']) ? (string) $_POST['captchac'] : ''; $response = isset($_POST['captchar']) ? (string) $_POST['captchar'] : ''; $correct = $captcha_instance->check($prefix, $response); if (!$correct) { $errors['captcha'] = __('The Captcha failed. Please try again.', 'strong-testimonials'); } // remove the temporary image and text files (except on Windows) if ('127.0.0.1' != $_SERVER['SERVER_ADDR']) { $captcha_instance->remove($prefix); } } break; // Advanced noCaptcha reCaptcha by Shamim Hasan // Advanced noCaptcha reCaptcha by Shamim Hasan case 'advnore': if (function_exists('anr_verify_captcha') && !anr_verify_captcha()) { $errors['captcha'] = __('The Captcha failed. Please try again.', 'strong-testimonials'); } break; default: } return $errors; }
function anr_item_send_friend_check($item) { if ('1' != anr_get_option('send_friend')) { return; } if (!anr_verify_captcha()) { $error_message = trim(osc_get_preference('error_message', 'plugin-anr_nocaptcha')); osc_add_flash_error_message($error_message); View::newInstance()->_exportVariableToView('item', $item); osc_redirect_to(osc_item_send_friend_url()); } }