Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save DragonBe/788d365bfeaf7cd731a76b7775286b8e to your computer and use it in GitHub Desktop.
Save DragonBe/788d365bfeaf7cd731a76b7775286b8e to your computer and use it in GitHub Desktop.
Here's a step-by-step process to check if a WooCommerce plugin adopts the privacy functionality provided by the platform by extending WC_Abstract_Privacy.

Plugins checker

This is a small report about plugins I've verified with phpdoc for extending WC_Abstract_Privacy privacy class provided by WooCommerce.

Based on information found in WooCommerce Guidelines for GDPR, Making Woo Extensions GDPR compliant and the whole WC_Abstract_Privacy class API.

Plugins not extending the privacy class

Plugins extending the privacy class.

Process to check for existence of inheritance

NOTE: Used on macOS, process might be simalar on Linux

1. Checking for WC_Abstract_Privacy

The easiest way I could imagine is to use fgrep on the command line.

cd /path/to/plugin
fgrep -r WC_Abstract_Privacy .

If found, it will return us the files where the string WC_Abstract_Privacy is being used.

./includes/admin/class-wc-stripe-privacy.php:if ( ! class_exists( 'WC_Abstract_Privacy' ) ) {
./includes/admin/class-wc-stripe-privacy.php:class WC_Stripe_Privacy extends WC_Abstract_Privacy {

2. Creating a class graph using PHPDocumentor

In order to facilitate communication, having a graph helps to visualize a point. We're using a PHPDoc container to spin it up without requiring to install all required components.

docker run -v "$PWD":/var/php/app/plugin dragonbe/phpdoc

The full API documentation for the plugin, including the graphs, will be available at build/phpdoc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment