Skip to content

Commit 02d47e5

Browse files
committed
WordPress coding standards set
1 parent 9c52b3a commit 02d47e5

20 files changed

+36
-56
lines changed

.phpcs.xml.dist

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,8 @@
2020
<!-- https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards -->
2121
<!-- https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties -->
2222
<config name="minimum_supported_wp_version" value="4.8"/>
23-
<rule ref="WordPress" />
24-
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
25-
<properties>
26-
<!-- Value: replace the function, class, and variable prefixes used. Separate multiple prefixes with a comma. -->
27-
<property name="prefixes" type="array" value="oauth2"/>
28-
</properties>
29-
</rule>
30-
<rule ref="WordPress.WP.I18n">
31-
<properties>
32-
<!-- Value: replace the text domain used. -->
33-
<property name="text_domain" type="array" value="oauth2"/>
34-
</properties>
35-
</rule>
36-
<rule ref="WordPress.WhiteSpace.ControlStructureSpacing">
37-
<properties>
38-
<property name="blank_line_check" value="true"/>
39-
</properties>
23+
<rule ref="WordPress">
24+
<exclude name="Generic.Commenting" />
25+
<exclude name="Squiz.Commenting" />
4026
</rule>
4127
</ruleset>

inc/admin/class-listtable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ protected function column_name( $item ) {
103103
];
104104

105105
$post_type_object = get_post_type_object( $item->post_type );
106-
if ( current_user_can( $post_type_object->cap->publish_posts ) && $item->post_status !== 'publish' ) {
106+
if ( current_user_can( $post_type_object->cap->publish_posts ) && 'publish' !== $item->post_status ) {
107107
$publish_link = add_query_arg(
108108
[
109109
'page' => 'rest-oauth2-apps',

inc/admin/namespace.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ function load() {
8686

8787
return;
8888
}
89-
9089
}
9190

9291
/**
@@ -342,7 +341,7 @@ function render_edit_page() {
342341
$submenu_file = BASE_SLUG;
343342
// phpcs:enable
344343

345-
include( ABSPATH . 'wp-admin/admin-header.php' );
344+
include ABSPATH . 'wp-admin/admin-header.php';
346345
?>
347346

348347
<div class="wrap">

inc/admin/profile/namespace.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function ( Access_Token $token ) {
4646
}
4747

4848
?>
49-
<h2><?php _e( 'Authorized Applications', 'oauth2' ); ?></h2>
49+
<h2><?php esc_html_e( 'Authorized Applications', 'oauth2' ); ?></h2>
5050
<?php if ( ! empty( $tokens ) ) : ?>
5151
<table class="widefat">
5252
<thead>
@@ -156,7 +156,6 @@ function render_token_row( WP_User $user, Access_Token $token ) {
156156
*/
157157
$actions = apply_filters_deprecated( 'oauth2.admin.profile.render_token_row.actions', $actions, $token, $user ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
158158

159-
160159
/**
161160
* Filter actions shown for an access token on the profile screen.
162161
*
@@ -192,7 +191,7 @@ function render_token_row( WP_User $user, Access_Token $token ) {
192191
*/
193192
function output_profile_messages() {
194193
global $pagenow;
195-
if ( $pagenow !== 'profile.php' && $pagenow !== 'user-edit.php' ) {
194+
if ( 'profile.php' !== $pagenow && 'user-edit.php' !== $pagenow ) {
196195
return;
197196
}
198197

inc/admin/profile/personaltokens/namespace.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ class="regular-text"
152152
* Handle action from a form.
153153
*/
154154
function handle_page_action( WP_User $user ) {
155-
156155
if ( ! isset( $_POST['oauth2_action'] ) ) {
157156
return new WP_Error(
158157
'rest_oauth2_invalid_action',

inc/authentication/namespace.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ function get_token_from_request() {
8484
return null;
8585
}
8686

87-
$token = $_GET['access_token']; // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
87+
$token = $_GET['access_token']; // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput
8888
if ( is_string( $token ) ) {
8989
return $token;
9090
}

inc/class-client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ public function regenerate_secret() {
276276
* Issue token for a user.
277277
*
278278
* @param \WP_User $user
279-
* @param array $meta
279+
* @param array $meta
280280
*
281281
* @return Access_Token
282282
*/

inc/class-clientinterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public function regenerate_secret();
8787
* Issue token for a user.
8888
*
8989
* @param \WP_User $user
90-
* @param array $meta
90+
* @param array $meta
9191
*
9292
* @return Access_Token
9393
*/

inc/class-personalclient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public function regenerate_secret() {
149149
* Issue token for a user.
150150
*
151151
* @param \WP_User $user
152-
* @param array $meta
152+
* @param array $meta
153153
*
154154
* @return Access_Token
155155
*/

inc/endpoints/class-token.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function register_routes() {
5252
* @return bool Whether or not the grant type is valid.
5353
*/
5454
public function validate_grant_type( $type ) {
55-
return $type === 'authorization_code';
55+
return 'authorization_code' === $type;
5656
}
5757

5858
/**

0 commit comments

Comments
 (0)