Coupon Creator Pro 2.4 is a refactor of the code base using Modern Tribe’s Common plugin used in The Events Calendar. The goal of the refactor was to reduce duplicate coding, use an autoloader, and organize all the files.
The first step was rename the common plugin into the Plugin Engine or pngx for short. Then, I stripped out much of the coding that was event related and started with the Autoloader and some of useful methods. My goal is the use the pngx as the base for the Settings and Meta Fields for Coupon Creator and Coupon Creator Pro. By running everything through pngx I am able to cut back on having duplicate fields. In the previous editions, I had two of everything for the the settings and meta fields.
From there I moved everything that was shared or duplicated between Coupon Creator and Coupon Creator Pro into pngx this included, EDD’s software license updater class, option class, meta class, custom post type creator class, custom taxonomy create class,santize class, allowed tags class, asset loading class, and all the fields such as checkbox to visual editor.
While building pngx I was actively building the Coupon Creator around it as one needs the other to work correctly. It ended being an entire refactor of all the coding, but with similar front end templates and related functions. Another goal was to separate css and js and make pngx’s the base so that Coupon Creator could use it as a starting point.
After wrapping up pngx and Coupon Creator, I refactored Pro and integrated it so it works with both pngx and Coupon Creator. Once complete, I tested the new code base by adding new features. Adding the Range Expiration and Exclude Category features proved to be far easier to add and in less time than anticipated. For that reason, I believe the refactor has already been a success in making it easier to add new features and look forward to coding them in the next releases as well as creating new plugins in the future.