-
Notifications
You must be signed in to change notification settings - Fork 72
update: usage of WP best practices #11137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| Significance: patch | ||
| Type: update | ||
|
|
||
| update: usage of WP best practices |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,7 +12,7 @@ | |
| * @param string $currency The currency to display. | ||
| * @return string | ||
| */ | ||
| function format_price_helper( array $product, string $currency ): string { | ||
| function wcpay_format_price_helper( array $product, string $currency ): string { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Despite this function being inside of a template, it looks like we still need to prefix it with a |
||
| $active_price = $product['price']; | ||
| $regular_price = $product['regular_price']; | ||
| $has_discount = $active_price !== $regular_price; | ||
|
|
@@ -139,7 +139,7 @@ function format_price_helper( array $product, string $currency ): string { | |
| <tr> | ||
| <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 esc_html( $item['quantity'] ); ?> @ <?php echo wp_kses( wcpay_format_price_helper( $item['product'], $order['currency'] ), 'post' ); ?></div> | ||
| <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> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -112,7 +112,8 @@ public function save_data() { | |
|
|
||
| $wpdb->query( | ||
| $wpdb->prepare( | ||
| "INSERT INTO $this->table (`session_key`, `session_value`, `session_expiry`) VALUES (%s, %s, %d) ON DUPLICATE KEY UPDATE `session_value` = VALUES(`session_value`), `session_expiry` = VALUES(`session_expiry`)", // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here I just moved the |
||
| // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared | ||
| "INSERT INTO $this->table (`session_key`, `session_value`, `session_expiry`) VALUES (%s, %s, %d) ON DUPLICATE KEY UPDATE `session_value` = VALUES(`session_value`), `session_expiry` = VALUES(`session_expiry`)", | ||
| $this->_customer_id, | ||
| maybe_serialize( $this->_data ), | ||
| $this->session_expiration | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only usage of
update_payment_result_on_erroris in our codebase. I verified it with this:So I think it's safe to rename this hook to have a
wcpay_prefix.