Analysing the issue with the WordPress Team
As explained in the earlier post, due to technical limitations, the WP.org repository can only be used to host plugins that don’t have external dependencies. Plugins are expected to carry around a copy of all the files they need, even if this may cause conflicts with different versions of the same files, which might be installed on the site. Our EU VAT Assistant relies our Aelia Foundation Classes (or AFC, for short), which is an external framework. Due to that, it didn’t match the described requirement.
We had a long discussion with the WordPress Team, during which we went into the details of the decisions behind the design for our EU VAT Assistant, as well as our other plugins. We proposed several solutions, all of which were technically valid, but they were rejected on the ground of not being fully compliant with the current policies that apply to WordPress.org. The conclusion was our solutions are highly modular (and work well that way), but the public WordPress repository, in its current form, doesn’t support such architecture.
The restrictions on the WordPress repository presented a significant challenge. We spent a significant amount of time and effort to create our existing, modular architecture. All our solutions are based on it, and they have been thoroughly tested. The WordPress Team insist that all plugins should carry around their own copy of the required files, while we have enough experience and statistical data to disagree with such statement. Besides, we couldn’t afford to discard years of work to go back to the required “monolithic” design, risking to introduce issues in the process.
The main hurdle came from one of the core principle on which the Aelia Foundation Classes is based. We wrote the AFC Framework with the assumption that there will always be one copy of such framework installed, at any given time. Such requirement can be easily enforced, and it allows to share the same code across multiple plugins. It also avoids having to write a convoluted logic to check if multiple copies of a framework are installed, and which one should be used. Based on our tests and experience, it’s a leaner and more effective approach.
Our challenge was to find a way to reach the following targets:
- Allow the EU VAT Assistant to carry around and load its own framework.
- Allow plugins that rely on the shared AFC Framework to keep doing so.
- Avoid substantial rewriting of any of the plugins, or the framework.
The AFC Framework as the key
After a careful analysis of our options, we realised that the AFC Framework could be the solution to the issue. Like our plugins, the framework is highly modular, and structured so that its components are loosely coupled. Although we designed the framework to be installed as a separate plugin, we were able to extract parts of it, and transform them into an “embedded framework”. This was also made easier by the logic used by our plugins to find the AFC, and interact with it, which allows for good flexibility. In short, we found a way to satisfy all the requirements, while keeping our modular structure and full compatibility with our other products.
The proposed solution
We reviewed the AFC Framework, focusing our attention on its basic, core elements, and we came up with a smart, yet simple solution:
- We built a smaller version of the framework, called AFC Embedded, which excludes non-essential features, as well as any feature that is not deemed “appropriate” for inclusion in the WordPress repository.
- We added the AFC Embedded framework to the EU VAT Assistant.
- We modified the loader logic used by the EU VAT Assistant, to perform the following operations:
- When the standalone AFC Framework is active, use that one. In such case, the plugin would behave exactly as it did before.
- When the standalone AFC Framework is not active, or not installed, load the embedded AFC Framework.
This approach required only minor changes in both the framework and the EU VAT Assistant, and no changes at all in our other products. It also covers the scenario where the EU VAT plugin is installed first, and the standalone framework at a later stage, e.g. after installing one of our premium WooCommerce plugins. In that case, the EU VAT Assistant switches from the embedded framework to the standalone one, transparently. Simple, yet effective!
We discussed the above solution with the WordPress Team, and they agreed that it would be within the new guidelines of the WordPress.org repository. We have submitted an updated version of our EU VAT Assistant for their review, and we are waiting for their reply. If all goes well, our solution for EU VAT compliance should be back online very soon.
Any questions? Always happy to answer!
Should you have any questions about the EU VAT Assistant, or the progress with the new version, please feel free to contact us. We will be happy to answer all your questions, and give you any information you might need.
Thanks again for staying with us, we are looking forward to sharing with you some good news soon!
The Aelia Team