Changeset 624 for trunk/bp-core.php
- Timestamp:
- 12/06/2008 01:42:04 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core.php
r623 r624 822 822 function bp_core_time_since( $older_date, $newer_date = false ) { 823 823 // array of time period chunks 824 824 825 $chunks = array( 825 array( 60 * 60 * 24 * 365 , __( 'year', 'buddypress') ),826 array( 60 * 60 * 24 * 30 , __( 'month', 'buddypress') ),827 array( 60 * 60 * 24 * 7, __( 'week', 'buddypress') ),828 array( 60 * 60 * 24 , __( 'day', 'buddypress') ),829 array( 60 * 60 , __( 'hour', 'buddypress') ),830 array( 60 , __( 'minute', 'buddypress') ),831 array( 1, __( 'second', 'buddypress') )826 array( 60 * 60 * 24 * 365 , __( 'year', 'buddypress' ), __( 'years', 'buddypress' ) ), 827 array( 60 * 60 * 24 * 30 , __( 'month', 'buddypress' ), __( 'months', 'buddypress' ) ), 828 array( 60 * 60 * 24 * 7, __( 'week', 'buddypress' ), __( 'weeks', 'buddypress' ) ), 829 array( 60 * 60 * 24 , __( 'day', 'buddypress' ), __( 'days', 'buddypress' ) ), 830 array( 60 * 60 , __( 'hour', 'buddypress' ), __( 'hours', 'buddypress' ) ), 831 array( 60 , __( 'minute', 'buddypress' ), __( 'minutes', 'buddypress' ) ), 832 array( 1, __( 'second', 'buddypress' ), __( 'seconds', 'buddypress' ) ) 832 833 ); 833 834 … … 849 850 for ( $i = 0, $j = count($chunks); $i < $j; $i++) { 850 851 $seconds = $chunks[$i][0]; 851 $name = $chunks[$i][1];852 852 853 853 /* Finding the biggest chunk (if the chunk fits, break) */ … … 857 857 858 858 /* Set output var */ 859 $output = ( $count == 1 ) ? '1 '. $ name : "$count {$name}s";859 $output = ( $count == 1 ) ? '1 '. $chunks[$i][1] : $count . ' ' . $chunks[$i][2]; 860 860 861 861 /* Step two: the second chunk */ … … 864 864 $name2 = $chunks[$i + 1][1]; 865 865 866 if ( $ name2 == __('second', 'buddypress') ) return $output;866 if ( $chunks[$i + 1][1] == __( 'second', 'buddypress' ) ) return $output; 867 867 868 868 if ( ( $count2 = floor( ( $since - ( $seconds * $count ) ) / $seconds2 ) ) != 0 ) { 869 869 /* Add to output var */ 870 $output .= ($count2 == 1) ? ', 1 '. $name2 : ", $count2 {$name2}s";870 $output .= ($count2 == 1) ? ', 1 '. $chunks[$i + 1][1] : ", " . $count2 . ' ' . $chunks[$i + 1][2]; 871 871 } 872 872 }
Note: See TracChangeset
for help on using the changeset viewer.