@@ -89,43 +89,35 @@ public static function get_rest_uri() {
8989 */
9090 public function register_routes () {
9191 $ args = array (
92- array (
93- 'methods ' => WP_REST_Server::CREATABLE ,
94- 'callback ' => array (
95- $ this ,
96- 'generate_token ' ,
92+ 'methods ' => WP_REST_Server::CREATABLE ,
93+ 'callback ' => array ( $ this , 'generate_token ' ),
94+ 'args ' => array (
95+ 'username ' => array (
96+ 'description ' => __ ( 'The username of the user; requires also setting the password argument. ' , 'jwt-auth ' ),
97+ 'type ' => 'string ' ,
98+ 'sanitize_callback ' => 'sanitize_user ' ,
99+ 'validate_callback ' => 'rest_validate_request_arg ' ,
97100 ),
98- 'args ' => array (
99- 'username ' => array (
100- 'description ' => __ ( 'The username of the user; requires also setting the password argument. ' , 'jwt-auth ' ),
101- 'type ' => 'string ' ,
102- 'sanitize_callback ' => 'sanitize_user ' ,
103- 'validate_callback ' => 'rest_validate_request_arg ' ,
104- ),
105- 'password ' => array (
106- 'description ' => __ ( 'The password of the user; requires also setting the username argument. ' , 'jwt-auth ' ),
107- 'type ' => 'string ' ,
108- 'sanitize_callback ' => 'sanitize_text_field ' ,
109- 'validate_callback ' => 'rest_validate_request_arg ' ,
110- ),
111- 'api_key ' => array (
112- 'description ' => __ ( 'The API key of the user; requires also setting the api_secret. ' , 'jwt-auth ' ),
113- 'type ' => 'string ' ,
114- 'sanitize_callback ' => 'sanitize_text_field ' ,
115- 'validate_callback ' => 'rest_validate_request_arg ' ,
116- ),
117- 'api_secret ' => array (
118- 'description ' => __ ( 'The API secret of the user; requires also setting the api_key. ' , 'jwt-auth ' ),
119- 'type ' => 'string ' ,
120- 'sanitize_callback ' => 'sanitize_text_field ' ,
121- 'validate_callback ' => 'rest_validate_request_arg ' ,
122- ),
101+ 'password ' => array (
102+ 'description ' => __ ( 'The password of the user; requires also setting the username argument. ' , 'jwt-auth ' ),
103+ 'type ' => 'string ' ,
104+ 'sanitize_callback ' => 'sanitize_text_field ' ,
105+ 'validate_callback ' => 'rest_validate_request_arg ' ,
106+ ),
107+ 'api_key ' => array (
108+ 'description ' => __ ( 'The API key of the user; requires also setting the api_secret. ' , 'jwt-auth ' ),
109+ 'type ' => 'string ' ,
110+ 'sanitize_callback ' => 'sanitize_text_field ' ,
111+ 'validate_callback ' => 'rest_validate_request_arg ' ,
112+ ),
113+ 'api_secret ' => array (
114+ 'description ' => __ ( 'The API secret of the user; requires also setting the api_key. ' , 'jwt-auth ' ),
115+ 'type ' => 'string ' ,
116+ 'sanitize_callback ' => 'sanitize_text_field ' ,
117+ 'validate_callback ' => 'rest_validate_request_arg ' ,
123118 ),
124119 ),
125- 'schema ' => array (
126- $ this ,
127- 'get_item_schema ' ,
128- ),
120+ 'schema ' => array ( $ this , 'get_item_schema ' ),
129121 );
130122 register_rest_route ( self ::_NAMESPACE_ , '/ ' . self ::_REST_BASE_ , $ args );
131123 }
0 commit comments