-
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?
Conversation
| * @return string | ||
| */ | ||
| function format_price_helper( array $product, string $currency ): string { | ||
| function wcpay_format_price_helper( array $product, string $currency ): string { |
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.
Despite this function being inside of a template, it looks like we still need to prefix it with a wcpay_ prefix, otherwise WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound fails
|
|
||
| $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 |
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.
Here I just moved the phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared comment before the query. It looks like some linters might fail it.
| // This allows WC to check if WP_DEBUG mode is enabled before returning previous Exception and expose Exception class name to frontend. | ||
| add_filter( 'woocommerce_return_previous_exceptions', '__return_true' ); | ||
| wc_add_notice( wp_strip_all_tags( WC_Payments_Utils::get_filtered_error_message( $e, $blocked_by_fraud_rules ) ), 'error' ); | ||
| do_action( 'update_payment_result_on_error', $e, $order ); |
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_error is in our codebase. I verified it with this:
- https://github.com/search?q=org%3AAutomattic%20update_payment_result_on_error&type=code
- https://github.com/search?q=org%3Awoocommerce+update_payment_result_on_error&type=code
So I think it's safe to rename this hook to have a wcpay_ prefix.
Test the buildOption 1. Jetpack Beta
Option 2. Jurassic Ninja - available for logged-in A12s🚀 Launch a JN site with this branch 🚀 ℹ️ Install this Tampermonkey script to get more options. Build info:
Note: the build is updated when a new commit is pushed to this PR. |
|
Size Change: 0 B Total Size: 875 kB ℹ️ View Unchanged
|
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.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
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.
Pull Request Overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
Fixes WOOPMNT-5509
Changes proposed in this Pull Request
Fixing some of the WP plugin best practices.
Testing instructions
Nothing changes here.
npm run changelogto add a changelog file, choosepatchto leave it empty if the change is not significant. You can add multiple changelog files in one PR by running this command a few times.Post merge