Currently we have some license issues. We are working on it.

Verified Commit 806e3222 authored by noplanman's avatar noplanman
Browse files

Clean up code to adhere to WordPress Code Sniffer standards.

parent dac290ac
......@@ -91,8 +91,7 @@ class Wp_Otp_Admin {
'type' => 'success',
'messages' => [
'<strong>' . __( 'WP-OTP configured successfully!', 'wp-otp' ) . '</strong>',
__( 'If you change your phone or do not have access to the OTP Authenticator app you can use the following codes as One Time Passwords on your login screen and then reconfigure WP-OTP.',
'wp-otp' ),
__( 'If you change your phone or do not have access to the OTP Authenticator app you can use the following codes as One Time Passwords on your login screen and then reconfigure WP-OTP.', 'wp-otp' ),
'<br>' . __( 'Keep these codes secret!', 'wp-otp' ),
implode( '<br>', array_keys( $otp_recovery_codes ) ),
],
......@@ -269,9 +268,18 @@ class Wp_Otp_Admin {
];
$app_providers = [
'f_droid' => [ 'name' => 'F-Droid', 'uri_logo' => plugins_url( 'images/f-droid.png', __FILE__ ), ],
'play_store' => [ 'name' => 'Play Store', 'uri_logo' => plugins_url( 'images/play-store.png', __FILE__ ), ],
'app_store' => [ 'name' => 'App Store', 'uri_logo' => plugins_url( 'images/app-store.png', __FILE__ ), ],
'f_droid' => [
'name' => 'F-Droid',
'uri_logo' => plugins_url( 'images/f-droid.png', __FILE__ ),
],
'play_store' => [
'name' => 'Play Store',
'uri_logo' => plugins_url( 'images/play-store.png', __FILE__ ),
],
'app_store' => [
'name' => 'App Store',
'uri_logo' => plugins_url( 'images/app-store.png', __FILE__ ),
],
];
include __DIR__ . '/partials/wp-otp-profile-display.php';
......@@ -349,7 +357,8 @@ class Wp_Otp_Admin {
}
}
if ( $notice = $user_meta_data->get( 'notice' ) ) {
$notice = $user_meta_data->get( 'notice' );
if ( $notice ) {
$this->show_user_notification(
(array) $notice['messages'],
$notice['type']
......
<?php // Silence is golden
\ No newline at end of file
<?php // Silence is golden
<?php // Silence is golden
\ No newline at end of file
<?php // Silence is golden
......@@ -12,7 +12,7 @@
<tr>
<th scope="row">
<?php echo __( 'OTP Secret', 'wp-otp' ) . ':<br>' . implode( ' ', str_split( $secret, 4 ) ) . '<br><br>'; ?>
<?php if ( $otp_enabled ): ?>
<?php if ( $otp_enabled ) : ?>
<?php
printf(
'<em>%1$s</em><br><a href="%2$s" class="button button-small wp-otp-link-reconfigure">%3$s</a>',
......@@ -35,9 +35,8 @@
);
?>
</div>
<?php else: ?>
<em><?php _e( 'To activate WP-OTP, enter the One Time Password from your authenticator app and save your profile.',
'wp-otp' ); ?></em><br><br>
<?php else : ?>
<em><?php _e( 'To activate WP-OTP, enter the One Time Password from your authenticator app and save your profile.', 'wp-otp' ); ?></em><br><br>
<label for="wp_otp_code"><?php _e( 'One Time Password', 'wp-otp' ); ?></label><br>
<input type="text" size="25" name="wp_otp_code" id="wp_otp_code"/>
<?php endif; ?>
......@@ -47,20 +46,19 @@
</td>
<td>
<span class="description">
<?php _e( 'Download any OTP Authenticator app on your smart phone and scan the QR Code to activate WP-OTP.',
'wp-otp' ); ?>
<?php _e( 'Download any OTP Authenticator app on your smart phone and scan the QR Code to activate WP-OTP.', 'wp-otp' ); ?>
</span><br><br>
<?php foreach ( $otp_apps as $otp_app ): ?>
<?php foreach ( $otp_apps as $otp_app ) : ?>
<span class="wp-otp-app-box">
<?php $app_name = esc_attr( $otp_app['name'] ); ?>
<strong><?php echo $otp_app['name']; ?></strong><br>
<a href="<?php echo $otp_app['uri']; ?>" target="_blank">
<img src="<?php echo $otp_app['uri_logo']; ?>"
alt="<?php echo $app_name; ?>"
title="<?php echo $app_name; ?>"
alt="<?php echo $app_name; ?>"
title="<?php echo $app_name; ?>"
/></a>&nbsp;
<?php foreach ( $app_providers as $app_provider_key => $app_provider ): ?>
<?php foreach ( $app_providers as $app_provider_key => $app_provider ) : ?>
<?php
$get_it_on_text = sprintf(
esc_attr__( 'Get it on %s', 'wp-otp' ),
......@@ -69,8 +67,8 @@
?>
<a href="<?php echo $otp_app[ 'uri_' . $app_provider_key ]; ?>" target="_blank">
<img src="<?php echo $app_provider['uri_logo']; ?>"
alt="<?php echo $get_it_on_text; ?>"
title="<?php echo $get_it_on_text; ?>"
alt="<?php echo $get_it_on_text; ?>"
title="<?php echo $get_it_on_text; ?>"
/></a>&nbsp;
<?php endforeach; ?>
</span>
......
......@@ -35,5 +35,15 @@
"php": "^5.5|^7.0",
"_dummy_wp": "@dev",
"spomky-labs/otphp": "^8.3"
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.3",
"wp-coding-standards/wpcs": "^1.0",
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.4"
},
"scripts": {
"check-code": [
"vendor/bin/phpcs --standard=phpcs.xml"
]
}
}
......@@ -19,7 +19,7 @@ namespace Wp_Otp;
*
* @since 0.1.0
*/
class Wp_Otp_i18n {
class Wp_Otp_I18n {
/**
* Load the plugin text domain for translation.
*
......
......@@ -86,7 +86,7 @@ class Wp_Otp {
* @access private
*/
private function set_locale() {
$plugin_i18n = new Wp_Otp_i18n();
$plugin_i18n = new Wp_Otp_I18n();
$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
}
......
<?php // Silence is golden
\ No newline at end of file
<?php // Silence is golden
<?php // Silence is golden
\ No newline at end of file
<?php // Silence is golden
<?xml version="1.0"?>
<ruleset name="WordPress Coding Standards">
<arg value="snp"/>
<arg name="extensions" value="php"/>
<arg name="encoding" value="utf-8"/>
<arg name="report-width" value="150"/>
<file>.</file>
<!-- Exclude Composer vendor directory. -->
<exclude-pattern>*/vendor/*</exclude-pattern>
<rule ref="WordPress-Core"/>
</ruleset>
<?php // Silence is golden
\ No newline at end of file
<?php // Silence is golden
<?php
/**
* Plugin Name: WP-OTP
* Plugin URI: https://wordpress.org/plugins/wp-otp/
* Description: WP-OTP adds 2 Factor Authentication using TOTP or HOTP. (Based on "WP Secure Login" by Brijesh Kothari)
* Version: 0.1.4
* Author: Armando Lüscher
* Author URI: https://noplanman.ch
* License: GPL-3.0+
* Text Domain: wp-otp
* License URI: https://www.gnu.org/licenses/gpl-3.0.txt
* Domain Path: /languages
* GitHub Plugin URI: noplanman/wp-otp
* GitHub Branch: master
*
* @package Wp_Otp
* @since 0.1.0
*/
namespace Wp_Otp;
defined( 'WPINC' ) || exit;
// Define constants.
define( 'WP_OTP_SLUG', 'wp-otp' );
define( 'WP_OTP_VERSION', '0.1.4' );
require_once __DIR__ . '/vendor/autoload.php';
require_once __DIR__ . '/includes/class-wp-otp.php';
register_activation_hook( __FILE__, [ 'Wp_Otp\\Wp_Otp_Setup', 'activate' ] );
register_deactivation_hook( __FILE__, [ 'Wp_Otp\\Wp_Otp_Setup', 'deactivate' ] );
( new Wp_Otp() )->run();
<?php
/**
* Plugin Name: WP-OTP
* Plugin URI: https://wordpress.org/plugins/wp-otp/
* Description: WP-OTP adds 2 Factor Authentication using TOTP. (Based on "WP Secure Login" by Brijesh Kothari)
* Version: 0.1.4
* Author: Armando Lüscher
* Author URI: https://noplanman.ch
* License: GPL-3.0+
* License URI: https://www.gnu.org/licenses/gpl-3.0.txt
* Text Domain: wp-otp
* Domain Path: /languages
* GitHub Plugin URI: noplanman/wp-otp
* GitHub Branch: master
*
* @package Wp_Otp
* @since 0.1.0
*/
namespace Wp_Otp;
defined( 'WPINC' ) || exit;
// Define constants.
define( 'WP_OTP_SLUG', 'wp-otp' );
define( 'WP_OTP_VERSION', '0.1.4' );
require_once __DIR__ . '/vendor/autoload.php';
require_once __DIR__ . '/includes/class-wp-otp.php';
register_activation_hook( __FILE__, [ 'Wp_Otp\\Wp_Otp_Setup', 'activate' ] );
register_deactivation_hook( __FILE__, [ 'Wp_Otp\\Wp_Otp_Setup', 'deactivate' ] );
( new Wp_Otp() )->run();
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment