sanitize_text( $store_name ) . '"', 'TEXT 30,55,"0",0,1,1,"WCPOS RECEIPT"', 'TEXT 30,80,"0",0,1,1,"Order #' . $this->sanitize_text( $order_number ) . '"', 'TEXT 30,130,"0",0,1,1,"Total ' . wc_format_decimal( $total, wc_get_price_decimals() ) . '"', ); if ( $print_barcode ) { $tspl[] = 'BARCODE 30,180,"128",80,1,0,2,2,"' . $this->sanitize_text( $order_number ) . '"'; } if ( $print_qr && '' !== $qr_payload ) { $tspl[] = 'QRCODE 30,290,L,6,A,0,M2,S7,"' . $this->sanitize_text( $qr_payload ) . '"'; } $tspl[] = 'PRINT 1,1'; return implode( "\n", $tspl ) . "\n"; } /** * Sanitize text for TSPL commands. * * @param string $value Text value. * * @return string */ private function sanitize_text( string $value ): string { $value = preg_replace( '/["\r\n]/', ' ', $value ); return trim( $value ); } }