Ejemplo n.º 1
0
        function shortcode_handler($tag)
        {
            global $wpcf7_contact_form, $bwp_capt, $recaptcha;
            if ($this->recaptcha_tool === CF7reCAPTCHA::RECAPTCHATOOL_BWP_RECAPTCHA && $bwp_capt->user_can_bypass() || $this->recaptcha_tool === CF7reCAPTCHA::RECAPTCHATOOL_WP_RECAPTCHA && $this->wp_recaptcha_user_can_bypass()) {
                return '';
            }
            $name = $tag['name'];
            $recaptcha_options = WPASDPlugin::retrieve_options($this->recaptcha_options_name[$this->recaptcha_tool]);
            $used_theme = '';
            $used_language = '';
            if ($this->options[$this->theme_option_name[$this->recaptcha_tool]] === 'cf7recapext_theme' && isset($this->options['cf7recapext_theme'])) {
                $used_theme = $this->options['cf7recapext_theme'];
            } elseif (isset($recaptcha_options[$this->options[$this->theme_option_name[$this->recaptcha_tool]]])) {
                $used_theme = $recaptcha_options[$this->options[$this->theme_option_name[$this->recaptcha_tool]]];
            } else {
                $used_theme = 'red';
            }
            if ($this->options[$this->language_option_name[$this->recaptcha_tool]] === 'cf7recapext' && isset($this->options['cf7recapext_language'])) {
                $used_language = $this->options['cf7recapext_language'];
            } elseif (isset($recaptcha_options[$this->options[$this->language_option_name[$this->recaptcha_tool]]])) {
                $used_language = $recaptcha_options[$this->options[$this->language_option_name[$this->recaptcha_tool]]];
            } else {
                $used_language = 'en';
            }
            $js_options = <<<JSOPTS
\t    <script type='text/javascript'>
\t\tvar RecaptchaOptions = { theme : '{$used_theme}', lang : '{$used_language}'};
\t    </script>
JSOPTS;
            $html = $js_options;
            if ($this->recaptcha_tool === CF7reCAPTCHA::RECAPTCHATOOL_WP_RECAPTCHA) {
                $use_ssl = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on';
                $html .= $recaptcha->get_recaptcha_html(null, $use_ssl);
            } elseif ($this->recaptcha_tool === CF7reCAPTCHA::RECAPTCHATOOL_BWP_RECAPTCHA) {
                require_once dirname(__FILE__) . '/../../bwp-recaptcha/includes/recaptcha/recaptchalib.php';
                if (function_exists('recaptcha_get_html') && !defined('BWP_CAPT_ADDED')) {
                    // make sure we add only one recaptcha instance
                    define('BWP_CAPT_ADDED', true);
                    $captcha_error = '';
                    if (!empty($_GET['cerror']) && 'incorrect-captcha-sol' == $_GET['cerror']) {
                        $captcha_error = $_GET['cerror'];
                    }
                    if (!empty($_SESSION['bwp_capt_akismet_needed']) && 'yes' == $_SESSION['bwp_capt_akismet_needed']) {
                        $html .= '<p class="bwp-capt-spam-identified">' . _e('Your comment was identified as spam, please complete the CAPTCHA below:', $this->textdomain_name) . '</p>';
                    }
                    do_action('bwp_capt_before_add_captcha');
                    if ('redirect' == $bwp_capt->options['select_response'] && !is_admin()) {
                        $html .= '<input type="hidden" name="error_redirect_to" value="' . esc_attr_e($bwp_capt->get_current_comment_page_link()) . '" />';
                    }
                    $use_ssl = isset($_SERVER['HTTPS']) && 'on' == $_SERVER['HTTPS'] ? true : false;
                    if (!empty($bwp_capt->options['input_pubkey'])) {
                        $html .= recaptcha_get_html($bwp_capt->options['input_pubkey'], $captcha_error, $use_ssl);
                    } else {
                        if (current_user_can('manage_options')) {
                            $html .= _e("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>", $this->textdomain_name);
                        }
                    }
                }
            }
            $validation_error = '';
            if (is_a($wpcf7_contact_form, 'WPCF7_ContactForm')) {
                $validation_error = $wpcf7_contact_form->validation_error($name);
            }
            $html .= '<span class="wpcf7-form-control-wrap ' . $name . '">' . $validation_error . '</span>';
            return $html;
        }
Ejemplo n.º 2
0
<?php

if (!defined('WP_UNINSTALL_PLUGIN')) {
    exit;
}
require_once 'includes/WPASDPlugin.class.php';
if (class_exists('WPASDPlugin')) {
    WPASDPlugin::uninstall_options('cf7_recaptcha_options');
}
Ejemplo n.º 3
0
 protected static function debugValue($header, $value, $file = null, $line = null)
 {
     WPASDPlugin::toDebugBar('print', $header, $value, $file, $line);
 }