| 1 |
<?php |
| 2 |
/** |
| 3 |
* Contract every feature module must implement. |
| 4 |
* |
| 5 |
* @package Import_Export_Menu |
| 6 |
* @since 2.2.0 |
| 7 |
*/ |
| 8 |
|
| 9 |
declare(strict_types=1); |
| 10 |
|
| 11 |
namespace ImportExportMenu\Modules; |
| 12 |
|
| 13 |
defined( 'ABSPATH' ) || exit; |
| 14 |
|
| 15 |
/** |
| 16 |
* Standard shape of a feature module. |
| 17 |
* |
| 18 |
* Each maintenance/feature tool lives in `includes/Modules/<Name>/` and |
| 19 |
* implements this interface so the loader can boot any module uniformly and |
| 20 |
* gate it by tier. Modules are collected through the |
| 21 |
* `import_export_menu_modules_register` filter, letting a separate Pro plugin register |
| 22 |
* its own modules without touching this plugin's code. |
| 23 |
* |
| 24 |
* @since 2.2.0 |
| 25 |
*/ |
| 26 |
interface ModuleInterface { |
| 27 |
|
| 28 |
/** |
| 29 |
* Free tier — always loaded. |
| 30 |
*/ |
| 31 |
public const TIER_FREE = 'free'; |
| 32 |
|
| 33 |
/** |
| 34 |
* Pro tier — only loaded once the Pro edition is unlocked. |
| 35 |
*/ |
| 36 |
public const TIER_PRO = 'pro'; |
| 37 |
|
| 38 |
/** |
| 39 |
* Distribution tier of this module. |
| 40 |
* |
| 41 |
* @return string Either {@see self::TIER_FREE} or {@see self::TIER_PRO}. |
| 42 |
*/ |
| 43 |
public function tier(): string; |
| 44 |
|
| 45 |
/** |
| 46 |
* Register every WP hook this module needs. |
| 47 |
* |
| 48 |
* The single place a module is allowed to call `add_action()` / |
| 49 |
* `add_filter()`. Must have no side effects beyond hook registration. |
| 50 |
*/ |
| 51 |
public function register_hooks(): void; |
| 52 |
} |
| 53 |
|