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-actions.php

    r11091 r11102  
    604604}
    605605add_action( 'bp_actions', 'bp_activity_action_favorites_feed' );
    606 
    607 /**
    608  * Loads Akismet filtering for activity.
    609  *
    610  * @since 1.6.0
    611  * @since 2.3.0 We only support Akismet 3+.
    612  */
    613 function bp_activity_setup_akismet() {
    614         $bp = buddypress();
    615 
    616         // Bail if Akismet is not active.
    617         if ( ! defined( 'AKISMET_VERSION' ) ) {
    618                 return;
    619         }
    620 
    621         // Bail if older version of Akismet.
    622         if ( ! class_exists( 'Akismet' ) ) {
    623                 return;
    624         }
    625 
    626         // Bail if no Akismet key is set.
    627         if ( ! bp_get_option( 'wordpress_api_key' ) && ! defined( 'WPCOM_API_KEY' ) ) {
    628                 return;
    629         }
    630 
    631         /**
    632          * Filters if BuddyPress Activity Akismet support has been disabled by another plugin.
    633          *
    634          * @since 1.6.0
    635          *
    636          * @param bool $value Return value of bp_is_akismet_active boolean function.
    637          */
    638         if ( ! apply_filters( 'bp_activity_use_akismet', bp_is_akismet_active() ) ) {
    639                 return;
    640         }
    641 
    642         // Instantiate Akismet for BuddyPress.
    643         $bp->activity->akismet = new BP_Akismet();
    644 }
    645606
    646607/**
Note: See TracChangeset for help on using the changeset viewer.