Skip to:
Content

BuddyPress.org

Changeset 4137


Ignore:
Timestamp:
03/12/2011 09:25:51 PM (14 years ago)
Author:
djpaul
Message:

Swap function_exists checks to bp_is_active. Fixes #2718

Location:
trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-cache.php

    r3955 r4137  
    3131function bp_core_add_global_group() {
    3232    wp_cache_init();
    33 
    34     if ( function_exists( 'wp_cache_add_global_groups' ) )
    35         wp_cache_add_global_groups( array( 'bp' ) );
     33    wp_cache_add_global_groups( array( 'bp' ) );
    3634}
    3735add_action( 'bp_loaded', 'bp_core_add_global_group' );
  • trunk/bp-core/bp-core-wpabstraction.php

    r3947 r4137  
    7171}
    7272
    73 /**
    74  * bp_core_is_main_site
    75  *
    76  * Checks if current blog is root blog of site. Deprecated in 1.3.
    77  *
    78  * @deprecated 1.3
    79  * @deprecated Use is_multisite()
    80  * @package BuddyPress
    81  * @param int $blog_id optional blog id to test (default current blog)
    82  * @return bool True if not multisite or $blog_id is main site
    83  * @since 1.2.6
    84  */
    85 function bp_core_is_main_site( $blog_id = '' ) {
    86     _deprecated_function( __FUNCTION__, '1.3', 'is_main_site()' );
    87     return is_main_site( $blog_id );
    88 }
    89 
    9073function bp_core_get_status_sql( $prefix = false ) {
    9174    if ( !is_multisite() )
     
    9477        return "{$prefix}spam = 0 AND {$prefix}deleted = 0 AND {$prefix}user_status = 0";
    9578}
    96 
    97 
    9879?>
  • trunk/bp-core/deprecated/1.3.php

    r4053 r4137  
    3030    _deprecated_function( __FUNCTION__, '1.3', 'is_multisite()' );
    3131    return is_multisite();
     32}
     33
     34/**
     35 * bp_core_is_main_site
     36 *
     37 * Checks if current blog is root blog of site. Deprecated in 1.3.
     38 *
     39 * @deprecated 1.3
     40 * @deprecated Use is_main_site()
     41 * @package BuddyPress
     42 * @param int $blog_id optional blog id to test (default current blog)
     43 * @return bool True if not multisite or $blog_id is main site
     44 * @since 1.2.6
     45 */
     46function bp_core_is_main_site( $blog_id = '' ) {
     47    _deprecated_function( __FUNCTION__, '1.3', 'is_main_site()' );
     48    return is_main_site( $blog_id );
    3249}
    3350
  • trunk/bp-forums/bp-forums-screens.php

    r4088 r4137  
    1818
    1919        // Check to see if the user has posted a new topic from the forums page.
    20         if ( isset( $_POST['submit_topic'] ) && function_exists( 'bp_forums_new_topic' ) ) {
     20        if ( isset( $_POST['submit_topic'] ) && bp_is_active( 'forums' ) ) {
    2121            check_admin_referer( 'bp_forums_new_topic' );
    2222
  • trunk/bp-friends/bp-friends-activity.php

    r4041 r4137  
    3434    global $bp;
    3535
    36     if ( function_exists('bp_activity_delete_by_item_id') ) {
     36    if ( bp_is_active( 'activity' ) ) {
    3737        extract( (array)$args );
    3838        bp_activity_delete_by_item_id( array( 'item_id' => $item_id, 'component' => $bp->friends->id, 'type' => $type, 'user_id' => $user_id, 'secondary_item_id' => $secondary_item_id ) );
  • trunk/bp-friends/bp-friends-template.php

    r3841 r4137  
    134134                <h5><?php echo bp_core_get_userlink( $user_ids['users'][$i]->user_id ) ?></h5>
    135135
    136                 <?php if ( function_exists( 'xprofile_get_random_profile_data' ) ) { ?>
     136                <?php if ( bp_is_active( 'xprofile' ) ) { ?>
    137137
    138138                    <?php $random_data = xprofile_get_random_profile_data( $user_ids['users'][$i]->user_id, true ); ?>
     
    149149                <div class="action">
    150150
    151                     <?php if ( function_exists( 'bp_add_friend_button' ) ) { ?>
     151                    <?php if ( bp_is_active( 'friends' ) ) { ?>
    152152
    153153                        <?php bp_add_friend_button( $user_ids['users'][$i]->user_id ) ?>
  • trunk/bp-groups/bp-groups-actions.php

    r3982 r4137  
    8383            } else {
    8484                // Create the forum if enable_forum = 1
    85                 if ( function_exists( 'bp_forums_setup' ) && '' == groups_get_groupmeta( $bp->groups->new_group_id, 'forum_id' ) ) {
     85                if ( bp_is_active( 'forums' ) && '' == groups_get_groupmeta( $bp->groups->new_group_id, 'forum_id' ) ) {
    8686                    groups_new_group_forum();
    8787                }
  • trunk/bp-groups/bp-groups-forums.php

    r3903 r4137  
    2626    $group = new BP_Groups_Group( $group_id );
    2727
    28     if ( empty( $group->enable_forum ) || !function_exists( 'bp_forums_setup' ) )
     28    if ( empty( $group->enable_forum ) || !bp_is_active( 'forums' ) )
    2929        return false;
    3030
     
    120120    if ( $topic = bp_forums_update_topic( array( 'topic_title' => $topic_title, 'topic_text' => $topic_text, 'topic_id' => $topic_id ) ) ) {
    121121        // Update the activity stream item
    122         if ( function_exists( 'bp_activity_delete_by_item_id' ) )
     122        if ( bp_is_active( 'activity' ) )
    123123            bp_activity_delete_by_item_id( array( 'item_id' => $bp->groups->current_group->id, 'secondary_item_id' => $topic_id, 'component' => $bp->groups->id, 'type' => 'new_forum_topic' ) );
    124124
     
    164164
    165165        // Fetch an existing entry and update if one exists.
    166         if ( function_exists( 'bp_activity_get_activity_id' ) )
     166        if ( bp_is_active( 'activity' ) )
    167167            $id = bp_activity_get_activity_id( array( 'user_id' => $post->poster_id, 'component' => $bp->groups->id, 'type' => 'new_forum_post', 'item_id' => $bp->groups->current_group->id, 'secondary_item_id' => $post_id ) );
    168168
     
    195195
    196196        // Delete the activity stream item
    197         if ( function_exists( 'bp_activity_delete' ) )
     197        if ( bp_is_active( 'activity' ) )
    198198            bp_activity_delete( array( 'item_id' => $bp->groups->current_group->id, 'secondary_item_id' => $topic_id, 'component' => $bp->groups->id, 'type' => 'new_forum_topic' ) );
    199199
     
    213213
    214214        // Delete the activity stream item
    215         if ( function_exists( 'bp_activity_delete' ) )
     215        if ( bp_is_active( 'activity' ) )
    216216            bp_activity_delete( array( 'item_id' => $bp->groups->current_group->id, 'secondary_item_id' => $post_id, 'component' => $bp->groups->id, 'type' => 'new_forum_post' ) );
    217217
  • trunk/bp-groups/bp-groups-functions.php

    r3955 r4137  
    256256     * joining/leaving the group in quick succession.
    257257     */
    258     if ( function_exists( 'bp_activity_delete' ) && gmmktime() <= strtotime( '+5 minutes', (int)strtotime( $membership->date_modified ) ) )
     258    if ( bp_is_active( 'activity' ) && gmmktime() <= strtotime( '+5 minutes', (int)strtotime( $membership->date_modified ) ) )
    259259        bp_activity_delete( array( 'component' => $bp->groups->id, 'type' => 'joined_group', 'user_id' => $user_id, 'item_id' => $group_id ) );
    260260
  • trunk/bp-groups/bp-groups-screens.php

    r4124 r4137  
    312312        } else {
    313313            // Posting a topic
    314             if ( isset( $_POST['submit_topic'] ) && function_exists( 'bp_forums_new_topic') ) {
     314            if ( isset( $_POST['submit_topic'] ) && bp_is_active( 'forums' ) ) {
    315315                // Check the nonce
    316316                check_admin_referer( 'bp_forums_new_topic' );
  • trunk/bp-groups/bp-groups-template.php

    r4063 r4137  
    702702            return false;
    703703
    704         if ( !function_exists( 'bp_forums_get_forum_topicpost_count' ) )
     704        if ( !bp_is_active( 'forums' ) )
    705705            return false;
    706706
     
    736736            return false;
    737737
    738         if ( !function_exists( 'bp_forums_get_forum_topicpost_count' ) )
     738        if ( !bp_is_active( 'forums' ) )
    739739            return false;
    740740
     
    760760        $group =& $groups_template->group;
    761761
    762     if ( function_exists( 'bp_forums_is_installed_correctly' ) ) {
     762    if ( bp_is_active( 'forums' ) ) {
    763763        if ( bp_forums_is_installed_correctly() ) {
    764764            if ( $group->enable_forum )
  • trunk/bp-members/bp-members-actions.php

    r3917 r4137  
    7272
    7373        // Hide this user's activity
    74         if ( $is_spam && function_exists( 'bp_activity_hide_user_activity' ) )
     74        if ( $is_spam && bp_is_active( 'activity' ) )
    7575            bp_activity_hide_user_activity( $bp->displayed_user->id );
    7676
  • trunk/bp-members/bp-members-signup.php

    r4094 r4137  
    6161
    6262        // Now we've checked account details, we can check profile information
    63         if ( function_exists( 'xprofile_check_is_required_field' ) ) {
     63        if ( bp_is_active( 'xprofile' ) ) {
    6464
    6565            // Make sure hidden field is passed and populated
     
    396396
    397397        // Set any profile data
    398         if ( function_exists( 'xprofile_set_field_data' ) ) {
     398        if ( bp_is_active( 'xprofile' ) ) {
    399399            if ( !empty( $usermeta['profile_field_ids'] ) ) {
    400400                $profile_field_ids = explode( ',', $usermeta['profile_field_ids'] );
     
    455455
    456456        // Set any profile data
    457         if ( function_exists( 'xprofile_set_field_data' ) ) {
     457        if ( bp_is_active( 'xprofile' ) ) {
    458458            if ( !empty( $user['meta']['profile_field_ids'] ) ) {
    459459                $profile_field_ids = explode( ',', $user['meta']['profile_field_ids'] );
     
    486486    }
    487487
    488     // Support for WP < 3.1
    489     if ( ! function_exists( 'wp_update_user' ) )
    490         require_once( ABSPATH . WPINC . '/registration.php' );
     488    require_once( ABSPATH . WPINC . '/registration.php' );
    491489
    492490    // Update the display_name
     
    534532
    535533    // Add the user's fullname to Xprofile
    536     if ( function_exists( 'xprofile_set_field_data' ) ) {
     534    if ( bp_is_active( 'xprofile' ) ) {
    537535        $firstname = get_user_meta( $user_id, 'first_name', true );
    538536        $lastname = ' ' . get_user_meta( $user_id, 'last_name', true );
  • trunk/bp-members/bp-members-template.php

    r4107 r4137  
    561561    global $members_template;
    562562
    563     if ( function_exists( 'xprofile_get_random_profile_data' ) ) { ?>
     563    if ( bp_is_active( 'xprofile' ) ) { ?>
    564564        <?php $random_data = xprofile_get_random_profile_data( $members_template->member->id, true ); ?>
    565565            <strong><?php echo wp_filter_kses( $random_data[0]->name ) ?></strong>
     
    648648
    649649    // Always add a log out list item to the end of the navigation
    650     if ( function_exists( 'wp_logout_url' ) )
    651         $logout_link = '<li><a id="wp-logout" href="' .  wp_logout_url( bp_get_root_domain() ) . '">' . __( 'Log Out', 'buddypress' ) . '</a></li>';
    652     else
    653         $logout_link = '<li><a id="wp-logout" href="' . site_url() . '/wp-login.php?action=logout&amp;redirect_to=' . bp_get_root_domain() . '">' . __( 'Log Out', 'buddypress' ) . '</a></li>';
     650    $logout_link = '<li><a id="wp-logout" href="' .  wp_logout_url( bp_get_root_domain() ) . '">' . __( 'Log Out', 'buddypress' ) . '</a></li>';
    654651
    655652    echo apply_filters( 'bp_logout_nav_link', $logout_link );
Note: See TracChangeset for help on using the changeset viewer.