Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/10/2012 09:02:53 PM (15 years ago)
Author:
johnjamesjacoby
Message:

Remove unneeded globals and clean up some code in Messages component. See #3989.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-messages/bp-messages-functions.php

    r5417 r5696  
    11<?php
    2 /*******************************************************************************
     2
     3/**
     4 * BuddyPress Messages Functions
     5 *
    36 * Business functions are where all the magic happens in BuddyPress. They will
    47 * handle the actual saving or manipulation of information. Usually they will
    58 * hand off to a database class for data access, then return
    69 * true or false on success or failure.
     10 *
     11 * @package BuddyPress
     12 * @subpackage MessagesFunctions
    713 */
    814
     
    1117
    1218function messages_new_message( $args = '' ) {
    13         global $bp;
    1419
    1520        $defaults = array (
     
    144149                $error = 0;
    145150                for ( $i = 0, $count = count( $thread_ids ); $i < $count; ++$i ) {
    146                         if ( !$status = BP_Messages_Thread::delete( $thread_ids[$i]) )
     151                        if ( !$status = BP_Messages_Thread::delete( $thread_ids[$i]) ) {
    147152                                $error = 1;
     153                        }
    148154                }
    149155
     
    165171
    166172function messages_check_thread_access( $thread_id, $user_id = 0 ) {
    167         global $bp;
    168 
    169173        if ( empty( $user_id ) )
    170174                $user_id = bp_loggedin_user_id();
     
    194198
    195199function messages_get_unread_count( $user_id = 0 ) {
    196         global $bp;
    197 
    198200        if ( empty( $user_id ) )
    199201                $user_id = bp_loggedin_user_id();
     
    213215        return BP_Messages_Thread::is_valid( $thread_id );
    214216}
    215 
    216 /*******************************************************************************
    217  * These functions handle the recording, deleting and formatting of activity and
    218  * notifications for the user and for this specific component.
    219  */
    220217
    221218/**
     
    231228 */
    232229function messages_format_notifications( $action, $item_id, $secondary_item_id, $total_items, $format = 'string' ) {
    233         global $bp;
    234230
    235231        if ( 'new_message' == $action ) {
     
    237233                $title = __( 'Inbox', 'buddypress' );
    238234
    239                 if ( (int)$total_items > 1 ) {
     235                if ( (int) $total_items > 1 ) {
    240236                        $text = sprintf( __('You have %d new messages', 'buddypress' ), (int)$total_items );
    241237                        $filter = 'bp_messages_multiple_new_message_notification';
     
    252248                        'text' => $text,
    253249                        'link' => $link
    254                 ), $link, (int)$total_items, $text, $link );
     250                ), $link, (int) $total_items, $text, $link );
    255251        }
    256252
     
    259255        return $return;
    260256}
     257
    261258?>
Note: See TracChangeset for help on using the changeset viewer.