Dev needed for simple (?) CC plugin idea

It is the default behaviour of get_plugin_data() – Function | Developer.WordPress.org

While it reads the first 8 KB of said file, it also hardcodes the headers to a default set of args.

I did not dig into how WC registered the additional header info, but I do not believe it is worth investigating registering it in the Checker plugin because de facto, that plugin is explicitly for WC (and maybe CC)
Without that plugin installed, the Checker process is redundant. Why would you want to know what your plugin require from WC or CC if it is not installed and active?

The only reason I could think of is that for debugging purposes you deactivate the WC/CC
So a solution here could be to instead of checking for active plugin we could check for installed plugins.

This is possible with

$path = WP_PLUGIN_DIR . '/plugin-folder/plugin-file.php';

$installed = file_exists( $path );

It can be amended around line 77 of the activator file, see it in PR 09-11-2021 by smileBeda · Pull Request #1 · ClassicPress-research/cc-plugin-checker · GitHub

However then the checker won’t work as the header infos are not registered… If someone knows how those get registered we can of course add them.
I believe it is extra_{$context}_headers filter extra_{$context}_headers – Hook | Developer.WordPress.org, but would need to experiment with it to be sure.
This filter could be added in the main class of the plugin and then a callback in an admin facing class (which is not included in the plugin, as I decided to put all things in one class in this case, usually I separate things into admin/public/includes, but I didn’t do that with this one…)

1 Like