Automattic\WooCommerce\Admin\RemoteInboxNotifications
RemoteInboxNotificationsEngine::init
Initialize the engine. phpcs:disable WooCommerce.Functions.InternalInjectionMethod.MissingFinal phpcs:disable WooCommerce.Functions.InternalInjectionMethod.MissingInternalTag
Method of the class: RemoteInboxNotificationsEngine{}
No Hooks.
Returns
null. Nothing (null).
Usage
$result = RemoteInboxNotificationsEngine::init();
RemoteInboxNotificationsEngine::init() RemoteInboxNotificationsEngine::init code WC 11.3.0
public static function init() {
// Init things that need to happen before admin_init.
add_action( 'init', array( __CLASS__, 'on_init' ), 0, 0 );
// Continue init via admin_init.
add_action( 'admin_init', array( __CLASS__, 'on_admin_init' ) );
// Trigger when the profile data option is updated (during onboarding).
add_action(
'update_option_' . OnboardingProfile::DATA_OPTION,
array( __CLASS__, 'update_profile_option' ),
10,
2
);
// Hook into WCA updated. This is hooked up here rather than in
// on_admin_init because that runs too late to hook into the action.
add_action(
'woocommerce_run_on_woocommerce_admin_updated',
array( __CLASS__, 'run_on_woocommerce_admin_updated' )
);
add_action(
'woocommerce_updated',
function () {
$queue = WC()->queue();
// Custom queues, including subclasses, must retain their search overrides.
if ( \WC_Action_Queue::class === get_class( $queue ) && function_exists( 'as_has_scheduled_action' ) ) {
if ( as_has_scheduled_action( 'woocommerce_run_on_woocommerce_admin_updated', array(), 'woocommerce-remote-inbox-engine' ) ) {
return;
}
} else {
// A date lookup cannot represent running actions or pending async actions.
foreach ( array( \ActionScheduler_Store::STATUS_PENDING, \ActionScheduler_Store::STATUS_RUNNING ) as $status ) {
$actions = $queue->search(
array(
'hook' => 'woocommerce_run_on_woocommerce_admin_updated',
'args' => array(),
'group' => 'woocommerce-remote-inbox-engine',
'status' => $status,
'per_page' => 1,
),
'ids'
);
if ( ! empty( $actions ) ) {
return;
}
}
}
$queue->schedule_single(
time(),
'woocommerce_run_on_woocommerce_admin_updated',
array(),
'woocommerce-remote-inbox-engine'
);
}
);
add_filter( 'woocommerce_get_note_from_db', array( __CLASS__, 'get_note_from_db' ), 10, 1 );
add_filter( 'woocommerce_debug_tools', array( __CLASS__, 'add_debug_tools' ) );
add_action(
'wp_ajax_woocommerce_json_inbox_notifications_search',
array( __CLASS__, 'ajax_action_inbox_notification_search' )
);
}