PluginProbe
Magic Login – Magic Link & Passwordless Authentication for WordPress – Login Without Password / 2.8
Magic Login – Magic Link & Passwordless Authentication for WordPress – Login Without Password v2.8
2.8.1 2.1 2.1.1 2.1.2 2.1.3 2.2 2.3 2.3.1 2.3.2 2.3.3 2.3.4 2.3.5 2.4 2.4.1 2.4.2 2.5 2.5.1 2.6 2.6.1 2.6.2 2.6.3 2.7 2.7.1 2.8 trunk All 48 releases
magic-login / plugin.php

plugin.php in Magic Login – Magic Link & Passwordless Authentication for WordPress – Login Without Password 2.8, at plugin.php

118 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 * Plugin Name: Magic Login
4 * Plugin URI: https://handyplugins.co/magic-login-pro/
5 * Description: Passwordless login for WordPress.
6 * Version: 2.8
7 * Requires at least: 5.0
8 * Requires PHP: 7.4
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 if ( ! defined( 'ABSPATH' ) ) {
22 exit; // Exit if accessed directly.
23 }
24
25 // Useful global constants.
26 define( 'MAGIC_LOGIN_VERSION', '2.8' );
27 define( 'MAGIC_LOGIN_PLUGIN_FILE', __FILE__ );
28 define( 'MAGIC_LOGIN_URL', plugin_dir_url( __FILE__ ) );
29 define( 'MAGIC_LOGIN_PATH', plugin_dir_path( __FILE__ ) );
30 define( 'MAGIC_LOGIN_INC', MAGIC_LOGIN_PATH . 'includes/' );
31
32 if ( ! defined( 'MAGIC_LOGIN_USERNAME_ONLY' ) ) {
33 define( 'MAGIC_LOGIN_USERNAME_ONLY', false );
34 }
35
36 // deactivate pro
37 if ( defined( 'MAGIC_LOGIN_PRO_PLUGIN_FILE' ) ) {
38 if ( ! function_exists( 'deactivate_plugins' ) ) {
39 include_once ABSPATH . 'wp-admin/includes/plugin.php';
40 }
41
42 deactivate_plugins( plugin_basename( MAGIC_LOGIN_PRO_PLUGIN_FILE ) );
43
44 return;
45 }
46
47 // Require Composer autoloader if it exists.
48 if ( file_exists( MAGIC_LOGIN_PATH . '/vendor/autoload.php' ) ) {
49 require_once MAGIC_LOGIN_PATH . 'vendor/autoload.php';
50 }
51
52
53 /**
54 * PSR-4-ish autoloading
55 *
56 * @since 2.0
57 */
58 spl_autoload_register(
59 function ( $class ) {
60 // project-specific namespace prefix.
61 $prefix = 'MagicLogin\\';
62
63 // base directory for the namespace prefix.
64 $base_dir = __DIR__ . '/includes/classes/';
65
66 // does the class use the namespace prefix?
67 $len = strlen( $prefix );
68
69 if ( strncmp( $prefix, $class, $len ) !== 0 ) {
70 return;
71 }
72
73 $relative_class = substr( $class, $len );
74
75 $file = $base_dir . str_replace( '\\', '/', $relative_class ) . '.php';
76
77 // if the file exists, require it.
78 if ( file_exists( $file ) ) {
79 require $file;
80 }
81 }
82 );
83
84 // Include files.
85 require_once MAGIC_LOGIN_INC . 'constants.php';
86 require_once MAGIC_LOGIN_INC . 'utils.php';
87 require_once MAGIC_LOGIN_INC . 'core.php';
88 require_once MAGIC_LOGIN_INC . 'login.php';
89 require_once MAGIC_LOGIN_INC . 'security.php';
90 require_once MAGIC_LOGIN_INC . 'admin/dashboard.php';
91 require_once MAGIC_LOGIN_INC . 'shortcode.php';
92 require_once MAGIC_LOGIN_INC . 'block.php';
93
94 $network_activated = Utils\is_network_wide( MAGIC_LOGIN_PLUGIN_FILE );
95 if ( ! defined( 'MAGIC_LOGIN_IS_NETWORK' ) ) {
96 define( 'MAGIC_LOGIN_IS_NETWORK', $network_activated );
97 }
98
99 /**
100 * Setup routine
101 *
102 * @return void
103 * @since 1.5 bootstrapping with plugins_loaded hook
104 */
105 function setup_magic_login() {
106 // Bootstrap.
107 Core\setup();
108 LoginManager::setup();
109 Honeypot::setup();
110 Security\setup();
111 Shortcode\setup();
112 Block\setup();
113 Admin\Dashboard\setup();
114 CodeLogin::setup();
115 }
116
117 add_action( 'plugins_loaded', __NAMESPACE__ . '\\setup_magic_login' );
118