Automattic\WooCommerce\Internal\Admin\Notes
ExtensionsWithoutSubscription::refresh_note
Add, update or remove the note on WooCommerce admin pages, so it follows the installed extensions.
Runs on every WooCommerce admin page, so it only touches the notes table when the set of extensions without a subscription differs from the last refresh.
Метод класса: ExtensionsWithoutSubscription{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$ExtensionsWithoutSubscription = new ExtensionsWithoutSubscription(); $ExtensionsWithoutSubscription->refresh_note(): void;
Список изменений
| С версии 11.3.0 | Введена. |
Код ExtensionsWithoutSubscription::refresh_note() ExtensionsWithoutSubscription::refresh note WC 11.3.0
public function refresh_note(): void {
if ( ! PageController::is_admin_or_embed_page() ) {
return;
}
// Try the cached subscription list first, so a store with nothing to check never reads the fetch budget.
$plugins = self::get_plugins( false );
if ( null === $plugins && self::may_fetch() ) {
$plugins = self::get_plugins( true );
}
// Leave the note as it is while the subscription list can't be trusted.
if ( null === $plugins ) {
return;
}
$plugin_files = array_keys( $plugins );
sort( $plugin_files );
if ( get_option( self::LAST_PLUGINS_OPTION_KEY ) === $plugin_files ) {
return;
}
if ( empty( $plugins ) ) {
self::delete_note_unless_dismissed_or_actioned();
} elseif ( self::note_exists() ) {
self::possibly_update_note();
} else {
self::possibly_add_note();
}
update_option( self::LAST_PLUGINS_OPTION_KEY, $plugin_files, true );
}