C:\xampp\htdocs\landing\wp-content\plugins\wpforms-lite\src\Logger\RecordQuery.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php

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.NoCaching
        //phpcs:disable WordPress.DB.PreparedSQL.NotPrepared
        
return (array) $wpdb->get_results(
            
$this->build_query$limit$offset$search$type )
        );
        
//phpcs:enable WordPress.DB.DirectDatabaseQuery.NoCaching
        //phpcs:enable 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 `id` DESC';
        
$sql .= $wpdb->prepare' LIMIT %d, %d'absint$offset ), absint$limit ) );

        return 
$sql;
    }
}
x

Windows NT KPTV 6.2 build 9200 (Windows Server 2012 Datacenter Edition) i586