Changeset 485904
- Timestamp:
- 01/06/2012 11:45:44 PM (14 years ago)
- Location:
- contact-form-7-bwp-recaptcha-extension/trunk
- Files:
-
- 3 edited
-
contact-form-7-bwp-recaptcha-extension.php (modified) (2 diffs)
-
includes/CF7bwpCAPT.class.php (modified) (4 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
contact-form-7-bwp-recaptcha-extension/trunk/contact-form-7-bwp-recaptcha-extension.php
r476973 r485904 4 4 Plugin URI: http://www.manfersite.tk/cf7bwpcapt 5 5 Description: Provides Better WordPress reCAPTCHA possibilities to the Contact Form 7 plugin. Requires both. 6 Version: 0. 26 Version: 0.3 7 7 Author: Fernando San Julián 8 8 Email: manfer.site@gmail.com … … 31 31 // this is the 'driver' file that instantiates the object 32 32 define( 'ALLOW_CF7_BWP_CAPT_INCLUDE', true ); 33 define( 'CF7BWPRECAPT_VERSION', '0. 2' );33 define( 'CF7BWPRECAPT_VERSION', '0.3' ); 34 34 define( 'CF7BWPRECAPT_URL', 'http://www.manfersite.tk/cf7bwpcapt' ); 35 35 define( 'CF7BWPRECAPT_TITLE', 'Contact Form 7 BWP reCAPTCHA Extension' ); -
contact-form-7-bwp-recaptcha-extension/trunk/includes/CF7bwpCAPT.class.php
r476971 r485904 173 173 'white' => __( 'White', $this->textdomain ), 174 174 'blackglass' => __( 'Black Glass', $this->textdomain ), 175 'clean' => __( 'Clean', $this->textdomain ) 175 'clean' => __( 'Clean', $this->textdomain ), 176 'custom' => __( 'Custom', $this->textdomain ) 176 177 ); 177 178 … … 197 198 __( 'White', $this->textdomain ) => 'white', 198 199 __( 'Black Glass', $this->textdomain ) => 'blackglass', 199 __( 'Clean', $this->textdomain ) => 'clean' 200 __( 'Clean', $this->textdomain ) => 'clean', 201 __( 'Custom', $this->textdomain ) => 'custom' 200 202 ); 201 203 … … 293 295 'white', 294 296 'blackglass', 295 'clean' 297 'clean', 298 'custom' 296 299 ); 297 300 … … 411 414 global $wpcf7_contact_form, $bwp_capt; 412 415 413 if ( $bwp_capt->user_can_bypass() ) return '';414 415 416 $name = $tag[ 'name' ]; 416 417 417 // Get Better Wordpress Recaptcha options to obtain current language 418 $bwp_capt_options = get_option( 'bwp_capt_theme' ); 419 420 // default options if not configured 421 $used_theme = 'red'; 422 $used_language = 'en'; 423 424 if ( $this->options[ 'select_theme' ] === 'bwp_capt' 425 && isset( $bwp_capt_options[ 'select_theme' ] ) ) { 426 $used_theme = $bwp_capt_options[ 'select_theme' ]; 427 } elseif ( $this->options[ 'select_theme' ] === 'cf7' 418 // set bwp recaptcha options to cf7 bwp recaptcha options 419 $bwp_capt_theme = $bwp_capt->options['select_theme']; 420 $bwp_capt_lang = $bwp_capt->options['select_lang']; 421 422 if ( $this->options[ 'select_theme' ] === 'cf7' 428 423 && isset( $this->options[ 'cf7_theme' ] ) ) { 429 $used_theme = $this->options[ 'cf7_theme' ]; 430 } 431 432 if ( $this->options[ 'select_lang' ] === 'bwp_capt' 433 && isset( $bwp_capt_options[ 'select_lang' ] ) ) { 434 $used_language = $bwp_capt_options[ 'select_lang' ]; 435 } elseif ( $this->options[ 'select_lang' ] === 'cf7' 424 $bwp_capt->options['select_theme'] = $this->options[ 'cf7_theme' ]; 425 } 426 427 if ( $this->options[ 'select_lang' ] === 'cf7' 436 428 && isset( $this->options[ 'cf7_lang' ] ) ) { 437 $used_language = $this->options[ 'cf7_lang' ]; 438 } 439 440 $js_options = <<<JSOPTS 441 <script type='text/javascript'> 442 var RecaptchaOptions = { theme : '{$used_theme}', lang : '{$used_language}'}; 443 </script> 444 JSOPTS; 445 446 $html = $js_options; 447 448 if ( function_exists( 'recaptcha_get_html' ) && !defined( 'BWP_CAPT_ADDED' ) ) { 449 450 // make sure we add only one recaptcha instance 451 define( 'BWP_CAPT_ADDED', true ); 452 453 $captcha_error = ''; 454 if ( ! empty( $_GET[ 'cerror' ] ) && 'incorrect-captcha-sol' == $_GET[ 'cerror' ] ) 455 $captcha_error = $_GET[ 'cerror' ]; 456 457 if ( ! empty( $_SESSION[ 'bwp_capt_akismet_needed' ]) && 'yes' == $_SESSION[ 'bwp_capt_akismet_needed' ] ) { 458 $html .= '<p class="bwp-capt-spam-identified">' . _e( 'Your comment was identified as spam, please complete the CAPTCHA below:', 'bwp-recaptcha' ) . '</p>'; 459 } 460 461 do_action( 'bwp_capt_before_add_captcha' ); 462 463 if ( 'redirect' == $bwp_capt->options[ 'select_response' ] && ! is_admin() ) { 464 $html .= '<input type="hidden" name="error_redirect_to" value="' . esc_attr_e( $bwp_capt->get_current_comment_page_link() ) . '" />'; 465 } 466 467 $use_ssl = ( isset( $_SERVER[ 'HTTPS' ]) && 'on' == $_SERVER[ 'HTTPS' ] ) ? true : false; 468 if ( ! empty( $bwp_capt->options[ 'input_pubkey' ] ) ) 469 $html .= recaptcha_get_html( $bwp_capt->options[ 'input_pubkey' ], $captcha_error, $use_ssl ); 470 elseif ( current_user_can( 'manage_options' ) ) 471 $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>", 'bwp-recaptcha' ); 472 } 429 $bwp_capt->options['select_lang'] = $this->options[ 'cf7_lang' ]; 430 } 431 432 // add_recaptcha function outputs directly so we have to buffer 433 // that to store it in a variable instead. 434 ob_start(); 435 $bwp_capt->add_recaptcha(); 436 $html = ob_get_contents(); 437 ob_end_clean(); 438 439 // restore bwp recaptcha options 440 $bwp_capt->options['select_theme'] = $bwp_capt_theme; 441 $bwp_capt->options['select_lang'] = $bwp_capt_lang; 442 473 443 474 444 $validation_error = ''; 475 445 if ( is_a( $wpcf7_contact_form, 'WPCF7_ContactForm' ) ) 476 $validation_error = $wpcf7_contact_form->validation_error( $name );446 $validation_error = $wpcf7_contact_form->validation_error( $name ); 477 447 478 448 $html .= '<span class="wpcf7-form-control-wrap ' . $name . '">' . $validation_error . '</span>'; 479 480 449 return $html; 450 481 451 } 482 452 -
contact-form-7-bwp-recaptcha-extension/trunk/readme.txt
r476973 r485904 5 5 Requires at least: 2.9 6 6 Tested up to: 3.1.3 7 Stable tag: 0. 27 Stable tag: 0.3 8 8 9 9 This plugin provides a new tag for the Contact Form 7 Plugin. It allows the usage of a reCAPTCHA field provided by the BWP reCAPTCHA Plugin. … … 66 66 == Changelog == 67 67 68 = 0.3 (20120106) = 69 * Added support for custom theme. 70 * Better integration with BWP Recaptcha. 71 72 = 0.2 (20111218) = 73 * Updated language file. 74 68 75 = 0.1 (20111217) = 69 76 * Total rewrite to stop using some code I don't want to use anymore.
Note: See TracChangeset
for help on using the changeset viewer.