web/wp-content/plugins/bbpress/includes/core/extend.php
changeset 196 5e8dcbe22c24
equal deleted inserted replaced
195:c7c0fbc09788 196:5e8dcbe22c24
       
     1 <?php
       
     2 
       
     3 /**
       
     4  * bbPress Extentions
       
     5  *
       
     6  * There's a world of really cool plugins out there, and bbPress comes with
       
     7  * support for some of the most popular ones.
       
     8  *
       
     9  * @package bbPress
       
    10  * @subpackage Extend
       
    11  */
       
    12 
       
    13 // Exit if accessed directly
       
    14 if ( !defined( 'ABSPATH' ) ) exit;
       
    15 
       
    16 /**
       
    17  * Loads Akismet inside the bbPress global class
       
    18  *
       
    19  * @since bbPress (r3277)
       
    20  *
       
    21  * @return If bbPress is not active
       
    22  */
       
    23 function bbp_setup_akismet() {
       
    24 
       
    25 	// Bail if no akismet
       
    26 	if ( !defined( 'AKISMET_VERSION' ) ) return;
       
    27 
       
    28 	// Bail if Akismet is turned off
       
    29 	if ( !bbp_is_akismet_active() ) return;
       
    30 
       
    31 	// Include the Akismet Component
       
    32 	require( bbpress()->includes_dir . 'extend/akismet.php' );
       
    33 
       
    34 	// Instantiate Akismet for bbPress
       
    35 	bbpress()->extend->akismet = new BBP_Akismet();
       
    36 }
       
    37 
       
    38 /**
       
    39  * Requires and creates the BuddyPress extension, and adds component creation
       
    40  * action to bp_init hook. @see bbp_setup_buddypress_component()
       
    41  *
       
    42  * @since bbPress (r3395)
       
    43  * @return If BuddyPress is not active
       
    44  */
       
    45 function bbp_setup_buddypress() {
       
    46 
       
    47 	if ( ! function_exists( 'buddypress' ) ) {
       
    48 
       
    49 		/**
       
    50 		 * Helper for BuddyPress 1.6 and earlier
       
    51 		 *
       
    52 		 * @since bbPress (r4395)
       
    53 		 * @return BuddyPress
       
    54 		 */
       
    55 		function buddypress() {
       
    56 			return isset( $GLOBALS['bp'] ) ? $GLOBALS['bp'] : false;
       
    57 		}
       
    58 	}
       
    59 
       
    60 	// Bail if in maintenance mode
       
    61 	if ( ! buddypress() || buddypress()->maintenance_mode )
       
    62 		return;
       
    63 
       
    64 	// Include the BuddyPress Component
       
    65 	require( bbpress()->includes_dir . 'extend/buddypress/loader.php' );
       
    66 
       
    67 	// Instantiate BuddyPress for bbPress
       
    68 	bbpress()->extend->buddypress = new BBP_Forums_Component();
       
    69 }