| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Hook; |
| 4 | |
| 5 | use MediaWiki\Language\Language; |
| 6 | use MediaWiki\User\User; |
| 7 | use MediaWiki\Utils\MWTimestamp; |
| 8 | |
| 9 | /** |
| 10 | * This is a hook handler interface, see docs/Hooks.md. |
| 11 | * Use the hook name "GetHumanTimestamp" to register handlers implementing this interface. |
| 12 | * |
| 13 | * @stable to implement |
| 14 | * @ingroup Hooks |
| 15 | */ |
| 16 | interface GetHumanTimestampHook { |
| 17 | /** |
| 18 | * Use this hook to preemptively override the human-readable timestamp |
| 19 | * generated by Language::getHumanTimestamp(). |
| 20 | * |
| 21 | * @since 1.35 |
| 22 | * |
| 23 | * @param string &$output Output timestamp |
| 24 | * @param MWTimestamp $timestamp Current (user-adjusted) timestamp |
| 25 | * @param MWTimestamp $relativeTo Relative (user-adjusted) timestamp |
| 26 | * @param User $user User whose preferences are being used to make timestamp |
| 27 | * @param Language $lang Language that will be used to render the timestamp |
| 28 | * @return bool|void True or no return value to continue, or false to use |
| 29 | * the custom output |
| 30 | */ |
| 31 | public function onGetHumanTimestamp( &$output, $timestamp, $relativeTo, $user, |
| 32 | $lang |
| 33 | ); |
| 34 | } |