PluginProbe
Fluent Support – Helpdesk & Customer Support Ticket System / 2.4.5
Fluent Support – Helpdesk & Customer Support Ticket System v2.4.5
2.4.5 2.4.0 2.3.2 2.3.1 2.3.0 2.2.1 2.2.0 trunk 1.10.0 1.10.1 1.10.2 1.10.3 1.10.4 1.10.5 1.4.0 1.4.1 1.4.2 1.4.5 1.4.6 1.4.7 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 All 69 releases
fluent-support / app / Models / Model.php

Model.php in Fluent Support – Helpdesk & Customer Support Ticket System 2.4.5, at app/Models/Model.php

52 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentSupport\App\Models;
4
5 use FluentSupport\Framework\Database\Orm\Model as BaseModel;
6
7 class Model extends BaseModel
8 {
9 protected $guarded = ['id', 'ID'];
10
11 public function __construct($attributes = [])
12 {
13 parent::__construct($attributes);
14 }
15
16 /**
17 * Dates go out as stored: site time, "Y-m-d H:i:s", like every other date
18 * column. The framework default is an ISO UTC moment, which made
19 * created_at/updated_at the only dates in another format.
20 *
21 * @param \DateTimeInterface $date
22 * @return string
23 */
24 protected function serializeDate(\DateTimeInterface $date)
25 {
26 if ($date instanceof \DateTime || $date instanceof \DateTimeImmutable) {
27 $date = (clone $date)->setTimezone(wp_timezone());
28 }
29
30 return $date->format('Y-m-d H:i:s');
31 }
32
33 public function getPerPage()
34 {
35 if (!isset($_REQUEST['per_page'])) {
36 return 15;
37 }
38
39 if (isset($_REQUEST['nonce'])) {
40 $nonceAction = (defined('REST_REQUEST') && REST_REQUEST) ? 'wp_rest' : 'fluent-support';
41
42 if (!wp_verify_nonce(sanitize_text_field(wp_unslash($_REQUEST['nonce'])), $nonceAction)) {
43 return 15;
44 }
45 } elseif (is_admin() || wp_doing_ajax() || (defined('REST_REQUEST') && REST_REQUEST)) {
46 return intval(sanitize_text_field(wp_unslash($_REQUEST['per_page']))) ?? 15;
47 }
48
49 return intval(sanitize_text_field(wp_unslash($_REQUEST['per_page'])));
50 }
51 }
52