Changeset 556588
- Timestamp:
- 06/12/2012 09:59:38 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
contact-form-7-bwp-recaptcha-extension/trunk/includes/CF7bwpCAPT.class.php
r556016 r556588 13 13 14 14 // member variables 15 private $requirements_met;16 private $is_bwp_capt_active;17 private $is_cf7_active;18 15 private $textdomain; 19 16 private $options_name; … … 38 35 $this->options_name = $options; 39 36 $this->options = get_option( $options ); 40 $this->requirements_met = $this->meets_requirements();41 37 42 38 // register settings page … … 49 45 50 46 // register tag generator 51 if ( $this-> requirements_met) {47 if ( $this->meets_requirements() ) { 52 48 add_action( 'admin_init', array( &$this, 'tag_generator_recaptcha' ), 46 ); 53 49 add_action( 'admin_init', array( &$this, 'cf7_bwp_capt_register_styles' ) ); … … 55 51 56 52 // register validation filter 57 if ( $this-> requirements_met) {53 if ( $this->meets_requirements() ) { 58 54 add_filter( 'wpcf7_validate_recaptcha', array( &$this, 'recaptcha_validation_filter' ), 10, 2 ); 59 55 add_filter( 'wpcf7_ajax_json_echo', array( &$this, 'ajax_json_echo_filter' ) ); … … 69 65 */ 70 66 function register_cf7_shortcode() { 71 if ( function_exists( 'wpcf7_add_shortcode' ) && $this-> requirements_met) {67 if ( function_exists( 'wpcf7_add_shortcode' ) && $this->meets_requirements() ) { 72 68 wpcf7_add_shortcode( 'recaptcha', array( &$this, 'shortcode_handler' ), true ); 73 69 } … … 395 391 */ 396 392 function tag_generator_recaptcha() { 397 if ( function_exists( 'wpcf7_add_tag_generator' ) && $this-> requirements_met) {393 if ( function_exists( 'wpcf7_add_tag_generator' ) && $this->meets_requirements() ) { 398 394 wpcf7_add_tag_generator( 399 395 'recaptcha', // name … … 465 461 <table> 466 462 467 <?php if ( ! $this-> requirements_met) : ?>463 <?php if ( ! $this->meets_requirements() ) : ?> 468 464 <tr> 469 465 <td colspan="2"> … … 503 499 */ 504 500 function meets_requirements() { 505 if ( ! isset( $this->requirements_met ) ) {506 $this->requirements_met = $this->check_bwp_capt() && $this->check_cf7();507 }508 509 return $ this->requirements_met;501 static $requirements_met; 502 if ( ! isset( $requirements_met ) ) { 503 $requirements_met = $this->check_bwp_capt() && $this->check_cf7(); 504 } 505 return $requirements_met; 510 506 } 511 507 … … 514 510 */ 515 511 function check_bwp_capt() { 516 include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); 517 $this->is_bwp_capt_active = is_plugin_active('bwp-recaptcha/bwp-recaptcha.php'); 518 return $this->is_bwp_capt_active; 512 static $is_bwp_capt_active; 513 if ( ! isset( $is_bwp_capt_active ) ) { 514 include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); 515 $is_bwp_capt_active = is_plugin_active('bwp-recaptcha/bwp-recaptcha.php'); 516 } 517 return $is_bwp_capt_active; 519 518 } 520 519 … … 523 522 */ 524 523 function check_cf7() { 525 include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); 526 $this->is_cf7_active = is_plugin_active('contact-form-7/wp-contact-form-7.php'); 527 return $this->is_cf7_active; 524 static $is_cf7_active; 525 if ( ! isset( $is_cf7_active ) ) { 526 include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); 527 $is_cf7_active = is_plugin_active('contact-form-7/wp-contact-form-7.php'); 528 } 529 return $is_cf7_active; 528 530 } 529 531 … … 534 536 global $plugin_page; 535 537 536 if ( ! $this-> is_cf7_active) :538 if ( ! $this->check_cf7() ) : 537 539 ?> 538 540 … … 547 549 endif; 548 550 549 if ( ! $this-> is_bwp_capt_active) :551 if ( ! $this->check_bwp_capt() ) : 550 552 551 553 ?>
Note: See TracChangeset
for help on using the changeset viewer.