openmindculture / wp-incompatibility-status Goto Github PK
View Code? Open in Web Editor NEWWordPress plugin to show incompatible settings in dashboard widget in WP-Admin
License: GNU General Public License v3.0
WordPress plugin to show incompatible settings in dashboard widget in WP-Admin
License: GNU General Public License v3.0
Configure a local WordPress Code Sniffer to validate the code in the IDE before submitting to the WordPress plugin repository, to avoid errors and unnecessary refinement loops to speed up development.
See
Test the plugin
https://wordpress.org/plugins/developers/add/
This is in the Developer FAQ. It takes anywhere between 1 and 10 days. We attempt to review all plugins within 5 business days of submission, but the process takes as long as it takes, depending on the complexity of your plugin.
Issues after "improving" the code for release candidate 3 (#2):
Instead of using inline CSS with <<<HEREDOC
, and failing to find a proper escape function, I decided to include a CSS file but forgot to use wp_enqueue
instead of a regular <link>
element to load the external CSS file.
Based on the SonarLint warnings about snake_case namings, I changed the function and variable names, removing prefixes where I thought it safe for a seemingly local function. While those seemed to be correct (how can we know if there is no local version of their linter available for my IDE?), the automatic code sniffer complained about the names where I only removed the underscore between prefix and the rest of the identifier, like openmindcultureWpstatusDashboardWidgets
instead of openmindculture_wpstatus_dashboarddidgets
. Hopefully openmindculture_wpstatusDashboardWidgets
will do (again, how are we to know without a local code sniffer?) and so we will have to disable the SonarLint S100 rule for the whole project.
use wp_enqueue
commands
avoid generic function/class/define/namespace names
New target version: release candidate 4 (1.0.0-rc4
).
There is still an issues
Your plugin is not correctly including JS and/or CSS. You should be using the built in functions for this:
And remember you can use this function to add inline javascript:
As of WordPress 5.7, you can pass attributes like async, nonce, and type by using new functions and filters:
If you're trying to enqueue on the admin pages you'll want to use the admin enqueues
Example(s) from your plugin:
1.0.0/incompatibility-status.php:138: echo '<link rel="stylesheet" href="'. plugin_dir_url(__FILE__) . 'styles.css">';
All plugins must have unique function names, namespaces, defines, and class names. This prevents your plugin from conflicting with other plugins or themes. We need you to update your plugin to use more unique and distinct names.
A good way to do this is with a prefix. For example, if your plugin is called "Easy Custom Post Types" then you could use names like these:
Don't try to use two (2) or three (3) letter prefixes anymore. We host nearly 100-thousand plugins on WordPress.org alone. There are tens of thousands more outside our servers. Believe us, you’re going to run into conflicts.
You also need to avoid the use of __
(double underscores), wp_
, or _
(single underscore) as a prefix. Those are reserved for WordPress itself. You can use them inside your classes, but not as stand-alone function.
Please remember, if you're using _n()
or __()
for translation, that's fine. We're only talking about functions you've created for your plugin, not the core functions from WordPress. In fact, those core features are why you need to not use those prefixes in your own plugin! You don't want to break WordPress for your users.
Related to this, using if (!function_exists(‘NAME ‘)) {
around all your functions and classes sounds like a great idea until you realize the fatal flaw. If something else has a function with the same name and their code loads first, your plugin will break. Using if-exists should be reserved for shared libraries only.
Remember: Good prefix names are unique and distinct to your plugin. This will help you and the next person in debugging, as well as prevent conflicts.
Example(s) from your plugin:
1.0.0/incompatibility-status.php:24: function openmindcultureWpstatusDashboardWidgets()
1.0.0/incompatibility-status.php:29: function openmindcultureWpstatusContent()
1.0.0/incompatibility-status.php:136: function openmindcultureWpstatusPrintStyles()
Current dashboard widget title "Incompatibility warnings" might suggest that there are warnings, even if there are none. The more neutral "incompatibility status" wording might still mislead some users that there might be an incompatibility.
Possible solution: change the widget title to "Compatibility Status".
Although this does not match the plugin name anymore, but that's common practice, and there is still a footer line making it perfectly clear which plugin generated the status widget.
see previous issue
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.