Automattic\WooCommerce\Internal\PushNotifications
PushNotifications::on_init
Loads the push notifications class.
Метод класса: PushNotifications{}
Хуков нет.
Возвращает
void. Ничего (null).
Использование
$PushNotifications = new PushNotifications(); $PushNotifications->on_init(): void;
Список изменений
| С версии 10.6.0 | Введена. |
Код PushNotifications::on_init() PushNotifications::on init WC 11.3.0
public function on_init(): void {
// Registered ahead of the enablement check, so the status endpoint stays
// available when push notifications are disabled and clients can discover
// the state and fall back if needed.
wc_get_container()->get( PushNotificationStatusRestController::class )->register();
// Also registered ahead of the enablement check. Tokens stored while the
// feature was on stay in the database once it is off, and a user deleted
// in the meantime must not leave records behind for a later reconnection
// to start sending against.
wc_get_container()->get( UserDataCleanupService::class )->register();
// Registered ahead of the enablement check so the token list can still be
// read on a store that has been switched off. The controller registers the
// write routes only while the module is enabled, like everything below.
( new PushTokenRestController() )->register();
// Registered ahead of the enablement check for the same reason: a store
// is most worth reading the step log for once push notifications have
// been switched off, which is often why they were switched off.
wc_get_container()->get( StepLogRestController::class )->register();
if ( ! $this->should_be_enabled() ) {
return;
}
$this->register_post_types();
wc_get_container()->get( PendingNotificationStore::class )->register();
( new PushNotificationRestController() )->register();
( new NotificationPreferencesRestController() )->register();
( new NewOrderNotificationTrigger() )->register();
( new NewReviewNotificationTrigger() )->register();
( new StockNotificationTrigger() )->register();
( new StockNotificationRecoveryHandler() )->register();
wc_get_container()->get( NotificationProcessor::class )->register();
wc_get_container()->get( NotificationRetryHandler::class )->register();
}