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-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
Note: See TracChangeset for help on using the changeset viewer.