logs_controller();
}
/**
* Get view label.
*
* @since 1.6.6
*
* @return string
*/
public function get_label() {
return esc_html__( 'Logs', 'wpforms-lite' );
}
/**
* Checking user capability to view.
*
* @since 1.6.6
*
* @return bool
*/
public function check_capability() {
return wpforms_current_user_can();
}
/**
* Get ListTable instance.
*
* @since 1.6.6
*
* @return \WPForms\Logger\ListTable
*/
private function get_list_table() {
if ( empty( $this->list_table ) ) {
$this->list_table = wpforms()->get( 'log' )->get_list_table();
}
return $this->list_table;
}
/**
* Display view content.
*
* @since 1.6.6
*/
public function display() {
?>
get_list_table();
if ( wpforms_setting( 'logs-enable' ) || $logs_list_table->get_total() ) {
$logs_list_table->display_page();
}
}
/**
* Types block.
*
* @since 1.6.6
*/
private function types_block() {
?>
get( 'log' );
$log->create_table();
if ( $this->verify_nonce() ) {
$settings = get_option( 'wpforms_settings' );
$was_enabled = ! empty( $settings['logs-enable'] ) ? $settings['logs-enable'] : 0;
$settings['logs-enable'] = filter_input( INPUT_POST, 'logs-enable', FILTER_VALIDATE_BOOLEAN );
$logs_types = filter_input( INPUT_POST, 'logs-types', FILTER_SANITIZE_STRING, FILTER_REQUIRE_ARRAY );
$logs_user_roles = filter_input( INPUT_POST, 'logs-user-roles', FILTER_SANITIZE_STRING, FILTER_REQUIRE_ARRAY );
$logs_users = filter_input( INPUT_POST, 'logs-users', FILTER_SANITIZE_NUMBER_INT, FILTER_REQUIRE_ARRAY );
if ( $was_enabled ) {
$settings['logs-types'] = $logs_types ? $logs_types : [];
$settings['logs-user-roles'] = $logs_user_roles ? $logs_user_roles : [];
$settings['logs-users'] = $logs_users ? array_map( 'absint', $logs_users ) : [];
}
wpforms_update_settings( $settings );
}
$logs_list_table = $this->get_list_table();
$logs_list_table->process_admin_ui();
}
}