function gettplInvoicesList($params = array(), $response = array()) { global $wpdb; $table_name = TemplateData::get_tpl_invoices_table_name(); $query = "SELECT id, form_id, is_active, meta FROM {$table_name}"; $where = ""; if (isset($params['where'])) { $where[] = $params['where']; } if (!empty($where)) { $query .= " where " . implode(" and ", $where); } $response = $wpdb->get_results($query, ARRAY_A); if (empty($response)) { return array(); } $response = $response[0]; $response["meta"] = maybe_unserialize($response["meta"]); return $response; }