| 1 |
<?php |
| 2 |
|
| 3 |
namespace cybot\cookiebot\admin_notices; |
| 4 |
|
| 5 |
if ( ! defined( 'ABSPATH' ) ) { |
| 6 |
exit; |
| 7 |
} // Exit if accessed directly |
| 8 |
|
| 9 |
class Cookiebot_Notices { |
| 10 |
|
| 11 |
/** |
| 12 |
* @var array |
| 13 |
*/ |
| 14 |
private $notices_list = array(); |
| 15 |
|
| 16 |
public function __construct() { |
| 17 |
$this->load_notices(); |
| 18 |
} |
| 19 |
|
| 20 |
public function register_hooks() { |
| 21 |
add_action( 'init', array( $this, 'build_notices' ) ); |
| 22 |
} |
| 23 |
|
| 24 |
protected function load_notices() { |
| 25 |
$this->notices_list = self::PLUGIN_NOTICES; |
| 26 |
} |
| 27 |
|
| 28 |
public function build_notices() { |
| 29 |
foreach ( $this->notices_list as $notice_class ) { |
| 30 |
( new $notice_class() )->register_hooks(); |
| 31 |
} |
| 32 |
} |
| 33 |
|
| 34 |
const PLUGIN_NOTICES = array( |
| 35 |
Cookiebot_Recommendation_Notice::class, |
| 36 |
Cookiebot_Temp_Notice::class, |
| 37 |
); |
| 38 |
} |
| 39 |
|