Skip to:
Content

BuddyPress.org

Changeset 9378


Ignore:
Timestamp:
01/19/2015 08:53:46 PM (9 years ago)
Author:
johnjamesjacoby
Message:

Remove $bp global touches in bp-activity-classes.php. See #5138.

File:
1 edited

Legend:

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

    r9377 r9378  
    136136     */
    137137    public function populate() {
    138         global $wpdb, $bp;
     138        global $wpdb;
    139139
    140140        $row = wp_cache_get( $this->id, 'bp_activity' );
    141141
    142142        if ( false === $row ) {
     143            $bp  = buddypress();
    143144            $row = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->activity->table_name} WHERE id = %d", $this->id ) );
    144145
     
    302303     */
    303304    public static function get( $args = array() ) {
    304         global $wpdb, $bp;
     305        global $wpdb;
    305306
    306307        // Backward compatibility with old method of passing arguments
     
    326327        }
    327328
    328         $r = wp_parse_args( $args, array(
     329        $bp = buddypress();
     330        $r  = wp_parse_args( $args, array(
    329331            'page'              => 1,          // The current page
    330332            'per_page'          => 25,         // Activity items per page
     
    10551057     */
    10561058    public static function delete( $args = array() ) {
    1057         global $wpdb, $bp;
     1059        global $wpdb;
     1060
     1061        $bp = buddypress();
    10581062
    10591063        $defaults = array(
     
    11561160     */
    11571161    public static function delete_activity_item_comments( $activity_ids = array(), $delete_meta = true ) {
    1158         global $bp, $wpdb;
    1159 
    1160         $delete_meta = (bool) $delete_meta;
    1161 
     1162        global $wpdb;
     1163
     1164        $bp = buddypress();
     1165
     1166        $delete_meta  = (bool) $delete_meta;
    11621167        $activity_ids = implode( ',', wp_parse_id_list( $activity_ids ) );
    11631168
     
    12271232     * @since BuddyPress (1.2)
    12281233     *
    1229      * @global BuddyPress $bp The one true BuddyPress instance.
    12301234     * @global wpdb $wpdb WordPress database object.
    12311235     *
     
    12381242     */
    12391243    public static function get_activity_comments( $activity_id, $left, $right, $spam = 'ham_only', $top_level_parent_id = 0 ) {
    1240         global $wpdb, $bp;
     1244        global $wpdb;
    12411245
    12421246        if ( empty( $top_level_parent_id ) ) {
     
    12531257        // A true cache miss
    12541258        } elseif ( empty( $comments ) ) {
     1259
     1260            $bp = buddypress();
    12551261
    12561262            // Select the user's fullname with the query
     
    14201426     * @since BuddyPress (1.2)
    14211427     *
    1422      * @global BuddyPress $bp The one true BuddyPress instance.
    14231428     * @global wpdb $wpdb WordPress database object.
    14241429     *
     
    14271432     */
    14281433    public static function get_child_comments( $parent_id ) {
    1429         global $bp, $wpdb;
     1434        global $wpdb;
     1435
     1436        $bp = buddypress();
    14301437
    14311438        return $wpdb->get_results( $wpdb->prepare( "SELECT id FROM {$bp->activity->table_name} WHERE type = 'activity_comment' AND secondary_item_id = %d", $parent_id ) );
     
    14431450     */
    14441451    public static function get_recorded_components( $skip_last_activity = true ) {
    1445         global $wpdb, $bp;
    1446 
    1447         if ( $skip_last_activity ) {
     1452        global $wpdb;
     1453
     1454        $bp = buddypress();
     1455
     1456        if ( true === $skip_last_activity ) {
    14481457            $components = $wpdb->get_col( "SELECT DISTINCT component FROM {$bp->activity->table_name} WHERE action != '' AND action != 'last_activity' ORDER BY component ASC" );
    14491458        } else {
     
    15971606     */
    15981607    public static function get_last_updated() {
    1599         global $bp, $wpdb;
     1608        global $wpdb;
     1609
     1610        $bp = buddypress();
    16001611
    16011612        return $wpdb->get_var( "SELECT date_recorded FROM {$bp->activity->table_name} ORDER BY date_recorded DESC LIMIT 1" );
     
    16291640     */
    16301641    public static function check_exists_by_content( $content ) {
    1631         global $wpdb, $bp;
     1642        global $wpdb;
     1643
     1644        $bp = buddypress();
    16321645
    16331646        return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->activity->table_name} WHERE content = %s", $content ) );
     
    16411654     */
    16421655    public static function hide_all_for_user( $user_id ) {
    1643         global $wpdb, $bp;
     1656        global $wpdb;
     1657
     1658        $bp = buddypress();
    16441659
    16451660        return $wpdb->get_var( $wpdb->prepare( "UPDATE {$bp->activity->table_name} SET hide_sitewide = 1 WHERE user_id = %d", $user_id ) );
Note: See TracChangeset for help on using the changeset viewer.