Skip to content

Commit e486b32

Browse files
committed
Fix PHPCS issues
1 parent 5ba672e commit e486b32

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

wp-admin/includes/class-wp-key-pair-list-table.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,12 @@ protected function column_default( $item, $column_name ) {
7373
if ( empty( $item['created'] ) ) {
7474
return '—';
7575
}
76-
return date( 'F j, Y g:i a', $item['created'] );
76+
return gmdate( 'F j, Y g:i a', $item['created'] );
7777
case 'last_used':
7878
if ( empty( $item['last_used'] ) ) {
7979
return '—';
8080
}
81-
return date( 'F j, Y g:i a', $item['last_used'] );
81+
return gmdate( 'F j, Y g:i a', $item['last_used'] );
8282
case 'last_ip':
8383
if ( empty( $item['last_ip'] ) ) {
8484
return '—';

wp-includes/rest-api/auth/class-wp-rest-key-pair.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,14 @@ public function register_routes() {
9696
'callback' => array( $this, 'generate_key_pair' ),
9797
'permission_callback' => '__return_true',
9898
'args' => array(
99-
'name' => array(
99+
'name' => array(
100100
'description' => esc_html__( 'The name of the key-pair.', 'jwt-auth' ),
101101
'type' => 'string',
102102
'required' => true,
103103
'sanitize_callback' => 'sanitize_text_field',
104104
'validate_callback' => 'rest_validate_request_arg',
105105
),
106-
'user_id' => array(
106+
'user_id' => array(
107107
'description' => esc_html__( 'The ID of the user.', 'jwt-auth' ),
108108
'type' => 'integer',
109109
'required' => true,
@@ -120,7 +120,7 @@ public function register_routes() {
120120
'callback' => array( $this, 'delete_all_key_pairs' ),
121121
'permission_callback' => '__return_true',
122122
'args' => array(
123-
'user_id' => array(
123+
'user_id' => array(
124124
'description' => esc_html__( 'The ID of the user.', 'jwt-auth' ),
125125
'type' => 'integer',
126126
'required' => true,
@@ -136,14 +136,14 @@ public function register_routes() {
136136
'callback' => array( $this, 'delete_key_pair' ),
137137
'permission_callback' => '__return_true',
138138
'args' => array(
139-
'user_id' => array(
139+
'user_id' => array(
140140
'description' => esc_html__( 'The ID of the user.', 'jwt-auth' ),
141141
'type' => 'integer',
142142
'required' => true,
143143
'sanitize_callback' => 'absint',
144144
'validate_callback' => 'rest_validate_request_arg',
145145
),
146-
'api_key' => array(
146+
'api_key' => array(
147147
'description' => esc_html__( 'The API key being revoked.', 'jwt-auth' ),
148148
'type' => 'string',
149149
'required' => true,
@@ -517,7 +517,7 @@ public function generate_key_pair( WP_REST_Request $request ) {
517517
$keypairs[] = $new_item;
518518
$this->set_user_key_pairs( $user_id, $keypairs );
519519

520-
$new_item['created'] = date( 'F j, Y g:i a', $new_item['created'] );
520+
$new_item['created'] = gmdate( 'F j, Y g:i a', $new_item['created'] );
521521
$new_item['last_used'] = '';
522522
$new_item['last_ip'] = '';
523523

wp-includes/rest-api/auth/class-wp-rest-token.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function register_routes() {
100100
$args = array(
101101
'methods' => WP_REST_Server::READABLE,
102102
'callback' => array( $this, 'validate' ),
103-
'permission_callback' => '__return_true'
103+
'permission_callback' => '__return_true',
104104
);
105105
register_rest_route( self::_NAMESPACE_, '/' . self::_REST_BASE_ . '/validate', $args );
106106

@@ -109,13 +109,13 @@ public function register_routes() {
109109
'callback' => array( $this, 'generate_token' ),
110110
'permission_callback' => '__return_true',
111111
'args' => array(
112-
'api_key' => array(
112+
'api_key' => array(
113113
'description' => __( 'The API key of the user; requires also setting the api_secret.', 'jwt-auth' ),
114114
'type' => 'string',
115115
'sanitize_callback' => 'sanitize_text_field',
116116
'validate_callback' => 'rest_validate_request_arg',
117117
),
118-
'api_secret' => array(
118+
'api_secret' => array(
119119
'description' => __( 'The API secret of the user; requires also setting the api_key.', 'jwt-auth' ),
120120
'type' => 'string',
121121
'sanitize_callback' => 'sanitize_text_field',
@@ -382,8 +382,8 @@ public function authenticate_refresh_token( $user, WP_REST_Request $request ) {
382382
*/
383383
public function require_token() {
384384
$require_token = true;
385-
$request_uri = isset( $_SERVER['REQUEST_URI'] ) ? sanitize_text_field( $_SERVER['REQUEST_URI'] ) : false;
386-
$request_method = isset( $_SERVER['REQUEST_METHOD'] ) ? sanitize_text_field( $_SERVER['REQUEST_METHOD'] ) : false;
385+
$request_uri = isset( $_SERVER['REQUEST_URI'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : false;
386+
$request_method = isset( $_SERVER['REQUEST_METHOD'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REQUEST_METHOD'] ) ) : false;
387387

388388
// User is already authenticated.
389389
$user = wp_get_current_user();
@@ -777,11 +777,11 @@ public function validate_token() {
777777
public function get_auth_header() {
778778

779779
// Get HTTP Authorization Header.
780-
$header = isset( $_SERVER['HTTP_AUTHORIZATION'] ) ? sanitize_text_field( $_SERVER['HTTP_AUTHORIZATION'] ) : false;
780+
$header = isset( $_SERVER['HTTP_AUTHORIZATION'] ) ? sanitize_text_field( wp_unslash( $_SERVER['HTTP_AUTHORIZATION'] ) ) : false;
781781

782782
// Check for alternative header.
783783
if ( ! $header && isset( $_SERVER['REDIRECT_HTTP_AUTHORIZATION'] ) ) {
784-
$header = sanitize_text_field( $_SERVER['REDIRECT_HTTP_AUTHORIZATION'] );
784+
$header = sanitize_text_field( wp_unslash( $_SERVER['REDIRECT_HTTP_AUTHORIZATION'] ) );
785785
}
786786

787787
// The HTTP Authorization Header is missing, return an error.

0 commit comments

Comments
 (0)