wp-2fa
Last commit date
dist
4 years ago
includes
4 years ago
languages
4 years ago
vendor
4 years ago
index.php
5 years ago
readme.txt
4 years ago
wp-2fa.php
4 years ago
wp-2fa.php
71 lines
| 1 | <?php // phpcs:ignore |
| 2 | /** |
| 3 | * Plugin Name: WP 2FA - Two-factor authentication for WordPress |
| 4 | * Plugin URI: https://wp2fa.io |
| 5 | * Description: Easily add an additional layer of security to your WordPress login pages. Enable Two-Factor Authentication for you and all your website users with this easy to use plugin. |
| 6 | * Version: 2.0.0 |
| 7 | * Author: WP White Security |
| 8 | * Author URI: https://www.wpwhitesecurity.com |
| 9 | * Text Domain: wp-2fa |
| 10 | * Domain Path: /languages |
| 11 | * Network: true |
| 12 | * |
| 13 | * @package WP2FA |
| 14 | */ |
| 15 | |
| 16 | if ( ! defined( 'ABSPATH' ) ) { |
| 17 | exit; |
| 18 | } |
| 19 | |
| 20 | // Useful global constants. |
| 21 | if ( ! defined( 'WP_2FA_VERSION' ) ) { |
| 22 | define( 'WP_2FA_VERSION', '2.0.0' ); |
| 23 | define( 'WP_2FA_URL', plugin_dir_url( __FILE__ ) ); |
| 24 | define( 'WP_2FA_PATH', plugin_dir_path( __FILE__ ) ); |
| 25 | define( 'WP_2FA_INC', WP_2FA_PATH . 'includes/' ); |
| 26 | define( 'WP_2FA_FILE', __FILE__ ); |
| 27 | define( 'WP_2FA_BASE', plugin_basename( __FILE__ ) ); |
| 28 | define( 'WP_2FA_LOGS_DIR', 'wp-2fa-logs' ); |
| 29 | |
| 30 | // Prefix used in usermetas, settings and transients. |
| 31 | define( 'WP_2FA_PREFIX', 'wp_2fa_' ); |
| 32 | define( 'WP_2FA_POLICY_SETTINGS_NAME', WP_2FA_PREFIX . 'policy' ); |
| 33 | define( 'WP_2FA_SETTINGS_NAME', WP_2FA_PREFIX . 'settings' ); |
| 34 | define( 'WP_2FA_WHITE_LABEL_SETTINGS_NAME', WP_2FA_PREFIX . 'white_label' ); |
| 35 | define( 'WP_2FA_EMAIL_SETTINGS_NAME', WP_2FA_PREFIX . 'email_settings' ); |
| 36 | } |
| 37 | // Include files. |
| 38 | require_once WP_2FA_INC . 'functions/core.php'; |
| 39 | |
| 40 | // Require Composer autoloader if it exists. |
| 41 | if ( file_exists( WP_2FA_PATH . 'vendor/autoload.php' ) ) { |
| 42 | require_once WP_2FA_PATH . 'vendor/autoload.php'; |
| 43 | } |
| 44 | |
| 45 | if ( file_exists( WP_2FA_PATH . 'third-party/vendor/autoload.php' ) ) { |
| 46 | require_once WP_2FA_PATH . 'third-party/vendor/autoload.php'; |
| 47 | } |
| 48 | |
| 49 | // run any required update routines. |
| 50 | \WP2FA\Utils\Migration::migrate(); |
| 51 | |
| 52 | $wp2fa = \WP2FA\WP2FA::get_instance(); |
| 53 | $wp2fa->init(); |
| 54 | if ( ! function_exists( 'wp2fa_free_on_plugin_activation' ) ) { |
| 55 | /** |
| 56 | * Takes care of deactivation of the premium plugin when the free plugin is activated. |
| 57 | * |
| 58 | * Note: This code MUST NOT be present in the premium version an is removed automatically during the build process. |
| 59 | * |
| 60 | * @since 2.0.0 |
| 61 | */ |
| 62 | function wp2fa_free_on_plugin_activation() { |
| 63 | $premium_version_slug = 'wp-2fa-premium/wp-2fa.php'; |
| 64 | if ( is_plugin_active( $premium_version_slug ) ) { |
| 65 | deactivate_plugins( $premium_version_slug, true ); |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | register_activation_hook( __FILE__, 'wp2fa_free_on_plugin_activation' ); |
| 70 | } |
| 71 |