PluginProbe
Custom Login / 5.1.2.1
Custom Login v5.1.2.1
trunk 1.1.4 2.4 3.0.8.1 3.1 3.2.15 3.2.5 3.2.8 3.2.9 4.0.11 4.0.12 4.0.8 4.1.0 4.1.1 4.2.0 4.3.0 4.4.0.1 4.5.0 4.5.1 4.5.2 5.0.0 5.1.1 5.1.2.1 5.1.2.2 5.1.3
custom-login / custom-login.php

custom-login.php in Custom Login 5.1.2.1, at custom-login.php

105 lines 4.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: Custom Login
4 * Plugin URI: https://frosty.media/plugins/custom-login
5 * Description: A simple way to customize your WordPress <code>wp-login.php</code> screen! A <a href="https://frosty.media/">Frosty Media</a> plugin.
6 * Version: 5.1.2.1
7 * Author: Austin Passy
8 * Author URI: https://austin.passy.co
9 * Requires at least: 6.4
10 * Tested up to: 6.8.3
11 * Requires PHP: 7.4
12 * Text Domain: custom-login
13 * GitHub Plugin URI: https://github.com/thefrosty/custom-login
14 * Primary Branch: develop
15 * Release Asset: true
16 *
17 * @copyright 2012 - 2025
18 * @author Austin Passy
19 * @link https://austin.passy.co/
20 * @license https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
24 */
25
26 use Dwnload\WpSettingsApi\WpSettingsApi;
27 use TheFrosty\CustomLogin\Api\Cron;
28 use TheFrosty\CustomLogin\CustomLogin;
29 use TheFrosty\CustomLogin\ServiceProvider;
30 use TheFrosty\CustomLogin\Settings\Api\Factory;
31 use TheFrosty\CustomLogin\Settings\ImportExport;
32 use TheFrosty\CustomLogin\Settings\Settings;
33 use TheFrosty\CustomLogin\WpAdmin\Dashboard;
34 use TheFrosty\CustomLogin\WpAdmin\Extensions;
35 use TheFrosty\CustomLogin\WpAdmin\SettingsUpgrades;
36 use TheFrosty\CustomLogin\WpAdmin\Tracking;
37 use TheFrosty\CustomLogin\WpLogin\Login;
38 use TheFrosty\WpUtilities\Plugin\PluginFactory;
39
40 /**
41 * Maybe trigger an error notice "message" on the `admin_notices` action hook.
42 */
43 add_action('admin_notices', static function (): void {
44 $message = apply_filters('custom_login_shutdown_error_message', '');
45 if (!is_admin() || empty($message)) {
46 return;
47 }
48 load_plugin_textdomain('custom-login', false, dirname(plugin_basename(__FILE__)) . '/languages/');
49 echo wp_kses_post(sprintf('<div class="error">%s</div>', wpautop($message)));
50 });
51
52 if (version_compare(PHP_VERSION, '7.4', '<')) {
53 return add_filter('custom_login_shutdown_error_message', static function (): string {
54 return sprintf(
55 esc_html__(
56 'Notice: Custom Login version %1$s requires PHP version >= 8.3, you are running %2$s, all features are currently disabled.',
57 'custom-login'
58 ),
59 get_plugin_data(__FILE__, false, false)['Version'],
60 PHP_VERSION
61 );
62 });
63 }
64
65 if (!is_readable(__DIR__ . '/vendor/autoload.php') && !defined('TheFrosty\CustomLogin\CUSTOM_LOGIN_FUNCTIONS')) {
66 return add_filter('custom_login_shutdown_error_message', static function (): string {
67 return esc_html__(
68 'Error: Custom Login can\'t find the autoload file (if installed from GitHub, please run `composer install`), all features are currently disabled.',
69 'custom-login'
70 );
71 });
72 }
73
74 if (file_exists(__DIR__ . '/vendor/autoload.php')) {
75 require_once __DIR__ . '/vendor/autoload.php';
76 }
77 $plugin = PluginFactory::create('custom-login', __FILE__);
78 $container = $plugin->getContainer();
79 $container->register(new ServiceProvider());
80 $plugin
81 ->add(new Cron())
82 ->addOnHook(CustomLogin::class, 'plugins_loaded', 5)
83 ->addOnHook(Dashboard::class, 'load-index.php', 5, true, [Dashboard::getArgs()])
84 ->addOnHook(Extensions::class, 'init', 10, true, [$container])
85 ->addOnHook(ImportExport::class, 'init', 10, true, [$container])
86 ->addOnHook(Login::class, 'init', 2, null, [$container])
87 ->addOnHook(Settings::class, 'init', 10, true, [$container])
88 ->addOnHook(SettingsUpgrades::class, 'init', 10, null, [$container])
89 ->addOnHook(Tracking::class, 'admin_init', 10, true, [$container]);
90
91 add_action('plugins_loaded', static function () use ($plugin): void {
92 do_action('custom_login_loaded_before_initialize', $plugin);
93 $plugin->initialize();
94 });
95
96 // Defer the WpSettingsApi until after 'init' for translation's issues triggered in WP >= 6.7.0.
97 add_action('init', static function () use ($plugin): void {
98 $plugin->addOnHook(WpSettingsApi::class, 'init', 5, true, [Factory::getPluginSettings($plugin)]);
99 do_action('custom_login_loaded_after_initialize', $plugin);
100 }, 2);
101
102 register_activation_hook(__FILE__, static function (): void {
103 (new CustomLogin())->activate();
104 });
105