| @@ -233,21 +233,9 @@ | ||
| 233 | 233 | * @param string $uri The URI that was accessed. |
| 234 | 234 | * @param string $scenario The scenario under which the event is logged. |
| 235 | 235 | */ |
| 236 | 236 | public function log_event( $ip, $uri, $scenario ) { |
| 237 | - $model = new Lockout_Log(); | |
| 238 | - $model->ip = $ip; | |
| 239 | - $user_agent = defender_get_data_from_request( 'HTTP_USER_AGENT', 's' ); | |
| 240 | - $model->user_agent = isset( $user_agent ) ? User_Agent::fast_cleaning( $user_agent ) : null; | |
| 241 | - $model->date = time(); | |
| 242 | - $model->tried = $uri; | |
| 243 | - $model->blog_id = get_current_blog_id(); | |
| 244 | - | |
| 245 | - $ip_to_country = $this->ip_to_country( $ip ); | |
| 246 | - | |
| 247 | - if ( isset( $ip_to_country['iso'] ) ) { | |
| 248 | - $model->country_iso_code = $ip_to_country['iso']; | |
| 249 | - } | |
| 237 | + $model = Lockout_Log::create( $ip, $uri ); | |
| 250 | 238 | |
| 251 | 239 | switch ( $scenario ) { |
| 252 | 240 | case self::SCENARIO_MALICIOUS_BOT: |
| 253 | 241 | default: |