namespace WPForms\Logger;
* Array, string, or string separated by commas types.
* Datetime of creating record.
* @param int $id Record ID.
* @param string $title Record title.
* @param string $message Record message.
* @param array|string $types Array, string, or string separated by commas types.
* @param string $create_at Datetime of creating record.
* @param int $form_id Record form ID.
* @param int $entry_id Record entry ID.
* @param int $user_id Record user ID.
public function __construct( $id, $title, $message, $types, $create_at, $form_id = 0, $entry_id = 0, $user_id = 0 ) {
$this->message = $message;
$this->create_at = strtotime( $create_at );
$this->form_id = $form_id;
$this->entry_id = $entry_id;
$this->user_id = $user_id;
public function get_id() {
public function get_title() {
public function get_message() {
* @param string $view Keys or labels.
public function get_types( $view = 'key' ) {
$this->types = is_array( $this->types ) ? $this->types : explode( ',', $this->types );
if ( $view === 'label' ) {
return array_intersect_key(
array_flip( $this->types )
* Get date of creating record.
* @param string $format Date format full|short|default sql format.
public function get_date( $format = 'short' ) {
$date = wpforms_date_format( $this->create_at, '', true );
$date = wpforms_datetime_format( $this->create_at, '', true );
$date = wpforms_datetime_format( $this->create_at, 'Y-m-d H:i:s' );
$date = wpforms_datetime_format( $this->create_at, 'Y-m-d H:i:s', true );
public function get_form_id() {
public function get_entry_id() {
public function get_user_id() {
* @param string $title Record title.
* @param string $message Record message.
* @param array|string $types Array, string, or string separated by commas types.
* @param int $form_id Record form ID.
* @param int $entry_id Record entry ID.
* @param int $user_id Record user ID.
public static function create( $title, $message, $types, $form_id = 0, $entry_id = 0, $user_id = 0 ) {
sanitize_text_field( $title ),
wp_kses( $message, [ 'pre' => [] ] ),