/** * Selector for recaptcha theme */ public function select_theme() { $option_name = 'recaptcha_theme'; $grecaptcha_themes = WP_reCaptcha_NoCaptcha::instance()->get_supported_themes(); $grecaptcha_themes = array_map(array($this, '_map_grecaptcha'), $grecaptcha_themes); $recaptcha_themes = WP_reCaptcha_ReCaptcha::instance()->get_supported_themes(); $recaptcha_themes = array_map(array($this, '_map_recaptcha'), $recaptcha_themes); $themes = $grecaptcha_themes + $recaptcha_themes; $option_theme = WP_reCaptcha::instance()->get_option($option_name); $option_flavor = WP_reCaptcha::instance()->get_option('recaptcha_flavor'); ?> <div class="recaptcha-select-theme"><?php foreach ($themes as $value => $theme) { extract($theme); // label, flavor ?> <div class="theme-item flavor-<?php echo $flavor; ?> "><?php ?> <input <?php checked($value, $option_theme, true); ?> id="<?php echo "{$option_name}-{$value}"; ?> " type="radio" name="<?php echo $option_name; ?> " value="<?php echo $value; ?> " /><?php ?> <label for="<?php echo "{$option_name}-{$value}"; ?> "><?php ?> <span class="title"><?php echo $label; ?> </span><?php if ($value == 'custom') { ?> <span class="visual"><?php _e('Unstyled HTML to apply your own Stylesheets.', 'wp-recaptcha-integration'); ?> </span><?php } else { $src = plugins_url("images/{$flavor}-theme-{$value}.png", dirname(__FILE__)); printf('<img src="%s" alt="%s" />', $src, $label); } ?> </label><?php ?> </div><?php } ?> </div><?php ?> </div><?php }
/** * Set current captcha instance and return it. * * @param string captcha flavor. 'grecaptcha' (noCaptcha) or 'recaptcha' (reCaptcha) * @return object WP_reCaptcha_Captcha */ public function captcha_instance_by_flavor($flavor) { switch ($flavor) { case 'grecaptcha': return WP_reCaptcha_NoCaptcha::instance(); case 'recaptcha': return WP_reCaptcha_ReCaptcha::instance(); } }