| 1 |
<?php |
| 2 |
/** |
| 3 |
* @package GDPRess |
| 4 |
* @author Daan van den Bergh |
| 5 |
* https://daan.dev |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace GDPRess; |
| 9 |
|
| 10 |
use GDPRess\Admin\Ajax; |
| 11 |
use GDPRess\Admin\CacheManager; |
| 12 |
use GDPRess\Admin\Settings\Help; |
| 13 |
use GDPRess\Admin\Settings\Manage; |
| 14 |
use GDPRess\Admin\Notice; |
| 15 |
|
| 16 |
class Admin { |
| 17 |
|
| 18 |
/** |
| 19 |
* Set fields. |
| 20 |
* |
| 21 |
* @return void |
| 22 |
*/ |
| 23 |
public function __construct() { |
| 24 |
$this->init(); |
| 25 |
} |
| 26 |
|
| 27 |
/** |
| 28 |
* Hooks and Filters |
| 29 |
* |
| 30 |
* @return void |
| 31 |
*/ |
| 32 |
private function init() { |
| 33 |
add_action( 'admin_init', [ $this, 'update_cache' ] ); |
| 34 |
add_action( 'admin_notices', [ $this, 'print_notices' ] ); |
| 35 |
|
| 36 |
$this->add_ajax_hooks(); |
| 37 |
$this->build_manage_section(); |
| 38 |
$this->build_help_section(); |
| 39 |
} |
| 40 |
|
| 41 |
/** |
| 42 |
* Add AJAX hooks. |
| 43 |
* |
| 44 |
* @return void |
| 45 |
*/ |
| 46 |
private function add_ajax_hooks() { |
| 47 |
new Ajax(); |
| 48 |
} |
| 49 |
|
| 50 |
/** |
| 51 |
* Build Manage section contents. |
| 52 |
* |
| 53 |
* @return void |
| 54 |
*/ |
| 55 |
private function build_manage_section() { |
| 56 |
new Manage(); |
| 57 |
} |
| 58 |
|
| 59 |
/** |
| 60 |
* Load Help section contents. |
| 61 |
* |
| 62 |
* @return void |
| 63 |
*/ |
| 64 |
private function build_help_section() { |
| 65 |
new Help(); |
| 66 |
} |
| 67 |
|
| 68 |
/** |
| 69 |
* Print onscreen notices, if any. |
| 70 |
* |
| 71 |
* @return void |
| 72 |
*/ |
| 73 |
public function print_notices() { |
| 74 |
Notice::print_notices(); |
| 75 |
} |
| 76 |
|
| 77 |
/** |
| 78 |
* File Downloader |
| 79 |
* |
| 80 |
* @return void |
| 81 |
*/ |
| 82 |
public function update_cache() { |
| 83 |
new CacheManager(); |
| 84 |
} |
| 85 |
} |
| 86 |
|