| 1 |
<?php |
| 2 |
|
| 3 |
namespace Cookiez\Modules\Cookie; |
| 4 |
|
| 5 |
use Cookiez\Classes\Module_Base; |
| 6 |
use Cookiez\Modules\Cookie\Database\Cookie_Table; |
| 7 |
|
| 8 |
if ( ! defined( 'ABSPATH' ) ) { |
| 9 |
exit; |
| 10 |
} |
| 11 |
|
| 12 |
/** |
| 13 |
* Module `Cookie` |
| 14 |
* Manages cookie entity storage and relationships |
| 15 |
*/ |
| 16 |
class Module extends Module_Base { |
| 17 |
|
| 18 |
/** |
| 19 |
* Get module name |
| 20 |
* @return string |
| 21 |
*/ |
| 22 |
public function get_name(): string { |
| 23 |
return 'Cookie'; |
| 24 |
} |
| 25 |
|
| 26 |
/** |
| 27 |
* Get list of REST routes |
| 28 |
* @return array |
| 29 |
*/ |
| 30 |
public static function routes_list(): array { |
| 31 |
return [ |
| 32 |
'Create_Cookie', |
| 33 |
'Get_Cookies', |
| 34 |
'Update_Cookie', |
| 35 |
'Delete_Cookie', |
| 36 |
]; |
| 37 |
} |
| 38 |
|
| 39 |
public static function component_list(): array { |
| 40 |
return [ |
| 41 |
'Cookie', |
| 42 |
]; |
| 43 |
} |
| 44 |
|
| 45 |
/** |
| 46 |
* Install database tables |
| 47 |
* Called on plugin activation |
| 48 |
*/ |
| 49 |
public static function install_tables(): void { |
| 50 |
Cookie_Table::install(); |
| 51 |
} |
| 52 |
|
| 53 |
/** |
| 54 |
* Constructor |
| 55 |
*/ |
| 56 |
public function __construct() { |
| 57 |
$this->install_tables(); |
| 58 |
$this->register_components(); |
| 59 |
$this->register_routes(); |
| 60 |
} |
| 61 |
} |
| 62 |
|