__( 'log', 'woocommerce' ), 'plural' => __( 'logs', 'woocommerce' ), 'ajax' => false, ) ); } /** * Get list views. * * @return array Views. */ public function get_views() { $current = ! empty( $_REQUEST['level'] ) ? $_REQUEST['level'] : false; $views = array(); $levels = array( array( 'query_arg' => false, 'label' => __( 'All levels', 'woocommerce' ) ), array( 'query_arg' => 'emergency', 'label' => __( 'Emergency', 'woocommerce' ) ), array( 'query_arg' => 'alert', 'label' => __( 'Alert', 'woocommerce' ) ), array( 'query_arg' => 'critical', 'label' => __( 'Critical', 'woocommerce' ) ), array( 'query_arg' => 'error', 'label' => __( 'Error', 'woocommerce' ) ), array( 'query_arg' => 'warning', 'label' => __( 'Warning', 'woocommerce' ) ), array( 'query_arg' => 'notice', 'label' => __( 'Notice', 'woocommerce' ) ), array( 'query_arg' => 'info', 'label' => __( 'Info', 'woocommerce' ) ), array( 'query_arg' => 'debug', 'label' => __( 'Debug', 'woocommerce' ) ), ); foreach ( $levels as $level ) { $url = esc_url( add_query_arg( 'level', $level['query_arg'] ) ); $class = $current === $level['query_arg'] ? ' class="current"' : ''; $views[] = sprintf( '%3$s', $url, $class, esc_html( $level['label'] ) ); } return $views; } /** * Get list columns. * * @return array */ public function get_columns() { return array( 'cb' => '', 'timestamp' => __( 'Timestamp', 'woocommerce' ), 'level' => __( 'Level', 'woocommerce' ), 'message' => __( 'Message', 'woocommerce' ), 'source' => __( 'Source', 'woocommerce' ), ); } /** * Column cb. * * @param array $log * @return string */ public function column_cb( $log ) { return sprintf( '', $log['log_id'] ); } /** * Timestamp column. * * @param array $log * @return string */ public function column_timestamp( $log ) { return esc_html( mysql2date( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), $log['timestamp'] ) ); } /** * Level column. * * @param array $log * @return string */ public function column_level( $log ) { $level_key = WC_Log_Levels::get_severity_level( $log['level'] ); $levels = array( 'emergency' => __( 'Emergency', 'woocommerce' ), 'alert' => __( 'Alert', 'woocommerce' ), 'critical' => __( 'Critical', 'woocommerce' ), 'error' => __( 'Error', 'woocommerce' ), 'warning' => __( 'Warning', 'woocommerce' ), 'notice' => __( 'Notice', 'woocommerce' ), 'info' => __( 'Info', 'woocommerce' ), 'debug' => __( 'Debug', 'woocommerce' ), ); if ( isset( $levels[ $level_key ] ) ) { return esc_html( $levels[ $level_key ] ); } else { return ''; } } /** * Message column. * * @param array $log * @return string */ public function column_message( $log ) { return esc_html( $log['message'] ); } /** * Source column. * * @param array $log * @return string */ public function column_source( $log ) { return esc_html( $log['source'] ); } /** * Get bulk actions. * * @return array */ protected function get_bulk_actions() { return array( 'delete' => __( 'Delete', 'woocommerce' ), ); } /** * Extra controls to be displayed between bulk actions and pagination. * * @param string $which */ protected function extra_tablenav( $which ) { if ( 'top' === $which ) { echo '