Yoast_Plugin_Conflict_Ajax::dismiss_notice()publicYoast 1.0

Handles the dismiss notice request.

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

Хуков нет.

Возвращает

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

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

$Yoast_Plugin_Conflict_Ajax = new Yoast_Plugin_Conflict_Ajax();
$Yoast_Plugin_Conflict_Ajax->dismiss_notice();

Код Yoast_Plugin_Conflict_Ajax::dismiss_notice() Yoast 22.7

public function dismiss_notice() {
	check_ajax_referer( 'dismiss-plugin-conflict' );

	if ( ! isset( $_POST['data'] ) || ! is_array( $_POST['data'] ) ) {
		// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: WPSEO_Utils::format_json_encode is considered safe.
		wp_die( WPSEO_Utils::format_json_encode( [] ) );
	}

	// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: $conflict_data is getting sanitized later.
	$conflict_data = wp_unslash( $_POST['data'] );

	$conflict_data = [
		'section' => sanitize_text_field( $conflict_data['section'] ),
		'plugins' => sanitize_text_field( $conflict_data['plugins'] ),
	];

	$this->dismissed_conflicts = $this->get_dismissed_conflicts( $conflict_data['section'] );

	$this->compare_plugins( $conflict_data['plugins'] );

	$this->save_dismissed_conflicts( $conflict_data['section'] );

	wp_die( 'true' );
}