PluginProbe
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification / 2.15
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification v2.15
5.6.0 5.5.0 5.4.0 5.3.2 5.3.1 5.1.6 5.1.5 trunk 2.1.5 2.11 2.12 2.13 2.15 3.0.0 3.0.1 3.0.2 3.0.3 3.0.5 3.0.51 3.0.60 3.0.61 3.0.62 3.0.70 3.0.71 3.0.72 All 35 releases
double-opt-in / core / Pagination.class.php

Pagination.class.php in Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification 2.15, at core/Pagination.class.php

68 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace forge12\contactform7\CF7DoubleOptIn {
4 if (!defined('ABSPATH')) {
5 exit;
6 }
7
8 /**
9 * Class Pagination
10 *
11 * @package forge12\contactform7\CF7DoubleOptIn
12 */
13 class Pagination
14 {
15 private static $_instance = null;
16
17 public static function getInstance()
18 {
19 if (null === self::$_instance) {
20 self::$_instance = new Pagination();
21 }
22 return self::$_instance;
23 }
24
25 private function __construct()
26 {
27 // Add additional actions
28 add_filter('f12_cf7_doubleoptin_pagination_link', array($this, 'buildLink'), 10, 2);
29 }
30
31 public function buildLink($link, $parameter = array())
32 {
33 /*
34 * Default Parameter
35 */
36 $default = array(
37 'perPage' => 10,
38 'pageNum' => 1,
39 );
40
41 if(isset($_GET['perPage'])){
42 $default['perPage'] = (int)$_GET['perPage'];
43 }
44
45 if(isset($_GET['pageNum'])){
46 $default['pageNum'] = (int)$_GET['pageNum'];
47 }
48
49 if(isset($_GET['keyword'])){
50 $default['keyword'] = sanitize_text_field($_GET['keyword']);
51 }
52
53 if(isset($_GET['cf_form_id'])){
54 $default['cf_form_id'] = (int)$_GET['cf_form_id'];
55 }
56
57 $default = array_merge($default, $parameter);
58
59 $default_keypair = array();
60
61 foreach ($default as $key => $value) {
62 $default_keypair[] = $key . '=' . $value;
63 }
64
65 return $link . '?' . implode("&", $default_keypair);
66 }
67 }
68 }