GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
class-gv-collection-entry-offset.php
Go to the documentation of this file.
1 <?php
2 namespace GV;
3 
4 /** If this file is called directly, abort. */
5 if ( ! defined( 'GRAVITYVIEW_DIR' ) ) {
6  die();
7 }
8 
9 /**
10  * Filtering window settings:
11  *
12  * Offset and limit, pagination.
13  */
14 class Entry_Offset {
15 
16  /** @var int The offset. */
17  public $offset = 0;
18 
19  /** @var int The limit. */
20  public $limit = 20;
21 
22  /**
23  * Return a search_criteria format for this offset.
24  *
25  * @param int $page The page. Default: 1
26  *
27  * @return array ['page_size' => N, 'offset' => N]
28  */
29  public function to_paging( $page = 1 ) {
30  return array(
31  'page_size' => $this->limit,
32  'offset' => ( ( $page - 1 ) * $this->limit ) + $this->offset,
33  );
34  }
35 }
to_paging( $page=1)
Return a search_criteria format for this offset.
If this file is called directly, abort.