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-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.