Skip to content

Commit

Permalink
Fix various lint errors reported by phpcs
Browse files Browse the repository at this point in the history
  • Loading branch information
spencermaxfield committed Dec 19, 2023
1 parent 5f1069a commit ad90b3b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
16 changes: 8 additions & 8 deletions class-duouniversal-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
namespace Duo\DuoUniversalWordpress;

if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
exit; // Exit if accessed directly.
}

require_once 'class-duouniversal-utilities.php';
Expand Down Expand Up @@ -147,7 +147,7 @@ function duo_settings_roles() {
$selected = $this->duo_utils->duo_get_option( 'duoup_roles', $newroles );

foreach ( $wp_roles->get_names() as $key => $role ) {
// create checkbox for each role
// create checkbox for each role.
echo ( '' .
"<input id='duoup_roles' " .
"name='duoup_roles[" . \esc_attr( $key ) . "]' " .
Expand All @@ -161,14 +161,14 @@ function duo_settings_roles() {
}

function duoup_roles_validate( $options ) {
// return empty array
// return empty array.
if ( ! is_array( $options ) || empty( $options ) || ( false === $options ) ) {
return array();
}
$wp_roles = $this->duo_utils->duo_get_roles();

$valid_roles = $wp_roles->get_names();
// otherwise validate each role and then return the array
// otherwise validate each role and then return the array.
foreach ( $options as $opt => $value ) {
if ( ! array_key_exists( $opt, $valid_roles ) ) {
unset( $options[ $opt ] );
Expand Down Expand Up @@ -219,15 +219,15 @@ function duo_add_page() {

function duo_add_site_option( $option, $value = '' ) {
// Add multisite option only if it doesn't exist already
// With WordPress versions < 3.3, calling add_site_option will override old values
// With WordPress versions < 3.3, calling add_site_option will override old values.
if ( $this->duo_utils->duo_get_option( $option ) === false ) {
\add_site_option( $option, $value );
}
}

function duoup_add_settings_field( $id, $title, $callback, $sanitize_callback ) {
\add_settings_field( $id, $title, $callback, 'duo_universal_settings', 'duo_universal_settings', array( 'label_for' => $id ) );
\register_setting( 'duo_universal_settings', $id, $sanitize_callback );
\add_settings_field( $id, $title, $callback, 'duo_universal_settings', 'duo_universal_settings', array( 'label_for' => $id ) );
\register_setting( 'duo_universal_settings', $id, $sanitize_callback );
}


Expand All @@ -247,7 +247,7 @@ function duo_admin_init() {
$this->duo_add_site_option( 'duoup_roles', $allroles );
$this->duo_add_site_option( 'duoup_xmlrpc', 'off' );
} else {
\add_settings_section( 'duo_universal_settings', 'Main Settings', array( $this, 'duo_settings_text' ), 'duo_universal_settings');
\add_settings_section( 'duo_universal_settings', 'Main Settings', array( $this, 'duo_settings_text' ), 'duo_universal_settings' );
$this->duoup_add_settings_field( 'duoup_client_id', 'Client ID', array( $this, 'duo_settings_client_id' ), array( $this, 'duoup_client_id_validate' ) );
$this->duoup_add_settings_field( 'duoup_client_secret', 'Client Secret', array( $this, 'duo_settings_client_secret' ), array( $this, 'duoup_client_secret_validate' ) );
$this->duoup_add_settings_field( 'duoup_api_host', 'API hostname', array( $this, 'duo_settings_host' ), array( $this, 'duoup_api_host_validate' ) );
Expand Down
4 changes: 2 additions & 2 deletions class-duouniversal-utilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
namespace Duo\DuoUniversalWordpress;

if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
exit; // Exit if accessed directly.
}

class DuoUniversal_Utilities {
Expand All @@ -33,7 +33,7 @@ function duo_get_roles() {
function duo_auth_enabled() {
if ( $this->xmlrpc_enabled() ) {
$this->duo_debug_log( 'Found an XMLRPC request. XMLRPC is allowed for this site. Skipping second factor' );
return false; // allows the XML-RPC protocol for remote publishing
return false; // allows the XML-RPC protocol for remote publishing.
}

if ( $this->duo_get_option( 'duoup_client_id', '' ) === '' || $this->duo_get_option( 'duoup_client_secret', '' ) === ''
Expand Down
5 changes: 3 additions & 2 deletions class-duouniversal-wordpressplugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
* @package Duo Universal
* @since 1.0.0
*/

namespace Duo\DuoUniversalWordpress;

if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
exit; // Exit if accessed directly.
}

require_once 'class-duouniversal-settings.php';
Expand Down Expand Up @@ -235,7 +236,7 @@ function duo_authenticate_user( $user = '', $username = '', $password = '' ) {
$this->update_user_auth_status( $user->user_login, 'in-progress' );
try {
// logging out clears cookies and transients so it should be done _before_ updating
// the auth status
// the auth status.
\wp_logout();
$this->duo_start_second_factor( $user );
} catch ( \Duo\DuoUniversal\DuoException $e ) {
Expand Down
2 changes: 1 addition & 1 deletion duouniversal-wordpress.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/

if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
exit; // Exit if accessed directly.
}

require_once 'class-duouniversal-settings.php';
Expand Down

0 comments on commit ad90b3b

Please sign in to comment.