Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
09/14/2016 05:06:11 PM (10 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/bp-activity-akismet.php

    r10652 r11102  
    1414        require dirname( __FILE__ ) . '/classes/class-bp-akismet.php';
    1515}
     16
     17/**
     18 * Loads Akismet filtering for activity.
     19 *
     20 * @since 1.6.0
     21 * @since 2.3.0 We only support Akismet 3+.
     22 */
     23function bp_activity_setup_akismet() {
     24        /**
     25         * Filters if BuddyPress Activity Akismet support has been disabled by another plugin.
     26         *
     27         * @since 1.6.0
     28         *
     29         * @param bool $value Return value of bp_is_akismet_active boolean function.
     30         */
     31        if ( ! apply_filters( 'bp_activity_use_akismet', bp_is_akismet_active() ) ) {
     32                return;
     33        }
     34
     35        // Instantiate Akismet for BuddyPress.
     36        buddypress()->activity->akismet = new BP_Akismet();
     37}
     38add_action( 'bp_activity_setup_globals', 'bp_activity_setup_akismet' );
    1639
    1740/**
Note: See TracChangeset for help on using the changeset viewer.