SILENT KILLERPanel

Current Path: > home > codekrsu > > ameliagraphics.com > wp-content > plugins > > wpforms-lite > > src > Logger


Operation   : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
Software     : Apache
Server IP    : 162.0.232.56 | Your IP: 216.73.216.111
Domains      : 1034 Domain(s)
Permission   : [ 0755 ]

Files and Folders in: /home/codekrsu//ameliagraphics.com/wp-content/plugins//wpforms-lite//src/Logger

NameTypeSizeLast ModifiedActions
ListTable.php File 12759 bytes June 05 2025 16:54:44.
Log.php File 5402 bytes August 08 2024 19:32:00.
Record.php File 4383 bytes November 28 2023 16:59:36.
RecordQuery.php File 1863 bytes September 26 2024 15:36:36.
Records.php File 1986 bytes February 03 2022 16:56:54.
Repository.php File 6092 bytes November 07 2024 17:15:50.

Reading File: /home/codekrsu//ameliagraphics.com/wp-content/plugins//wpforms-lite//src/Logger/RecordQuery.php

<?php

// phpcs:ignore Generic.Commenting.DocComment.MissingShort
/** @noinspection PhpIllegalPsrClassPathInspection */

namespace WPForms\Logger;

/**
 * Class RecordQuery.
 *
 * @since 1.6.3
 */
class RecordQuery {

	/**
	 * Build query.
	 *
	 * @since 1.6.3
	 *
	 * @param int    $limit  Query limit of records.
	 * @param int    $offset Offset of records.
	 * @param string $search Search.
	 * @param string $type   Type of records.
	 *
	 * @return array
	 */
	public function get( $limit, $offset = 0, $search = '', $type = '' ) {

		global $wpdb;
		//phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
		return (array) $wpdb->get_results(
			$this->build_query( $limit, $offset, $search, $type )
		);
		//phpcs:enable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
	}

	/**
	 * Build query.
	 *
	 * @since 1.6.3
	 *
	 * @param int    $limit  Query limit of records.
	 * @param int    $offset Offset of records.
	 * @param string $search Search.
	 * @param string $type   Type of records.
	 *
	 * @return string
	 */
	private function build_query( $limit, $offset = 0, $search = '', $type = '' ) {

		global $wpdb;

		$sql   = 'SELECT SQL_CALC_FOUND_ROWS * FROM ' . Repository::get_table_name();
		$where = [];

		if ( ! empty( $search ) ) {
			$where[] = $wpdb->prepare(
				'`title` REGEXP %s OR `message` REGEXP %s',
				$search,
				$search
			);
		}

		if ( ! empty( $type ) ) {
			$where[] = $wpdb->prepare(
				'`types` REGEXP %s',
				$type
			);
		}

		if ( $where ) {
			$sql .= ' WHERE ' . implode( ' AND ', $where );
		}

		$sql .= ' ORDER BY `create_at` DESC, `id` DESC';
		$sql .= $wpdb->prepare( ' LIMIT %d, %d', absint( $offset ), absint( $limit ) );

		return $sql;
	}
}

SILENT KILLER Tool