config
4 years ago
notices
1 month ago
Config.php
1 month ago
Dismissed.php
1 month ago
Display.php
1 month ago
Loader.php
1 month ago
MessageTexts.php
1 month ago
PageConfig.php
1 month ago
ScreenConfig.php
1 month ago
Store.php
1 month ago
ScreenConfig.php
30 lines
| 1 | <?php |
| 2 | |
| 3 | namespace OTGS\Installer\AdminNotices; |
| 4 | |
| 5 | class ScreenConfig extends Config { |
| 6 | |
| 7 | public function isAnyMessageOnPage( array $messages ) { |
| 8 | $currentScreen = get_current_screen(); |
| 9 | |
| 10 | if ( ! $currentScreen instanceof \WP_Screen ) { |
| 11 | return false; |
| 12 | } |
| 13 | |
| 14 | return $this->hasItem( $messages, $currentScreen->id, 'screens' ); |
| 15 | } |
| 16 | |
| 17 | public function shouldShowMessage( $repo, $id ) { |
| 18 | $currentScreen = get_current_screen(); |
| 19 | |
| 20 | if ( $currentScreen instanceof \WP_Screen ) { |
| 21 | if ( isset( $this->config['repo'][ $repo ][ $id ]['screens'] ) ) { |
| 22 | return in_array( $currentScreen->id, $this->config['repo'][ $repo ][ $id ]['screens'] ); |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | return false; |
| 27 | } |
| 28 | |
| 29 | } |
| 30 |