function column_ip_address($item) { if (AIOWPSecurity_Blocking::is_ip_blocked($item['ip_address'])) { return $item['ip_address'] . '<br /><span class="aiowps-label aiowps-label-success">' . __('blocked', 'WPS') . '</span>'; } else { return $item['ip_address']; } }
/** * Will check the current visitor IP against the blocked table * If IP present will block the visitor from viewing the site */ static function check_visitor_ip_and_perform_blocking() { global $aio_wp_security, $wpdb; $visitor_ip = AIOWPSecurity_Utility_IP::get_user_ip_address(); $ip_type = WP_Http::is_ip_address($visitor_ip); if (empty($ip_type)) { $aio_wp_security->debug_logger->log_debug("do_general_ip_blocking_tasks: " . $visitor_ip . " is not a valid IP!", 4); return; } //Check if this IP address is in the block list $blocked = AIOWPSecurity_Blocking::is_ip_blocked($visitor_ip); //TODO - future feature: add blocking whitelist and check if (empty($blocked)) { return; //Visitor IP is not blocked - allow page to load } else { //block this visitor!! AIOWPSecurity_Utility::redirect_to_url('http://127.0.0.1'); } return; }