sanitize_text( $store_name ), 'TEXT 4 0 30 60 WCPOS RECEIPT', 'TEXT 4 0 30 80 Order #' . $this->sanitize_text( $order_number ), 'TEXT 4 0 30 130 Total ' . wc_format_decimal( $total, wc_get_price_decimals() ), ); if ( $print_barcode ) { $cpcl[] = 'BARCODE 128 1 1 60 30 180 ' . $this->sanitize_text( $order_number ); } if ( $print_qr && '' !== $qr_payload ) { $cpcl[] = 'B QR 30 260 M 2 U 6'; $cpcl[] = 'MA,' . $this->sanitize_text( $qr_payload ); $cpcl[] = 'ENDQR'; } $cpcl[] = 'FORM'; $cpcl[] = 'PRINT'; return implode( "\n", $cpcl ) . "\n"; } /** * Sanitize text for CPCL commands. * * @param string $value Text value. * * @return string */ private function sanitize_text( string $value ): string { return trim( preg_replace( '/[\r\n]/', ' ', $value ) ); } }