Example #1
0
/**
 *  Embeds the reCAPTCHA widget into the comment form.
 * 
 */
function recaptcha_comment_form()
{
    //modify the comment form for the reCAPTCHA widget
    $recaptcha_js_opts = <<<OPTS
\t\t<script type='text/javascript'>
\t\t\tvar RecaptchaOptions = { theme : 'red', tabindex : 5 };
\t\t</script>
OPTS;
    $comment_string = <<<COMMENT_FORM
\t\t<div id="recaptcha-submit-btn-area"></div> 
\t\t<script type='text/javascript'>
\t\t\tvar sub = document.getElementById('submit');
\t\t\tsub.parentNode.removeChild(sub);
\t\t\tdocument.getElementById('recaptcha-submit-btn-area').appendChild (sub);
\t\t\tdocument.getElementById('submit').tabIndex = 6;
\t\t\tif ( typeof _recaptcha_wordpress_savedcomment != 'undefined') {
\t\t\t\tdocument.getElementById('comment').value = _recaptcha_wordpress_savedcomment;
\t\t\t}
\t\t</script>
\t\t<noscript>
\t\t <style type='text/css'>#submit {display:none;}</style>
\t\t <input name="submit" type="submit" id="submit-alt" tabindex="6" value="Submit Comment"/> 
\t\t</noscript>
COMMENT_FORM;
    echo $recaptcha_js_opts . recaptcha_wp_get_html($_GET['rerror']) . $comment_string;
}
Example #2
0
/**
 *  Embeds the reCAPTCHA widget into the comment form.
 * 
 */
function recaptcha_comment_form()
{
    global $user_ID, $recaptcha_opt;
    // set the minimum capability needed to skip the captcha if there is one
    if ($recaptcha_opt['re_bypass'] && $recaptcha_opt['re_bypasslevel']) {
        $needed_capability = $recaptcha_opt['re_bypasslevel'];
    }
    // skip the reCAPTCHA display if the minimum capability is met
    if ($needed_capability && current_user_can($needed_capability) || !$recaptcha_opt['re_comments']) {
        return;
    } else {
        // Did the user fail to match the CAPTCHA? If so, let them know
        if ($_GET['rerror'] == 'incorrect-captcha-sol') {
            echo "<p class=\"recaptcha-error\">" . $recaptcha_opt['error_incorrect'] . "</p>";
        }
        //modify the comment form for the reCAPTCHA widget
        $recaptcha_js_opts = <<<OPTS
\t\t<script type='text/javascript'>
\t\t\t\tvar RecaptchaOptions = { theme : '{$recaptcha_opt['re_theme']}', lang : '{$recaptcha_opt['re_lang']}' , tabindex : {$recaptcha_opt['re_tabindex']} };
\t\t</script>
OPTS;
        if ($recaptcha_opt['re_xhtml']) {
            $comment_string = <<<COMMENT_FORM
\t\t\t\t<div id="recaptcha-submit-btn-area"><br /></div>
\t\t\t\t<script type='text/javascript'>
\t\t\t\tvar sub = document.getElementById('submit');
\t\t\t\tsub.parentNode.removeChild(sub);
\t\t\t\tdocument.getElementById('recaptcha-submit-btn-area').appendChild (sub);
\t\t\t\tdocument.getElementById('submit').tabIndex = 6;
\t\t\t\tif ( typeof _recaptcha_wordpress_savedcomment != 'undefined') {
\t\t\t\t\t\tdocument.getElementById('comment').value = _recaptcha_wordpress_savedcomment;
\t\t\t\t}
\t\t\t\tdocument.getElementById('recaptcha_table').style.direction = 'ltr';
\t\t\t\t</script>
COMMENT_FORM;
        } else {
            $comment_string = <<<COMMENT_FORM
\t\t\t\t<div id="recaptcha-submit-btn-area"></div> 
\t\t\t\t<script type='text/javascript'>
\t\t\t\tvar sub = document.getElementById('submit');
\t\t\t\tsub.parentNode.removeChild(sub);
\t\t\t\tdocument.getElementById('recaptcha-submit-btn-area').appendChild (sub);
\t\t\t\tdocument.getElementById('submit').tabIndex = 6;
\t\t\t\tif ( typeof _recaptcha_wordpress_savedcomment != 'undefined') {
\t\t\t\t\t\tdocument.getElementById('comment').value = _recaptcha_wordpress_savedcomment;
\t\t\t\t}
\t\t\t\tdocument.getElementById('recaptcha_table').style.direction = 'ltr';
\t\t\t\t</script>
\t\t\t\t<noscript>
\t\t\t\t <style type='text/css'>#submit {display:none;}</style>
\t\t\t\t <input name="submit" type="submit" id="submit-alt" tabindex="6" value="Submit Comment"/> 
\t\t\t\t</noscript>
COMMENT_FORM;
        }
        if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") {
            $use_ssl = true;
        } else {
            $use_ssl = false;
        }
        echo $recaptcha_js_opts . recaptcha_wp_get_html($_GET['rerror'], $use_ssl) . $comment_string;
    }
}
</small></p>-->
			<p>
				<textarea name="comment" id="comment" cols="50" rows="10" tabindex="4"></textarea>
			</p>
<!--added by raj-->
<?php 
        if (function_exists('recaptcha_wp_show_captcha_for_comment') && recaptcha_wp_show_captcha_for_comment()) {
            ?>
<script>
var RecaptchaOptions = {
   tabindex : 5
};
</script>

<?php 
            echo recaptcha_wp_get_html();
        }
        // should show captcha
        ?>

<p><input name="submit" type="submit" 
id="submit" tabindex="6" value="Submit Comment" />
<!--end recaptha stuff-->
<!--remove this submit button
			<p>
				<input name="submit" type="submit" id="submit" tabindex="5" value="Submit Comment" /> -->
				<input type="hidden" name="comment_post_ID" value="<?php 
        echo $id;
        ?>
" />
			</p>
Example #4
0
/**
 *  Return the reCAPTCHA widget for embedding in a comment field.
 *  This is the non-AJAX version.
 */
function recaptcha_field()
{
    global $recaptcha_opt;
    $field = '';
    $comment_string = <<<COMMENT_FORM
\t\t\t<script type='text/javascript'>
\t\t\tvar RecaptchaOptions = { theme : '{$recaptcha_opt['re_theme']}', lang : '{$recaptcha_opt['re_lang']}' };
\t\t\tif ( typeof _recaptcha_wordpress_savedcomment != 'undefined') {
\t\t\t\t\tdocument.getElementById('comment').value = _recaptcha_wordpress_savedcomment;
\t\t\t}
\t\t\tdocument.getElementById('recaptcha_table').style.direction = 'ltr';
\t\t\t</script>
COMMENT_FORM;
    if (!$recaptcha_opt['re_xhtml']) {
        $comment_string .= <<<COMMENT_FORM
\t\t\t<noscript>
\t\t\t <style type='text/css'>#submit {display:none;}</style>
\t\t\t <input name="submit" type="submit" id="submit-alt" value="Submit Comment"/>
\t\t\t</noscript>
COMMENT_FORM;
    }
    $use_ssl = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on";
    $field .= $comment_string . recaptcha_wp_get_html($_GET['rerror'], $use_ssl);
    return $field;
}