PluginProbe
DoLogin Security / trunk
DoLogin Security vtrunk
5.0.10 4.8.3 trunk 1.0 1.1 1.1.1 1.2 1.2.1 1.2.2 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.5 1.6 All 64 releases
dologin / dologin.php

dologin.php in DoLogin Security trunk, at dologin.php

91 lines 3.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Plugin Name: DoLogin Security
5 * Description: Login security: KeyLockr SSO scan login, 2FA, passwordless login, Cloudflare Turnstile, GeoLocation/IP limits, whitelist and blacklist. WooCommerce and WP-CLI supported.
6 * Version: 5.0.10
7 * Requires at least: 4.4
8 * Requires PHP: 5.6
9 * Author: WPDO
10 * License: GPLv3
11 * License URI: http://www.gnu.org/licenses/gpl.html
12 * Text Domain: dologin
13 * Domain Path: /lang
14 *
15 * Copyright (C) 2025-2026 WPDO
16 *
17 * This program is free software: you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by
19 * the Free Software Foundation, either version 3 of the License, or
20 * (at your option) any later version.
21 *
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 *
27 * You should have received a copy of the GNU General Public License
28 * along with this program. If not, see <http://www.gnu.org/licenses/>.
29
30 */
31 defined('WPINC') || exit;
32
33 if (defined('DOLOGIN_V')) {
34 return;
35 }
36
37 define('DOLOGIN_V', '5.0.10');
38
39 !defined('DOLOGIN_DIR') && define('DOLOGIN_DIR', __DIR__ . '/'); // Full absolute path '/usr/local/***/wp-content/plugins/dologin/' or MU
40 !defined('DOLOGIN_PLUGIN_URL') && define('DOLOGIN_PLUGIN_URL', plugin_dir_url(__FILE__)); // Full URL path '//example.com/wp-content/plugins/dologin/'
41
42 !defined('DOLOGIN_LOGO') && define('DOLOGIN_LOGO', '<img src="' . DOLOGIN_PLUGIN_URL . 'assets/shield.svg" class="dologin-logo" style="max-width:50px;max-height:37px;"> ');
43
44 require_once DOLOGIN_DIR . 'autoload.php';
45
46 // Define CLI
47 if ((defined('WP_CLI') && WP_CLI) || PHP_SAPI == 'cli') {
48 !defined('DOLOGIN_CLI') && define('DOLOGIN_CLI', true);
49
50 // Register CLI cmd
51 if (method_exists('WP_CLI', 'add_command')) {
52 WP_CLI::add_command('dologin', 'dologin\CLI');
53 }
54 }
55
56 /**
57 * API for external plugin usage
58 * @since 1.4.1
59 */
60 if (!function_exists('dologin_gen_link')) {
61 function dologin_gen_link($src, $uid = false)
62 {
63 if (!$uid) {
64 $user = wp_get_current_user();
65 } else {
66 $user = get_user_by('id', (int) $uid);
67 }
68 if (!$user) {
69 return false;
70 }
71
72 $uid = $user->ID;
73 $src .= '-' . $user->display_name;
74
75 return \dologin\Pswdless::cls()->gen_link($src, $uid, true);
76 }
77 }
78
79 // Declare WooCommerce HPOS (High-Performance Order Storage) compatibility. This plugin only hooks the login form and never touches order data, so it is fully compatible.
80 add_action('before_woocommerce_init', function () {
81 if (class_exists('\Automattic\WooCommerce\Utilities\FeaturesUtil')) {
82 \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility('custom_order_tables', __FILE__, true);
83 }
84 });
85
86 if ( did_action( 'plugins_loaded' ) ) {
87 \dologin\Core::cls();
88 } else {
89 add_action( 'plugins_loaded', array( '\dologin\Core', 'cls' ), 0 );
90 }
91