Skip to content

Commit

Permalink
Replace empty() checks with explicit types
Browse files Browse the repository at this point in the history
  • Loading branch information
alecgeatches committed Oct 11, 2024
1 parent 8c42cb3 commit b67ae56
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/notifications/notifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ public static function schedule_emails( array $recipients, string $action, WP_Po
*/
$message_headers = apply_filters( 'vw_notification_email_headers', $message_headers, $action, $post );

if ( ! empty( $recipients ) ) {
if ( [] !== $recipients ) {
wp_schedule_single_event( time(), 'vw_send_scheduled_emails', [ $recipients, $subject, $message, $message_headers ] );
}
}
Expand Down Expand Up @@ -286,7 +286,7 @@ public static function schedule_webhook_notification( string $webhook_message, s
public static function send_to_webhook( string $message, string $message_type, string $timestamp ): bool {
$webhook_url = OptionsUtilities::get_options_by_key( 'webhook_url' );

if ( empty( $webhook_url ) ) {
if ( ! is_string( $webhook_url ) || strlen( $webhook_url ) === 0 ) {
// This can happen if the webhook URL was cleared after scheduling this notification
return false;
}
Expand Down

0 comments on commit b67ae56

Please sign in to comment.