Skip to:
Content

BuddyPress.org

Changeset 554


Ignore:
Timestamp:
11/18/2008 04:41:06 PM (18 years ago)
Author:
apeatling
Message:

Template tag updates to support translation in themes.

Location:
trunk
Files:
2 edited

Legend:

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

    r428 r554  
    221221}
    222222
    223 function bp_post_title() {
    224         global $posts_template;
    225         echo $posts_template->post->post_title;
     223function bp_post_title( $echo = true ) {
     224        global $posts_template;
     225       
     226        if ( $echo )
     227                echo $posts_template->post->post_title;
     228        else
     229                return $posts_template->post->post_title;
    226230}
    227231
    … …  
    249253}
    250254
    251 function bp_post_date( $date_format = null ) {
     255function bp_post_date( $date_format = null, $echo = true ) {
    252256        global $posts_template;
    253257       
    … …  
    255259                $date_format = get_option('date_format');
    256260               
    257         echo mysql2date( $date_format, $posts_template->post->post_date );
     261        if ( $echo )
     262                echo mysql2date( $date_format, $posts_template->post->post_date );
     263        else
     264                return mysql2date( $date_format, $posts_template->post->post_date );
    258265}
    259266
    … …  
    300307}
    301308
    302 function bp_post_author() {
    303         global $posts_template;
    304         echo bp_core_get_userlink( $posts_template->post->post_author );       
     309function bp_post_author( $echo = true ) {
     310        global $posts_template;
     311       
     312        if ( $echo )
     313                echo bp_core_get_userlink( $posts_template->post->post_author );
     314        else
     315                return bp_core_get_userlink( $posts_template->post->post_author );
    305316}
    306317
    … …  
    310321}
    311322
    312 function bp_post_category( $separator = '', $parents='', $post_id = false ) {
    313         global $posts_template;
    314         echo get_the_category_list($separator, $parents, $posts_template->post->ID );   
     323function bp_post_category( $separator = '', $parents='', $post_id = false, $echo = true ) {
     324        global $posts_template;
     325       
     326        if ( $echo )
     327                echo get_the_category_list( $separator, $parents, $posts_template->post->ID );
     328        else
     329                return get_the_category_list( $separator, $parents, $posts_template->post->ID );
    315330}
    316331
    … …  
    556571}
    557572
    558 function bp_comment_post_permalink() {
    559         global $comments_template;
    560         echo bp_post_get_permalink( $comments_template->comment->post, $comments_template->comment->blog_id ) . '#comment-' . $comments_template->comment->comment_ID;
    561 }
    562 
    563 function bp_comment_post_title() {
    564         global $comments_template;
    565         echo $comments_template->comment->post->post_title;
    566 }
    567 
    568 function bp_comment_author() {
    569         global $comments_template;     
    570         echo bp_core_get_userlink( $comments_template->comment->user_id );
     573function bp_comment_post_permalink( $echo = true ) {
     574        global $comments_template;
     575       
     576        if ( $echo )
     577                echo bp_post_get_permalink( $comments_template->comment->post, $comments_template->comment->blog_id ) . '#comment-' . $comments_template->comment->comment_ID;
     578        else
     579                return bp_post_get_permalink( $comments_template->comment->post, $comments_template->comment->blog_id ) . '#comment-' . $comments_template->comment->comment_ID;
     580}
     581
     582function bp_comment_post_title( $echo = true ) {
     583        global $comments_template;
     584       
     585        if ( $echo )
     586                echo $comments_template->comment->post->post_title;
     587        else
     588                return $comments_template->comment->post->post_title;
     589}
     590
     591function bp_comment_author( $echo = true ) {
     592        global $comments_template;
     593       
     594        if ( $echo )
     595                echo bp_core_get_userlink( $comments_template->comment->user_id );
     596        else
     597                return bp_core_get_userlink( $comments_template->comment->user_id );
    571598}
    572599
    … …  
    579606}
    580607
    581 function bp_comment_date( $date_format = null ) {
     608function bp_comment_date( $date_format = null, $echo = true ) {
    582609        global $comments_template;
    583610       
    … …  
    585612                $date_format = get_option('date_format');
    586613               
    587         echo mysql2date( $date_format, $comments_template->comment->post->post_date );
    588 }
    589 
    590 function bp_comment_blog_permalink() {
    591         global $comments_template;
    592         echo get_blog_option( $comments_template->comment->blog_id, 'siteurl' );
    593 }
    594 
    595 function bp_comment_blog_name() {
    596         global $comments_template;
    597         echo get_blog_option( $comments_template->comment->blog_id, 'blogname' );
     614        if ( $echo == true )
     615                echo mysql2date( $date_format, $comments_template->comment->post->post_date );
     616        else
     617                return mysql2date( $date_format, $comments_template->comment->post->post_date );
     618}
     619
     620function bp_comment_blog_permalink( $echo = true ) {
     621        global $comments_template;
     622       
     623        if ( $echo )
     624                echo get_blog_option( $comments_template->comment->blog_id, 'siteurl' );
     625        else
     626                return get_blog_option( $comments_template->comment->blog_id, 'siteurl' );
     627}
     628
     629function bp_comment_blog_name( $echo = true ) {
     630        global $comments_template;
     631       
     632        if ( $echo )
     633                echo get_blog_option( $comments_template->comment->blog_id, 'blogname' );
     634        else
     635                return get_blog_option( $comments_template->comment->blog_id, 'blogname' );
    598636}
    599637
  • trunk/bp-groups/bp-groups-templatetags.php

    r548 r554  
    365365}
    366366
    367 function bp_group_all_members_permalink() {
     367function bp_group_all_members_permalink( $echo = true ) {
    368368        global $groups_template, $bp;
    369         echo bp_group_permalink( false, true ) . '/' . MEMBERS_SLUG ;
     369       
     370        if ( $echo )
     371                echo bp_group_permalink( false, true ) . '/' . MEMBERS_SLUG ;
     372        else
     373                return bp_group_permalink( false, false ) . '/' . MEMBERS_SLUG ;
    370374}
    371375
    … …  
    440444}
    441445
    442 function bp_group_total_members() {
    443         global $groups_template;
    444        
    445         echo $groups_template->group->total_member_count;
     446function bp_group_total_members( $echo = true ) {
     447        global $groups_template;
     448       
     449        if ( $echo )
     450                echo $groups_template->group->total_member_count;
     451        else
     452                return $groups_template->group->total_member_count;
    446453}
    447454
Note: See TracChangeset for help on using the changeset viewer.