AdminDismissibleNotice.php
4 years ago
AdminErrorNotice.php
4 years ago
AdminNotice.php
4 years ago
Filters.php
4 years ago
SitewideAdminDismissibleNotice.php
4 years ago
AdminNotice.php
30 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Wpae\WordPress; |
| 4 | |
| 5 | |
| 6 | abstract class AdminNotice |
| 7 | { |
| 8 | protected $message; |
| 9 | |
| 10 | public function __construct($message) |
| 11 | { |
| 12 | $this->message = $message; |
| 13 | } |
| 14 | |
| 15 | public function showNotice() |
| 16 | { |
| 17 | ?> |
| 18 | <div class="<?php echo $this->getType();?>"><p> |
| 19 | <?php echo $this->message; ?> |
| 20 | </p></div> |
| 21 | <?php |
| 22 | } |
| 23 | |
| 24 | public function render() |
| 25 | { |
| 26 | add_action('admin_notices', array($this, 'showNotice')); |
| 27 | } |
| 28 | |
| 29 | abstract function getType(); |
| 30 | } |