plugin updates

This commit is contained in:
Tony Volpe
2024-10-24 12:57:16 -04:00
parent 8217f0dbed
commit 5e040c9234
399 changed files with 3377 additions and 46318 deletions

View File

@@ -51,78 +51,24 @@ class Notification_Helper {
}
/**
* Parses all the notifications to an array with just warnings notifications, and splitting them between dismissed
* and active.
* Parses all the notifications to an array with just id, message, nonce, type and dismissed.
*
* @return array<Yoast_Notification>
* @return array<string,string|bool>
*/
public function get_notifications(): array {
$all_notifications = $this->get_sorted_notifications();
$notifications = \array_filter(
$all_notifications,
static function ( $notification ) {
return $notification->get_type() !== 'error';
}
);
$dismissed_notifications = \array_filter(
$notifications,
public function get_alerts(): array {
$all_notifications = $this->get_sorted_notifications();
return \array_map(
function ( $notification ) {
return $this->is_notification_dismissed( $notification );
}
return [
'id' => $notification->get_id(),
'message' => $notification->get_message(),
'nonce' => $notification->get_nonce(),
'type' => $notification->get_type(),
'dismissed' => $this->is_notification_dismissed( $notification ),
];
},
$all_notifications
);
$active_notifications = \array_diff( $notifications, $dismissed_notifications );
return [
'dismissed' => \array_map(
static function ( $notification ) {
return $notification->to_array();
},
$dismissed_notifications
),
'active' => \array_map(
static function ( $notification ) {
return $notification->to_array();
},
$active_notifications
),
];
}
/**
* Parses all the notifications to an array with just error notifications, and splitting them between dismissed and
* active.
*
* @return array<Yoast_Notification>
*/
public function get_problems(): array {
$all_notifications = $this->get_sorted_notifications();
$problems = \array_filter(
$all_notifications,
static function ( $notification ) {
return $notification->get_type() === 'error';
}
);
$dismissed_problems = \array_filter(
$problems,
function ( $notification ) {
return $this->is_notification_dismissed( $notification );
}
);
$active_problems = \array_diff( $problems, $dismissed_problems );
return [
'dismissed' => \array_map(
static function ( $notification ) {
return $notification->to_array();
},
$dismissed_problems
),
'active' => \array_map(
static function ( $notification ) {
return $notification->to_array();
},
$active_problems
),
];
}
}

View File

@@ -1,18 +0,0 @@
<?php
namespace Yoast\WP\SEO\Helpers;
/**
* A helper object for the request state.
*/
class Request_Helper {
/**
* Checks if the current request is a REST request.
*
* @return bool True when the current request is a REST request.
*/
public function is_rest_request() {
return \defined( 'REST_REQUEST' ) && \REST_REQUEST === true;
}
}