| 1 |
<?php |
| 2 |
/************************************************************ |
| 3 |
* This plugin was modified by Revmakx * |
| 4 |
* Copyright (c) 2012 Revmakx * |
| 5 |
* www.revmakx.com * |
| 6 |
* * |
| 7 |
************************************************************/ |
| 8 |
|
| 9 |
if ( ! defined('ABSPATH') ) |
| 10 |
die(); |
| 11 |
|
| 12 |
class IWP_MMB_FixCompatibility |
| 13 |
{ |
| 14 |
|
| 15 |
public function fixWpSpamShieldBan() |
| 16 |
{ |
| 17 |
$wpss_ubl_cache = get_option('spamshield_ubl_cache'); |
| 18 |
|
| 19 |
if (empty($wpss_ubl_cache)){ |
| 20 |
return; |
| 21 |
} |
| 22 |
|
| 23 |
$serverIp = !empty($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : null; |
| 24 |
|
| 25 |
foreach ($wpss_ubl_cache as $key => $singleIp) { |
| 26 |
if ($singleIp !== $serverIp) { |
| 27 |
continue; |
| 28 |
} |
| 29 |
|
| 30 |
unset($wpss_ubl_cache[$key]); |
| 31 |
} |
| 32 |
|
| 33 |
update_option('spamshield_ubl_cache', array_values($wpss_ubl_cache)); |
| 34 |
} |
| 35 |
|
| 36 |
public function fixSpamShield() |
| 37 |
{ |
| 38 |
if (!defined('WPSS_IP_BAN_CLEAR')) { |
| 39 |
define('WPSS_IP_BAN_CLEAR', true); |
| 40 |
} |
| 41 |
} |
| 42 |
|
| 43 |
public function fixSidekickPlugin() |
| 44 |
{ |
| 45 |
add_action('init', array($this, '_fixSidekickPlugin'), -1); |
| 46 |
} |
| 47 |
|
| 48 |
public function _fixSidekickPlugin() |
| 49 |
{ |
| 50 |
$this->removeByPluginClass('admin_init', 'Sidekick', 'redirect', true); |
| 51 |
} |
| 52 |
|
| 53 |
public function fixShieldUserManagementICWP() |
| 54 |
{ |
| 55 |
add_filter('icwp-wpsf-visitor_is_whitelisted', '__return_true'); |
| 56 |
} |
| 57 |
|
| 58 |
public function fixDuoFactor() |
| 59 |
{ |
| 60 |
|
| 61 |
if (!is_plugin_active('duo-universal/duouniversal-wordpress.php')) { |
| 62 |
return; |
| 63 |
} |
| 64 |
add_action('init', array($this, '_fixDuoFactor'), -1); |
| 65 |
} |
| 66 |
|
| 67 |
function remove_by_plugin_class($tag, $class_name, $functionName, $isAction = false, $priority = 10) { |
| 68 |
if (!class_exists($class_name)) { |
| 69 |
return null; |
| 70 |
} |
| 71 |
|
| 72 |
global $wp_filter; |
| 73 |
|
| 74 |
if (empty($wp_filter[$tag][$priority])) { |
| 75 |
return null; |
| 76 |
} |
| 77 |
|
| 78 |
foreach ($wp_filter[$tag][$priority] as $callable) { |
| 79 |
if (empty($callable['function']) || !is_array($callable['function']) || count($callable['function']) < 2) { |
| 80 |
continue; |
| 81 |
} |
| 82 |
|
| 83 |
if (!is_a($callable['function'][0], $class_name)) { |
| 84 |
continue; |
| 85 |
} |
| 86 |
|
| 87 |
if ($callable['function'][1] !== $functionName) { |
| 88 |
continue; |
| 89 |
} |
| 90 |
|
| 91 |
if ($isAction) { |
| 92 |
remove_action($tag, $callable['function'], $priority); |
| 93 |
} else { |
| 94 |
remove_filter($tag, $callable['function'], $priority); |
| 95 |
} |
| 96 |
|
| 97 |
return $callable['function']; |
| 98 |
} |
| 99 |
|
| 100 |
return null; |
| 101 |
} |
| 102 |
|
| 103 |
/** |
| 104 |
* @internal |
| 105 |
*/ |
| 106 |
public function _fixDuoFactor() |
| 107 |
{ |
| 108 |
$this->remove_by_plugin_class('init','Duo\DuoUniversalWordpress\DuoUniversal_WordpressPlugin' ,'duo_verify_auth', 10); |
| 109 |
} |
| 110 |
|
| 111 |
public function fixAllInOneSecurity() |
| 112 |
{ |
| 113 |
if (!is_plugin_active('all-in-one-wp-security-and-firewall/wp-security.php')) { |
| 114 |
return; |
| 115 |
} |
| 116 |
|
| 117 |
add_action('init', array($this, '_fixAllInOneSecurity'), -1); |
| 118 |
} |
| 119 |
|
| 120 |
/** |
| 121 |
* @internal |
| 122 |
*/ |
| 123 |
public function _fixAllInOneSecurity() |
| 124 |
{ |
| 125 |
$user = wp_get_current_user(); |
| 126 |
|
| 127 |
if (empty($user->ID)) { |
| 128 |
return; |
| 129 |
} |
| 130 |
$time = new DateTime(current_time('mysql', true)); |
| 131 |
update_user_meta($user->ID, 'aiowps_last_login_time', $time->format('Y-m-d H:i:s')); |
| 132 |
} |
| 133 |
|
| 134 |
public function fixWpSimpleFirewall() |
| 135 |
{ |
| 136 |
if (!is_plugin_active('wp-simple-firewall/icwp-wpsf.php')) { |
| 137 |
return; |
| 138 |
} |
| 139 |
|
| 140 |
/** @handled function */ |
| 141 |
IWP_FixCompatibility_ICWP_WPSF(); |
| 142 |
} |
| 143 |
|
| 144 |
private function removeByPluginClass($tag, $class_name, $functionName, $isAction = false, $priority = 10) |
| 145 |
{ |
| 146 |
if (!class_exists($class_name)) { |
| 147 |
return null; |
| 148 |
} |
| 149 |
|
| 150 |
global $wp_filter; |
| 151 |
|
| 152 |
if (empty($wp_filter[$tag][$priority])) { |
| 153 |
return null; |
| 154 |
} |
| 155 |
|
| 156 |
foreach ($wp_filter[$tag][$priority] as $callable) { |
| 157 |
if (empty($callable['function']) || !is_array($callable['function']) || count($callable['function']) < 2) { |
| 158 |
continue; |
| 159 |
} |
| 160 |
|
| 161 |
if (!is_a($callable['function'][0], $class_name)) { |
| 162 |
continue; |
| 163 |
} |
| 164 |
|
| 165 |
if ($callable['function'][1] !== $functionName) { |
| 166 |
continue; |
| 167 |
} |
| 168 |
|
| 169 |
if ($isAction) { |
| 170 |
remove_action($tag, $callable['function'], $priority); |
| 171 |
} else { |
| 172 |
remove_filter($tag, $callable['function'], $priority); |
| 173 |
} |
| 174 |
|
| 175 |
return $callable['function']; |
| 176 |
} |
| 177 |
|
| 178 |
return null; |
| 179 |
} |
| 180 |
|
| 181 |
public function fixGlobals() |
| 182 |
{ |
| 183 |
if (!isset($GLOBALS['hook_suffix'])) { |
| 184 |
$GLOBALS['hook_suffix'] = null; |
| 185 |
} |
| 186 |
} |
| 187 |
} |
| 188 |
|
| 189 |
function IWP_FixCompatibility_ICWP_WPSF() |
| 190 |
{ |
| 191 |
if (class_exists('ICWP_WPSF_Processor_LoginProtect_TwoFactorAuth', false)) { |
| 192 |
return; |
| 193 |
} |
| 194 |
|
| 195 |
class ICWP_WPSF_Processor_LoginProtect_TwoFactorAuth |
| 196 |
{ |
| 197 |
public function run() |
| 198 |
{ |
| 199 |
} |
| 200 |
} |
| 201 |
} |
| 202 |
|