Skip to content

Commit 6745745

Browse files
committed
fix #848
1 parent 16ec2ef commit 6745745

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Diff for: App/Controller/Manager.php

+8-2
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,10 @@ protected function _get_option( $key, $option_name ) {
255255
protected function _is_option_page() {
256256
$current_url = admin_url( '/options-general.php?page=' . static::MENU_SLUG ) ?? '';
257257
$current_url = preg_replace( '|^(.+)?(/wp-admin/.*?)$|', '$2', $current_url );
258-
$request_uri = filter_input( INPUT_SERVER, 'REQUEST_URI' ) ?? '';
258+
$request_uri = filter_input( INPUT_SERVER, 'REQUEST_URI' );
259+
if ( ! $request_uri ) {
260+
$request_uri = esc_html( wp_unslash( $_SERVER['REQUEST_URI'] ?? '' ) ); // @phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
261+
}
259262
$request_uri = preg_replace( '|^(.+)?(/wp-admin/.*?)$|', '$2', $request_uri );
260263
return false !== strpos( $request_uri, $current_url );
261264
}
@@ -268,7 +271,10 @@ protected function _is_option_page() {
268271
protected function _is_options_page() {
269272
$current_url = admin_url( '/options.php' ) ?? '';
270273
$current_url = preg_replace( '|^(.+)?(/wp-admin/.*?)$|', '$2', $current_url );
271-
$request_uri = filter_input( INPUT_SERVER, 'REQUEST_URI' ) ?? '';
274+
$request_uri = filter_input( INPUT_SERVER, 'REQUEST_URI' );
275+
if ( ! $request_uri ) {
276+
$request_uri = esc_html( wp_unslash( $_SERVER['REQUEST_URI'] ?? '' ) ); // @phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
277+
}
272278
$request_uri = preg_replace( '|^(.+)?(/wp-admin/.*?)$|', '$2', $request_uri );
273279
return false !== strpos( $request_uri, $current_url );
274280
}

0 commit comments

Comments
 (0)