@@ -18,8 +18,8 @@ public static function register() {
1818 include_once dirname ( __FILE__ ) . '/class-listtable.php ' ;
1919
2020 $ hook = add_users_page (
21- __ ( 'Registered OAuth Applications ' , 'rest_oauth2 ' ),
22- _x ( 'Applications ' , 'menu title ' , 'rest_oauth2 ' ),
21+ __ ( 'Registered OAuth Applications ' , 'oauth2 ' ),
22+ _x ( 'Applications ' , 'menu title ' , 'oauth2 ' ),
2323 'list_users ' ,
2424 self ::BASE_SLUG ,
2525 [ get_class (), 'dispatch ' ]
@@ -109,28 +109,28 @@ public static function render() {
109109 <div class="wrap">
110110 <h2>
111111 <?php
112- esc_html_e ( 'Registered Applications ' , 'rest_oauth2 ' );
112+ esc_html_e ( 'Registered Applications ' , 'oauth2 ' );
113113
114114 if ( current_user_can ( 'create_users ' ) ): ?>
115115 <a href="<?php echo esc_url ( self ::get_url ( 'action=add ' ) ) ?> "
116- class="add-new-h2"><?php echo esc_html_x ( 'Add New ' , 'application ' , 'rest_oauth2 ' ); ?> </a>
116+ class="add-new-h2"><?php echo esc_html_x ( 'Add New ' , 'application ' , 'oauth2 ' ); ?> </a>
117117 <?php
118118 endif ;
119119 ?>
120120 </h2>
121121 <?php
122122 if ( ! empty ( $ _GET ['deleted ' ] ) ) {
123- echo '<div id="message" class="updated"><p> ' . esc_html__ ( 'Deleted application. ' , 'rest_oauth2 ' ) . '</p></div> ' ;
123+ echo '<div id="message" class="updated"><p> ' . esc_html__ ( 'Deleted application. ' , 'oauth2 ' ) . '</p></div> ' ;
124124 } elseif ( ! empty ( $ _GET ['approved ' ] ) ) {
125- echo '<div id="message" class="updated"><p> ' . esc_html__ ( 'Approved application. ' , 'rest_oauth2 ' ) . '</p></div> ' ;
125+ echo '<div id="message" class="updated"><p> ' . esc_html__ ( 'Approved application. ' , 'oauth2 ' ) . '</p></div> ' ;
126126 }
127127 ?>
128128
129129 <?php $ wp_list_table ->views (); ?>
130130
131131 <form action="" method="get">
132132
133- <?php $ wp_list_table ->search_box ( __ ( 'Search Applications ' , 'rest_oauth2 ' ), 'rest_oauth2 ' ); ?>
133+ <?php $ wp_list_table ->search_box ( __ ( 'Search Applications ' , 'oauth2 ' ), 'oauth2 ' ); ?>
134134
135135 <?php $ wp_list_table ->display (); ?>
136136
@@ -152,22 +152,22 @@ protected static function validate_parameters( $params ) {
152152 $ valid = [];
153153
154154 if ( empty ( $ params ['name ' ] ) ) {
155- return new WP_Error ( 'rest_oauth2_missing_name ' , __ ( 'Client name is required ' , 'rest_oauth2 ' ) );
155+ return new WP_Error ( 'rest_oauth2_missing_name ' , __ ( 'Client name is required ' , 'oauth2 ' ) );
156156 }
157157 $ valid ['name ' ] = wp_filter_post_kses ( $ params ['name ' ] );
158158
159159 if ( empty ( $ params ['description ' ] ) ) {
160- return new WP_Error ( 'rest_oauth2_missing_description ' , __ ( 'Client description is required ' , 'rest_oauth2 ' ) );
160+ return new WP_Error ( 'rest_oauth2_missing_description ' , __ ( 'Client description is required ' , 'oauth2 ' ) );
161161 }
162162 $ valid ['description ' ] = wp_filter_post_kses ( $ params ['description ' ] );
163163
164164 if ( empty ( $ params ['type ' ] ) ) {
165- return new WP_Error ( 'rest_oauth2_missing_type ' , __ ( 'Type is required. ' , 'rest_oauth2 ' ) );
165+ return new WP_Error ( 'rest_oauth2_missing_type ' , __ ( 'Type is required. ' , 'oauth2 ' ) );
166166 }
167167 $ valid ['type ' ] = wp_filter_post_kses ( $ params ['type ' ] );
168168
169169 if ( empty ( $ params ['callback ' ] ) ) {
170- return new WP_Error ( 'rest_oauth2_missing_callback ' , __ ( 'Client callback is required and must be a valid URL. ' , 'rest_oauth2 ' ) );
170+ return new WP_Error ( 'rest_oauth2_missing_callback ' , __ ( 'Client callback is required and must be a valid URL. ' , 'oauth2 ' ) );
171171 }
172172 if ( ! empty ( $ params ['callback ' ] ) ) {
173173 $ valid ['callback ' ] = $ params ['callback ' ];
@@ -251,7 +251,7 @@ protected static function handle_edit_submit( Client $consumer = null ) {
251251 */
252252 public static function render_edit_page () {
253253 if ( ! current_user_can ( 'edit_users ' ) ) {
254- wp_die ( __ ( 'You do not have permission to access this page. ' , 'rest_oauth2 ' ) );
254+ wp_die ( __ ( 'You do not have permission to access this page. ' , 'oauth2 ' ) );
255255 }
256256
257257 // Are we editing?
@@ -262,7 +262,7 @@ public static function render_edit_page() {
262262 $ id = absint ( $ _REQUEST ['id ' ] );
263263 $ consumer = Client::get_by_post_id ( $ id );
264264 if ( is_wp_error ( $ consumer ) || empty ( $ consumer ) ) {
265- wp_die ( __ ( 'Invalid client ID. ' , 'rest_oauth2 ' ) );
265+ wp_die ( __ ( 'Invalid client ID. ' , 'oauth2 ' ) );
266266 }
267267
268268 $ form_action = self ::get_url ( [ 'action ' => 'edit ' , 'id ' => $ id ] );
@@ -277,15 +277,15 @@ public static function render_edit_page() {
277277 if ( ! empty ( $ _GET ['did_action ' ] ) ) {
278278 switch ( $ _GET ['did_action ' ] ) {
279279 case 'edit ' :
280- $ messages [] = __ ( 'Updated application. ' , 'rest_oauth2 ' );
280+ $ messages [] = __ ( 'Updated application. ' , 'oauth2 ' );
281281 break ;
282282
283283 case 'regenerate ' :
284- $ messages [] = __ ( 'Regenerated secret. ' , 'rest_oauth2 ' );
284+ $ messages [] = __ ( 'Regenerated secret. ' , 'oauth2 ' );
285285 break ;
286286
287287 default :
288- $ messages [] = __ ( 'Successfully created application. ' , 'rest_oauth2 ' );
288+ $ messages [] = __ ( 'Successfully created application. ' , 'oauth2 ' );
289289 break ;
290290 }
291291 }
@@ -309,7 +309,7 @@ public static function render_edit_page() {
309309
310310 // Header time!
311311 global $ title , $ parent_file , $ submenu_file ;
312- $ title = $ consumer ? __ ( 'Edit Application ' , 'rest_oauth2 ' ) : __ ( 'Add Application ' , 'rest_oauth2 ' );
312+ $ title = $ consumer ? __ ( 'Edit Application ' , 'oauth2 ' ) : __ ( 'Add Application ' , 'oauth2 ' );
313313 $ parent_file = 'users.php ' ;
314314 $ submenu_file = self ::BASE_SLUG ;
315315
@@ -331,24 +331,24 @@ public static function render_edit_page() {
331331 <table class="form-table">
332332 <tr>
333333 <th scope="row">
334- <label for="oauth-name"><?php echo esc_html_x ( 'Client Name ' , 'field name ' , 'rest_oauth2 ' ) ?> </label>
334+ <label for="oauth-name"><?php echo esc_html_x ( 'Client Name ' , 'field name ' , 'oauth2 ' ) ?> </label>
335335 </th>
336336 <td>
337337 <input type="text" class="regular-text" name="name" id="oauth-name" value="<?php echo esc_attr ( $ data ['name ' ] ) ?> "/>
338- <p class="description"><?php esc_html_e ( 'This is shown to users during authorization and in their profile. ' , 'rest_oauth2 ' ) ?> </p>
338+ <p class="description"><?php esc_html_e ( 'This is shown to users during authorization and in their profile. ' , 'oauth2 ' ) ?> </p>
339339 </td>
340340 </tr>
341341 <tr>
342342 <th scope="row">
343- <label for="oauth-description"><?php echo esc_html_x ( 'Description ' , 'field name ' , 'rest_oauth2 ' ) ?> </label>
343+ <label for="oauth-description"><?php echo esc_html_x ( 'Description ' , 'field name ' , 'oauth2 ' ) ?> </label>
344344 </th>
345345 <td>
346346 <textarea class="regular-text" name="description" id="oauth-description" cols="30" rows="5" style="width: 500px"><?php echo esc_textarea ( $ data ['description ' ] ) ?> </textarea>
347347 </td>
348348 </tr>
349349 <tr>
350350 <th scope="row">
351- <?php echo esc_html_x ( 'Type ' , 'field name ' , 'rest_oauth2 ' ) ?>
351+ <?php echo esc_html_x ( 'Type ' , 'field name ' , 'oauth2 ' ) ?>
352352 </th>
353353 <td>
354354 <ul>
@@ -361,12 +361,12 @@ public static function render_edit_page() {
361361 <?php checked ( 'private ' , $ data ['type ' ] ); ?>
362362 />
363363 <label for="oauth-type-private">
364- <?php echo esc_html_x ( 'Private ' , 'Client type select option ' , 'rest_oauth2 ' ); ?>
364+ <?php echo esc_html_x ( 'Private ' , 'Client type select option ' , 'oauth2 ' ); ?>
365365 </label>
366366 <p class="description">
367367 <?php esc_html_e (
368368 'Clients capable of maintaining confidentiality of credentials, such as server-side applications ' ,
369- 'rest_oauth2 '
369+ 'oauth2 '
370370 ) ?>
371371 </p>
372372 </li>
@@ -379,12 +379,12 @@ public static function render_edit_page() {
379379 <?php checked ( 'public ' , $ data ['type ' ] ); ?>
380380 />
381381 <label for="oauth-type-public">
382- <?php echo esc_html_x ( 'Public ' , 'Client type select option ' , 'rest_oauth2 ' ); ?>
382+ <?php echo esc_html_x ( 'Public ' , 'Client type select option ' , 'oauth2 ' ); ?>
383383 </label>
384384 <p class="description">
385385 <?php esc_html_e (
386386 'Clients incapable of keeping credentials secret, such as browser-based applications or desktop and mobile apps ' ,
387- 'rest_oauth2 '
387+ 'oauth2 '
388388 ) ?>
389389 </p>
390390 </li>
@@ -393,11 +393,11 @@ public static function render_edit_page() {
393393 </tr>
394394 <tr>
395395 <th scope="row">
396- <label for="oauth-callback"><?php echo esc_html_x ( 'Callback ' , 'field name ' , 'rest_oauth2 ' ) ?> </label>
396+ <label for="oauth-callback"><?php echo esc_html_x ( 'Callback ' , 'field name ' , 'oauth2 ' ) ?> </label>
397397 </th>
398398 <td>
399399 <input type="text" class="regular-text" name="callback" id="oauth-callback" value="<?php echo esc_attr ( $ data ['callback ' ] ) ?> "/>
400- <p class="description"><?php esc_html_e ( "Your application's callback URI or a list of comma separated URIs. The callback passed with the request token must match the scheme, host, port, and path of this URL. " , 'rest_oauth2 ' ) ?> </p>
400+ <p class="description"><?php esc_html_e ( "Your application's callback URI or a list of comma separated URIs. The callback passed with the request token must match the scheme, host, port, and path of this URL. " , 'oauth2 ' ) ?> </p>
401401 </td>
402402 </tr>
403403 </table>
@@ -406,32 +406,32 @@ public static function render_edit_page() {
406406
407407 if ( empty ( $ consumer ) ) {
408408 wp_nonce_field ( 'rest-oauth2-add ' );
409- submit_button ( __ ( 'Create Client ' , 'rest_oauth2 ' ) );
409+ submit_button ( __ ( 'Create Client ' , 'oauth2 ' ) );
410410 } else {
411411 echo '<input type="hidden" name="id" value=" ' . esc_attr ( $ consumer ->get_post_id () ) . '" /> ' ;
412412 wp_nonce_field ( 'rest-oauth2-edit- ' . $ consumer ->get_post_id () );
413- submit_button ( __ ( 'Save Client ' , 'rest_oauth2 ' ) );
413+ submit_button ( __ ( 'Save Client ' , 'oauth2 ' ) );
414414 }
415415
416416 ?>
417417 </form>
418418
419419 <?php if ( ! empty ( $ consumer ) ) : ?>
420420 <form method="post" action="<?php echo esc_url ( $ regenerate_action ) ?> ">
421- <h3><?php esc_html_e ( 'OAuth Credentials ' , 'rest_oauth2 ' ) ?> </h3>
421+ <h3><?php esc_html_e ( 'OAuth Credentials ' , 'oauth2 ' ) ?> </h3>
422422
423423 <table class="form-table">
424424 <tr>
425425 <th scope="row">
426- <?php esc_html_e ( 'Client Key ' , 'rest_oauth2 ' ) ?>
426+ <?php esc_html_e ( 'Client Key ' , 'oauth2 ' ) ?>
427427 </th>
428428 <td>
429429 <code><?php echo esc_html ( $ consumer ->get_id () ) ?> </code>
430430 </td>
431431 </tr>
432432 <tr>
433433 <th scope="row">
434- <?php esc_html_e ( 'Client Secret ' , 'rest_oauth2 ' ) ?>
434+ <?php esc_html_e ( 'Client Secret ' , 'oauth2 ' ) ?>
435435 </th>
436436 <td>
437437 <code><?php echo esc_html ( $ consumer ->get_secret () ) ?> </code>
@@ -441,7 +441,7 @@ public static function render_edit_page() {
441441
442442 <?php
443443 wp_nonce_field ( 'rest-oauth2-regenerate: ' . $ consumer ->get_post_id () );
444- submit_button ( __ ( 'Regenerate Secret ' , 'rest_oauth2 ' ), 'delete ' );
444+ submit_button ( __ ( 'Regenerate Secret ' , 'oauth2 ' ), 'delete ' );
445445 ?>
446446 </form>
447447 <?php endif ?>
@@ -463,8 +463,8 @@ public static function handle_delete() {
463463
464464 if ( ! current_user_can ( 'delete_post ' , $ id ) ) {
465465 wp_die (
466- '<h1> ' . __ ( 'Cheatin’ uh? ' , 'rest_oauth2 ' ) . '</h1> ' .
467- '<p> ' . __ ( 'You are not allowed to delete this application. ' , 'rest_oauth2 ' ) . '</p> ' ,
466+ '<h1> ' . __ ( 'Cheatin’ uh? ' , 'oauth2 ' ) . '</h1> ' .
467+ '<p> ' . __ ( 'You are not allowed to delete this application. ' , 'oauth2 ' ) . '</p> ' ,
468468 403
469469 );
470470 }
@@ -500,8 +500,8 @@ public static function handle_approve() {
500500
501501 if ( ! current_user_can ( 'publish_post ' , $ id ) ) {
502502 wp_die (
503- '<h1> ' . __ ( 'Cheatin’ uh? ' , 'rest_oauth2 ' ) . '</h1> ' .
504- '<p> ' . __ ( 'You are not allowed to approve this application. ' , 'rest_oauth2 ' ) . '</p> ' ,
503+ '<h1> ' . __ ( 'Cheatin’ uh? ' , 'oauth2 ' ) . '</h1> ' .
504+ '<p> ' . __ ( 'You are not allowed to approve this application. ' , 'oauth2 ' ) . '</p> ' ,
505505 403
506506 );
507507 }
@@ -533,8 +533,8 @@ public static function handle_regenerate() {
533533
534534 if ( ! current_user_can ( 'edit_post ' , $ id ) ) {
535535 wp_die (
536- '<h1> ' . __ ( 'Cheatin’ uh? ' , 'rest_oauth2 ' ) . '</h1> ' .
537- '<p> ' . __ ( 'You are not allowed to edit this application. ' , 'rest_oauth2 ' ) . '</p> ' ,
536+ '<h1> ' . __ ( 'Cheatin’ uh? ' , 'oauth2 ' ) . '</h1> ' .
537+ '<p> ' . __ ( 'You are not allowed to edit this application. ' , 'oauth2 ' ) . '</p> ' ,
538538 403
539539 );
540540 }
0 commit comments