'; $footer = ''; $media['wp-activity-log'] = trailingslashit( WSAL_BASE_URL ) . 'img/mails/daily-notification/wp-activity-log.png'; $media['documentation'] = trailingslashit( WSAL_BASE_URL ) . 'img/mails/daily-notification/documentation.png'; $media['support'] = trailingslashit( WSAL_BASE_URL ) . 'img/mails/daily-notification/support.png'; $media['melapress-icon'] = trailingslashit( WSAL_BASE_URL ) . 'img/mails/daily-notification/melapress-icon.png'; $media['wsal-dg-footer-bg'] = trailingslashit( WSAL_BASE_URL ) . 'img/mails/daily-notification/wsal-dg-footer-bg.png'; $current_settings = Settings_Helper::get_option_value( Notifications::NOTIFICATIONS_SETTINGS_NAME, array() ); $number_to_include = Notification_Helper::NUMBER_OF_EVENTS_TO_INCLUDE; if ( isset( $current_settings['notification_summary_number_of_events_included'] ) && Notification_Helper::NUMBER_OF_EVENTS_TO_INCLUDE === (int) $current_settings['notification_summary_number_of_events_included'] ) { $number_to_include = Notification_Helper::NUMBER_OF_EVENTS_TO_INCLUDE; } elseif ( isset( $current_settings['notification_summary_number_of_events_included'] ) && 1 === (int) $current_settings['notification_summary_number_of_events_included'] ) { $number_to_include = PHP_INT_MAX; // Show all events. } $home_url = \home_url(); $safe_url = str_replace( array( 'http://', 'https://' ), '', $home_url ); $number_of_logins = 0; // Number of logins. $login_events = array(); // Login events. $failed_logins_wrong_pass = array(); // Failed logins wrong pass. $failed_logins_wrong_user = array(); // Failed logins wrong user. $password_changes = array(); // Password changes. $forced_password_changes = array(); // Forced password changes. $user_profile_changes = array(); // User profile changes. $multisite_activity = array(); // Multisite network activity. $plugin_activity = array(); // Plugin activity. $system_activity = array(); // System activity. $posts_published = array(); // Posts published. $posts_trashed = array(); // Posts trashed. $posts_deleted = array(); // Posts deleted. $posts_modified = array(); // Posts modified. $posts_status_changed = array(); // Posts status changes. $files_added = array(); // Files added. $files_modified = array(); // Files modified. $files_deleted = array(); // Files deleted. $login_events_ids = array( 1000, 1005 ); // Login events. $password_changes_events = array( 4003 ); // Login events. $forced_password_changes_events = array( 4004 ); // Login events. $failed_logins_events = array( 1002, 1003 ); // Failed login events. $failed_logins_wrong_pass_events = array( 1002 ); // Failed login events. $failed_logins_wrong_user_events = array( 1003 ); // Failed login events. $posts_published_events = array( 2001 ); // Login events. $posts_trashed_events = array( 2012 ); // Login events. $posts_deleted_events = array( 2008 ); // Login events. $posts_modified_events = array( 2065 ); // Login events. $posts_status_changed_events = array( 2021 ); // Login events. $system_activity_events = \array_keys( Alert_Manager::get_alerts_by_category( esc_html__( 'WordPress & System', 'wp-security-audit-log' ) ) ); $plugin_events = array( 5000, 5001, 5002, 5003, 5004 ); // Plugin events. $user_profile_events = array( 4000, 4001, 4002, 4007 ); // Multisite events. $multisite_events = array( 4010, 4011, 7000, 7001, 7002, 7003, 7004, 7005 ); // Multisite events. if ( ! empty( $events ) ) { foreach ( $events as $event ) { if ( in_array( (int) $event['alert_id'], $login_events_ids, true ) ) { ++$number_of_logins; $login_events[] = $event; } elseif ( 1002 === (int) $event['alert_id'] ) { $failed_logins_wrong_pass[] = $event; } elseif ( 1003 === (int) $event['alert_id'] ) { $failed_logins_wrong_user[] = $event; } elseif ( 4003 === (int) $event['alert_id'] ) { $password_changes[] = $event; } elseif ( 4004 === (int) $event['alert_id'] ) { $forced_password_changes[] = $event; } elseif ( in_array( (int) $event['alert_id'], $plugin_events, true ) ) { $plugin_activity[] = $event; } elseif ( in_array( (int) $event['alert_id'], $system_activity_events, true ) ) { $system_activity[] = $event; } elseif ( 2001 === (int) $event['alert_id'] ) { $posts_published[] = $event; } elseif ( 2012 === (int) $event['alert_id'] ) { $posts_trashed[] = $event; } elseif ( 2008 === (int) $event['alert_id'] ) { $posts_deleted[] = $event; } elseif ( 2065 === (int) $event['alert_id'] ) { $posts_modified[] = $event; } elseif ( in_array( (int) $event['alert_id'], $posts_status_changed_events, true ) ) { $posts_status_changed[] = $event; } elseif ( in_array( (int) $event['alert_id'], $user_profile_events, true ) ) { $user_profile_changes[] = $event; } elseif ( in_array( (int) $event['alert_id'], $multisite_events, true ) ) { $multisite_activity[] = $event; } elseif ( 6028 === (int) $event['alert_id'] ) { $files_modified[] = $event; } elseif ( 6029 === (int) $event['alert_id'] ) { $files_added[] = $event; } elseif ( 6030 === (int) $event['alert_id'] ) { $files_deleted[] = $event; } } } $set_link = ( 'free' !== \WpSecurityAuditLog::get_plugin_version() ) ? 'premium' : 'free'; $show_free_link = false; $body = '