| @@ -11,8 +11,9 @@ | ||
| 11 | 11 | use WP_Defender\Traits\IP; |
| 12 | 12 | use Calotes\Component\Request; |
| 13 | 13 | use Calotes\Component\Response; |
| 14 | 14 | use WP_Defender\Traits\Setting; |
| 15 | +use WP_Defender\Model\Lockout_Log; | |
| 15 | 16 | use WP_Defender\Component\Blacklist_Lockout; |
| 16 | 17 | use WP_Defender\Model\Setting\Notfound_Lockout; |
| 17 | 18 | use WP_Defender\Component\Config\Config_Hub_Helper; |
| 18 | 19 | |
| @@ -67,9 +68,8 @@ | ||
| 67 | 68 | public function enqueue_assets() { |
| 68 | 69 | if ( ! $this->is_page_active() ) { |
| 69 | 70 | return; |
| 70 | 71 | } |
| 71 | - wp_localize_script( 'def-iplockout', 'nf_lockout', $this->data_frontend() ); | |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | /** |
| 75 | 75 | * Save settings. |
| @@ -126,12 +126,18 @@ | ||
| 126 | 126 | * |
| 127 | 127 | * @return array An array of data for the frontend. |
| 128 | 128 | */ |
| 129 | 129 | public function data_frontend(): array { |
| 130 | + $summary = Lockout_Log::get_summary(); | |
| 131 | + | |
| 130 | 132 | return array_merge( |
| 131 | 133 | array( |
| 132 | 134 | 'model' => $this->model->export(), |
| 133 | - 'misc' => array( 'module_name' => Notfound_Lockout::get_module_name() ), | |
| 135 | + 'misc' => array( | |
| 136 | + 'module_name' => Notfound_Lockout::get_module_name(), | |
| 137 | + 'hits_today' => (int) ( $summary['lockout_404_today'] ?? 0 ), | |
| 138 | + 'lockouts_today' => (int) ( $summary['lockout_404_today'] ?? 0 ), | |
| 139 | + ), | |
| 134 | 140 | ), |
| 135 | 141 | $this->dump_routes_and_nonces() |
| 136 | 142 | ); |
| 137 | 143 | } |