@@ 129-156 (lines=28) @@ | ||
126 | * |
|
127 | * @return void |
|
128 | */ |
|
129 | public function wordpress_init() { |
|
130 | if ( ! current_user_can( 'jetpack_disconnect' ) && is_admin() ) { |
|
131 | add_action( 'admin_notices', array( $this, 'display_non_admin_idc_notice' ) ); |
|
132 | add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_idc_notice_files' ) ); |
|
133 | add_action( 'current_screen', array( $this, 'non_admins_current_screen_check' ) ); |
|
134 | ||
135 | return; |
|
136 | } |
|
137 | ||
138 | if ( |
|
139 | isset( $_GET['jetpack_idc_clear_confirmation'], $_GET['_wpnonce'] ) && |
|
140 | wp_verify_nonce( $_GET['_wpnonce'], 'jetpack_idc_clear_confirmation' ) |
|
141 | ) { |
|
142 | Jetpack_Options::delete_option( 'safe_mode_confirmed' ); |
|
143 | self::$is_safe_mode_confirmed = false; |
|
144 | } else { |
|
145 | self::$is_safe_mode_confirmed = (bool) Jetpack_Options::get_option( 'safe_mode_confirmed' ); |
|
146 | } |
|
147 | ||
148 | // 121 Priority so that it's the most inner Jetpack item in the admin bar. |
|
149 | add_action( 'admin_bar_menu', array( $this, 'display_admin_bar_button' ), 121 ); |
|
150 | add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_bar_css' ) ); |
|
151 | ||
152 | if ( is_admin() && ! self::$is_safe_mode_confirmed ) { |
|
153 | add_action( 'admin_notices', array( $this, 'display_idc_notice' ) ); |
|
154 | add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_idc_notice_files' ) ); |
|
155 | } |
|
156 | } |
|
157 | ||
158 | /** |
|
159 | * Non-admins current screen check. |
@@ 93-119 (lines=27) @@ | ||
90 | } |
|
91 | } |
|
92 | ||
93 | function wordpress_init() { |
|
94 | if ( ! current_user_can( 'jetpack_disconnect' ) && is_admin() ) { |
|
95 | add_action( 'admin_notices', array( $this, 'display_non_admin_idc_notice' ) ); |
|
96 | add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_idc_notice_files' ) ); |
|
97 | add_action( 'current_screen', array( $this, 'non_admins_current_screen_check' ) ); |
|
98 | return; |
|
99 | } |
|
100 | ||
101 | if ( |
|
102 | isset( $_GET['jetpack_idc_clear_confirmation'], $_GET['_wpnonce'] ) && |
|
103 | wp_verify_nonce( $_GET['_wpnonce'], 'jetpack_idc_clear_confirmation' ) |
|
104 | ) { |
|
105 | Jetpack_Options::delete_option( 'safe_mode_confirmed' ); |
|
106 | self::$is_safe_mode_confirmed = false; |
|
107 | } else { |
|
108 | self::$is_safe_mode_confirmed = (bool) Jetpack_Options::get_option( 'safe_mode_confirmed' ); |
|
109 | } |
|
110 | ||
111 | // 121 Priority so that it's the most inner Jetpack item in the admin bar. |
|
112 | add_action( 'admin_bar_menu', array( $this, 'display_admin_bar_button' ), 121 ); |
|
113 | add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_bar_css' ) ); |
|
114 | ||
115 | if ( is_admin() && ! self::$is_safe_mode_confirmed ) { |
|
116 | add_action( 'admin_notices', array( $this, 'display_idc_notice' ) ); |
|
117 | add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_idc_notice_files' ) ); |
|
118 | } |
|
119 | } |
|
120 | ||
121 | function non_admins_current_screen_check( $current_screen ) { |
|
122 | self::$current_screen = $current_screen; |