Skip to:
Content

BuddyPress.org

Changeset 7308


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

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

Location:
trunk
Files:
6 edited

Legend:

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

    r7228 r7308  
    2626    var $is_spam;
    2727
    28     function __construct( $id = false ) {
     28    public function __construct( $id = false ) {
    2929        if ( !empty( $id ) ) {
    3030            $this->id = $id;
     
    3333    }
    3434
    35     function populate() {
     35    public function populate() {
    3636        global $wpdb, $bp;
    3737
     
    5656    }
    5757
    58     function save() {
    59         global $wpdb, $bp, $current_user;
     58    public function save() {
     59        global $wpdb, $bp;
    6060
    6161        $this->id                = apply_filters_ref_array( 'bp_activity_id_before_save',                array( $this->id,                &$this ) );
     
    113113     * @return array
    114114     */
    115     function get( $args = array() ) {
     115    public static function get( $args = array() ) {
    116116        global $wpdb, $bp;
    117117
     
    350350     * @since BuddyPress (1.2)
    351351     */
    352     function get_specific( $activity_ids, $max = false, $page = 1, $per_page = 25, $sort = 'DESC', $display_comments = false ) {
     352    public static function get_specific( $activity_ids, $max = false, $page = 1, $per_page = 25, $sort = 'DESC', $display_comments = false ) {
    353353        _deprecated_function( __FUNCTION__, '1.5', 'Use BP_Activity_Activity::get() with the "in" parameter instead.' );
    354354        return BP_Activity_Activity::get( $max, $page, $per_page, $sort, false, false, $display_comments, false, false, $activity_ids );
    355355    }
    356356
    357     function get_id( $user_id, $component, $type, $item_id, $secondary_item_id, $action, $content, $date_recorded ) {
     357    public static function get_id( $user_id, $component, $type, $item_id, $secondary_item_id, $action, $content, $date_recorded ) {
    358358        global $bp, $wpdb;
    359359
     
    392392    }
    393393
    394     function delete( $args ) {
     394    public static function delete( $args = array() ) {
    395395        global $wpdb, $bp;
    396396
     
    467467    }
    468468
    469     function delete_activity_item_comments( $activity_ids = array() ) {
     469    public static function delete_activity_item_comments( $activity_ids = array() ) {
    470470        global $bp, $wpdb;
    471471
     
    475475    }
    476476
    477     function delete_activity_meta_entries( $activity_ids = array() ) {
     477    public static function delete_activity_meta_entries( $activity_ids = array() ) {
    478478        global $bp, $wpdb;
    479479
     
    496496     * @since BuddyPress (1.2)
    497497     */
    498     function append_comments( $activities, $spam = 'ham_only' ) {
    499         global $wpdb;
    500 
     498    public static function append_comments( $activities, $spam = 'ham_only' ) {
    501499        $activity_comments = array();
    502500
     
    528526     * @since BuddyPress (1.2)
    529527     */
    530     function get_activity_comments( $activity_id, $left, $right, $spam = 'ham_only', $top_level_parent_id = 0 ) {
     528    public static function get_activity_comments( $activity_id, $left, $right, $spam = 'ham_only', $top_level_parent_id = 0 ) {
    531529        global $wpdb, $bp;
    532530
     
    585583    }
    586584
    587     function rebuild_activity_comment_tree( $parent_id, $left = 1 ) {
     585    public static function rebuild_activity_comment_tree( $parent_id, $left = 1 ) {
    588586        global $wpdb, $bp;
    589587
     
    609607    }
    610608
    611     function get_child_comments( $parent_id ) {
     609    public static function get_child_comments( $parent_id ) {
    612610        global $bp, $wpdb;
    613611
     
    620618     * @return array
    621619     */
    622     function get_recorded_components() {
     620    public static function get_recorded_components() {
    623621        global $wpdb, $bp;
    624622        return $wpdb->get_col( "SELECT DISTINCT component FROM {$bp->activity->table_name} ORDER BY component ASC" );
    625623    }
    626624
    627     function get_sitewide_items_for_feed( $limit = 35 ) {
    628         global $bp;
    629 
     625    public static function get_sitewide_items_for_feed( $limit = 35 ) {
    630626        $activities    = bp_activity_get_sitewide( array( 'max' => $limit ) );
    631627        $activity_feed = array();
     
    642638    }
    643639
    644     function get_in_operator_sql( $field, $items ) {
     640    public static function get_in_operator_sql( $field, $items ) {
    645641        global $wpdb;
    646642
     
    666662    }
    667663
    668     function get_filter_sql( $filter_array ) {
     664    public static function get_filter_sql( $filter_array ) {
    669665
    670666        $filter_sql = array();
     
    706702    }
    707703
    708     function get_last_updated() {
     704    public static function get_last_updated() {
    709705        global $bp, $wpdb;
    710706
     
    712708    }
    713709
    714     function total_favorite_count( $user_id ) {
     710    public static function total_favorite_count( $user_id ) {
    715711        if ( !$favorite_activity_entries = bp_get_user_meta( $user_id, 'bp_favorite_activities', true ) )
    716712            return 0;
     
    719715    }
    720716
    721     function check_exists_by_content( $content ) {
     717    public static function check_exists_by_content( $content ) {
    722718        global $wpdb, $bp;
    723719
     
    725721    }
    726722
    727     function hide_all_for_user( $user_id ) {
     723    public static function hide_all_for_user( $user_id ) {
    728724        global $wpdb, $bp;
    729725
  • trunk/bp-core/bp-core-classes.php

    r7298 r7308  
    626626     * @var integer
    627627     */
    628     var $id;
     628    public $id;
    629629
    630630    /**
     
    633633     * @var string
    634634     */
    635     var $avatar;
     635    public $avatar;
    636636
    637637    /**
     
    640640     * @var string
    641641     */
    642     var $avatar_thumb;
     642    public $avatar_thumb;
    643643
    644644    /**
     
    647647     * @var string
    648648     */
    649     var $avatar_mini;
     649    public $avatar_mini;
    650650
    651651    /**
     
    654654     * @var string
    655655     */
    656     var $fullname;
     656    public $fullname;
    657657
    658658    /**
     
    661661     * @var string
    662662     */
    663     var $email;
     663    public $email;
    664664
    665665    /**
     
    668668     * @var string
    669669     */
    670     var $user_url;
     670    public $user_url;
    671671
    672672    /**
     
    675675     * @var string
    676676     */
    677     var $user_link;
     677    public $user_link;
    678678
    679679    /**
     
    684684     * @var string
    685685     */
    686     var $last_active;
     686    public $last_active;
    687687
    688688    /* Extras */
     
    693693     * @var integer
    694694     */
    695     var $total_friends;
     695    public $total_friends;
    696696
    697697    /**
     
    701701     * @deprecated No longer used
    702702     */
    703     var $total_blogs;
     703    public $total_blogs;
    704704
    705705    /**
     
    710710     * @var string
    711711     */
    712     var $total_groups;
     712    public $total_groups;
    713713
    714714    /**
     
    728728     * @param boolean $populate_extras Whether to fetch extra information such as group/friendship counts or not.
    729729     */
    730     function __construct( $user_id, $populate_extras = false ) {
     730    public function __construct( $user_id, $populate_extras = false ) {
    731731        if ( !empty( $user_id ) ) {
    732732            $this->id = $user_id;
     
    751751     * @uses bp_profile_last_updated_date() Returns the last updated date for a user.
    752752     */
    753     function populate() {
     753    private function populate() {
    754754
    755755        if ( bp_is_active( 'xprofile' ) )
     
    784784     * Populates extra fields such as group and friendship counts.
    785785     */
    786     function populate_extras() {
     786    private function populate_extras() {
    787787
    788788        if ( bp_is_active( 'friends' ) ) {
     
    796796    }
    797797
    798     function get_profile_data() {
     798    private function get_profile_data() {
    799799        return BP_XProfile_ProfileData::get_all_for_user( $this->id );
    800800    }
     
    802802    /** Static Methods ********************************************************/
    803803
    804     function get_users( $type, $limit = 0, $page = 1, $user_id = 0, $include = false, $search_terms = false, $populate_extras = true, $exclude = false, $meta_key = false, $meta_value = false ) {
     804    public static function get_users( $type, $limit = 0, $page = 1, $user_id = 0, $include = false, $search_terms = false, $populate_extras = true, $exclude = false, $meta_key = false, $meta_value = false ) {
    805805        global $wpdb, $bp;
    806806
     
    989989     * @static
    990990     */
    991     function get_users_by_letter( $letter, $limit = null, $page = 1, $populate_extras = true, $exclude = '' ) {
     991    public static function get_users_by_letter( $letter, $limit = null, $page = 1, $populate_extras = true, $exclude = '' ) {
    992992        global $bp, $wpdb;
    993993
     
    10541054     * @static
    10551055     */
    1056     function get_specific_users( $user_ids, $limit = null, $page = 1, $populate_extras = true ) {
     1056    public static function get_specific_users( $user_ids, $limit = null, $page = 1, $populate_extras = true ) {
    10571057        global $wpdb;
    10581058
     
    10981098     * @static
    10991099     */
    1100     function search_users( $search_terms, $limit = null, $page = 1, $populate_extras = true ) {
     1100    public static function search_users( $search_terms, $limit = null, $page = 1, $populate_extras = true ) {
    11011101        global $bp, $wpdb;
    11021102
     
    11401140     * @static
    11411141     */
    1142     function get_user_extras( &$paged_users, &$user_ids, $type = false ) {
     1142    public static function get_user_extras( &$paged_users, &$user_ids, $type = false ) {
    11431143        global $bp, $wpdb;
    11441144
     
    12231223     * @static
    12241224     */
    1225     function get_core_userdata( $user_id ) {
     1225    public static function get_core_userdata( $user_id ) {
    12261226        global $wpdb;
    12271227
     
    12481248     * @var integer
    12491249     */
    1250     var $id;
     1250    public $id;
    12511251
    12521252    /**
     
    12551255     * @var integer
    12561256     */
    1257     var $item_id;
     1257    public $item_id;
    12581258
    12591259    /**
     
    12621262     * @var integer
    12631263     */
    1264     var $secondary_item_id = null;
     1264    public $secondary_item_id = null;
    12651265
    12661266    /**
     
    12691269     * @var integer
    12701270     */
    1271     var $user_id;
     1271    public $user_id;
    12721272
    12731273    /**
     
    12761276     * @var string
    12771277     */
    1278     var $component_name;
     1278    public $component_name;
    12791279
    12801280    /**
     
    12831283     * @var string
    12841284     */
    1285     var $component_action;
     1285    public $component_action;
    12861286
    12871287    /**
     
    12901290     * @var string
    12911291     */
    1292     var $date_notified;
     1292    public $date_notified;
    12931293
    12941294    /**
     
    12971297     * @var boolean
    12981298     */
    1299     var $is_new;
     1299    public $is_new;
    13001300
    13011301    /** Public Methods ********************************************************/
     
    13061306     * @param integer $id
    13071307     */
    1308     function __construct( $id = 0 ) {
     1308    public function __construct( $id = 0 ) {
    13091309        if ( !empty( $id ) ) {
    13101310            $this->id = $id;
     
    13201320     * @return bool Success or failure
    13211321     */
    1322     function save() {
     1322    public function save() {
    13231323        global $bp, $wpdb;
    13241324
     
    13481348     * @global wpdb $wpdb WordPress database object
    13491349     */
    1350     function populate() {
     1350    private function populate() {
    13511351        global $bp, $wpdb;
    13521352
     
    13641364    /** Static Methods ********************************************************/
    13651365
    1366     function check_access( $user_id, $notification_id ) {
     1366    public static function check_access( $user_id, $notification_id ) {
    13671367        global $wpdb, $bp;
    13681368
     
    13801380     * @static
    13811381     */
    1382     function get_all_for_user( $user_id, $status = 'is_new' ) {
     1382    public static function get_all_for_user( $user_id, $status = 'is_new' ) {
    13831383        global $bp, $wpdb;
    13841384
     
    13981398     * @static
    13991399     */
    1400     function delete_for_user_by_type( $user_id, $component_name, $component_action ) {
     1400    public static function delete_for_user_by_type( $user_id, $component_name, $component_action ) {
    14011401        global $bp, $wpdb;
    14021402
     
    14161416     * @static
    14171417     */
    1418     function delete_for_user_by_item_id( $user_id, $item_id, $component_name, $component_action, $secondary_item_id = false ) {
     1418    public static function delete_for_user_by_item_id( $user_id, $item_id, $component_name, $component_action, $secondary_item_id = false ) {
    14191419        global $bp, $wpdb;
    14201420
     
    14341434     * @static
    14351435     */
    1436     function delete_from_user_by_type( $user_id, $component_name, $component_action ) {
     1436    public static function delete_from_user_by_type( $user_id, $component_name, $component_action ) {
    14371437        global $bp, $wpdb;
    14381438
     
    14511451     * @static
    14521452     */
    1453     function delete_all_by_type( $item_id, $component_name, $component_action, $secondary_item_id ) {
     1453    public static function delete_all_by_type( $item_id, $component_name, $component_action, $secondary_item_id ) {
    14541454        global $bp, $wpdb;
    14551455
     
    17131713     * @global unknown $wp_embed
    17141714     */
    1715     function __construct() {
     1715    public function __construct() {
    17161716        global $wp_embed;
    17171717
     
    17621762     * @return string The embed HTML on success, otherwise the original URL.
    17631763     */
    1764     function shortcode( $attr, $url = '' ) {
     1764    public function shortcode( $attr, $url = '' ) {
    17651765        if ( empty( $url ) )
    17661766            return '';
     
    18271827     * @return string The embed HTML on success, otherwise the original URL.
    18281828     */
    1829     function parse_oembed( $id, $url, $attr, $rawattr ) {
     1829    public function parse_oembed( $id, $url, $attr, $rawattr ) {
    18301830        $id = intval( $id );
    18311831
     
    18951895     * @since BuddyPress (1.7)
    18961896     */
    1897     function walk( $elements, $max_depth ) {
     1897    public function walk( $elements, $max_depth ) {
    18981898        $args   = array_slice( func_get_args(), 2 );
    18991899        $output = '';
     
    19821982     * @since BuddyPress (1.7)
    19831983     */
    1984     function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
     1984    public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
    19851985        // If we're someway down the tree, indent the HTML with the appropriate number of tabs
    19861986        $indent = $depth ? str_repeat( "\t", $depth ) : '';
  • 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
  • trunk/bp-groups/bp-groups-classes.php

    r7302 r7308  
    197197    /** Static Methods ********************************************************/
    198198
    199     function group_exists( $slug, $table_name = false ) {
     199    public static function group_exists( $slug, $table_name = false ) {
    200200        global $wpdb, $bp;
    201201
     
    209209    }
    210210
    211     function get_id_from_slug( $slug ) {
     211    public static function get_id_from_slug( $slug ) {
    212212        return BP_Groups_Group::group_exists( $slug );
    213213    }
     
    14871487    }
    14881488
    1489     function total_group_count( $user_id = 0 ) {
     1489    public static function total_group_count( $user_id = 0 ) {
    14901490        global $bp, $wpdb;
    14911491
     
    15001500    }
    15011501
    1502     function get_invites( $user_id, $limit = false, $page = false, $exclude = false ) {
     1502    public static function get_invites( $user_id, $limit = false, $page = false, $exclude = false ) {
    15031503        global $wpdb, $bp;
    15041504
     
    15511551    }
    15521552
    1553     function check_is_admin( $user_id, $group_id ) {
     1553    public static function check_is_admin( $user_id, $group_id ) {
    15541554        global $wpdb, $bp;
    15551555
     
    15601560    }
    15611561
    1562     function check_is_mod( $user_id, $group_id ) {
     1562    public static function check_is_mod( $user_id, $group_id ) {
    15631563        global $wpdb, $bp;
    15641564
     
    15691569    }
    15701570
    1571     function check_is_member( $user_id, $group_id ) {
     1571    public static function check_is_member( $user_id, $group_id ) {
    15721572        global $wpdb, $bp;
    15731573
  • trunk/bp-messages/bp-messages-classes.php

    r7307 r7308  
    1212
    1313class BP_Messages_Thread {
    14     var $thread_id;
    15     var $messages;
    16     var $recipients;
    17     var $sender_ids;
    18 
    19     var $unread_count;
     14    public $thread_id;
     15    public $messages;
     16    public $recipients;
     17    public $sender_ids;
     18
     19    public $unread_count;
    2020
    2121    /**
     
    6767    public $messages_order;
    6868
    69     function __construct( $thread_id = false, $order = 'ASC' ) {
     69    public function __construct( $thread_id = false, $order = 'ASC' ) {
    7070        if ( $thread_id )
    7171            $this->populate( $thread_id, $order );
    7272    }
    7373
    74     function populate( $thread_id, $order ) {
     74    private function populate( $thread_id, $order ) {
    7575        global $wpdb, $bp;
    7676
     
    9595    }
    9696
    97     function mark_read() {
     97    public function mark_read() {
    9898        BP_Messages_Thread::mark_as_read( $this->thread_id );
    9999    }
    100100
    101     function mark_unread() {
     101    public function mark_unread() {
    102102        BP_Messages_Thread::mark_as_unread( $this->thread_id );
    103103    }
    104104
    105     function get_recipients() {
     105    public function get_recipients() {
    106106        global $wpdb, $bp;
    107107
     
    115115    }
    116116
    117     /** Static Functions **/
    118 
    119     function delete( $thread_id ) {
    120         global $wpdb, $bp;
    121 
    122         $delete_for_user = $wpdb->query( $wpdb->prepare( "UPDATE {$bp->messages->table_name_recipients} SET is_deleted = 1 WHERE thread_id = %d AND user_id = %d", $thread_id, bp_loggedin_user_id() ) );
     117    /** Static Functions ******************************************************/
     118
     119    public static function delete( $thread_id ) {
     120        global $wpdb, $bp;
     121
     122        // Mark messages as deleted
     123        $wpdb->query( $wpdb->prepare( "UPDATE {$bp->messages->table_name_recipients} SET is_deleted = 1 WHERE thread_id = %d AND user_id = %d", $thread_id, bp_loggedin_user_id() ) );
    123124
    124125        // Check to see if any more recipients remain for this message
     
    137138    }
    138139
    139     function get_current_threads_for_user( $user_id, $box = 'inbox', $type = 'all', $limit = null, $page = null, $search_terms = '' ) {
     140    public static function get_current_threads_for_user( $user_id, $box = 'inbox', $type = 'all', $limit = null, $page = null, $search_terms = '' ) {
    140141        global $wpdb, $bp;
    141142
     
    178179    }
    179180
    180     function mark_as_read( $thread_id ) {
     181    public static function mark_as_read( $thread_id ) {
    181182        global $wpdb, $bp;
    182183
     
    185186    }
    186187
    187     function mark_as_unread( $thread_id ) {
     188    public static function mark_as_unread( $thread_id ) {
    188189        global $wpdb, $bp;
    189190
     
    192193    }
    193194
    194     function get_total_threads_for_user( $user_id, $box = 'inbox', $type = 'all' ) {
     195    public static function get_total_threads_for_user( $user_id, $box = 'inbox', $type = 'all' ) {
    195196        global $wpdb, $bp;
    196197
     
    207208    }
    208209
    209     function user_is_sender( $thread_id ) {
     210    public static function user_is_sender( $thread_id ) {
    210211        global $wpdb, $bp;
    211212
     
    218219    }
    219220
    220     function get_last_sender( $thread_id ) {
     221    public static function get_last_sender( $thread_id ) {
    221222        global $wpdb, $bp;
    222223
     
    242243    }
    243244
    244     function check_access( $thread_id, $user_id = 0 ) {
     245    public static function check_access( $thread_id, $user_id = 0 ) {
    245246        global $wpdb, $bp;
    246247
     
    251252    }
    252253
    253     function is_valid( $thread_id ) {
     254    public static function is_valid( $thread_id ) {
    254255        global $wpdb, $bp;
    255256
     
    257258    }
    258259
    259     function get_recipient_links( $recipients ) {
     260    public static function get_recipient_links( $recipients ) {
    260261        if ( count( $recipients ) >= 5 )
    261262            return sprintf( __( '%s Recipients', 'buddypress' ), number_format_i18n( count( $recipients ) ) );
     
    276277    }
    277278
    278     // Update Functions
    279 
    280     function update_tables() {
     279    public static function update_tables() {
    281280        global $wpdb, $bp;
    282281
     
    309308
    310309class BP_Messages_Message {
    311     var $id;
    312     var $thread_id;
    313     var $sender_id;
    314     var $subject;
    315     var $message;
    316     var $date_sent;
    317 
    318     var $recipients = false;
    319 
    320     function __construct( $id = null ) {
     310    public $id;
     311    public $thread_id;
     312    public $sender_id;
     313    public $subject;
     314    public $message;
     315    public $date_sent;
     316
     317    public $recipients = false;
     318
     319    public function __construct( $id = null ) {
    321320        $this->date_sent = bp_core_current_time();
    322321        $this->sender_id = bp_loggedin_user_id();
    323322
    324         if ( !empty( $id ) )
     323        if ( !empty( $id ) ) {
    325324            $this->populate( $id );
    326     }
    327 
    328     function populate( $id ) {
     325        }
     326    }
     327
     328    private function populate( $id ) {
    329329        global $wpdb, $bp;
    330330
     
    339339    }
    340340
    341     function send() {
     341    public function send() {
    342342        global $wpdb, $bp;
    343343
     
    392392    }
    393393
    394     function get_recipients() {
     394    public function get_recipients() {
    395395        global $bp, $wpdb;
    396 
    397396        return $wpdb->get_results( $wpdb->prepare( "SELECT user_id FROM {$bp->messages->table_name_recipients} WHERE thread_id = %d", $this->thread_id ) );
    398397    }
    399398
    400     // Static Functions
    401 
    402     function get_recipient_ids( $recipient_usernames ) {
     399    /** Static Functions ******************************************************/
     400
     401    public static function get_recipient_ids( $recipient_usernames ) {
    403402        if ( !$recipient_usernames )
    404403            return false;
     
    415414    }
    416415
    417     function get_last_sent_for_user( $thread_id ) {
    418         global $wpdb, $bp;
    419 
     416    public static function get_last_sent_for_user( $thread_id ) {
     417        global $wpdb, $bp;
    420418        return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->messages->table_name_messages} WHERE sender_id = %d AND thread_id = %d ORDER BY date_sent DESC LIMIT 1", bp_loggedin_user_id(), $thread_id ) );
    421419    }
    422420
    423     function is_user_sender( $user_id, $message_id ) {
     421    public static function is_user_sender( $user_id, $message_id ) {
    424422        global $wpdb, $bp;
    425423        return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->messages->table_name_messages} WHERE sender_id = %d AND id = %d", $user_id, $message_id ) );
    426424    }
    427425
    428     function get_message_sender( $message_id ) {
     426    public static function get_message_sender( $message_id ) {
    429427        global $wpdb, $bp;
    430428        return $wpdb->get_var( $wpdb->prepare( "SELECT sender_id FROM {$bp->messages->table_name_messages} WHERE id = %d", $message_id ) );
     
    433431
    434432class BP_Messages_Notice {
    435     var $id = null;
    436     var $subject;
    437     var $message;
    438     var $date_sent;
    439     var $is_active;
    440 
    441     function __construct( $id = null ) {
     433    public $id = null;
     434    public $subject;
     435    public $message;
     436    public $date_sent;
     437    public $is_active;
     438
     439    public function __construct( $id = null ) {
    442440        if ( $id ) {
    443441            $this->id = $id;
     
    446444    }
    447445
    448     function populate() {
     446    private function populate() {
    449447        global $wpdb, $bp;
    450448
     
    459457    }
    460458
    461     function save() {
     459    private function save() {
    462460        global $wpdb, $bp;
    463461
     
    488486    }
    489487
    490     function activate() {
     488    public function activate() {
    491489        $this->is_active = 1;
    492         if ( !$this->save() )
    493             return false;
    494 
    495         return true;
    496     }
    497 
    498     function deactivate() {
     490        return (bool) $this->save();
     491    }
     492
     493    public function deactivate() {
    499494        $this->is_active = 0;
    500         if ( !$this->save() )
    501             return false;
    502 
    503         return true;
    504     }
    505 
    506     function delete() {
     495        return (bool) $this->save();
     496    }
     497
     498    public function delete() {
    507499        global $wpdb, $bp;
    508500
  • trunk/bp-xprofile/bp-xprofile-classes.php

    r7285 r7308  
    1212
    1313class BP_XProfile_Group {
    14     var $id = null;
    15     var $name;
    16     var $description;
    17     var $can_delete;
    18     var $group_order;
    19     var $fields;
    20 
    21     function __construct( $id = null ) {
     14    public $id = null;
     15    public $name;
     16    public $description;
     17    public $can_delete;
     18    public $group_order;
     19    public $fields;
     20
     21    public function __construct( $id = null ) {
    2222        if ( !empty( $id ) )
    2323            $this->populate( $id );
    2424    }
    2525
    26     function populate( $id ) {
     26    private function populate( $id ) {
    2727        global $wpdb, $bp;
    2828
     
    3939    }
    4040
    41     function save() {
     41    private function save() {
    4242        global $wpdb, $bp;
    4343
     
    6464    }
    6565
    66     function delete() {
     66    private function delete() {
    6767        global $wpdb, $bp;
    6868
     
    112112     * @return array $groups
    113113     */
    114     function get( $args = '' ) {
     114    public static function get( $args = array() ) {
    115115        global $wpdb, $bp;
    116116
     
    264264    }
    265265
    266     function admin_validate() {
     266    public static function admin_validate() {
    267267        global $message;
    268268
     
    276276    }
    277277
    278     function update_position( $field_group_id, $position ) {
     278    public static function update_position( $field_group_id, $position ) {
    279279        global $wpdb, $bp;
    280280
     
    294294     * @return array $fields The database results, with field_visibility added
    295295     */
    296     function fetch_visibility_level( $user_id = 0, $fields = array() ) {
     296    public static function fetch_visibility_level( $user_id = 0, $fields = array() ) {
    297297
    298298        // Get the user's visibility level preferences
     
    330330     *   visibility level + allow_custom (whether the admin allows this field to be set by user)
    331331     */
    332     function fetch_default_visibility_levels() {
     332    public static function fetch_default_visibility_levels() {
    333333        global $wpdb, $bp;
    334334
     
    348348    }
    349349
    350     function render_admin_form() {
     350    public static function render_admin_form() {
    351351        global $message;
    352352
     
    427427
    428428class BP_XProfile_Field {
    429     var $id;
    430     var $group_id;
    431     var $parent_id;
    432     var $type;
    433     var $name;
    434     var $description;
    435     var $is_required;
    436     var $can_delete;
    437     var $field_order;
    438     var $option_order;
    439     var $order_by;
    440     var $is_default_option;
    441     var $default_visibility;
    442     var $allow_custom_visibility = 'allowed';
    443 
    444     var $data;
    445     var $message = null;
    446     var $message_type = 'err';
    447 
    448     function __construct( $id = null, $user_id = null, $get_data = true ) {
     429    public $id;
     430    public $group_id;
     431    public $parent_id;
     432    public $type;
     433    public $name;
     434    public $description;
     435    public $is_required;
     436    public $can_delete;
     437    public $field_order;
     438    public $option_order;
     439    public $order_by;
     440    public $is_default_option;
     441    public $default_visibility;
     442    public $allow_custom_visibility = 'allowed';
     443
     444    public $data;
     445    public $message = null;
     446    public $message_type = 'err';
     447
     448    public function __construct( $id = null, $user_id = null, $get_data = true ) {
    449449        if ( !empty( $id ) )
    450450            $this->populate( $id, $user_id, $get_data );
    451451    }
    452452
    453     function populate( $id, $user_id, $get_data ) {
     453    private function populate( $id, $user_id, $get_data ) {
    454454        global $wpdb, $userdata, $bp;
    455455
     
    488488    }
    489489
    490     function delete( $delete_data = false ) {
     490    private function delete( $delete_data = false ) {
    491491        global $wpdb, $bp;
    492492
     
    507507    }
    508508
    509     function save() {
     509    private function save() {
    510510        global $wpdb, $bp;
    511511
     
    624624    }
    625625
    626     function get_field_data( $user_id ) {
     626    public function get_field_data( $user_id ) {
    627627        return new BP_XProfile_ProfileData( $this->id, $user_id );
    628628    }
    629629
    630     function get_children( $for_editing = false ) {
     630    public function get_children( $for_editing = false ) {
    631631        global $wpdb, $bp;
    632632
     
    655655    }
    656656
    657     function delete_children() {
     657    public function delete_children() {
    658658        global $wpdb, $bp;
    659659
     
    663663    }
    664664
    665     /* Static Functions */
    666 
    667     function get_type( $field_id ) {
     665    /** Static Methods ********************************************************/
     666
     667    public static function get_type( $field_id ) {
    668668        global $wpdb, $bp;
    669669
     
    681681    }
    682682
    683     function delete_for_group( $group_id ) {
     683    public static function delete_for_group( $group_id ) {
    684684        global $wpdb, $bp;
    685685
     
    697697    }
    698698
    699     function get_id_from_name( $field_name ) {
     699    public static function get_id_from_name( $field_name ) {
    700700        global $wpdb, $bp;
    701701
     
    706706    }
    707707
    708     function update_position( $field_id, $position, $field_group_id ) {
     708    public static function update_position( $field_id, $position, $field_group_id ) {
    709709        global $wpdb, $bp;
    710710
     
    729729
    730730    /* This function populates the items for radio buttons checkboxes and drop down boxes */
    731     function render_admin_form_children() {
     731    public function render_admin_form_children() {
    732732        $input_types = array( 'checkbox', 'selectbox', 'multiselectbox', 'radio' );
    733733
     
    817817    }
    818818
    819     function render_admin_form( $message = '' ) {
     819    public function render_admin_form( $message = '' ) {
    820820        if ( empty( $this->id ) ) {
    821821            $title  = __( 'Add Field', 'buddypress' );
     
    977977    }
    978978
    979     function admin_validate() {
     979    public function admin_validate() {
    980980        global $message;
    981981
     
    10041004
    10051005class BP_XProfile_ProfileData {
    1006     var $id;
    1007     var $user_id;
    1008     var $field_id;
    1009     var $value;
    1010     var $last_updated;
    1011 
    1012     function __construct( $field_id = null, $user_id = null ) {
     1006    public $id;
     1007    public $user_id;
     1008    public $field_id;
     1009    public $value;
     1010    public $last_updated;
     1011
     1012    public function __construct( $field_id = null, $user_id = null ) {
    10131013        if ( !empty( $field_id ) ) {
    10141014            $this->populate( $field_id, $user_id );
     
    10161016    }
    10171017
    1018     function populate( $field_id, $user_id )  {
     1018    private function populate( $field_id, $user_id )  {
    10191019        global $wpdb, $bp;
    10201020
     
    10351035
    10361036    /**
    1037      * exists ()
    1038      *
    10391037     * Check if there is data already for the user.
    10401038     *
     
    10431041     * @return bool
    10441042     */
    1045     function exists() {
     1043    private function exists() {
    10461044        global $wpdb, $bp;
    10471045
     
    10521050
    10531051    /**
    1054      * is_valid_field()
    1055      *
    10561052     * Check if this data is for a valid field.
    10571053     *
     
    10601056     * @return bool
    10611057     */
    1062     function is_valid_field() {
     1058    private function is_valid_field() {
    10631059        global $wpdb, $bp;
    10641060
     
    10681064    }
    10691065
    1070     function save() {
     1066    private function save() {
    10711067        global $wpdb, $bp;
    10721068
     
    11021098    }
    11031099
    1104     function delete() {
     1100    private function delete() {
    11051101        global $wpdb, $bp;
    11061102
     
    11111107    }
    11121108
    1113     /** Static Functions **/
     1109    /** Static Methods ********************************************************/
    11141110
    11151111    /**
     
    11181114     * Get all of the profile information for a specific user.
    11191115     */
    1120     function get_all_for_user( $user_id ) {
     1116    public static function get_all_for_user( $user_id ) {
    11211117        global $wpdb, $bp;
    11221118
     
    11501146     * @return int $fielddata_id
    11511147     */
    1152     function get_fielddataid_byid( $field_id, $user_id ) {
     1148    public static function get_fielddataid_byid( $field_id, $user_id ) {
    11531149        global $wpdb, $bp;
    11541150
     
    11621158    }
    11631159
    1164     function get_value_byid( $field_id, $user_ids = null ) {
     1160    public static function get_value_byid( $field_id, $user_ids = null ) {
    11651161        global $wpdb, $bp;
    11661162
     
    11781174    }
    11791175
    1180     function get_value_byfieldname( $fields, $user_id = null ) {
     1176    public static function get_value_byfieldname( $fields, $user_id = null ) {
    11811177        global $bp, $wpdb;
    11821178
     
    12271223    }
    12281224
    1229     function delete_for_field( $field_id ) {
     1225    public static function delete_for_field( $field_id ) {
    12301226        global $wpdb, $bp;
    12311227
     
    12361232    }
    12371233
    1238     function get_last_updated( $user_id ) {
     1234    public static function get_last_updated( $user_id ) {
    12391235        global $wpdb, $bp;
    12401236
     
    12441240    }
    12451241
    1246     function delete_data_for_user( $user_id ) {
     1242    public static function delete_data_for_user( $user_id ) {
    12471243        global $wpdb, $bp;
    12481244
     
    12501246    }
    12511247
    1252     function get_random( $user_id, $exclude_fullname ) {
     1248    public static function get_random( $user_id, $exclude_fullname ) {
    12531249        global $wpdb, $bp;
    12541250
     
    12591255    }
    12601256
    1261     function get_fullname( $user_id = 0 ) {
     1257    public static function get_fullname( $user_id = 0 ) {
    12621258
    12631259        if ( empty( $user_id ) )
Note: See TracChangeset for help on using the changeset viewer.