| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Magic Login |
| 4 |
* Plugin URI: https://handyplugins.co/magic-login-pro/ |
| 5 |
* Description: Passwordless login for WordPress. |
| 6 |
* Version: 2.1 |
| 7 |
* Requires at least: 5.0 |
| 8 |
* Requires PHP: 7.2 |
| 9 |
* Author: HandyPlugins |
| 10 |
* Author URI: https://handyplugins.co/ |
| 11 |
* License: GPL v2 or later |
| 12 |
* License URI: https://www.gnu.org/licenses/gpl-2.0.html |
| 13 |
* Text Domain: magic-login |
| 14 |
* Domain Path: /languages |
| 15 |
* |
| 16 |
* @package MagicLogin |
| 17 |
*/ |
| 18 |
|
| 19 |
namespace MagicLogin; |
| 20 |
|
| 21 |
// Useful global constants. |
| 22 |
define( 'MAGIC_LOGIN_VERSION', '2.1' ); |
| 23 |
define( 'MAGIC_LOGIN_PLUGIN_FILE', __FILE__ ); |
| 24 |
define( 'MAGIC_LOGIN_URL', plugin_dir_url( __FILE__ ) ); |
| 25 |
define( 'MAGIC_LOGIN_PATH', plugin_dir_path( __FILE__ ) ); |
| 26 |
define( 'MAGIC_LOGIN_INC', MAGIC_LOGIN_PATH . 'includes/' ); |
| 27 |
|
| 28 |
if ( ! defined( 'MAGIC_LOGIN_USERNAME_ONLY' ) ) { |
| 29 |
define( 'MAGIC_LOGIN_USERNAME_ONLY', false ); |
| 30 |
} |
| 31 |
|
| 32 |
// deactivate pro |
| 33 |
if ( defined( 'MAGIC_LOGIN_PRO_PLUGIN_FILE' ) ) { |
| 34 |
if ( ! function_exists( 'deactivate_plugins' ) ) { |
| 35 |
include_once ABSPATH . 'wp-admin/includes/plugin.php'; |
| 36 |
} |
| 37 |
|
| 38 |
deactivate_plugins( plugin_basename( MAGIC_LOGIN_PRO_PLUGIN_FILE ) ); |
| 39 |
|
| 40 |
return; |
| 41 |
} |
| 42 |
|
| 43 |
// Require Composer autoloader if it exists. |
| 44 |
if ( file_exists( MAGIC_LOGIN_PATH . '/vendor/autoload.php' ) ) { |
| 45 |
require_once MAGIC_LOGIN_PATH . 'vendor/autoload.php'; |
| 46 |
} |
| 47 |
|
| 48 |
// Include files. |
| 49 |
require_once MAGIC_LOGIN_INC . 'constants.php'; |
| 50 |
require_once MAGIC_LOGIN_INC . 'utils.php'; |
| 51 |
require_once MAGIC_LOGIN_INC . 'core.php'; |
| 52 |
require_once MAGIC_LOGIN_INC . 'login.php'; |
| 53 |
require_once MAGIC_LOGIN_INC . 'settings.php'; |
| 54 |
require_once MAGIC_LOGIN_INC . 'shortcode.php'; |
| 55 |
require_once MAGIC_LOGIN_INC . 'block.php'; |
| 56 |
|
| 57 |
$network_activated = Utils\is_network_wide( MAGIC_LOGIN_PLUGIN_FILE ); |
| 58 |
if ( ! defined( 'MAGIC_LOGIN_IS_NETWORK' ) ) { |
| 59 |
define( 'MAGIC_LOGIN_IS_NETWORK', $network_activated ); |
| 60 |
} |
| 61 |
|
| 62 |
/** |
| 63 |
* Setup routine |
| 64 |
* |
| 65 |
* @return void |
| 66 |
* @since 1.5 bootstrapping with plugins_loaded hook |
| 67 |
*/ |
| 68 |
function setup_magic_login() { |
| 69 |
// Bootstrap. |
| 70 |
Core\setup(); |
| 71 |
Login\setup(); |
| 72 |
Settings\setup(); |
| 73 |
Shortcode\setup(); |
| 74 |
Block\setup(); |
| 75 |
} |
| 76 |
|
| 77 |
add_action( 'plugins_loaded', __NAMESPACE__ . '\\setup_magic_login' ); |
| 78 |
|