refactored: trademark validation methods to unify trademark checks for names and slugs#1034
Closed
SteveJonesDev wants to merge 5 commits intoWordPress:trunkfrom
Closed
Conversation
…r names and slugs
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request refactors the trademark checking logic for plugin names and slugs to improve accuracy and code maintainability. The main change is the introduction of a generalized
has_trademarkmethod, which replaces the previous slug-specific logic and adds word boundary checks for plugin names to reduce false positives like. For example the current version of the plugin flags the acronymWCAGfor the use ofWC. Helper methods have also been added for clarity and future extensibility.Trademark checking logic improvements:
has_trademarkmethod that checks for trademarked terms in both plugin names and slugs, with an option to use word boundaries for names to avoid false positives.validate_name_has_no_trademarksandvalidate_slug_has_no_trademarksto use the newhas_trademarkmethod, passing the appropriate word boundary flag for each case [1] [2].Code organization and maintainability:
has_trademarked_slugandhas_trademarked_namethat delegate tohas_trademarkwith the correct parameters, improving code readability and future extensibility.