Yoast\WP\SEO\Integrations\Watchers
Addon_Update_Watcher::toggle_auto_updates_for_add_ons() public Yoast 1.0
Enables premium auto updates when free are enabled and the other way around.
{} Это метод класса: Addon_Update_Watcher{}
Хуков нет.
Возвращает
null
. Ничего.
Использование
$Addon_Update_Watcher = new Addon_Update_Watcher(); $Addon_Update_Watcher->toggle_auto_updates_for_add_ons( $option, $new_value, $old_value );
- $option(строка) (обязательный)
- The name of the option that has been updated.
- $new_value(массив) (обязательный)
- The new value of the auto_update_plugins option.
- $old_value(массив) (обязательный)
- The old value of the auto_update_plugins option.
Код Addon_Update_Watcher::toggle_auto_updates_for_add_ons() Addon Update Watcher::toggle auto updates for add ons Yoast 16.1.1
public function toggle_auto_updates_for_add_ons( $option, $new_value, $old_value ) {
if ( $option !== 'auto_update_plugins' ) {
// If future versions of WordPress change this filter's behavior, our behavior should stay consistent.
return;
}
if ( ! \is_array( $old_value ) || ! \is_array( $new_value ) ) {
return;
}
$auto_updates_are_enabled = $this->are_auto_updates_enabled( self::WPSEO_FREE_PLUGIN_ID, $new_value );
$auto_updates_were_enabled = $this->are_auto_updates_enabled( self::WPSEO_FREE_PLUGIN_ID, $old_value );
if ( $auto_updates_are_enabled === $auto_updates_were_enabled ) {
// Auto-updates for Yoast SEO have stayed the same, so have neither been enabled or disabled.
return;
}
$auto_updates_have_been_enabled = $auto_updates_are_enabled && ! $auto_updates_were_enabled;
if ( $auto_updates_have_been_enabled ) {
$this->enable_auto_updates_for_addons( $new_value );
}
else {
$this->disable_auto_updates_for_addons( $new_value );
}
}