| Server IP : 93.127.179.51 / Your IP :
216.73.216.109 [
Web Server : LiteSpeed System : Linux nl-srv-web1124.main-hosting.eu 4.18.0-553.121.1.lve.el8.x86_64 #1 SMP Thu Apr 30 16:40:41 UTC 2026 x86_64 User : u964240598 ( 964240598) PHP Version : 8.4.19 Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail Domains : 2 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/u964240598/domains/arisecbo.org/public_html/wp-content/plugins/hostinger/includes/ |
Upload File : |
<?php
namespace Hostinger;
use Hostinger\Admin\PluginSettings;
use Hostinger\WpHelper\Utils;
defined( 'ABSPATH' ) || exit;
class Hooks {
public function __construct() {
// XMLRpc / Force SSL
add_filter( 'xmlrpc_enabled', array( $this, 'check_xmlrpc_enabled' ) );
add_filter( 'wp_headers', array( $this, 'check_pingback' ) );
add_filter( 'plugins_loaded', array( $this, 'plugins_loaded' ) );
}
/**
* @return void
*/
public function plugins_loaded() {
$utils = new Utils();
$plugin_settings = new PluginSettings();
$settings = $plugin_settings->get_plugin_settings();
if ( defined( 'WP_CLI' ) && \WP_CLI ) {
return;
}
// Xmlrpc.
if ( $settings->get_disable_xml_rpc() && $utils->isThisPage( 'xmlrpc.php' ) ) {
exit( 'Disabled' );
}
// SSL redirect.
if ( $settings->get_force_https() && ! is_ssl() ) {
if ( isset( $_SERVER['HTTP_HOST'] ) && isset( $_SERVER['REQUEST_URI'] ) ) {
$host = sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) );
if ( $settings->get_force_www() && strpos( $host, 'www.' ) === false ) {
$host = 'www.' . $host;
}
wp_safe_redirect( 'https://' . $host . sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 301 );
exit;
}
}
// Force www.
if ( $settings->get_force_www() ) {
if ( isset( $_SERVER['HTTP_HOST'] ) && isset( $_SERVER['REQUEST_URI'] ) ) {
$host = sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) );
if ( strpos( $host, 'www.' ) === false ) {
wp_safe_redirect( 'https://www.' . $host . sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 301 );
exit;
}
}
}
}
/**
* @param mixed $headers
*
* @return mixed
*/
public function check_pingback( $headers ) {
$plugin_settings = new PluginSettings();
$settings = $plugin_settings->get_plugin_settings();
if ( $settings->get_disable_xml_rpc() ) {
unset( $headers['X-Pingback'] );
}
return $headers;
}
/**
* @return bool
*/
public function check_xmlrpc_enabled(): bool {
$plugin_settings = new PluginSettings();
$settings = $plugin_settings->get_plugin_settings();
if ( $settings->get_disable_xml_rpc() ) {
return false;
}
return true;
}
}
Anon7 - 2022
AnonSec Team
