Changeset 3142 for branches/1.2/bp-core.php
- Timestamp:
- 07/21/2010 07:33:39 PM (16 years ago)
- File:
-
- 1 edited
-
branches/1.2/bp-core.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/1.2/bp-core.php
r3133 r3142 1290 1290 1291 1291 /** 1292 * bp_core_format_time() 1293 */ 1294 function bp_core_format_time( $time, $just_date = false ) { 1295 if ( !$time ) 1296 return false; 1297 1298 $date = date( "F j, Y ", $time ); 1299 1300 if ( !$just_date ) { 1301 $date .= __('at', 'buddypress') . date( ' g:iA', $time ); 1302 } 1303 1304 return $date; 1292 * bp_core_current_time() 1293 * 1294 * Get the current GMT time to save into the DB 1295 * 1296 * @package BuddyPress Core 1297 * @since 1.2.6 1298 */ 1299 function bp_core_current_time() { 1300 // Get current time in MYSQL format 1301 $current_time = current_time( 'mysql', true ); 1302 1303 return apply_filters( 'bp_core_current_time', $current_time ); 1305 1304 } 1306 1305 … … 1400 1399 */ 1401 1400 function bp_core_time_since( $older_date, $newer_date = false ) { 1401 1402 1402 // array of time period chunks 1403 1404 1403 $chunks = array( 1405 array( 60 * 60 * 24 * 365 , __( 'year', 'buddypress' ), __( 'years', 'buddypress' ) ),1406 array( 60 * 60 * 24 * 30 , __( 'month', 'buddypress' ), __( 'months', 'buddypress' ) ),1407 array( 60 * 60 * 24 * 7, __( 'week', 'buddypress' ), __( 'weeks', 'buddypress' ) ),1408 array( 60 * 60 * 24 , __( 'day', 'buddypress' ), __( 'days', 'buddypress' ) ),1409 array( 60 * 60 , __( 'hour', 'buddypress' ), __( 'hours', 'buddypress' ) ),1410 array( 60 , __( 'minute', 'buddypress' ), __( 'minutes', 'buddypress' ) ),1411 array( 1, __( 'second', 'buddypress' ), __( 'seconds', 'buddypress' ) )1404 array( 60 * 60 * 24 * 365 , __( 'year', 'buddypress' ), __( 'years', 'buddypress' ) ), 1405 array( 60 * 60 * 24 * 30 , __( 'month', 'buddypress' ), __( 'months', 'buddypress' ) ), 1406 array( 60 * 60 * 24 * 7, __( 'week', 'buddypress' ), __( 'weeks', 'buddypress' ) ), 1407 array( 60 * 60 * 24 , __( 'day', 'buddypress' ), __( 'days', 'buddypress' ) ), 1408 array( 60 * 60 , __( 'hour', 'buddypress' ), __( 'hours', 'buddypress' ) ), 1409 array( 60 , __( 'minute', 'buddypress' ), __( 'minutes', 'buddypress' ) ), 1410 array( 1, __( 'second', 'buddypress' ), __( 'seconds', 'buddypress' ) ) 1412 1411 ); 1413 1412 … … 1421 1420 /* $newer_date will equal false if we want to know the time elapsed between a date and the current time */ 1422 1421 /* $newer_date will have a value if we want to work out time elapsed between two known dates */ 1423 $newer_date = ( !$newer_date ) ? gmmktime( gmdate( 'H' ), gmdate( 'i' ), gmdate( 's' ), gmdate( 'n' ), gmdate( 'j' ), gmdate( 'Y') ) : $newer_date;1422 $newer_date = ( !$newer_date ) ? strtotime( bp_core_current_time() ) : $newer_date; 1424 1423 1425 1424 /* Difference in seconds */ … … 1489 1488 $activity = strtotime( $activity ); 1490 1489 1491 if ( '' == $activity || strtotime( gmdate( "Y-m-d H:i:s" ) ) >= strtotime( '+5 minutes', $activity ) ) 1492 update_usermeta( $bp->loggedin_user->id, 'last_activity', gmdate( "Y-m-d H:i:s" ) ); 1490 // Get current time 1491 $current_time = bp_core_current_time(); 1492 1493 if ( '' == $activity || strtotime( $current_time ) >= strtotime( '+5 minutes', $activity ) ) 1494 update_usermeta( $bp->loggedin_user->id, 'last_activity', $current_time ); 1493 1495 } 1494 1496 add_action( 'wp_head', 'bp_core_record_activity' );
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)