Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/wpforms-.../src/Logger
File: RecordQuery.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace WPForms\Logger;
[2] Fix | Delete
[3] Fix | Delete
/**
[4] Fix | Delete
* Class RecordQuery.
[5] Fix | Delete
*
[6] Fix | Delete
* @since 1.6.3
[7] Fix | Delete
*/
[8] Fix | Delete
class RecordQuery {
[9] Fix | Delete
[10] Fix | Delete
/**
[11] Fix | Delete
* Build query.
[12] Fix | Delete
*
[13] Fix | Delete
* @since 1.6.3
[14] Fix | Delete
*
[15] Fix | Delete
* @param int $limit Query limit of records.
[16] Fix | Delete
* @param int $offset Offset of records.
[17] Fix | Delete
* @param string $search Search.
[18] Fix | Delete
* @param string $type Type of records.
[19] Fix | Delete
*
[20] Fix | Delete
* @return array
[21] Fix | Delete
*/
[22] Fix | Delete
public function get( $limit, $offset = 0, $search = '', $type = '' ) {
[23] Fix | Delete
[24] Fix | Delete
global $wpdb;
[25] Fix | Delete
//phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching
[26] Fix | Delete
//phpcs:disable WordPress.DB.PreparedSQL.NotPrepared
[27] Fix | Delete
return (array) $wpdb->get_results(
[28] Fix | Delete
$this->build_query( $limit, $offset, $search, $type )
[29] Fix | Delete
);
[30] Fix | Delete
//phpcs:enable WordPress.DB.DirectDatabaseQuery.NoCaching
[31] Fix | Delete
//phpcs:enable WordPress.DB.PreparedSQL.NotPrepared
[32] Fix | Delete
}
[33] Fix | Delete
[34] Fix | Delete
/**
[35] Fix | Delete
* Build query.
[36] Fix | Delete
*
[37] Fix | Delete
* @since 1.6.3
[38] Fix | Delete
*
[39] Fix | Delete
* @param int $limit Query limit of records.
[40] Fix | Delete
* @param int $offset Offset of records.
[41] Fix | Delete
* @param string $search Search.
[42] Fix | Delete
* @param string $type Type of records.
[43] Fix | Delete
*
[44] Fix | Delete
* @return string
[45] Fix | Delete
*/
[46] Fix | Delete
private function build_query( $limit, $offset = 0, $search = '', $type = '' ) {
[47] Fix | Delete
[48] Fix | Delete
global $wpdb;
[49] Fix | Delete
[50] Fix | Delete
$sql = 'SELECT SQL_CALC_FOUND_ROWS * FROM ' . Repository::get_table_name();
[51] Fix | Delete
$where = [];
[52] Fix | Delete
[53] Fix | Delete
if ( ! empty( $search ) ) {
[54] Fix | Delete
$where[] = $wpdb->prepare(
[55] Fix | Delete
'`title` REGEXP %s OR `message` REGEXP %s',
[56] Fix | Delete
$search,
[57] Fix | Delete
$search
[58] Fix | Delete
);
[59] Fix | Delete
}
[60] Fix | Delete
[61] Fix | Delete
if ( ! empty( $type ) ) {
[62] Fix | Delete
$where[] = $wpdb->prepare(
[63] Fix | Delete
'`types` REGEXP %s',
[64] Fix | Delete
$type
[65] Fix | Delete
);
[66] Fix | Delete
}
[67] Fix | Delete
[68] Fix | Delete
if ( $where ) {
[69] Fix | Delete
$sql .= ' WHERE ' . implode( ' AND ', $where );
[70] Fix | Delete
}
[71] Fix | Delete
[72] Fix | Delete
$sql .= ' ORDER BY `create_at` DESC, `id` DESC';
[73] Fix | Delete
$sql .= $wpdb->prepare( ' LIMIT %d, %d', absint( $offset ), absint( $limit ) );
[74] Fix | Delete
[75] Fix | Delete
return $sql;
[76] Fix | Delete
}
[77] Fix | Delete
}
[78] Fix | Delete
[79] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function