Automattic\WooCommerce\Admin\Notes
WooSubscriptionsNotes::admin_init() public WC 1.0
Things to do on admin_init.
{} Это метод класса: WooSubscriptionsNotes{}
Хуков нет.
Возвращает
Null. Ничего.
Использование
$WooSubscriptionsNotes = new WooSubscriptionsNotes(); $WooSubscriptionsNotes->admin_init();
Код WooSubscriptionsNotes::admin_init() WooSubscriptionsNotes::admin init WC 5.0.0
public function admin_init() {
$this->check_connection();
if ( $this->is_connected() ) {
$refresh_notes = false;
// Did the user just do something on the helper page?.
if ( isset( $_GET['wc-helper-status'] ) ) { // @codingStandardsIgnoreLine.
$refresh_notes = true;
}
// Has it been more than a day since we last checked?
// Note: We do it this way and not wp_scheduled_task since WC_Helper_Options is not loaded for cron.
$time_now_gmt = current_time( 'timestamp', 0 );
$last_refresh = intval( get_option( self::LAST_REFRESH_OPTION_KEY, 0 ) );
if ( $last_refresh + DAY_IN_SECONDS <= $time_now_gmt ) {
update_option( self::LAST_REFRESH_OPTION_KEY, $time_now_gmt );
$refresh_notes = true;
}
if ( $refresh_notes ) {
$this->refresh_subscription_notes();
}
}
}