2022-10-08 02:41:03 +00:00
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
Plugin Name: WP-WebAuthn
|
|
|
|
Plugin URI: https://flyhigher.top
|
|
|
|
Description: WP-WebAuthn allows you to safely login to your WordPress site without password.
|
2024-10-09 12:44:38 +00:00
|
|
|
Version: 1.3.4
|
2022-10-08 02:41:03 +00:00
|
|
|
Author: Axton
|
|
|
|
Author URI: https://axton.cc
|
|
|
|
License: GPLv3
|
|
|
|
Text Domain: wp-webauthn
|
|
|
|
Domain Path: /languages
|
|
|
|
*/
|
|
|
|
/* Copyright 2020 Axton
|
|
|
|
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version of the License, or (at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
register_activation_hook(__FILE__, 'wwa_init');
|
|
|
|
|
|
|
|
function wwa_init(){
|
2024-10-09 12:44:38 +00:00
|
|
|
if(version_compare(get_bloginfo('version'), '5.0', '<')){
|
2022-10-08 02:41:03 +00:00
|
|
|
deactivate_plugins(basename(__FILE__)); //disable
|
|
|
|
}else{
|
|
|
|
wwa_init_data();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
wwa_init_data();
|
|
|
|
|
|
|
|
function wwa_init_data(){
|
|
|
|
if(!get_option('wwa_init')){
|
|
|
|
// Init
|
2024-10-09 12:44:38 +00:00
|
|
|
$site_domain = wp_parse_url(site_url(), PHP_URL_HOST);
|
2022-10-08 02:41:03 +00:00
|
|
|
$wwa_init_options = array(
|
2023-10-22 22:21:36 +00:00
|
|
|
'user_credentials' => '{}',
|
|
|
|
'user_credentials_meta' => '{}',
|
2022-10-08 02:41:03 +00:00
|
|
|
'user_id' => array(),
|
|
|
|
'first_choice' => 'true',
|
|
|
|
'website_name' => get_bloginfo('name'),
|
|
|
|
'website_domain' => $site_domain === NULL ? "" : $site_domain,
|
|
|
|
'remember_me' => 'false',
|
2023-10-22 22:21:36 +00:00
|
|
|
'email_login' => 'false',
|
2022-10-08 02:41:03 +00:00
|
|
|
'user_verification' => 'false',
|
|
|
|
'usernameless_login' => 'false',
|
|
|
|
'allow_authenticator_type' => 'none',
|
2023-10-22 22:21:36 +00:00
|
|
|
'password_reset' => 'off',
|
|
|
|
'after_user_registration' => 'none',
|
2022-10-08 02:41:03 +00:00
|
|
|
'logging' => 'false'
|
|
|
|
);
|
|
|
|
update_option('wwa_options', $wwa_init_options);
|
|
|
|
include('wwa-version.php');
|
|
|
|
update_option('wwa_version', $wwa_version);
|
|
|
|
update_option('wwa_log', array());
|
2024-10-09 12:44:38 +00:00
|
|
|
update_option('wwa_init', md5(date('Y-m-d H:i:s'))); // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
|
2022-10-08 02:41:03 +00:00
|
|
|
}else{
|
|
|
|
include('wwa-version.php');
|
|
|
|
if(!get_option('wwa_version') || get_option('wwa_version')['version'] != $wwa_version['version']){
|
|
|
|
update_option('wwa_version', $wwa_version); //update version
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Wrap WP-WebAuthn settings
|
|
|
|
function wwa_get_option($option_name){
|
2023-10-22 22:21:36 +00:00
|
|
|
$val = get_option('wwa_options');
|
2022-10-08 02:41:03 +00:00
|
|
|
if(isset($val[$option_name])){
|
|
|
|
return $val[$option_name];
|
|
|
|
}else{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function wwa_update_option($option_name, $option_value){
|
2023-10-22 22:21:36 +00:00
|
|
|
$options = get_option('wwa_options');
|
2022-10-08 02:41:03 +00:00
|
|
|
$options[$option_name] = $option_value;
|
|
|
|
update_option('wwa_options',$options);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
include('wwa-menus.php');
|
|
|
|
include('wwa-functions.php');
|
|
|
|
include('wwa-ajax.php');
|
|
|
|
include('wwa-shortcodes.php');
|