mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-07-04 02:01:18 +03:00
Apply coding standards
This commit is contained in:
parent
a71a1abd74
commit
e4deb6809a
5 changed files with 28 additions and 15 deletions
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
|
||||
namespace WordPressDotOrg\FiveForTheFuture\Auth;
|
||||
use WordPressDotOrg\FiveForTheFuture;
|
||||
use WP_Error;
|
||||
|
||||
defined( 'WPINC' ) || die();
|
||||
|
||||
|
@ -151,7 +151,7 @@ function is_valid_authentication_token( $pledge_id, $action, $unverified_token )
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks user capabilties or auth token to see if this user can edit the given pledge.
|
||||
* Checks user capabilities or auth token to see if this user can edit the given pledge.
|
||||
*
|
||||
* @param int $requested_pledge_id The pledge to edit.
|
||||
* @param string $auth_token The supplied auth token to check.
|
||||
|
@ -159,14 +159,15 @@ function is_valid_authentication_token( $pledge_id, $action, $unverified_token )
|
|||
* @return true|WP_Error
|
||||
*/
|
||||
function can_manage_pledge( $requested_pledge_id, $auth_token = '' ) {
|
||||
// A valid token superceeds other auth methods.
|
||||
// A valid token supersedes other auth methods.
|
||||
if ( true === is_valid_authentication_token( $requested_pledge_id, 'manage_pledge', $auth_token ) ) {
|
||||
return true;
|
||||
} else if ( is_user_logged_in() ) {
|
||||
if ( current_user_can( 'manage_options' ) ) {
|
||||
return true;
|
||||
}
|
||||
return new \WP_Error(
|
||||
|
||||
return new WP_Error(
|
||||
'invalid_token',
|
||||
sprintf(
|
||||
__( 'You don\'t have permissions to edit this page. <a href="%s">Request an edit link.</a>', 'wporg-5ftf' ),
|
||||
|
@ -175,7 +176,7 @@ function can_manage_pledge( $requested_pledge_id, $auth_token = '' ) {
|
|||
);
|
||||
}
|
||||
|
||||
return new \WP_Error(
|
||||
return new WP_Error(
|
||||
'invalid_token',
|
||||
sprintf(
|
||||
__( 'Your link has expired, please <a href="%s">obtain a new one.</a>', 'wporg-5ftf' ),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue