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