Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
09/14/2016 05:06:11 PM (8 years ago)
Author:
r-a-y
Message:

Activity: Move Akismet loader to bp-activity-akismet.php.

Previously, bp_activity_setup_akismet() was placed in
bp-activity-actions.php. The actions file isn't a proper place to put
this code.

This commit moves this function to bp-activity-akismet.php and also
removes some duplicate conditional code. BP_Activity_Component already
checks if Akismet is loaded, so no need to re-duplicate this logic.

This is part of some prep work to conditionally load a component's action
and screen code when necessary.

See #7218.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-activity/classes/class-bp-activity-component.php

    r11080 r11102  
    7373        $akismet_key = bp_get_option( 'wordpress_api_key' );
    7474
    75         /** This filter is documented in bp-activity/bp-activity-actions.php */
     75        /** This filter is documented in bp-activity/bp-activity-akismet.php */
    7676        if ( defined( 'AKISMET_VERSION' ) && class_exists( 'Akismet' ) && ( ! empty( $akismet_key ) || defined( 'WPCOM_API_KEY' ) ) && apply_filters( 'bp_activity_use_akismet', bp_is_akismet_active() ) ) {
    7777            $includes[] = 'akismet';
     
    371371
    372372    /**
    373      * Set up actions necessary for the component.
    374      *
    375      * @since 1.6.0
    376      */
    377     public function setup_actions() {
    378 
    379         // Spam prevention.
    380         add_action( 'bp_include', 'bp_activity_setup_akismet' );
    381 
    382         parent::setup_actions();
    383     }
    384 
    385     /**
    386373     * Setup cache groups.
    387374     *
Note: See TracChangeset for help on using the changeset viewer.