Skip to content

Commit

Permalink
Change text domain to openid-connect-server
Browse files Browse the repository at this point in the history
  • Loading branch information
psrpinto committed May 30, 2023
1 parent d886725 commit 07be3c3
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 38 deletions.
2 changes: 1 addition & 1 deletion openid-connect-server.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* Author URI: https://wordpress.org/
* License: GPL v2
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: wp-openid-connect-server
* Text Domain: openid-connect-server
*/

use OpenIDConnectServer\OpenIDConnectServer;
Expand Down
18 changes: 9 additions & 9 deletions src/Http/Handlers/AuthenticateHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function handle( Request $request, Response $response ): Response {

$has_permission = current_user_can( apply_filters( 'oidc_minimal_capability', OIDC_DEFAULT_MINIMAL_CAPABILITY ) );
if ( ! $has_permission ) {
login_header( 'OIDC Connect', null, new \WP_Error( 'OIDC_NO_PERMISSION', __( "You don't have permission to use OpenID Connect.", 'wp-openid-connect-server' ) ) );
login_header( 'OIDC Connect', null, new \WP_Error( 'OIDC_NO_PERMISSION', __( "You don't have permission to use OpenID Connect.", 'openid-connect-server' ) ) );
$this->render_no_permission_screen( $data );
} else {
login_header( 'OIDC Connect' );
Expand All @@ -69,20 +69,20 @@ private function render_no_permission_screen( $data ) {
echo esc_html(
sprintf(
// translators: %s is a username.
__( 'Hi %s!', 'wp-openid-connect-server' ),
__( 'Hi %s!', 'openid-connect-server' ),
$data['user']->user_nicename
)
);
?>
</h2>
<br/>
<p><?php esc_html_e( "You don't have permission to use OpenID Connect.", 'wp-openid-connect-server' ); ?></p>
<p><?php esc_html_e( "You don't have permission to use OpenID Connect.", 'openid-connect-server' ); ?></p>
<br/>
<p><?php esc_html_e( 'Contact your administrator for more details.', 'wp-openid-connect-server' ); ?></p>
<p><?php esc_html_e( 'Contact your administrator for more details.', 'openid-connect-server' ); ?></p>
<br/>
<p class="submit">
<a class="button button-large" href="<?php echo esc_url( $data['cancel_url'] ); ?>" target="_top">
<?php esc_html_e( 'Cancel', 'wp-openid-connect-server' ); ?>
<?php esc_html_e( 'Cancel', 'openid-connect-server' ); ?>
</a>
</p>
</form>
Expand All @@ -101,7 +101,7 @@ private function render_consent_screen( $data ) {
echo esc_html(
sprintf(
// translators: %s is a username.
__( 'Hi %s!', 'wp-openid-connect-server' ),
__( 'Hi %s!', 'openid-connect-server' ),
$data['user']->user_nicename
)
);
Expand All @@ -114,7 +114,7 @@ private function render_consent_screen( $data ) {
echo wp_kses(
sprintf(
// translators: %1$s is the site name, %2$s is the username.
__( 'Do you want to log in to <em>%1$s</em> with your <em>%2$s</em> account?', 'wp-openid-connect-server' ),
__( 'Do you want to log in to <em>%1$s</em> with your <em>%2$s</em> account?', 'openid-connect-server' ),
$data['client_name'],
get_bloginfo( 'name' )
),
Expand All @@ -131,9 +131,9 @@ private function render_consent_screen( $data ) {
<input type="hidden" name="<?php echo esc_attr( $key ); ?>" value="<?php echo esc_attr( $value ); ?>"/>
<?php endforeach; ?>
<p class="submit">
<input type="submit" name="authorize" class="button button-primary button-large" value="<?php esc_attr_e( 'Authorize', 'wp-openid-connect-server' ); ?>"/>
<input type="submit" name="authorize" class="button button-primary button-large" value="<?php esc_attr_e( 'Authorize', 'openid-connect-server' ); ?>"/>
<a href="<?php echo esc_url( $data['cancel_url'] ); ?>" target="_top">
<?php esc_html_e( 'Cancel', 'wp-openid-connect-server' ); ?>
<?php esc_html_e( 'Cancel', 'openid-connect-server' ); ?>
</a>
</p>
</form>
Expand Down
56 changes: 28 additions & 28 deletions src/SiteStatusTests.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ public function __construct() {

public function register_site_status_tests( $tests ): array {
$tests['direct']['oidc-public-key'] = array(
'label' => __( 'The public key is defined and in the right format', 'wp-openid-connect-server' ),
'label' => __( 'The public key is defined and in the right format', 'openid-connect-server' ),
'test' => array( $this, 'site_status_test_public_key' ),
);

$tests['direct']['oidc-private-key'] = array(
'label' => __( 'The private key is defined and in the right format', 'wp-openid-connect-server' ),
'label' => __( 'The private key is defined and in the right format', 'openid-connect-server' ),
'test' => array( $this, 'site_status_test_private_key' ),
);

$tests['direct']['oidc-clients'] = array(
'label' => __( 'One or more clients have been defined correctly', 'wp-openid-connect-server' ),
'label' => __( 'One or more clients have been defined correctly', 'openid-connect-server' ),
'test' => array( $this, 'site_status_test_clients' ),
);

Expand All @@ -28,19 +28,19 @@ public function register_site_status_tests( $tests ): array {

public function site_status_test_public_key(): array {
if ( ! defined( 'OIDC_PUBLIC_KEY' ) ) {
$label = __( 'The public key constant OIDC_PUBLIC_KEY is not defined.', 'wp-openid-connect-server' );
$label = __( 'The public key constant OIDC_PUBLIC_KEY is not defined.', 'openid-connect-server' );
$status = 'critical';
$badge = 'red';
} elseif (
0 === strpos( OIDC_PUBLIC_KEY, '-----BEGIN PUBLIC KEY-----' )
&& '-----END PUBLIC KEY-----' === substr( OIDC_PUBLIC_KEY, - strlen( '-----END PUBLIC KEY-----' ) )
&& strlen( OIDC_PUBLIC_KEY ) > 50
) {
$label = __( 'The public key is defined and in the right format', 'wp-openid-connect-server' );
$label = __( 'The public key is defined and in the right format', 'openid-connect-server' );
$status = 'good';
$badge = 'green';
} else {
$label = __( 'The public key constant OIDC_PUBLIC_KEY is malformed.', 'wp-openid-connect-server' );
$label = __( 'The public key constant OIDC_PUBLIC_KEY is malformed.', 'openid-connect-server' );
$status = 'critical';
$badge = 'red';
}
Expand All @@ -49,18 +49,18 @@ public function site_status_test_public_key(): array {
'label' => wp_kses_post( $label ),
'status' => $status,
'badge' => array(
'label' => __( 'OpenID Connect Server', 'wp-openid-connect-server' ),
'label' => __( 'OpenID Connect Server', 'openid-connect-server' ),
'color' => $badge,
),
'description' =>
'<p>' .
__( 'You need to provide RSA keys for the OpenID Connect Server to function.', 'wp-openid-connect-server' ) .
__( 'You need to provide RSA keys for the OpenID Connect Server to function.', 'openid-connect-server' ) .
' ' .
wp_kses_post(
sprintf(
// Translators: %s is a URL.
__( "Please see the <a href=%s>plugin's readme file</a> for details.", 'wp-openid-connect-server' ),
'"https://github.com/Automattic/wp-openid-connect-server/blob/trunk/README.md"'
__( "Please see the <a href=%s>plugin's readme file</a> for details.", 'openid-connect-server' ),
'"https://github.com/Automattic/openid-connect-server/blob/trunk/README.md"'
)
) .
'</p>',
Expand All @@ -70,19 +70,19 @@ public function site_status_test_public_key(): array {

public function site_status_test_private_key(): array {
if ( ! defined( 'OIDC_PRIVATE_KEY' ) ) {
$label = __( 'The private key constant OIDC_PRIVATE_KEY is not defined.', 'wp-openid-connect-server' );
$label = __( 'The private key constant OIDC_PRIVATE_KEY is not defined.', 'openid-connect-server' );
$status = 'critical';
$badge = 'red';
} elseif (
0 === strpos( OIDC_PRIVATE_KEY, '-----BEGIN RSA PRIVATE KEY-----' )
&& '-----END RSA PRIVATE KEY-----' === substr( OIDC_PRIVATE_KEY, - strlen( '-----END RSA PRIVATE KEY-----' ) )
&& strlen( OIDC_PRIVATE_KEY ) > 70
) {
$label = __( 'The private key is defined and in the right format', 'wp-openid-connect-server' );
$label = __( 'The private key is defined and in the right format', 'openid-connect-server' );
$status = 'good';
$badge = 'green';
} else {
$label = __( 'The private key constant OIDC_PRIVATE_KEY is malformed.', 'wp-openid-connect-server' );
$label = __( 'The private key constant OIDC_PRIVATE_KEY is malformed.', 'openid-connect-server' );
$status = 'critical';
$badge = 'red';
}
Expand All @@ -91,18 +91,18 @@ public function site_status_test_private_key(): array {
'label' => wp_kses_post( $label ),
'status' => $status,
'badge' => array(
'label' => __( 'OpenID Connect Server', 'wp-openid-connect-server' ),
'label' => __( 'OpenID Connect Server', 'openid-connect-server' ),
'color' => $badge,
),
'description' =>
'<p>' .
__( 'You need to provide RSA keys for the OpenID Connect Server to function.', 'wp-openid-connect-server' ) .
__( 'You need to provide RSA keys for the OpenID Connect Server to function.', 'openid-connect-server' ) .
' ' .
wp_kses_post(
sprintf(
// translators: %s is a URL.
__( "Please see the <a href=%s>plugin's readme file</a> for details.", 'wp-openid-connect-server' ),
'"https://github.com/Automattic/wp-openid-connect-server/blob/trunk/README.md"'
__( "Please see the <a href=%s>plugin's readme file</a> for details.", 'openid-connect-server' ),
'"https://github.com/Automattic/openid-connect-server/blob/trunk/README.md"'
)
) .
'</p>',
Expand All @@ -113,28 +113,28 @@ public function site_status_test_private_key(): array {
public function site_status_test_clients(): array {
$clients = apply_filters( 'oidc_registered_clients', array() );
if ( empty( $clients ) ) {
$label = __( 'No clients have been defined.', 'wp-openid-connect-server' );
$label = __( 'No clients have been defined.', 'openid-connect-server' );
$status = 'critical';
$badge = 'red';
} else {
$all_clients_ok = true;
foreach ( $clients as $client_id => $client ) {
$error = false;
if ( strlen( $client_id ) < 10 ) {
$error = __( 'The client id (array key) needs to be a random string.', 'wp-openid-connect-server' );
$error = __( 'The client id (array key) needs to be a random string.', 'openid-connect-server' );
}
if ( empty( $client['redirect_uri'] ) ) {
$error = __( 'You need to specify a redirect_uri.', 'wp-openid-connect-server' );
$error = __( 'You need to specify a redirect_uri.', 'openid-connect-server' );
}
if ( ! preg_match( '#^https://#', $client['redirect_uri'] ) ) {
$error = __( 'The redirect_uri needs to be a HTTPS URL.', 'wp-openid-connect-server' );
$error = __( 'The redirect_uri needs to be a HTTPS URL.', 'openid-connect-server' );
}
if ( empty( $client['name'] ) ) {
$error = __( 'You need to specify a name.', 'wp-openid-connect-server' );
$error = __( 'You need to specify a name.', 'openid-connect-server' );
}
if ( $error ) {
$label = sprintf( // translators: %s is a random string representing the client id.
__( 'The client %1$s seems to be malformed. %2$s', 'wp-openid-connect-server' ),
__( 'The client %1$s seems to be malformed. %2$s', 'openid-connect-server' ),
$client_id,
$error
);
Expand All @@ -147,7 +147,7 @@ public function site_status_test_clients(): array {
}

if ( $all_clients_ok ) {
$label = _n( 'The defined client seems to be in the right format', 'The defined clients seem to be in the right format', count( $clients ), 'wp-openid-connect-server' );
$label = _n( 'The defined client seems to be in the right format', 'The defined clients seem to be in the right format', count( $clients ), 'openid-connect-server' );
$status = 'good';
$badge = 'green';
}
Expand All @@ -157,18 +157,18 @@ public function site_status_test_clients(): array {
'label' => wp_kses_post( $label ),
'status' => $status,
'badge' => array(
'label' => __( 'OpenID Connect Server', 'wp-openid-connect-server' ),
'label' => __( 'OpenID Connect Server', 'openid-connect-server' ),
'color' => $badge,
),
'description' =>
'<p>' .
__( 'You need to define clients for the OpenID Connect Server to function.', 'wp-openid-connect-server' ) .
__( 'You need to define clients for the OpenID Connect Server to function.', 'openid-connect-server' ) .
' ' .
wp_kses_post(
sprintf(
// Translators: %s is a URL.
__( "Please see the <a href=%s>plugin's readme file</a> for details.", 'wp-openid-connect-server' ),
'"https://github.com/Automattic/wp-openid-connect-server/blob/trunk/README.md"'
__( "Please see the <a href=%s>plugin's readme file</a> for details.", 'openid-connect-server' ),
'"https://github.com/Automattic/openid-connect-server/blob/trunk/README.md"'
)
) .
'</p>',
Expand Down

0 comments on commit 07be3c3

Please sign in to comment.