Skip to content

Commit 7e791ea

Browse files
authored
Merge pull request #24 from tfrommen/textdomain
Unify text domains.
2 parents 5503faf + e020e06 commit 7e791ea

File tree

5 files changed

+55
-54
lines changed

5 files changed

+55
-54
lines changed

inc/admin/class-admin.php

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -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&#8217; uh?', 'rest_oauth2' ) . '</h1>' .
467-
'<p>' . __( 'You are not allowed to delete this application.', 'rest_oauth2' ) . '</p>',
466+
'<h1>' . __( 'Cheatin&#8217; 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&#8217; uh?', 'rest_oauth2' ) . '</h1>' .
504-
'<p>' . __( 'You are not allowed to approve this application.', 'rest_oauth2' ) . '</p>',
503+
'<h1>' . __( 'Cheatin&#8217; 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&#8217; uh?', 'rest_oauth2' ) . '</h1>' .
537-
'<p>' . __( 'You are not allowed to edit this application.', 'rest_oauth2' ) . '</p>',
536+
'<h1>' . __( 'Cheatin&#8217; uh?', 'oauth2' ) . '</h1>' .
537+
'<p>' . __( 'You are not allowed to edit this application.', 'oauth2' ) . '</p>',
538538
403
539539
);
540540
}

inc/admin/class-listtable.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ public function prepare_items() {
4949
public function get_columns() {
5050
$c = [
5151
'cb' => '<input type="checkbox" />',
52-
'name' => __( 'Name', 'rest_oauth2' ),
53-
'description' => __( 'Description', 'rest_oauth2' ),
52+
'name' => __( 'Name', 'oauth2' ),
53+
'description' => __( 'Description', 'oauth2' ),
5454
];
5555

5656
return $c;
@@ -62,7 +62,7 @@ public function get_columns() {
6262
public function column_cb( $item ) {
6363
?>
6464
<label class="screen-reader-text"
65-
for="cb-select-<?php echo esc_attr( $item->ID ) ?>"><?php esc_html_e( 'Select consumer', 'rest_oauth2' ); ?></label>
65+
for="cb-select-<?php echo esc_attr( $item->ID ) ?>"><?php esc_html_e( 'Select consumer', 'oauth2' ); ?></label>
6666

6767
<input id="cb-select-<?php echo esc_attr( $item->ID ) ?>" type="checkbox"
6868
name="consumers[]" value="<?php echo esc_attr( $item->ID ) ?>"/>
@@ -77,7 +77,7 @@ public function column_cb( $item ) {
7777
protected function column_name( $item ) {
7878
$title = get_the_title( $item->ID );
7979
if ( empty( $title ) ) {
80-
$title = '<em>' . esc_html__( 'Untitled', 'rest_oauth2' ) . '</em>';
80+
$title = '<em>' . esc_html__( 'Untitled', 'oauth2' ) . '</em>';
8181
}
8282

8383
$edit_link = add_query_arg(
@@ -99,8 +99,8 @@ protected function column_name( $item ) {
9999
$delete_link = wp_nonce_url( $delete_link, 'rest-oauth2-delete:' . $item->ID );
100100

101101
$actions = [
102-
'edit' => sprintf( '<a href="%s">%s</a>', esc_url( $edit_link ), esc_html__( 'Edit', 'rest_oauth2' ) ),
103-
'delete' => sprintf( '<a href="%s">%s</a>', esc_url( $delete_link ), esc_html__( 'Delete', 'rest_oauth2' ) ),
102+
'edit' => sprintf( '<a href="%s">%s</a>', esc_url( $edit_link ), esc_html__( 'Edit', 'oauth2' ) ),
103+
'delete' => sprintf( '<a href="%s">%s</a>', esc_url( $delete_link ), esc_html__( 'Delete', 'oauth2' ) ),
104104
];
105105

106106
$post_type_object = get_post_type_object( $item->post_type );
@@ -117,7 +117,7 @@ protected function column_name( $item ) {
117117
$actions['app-approve'] = sprintf(
118118
'<a href="%s">%s</a>',
119119
esc_url( $publish_link ),
120-
esc_html__( 'Approve', 'rest_oauth2' )
120+
esc_html__( 'Approve', 'oauth2' )
121121
);
122122
}
123123

inc/admin/profile/namespace.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ function render_profile_section( WP_User $user ) {
2929
<table class="form-table">
3030
<tbody>
3131
<tr>
32-
<th scope="row"><?php _e( 'Authorized Applications', 'rest_oauth1' ) ?></th>
32+
<th scope="row"><?php _e( 'Authorized Applications', 'oauth2' ) ?></th>
3333
<td>
3434
<?php if ( ! empty( $tokens ) ): ?>
3535
<table class="widefat">
3636
<thead>
3737
<tr>
38-
<th style="padding-left:10px;"><?php esc_html_e( 'Application Name', 'rest_oauth1' ); ?></th>
38+
<th style="padding-left:10px;"><?php esc_html_e( 'Application Name', 'oauth2' ); ?></th>
3939
<th></th>
4040
</tr>
4141
</thead>
@@ -47,14 +47,14 @@ function render_profile_section( WP_User $user ) {
4747
?>
4848
<tr>
4949
<td><?php echo $client->get_name() ?></td>
50-
<td><button class="button" name="oauth2_revoke" value="<?php echo esc_attr( $token->get_key() ) ?>"><?php esc_html_e( 'Revoke', 'rest_oauth1' ) ?></button>
50+
<td><button class="button" name="oauth2_revoke" value="<?php echo esc_attr( $token->get_key() ) ?>"><?php esc_html_e( 'Revoke', 'oauth2' ) ?></button>
5151
</tr>
5252

5353
<?php endforeach ?>
5454
</tbody>
5555
</table>
5656
<?php else: ?>
57-
<p class="description"><?php esc_html_e( 'No applications authorized.', 'rest_oauth1' ) ?></p>
57+
<p class="description"><?php esc_html_e( 'No applications authorized.', 'oauth2' ) ?></p>
5858
<?php endif ?>
5959
</td>
6060
</tr>

plugin.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* Version: 0.1.0
66
* Author: WordPress Core Contributors (REST API Focus)
77
* Author URI: https://make.wordpress.org/core/
8+
* Text Domain: oauth2
89
*/
910

1011
namespace WP\OAuth2;

theme/oauth2-authorize.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@
5555

5656
</style>
5757

58-
<form name="oauth1_authorize_form" id="oauth1_authorize_form" action="<?php echo esc_url( $url ); ?>" method="post">
58+
<form name="oauth2_authorize_form" id="oauth2_authorize_form" action="<?php echo esc_url( $url ); ?>" method="post">
5959

60-
<h2 class="login-title"><?php echo esc_html( sprintf( __('Connect %1$s'), $client->get_name() ) ) ?></h2>
60+
<h2 class="login-title"><?php echo esc_html( sprintf( __( 'Connect %1$s', 'oauth2' ), $client->get_name() ) ) ?></h2>
6161

6262
<div class="login-info">
6363

@@ -90,10 +90,10 @@
9090
</form>
9191

9292
<p id="nav">
93-
<a href="<?php echo esc_url( wp_login_url( $url, true ) ); ?>"><?php _e( 'Switch user' ) ?></a>
93+
<a href="<?php echo esc_url( wp_login_url( $url, true ) ); ?>"><?php _e( 'Switch user', 'oauth2' ) ?></a>
9494
<?php
9595
if ( get_option( 'users_can_register' ) ) :
96-
$registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) );
96+
$registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register', 'oauth2' ) );
9797
/**
9898
* Filter the registration URL below the login form.
9999
*

0 commit comments

Comments
 (0)