PluginProbe
JetFormBuilder — Dynamic Blocks Form Builder / 3.6.5.3
JetFormBuilder — Dynamic Blocks Form Builder v3.6.5.3
3.6.5.3 3.6.5.2 3.6.5.1 3.6.5 3.6.4.2 3.6.4.1 3.6.4 3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 All 131 releases
jetformbuilder / components / rest-api / traits / paginated-args.php

paginated-args.php in JetFormBuilder — Dynamic Blocks Form Builder 3.6.5.3, at components/rest-api/traits/paginated-args.php

27 lines 556 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3
4 namespace JFB_Components\Rest_Api\Traits;
5
6 use Jet_Form_Builder\Db_Queries\Views\View_Base;
7
8 // If this file is called directly, abort.
9 if ( ! defined( 'WPINC' ) ) {
10 die;
11 }
12
13 trait Paginated_Args {
14
15 protected function get_paginate_args( \WP_REST_Request $request ) {
16 $body = $request->get_query_params();
17
18 return array(
19 'limit' => (int) ( $body['limit'] ?? 5 ),
20 'sort' => $body['sort'] ?? View_Base::FROM_HIGH_TO_LOW,
21 'page' => (int) ( $body['page'] ?? 1 ),
22 'filters' => (array) ( $body['filters'] ?? array() ),
23 );
24 }
25
26 }
27