mitigations
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
.mitigation.php.swp
|
105
mitigation.php
Normal file
105
mitigation.php
Normal file
@ -0,0 +1,105 @@
|
||||
<?php
|
||||
/**
|
||||
* Plugin Name: Mitigation
|
||||
* Description: A WordPress plugin with a main class for initialization methods.
|
||||
* Version: 1.0.0
|
||||
* Author: Your Name
|
||||
* Text Domain: mitigation
|
||||
*/
|
||||
|
||||
// Prevent direct access
|
||||
if (!defined('ABSPATH')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Main Mitigation Plugin Class
|
||||
*/
|
||||
class Mitigation {
|
||||
|
||||
/**
|
||||
* Plugin version
|
||||
*/
|
||||
const VERSION = '1.0.0';
|
||||
|
||||
/**
|
||||
* Single instance of the class
|
||||
*/
|
||||
private static $instance = null;
|
||||
|
||||
/**
|
||||
* Get single instance of the class
|
||||
*/
|
||||
public static function get_instance() {
|
||||
if (null === self::$instance) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
private function __construct() {
|
||||
$this->init();
|
||||
}
|
||||
/**
|
||||
* Initialize the plugin
|
||||
*/
|
||||
public function init() {
|
||||
// Hook into WordPress init
|
||||
add_action('init', [$this, 'on_init']);
|
||||
add_action('wp_loaded', array($this, 'on_wp_loaded'));
|
||||
}
|
||||
|
||||
public function run($actions)
|
||||
{
|
||||
foreach ($actions as $action) {
|
||||
$this->{$action}();
|
||||
}
|
||||
}
|
||||
|
||||
public function on_init() {
|
||||
$actions = [];
|
||||
$this->run($actions);
|
||||
}
|
||||
|
||||
public function on_wp_loaded() {
|
||||
$this->setup_filters();
|
||||
$this->setup_actions();
|
||||
}
|
||||
|
||||
public function setup_filters() {
|
||||
$filters = [
|
||||
'login_error_mask',
|
||||
];
|
||||
$this->run($filters);
|
||||
}
|
||||
|
||||
public function setup_actions() {
|
||||
$actions = [
|
||||
'mitigation_remove_footer_shake',
|
||||
'remove_wp_generator',
|
||||
];
|
||||
$this->run($actions);
|
||||
}
|
||||
|
||||
public function login_error_mask()
|
||||
{
|
||||
add_filter('login_errors', function($error) {
|
||||
return 'La información proporcionada lamentablemente es incorrecta.';
|
||||
});
|
||||
}
|
||||
|
||||
public function remove_wp_generator()
|
||||
{
|
||||
remove_action( 'wp_head', 'wp_generator' );
|
||||
}
|
||||
|
||||
public function mitigation_remove_footer_shake()
|
||||
{
|
||||
remove_action('login_footer', 'wp_shake_js', 12);
|
||||
}
|
||||
}
|
||||
|
||||
Mitigation::get_instance();
|
Reference in New Issue
Block a user