/** * Inserts an IP address into the htaccess ban list. * * @since 4.0 * * @param $ip * * @return boolean False if the IP is whitelisted, true otherwise. */ public function blacklist_ip($ip) { $ip = sanitize_text_field($ip); if (ITSEC_Lib::is_ip_blacklisted($ip)) { // Already blacklisted. return true; } if (ITSEC_Lib::is_ip_whitelisted($ip)) { // Cannot blacklist a whitelisted IP. return false; } // The following action allows modules to handle the blacklist as needed. This is primarily useful for the Ban // Users module. do_action('itsec-new-blacklisted-ip', $ip); return true; }