Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
06/19/2012 01:09:29 PM (14 years ago)
Author:
boonebgorges
Message:

Removes access declarations on legacy methods in bp-groups-classes.php

Prior versions of BuddyPress were written for PHP4 compatibility, which meant
that method visibility/access/static was not possible. WP and BP now require
PHP5, which means that new methods can use PHP5+ access declarations. However,
explicitly declaring 'static' or visibility on existing methods causes
backward compatibility issues, because any existing plugin that extends these
classes will throw fatal errors if they do not declare the same visibility/
static as the parent class.

See #4274

File:
1 edited

Legend:

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

    r6107 r6119  
    4949        public $user_has_access;
    5050
    51         public function __construct( $id = null ) {
     51        function __construct( $id = null ) {
    5252                if ( !empty( $id ) ) {
    5353                        $this->id = $id;
     
    5656        }
    5757
    58         private function populate() {
     58        function populate() {
    5959                global $wpdb, $bp;
    6060
     
    9595        }
    9696
    97         public function save() {
     97        function save() {
    9898                global $wpdb, $bp;
    9999
     
    166166        }
    167167
    168         public function delete() {
     168        function delete() {
    169169                global $wpdb, $bp;
    170170
     
    195195        /** Static Methods ********************************************************/
    196196
    197         public static function group_exists( $slug, $table_name = false ) {
     197        function group_exists( $slug, $table_name = false ) {
    198198                global $wpdb, $bp;
    199199
     
    207207        }
    208208
    209         public static function get_id_from_slug( $slug ) {
     209        function get_id_from_slug( $slug ) {
    210210                return BP_Groups_Group::group_exists( $slug );
    211211        }
     
    216216        }
    217217
    218         public static function filter_user_groups( $filter, $user_id = 0, $order = false, $limit = null, $page = null ) {
     218        function filter_user_groups( $filter, $user_id = 0, $order = false, $limit = null, $page = null ) {
    219219                global $wpdb, $bp;
    220220
     
    241241        }
    242242
    243         public static function search_groups( $filter, $limit = null, $page = null, $sort_by = false, $order = false ) {
     243        function search_groups( $filter, $limit = null, $page = null, $sort_by = false, $order = false ) {
    244244                global $wpdb, $bp;
    245245
     
    264264        }
    265265
    266         public static function check_slug( $slug ) {
     266        function check_slug( $slug ) {
    267267                global $wpdb, $bp;
    268268
     
    270270        }
    271271
    272         public static function get_slug( $group_id ) {
     272        function get_slug( $group_id ) {
    273273                global $wpdb, $bp;
    274274
     
    276276        }
    277277
    278         public static function has_members( $group_id ) {
     278        function has_members( $group_id ) {
    279279                global $wpdb, $bp;
    280280
     
    287287        }
    288288
    289         public static function has_membership_requests( $group_id ) {
     289        function has_membership_requests( $group_id ) {
    290290                global $wpdb, $bp;
    291291
     
    293293        }
    294294
    295         public static function get_membership_requests( $group_id, $limit = null, $page = null ) {
     295        function get_membership_requests( $group_id, $limit = null, $page = null ) {
    296296                global $wpdb, $bp;
    297297
     
    306306        }
    307307
    308         public static function get( $type = 'newest', $per_page = null, $page = null, $user_id = 0, $search_terms = false, $include = false, $populate_extras = true, $exclude = false, $show_hidden = false ) {
     308        function get( $type = 'newest', $per_page = null, $page = null, $user_id = 0, $search_terms = false, $include = false, $populate_extras = true, $exclude = false, $show_hidden = false ) {
    309309                global $wpdb, $bp;
    310310
     
    431431        }
    432432
    433         public static function get_by_most_forum_topics( $limit = null, $page = null, $user_id = 0, $search_terms = false, $populate_extras = true, $exclude = false ) {
     433        function get_by_most_forum_topics( $limit = null, $page = null, $user_id = 0, $search_terms = false, $populate_extras = true, $exclude = false ) {
    434434                global $wpdb, $bp, $bbdb;
    435435
     
    472472        }
    473473
    474         public static function get_by_most_forum_posts( $limit = null, $page = null, $search_terms = false, $populate_extras = true, $exclude = false ) {
     474        function get_by_most_forum_posts( $limit = null, $page = null, $search_terms = false, $populate_extras = true, $exclude = false ) {
    475475                global $wpdb, $bp, $bbdb;
    476476
     
    513513        }
    514514
    515         public static function get_by_letter( $letter, $limit = null, $page = null, $populate_extras = true, $exclude = false ) {
     515        function get_by_letter( $letter, $limit = null, $page = null, $populate_extras = true, $exclude = false ) {
    516516                global $wpdb, $bp;
    517517
     
    553553        }
    554554
    555         public static function get_random( $limit = null, $page = null, $user_id = 0, $search_terms = false, $populate_extras = true, $exclude = false ) {
     555        function get_random( $limit = null, $page = null, $user_id = 0, $search_terms = false, $populate_extras = true, $exclude = false ) {
    556556                global $wpdb, $bp;
    557557
     
    592592        }
    593593
    594         public static function get_group_extras( &$paged_groups, &$group_ids, $type = false ) {
     594        function get_group_extras( &$paged_groups, &$group_ids, $type = false ) {
    595595                global $bp, $wpdb;
    596596
     
    624624        }
    625625
    626         public static function delete_all_invites( $group_id ) {
     626        function delete_all_invites( $group_id ) {
    627627                global $wpdb, $bp;
    628628
     
    630630        }
    631631
    632         public static function get_total_group_count() {
     632        function get_total_group_count() {
    633633                global $wpdb, $bp;
    634634
     
    640640        }
    641641
    642         public static function get_global_forum_topic_count( $type ) {
     642        function get_global_forum_topic_count( $type ) {
    643643                global $bbdb, $wpdb, $bp;
    644644
     
    651651        }
    652652
    653         public static function get_total_member_count( $group_id ) {
     653        function get_total_member_count( $group_id ) {
    654654                global $wpdb, $bp;
    655655
     
    666666         * @return int The topic count
    667667         */
    668         public static function get_global_topic_count( $status = 'public', $search_terms = false ) {
     668        function get_global_topic_count( $status = 'public', $search_terms = false ) {
    669669                global $bbdb, $wpdb, $bp;
    670670
     
    720720        var $user;
    721721
    722         public function __construct( $user_id = 0, $group_id = 0, $id = false, $populate = true ) {
    723                
     722        function __construct( $user_id = 0, $group_id = 0, $id = false, $populate = true ) {
     723
    724724                // User and group are not empty, and ID is
    725725                if ( !empty( $user_id ) && !empty( $group_id ) && empty( $id ) ) {
     
    742742        }
    743743
    744         private function populate() {
     744        function populate() {
    745745                global $wpdb, $bp;
    746746
     
    771771        }
    772772
    773         public function save() {
     773        function save() {
    774774                global $wpdb, $bp;
    775775
     
    809809        }
    810810
    811         public function promote( $status = 'mod' ) {
     811        function promote( $status = 'mod' ) {
    812812                if ( 'mod' == $status ) {
    813813                        $this->is_admin   = 0;
     
    825825        }
    826826
    827         public function demote() {
     827        function demote() {
    828828                $this->is_mod     = 0;
    829829                $this->is_admin   = 0;
     
    833833        }
    834834
    835         public function ban() {
     835        function ban() {
    836836
    837837                if ( !empty( $this->is_admin ) )
     
    850850        }
    851851
    852         public function unban() {
     852        function unban() {
    853853
    854854                if ( !empty( $this->is_admin ) )
     
    863863        }
    864864
    865         public function accept_invite() {
     865        function accept_invite() {
    866866
    867867                $this->inviter_id    = 0;
     
    872872        }
    873873
    874         public function accept_request() {
     874        function accept_request() {
    875875
    876876                $this->is_confirmed = 1;
     
    880880        }
    881881
    882         public function remove() {
     882        function remove() {
    883883                global $wpdb, $bp;
    884884
     
    899899        /** Static Methods ********************************************************/
    900900
    901         public static function delete( $user_id, $group_id ) {
     901        function delete( $user_id, $group_id ) {
    902902                global $wpdb, $bp;
    903903
     
    905905        }
    906906
    907         public static function get_group_ids( $user_id, $limit = false, $page = false ) {
     907        function get_group_ids( $user_id, $limit = false, $page = false ) {
    908908                global $wpdb, $bp;
    909909
     
    926926        }
    927927
    928         public static function get_recently_joined( $user_id, $limit = false, $page = false, $filter = false ) {
     928        function get_recently_joined( $user_id, $limit = false, $page = false, $filter = false ) {
    929929                global $wpdb, $bp;
    930930
     
    948948        }
    949949
    950         public static function get_is_admin_of( $user_id, $limit = false, $page = false, $filter = false ) {
     950        function get_is_admin_of( $user_id, $limit = false, $page = false, $filter = false ) {
    951951                global $wpdb, $bp;
    952952
     
    970970        }
    971971
    972         public static function get_is_mod_of( $user_id, $limit = false, $page = false, $filter = false ) {
     972        function get_is_mod_of( $user_id, $limit = false, $page = false, $filter = false ) {
    973973                global $wpdb, $bp;
    974974
     
    992992        }
    993993
    994         public static function total_group_count( $user_id = 0 ) {
     994        function total_group_count( $user_id = 0 ) {
    995995                global $bp, $wpdb;
    996996
     
    10051005        }
    10061006
    1007         public static function get_invites( $user_id, $limit = false, $page = false, $exclude = false ) {
     1007        function get_invites( $user_id, $limit = false, $page = false, $exclude = false ) {
    10081008                global $wpdb, $bp;
    10091009
     
    10181018        }
    10191019
    1020         public static function check_has_invite( $user_id, $group_id, $type = 'sent' ) {
     1020        function check_has_invite( $user_id, $group_id, $type = 'sent' ) {
    10211021                global $wpdb, $bp;
    10221022
     
    10321032        }
    10331033
    1034         public static function delete_invite( $user_id, $group_id ) {
     1034        function delete_invite( $user_id, $group_id ) {
    10351035                global $wpdb, $bp;
    10361036
     
    10411041        }
    10421042
    1043         public static function delete_request( $user_id, $group_id ) {
     1043        function delete_request( $user_id, $group_id ) {
    10441044                global $wpdb, $bp;
    10451045
     
    10501050        }
    10511051
    1052         public static function check_is_admin( $user_id, $group_id ) {
     1052        function check_is_admin( $user_id, $group_id ) {
    10531053                global $wpdb, $bp;
    10541054
     
    10591059        }
    10601060
    1061         public static function check_is_mod( $user_id, $group_id ) {
     1061        function check_is_mod( $user_id, $group_id ) {
    10621062                global $wpdb, $bp;
    10631063
     
    10681068        }
    10691069
    1070         public static function check_is_member( $user_id, $group_id ) {
     1070        function check_is_member( $user_id, $group_id ) {
    10711071                global $wpdb, $bp;
    10721072
     
    10771077        }
    10781078
    1079         public static function check_is_banned( $user_id, $group_id ) {
     1079        function check_is_banned( $user_id, $group_id ) {
    10801080                global $wpdb, $bp;
    10811081
     
    10951095         * @since 1.2.6
    10961096         */
    1097         public static function check_is_creator( $user_id, $group_id ) {
     1097        function check_is_creator( $user_id, $group_id ) {
    10981098                global $bp, $wpdb;
    10991099
     
    11041104        }
    11051105
    1106         public static function check_for_membership_request( $user_id, $group_id ) {
     1106        function check_for_membership_request( $user_id, $group_id ) {
    11071107                global $wpdb, $bp;
    11081108
     
    11131113        }
    11141114
    1115         public static function get_random_groups( $user_id, $total_groups = 5 ) {
     1115        function get_random_groups( $user_id, $total_groups = 5 ) {
    11161116                global $wpdb, $bp;
    11171117
     
    11241124        }
    11251125
    1126         public static function get_group_member_ids( $group_id ) {
     1126        function get_group_member_ids( $group_id ) {
    11271127                global $bp, $wpdb;
    11281128
     
    11301130        }
    11311131
    1132         public static function get_group_administrator_ids( $group_id ) {
     1132        function get_group_administrator_ids( $group_id ) {
    11331133                global $bp, $wpdb;
    11341134
     
    11361136        }
    11371137
    1138         public static function get_group_moderator_ids( $group_id ) {
     1138        function get_group_moderator_ids( $group_id ) {
    11391139                global $bp, $wpdb;
    11401140
     
    11421142        }
    11431143
    1144         public static function get_all_membership_request_user_ids( $group_id ) {
     1144        function get_all_membership_request_user_ids( $group_id ) {
    11451145                global $bp, $wpdb;
    11461146
     
    11481148        }
    11491149
    1150         public static function get_all_for_group( $group_id, $limit = false, $page = false, $exclude_admins_mods = true, $exclude_banned = true, $exclude = false ) {
     1150        function get_all_for_group( $group_id, $limit = false, $page = false, $exclude_admins_mods = true, $exclude_banned = true, $exclude = false ) {
    11511151                global $bp, $wpdb;
    11521152
     
    12001200        }
    12011201
    1202         public static function delete_all( $group_id ) {
     1202        function delete_all( $group_id ) {
    12031203                global $wpdb, $bp;
    12041204
     
    12151215         * @uses BP_Groups_Member
    12161216         */
    1217         public static function delete_all_for_user( $user_id ) {
     1217        function delete_all_for_user( $user_id ) {
    12181218                global $bp, $wpdb;
    12191219
Note: See TracChangeset for help on using the changeset viewer.