Skip to content

Commit

Permalink
use printf instead of echo sprintf
Browse files Browse the repository at this point in the history
  • Loading branch information
reykjalin committed Mar 21, 2024
1 parent 1e7850a commit 393ba5e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion includes/admin/class-wc-payments-admin-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function display_test_mode_notice() {
<p>
<b><?php esc_html_e( 'Test mode active: ', 'woocommerce-payments' ); ?></b>
<?php
echo sprintf(
printf(
/* translators: %s: WooPayments */
esc_html__( "All transactions are simulated. Customers can't make real purchases through %s.", 'woocommerce-payments' ),
'WooPayments'
Expand Down
2 changes: 1 addition & 1 deletion includes/admin/class-wc-payments-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public function display_not_supported_currency_notice() {
<?php esc_html( ' ' . get_woocommerce_currency() ); ?>
</b>
<?php
echo sprintf(
printf(
/* translators: %s: WooPayments*/
esc_html__( 'The selected currency is not available for the country set in your %s account.', 'woocommerce-payments' ),
'WooPayments'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ function format_price_helper( array $product, string $currency ): string {
</p>
</div>
<div class="order">
<p class="order__title"><?php echo sprintf( '%s %s', esc_html__( 'Order', 'woocommerce-payments' ), esc_html( $order['id'] ) ); ?></p>
<p class="order__title"><?php printf( '%s %s', esc_html__( 'Order', 'woocommerce-payments' ), esc_html( $order['id'] ) ); ?></p>
</div>
</div>
<hr />
Expand All @@ -140,7 +140,7 @@ function format_price_helper( array $product, string $currency ): string {
<td class="align-left">
<div><?php echo esc_html( $item['name'] ); ?></div>
<div><?php echo esc_html( $item['quantity'] ); ?> @ <?php echo wp_kses( format_price_helper( $item['product'], $order['currency'] ), 'post' ); ?></div>
<div><?php echo sprintf( '%s: %s', esc_html__( 'SKU', 'woocommerce-payments' ), esc_html( $item['product']['id'] ) ); ?></div> <!-- TODO SKU or ID? -->
<div><?php printf( '%s: %s', esc_html__( 'SKU', 'woocommerce-payments' ), esc_html( $item['product']['id'] ) ); ?></div> <!-- TODO SKU or ID? -->
</td>
<td class="align-right align-top"><?php echo wp_kses( wc_price( $item['subtotal'], [ 'currency' => $order['currency'] ] ), 'post' ); ?></td>
</tr>
Expand All @@ -157,7 +157,7 @@ function format_price_helper( array $product, string $currency ): string {
<?php foreach ( $coupon_lines as $order_coupon ) { ?>
<tr>
<td class="align-left">
<div><?php echo sprintf( '%s: %s', esc_html__( 'Discount', 'woocommerce-payments' ), esc_html( $order_coupon['code'] ) ); ?></div>
<div><?php printf( '%s: %s', esc_html__( 'Discount', 'woocommerce-payments' ), esc_html( $order_coupon['code'] ) ); ?></div>
<div><?php echo esc_html( $order_coupon['description'] ); ?></div>
</td>
<td class="align-right align-top"><?php echo wp_kses( wc_price( abs( $order_coupon['discount'] ) * -1, [ 'currency' => $order['currency'] ] ), 'post' ); ?></td>
Expand Down Expand Up @@ -211,9 +211,9 @@ function format_price_helper( array $product, string $currency ): string {
</div>
<hr />
<div class="receipt__transaction">
<p id="application-preferred-name"><?php echo sprintf( '%s: %s', esc_html__( 'Application name', 'woocommerce-payments' ), esc_html( ucfirst( $receipt['application_preferred_name'] ) ) ); ?></p>
<p id="dedicated-file-name"><?php echo sprintf( '%s: %s', esc_html__( 'AID', 'woocommerce-payments' ), esc_html( ucfirst( $receipt['dedicated_file_name'] ) ) ); ?></p>
<p id="account_type"><?php echo sprintf( '%s: %s', esc_html__( 'Account Type', 'woocommerce-payments' ), esc_html( ucfirst( $receipt['account_type'] ) ) ); ?></p>
<p id="application-preferred-name"><?php printf( '%s: %s', esc_html__( 'Application name', 'woocommerce-payments' ), esc_html( ucfirst( $receipt['application_preferred_name'] ) ) ); ?></p>
<p id="dedicated-file-name"><?php printf( '%s: %s', esc_html__( 'AID', 'woocommerce-payments' ), esc_html( ucfirst( $receipt['dedicated_file_name'] ) ) ); ?></p>
<p id="account_type"><?php printf( '%s: %s', esc_html__( 'Account Type', 'woocommerce-payments' ), esc_html( ucfirst( $receipt['account_type'] ) ) ); ?></p>
<p id="powered_by"><?php echo esc_html__( 'Powered by WooCommerce', 'woocommerce-payments' ); ?></p>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion woocommerce-payments.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ function wcpay_show_old_jetpack_notice() {
<p><b>WooPayments</b></p>
<p>
<?php
echo sprintf(
printf(
/* translators: %1 WooPayments. */
esc_html( __( 'The version of Jetpack installed is too old to be used with %1$s. %1$s has been disabled. Please deactivate or update Jetpack.', 'woocommerce-payments' ) ),
'WooPayments'
Expand Down

0 comments on commit 393ba5e

Please sign in to comment.