Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/02/2009 07:54:21 PM (16 years ago)
Author:
apeatling
Message:

Merging 1.1 branch changes and syncing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-friends/bp-friends-templatetags.php

    r2032 r2077  
    66    var $friendships;
    77    var $friendship;
    8    
     8
    99    var $in_the_loop;
    10    
     10
    1111    var $pag_page;
    1212    var $pag_num;
    1313    var $pag_links;
    1414    var $total_friend_count;
    15    
     15
    1616    function bp_friendship_template( $user_id, $type, $per_page, $max, $filter ) {
    1717        global $bp;
     
    1919        if ( !$user_id )
    2020            $user_id = $bp->displayed_user->id;
    21                    
     21
    2222        $this->pag_page = isset( $_REQUEST['frpage'] ) ? intval( $_REQUEST['frpage'] ) : 1;
    2323        $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
     
    2828                $this->friendships = friends_get_newest( $user_id, $this->pag_num, $this->pag_page, $filter );
    2929                break;
    30            
     30
    3131            case 'alphabetical':
    32                 $this->friendships = friends_get_alphabetically( $user_id, $this->pag_num, $this->pag_page, $filter );             
     32                $this->friendships = friends_get_alphabetically( $user_id, $this->pag_num, $this->pag_page, $filter );
    3333                break;
    3434
     
    3838
    3939            case 'active': default:
    40                 $this->friendships = friends_get_recently_active( $user_id, $this->pag_num, $this->pag_page, $filter ); 
     40                $this->friendships = friends_get_recently_active( $user_id, $this->pag_num, $this->pag_page, $filter );
    4141                break;
    4242        }
     
    7474        ));
    7575    }
    76    
     76
    7777    function has_friendships() {
    7878        if ( $this->friendship_count )
    7979            return true;
    80        
     80
    8181        return false;
    8282    }
    83    
     83
    8484    function next_friendship() {
    8585        $this->current_friendship++;
    8686        $this->friendship = $this->friendships[$this->current_friendship];
    87        
     87
    8888        return $this->friendship;
    8989    }
    90    
     90
    9191    function rewind_friendships() {
    9292        $this->current_friendship = -1;
     
    9595        }
    9696    }
    97    
    98     function user_friendships() { 
     97
     98    function user_friendships() {
    9999        if ( $this->current_friendship + 1 < $this->friendship_count ) {
    100100            return true;
     
    108108        return false;
    109109    }
    110    
     110
    111111    function the_friendship() {
    112112        global $friendship, $bp;
     
    123123            else
    124124                $user_id = $this->friendship->user_id;
    125            
     125
    126126            $this->friendship = new stdClass;
    127                
     127
    128128            if ( !$this->friendship->friend = wp_cache_get( 'bp_user_' . $user_id, 'bp' ) ) {
    129129                $this->friendship->friend = new BP_Core_User( $user_id );
    130130                wp_cache_set( 'bp_user_' . $user_id, $this->friendship->friend, 'bp' );
    131131            }
    132            
     132
    133133            /* Make sure the user_id is available in the friend object. */
    134134            $this->friendship->friend->user_id = $user_id;
     
    153153    $r = wp_parse_args( $args, $defaults );
    154154    extract( $r, EXTR_SKIP );
    155    
     155
    156156    /* The following code will auto set parameters based on the page being viewed.
    157157     * for example on example.com/members/andy/friends/my-friends/newest/
     
    167167        $type = 'requests';
    168168    }
    169    
     169
    170170    if ( isset( $_REQUEST['friend-search-box'] ) )
    171171        $filter = $_REQUEST['friend-search-box'];
     
    190190    function bp_get_friend_id() {
    191191        global $friends_template;
    192        
    193         return apply_filters( 'bp_get_friend_id', $friends_template->friendship->friend->user_id ); 
     192
     193        return apply_filters( 'bp_get_friend_id', $friends_template->friendship->friend->user_id );
    194194    }
    195195
     
    208208    function bp_get_friend_name() {
    209209        global $friends_template;
    210        
    211         return apply_filters( 'bp_get_friend_name', strip_tags( $friends_template->friendship->friend->user_link ) );   
    212     }
    213    
     210
     211        return apply_filters( 'bp_get_friend_name', strip_tags( $friends_template->friendship->friend->user_link ) );
     212    }
     213
    214214function bp_friend_link() {
    215215    echo bp_get_friend_link();
     
    238238        return apply_filters( 'bp_get_friend_last_active', $friends_template->friendship->friend->last_active );
    239239    }
    240    
     240
    241241function bp_friend_time_since_requested() {
    242242    echo bp_get_friend_time_since_requested();
     
    248248            return apply_filters( 'bp_friend_time_since_requested', sprintf( __( 'requested %s ago', 'buddypress' ), bp_core_time_since( strtotime( $friends_template->friendship->date_created ) ) ) );
    249249        }
    250        
     250
    251251        return false;
    252252    }
     
    267267        global $friends_template, $bp;
    268268
    269         return apply_filters( 'bp_get_friend_reject_request_link', wp_nonce_url( $bp->loggedin_user->domain . $bp->friends->slug . '/requests/reject/' . $friends_template->friendship->id, 'friends_reject_friendship' ) );   
     269        return apply_filters( 'bp_get_friend_reject_request_link', wp_nonce_url( $bp->loggedin_user->domain . $bp->friends->slug . '/requests/reject/' . $friends_template->friendship->id, 'friends_reject_friendship' ) );
    270270    }
    271271
     
    275275    function bp_get_friend_pagination() {
    276276        global $friends_template;
    277        
     277
    278278        return apply_filters( 'bp_friend_pagination', $friends_template->pag_links );
    279279    }
     
    286286
    287287    echo sprintf( __( 'Viewing friend %d to %d (of %d friends)', 'buddypress' ), $from_num, $to_num, $friends_template->total_friend_count ); ?> &nbsp;
    288     <span class="ajax-loader"></span><?php 
     288    <span class="ajax-loader"></span><?php
    289289}
    290290
     
    295295        return apply_filters( 'bp_get_friend_total_for_member', BP_Friends_Friendship::total_friend_count() );
    296296    }
    297    
     297
    298298function bp_friend_search_form() {
    299299    global $friends_template, $bp;
     
    306306        <label for="friend-search-box" id="friend-search-label"><?php echo $label ?></label>
    307307        <input type="search" name="friend-search-box" id="friend-search-box" value="<?php echo $value ?>"<?php echo $disabled ?> />
    308        
     308
    309309        <?php wp_nonce_field( 'friends_search', '_wpnonce_friend_search' ) ?>
    310310        <input type="hidden" name="initiator" id="initiator" value="<?php echo attribute_escape( $bp->displayed_user->id ) ?>" />
    311    
     311
    312312    </form>
    313313<?php
     
    317317    if ( isset( $_POST['friend-search-box'] ) )
    318318        return true;
    319    
     319
    320320    return false;
    321321}
     
    328328function bp_friend_latest_update_link() {
    329329    global $bp;
    330     echo apply_filters( 'bp_friend_latest_update_link', $bp->displayed_user->domain . 'my-friends/last-updated' ); 
     330    echo apply_filters( 'bp_friend_latest_update_link', $bp->displayed_user->domain . 'my-friends/last-updated' );
    331331}
    332332
    333333function bp_friend_recent_activity_link() {
    334334    global $bp;
    335     echo apply_filters( 'bp_friend_recent_activity_link', $bp->displayed_user->domain . 'my-friends/recently-active' ); 
     335    echo apply_filters( 'bp_friend_recent_activity_link', $bp->displayed_user->domain . 'my-friends/recently-active' );
    336336}
    337337
    338338function bp_friend_recent_status_link() {
    339339    global $bp;
    340     echo apply_filters( 'bp_friend_recent_status_link', $bp->displayed_user->domain . 'my-friends/status-updates' );   
     340    echo apply_filters( 'bp_friend_recent_status_link', $bp->displayed_user->domain . 'my-friends/status-updates' );
    341341}
    342342
     
    346346    function bp_get_add_friend_button( $potential_friend_id = false ) {
    347347        global $bp, $friends_template;
    348    
     348
    349349        $button = false;
    350        
     350
    351351        if ( is_user_logged_in() ) {
    352        
     352
    353353            if ( !$potential_friend_id && $friends_template->friendship->friend )
    354354                $potential_friend_id = $friends_template->friendship->friend->id;
     
    371371            $button .= '</div>';
    372372        }
    373        
     373
    374374        return apply_filters( 'bp_get_add_friend_button', $button );
    375375    }
     
    387387function bp_friends_filter_title() {
    388388    global $bp;
    389    
     389
    390390    $current_filter = $bp->action_variables[0];
    391    
     391
    392392    switch ( $current_filter ) {
    393393        case 'recently-active': default:
     
    405405function bp_friends_random_friends() {
    406406    global $bp;
    407    
     407
    408408    if ( !$friend_ids = wp_cache_get( 'friends_friend_ids_' . $bp->displayed_user->id, 'bp' ) ) {
    409409        $friend_ids = BP_Friends_Friendship::get_random_friends( $bp->displayed_user->id );
    410410        wp_cache_set( 'friends_friend_ids_' . $bp->displayed_user->id, $friend_ids, 'bp' );
    411411    }
    412 ?> 
     412?>
    413413    <div class="info-group">
    414414        <h4><?php bp_word_or_name( __( "My Friends", 'buddypress' ), __( "%s's Friends", 'buddypress' ) ) ?>  (<?php echo BP_Friends_Friendship::total_friend_count( $bp->displayed_user->id ) ?>) <span><a href="<?php echo $bp->displayed_user->domain . $bp->friends->slug ?>"><?php _e('See All', 'buddypress') ?> &raquo;</a></span></h4>
    415        
     415
    416416        <?php if ( $friend_ids ) { ?>
    417417            <ul class="horiz-gallery">
     
    435435function bp_friends_random_members( $total_members = 5 ) {
    436436    global $bp;
    437    
     437
    438438    if ( !$user_ids = wp_cache_get( 'friends_random_users', 'bp' ) ) {
    439439        $user_ids = BP_Core_User::get_random_users( $total_members );
    440440        wp_cache_set( 'friends_random_users', $user_ids, 'bp' );
    441441    }
    442 ?> 
     442?>
    443443    <?php if ( $user_ids['users'] ) { ?>
    444444        <ul class="item-list" id="random-members-list">
     
    454454                    </div>
    455455                <?php } ?>
    456                
     456
    457457                <div class="action">
    458458                    <?php if ( function_exists( 'bp_add_friend_button' ) ) { ?>
     
    466466        <div id="message" class="info">
    467467            <p><?php _e( "There aren't enough site members to show a random sample just yet.", 'buddypress' ) ?></p>
    468         </div>     
     468        </div>
    469469    <?php } ?>
    470470<?php
Note: See TracChangeset for help on using the changeset viewer.