Skip to:
Content

BuddyPress.org


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

Merging 1.1 branch changes and syncing.

File:
1 edited

Legend:

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

    r1910 r2077  
    66        var $wire_posts;
    77        var $wire_post;
    8        
     8
    99        var $in_the_loop;
    10        
     10
    1111        var $pag_page;
    1212        var $pag_num;
    1313        var $pag_links;
    1414        var $total_wire_post_count;
    15        
     15
    1616        var $can_post;
    17        
     17
    1818        var $table_name;
    19        
     19
    2020        function bp_wire_posts_template( $item_id, $component_slug, $can_post, $per_page, $max ) {
    2121                global $bp;
     
    2525                } else
    2626                        $this->table_name = $bp->{$bp->active_components[$component_slug]}->table_name_wire;
    27                
     27
    2828                $this->pag_page = isset( $_REQUEST['wpage'] ) ? intval( $_REQUEST['wpage'] ) : 1;
    2929                $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
     
    3131                $this->wire_posts = BP_Wire_Post::get_all_for_item( $item_id, $this->table_name, $this->pag_page, $this->pag_num );
    3232                $this->total_wire_post_count = (int)$this->wire_posts['count'];
    33                
     33
    3434                $this->wire_posts = $this->wire_posts['wire_posts'];
    3535                $this->wire_post_count = count($this->wire_posts);
    36                
     36
    3737                if ( is_site_admin() || ( (int)get_site_option('non-friend-wire-posting') && ( $bp->current_component == $bp->profile->slug || $bp->current_component == $bp->wire->slug ) ) )
    3838                        $this->can_post = 1;
    3939                else
    4040                        $this->can_post = $can_post;
    41                
     41
    4242                $this->pag_links = paginate_links( array(
    4343                        'base' => add_query_arg( 'wpage', '%#%', $bp->displayed_user->domain ),
     
    4949                        'mid_size' => 1
    5050                ));
    51                
    52         }
    53        
     51
     52        }
     53
    5454        function has_wire_posts() {
    5555                if ( $this->wire_post_count )
    5656                        return true;
    57                
     57
    5858                return false;
    5959        }
    60        
     60
    6161        function next_wire_post() {
    6262                $this->current_wire_post++;
    6363                $this->wire_post = $this->wire_posts[$this->current_wire_post];
    64                
     64
    6565                return $this->wire_post;
    6666        }
    67        
     67
    6868        function rewind_wire_posts() {
    6969                $this->current_wire_post = -1;
     
    7272                }
    7373        }
    74        
    75         function user_wire_posts() { 
     74
     75        function user_wire_posts() {
    7676                if ( $this->current_wire_post + 1 < $this->wire_post_count ) {
    7777                        return true;
     
    8585                return false;
    8686        }
    87        
     87
    8888        function the_wire_post() {
    8989                global $wire_post;
     
    9999function bp_has_wire_posts( $args = '' ) {
    100100        global $wire_posts_template, $bp;
    101        
     101
    102102        $defaults = array(
    103103                'item_id' => false,
     
    110110        $r = wp_parse_args( $args, $defaults );
    111111        extract( $r, EXTR_SKIP );
    112        
     112
    113113        if ( !$item_id )
    114114                return false;
    115                
    116         $wire_posts_template = new BP_Wire_Posts_Template( $item_id, $component_slug, $can_post, $per_page, $max );             
     115
     116        $wire_posts_template = new BP_Wire_Posts_Template( $item_id, $component_slug, $can_post, $per_page, $max );
    117117        return apply_filters( 'bp_has_wire_posts', $wire_posts_template->has_wire_posts(), &$wire_posts_template );
    118118}
     
    133133        if ( !$item_id )
    134134                return false;
    135        
     135
    136136        if ( !$empty_message )
    137137                $empty_message = __("There are currently no wire posts.", 'buddypress');
    138        
     138
    139139        if ( !$title )
    140140                $title = __('Wire', 'buddypress');
     
    146146        $bp_wire_can_post = $can_post;
    147147        $bp_wire_show_email_notify = $show_email_notify;
    148        
     148
    149149        locate_template( array( '/wire/post-list.php' ), true );
    150150}
     
    157157                return apply_filters( 'bp_get_wire_title', $bp_wire_header );
    158158        }
    159        
     159
    160160function bp_wire_item_id( $deprecated = false ) {
    161161        global $bp_item_id;
    162        
     162
    163163        if ( $deprecated )
    164164                echo bp_get_wire_item_id();
     
    179179                return apply_filters( 'bp_get_wire_no_posts_message', $bp_wire_msg );
    180180        }
    181        
     181
    182182function bp_wire_can_post() {
    183183        global $bp_wire_can_post;
     
    192192function bp_wire_post_id( $deprecated = true ) {
    193193        global $wire_posts_template;
    194        
     194
    195195        if ( !$deprecated )
    196196                return bp_get_wire_post_id();
     
    218218        if ( $wire_posts_template->total_wire_post_count > $wire_posts_template->pag_num )
    219219                return true;
    220        
     220
    221221        return false;
    222222}
     
    230230                return apply_filters( 'bp_get_wire_pagination', $wire_posts_template->pag_links );
    231231        }
    232        
     232
    233233function bp_wire_pagination_count() {
    234234        echo bp_get_wire_pagination_count();
     
    238238
    239239                $from_num = intval( ( $wire_posts_template->pag_page - 1 ) * $wire_posts_template->pag_num ) + 1;
    240                 $to_num = ( $from_num + ( $wire_posts_template->pag_num - 1) > $wire_posts_template->total_wire_post_count ) ? $wire_posts_template->total_wire_post_count : $from_num + ( $wire_posts_template->pag_num - 1); 
    241 
    242                 return apply_filters( 'bp_get_wire_pagination_count', sprintf( __( 'Viewing post %d to %d (%d total posts)', 'buddypress' ), $from_num, $to_num, $wire_posts_template->total_wire_post_count ) ); 
    243         }
    244        
     240                $to_num = ( $from_num + ( $wire_posts_template->pag_num - 1) > $wire_posts_template->total_wire_post_count ) ? $wire_posts_template->total_wire_post_count : $from_num + ( $wire_posts_template->pag_num - 1);
     241
     242                return apply_filters( 'bp_get_wire_pagination_count', sprintf( __( 'Viewing post %d to %d (%d total posts)', 'buddypress' ), $from_num, $to_num, $wire_posts_template->total_wire_post_count ) );
     243        }
     244
    245245function bp_wire_ajax_loader_src() {
    246246        echo bp_get_wire_ajax_loader_src();
     
    262262        function bp_get_wire_post_date() {
    263263                global $wire_posts_template;
    264                
     264
    265265                return apply_filters( 'bp_get_wire_post_date', mysql2date( get_blog_option( BP_ROOT_BLOG, 'date_format'), $wire_posts_template->wire_post->date_posted ) );
    266266        }
     
    268268function bp_wire_post_author_name( $deprecated = true ) {
    269269        global $wire_posts_template;
    270        
     270
    271271        if ( !$deprecated )
    272272                return bp_get_wire_post_author_name();
     
    291291function bp_wire_get_post_form() {
    292292        global $wire_posts_template;
    293        
     293
    294294        if ( is_user_logged_in() && $wire_posts_template->can_post )
    295                 locate_template( array( '/wire/post-form.php' ), true );       
     295                locate_template( array( '/wire/post-form.php' ), true );
    296296}
    297297
     
    339339                return bp_get_wire_poster_date();
    340340        else
    341                 echo bp_get_wire_poster_date(); 
     341                echo bp_get_wire_poster_date();
    342342}
    343343        function bp_get_wire_poster_date() {
    344                 return apply_filters( 'bp_get_wire_poster_date', mysql2date( get_blog_option( BP_ROOT_BLOG, 'date_format' ), date("Y-m-d H:i:s") ) );   
     344                return apply_filters( 'bp_get_wire_poster_date', mysql2date( get_blog_option( BP_ROOT_BLOG, 'date_format' ), date("Y-m-d H:i:s") ) );
    345345        }
    346346
Note: See TracChangeset for help on using the changeset viewer.