Changeset 9843
- Timestamp:
- 05/06/2015 10:23:53 PM (10 years ago)
- Location:
- trunk/src/bp-activity
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-activity/bp-activity-actions.php
r9833 r9843 713 713 * 714 714 * @since BuddyPress (1.6.0) 715 * @since BuddyPress (2.3.0) We only support Akismet 3+. 715 716 */ 716 717 function bp_activity_setup_akismet() { … … 718 719 719 720 // Bail if Akismet is not active 720 if ( ! defined( 'AKISMET_VERSION' ) ) 721 if ( ! defined( 'AKISMET_VERSION' ) ) { 721 722 return; 723 } 724 725 // Bail if older version of Akismet 726 if ( ! class_exists( 'Akismet' ) ) { 727 return; 728 } 722 729 723 730 // Bail if no Akismet key is set 724 if ( ! bp_get_option( 'wordpress_api_key' ) && ! defined( 'WPCOM_API_KEY' ) ) 731 if ( ! bp_get_option( 'wordpress_api_key' ) && ! defined( 'WPCOM_API_KEY' ) ) { 725 732 return; 733 } 726 734 727 735 /** … … 732 740 * @param bool $value Return value of bp_is_akismet_active boolean function. 733 741 */ 734 if ( ! apply_filters( 'bp_activity_use_akismet', bp_is_akismet_active() ) ) 742 if ( ! apply_filters( 'bp_activity_use_akismet', bp_is_akismet_active() ) ) { 735 743 return; 744 } 736 745 737 746 // Instantiate Akismet for BuddyPress -
trunk/src/bp-activity/bp-activity-akismet.php
r9834 r9843 15 15 * 16 16 * @since BuddyPress (1.6.0) 17 * @since BuddyPress (2.3.0) We only support Akismet 3+. 17 18 */ 18 19 class BP_Akismet { … … 340 341 $activity_data['permalink'] = bp_activity_get_permalink( $activity->id, $activity ); 341 342 $activity_data['user_ID'] = $userdata->ID; 342 $activity_data['user_role'] = akismet_get_user_roles( $userdata->ID );343 $activity_data['user_role'] = Akismet::get_user_roles( $userdata->ID ); 343 344 344 345 /** … … 496 497 * @since BuddyPress (1.6.0) 497 498 * 498 * @global string $akismet_api_host499 * @global string $akismet_api_port500 *501 499 * @param array $activity_data Packet of information to submit to Akismet. 502 500 * @param string $check "check" or "submit". … … 506 504 */ 507 505 public function send_akismet_request( $activity_data, $check = 'check', $spam = 'spam' ) { 508 global $akismet_api_host, $akismet_api_port;509 510 // Check that host and port are set, if not, set them511 if ( function_exists( 'akismet_init' ) && ( empty( $akismet_api_host ) || empty( $akismet_api_port ) ) )512 akismet_init();513 514 506 $query_string = $path = ''; 515 507 … … 521 513 $activity_data['user_ip'] = bp_core_current_user_ip(); 522 514 523 if ( akismet_test_mode() )515 if ( Akismet::is_test_mode() ) 524 516 $activity_data['is_test'] = 'true'; 525 517 … … 549 541 550 542 if ( 'check' == $check ) 551 $path = ' /1.1/comment-check';543 $path = 'comment-check'; 552 544 elseif ( 'submit' == $check ) 553 $path = ' /1.1/submit-' . $spam;545 $path = 'submit-' . $spam; 554 546 555 547 // Send to Akismet 556 548 add_filter( 'akismet_ua', array( $this, 'buddypress_ua' ) ); 557 $response = akismet_http_post( $query_string, $akismet_api_host, $path, $akismet_api_port);549 $response = Akismet::http_post( $query_string, $path ); 558 550 remove_filter( 'akismet_ua', array( $this, 'buddypress_ua' ) ); 559 551 … … 635 627 'event' => $event, 636 628 'message' => $message, 637 'time' => akismet_microtime(),629 'time' => Akismet::_get_microtime(), 638 630 'user' => bp_loggedin_user_id(), 639 631 ); -
trunk/src/bp-activity/bp-activity-loader.php
r9834 r9843 63 63 64 64 /** This filter is documented in bp-activity/bp-activity-actions.php */ 65 if ( defined( 'AKISMET_VERSION' ) && ( !empty( $akismet_key ) || defined( 'WPCOM_API_KEY' ) ) && apply_filters( 'bp_activity_use_akismet', bp_is_akismet_active() ) ) {65 if ( defined( 'AKISMET_VERSION' ) && class_exists( 'Akismet' ) && ( ! empty( $akismet_key ) || defined( 'WPCOM_API_KEY' ) ) && apply_filters( 'bp_activity_use_akismet', bp_is_akismet_active() ) ) { 66 66 $includes[] = 'akismet'; 67 67 }
Note: See TracChangeset
for help on using the changeset viewer.