ScreenConfig.php
799 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
namespace OTGS\Installer\AdminNotices;
class ScreenConfig extends Config {
/**
* @param array $messages
*
* @return bool
*/
public function isAnyMessageOnPage( array $messages ) {
$currentScreen = get_current_screen();
if ( ! $currentScreen instanceof \WP_Screen ) {
return false;
}
return $this->hasItem( $messages, $currentScreen->id, 'screens' );
}
/**
* @param string $repo
* @param string $id
*
* @return bool
*/
public function shouldShowMessage( $repo, $id ) {
$currentScreen = get_current_screen();
if ( $currentScreen instanceof \WP_Screen ) {
if ( isset( $this->config['repo'][ $repo ][ $id ]['screens'] ) ) {
return in_array( $currentScreen->id, $this->config['repo'][ $repo ][ $id ]['screens'] );
}
}
return false;
}
}