Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
07/25/2013 02:28:28 AM (11 years ago)
Author:
johnjamesjacoby
Message:

Fix some PHP 5.4 static method E_STRICT warnings across several components. More to do here. See #5108.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-friends/bp-friends-classes.php

    r7298 r7308  
    1111
    1212class BP_Friends_Friendship {
    13     var $id;
    14     var $initiator_user_id;
    15     var $friend_user_id;
    16     var $is_confirmed;
    17     var $is_limited;
    18     var $date_created;
    19 
    20     var $is_request;
    21     var $populate_friend_details;
    22 
    23     var $friend;
    24 
    25     function __construct( $id = null, $is_request = false, $populate_friend_details = true ) {
     13    public $id;
     14    public $initiator_user_id;
     15    public $friend_user_id;
     16    public $is_confirmed;
     17    public $is_limited;
     18    public $date_created;
     19
     20    public $is_request;
     21    public $populate_friend_details;
     22
     23    public $friend;
     24
     25    public function __construct( $id = null, $is_request = false, $populate_friend_details = true ) {
    2626        $this->is_request = $is_request;
    2727
     
    3333    }
    3434
    35     function populate() {
     35    public function populate() {
    3636        global $wpdb, $bp;
    3737
     
    5353    }
    5454
    55     function save() {
     55    public function save() {
    5656        global $wpdb, $bp;
    5757
     
    7979    }
    8080
    81     function delete() {
    82         global $wpdb, $bp;
    83 
     81    public function delete() {
     82        global $wpdb, $bp;
    8483        return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->friends->table_name} WHERE id = %d", $this->id ) );
    8584    }
     
    8786    /** Static Methods ********************************************************/
    8887
    89     function get_friend_user_ids( $user_id, $friend_requests_only = false, $assoc_arr = false ) {
     88    public static function get_friend_user_ids( $user_id, $friend_requests_only = false, $assoc_arr = false ) {
    9089        global $wpdb, $bp;
    9190
     
    112111    }
    113112
    114     function get_friendship_id( $user_id, $friend_id ) {
     113    public static function get_friendship_id( $user_id, $friend_id ) {
    115114        global $wpdb, $bp;
    116115
     
    118117    }
    119118
    120     function get_friendship_request_user_ids( $user_id ) {
     119    public static function get_friendship_request_user_ids( $user_id ) {
    121120        global $wpdb, $bp;
    122121
     
    124123    }
    125124
    126     function total_friend_count( $user_id = 0 ) {
     125    public static function total_friend_count( $user_id = 0 ) {
    127126        global $wpdb, $bp;
    128127
     
    140139
    141140        bp_update_user_meta( $user_id, 'total_friend_count', (int) $count );
    142         return (int) $count;
    143     }
    144 
    145     function search_friends( $filter, $user_id, $limit = null, $page = null ) {
     141
     142        return absint( $count );
     143    }
     144
     145    public static function search_friends( $filter, $user_id, $limit = null, $page = null ) {
    146146        global $wpdb, $bp;
    147147
     
    183183    }
    184184
    185     function check_is_friend( $loggedin_userid, $possible_friend_userid ) {
     185    public static function check_is_friend( $loggedin_userid, $possible_friend_userid ) {
    186186        global $wpdb, $bp;
    187187
     
    202202    }
    203203
    204     function get_bulk_last_active( $user_ids ) {
     204    public static function get_bulk_last_active( $user_ids ) {
    205205        global $wpdb;
    206206
     
    210210    }
    211211
    212     function accept($friendship_id) {
    213         global $wpdb, $bp;
    214 
     212    public static function accept($friendship_id) {
     213        global $wpdb, $bp;
    215214        return $wpdb->query( $wpdb->prepare( "UPDATE {$bp->friends->table_name} SET is_confirmed = 1, date_created = %s WHERE id = %d AND friend_user_id = %d", bp_core_current_time(), $friendship_id, bp_loggedin_user_id() ) );
    216215    }
    217216
    218     function withdraw($friendship_id) {
    219         global $wpdb, $bp;
    220 
     217    public static function withdraw($friendship_id) {
     218        global $wpdb, $bp;
    221219        return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->friends->table_name} WHERE id = %d AND initiator_user_id = %d", $friendship_id, bp_loggedin_user_id() ) );
    222220    }
    223221
    224     function reject($friendship_id) {
    225         global $wpdb, $bp;
    226 
     222    public static function reject($friendship_id) {
     223        global $wpdb, $bp;
    227224        return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->friends->table_name} WHERE id = %d AND friend_user_id = %d", $friendship_id, bp_loggedin_user_id() ) );
    228225    }
    229226
    230     function search_users( $filter, $user_id, $limit = null, $page = null ) {
     227    public static function search_users( $filter, $user_id, $limit = null, $page = null ) {
    231228        global $wpdb, $bp;
    232229
     
    254251    }
    255252
    256     function search_users_count( $filter ) {
     253    public static function search_users_count( $filter ) {
    257254        global $wpdb, $bp;
    258255
     
    277274    }
    278275
    279     function sort_by_name( $user_ids ) {
     276    public static function sort_by_name( $user_ids ) {
    280277        global $wpdb, $bp;
    281278
     
    288285    }
    289286
    290     function get_random_friends( $user_id, $total_friends = 5 ) {
     287    public static function get_random_friends( $user_id, $total_friends = 5 ) {
    291288        global $wpdb, $bp;
    292289
     
    306303    }
    307304
    308     function get_invitable_friend_count( $user_id, $group_id ) {
     305    public static function get_invitable_friend_count( $user_id, $group_id ) {
    309306
    310307        // Setup some data we'll use below
     
    333330    }
    334331
    335     function get_user_ids_for_friendship( $friendship_id ) {
    336         global $wpdb, $bp;
    337 
     332    public static function get_user_ids_for_friendship( $friendship_id ) {
     333        global $wpdb, $bp;
    338334        return $wpdb->get_row( $wpdb->prepare( "SELECT friend_user_id, initiator_user_id FROM {$bp->friends->table_name} WHERE id = %d", $friendship_id ) );
    339335    }
    340336
    341     function delete_all_for_user( $user_id ) {
     337    public static function delete_all_for_user( $user_id ) {
    342338        global $wpdb, $bp;
    343339
Note: See TracChangeset for help on using the changeset viewer.