PluginProbe
Hostinger Tools / 3.0.74
Hostinger Tools v3.0.74
3.0.77 3.0.76 3.0.75 3.0.74 3.0.73 3.0.72 3.0.71 3.0.70 3.0.69 3.0.68 3.0.67 3.0.66 1.8.1 1.8.2 1.8.3 1.9.1 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 2.0.4 All 108 releases
← All changes | includes/Hooks.php +29 -0 3.0.683.0.74 View file →
@@ -1,8 +1,9 @@
1 1 <?php
2 2
3 3 namespace Hostinger;
4 4
5 +use Hostinger\Admin\Menu;
5 6 use Hostinger\Admin\PluginSettings;
6 7 use Hostinger\Admin\Jobs\NotifyMcpJob;
7 8 use Hostinger\Mcp\EventHandlerFactory;
8 9 use Hostinger\WpHelper\Utils;
@@ -12,8 +13,9 @@
12 13 class Hooks {
13 14 public function __construct() {
14 15 add_filter( 'xmlrpc_enabled', array( $this, 'check_xmlrpc_enabled' ) );
15 16 add_filter( 'wp_is_application_passwords_available', array( $this, 'check_authentication_password_enabled' ) );
17 + add_filter( 'wp_die_handler', array( $this, 'maybe_customize_application_password_die_handler' ) );
16 18 add_filter( 'wp_headers', array( $this, 'check_pingback' ) );
17 19 add_action( 'init', array( $this, 'plugins_loaded' ) );
18 20 add_action( 'update_option_woocommerce_coming_soon', array( $this, 'litespeed_flush_cache' ) );
19 21 add_action( 'update_option_woocommerce_store_pages_only', array( $this, 'litespeed_flush_cache' ) );
@@ -142,8 +144,35 @@
142 144 return false;
143 145 }
144 146
145 147 return true;
148 + }
149 +
150 + public function maybe_customize_application_password_die_handler( $handler ) {
151 + $plugin_settings = new PluginSettings();
152 + $settings = $plugin_settings->get_plugin_settings();
153 +
154 + if ( ! $settings->get_disable_authentication_password() ) {
155 + return $handler;
156 + }
157 +
158 + return function ( $message, $title = '', $args = array() ) use ( $handler ) {
159 + if ( is_string( $message ) && $message === __( 'Application passwords are not available.' ) ) {
160 + $message = $this->get_application_password_disabled_message();
161 + }
162 +
163 + call_user_func( $handler, $message, $title, $args );
164 + };
165 + }
166 +
167 + private function get_application_password_disabled_message(): string {
168 + $settings_url = admin_url( 'admin.php?page=' . Menu::MENU_SLUG );
169 +
170 + return sprintf(
171 + /* translators: %s: URL to the Hostinger Tools settings page. */
172 + __( 'Application passwords have been disabled by Hostinger for security reasons. You can turn them back on from <a href="%s">Hostinger Tools → Security settings</a>.', 'hostinger' ),
173 + esc_url( $settings_url )
174 + );
146 175 }
147 176
148 177 public function litespeed_flush_cache(): void {
149 178 if ( has_action( 'litespeed_purge_all' ) ) {