captcha.php
2 years ago
common.php
2 years ago
dashboard.php
2 years ago
disable-author-query.php
2 years ago
disable-login.php
2 years ago
disable-restapi.php
2 years ago
disable-xmlrpc.php
2 years ago
login-log-table.php
2 years ago
login-log.php
2 years ago
login-notification.php
2 years ago
rename-login-page.php
2 years ago
restrict-admin-page.php
2 years ago
server-error-notification.php
2 years ago
server-error-table.php
2 years ago
two-factor-authentication-registration.php
2 years ago
two-factor-authentication.php
2 years ago
unify-messages.php
2 years ago
update-notice.php
2 years ago
server-error-table.php
69 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 | array(), |
| 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 | ); |
| 48 | } |
| 49 | |
| 50 | public function get_sortable_columns(): array { |
| 51 | return array( |
| 52 | 'created_at' => array( 'created_at' ), |
| 53 | 'type' => array( 'type' ), |
| 54 | 'message' => array( 'message' ), |
| 55 | 'file' => array( 'file' ), |
| 56 | 'line' => array( 'line' ), |
| 57 | ); |
| 58 | } |
| 59 | |
| 60 | public function column_default( $item, $column_name ) { |
| 61 | switch ( $column_name ) { |
| 62 | case 'message': |
| 63 | return nl2br( $item[ $column_name ] ); |
| 64 | default: |
| 65 | return $item[ $column_name ]; |
| 66 | } |
| 67 | } |
| 68 | } |
| 69 |