PluginProbe
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification / 3.0.3
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification v3.0.3
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 / UIPage.class.php

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

151 lines 3.6 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 UIPage
10 */
11 abstract class UIPage {
12 /**
13 * @var string
14 */
15 protected $domain;
16 /**
17 * @var string
18 */
19 protected $slug;
20 /**
21 * @var string
22 */
23 protected $title;
24 /**
25 * @var string
26 */
27 protected $class;
28 /**
29 * @var int
30 */
31 protected $position = 0;
32 /**
33 * @var TemplateHandler
34 */
35 protected TemplateHandler $TemplateHandler;
36
37 /**
38 * __construct method initializes an instance of the class.
39 *
40 * @param TemplateHandler $templateHandler - The TemplateHandler object used for handling templates.
41 * @param string $domain - The domain of the current page.
42 * @param string $slug - The WordPress slug used for the current page.
43 * @param string $title - The title of the sidebar.
44 * @param int $position - (optional) The position of the sidebar. Default is 10.
45 * @param string $class - (optional) The class of the sidebar. Default is an empty string.
46 *
47 * @return void
48 */
49 public function __construct( TemplateHandler $templateHandler, string $domain, string $slug, string $title, int $position = 10, string $class = '' ) {
50 $this->TemplateHandler = $templateHandler;
51 $this->domain = $domain;
52 $this->slug = $slug;
53 $this->title = $title;
54 $this->class = $class;
55 $this->position = $position;
56
57 add_filter( 'f12_cf7_doubleoptin_settings', array( $this, 'getSettings' ) );
58 }
59
60 public function hideInMenu() {
61 return false;
62 }
63
64 public function getPosition() {
65 return $this->position;
66 }
67
68 public function isDashboard() {
69 return $this->getPosition() == 0;
70 }
71
72 public function getDomain() {
73 return $this->domain;
74 }
75
76 public function getSlug() {
77 return $this->slug;
78 }
79
80 public function getTitle() {
81 return $this->title;
82 }
83
84 public function getClass() {
85 return $this->class;
86 }
87
88 /**
89 * @param $settings
90 *
91 * @return mixed
92 */
93 public abstract function getSettings( $settings );
94
95 /**
96 * @param string $slug - The WordPress Slug
97 * @param string $page - The Name of the current Page e.g.: license
98 *
99 * @return void
100 */
101 protected abstract function theSidebar( $slug, $page );
102
103 /**
104 * @param string $slug - The WordPress Slug
105 * @param string $page - The Name of the current Page e.g.: license
106 *
107 * @return void
108 */
109 protected abstract function theContent( $slug, $page, $settings );
110
111 /**
112 * @return void
113 * @private WordPress HOOK
114 */
115 public function renderContent( $slug, $page ) {
116 if ( $this->slug != $page ) {
117 return;
118 }
119
120 $settings = CF7DoubleOptIn::getInstance()->getSettings();
121
122 echo esc_html( Messages::getInstance()->getAll() );
123
124 do_action( 'f12_cf7_doubleoptin_ui_' . $page . '_before_box' );
125 ?>
126 <div class="box">
127 <?php
128 do_action( 'f12_cf7_doubleoptin_ui_' . $page . '_before_content', $settings );
129 $this->theContent( $slug, $page, $settings );
130 do_action( 'f12_cf7_doubleoptin_ui_' . $page . '_after_content', $settings );
131 ?>
132 </div>
133 <?php
134 do_action( 'f12_cf7_doubleoptin_ui_' . $page . '_after_box' );
135 }
136
137 /**
138 * @param string $slug
139 * @param string $page
140 *
141 * @return void
142 * @private WordPress Hook
143 */
144 public function renderSidebar( $slug, $page ) {
145 if ( $this->slug != $page ) {
146 return;
147 }
148 $this->theSidebar( $slug, $page );
149 }
150 }
151 }