captcha.php
1 year ago
common.php
1 year ago
dashboard.php
1 year ago
disable-access-system-file.php
1 year 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
1 year ago
login-log.php
1 year ago
login-notification.php
1 year ago
rename-login-page.php
1 year ago
restrict-admin-page.php
1 year ago
server-error-notification.php
1 year ago
server-error-table.php
1 year ago
two-factor-authentication-registration.php
2 years ago
two-factor-authentication.php
1 year ago
unify-messages.php
1 year ago
update-notice.php
1 year ago
waf-table.php
1 year ago
waf.php
1 year ago
server-error-table.php
77 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_Server_Error_Table extends WP_List_Table { |
| 12 | |
| 13 | private $server_error_notification; |
| 14 | |
| 15 | function __construct( CloudSecureWP_Server_Error_Notification $server_error_notification ) { |
| 16 | parent::__construct(); |
| 17 | $this->server_error_notification = $server_error_notification; |
| 18 | } |
| 19 | |
| 20 | public function prepare_items() { |
| 21 | $per_page = 50; |
| 22 | $orderby = sanitize_text_field( $_GET['orderby'] ?? 'created_at' ); |
| 23 | $order = sanitize_text_field( $_GET['order'] ?? 'desc' ); |
| 24 | $offset = ( $this->get_pagenum() - 1 ) * $per_page; |
| 25 | list( $this->items, $total_items ) = $this->server_error_notification->get_server_errors( $orderby, $order, $per_page, $offset ); |
| 26 | $this->_column_headers = array( |
| 27 | $this->get_columns(), |
| 28 | $this->get_hidden_columns(), |
| 29 | $this->get_sortable_columns(), |
| 30 | ); |
| 31 | |
| 32 | $this->set_pagination_args( |
| 33 | array( |
| 34 | 'total_items' => $total_items, |
| 35 | 'per_page' => $per_page, |
| 36 | ) |
| 37 | ); |
| 38 | } |
| 39 | |
| 40 | public function get_columns(): array { |
| 41 | return array( |
| 42 | 'created_at' => '日時', |
| 43 | 'type' => 'タイプ', |
| 44 | 'message' => 'メッセージ', |
| 45 | 'file' => 'ファイル', |
| 46 | 'line' => '行', |
| 47 | 'id' => 'ID', |
| 48 | ); |
| 49 | } |
| 50 | |
| 51 | public function get_hidden_columns() : array { |
| 52 | return array( |
| 53 | 'id', |
| 54 | ); |
| 55 | } |
| 56 | |
| 57 | public function get_sortable_columns(): array { |
| 58 | return array( |
| 59 | 'created_at' => array( 'created_at', false ), |
| 60 | 'type' => array( 'type', false ), |
| 61 | 'message' => array( 'message', false ), |
| 62 | 'file' => array( 'file', false ), |
| 63 | 'line' => array( 'line', false ), |
| 64 | 'id' => array( 'id', false ), |
| 65 | ); |
| 66 | } |
| 67 | |
| 68 | public function column_default( $item, $column_name ) { |
| 69 | switch ( $column_name ) { |
| 70 | case 'message': |
| 71 | return nl2br( esc_html( $item[ $column_name ] ) ); |
| 72 | default: |
| 73 | return esc_html( $item[ $column_name ] ); |
| 74 | } |
| 75 | } |
| 76 | } |
| 77 |