From 150976c0683bc9a20dfb85fe0726518a0dcc3cee Mon Sep 17 00:00:00 2001 From: Piotr Delawski Date: Wed, 8 Sep 2021 22:26:08 +0200 Subject: [PATCH] Fix phpcs issues --- src/Admin/OptionsMenu.php | 28 ++++++++++++------------- src/Admin/UserRESTEndpointExtension.php | 4 ++-- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/Admin/OptionsMenu.php b/src/Admin/OptionsMenu.php index 673928d76ce..8213415e891 100644 --- a/src/Admin/OptionsMenu.php +++ b/src/Admin/OptionsMenu.php @@ -223,31 +223,31 @@ public function enqueue_assets( $hook_suffix ) { $is_reader_theme = $this->reader_themes->theme_data_exists( get_stylesheet() ); $js_data = [ - 'AMP_QUERY_VAR' => amp_get_slug(), - 'CURRENT_THEME' => [ + 'AMP_QUERY_VAR' => amp_get_slug(), + 'CURRENT_THEME' => [ 'name' => $theme->get( 'Name' ), 'description' => $theme->get( 'Description' ), 'is_reader_theme' => $is_reader_theme, 'screenshot' => $theme->get_screenshot() ?: null, 'url' => $theme->get( 'ThemeURI' ), ], - 'HAS_DEPENDENCY_SUPPORT' => $this->dependency_support->has_support(), - 'HOME_URL' => home_url( '/' ), - 'OPTIONS_REST_PATH' => '/amp/v1/options', - 'READER_THEMES_REST_PATH' => '/amp/v1/reader-themes', - 'IS_CORE_THEME' => in_array( + 'HAS_DEPENDENCY_SUPPORT' => $this->dependency_support->has_support(), + 'HOME_URL' => home_url( '/' ), + 'OPTIONS_REST_PATH' => '/amp/v1/options', + 'READER_THEMES_REST_PATH' => '/amp/v1/reader-themes', + 'IS_CORE_THEME' => in_array( get_stylesheet(), AMP_Core_Theme_Sanitizer::get_supported_themes(), true ), - 'LEGACY_THEME_SLUG' => ReaderThemes::DEFAULT_READER_THEME, - 'USING_FALLBACK_READER_THEME' => $this->reader_themes->using_fallback_theme(), - 'THEME_SUPPORT_ARGS' => AMP_Theme_Support::get_theme_support_args(), - 'THEME_SUPPORTS_READER_MODE' => AMP_Theme_Support::supports_reader_mode(), - 'UPDATES_NONCE' => wp_create_nonce( 'updates' ), - 'USER_FIELD_DEVELOPER_TOOLS_ENABLED' => UserAccess::USER_FIELD_DEVELOPER_TOOLS_ENABLED, + 'LEGACY_THEME_SLUG' => ReaderThemes::DEFAULT_READER_THEME, + 'USING_FALLBACK_READER_THEME' => $this->reader_themes->using_fallback_theme(), + 'THEME_SUPPORT_ARGS' => AMP_Theme_Support::get_theme_support_args(), + 'THEME_SUPPORTS_READER_MODE' => AMP_Theme_Support::supports_reader_mode(), + 'UPDATES_NONCE' => wp_create_nonce( 'updates' ), + 'USER_FIELD_DEVELOPER_TOOLS_ENABLED' => UserAccess::USER_FIELD_DEVELOPER_TOOLS_ENABLED, 'USER_FIELD_REVIEW_PANEL_DISMISSED_FOR_TEMPLATE_MODE' => UserRESTEndpointExtension::USER_FIELD_REVIEW_PANEL_DISMISSED_FOR_TEMPLATE_MODE, - 'USER_REST_PATH' => '/wp/v2/users/me', + 'USER_REST_PATH' => '/wp/v2/users/me', ]; wp_add_inline_script( diff --git a/src/Admin/UserRESTEndpointExtension.php b/src/Admin/UserRESTEndpointExtension.php index eb661d8c9a0..320abafe4e2 100644 --- a/src/Admin/UserRESTEndpointExtension.php +++ b/src/Admin/UserRESTEndpointExtension.php @@ -62,7 +62,7 @@ public function register_rest_field() { * @return string|WP_Error Template mode fir which the panel is dismissed, empty string if the option has not been set, or WP_Error if the current user lacks permission. */ public function get_review_panel_dismissed_for_template_mode( $user ) { - if ( $user['id'] !== wp_get_current_user()->ID ) { + if ( wp_get_current_user()->ID !== $user['id'] ) { return new WP_Error( 'amp_rest_cannot_get_other_user', __( 'Sorry, the current user is not allowed to get this data about other user.', 'amp' ), @@ -90,7 +90,7 @@ public function update_review_panel_dismissed_for_template_mode( $template_mode, ); } - if ( $user->ID !== wp_get_current_user()->ID ) { + if ( wp_get_current_user()->ID !== $user->ID ) { return new WP_Error( 'amp_rest_cannot_edit_other_user', __( 'Sorry, the user is not allowed to make this change for other user.', 'amp' ),