PluginProbe ʕ •ᴥ•ʔ
CloudSecure WP Security / 1.4.9
CloudSecure WP Security v1.4.9
1.4.10 1.4.9 trunk 0.9.0 1.0.2 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.1 1.3.10 1.3.11 1.3.12 1.3.13 1.3.14 1.3.15 1.3.16 1.3.17 1.3.18 1.3.19 1.3.2 1.3.20 1.3.21 1.3.22 1.3.23 1.3.24 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8
cloudsecure-wp-security / modules / admin / waf-table.php
cloudsecure-wp-security / modules / admin Last commit date
captcha.php 1 year ago common.php 1 year ago dashboard.php 2 months ago disable-access-system-file.php 7 months ago disable-author-query.php 1 year ago disable-login.php 1 year ago disable-restapi.php 1 year ago disable-xmlrpc.php 1 year ago login-log-table.php 3 months ago login-log.php 1 year ago login-notification.php 1 year ago rename-login-page.php 1 month ago restrict-admin-page.php 1 year ago server-error-notification.php 2 months ago server-error-table.php 1 year ago two-factor-authentication-registration.php 2 months ago two-factor-authentication.php 2 months ago unify-messages.php 1 year ago update-notice.php 2 months ago waf-table.php 1 year ago waf.php 2 months ago
waf-table.php
93 lines
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit;
5 }
6
7 if ( ! class_exists( 'WP_List_Table' ) ) {
8 require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
9 }
10
11 class CloudSecureWP_Waf_Table extends WP_List_Table {
12 private $waf;
13 private $per_page = 50;
14
15 function __construct( CloudSecureWP_Waf $waf ) {
16 parent::__construct();
17 $this->waf = $waf;
18 }
19
20
21 public function get_columns() : array {
22 $column_datas = $this->waf->get_cloumns();
23
24 return array(
25 'access_at' => $column_datas['access_at'],
26 'attack' => $column_datas['attack'],
27 'url' => $column_datas['url'],
28 'matched' => $column_datas['matched'],
29 'ip' => $column_datas['ip'],
30 'id' => $column_datas['id'],
31 );
32 }
33
34
35 public function get_hidden_columns() : array {
36 return array(
37 'id',
38 );
39 }
40
41
42 public function get_sortable_columns() {
43 return array(
44 'access_at' => array( 'access_at', false ),
45 'attack' => array( 'attack', false ),
46 'url' => array( 'url', false ),
47 'matched' => array( 'matched', false ),
48 'ip' => array( 'ip', false ),
49 'id' => array( 'id', false ),
50 );
51 }
52
53
54 public function column_default( $item, $column ) {
55 switch ( $column ) {
56 case 'access_at':
57 case 'attack':
58 case 'ip':
59 return esc_html( $item[ $column ] );
60
61 case 'matched':
62 case 'url':
63 if ( mb_strlen( $item[ $column ], 'UTF-8' ) === 32767 ) {
64 $item[ $column ] = $item[ $column ] . '...';
65 }
66 return esc_html( $item[ $column ] );
67
68 default:
69 return '';
70 }
71 }
72
73
74 public function prepare_items() {
75 $columns = $this->get_columns();
76 $hidden = $this->get_hidden_columns();
77 $sortable = $this->get_sortable_columns();
78 $this->_column_headers = array( $columns, $hidden, $sortable );
79
80 $orderby = sanitize_text_field( $_GET['orderby'] ?? 'access_at' );
81 $order = sanitize_text_field( $_GET['order'] ?? 'desc' );
82 $offset = ( $this->get_pagenum() - 1 ) * $this->per_page;
83 list( $this->items, $total_items ) = $this->waf->get_block_history( $orderby, $order, $this->per_page, $offset );
84
85 $this->set_pagination_args(
86 array(
87 'total_items' => $total_items,
88 'per_page' => $this->per_page,
89 )
90 );
91 }
92 }
93