Yoast_Notifications::get_notification_from_ajax_request()
Extract the Yoast Notification from the AJAX request.
This function does not handle nonce verification.
Метод класса: Yoast_Notifications{}
Хуков нет.
Возвращает
Yoast_Notification|null
. A Yoast_Notification on success, null on failure.
Использование
// private - только в коде основоного (родительского) класса $result = $this->get_notification_from_ajax_request();
Код Yoast_Notifications::get_notification_from_ajax_request() Yoast Notifications::get notification from ajax request Yoast 24.9
private function get_notification_from_ajax_request() { // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Reason: This function does not handle nonce verification. if ( ! isset( $_POST['notification'] ) || ! is_string( $_POST['notification'] ) ) { return null; } // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Reason: This function does not handle nonce verification. $notification_id = sanitize_text_field( wp_unslash( $_POST['notification'] ) ); if ( empty( $notification_id ) ) { return null; } $notification_center = Yoast_Notification_Center::get(); return $notification_center->get_notification_by_id( $notification_id ); }