AdminNoticeHandler.php
5 years ago
RequestHandler.php
5 years ago
TopLevelMenuRedirect.php
5 years ago
AdminNoticeHandler.php
46 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Onboarding class |
| 5 | * |
| 6 | * @package Give |
| 7 | */ |
| 8 | |
| 9 | namespace Give\Onboarding\Setup\Handlers; |
| 10 | |
| 11 | defined( 'ABSPATH' ) || exit; |
| 12 | |
| 13 | class AdminNoticeHandler implements RequestHandler { |
| 14 | |
| 15 | /** |
| 16 | * @inheritDoc |
| 17 | */ |
| 18 | public function maybeHandle() { |
| 19 | if ( ! isset( $_GET['page'] ) || 'give-setup' !== $_GET['page'] ) { |
| 20 | return; |
| 21 | } |
| 22 | |
| 23 | $this->handle(); |
| 24 | } |
| 25 | |
| 26 | /** |
| 27 | * @inheritDoc |
| 28 | */ |
| 29 | public function handle() { |
| 30 | add_action( |
| 31 | 'admin_notices', |
| 32 | function() { |
| 33 | ob_start(); |
| 34 | }, |
| 35 | -999999 |
| 36 | ); |
| 37 | add_action( |
| 38 | 'admin_notices', |
| 39 | function() { |
| 40 | ob_get_clean(); |
| 41 | }, |
| 42 | 999999 |
| 43 | ); |
| 44 | } |
| 45 | } |
| 46 |