diff --git a/includes/class-siti-stock-supplier-exports.php b/includes/class-siti-stock-supplier-exports.php index cd294fa..9f9a3ef 100644 --- a/includes/class-siti-stock-supplier-exports.php +++ b/includes/class-siti-stock-supplier-exports.php @@ -239,25 +239,28 @@ class Siti_Stock_Supplier_Exports { $config['supplier'] ); - $body_lines = array(); - $body_lines[] = sprintf( + $rows_count = count( $data['rows'] ); + $body = ''; + $body .= '
' . sprintf( /* translators: %s supplier name */ - __( 'Overzicht voor leverancier %s.', 'siti-stock-plugin' ), - $config['supplier'] - ); - $body_lines[] = sprintf( + esc_html__( 'Overzicht voor leverancier %s.', 'siti-stock-plugin' ), + esc_html( $config['supplier'] ) + ) . '
'; + $body .= '' . sprintf( /* translators: %d total items */ - __( 'Totaal aantal regels: %d.', 'siti-stock-plugin' ), - count( $data['rows'] ) - ); - if ( empty( $data['rows'] ) ) { - $body_lines[] = __( 'Er zijn geen bestellingen gevonden in de afgelopen 24 uur.', 'siti-stock-plugin' ); - } - $body_lines[] = ''; - $body_lines[] = $csv; + esc_html__( 'Totaal aantal regels: %d.', 'siti-stock-plugin' ), + (int) $rows_count + ) . '
'; - $headers = array( 'Content-Type: text/plain; charset=UTF-8' ); - $sent = wp_mail( $admin_email, $subject, implode( "\r\n", $body_lines ), $headers ); + if ( empty( $data['rows'] ) ) { + $body .= '' . esc_html__( 'Er zijn geen bestellingen gevonden in de afgelopen 24 uur.', 'siti-stock-plugin' ) . '
'; + } else { + $body .= '' . esc_html__( 'CSV-overzicht (kopieer onderstaande tabel):', 'siti-stock-plugin' ) . '
'; + $body .= '' . esc_html( $csv ) . ''; + } + + $headers = array( 'Content-Type: text/html; charset=UTF-8' ); + $sent = wp_mail( $admin_email, $subject, $body, $headers ); if ( ! $sent ) { return new WP_Error( 'siti_stock_mail_failed', __( 'E-mail verzenden is mislukt.', 'siti-stock-plugin' ) );