-
-
Notifications
You must be signed in to change notification settings - Fork 490
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
Prefix Your Globals #1726
Prefix Your Globals #1726
Conversation
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.
Hi Mika, I've had a look and left some comments.
Also: should it be mentioned that there is an error for prefixes which use characters outside of the characters which PHP allows for constructs ?
</code_comparison> | ||
<standard> | ||
<![CDATA[ | ||
Using any prefixes designated for WordPress are not permitted, even if WordPress has not used the define. This includes all defines such as _() (underscores), __() double underscores, wp_, and wordpress_ |
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.
Using any prefixes designated for WordPress are not permitted, even if WordPress has not used the define. This includes all defines such as _() (underscores), __() double underscores, wp_, and wordpress_ | |
Using any prefixes reserved for WordPress are not permitted, even if WordPress has not started using the prefix (yet). This includes all defines such as _() (underscores), () double underscores, wp, and wordpress |
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.
This includes all defines such as _() (underscores), () double underscores, wp, and wordpress
What do you mean to say by this ? ()
are not characters allowed in prefixes as they are not allowed in PHP namespace/class/function/constant names etc.
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.
It ate __()
for some reason...
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.
Added in second example.
</code_comparison> | ||
<standard> | ||
<![CDATA[ | ||
Using any prefixes reserved for WordPress are not permitted, even if WordPress has not used the define. This includes all defines such as _() (underscores), __() double underscores, wp_, and wordpress_ |
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.
Possible to add a link here to where the full list of WordPress-reserved prefixes are documented?
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.
Good question. Got a link ?
* Use consistent indentation in the file. * Expand the base explanation. * Improve the valid/invalid descriptions. * Use `<em>` tags to mark valid/invalid code. * Expand the code samples. * Add a code comparison demonstrating how namespaces affect the prefixes. * Remove the unclear sentence regarding reserved prefixes. * Clarify the three character minimum length rule.
I've rebased the PR and added one commit to make the fixes needed and other improvements. Let's get this merged! For whomever will merge this: probably squash/merge would be a good idea. |
Globals need to be uniquely and distinctly named in order to prevent conflicts with other plugins and themes.
Prefixes may not use terms designated for WordPress.
Two Letter Prefixes are also bad (80+ THOUSAND PLUGINS, wanna know how many have the same two-letter initials? Ouch)
Related #1722