@@ -18,8 +18,8 @@ public static function register() {
18
18
include_once dirname ( __FILE__ ) . '/class-listtable.php ' ;
19
19
20
20
$ 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 ' ),
23
23
'list_users ' ,
24
24
self ::BASE_SLUG ,
25
25
[ get_class (), 'dispatch ' ]
@@ -109,28 +109,28 @@ public static function render() {
109
109
<div class="wrap">
110
110
<h2>
111
111
<?php
112
- esc_html_e ( 'Registered Applications ' , 'rest_oauth2 ' );
112
+ esc_html_e ( 'Registered Applications ' , 'oauth2 ' );
113
113
114
114
if ( current_user_can ( 'create_users ' ) ): ?>
115
115
<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>
117
117
<?php
118
118
endif ;
119
119
?>
120
120
</h2>
121
121
<?php
122
122
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> ' ;
124
124
} 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> ' ;
126
126
}
127
127
?>
128
128
129
129
<?php $ wp_list_table ->views (); ?>
130
130
131
131
<form action="" method="get">
132
132
133
- <?php $ wp_list_table ->search_box ( __ ( 'Search Applications ' , 'rest_oauth2 ' ), 'rest_oauth2 ' ); ?>
133
+ <?php $ wp_list_table ->search_box ( __ ( 'Search Applications ' , 'oauth2 ' ), 'oauth2 ' ); ?>
134
134
135
135
<?php $ wp_list_table ->display (); ?>
136
136
@@ -152,22 +152,22 @@ protected static function validate_parameters( $params ) {
152
152
$ valid = [];
153
153
154
154
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 ' ) );
156
156
}
157
157
$ valid ['name ' ] = wp_filter_post_kses ( $ params ['name ' ] );
158
158
159
159
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 ' ) );
161
161
}
162
162
$ valid ['description ' ] = wp_filter_post_kses ( $ params ['description ' ] );
163
163
164
164
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 ' ) );
166
166
}
167
167
$ valid ['type ' ] = wp_filter_post_kses ( $ params ['type ' ] );
168
168
169
169
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 ' ) );
171
171
}
172
172
if ( ! empty ( $ params ['callback ' ] ) ) {
173
173
$ valid ['callback ' ] = $ params ['callback ' ];
@@ -251,7 +251,7 @@ protected static function handle_edit_submit( Client $consumer = null ) {
251
251
*/
252
252
public static function render_edit_page () {
253
253
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 ' ) );
255
255
}
256
256
257
257
// Are we editing?
@@ -262,7 +262,7 @@ public static function render_edit_page() {
262
262
$ id = absint ( $ _REQUEST ['id ' ] );
263
263
$ consumer = Client::get_by_post_id ( $ id );
264
264
if ( is_wp_error ( $ consumer ) || empty ( $ consumer ) ) {
265
- wp_die ( __ ( 'Invalid client ID. ' , 'rest_oauth2 ' ) );
265
+ wp_die ( __ ( 'Invalid client ID. ' , 'oauth2 ' ) );
266
266
}
267
267
268
268
$ form_action = self ::get_url ( [ 'action ' => 'edit ' , 'id ' => $ id ] );
@@ -277,15 +277,15 @@ public static function render_edit_page() {
277
277
if ( ! empty ( $ _GET ['did_action ' ] ) ) {
278
278
switch ( $ _GET ['did_action ' ] ) {
279
279
case 'edit ' :
280
- $ messages [] = __ ( 'Updated application. ' , 'rest_oauth2 ' );
280
+ $ messages [] = __ ( 'Updated application. ' , 'oauth2 ' );
281
281
break ;
282
282
283
283
case 'regenerate ' :
284
- $ messages [] = __ ( 'Regenerated secret. ' , 'rest_oauth2 ' );
284
+ $ messages [] = __ ( 'Regenerated secret. ' , 'oauth2 ' );
285
285
break ;
286
286
287
287
default :
288
- $ messages [] = __ ( 'Successfully created application. ' , 'rest_oauth2 ' );
288
+ $ messages [] = __ ( 'Successfully created application. ' , 'oauth2 ' );
289
289
break ;
290
290
}
291
291
}
@@ -309,7 +309,7 @@ public static function render_edit_page() {
309
309
310
310
// Header time!
311
311
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 ' );
313
313
$ parent_file = 'users.php ' ;
314
314
$ submenu_file = self ::BASE_SLUG ;
315
315
@@ -331,24 +331,24 @@ public static function render_edit_page() {
331
331
<table class="form-table">
332
332
<tr>
333
333
<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>
335
335
</th>
336
336
<td>
337
337
<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>
339
339
</td>
340
340
</tr>
341
341
<tr>
342
342
<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>
344
344
</th>
345
345
<td>
346
346
<textarea class="regular-text" name="description" id="oauth-description" cols="30" rows="5" style="width: 500px"><?php echo esc_textarea ( $ data ['description ' ] ) ?> </textarea>
347
347
</td>
348
348
</tr>
349
349
<tr>
350
350
<th scope="row">
351
- <?php echo esc_html_x ( 'Type ' , 'field name ' , 'rest_oauth2 ' ) ?>
351
+ <?php echo esc_html_x ( 'Type ' , 'field name ' , 'oauth2 ' ) ?>
352
352
</th>
353
353
<td>
354
354
<ul>
@@ -361,12 +361,12 @@ public static function render_edit_page() {
361
361
<?php checked ( 'private ' , $ data ['type ' ] ); ?>
362
362
/>
363
363
<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 ' ); ?>
365
365
</label>
366
366
<p class="description">
367
367
<?php esc_html_e (
368
368
'Clients capable of maintaining confidentiality of credentials, such as server-side applications ' ,
369
- 'rest_oauth2 '
369
+ 'oauth2 '
370
370
) ?>
371
371
</p>
372
372
</li>
@@ -379,12 +379,12 @@ public static function render_edit_page() {
379
379
<?php checked ( 'public ' , $ data ['type ' ] ); ?>
380
380
/>
381
381
<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 ' ); ?>
383
383
</label>
384
384
<p class="description">
385
385
<?php esc_html_e (
386
386
'Clients incapable of keeping credentials secret, such as browser-based applications or desktop and mobile apps ' ,
387
- 'rest_oauth2 '
387
+ 'oauth2 '
388
388
) ?>
389
389
</p>
390
390
</li>
@@ -393,11 +393,11 @@ public static function render_edit_page() {
393
393
</tr>
394
394
<tr>
395
395
<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>
397
397
</th>
398
398
<td>
399
399
<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>
401
401
</td>
402
402
</tr>
403
403
</table>
@@ -406,32 +406,32 @@ public static function render_edit_page() {
406
406
407
407
if ( empty ( $ consumer ) ) {
408
408
wp_nonce_field ( 'rest-oauth2-add ' );
409
- submit_button ( __ ( 'Create Client ' , 'rest_oauth2 ' ) );
409
+ submit_button ( __ ( 'Create Client ' , 'oauth2 ' ) );
410
410
} else {
411
411
echo '<input type="hidden" name="id" value=" ' . esc_attr ( $ consumer ->get_post_id () ) . '" /> ' ;
412
412
wp_nonce_field ( 'rest-oauth2-edit- ' . $ consumer ->get_post_id () );
413
- submit_button ( __ ( 'Save Client ' , 'rest_oauth2 ' ) );
413
+ submit_button ( __ ( 'Save Client ' , 'oauth2 ' ) );
414
414
}
415
415
416
416
?>
417
417
</form>
418
418
419
419
<?php if ( ! empty ( $ consumer ) ) : ?>
420
420
<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>
422
422
423
423
<table class="form-table">
424
424
<tr>
425
425
<th scope="row">
426
- <?php esc_html_e ( 'Client Key ' , 'rest_oauth2 ' ) ?>
426
+ <?php esc_html_e ( 'Client Key ' , 'oauth2 ' ) ?>
427
427
</th>
428
428
<td>
429
429
<code><?php echo esc_html ( $ consumer ->get_id () ) ?> </code>
430
430
</td>
431
431
</tr>
432
432
<tr>
433
433
<th scope="row">
434
- <?php esc_html_e ( 'Client Secret ' , 'rest_oauth2 ' ) ?>
434
+ <?php esc_html_e ( 'Client Secret ' , 'oauth2 ' ) ?>
435
435
</th>
436
436
<td>
437
437
<code><?php echo esc_html ( $ consumer ->get_secret () ) ?> </code>
@@ -441,7 +441,7 @@ public static function render_edit_page() {
441
441
442
442
<?php
443
443
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 ' );
445
445
?>
446
446
</form>
447
447
<?php endif ?>
@@ -463,8 +463,8 @@ public static function handle_delete() {
463
463
464
464
if ( ! current_user_can ( 'delete_post ' , $ id ) ) {
465
465
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> ' ,
468
468
403
469
469
);
470
470
}
@@ -500,8 +500,8 @@ public static function handle_approve() {
500
500
501
501
if ( ! current_user_can ( 'publish_post ' , $ id ) ) {
502
502
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> ' ,
505
505
403
506
506
);
507
507
}
@@ -533,8 +533,8 @@ public static function handle_regenerate() {
533
533
534
534
if ( ! current_user_can ( 'edit_post ' , $ id ) ) {
535
535
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> ' ,
538
538
403
539
539
);
540
540
}
0 commit comments