| Server IP : 38.190.208.107 / Your IP : 216.73.217.46 Web Server : nginx/1.28.1 System : Linux ht2026040333114 6.1.0-10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.37-1 (2023-07-03) x86_64 User : root ( 0) PHP Version : 8.2.28 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv,eval,assert,passthru,system,exec,shell_exec,popen,proc_open MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/wp.8/wp-content/plugins/fluentform/app/Modules/Entries/ |
Upload File : |
<?php
namespace FluentForm\App\Modules\Entries;
use FluentForm\App\Helpers\Helper;
/**
* @deprecated Use SubmissionService or direct wpFluent() queries instead.
* @todo Remove in next major version.
*/
class EntryQuery
{
protected $request;
protected $formModel;
protected $responseModel;
protected $formId = false;
protected $per_page = 10;
protected $page_number = 1;
protected $status = false;
protected $is_favourite = null;
protected $sort_by = 'ASC';
protected $search = false;
protected $wheres = [];
protected $startDate;
protected $endDate;
public function __construct()
{
_deprecated_function(__CLASS__, '6.2.0', 'FluentForm\App\Models\Submission model or wpFluent() queries');
$this->request = wpFluentForm('request');
$this->formModel = wpFluent()->table('fluentform_forms');
$this->responseModel = wpFluent()->table('fluentform_submissions');
}
public function getResponses()
{
$query = $this->responseModel
->where('form_id', $this->formId)
->orderBy('id', Helper::sanitizeOrderValue($this->sort_by));
if ($this->per_page > 0) {
$query = $query->limit($this->per_page);
}
if ($this->page_number > 0) {
$query = $query->offset(($this->page_number - 1) * $this->per_page);
}
if ($this->is_favourite) {
$query->where('is_favourite', $this->is_favourite);
$query->where('status', '!=', 'trashed');
} else {
if (!$this->status) {
$query->where('status', '!=', 'trashed');
} else {
$query->where('status', $this->status);
}
}
if ($this->startDate && $this->endDate) {
$endDate = $this->endDate . ' 23:59:59';
$query->where('created_at', '>=', $this->startDate);
$query->where('created_at', '<=', $endDate);
}
if ($this->search) {
$searchString = $this->search;
$query->where(function ($q) use ($searchString) {
$q->where('id', 'LIKE', "%{$searchString}%")
->orWhere('response', 'LIKE', "%{$searchString}%")
->orWhere('status', 'LIKE', "%{$searchString}%")
->orWhere('created_at', 'LIKE', "%{$searchString}%");
});
}
if ($this->wheres) {
foreach ($this->wheres as $where) {
if (is_array($where) && count($where) > 1) {
if (count($where) > 2) {
$column = $where[0];
$operator = $where[1];
$value = $where[2];
} else {
$column = $where[0];
$operator = '=';
$value = $where[1];
}
if (is_array($value)) {
$query->whereIn($column, $value);
} else {
$query->where($column, $operator, $value);
}
}
}
}
$total = $query->count();
$responses = $query->get();
$responses = apply_filters('fluentform/get_raw_responses', $responses, $this->formId);
return [
'data' => $responses,
'paginate' => [
'total' => $total,
'per_page' => $this->per_page,
'current_page' => $this->page_number,
'last_page' => ceil($total / $this->per_page),
],
];
}
}