class-shortcodes-ultimate-notice-unsafe-features.php
933 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
41
42
43
44
45
46
47
48
49
<?php
final class Shortcodes_Ultimate_Notice_Unsafe_Features extends Shortcodes_Ultimate_Notice {
public function display_notice() {
if ( ! get_option( 'su_option_unsafe_features_auto_off' ) ) {
return;
}
if ( $this->is_dismissed() ) {
return;
}
if ( ! $this->current_user_can_view() ) {
return;
}
// phpcs:disable
$is_plugin_page =
isset( $_GET['page'] ) &&
in_array(
$_GET['page'],
array( 'shortcodes-ultimate', 'shortcodes-ultimate-settings' ),
true
);
// phpcs:enable
if ( 'dashboard' !== $this->get_current_screen_id() && ! $is_plugin_page ) {
return;
}
$this->include_template();
}
public function hide_notice_on_option_change( $prev_value, $new_value, $option ) {
if ( ! get_option( 'su_option_unsafe_features_auto_off' ) ) {
return;
}
if ( '' === $prev_value && 'on' === $new_value ) {
$this->update_notice_status( 'dismissed' );
}
}
}