Changeset 4678
- Timestamp:
- 07/18/2011 07:01:49 AM (15 years ago)
- Location:
- trunk
- Files:
-
- 13 edited
-
bp-activity/bp-activity-template.php (modified) (1 diff)
-
bp-blogs/bp-blogs-template.php (modified) (1 diff)
-
bp-core/bp-core-classes.php (modified) (1 diff)
-
bp-core/bp-core-functions.php (modified) (3 diffs)
-
bp-groups/bp-groups-template.php (modified) (4 diffs)
-
bp-groups/bp-groups-widgets.php (modified) (2 diffs)
-
bp-members/bp-members-template.php (modified) (3 diffs)
-
bp-messages/bp-messages-template.php (modified) (1 diff)
-
bp-themes/bp-default/_inc/ajax.php (modified) (1 diff)
-
bp-themes/bp-default/forums/single/forum-header.php (modified) (1 diff)
-
bp-themes/bp-default/groups/groups-loop.php (modified) (1 diff)
-
bp-themes/bp-default/groups/single/group-header.php (modified) (1 diff)
-
bp-xprofile/bp-xprofile-template.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity/bp-activity-template.php
r4674 r4678 1009 1009 return false; 1010 1010 1011 $date_recorded = sprintf( __( '%s ago', 'buddypress' ), bp_core_time_since( $activities_template->activity->current_comment->date_recorded ));1011 $date_recorded = bp_core_time_since( $activities_template->activity->current_comment->date_recorded ); 1012 1012 1013 1013 return apply_filters( 'bp_activity_comment_date_recorded', $date_recorded ); -
trunk/bp-blogs/bp-blogs-template.php
r4651 r4678 315 315 global $blogs_template; 316 316 317 return apply_filters( 'bp_blog_last_active', bp_core_get_last_activity( $blogs_template->blog->last_activity, __( 'active %s ago', 'buddypress' ) ) );317 return apply_filters( 'bp_blog_last_active', bp_core_get_last_activity( $blogs_template->blog->last_activity, __( 'active %s', 'buddypress' ) ) ); 318 318 } 319 319 -
trunk/bp-core/bp-core-classes.php
r4634 r4678 169 169 $this->avatar_thumb = bp_core_fetch_avatar( array( 'item_id' => $this->id, 'type' => 'thumb' ) ); 170 170 $this->avatar_mini = bp_core_fetch_avatar( array( 'item_id' => $this->id, 'type' => 'thumb', 'width' => 30, 'height' => 30 ) ); 171 $this->last_active = bp_core_get_last_activity( bp_get_user_meta( $this->id, 'last_activity', true ), __( 'active %s ago', 'buddypress' ) );171 $this->last_active = bp_core_get_last_activity( bp_get_user_meta( $this->id, 'last_activity', true ), __( 'active %s', 'buddypress' ) ); 172 172 } 173 173 -
trunk/bp-core/bp-core-functions.php
r4663 r4678 598 598 function bp_core_time_since( $older_date, $newer_date = false ) { 599 599 600 // Setup the strings 601 $unknown_text = apply_filters( 'bp_core_time_since_unknown_text', __( 'sometime', 'buddypress' ) ); 602 $right_now_text = apply_filters( 'bp_core_time_since_right_now_text', __( 'right now', 'buddypress' ) ); 603 $ago_text = apply_filters( 'bp_core_time_since_ago_text', __( '%s ago', 'buddypress' ) ); 604 600 605 // array of time period chunks 601 606 $chunks = array( 602 array( 60 * 60 * 24 * 365 , __( 'year', 'buddypress' ), __( 'years','buddypress' ) ),603 array( 60 * 60 * 24 * 30 , __( 'month', 'buddypress' ), __( 'months','buddypress' ) ),604 array( 60 * 60 * 24 * 7, __( 'week', 'buddypress' ), __( 'weeks','buddypress' ) ),605 array( 60 * 60 * 24 , __( 'day', 'buddypress' ), __( 'days','buddypress' ) ),606 array( 60 * 60 , __( 'hour', 'buddypress' ), __( 'hours','buddypress' ) ),607 array( 60 , __( 'minute', 'buddypress' ), __( 'minutes', 'buddypress' ) ),608 array( 1, __( 'second', 'buddypress' ), __( 'seconds', 'buddypress' ) )607 array( 60 * 60 * 24 * 365 , __( 'year', 'buddypress' ), __( 'years', 'buddypress' ) ), 608 array( 60 * 60 * 24 * 30 , __( 'month', 'buddypress' ), __( 'months', 'buddypress' ) ), 609 array( 60 * 60 * 24 * 7, __( 'week', 'buddypress' ), __( 'weeks', 'buddypress' ) ), 610 array( 60 * 60 * 24 , __( 'day', 'buddypress' ), __( 'days', 'buddypress' ) ), 611 array( 60 * 60 , __( 'hour', 'buddypress' ), __( 'hours', 'buddypress' ) ), 612 array( 60 , __( 'minute', 'buddypress' ), __( 'minutes', 'buddypress' ) ), 613 array( 1, __( 'second', 'buddypress' ), __( 'seconds', 'buddypress' ) ) 609 614 ); 610 615 … … 626 631 627 632 // Something went wrong with date calculation and we ended up with a negative date. 628 if ( 0 > $since ) 629 return __( 'sometime', 'buddypress' );630 633 if ( 0 > $since ) { 634 $output = $unknown_text; 635 631 636 /** 632 637 * We only want to output two chunks of time here, eg: … … 635 640 * so there's only two bits of calculation below: 636 641 */ 637 638 // Step one: the first chunk 639 for ( $i = 0, $j = count($chunks); $i < $j; $i++) { 640 $seconds = $chunks[$i][0]; 641 642 // Finding the biggest chunk (if the chunk fits, break) 643 if ( ( $count = floor($since / $seconds) ) != 0 ) 644 break; 645 } 646 647 // If $i iterates all the way to $j, then the event happened 0 seconds ago 648 if ( !isset( $chunks[$i] ) ) 649 return '0 ' . __( 'seconds', 'buddypress' ); 650 651 // Set output var 652 $output = ( 1 == $count ) ? '1 '. $chunks[$i][1] : $count . ' ' . $chunks[$i][2]; 653 654 // Step two: the second chunk 655 if ( $i + 2 < $j ) { 656 $seconds2 = $chunks[$i + 1][0]; 657 $name2 = $chunks[$i + 1][1]; 658 659 if ( ( $count2 = floor( ( $since - ( $seconds * $count ) ) / $seconds2 ) ) != 0 ) { 660 // Add to output var 661 $output .= ( 1 == $count2 ) ? _x( ',', 'Separator in time since', 'buddypress' ) . ' 1 '. $chunks[$i + 1][1] : _x( ',', 'Separator in time since', 'buddypress' ) . ' ' . $count2 . ' ' . $chunks[$i + 1][2]; 642 } else { 643 644 // Step one: the first chunk 645 for ( $i = 0, $j = count($chunks); $i < $j; $i++) { 646 $seconds = $chunks[$i][0]; 647 648 // Finding the biggest chunk (if the chunk fits, break) 649 if ( ( $count = floor($since / $seconds) ) != 0 ) { 650 break; 651 } 662 652 } 663 } 664 665 if ( !(int)trim( $output ) ) 666 $output = '0 ' . __( 'seconds', 'buddypress' ); 653 654 // If $i iterates all the way to $j, then the event happened 0 seconds ago 655 if ( !isset( $chunks[$i] ) ) { 656 $output = $right_now_text; 657 658 } else { 659 660 // Set output var 661 $output = ( 1 == $count ) ? '1 '. $chunks[$i][1] : $count . ' ' . $chunks[$i][2]; 662 663 // Step two: the second chunk 664 if ( $i + 2 < $j ) { 665 $seconds2 = $chunks[$i + 1][0]; 666 $name2 = $chunks[$i + 1][1]; 667 668 if ( ( $count2 = floor( ( $since - ( $seconds * $count ) ) / $seconds2 ) ) != 0 ) { 669 // Add to output var 670 $output .= ( 1 == $count2 ) ? _x( ',', 'Separator in time since', 'buddypress' ) . ' 1 '. $chunks[$i + 1][1] : _x( ',', 'Separator in time since', 'buddypress' ) . ' ' . $count2 . ' ' . $chunks[$i + 1][2]; 671 } 672 } 673 674 // No output, so happened right now 675 if ( !(int)trim( $output ) ) { 676 $output = $right_now_text; 677 } 678 } 679 } 680 681 // Append 'ago' to the end of time-since if not 'right now' 682 if ( $output != $right_now_text ) { 683 $output = sprintf( $ago_text, $output ); 684 } 667 685 668 686 return $output; -
trunk/bp-groups/bp-groups-template.php
r4649 r4678 1023 1023 <h5><?php echo bp_core_get_userlink( $admin->user_id ) ?></h5> 1024 1024 <span class="activity"> 1025 <?php echo bp_core_get_last_activity( strtotime( $admin->date_modified ), __( 'joined %s ago', 'buddypress') ); ?>1025 <?php echo bp_core_get_last_activity( strtotime( $admin->date_modified ), __( 'joined %s', 'buddypress') ); ?> 1026 1026 </span> 1027 1027 … … 1088 1088 <h5><?php echo bp_core_get_userlink( $mod->user_id ) ?></h5> 1089 1089 1090 <span class="activity"><?php echo bp_core_get_last_activity( strtotime( $mod->date_modified ), __( 'joined %s ago', 'buddypress') ); ?></span>1090 <span class="activity"><?php echo bp_core_get_last_activity( strtotime( $mod->date_modified ), __( 'joined %s', 'buddypress') ); ?></span> 1091 1091 1092 1092 <?php if ( bp_is_active( 'friends' ) ) : ?> … … 1853 1853 global $members_template; 1854 1854 1855 return apply_filters( 'bp_get_group_member_joined_since', bp_core_get_last_activity( $members_template->member->date_modified, __( 'joined %s ago', 'buddypress') ) );1855 return apply_filters( 'bp_get_group_member_joined_since', bp_core_get_last_activity( $members_template->member->date_modified, __( 'joined %s', 'buddypress') ) ); 1856 1856 } 1857 1857 … … 2509 2509 global $requests_template; 2510 2510 2511 echo apply_filters( 'bp_group_request_time_since_requested', sprintf( __( 'requested %s ago', 'buddypress' ), bp_core_time_since( strtotime( $requests_template->request->date_modified ) ) ) );2511 echo apply_filters( 'bp_group_request_time_since_requested', sprintf( __( 'requested %s', 'buddypress' ), bp_core_time_since( strtotime( $requests_template->request->date_modified ) ) ) ); 2512 2512 } 2513 2513 -
trunk/bp-groups/bp-groups-widgets.php
r4648 r4678 65 65 <?php 66 66 if ( 'newest' == $instance['group_default'] ) 67 printf( __( 'created %s ago', 'buddypress' ), bp_get_group_date_created() );67 printf( __( 'created %s', 'buddypress' ), bp_get_group_date_created() ); 68 68 if ( 'active' == $instance['group_default'] ) 69 printf( __( 'active %s ago', 'buddypress' ), bp_get_group_last_active() );69 printf( __( 'active %s', 'buddypress' ), bp_get_group_last_active() ); 70 70 else if ( 'popular' == $instance['group_default'] ) 71 71 bp_group_member_count(); … … 165 165 <?php 166 166 if ( 'newest-groups' == $_POST['filter'] ) { 167 printf( __( 'created %s ago', 'buddypress' ), bp_get_group_date_created() );167 printf( __( 'created %s', 'buddypress' ), bp_get_group_date_created() ); 168 168 } else if ( 'recently-active-groups' == $_POST['filter'] ) { 169 printf( __( 'active %s ago', 'buddypress' ), bp_get_group_last_active() );169 printf( __( 'active %s', 'buddypress' ), bp_get_group_last_active() ); 170 170 } else if ( 'popular-groups' == $_POST['filter'] ) { 171 171 bp_group_member_count(); -
trunk/bp-members/bp-members-template.php
r4645 r4678 495 495 496 496 if ( isset( $members_template->member->last_activity ) ) 497 $last_activity = bp_core_get_last_activity( $members_template->member->last_activity, __( 'active %s ago', 'buddypress' ) );497 $last_activity = bp_core_get_last_activity( $members_template->member->last_activity, __( 'active %s', 'buddypress' ) ); 498 498 else 499 499 $last_activity = __( 'Never active', 'buddypress' ); … … 557 557 global $members_template; 558 558 559 $registered = esc_attr( bp_core_get_last_activity( $members_template->member->user_registered, __( 'registered %s ago', 'buddypress' ) ) );559 $registered = esc_attr( bp_core_get_last_activity( $members_template->member->user_registered, __( 'registered %s', 'buddypress' ) ) ); 560 560 561 561 return apply_filters( 'bp_member_last_active', $registered ); … … 751 751 $user_id = $bp->displayed_user->id; 752 752 753 $last_activity = bp_core_get_last_activity( bp_get_user_meta( $user_id, 'last_activity', true ), __('active %s ago', 'buddypress') );753 $last_activity = bp_core_get_last_activity( bp_get_user_meta( $user_id, 'last_activity', true ), __('active %s', 'buddypress') ); 754 754 755 755 return apply_filters( 'bp_get_last_activity', $last_activity ); -
trunk/bp-messages/bp-messages-template.php
r4669 r4678 848 848 global $thread_template; 849 849 850 return apply_filters( 'bp_get_the_thread_message_time_since', sprintf( __( 'Sent %s ago', 'buddypress' ), bp_core_time_since( strtotime( $thread_template->message->date_sent ) ) ) );850 return apply_filters( 'bp_get_the_thread_message_time_since', sprintf( __( 'Sent %s', 'buddypress' ), bp_core_time_since( strtotime( $thread_template->message->date_sent ) ) ) ); 851 851 } 852 852 -
trunk/bp-themes/bp-default/_inc/ajax.php
r4671 r4678 528 528 <?php echo bp_loggedin_user_avatar( 'type=thumb&width=30&height=30' ); ?> 529 529 530 <strong><a href="<?php echo $bp->loggedin_user->domain ?>"><?php echo $bp->loggedin_user->fullname ?></a> <span class="activity"><?php printf( __( 'Sent %s ago', 'buddypress' ), bp_core_time_since( bp_core_current_time() ) ) ?></span></strong>530 <strong><a href="<?php echo $bp->loggedin_user->domain ?>"><?php echo $bp->loggedin_user->fullname ?></a> <span class="activity"><?php printf( __( 'Sent %s', 'buddypress' ), bp_core_time_since( bp_core_current_time() ) ) ?></span></strong> 531 531 532 532 <?php do_action( 'bp_after_message_meta' ) ?> -
trunk/bp-themes/bp-default/forums/single/forum-header.php
r4012 r4678 11 11 <div id="item-header-content"> 12 12 <h2><a href="<?php bp_forum_permalink(); ?>" title="<?php bp_forum_name(); ?>"><?php bp_forum_name(); ?></a></h2> 13 <span class="highlight"><?php //bp_forum_type(); ?></span> <span class="activity"><?php printf( __( 'active %s ago', 'buddypress' ), '' ); //bp_get_forum_last_active() ); ?></span>13 <span class="highlight"><?php //bp_forum_type(); ?></span> <span class="activity"><?php printf( __( 'active %s', 'buddypress' ), '' ); //bp_get_forum_last_active() ); ?></span> 14 14 15 15 <?php do_action( 'bp_before_forum_header_meta' ); ?> -
trunk/bp-themes/bp-default/groups/groups-loop.php
r3810 r4678 45 45 <div class="item"> 46 46 <div class="item-title"><a href="<?php bp_group_permalink(); ?>"><?php bp_group_name(); ?></a></div> 47 <div class="item-meta"><span class="activity"><?php printf( __( 'active %s ago', 'buddypress' ), bp_get_group_last_active() ); ?></span></div>47 <div class="item-meta"><span class="activity"><?php printf( __( 'active %s', 'buddypress' ), bp_get_group_last_active() ); ?></span></div> 48 48 49 49 <div class="item-desc"><?php bp_group_description_excerpt(); ?></div> -
trunk/bp-themes/bp-default/groups/single/group-header.php
r3899 r4678 40 40 <div id="item-header-content"> 41 41 <h2><a href="<?php bp_group_permalink(); ?>" title="<?php bp_group_name(); ?>"><?php bp_group_name(); ?></a></h2> 42 <span class="highlight"><?php bp_group_type(); ?></span> <span class="activity"><?php printf( __( 'active %s ago', 'buddypress' ), bp_get_group_last_active() ); ?></span>42 <span class="highlight"><?php bp_group_type(); ?></span> <span class="activity"><?php printf( __( 'active %s', 'buddypress' ), bp_get_group_last_active() ); ?></span> 43 43 44 44 <?php do_action( 'bp_before_group_header_meta' ); ?> -
trunk/bp-xprofile/bp-xprofile-template.php
r4558 r4678 714 714 715 715 if ( $last_updated ) 716 return apply_filters( 'bp_get_profile_last_updated', sprintf( __('Profile updated %s ago', 'buddypress'), bp_core_time_since( strtotime( $last_updated ) ) ) );716 return apply_filters( 'bp_get_profile_last_updated', sprintf( __('Profile updated %s', 'buddypress'), bp_core_time_since( strtotime( $last_updated ) ) ) ); 717 717 718 718 return false;
Note: See TracChangeset
for help on using the changeset viewer.