Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['7.4', '8.0', '8.1', '8.2', '8.3']
php: ['8.0', '8.1', '8.2', '8.3']
wp: ['6.5', '6.6', '6.7', '6.8', '6.9']

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7

- name: Install SVN
run: sudo apt-get update -q && sudo apt-get install -y subversion
Expand All @@ -44,7 +44,7 @@ jobs:
coverage: none

- name: Cache Composer packages
uses: actions/cache@v4
uses: actions/cache@v6
with:
path: vendor
key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('composer.json') }}
Expand All @@ -67,7 +67,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7

- name: Set up PHP
uses: shivammathur/setup-php@v2
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
## https://docs.npmjs.com/misc/faq#should-i-check-my-node_modules-folder-into-git
node_modules

# Composer-generated lock file
composer.lock

# Book build output
_book

Expand Down
2 changes: 1 addition & 1 deletion .phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
<config name="minimum_supported_wp_version" value="6.5"/>
<rule ref="WordPress">
<exclude name="Generic.Commenting" />
<exclude name="Generic.Arrays.DisallowShortArraySyntax" />
<exclude name="Squiz.Commenting" />
<exclude name="Universal.Arrays.DisallowShortArraySyntax" />
<exclude name="WordPress.DateTime.RestrictedFunctions.date_date" />
<exclude name="WordPress.NamingConventions.ValidHookName.UseUnderscores" />
<exclude name="WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_decode" />
Expand Down
10 changes: 3 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,17 @@
"php": ">=7.4"
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.3.1",
"wp-coding-standards/wpcs": "^2.1.1",
"squizlabs/php_codesniffer": "^3.13.1",
"wp-coding-standards/wpcs": "^3.4.1",
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
"phpcompatibility/phpcompatibility-wp": "^2.0",
"phpunit/phpunit": "^9.6",
"yoast/phpunit-polyfills": "^1.1 || ^2.0"
"yoast/phpunit-polyfills": "^2.0"
},
"config": {
"allow-plugins": {
"composer/installers": true,
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"scripts": {
"post-install-cmd": "\"vendor/bin/phpcs\" --config-set installed_paths vendor/wp-coding-standards/wpcs",
"post-update-cmd" : "\"vendor/bin/phpcs\" --config-set installed_paths vendor/wp-coding-standards/wpcs"
}
}
2 changes: 1 addition & 1 deletion inc/admin/namespace.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function register() {
/**
* Include anything we need that relies on admin classes/functions
*/
include_once dirname( __FILE__ ) . '/class-listtable.php';
include_once __DIR__ . '/class-listtable.php';

$hook = add_users_page(
__( 'Registered OAuth Applications', 'oauth2' ),
Expand Down
8 changes: 4 additions & 4 deletions inc/tokens/class-access-token.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ public function get_creation_time() {
* This is used to store additional information on the token itself, such
* as a description for the token.
*
* @param string $key Meta key to fetch.
* @param mixed $default Value to return if key is unavailable.
* @param string $key Meta key to fetch.
* @param mixed $default_value Value to return if key is unavailable.
*
* @return mixed Value if available, or value of `$default` if not found.
* @return mixed Value if available, or value of `$default_value` if not found.
*/
public function get_meta( $key, $default = null ) {
public function get_meta( $key, $default_value = null ) {
if ( empty( $this->value['meta'] ) || ! isset( $this->value['meta'][ $key ] ) ) {
return null;
}
Expand Down
3 changes: 1 addition & 2 deletions inc/tokens/class-authorization-code.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,9 @@ public function get_expiration() {
/**
* Validate the code for use.
*
* @param array $args Other request arguments to validate.
* @return bool|WP_Error True if valid, error describing problem otherwise.
*/
public function validate( $args = [] ) {
public function validate() {
$expiration = $this->get_expiration();
$now = time();
if ( $expiration <= $now ) {
Expand Down
12 changes: 5 additions & 7 deletions inc/types/class-base.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,11 @@ protected function validate_redirect_uri( Client $client, $redirect_uri = null )
}

$redirect_uri = $registered[0];
} else {
if ( ! $client->check_redirect_uri( $redirect_uri ) ) {
return new WP_Error(
'oauth2.types.authorization_code.handle_authorisation.invalid_redirect_uri',
__( 'Specified redirect URI is not valid for this client.', 'oauth2' )
);
}
} elseif ( ! $client->check_redirect_uri( $redirect_uri ) ) {
return new WP_Error(
'oauth2.types.authorization_code.handle_authorisation.invalid_redirect_uri',
__( 'Specified redirect URI is not valid for this client.', 'oauth2' )
);
}

return $redirect_uri;
Expand Down
1 change: 0 additions & 1 deletion inc/types/class-implicit.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,4 @@ protected function handle_authorization_submission( $submit, Client $client, $da
wp_safe_redirect( $generated_redirect );
exit;
}

}