Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/06/2015 10:23:53 PM (10 years ago)
Author:
r-a-y
Message:

Activity: Support only Akismet v3+.

For those using Akismet v3.0.x, notices started appearing due to Akismet
deprecating some older functions that were in use by the BP Activity
Akismet module.

Since Akismet 2.6.0 was released more than a year ago, we are upgrading
all calls in the BP Activity Akismet module to the new Akismet API. For
BuddyPress 2.3+, the BP Activity Akismet module will require at least
Akismet v3+.

Fixes #6191.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-activity/bp-activity-akismet.php

    r9834 r9843  
    1515 *
    1616 * @since BuddyPress (1.6.0)
     17 * @since BuddyPress (2.3.0) We only support Akismet 3+.
    1718 */
    1819class BP_Akismet {
     
    340341        $activity_data['permalink']             = bp_activity_get_permalink( $activity->id, $activity );
    341342        $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 );
    343344
    344345        /**
     
    496497     * @since BuddyPress (1.6.0)
    497498     *
    498      * @global string $akismet_api_host
    499      * @global string $akismet_api_port
    500      *
    501499     * @param array  $activity_data Packet of information to submit to Akismet.
    502500     * @param string $check         "check" or "submit".
     
    506504     */
    507505    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 them
    511         if ( function_exists( 'akismet_init' ) && ( empty( $akismet_api_host ) || empty( $akismet_api_port ) ) )
    512             akismet_init();
    513 
    514506        $query_string = $path = '';
    515507
     
    521513        $activity_data['user_ip']      = bp_core_current_user_ip();
    522514
    523         if ( akismet_test_mode() )
     515        if ( Akismet::is_test_mode() )
    524516            $activity_data['is_test'] = 'true';
    525517
     
    549541
    550542        if ( 'check' == $check )
    551             $path = '/1.1/comment-check';
     543            $path = 'comment-check';
    552544        elseif ( 'submit' == $check )
    553             $path = '/1.1/submit-' . $spam;
     545            $path = 'submit-' . $spam;
    554546
    555547        // Send to Akismet
    556548        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 );
    558550        remove_filter( 'akismet_ua', array( $this, 'buddypress_ua' ) );
    559551
     
    635627            'event'   => $event,
    636628            'message' => $message,
    637             'time'    => akismet_microtime(),
     629            'time'    => Akismet::_get_microtime(),
    638630            'user'    => bp_loggedin_user_id(),
    639631        );
Note: See TracChangeset for help on using the changeset viewer.