WPSEO_Suggested_Plugins::add_notifications()publicYoast 1.0

Adds notifications (when necessary).

Метод класса: WPSEO_Suggested_Plugins{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$WPSEO_Suggested_Plugins = new WPSEO_Suggested_Plugins();
$WPSEO_Suggested_Plugins->add_notifications();

Код WPSEO_Suggested_Plugins::add_notifications() Yoast 22.4

public function add_notifications() {
	$checker = $this->availability_checker;

	// Get all Yoast plugins that have dependencies.
	$plugins = $checker->get_plugins_with_dependencies();

	foreach ( $plugins as $plugin_name => $plugin ) {
		$notification_id = 'wpseo-suggested-plugin-' . $plugin_name;

		if ( ! $checker->dependencies_are_satisfied( $plugin ) ) {
			$this->notification_center->remove_notification_by_id( $notification_id );

			continue;
		}

		if ( ! $checker->is_installed( $plugin ) ) {
			$notification = $this->get_yoast_seo_suggested_plugins_notification( $notification_id, $plugin );
			$this->notification_center->add_notification( $notification );

			continue;
		}

		$this->notification_center->remove_notification_by_id( $notification_id );
	}
}