Activity::when( object $obj )
Description #
Return the human readable date of an activity which can be compared to other activity.
Parameters #
- $objobject (Required) Activity object.
Source #
File: includes/class/class-activity.php
public function when( $obj ) { $date = strtotime( $obj->date ); if ( $date >= strtotime( '-30 minutes' ) ) { $when = __( 'Just now', 'anspress-question-answer' ); } elseif ( $date >= strtotime( '-24 hours' ) ) { $when = __( 'Today', 'anspress-question-answer' ); } elseif ( $date >= strtotime( '-48 hours' ) ) { $when = __( 'Yesterday', 'anspress-question-answer' ); } elseif ( $date <= strtotime( '1 year' ) ) { $when = date_i18n( 'M', $date ); } else { $when = date_i18n( 'M Y', $date ); } return $when; }
Expand full source code Collapse full source code View on GitHub: includes/class/class-activity.php:483
Add your comment