@@ -85,78 +85,63 @@ public static function get_rest_uri() {
85
85
*/
86
86
public function register_routes () {
87
87
$ args = array (
88
- array (
89
- 'methods ' => WP_REST_Server::CREATABLE ,
90
- 'callback ' => array (
91
- $ this ,
92
- 'generate_key_pair ' ,
88
+ 'methods ' => WP_REST_Server::CREATABLE ,
89
+ 'callback ' => array ( $ this , 'generate_key_pair ' ),
90
+ 'args ' => array (
91
+ 'name ' => array (
92
+ 'description ' => esc_html__ ( 'The name of the key-pair. ' , 'jwt-auth ' ),
93
+ 'type ' => 'string ' ,
94
+ 'required ' => true ,
95
+ 'sanitize_callback ' => 'sanitize_text_field ' ,
96
+ 'validate_callback ' => 'rest_validate_request_arg ' ,
93
97
),
94
- 'args ' => array (
95
- 'name ' => array (
96
- 'description ' => esc_html__ ( 'The name of the key-pair. ' , 'jwt-auth ' ),
97
- 'type ' => 'string ' ,
98
- 'required ' => true ,
99
- 'sanitize_callback ' => 'sanitize_text_field ' ,
100
- 'validate_callback ' => 'rest_validate_request_arg ' ,
101
- ),
102
- 'user_id ' => array (
103
- 'description ' => esc_html__ ( 'The ID of the user. ' , 'jwt-auth ' ),
104
- 'type ' => 'integer ' ,
105
- 'required ' => true ,
106
- 'sanitize_callback ' => 'absint ' ,
107
- 'validate_callback ' => 'rest_validate_request_arg ' ,
108
- ),
98
+ 'user_id ' => array (
99
+ 'description ' => esc_html__ ( 'The ID of the user. ' , 'jwt-auth ' ),
100
+ 'type ' => 'integer ' ,
101
+ 'required ' => true ,
102
+ 'sanitize_callback ' => 'absint ' ,
103
+ 'validate_callback ' => 'rest_validate_request_arg ' ,
109
104
),
110
105
),
111
- 'schema ' => array (
106
+ 'schema ' => array (
112
107
$ this ,
113
108
'get_item_schema ' ,
114
109
),
115
110
);
116
111
register_rest_route ( self ::_NAMESPACE_ , '/ ' . self ::_REST_BASE_ . '/(?P<user_id>[\d]+) ' , $ args );
117
112
118
113
$ args = array (
119
- array (
120
- 'methods ' => WP_REST_Server::DELETABLE ,
121
- 'callback ' => array (
122
- $ this ,
123
- 'delete_all_key_pairs ' ,
124
- ),
125
- 'args ' => array (
126
- 'user_id ' => array (
127
- 'description ' => esc_html__ ( 'The ID of the user. ' , 'jwt-auth ' ),
128
- 'type ' => 'integer ' ,
129
- 'required ' => true ,
130
- 'sanitize_callback ' => 'absint ' ,
131
- 'validate_callback ' => 'rest_validate_request_arg ' ,
132
- ),
114
+ 'methods ' => WP_REST_Server::DELETABLE ,
115
+ 'callback ' => array ( $ this , 'delete_all_key_pairs ' ),
116
+ 'args ' => array (
117
+ 'user_id ' => array (
118
+ 'description ' => esc_html__ ( 'The ID of the user. ' , 'jwt-auth ' ),
119
+ 'type ' => 'integer ' ,
120
+ 'required ' => true ,
121
+ 'sanitize_callback ' => 'absint ' ,
122
+ 'validate_callback ' => 'rest_validate_request_arg ' ,
133
123
),
134
124
),
135
125
);
136
126
register_rest_route ( self ::_NAMESPACE_ , '/ ' . self ::_REST_BASE_ . '/(?P<user_id>[\d]+)/revoke-all ' , $ args );
137
127
138
128
$ args = array (
139
- array (
140
- 'methods ' => WP_REST_Server::DELETABLE ,
141
- 'callback ' => array (
142
- $ this ,
143
- 'delete_key_pair ' ,
129
+ 'methods ' => WP_REST_Server::DELETABLE ,
130
+ 'callback ' => array ( $ this , 'delete_key_pair ' ),
131
+ 'args ' => array (
132
+ 'user_id ' => array (
133
+ 'description ' => esc_html__ ( 'The ID of the user. ' , 'jwt-auth ' ),
134
+ 'type ' => 'integer ' ,
135
+ 'required ' => true ,
136
+ 'sanitize_callback ' => 'absint ' ,
137
+ 'validate_callback ' => 'rest_validate_request_arg ' ,
144
138
),
145
- 'args ' => array (
146
- 'user_id ' => array (
147
- 'description ' => esc_html__ ( 'The ID of the user. ' , 'jwt-auth ' ),
148
- 'type ' => 'integer ' ,
149
- 'required ' => true ,
150
- 'sanitize_callback ' => 'absint ' ,
151
- 'validate_callback ' => 'rest_validate_request_arg ' ,
152
- ),
153
- 'api_key ' => array (
154
- 'description ' => esc_html__ ( 'The API key being revoked. ' , 'jwt-auth ' ),
155
- 'type ' => 'string ' ,
156
- 'required ' => true ,
157
- 'sanitize_callback ' => 'sanitize_text_field ' ,
158
- 'validate_callback ' => 'rest_validate_request_arg ' ,
159
- ),
139
+ 'api_key ' => array (
140
+ 'description ' => esc_html__ ( 'The API key being revoked. ' , 'jwt-auth ' ),
141
+ 'type ' => 'string ' ,
142
+ 'required ' => true ,
143
+ 'sanitize_callback ' => 'sanitize_text_field ' ,
144
+ 'validate_callback ' => 'rest_validate_request_arg ' ,
160
145
),
161
146
),
162
147
);
0 commit comments