PluginProbe ʕ •ᴥ•ʔ
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI / 3.5.2
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI v3.5.2
3.5.2 3.5.1 3.5.0 3.4.8 3.4.7 3.4.6 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.5.1 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.10 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.6.1 1.6.7 1.7.0 1.7.0.1 1.7.0.2 1.7.0.3 1.7.1 1.7.2 1.7.2.1 1.7.2.2 1.7.3 1.7.4 1.7.5 1.7.5.1 1.7.5.2 1.7.6 1.7.7 1.7.7.1 1.7.7.2 1.7.8 1.7.9 1.8.0 1.8.0.1 1.8.1 1.8.2 1.8.2.1 1.8.2.2 1.8.2.3 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9.0 1.9.0.1 1.9.1 1.9.2 1.9.3 1.9.4 1.9.4.1 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.0.1 2.0.1 2.0.2 2.0.3 2.0.3.1 2.0.4 2.0.4.1 2.0.5 2.0.6 2.0.7 2.0.8 2.0.8.1 2.0.9 3.0.0 3.0.0.1 3.0.1 3.0.2 3.0.3 3.0.3.1 3.0.4 3.0.4.1 3.0.4.2 3.0.5 3.0.5.1 3.0.5.2 3.0.6 3.0.6.1 3.0.7.1 3.0.8 3.0.8.1 3.0.9 3.0.9.1 3.0.9.2 3.0.9.3 3.0.9.4 3.0.9.5 3.1.0 3.1.1 3.1.2 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.3.0 3.4.0 3.4.1 3.4.2 3.4.2.1 3.4.3 3.4.4 3.4.5 trunk 1.0 1.0.1 1.0.2 1.0.3
everest-forms / includes / admin / settings / class-evf-settings-payments.php
everest-forms / includes / admin / settings Last commit date
class-evf-setting-utilities.php 3 months ago class-evf-settings-advanced.php 1 month ago class-evf-settings-email.php 1 month ago class-evf-settings-general.php 3 months ago class-evf-settings-integrations.php 3 months ago class-evf-settings-page.php 3 months ago class-evf-settings-payments.php 1 month ago class-evf-settings-reporting.php 2 years ago class-evf-settings-security.php 3 months ago class-evf-settings-validation.php 11 months ago
class-evf-settings-payments.php
331 lines
1 <?php
2 /**
3 * EverestForms Payments Settings
4 *
5 * @package EverestForms\Admin
6 * @version 1.0.0
7 */
8
9 defined( 'ABSPATH' ) || exit;
10
11 if ( class_exists( 'EVF_Settings_Payments', false ) ) {
12 return new EVF_Settings_Payments();
13 }
14
15 /**
16 * EVF_Settings_Payments.
17 */
18 class EVF_Settings_Payments extends EVF_Settings_Page {
19
20 /**
21 * Constructor.
22 */
23 public function __construct() {
24 if ( defined( 'EFP_PLUGIN_FILE' ) ) {
25 return;
26 }
27
28 $this->id = 'payment';
29 $this->label = __( 'Payments', 'everest-forms' );
30
31 parent::__construct();
32
33 add_action( 'everest_forms_sections_' . $this->id, array( $this, 'output_sections' ) );
34 }
35
36 /**
37 * Get the current active section key.
38 *
39 * @return string
40 */
41 private function get_current_section() {
42 $sections = $this->get_sections();
43 $default = ! empty( $sections ) ? array_key_first( $sections ) : '';
44
45 return isset( $_GET['section'] ) // phpcs:ignore WordPress.Security.NonceVerification
46 ? sanitize_text_field( wp_unslash( $_GET['section'] ) ) // phpcs:ignore WordPress.Security.NonceVerification
47 : $default;
48 }
49
50 /**
51 * Get sections.
52 *
53 * @return array
54 */
55 public function get_sections() {
56 $sections = apply_filters( 'everest_forms_payments_sections', array() );
57
58 if ( ! isset( $sections['payment'] ) ) {
59 $sections = array_merge( array( 'payment' => array( 'label' => __( 'Payment Method', 'everest-forms' ), 'upsell' => true ) ), $sections );
60 }
61
62 return apply_filters( 'everest_forms_get_sections_' . $this->id, $sections );
63 }
64
65 /**
66 * Returns true if at least one real (non-upsell) section exists.
67 *
68 * @return bool
69 */
70 public function has_real_sections() {
71 if ( ! defined( 'EFP_PLUGIN_FILE' ) ) {
72 return true;
73 }
74
75 foreach ( $this->get_sections() as $section ) {
76 if ( ! $this->is_upsell_section( $section ) ) {
77 return true;
78 }
79 }
80 return false;
81 }
82
83 /**
84 * Returns the label string for a section regardless of format.
85 *
86 * @param mixed $section String label or config array.
87 * @return string
88 */
89 private function get_section_label( $section ) {
90 return is_array( $section ) ? ( $section['label'] ?? '' ) : (string) $section;
91 }
92
93 /**
94 * Returns true when a section is an upsell placeholder.
95 *
96 * @param mixed $section String label or config array.
97 * @return bool
98 */
99 private function is_upsell_section( $section ) {
100 return is_array( $section ) && ! empty( $section['upsell'] );
101 }
102
103 /**
104 * Returns true when a section links to an external page.
105 *
106 * @param mixed $section String label or config array.
107 * @return bool
108 */
109 private function is_external_section( $section ) {
110 return is_array( $section ) && ! empty( $section['url'] );
111 }
112
113 /**
114 * Output sections in navigation sidebar.
115 */
116 public function output_sections() {
117 global $current_section;
118
119 $sections = $this->get_sections();
120 $current_section = $this->get_current_section();
121
122 if ( empty( $sections ) ) {
123 return;
124 }
125
126 $lock_icon = '<svg class="evf-sidebar-upsell-icon" width="14" height="14" viewBox="0 0 20 20"
127 fill="none" xmlns="http://www.w3.org/2000/svg"
128 style="vertical-align:middle;margin-left:5px;flex-shrink:0;" aria-hidden="true">
129 <path d="M0 2C0 0.895431 0.895431 0 2 0H18C19.1046 0 20 0.895431 20 2V18C20 19.1046 19.1046 20 18 20H2C0.895431 20 0 19.1046 0 18V2Z" fill="#FF8C39"/>
130 <path d="M10 4.1666L13.5 13.4999H6.5L10 4.1666Z" fill="#EFEFEF"/>
131 <path d="M14.9994 15.833H4.99939V14.167H14.9994V15.833ZM15.0004 13.5H5.00037L4.16638 6.5L10.0004 11.3125L15.8334 6.5L15.0004 13.5Z" fill="white"/>
132 </svg>';
133
134 echo '<ul class="evf-subsections">';
135
136 foreach ( $sections as $id => $section ) {
137 $label = $this->get_section_label( $section );
138 $is_upsell = $this->is_upsell_section( $section );
139 $is_external = $this->is_external_section( $section );
140
141 if ( $is_external ) {
142 $url = $section['url'];
143 } else {
144 $url = add_query_arg(
145 array(
146 'page' => 'evf-settings',
147 'tab' => $this->id,
148 'section' => sanitize_title( $id ),
149 ),
150 admin_url( 'admin.php' )
151 );
152 }
153
154 printf(
155 '<li><a href="%s" class="%s">%s%s</a></li>',
156 esc_url( $url ),
157 esc_attr( $current_section === $id ? 'current' : '' ),
158 esc_html( $label ),
159 $is_upsell ? $lock_icon : '' // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
160 );
161 }
162
163 echo '</ul>';
164 }
165
166 /**
167 * Get settings array for the active section.
168 *
169 * @return array
170 */
171 public function get_settings() {
172 global $current_section;
173
174 $current_section = $this->get_current_section();
175
176 $settings = apply_filters( 'everest_forms_payments_settings_' . $current_section, array() );
177
178 return apply_filters( 'everest_forms_get_settings_' . $this->id, $settings, $current_section );
179 }
180
181 /**
182 * Output the settings.
183 */
184 public function output() {
185 global $current_section;
186
187 $current_section = $this->get_current_section();
188
189 if ( has_action( 'everest_forms_payments_output_' . $current_section ) ) {
190 $GLOBALS['hide_save_button'] = true;
191 do_action( 'everest_forms_payments_output_' . $current_section );
192 return;
193 }
194
195 if ( 'payment' === $current_section ) {
196 $GLOBALS['hide_save_button'] = true;
197 $this->render_payment_method_upsells();
198 return;
199 }
200
201 $settings = $this->get_settings();
202 EVF_Admin_Settings::output_fields( $settings );
203 }
204
205 /**
206 * Renders all payment gateway upsell cards — same flat layout as the Integration settings page.
207 */
208 private function render_payment_method_upsells() {
209 $gateways = EVF_Addon_Upsell::get_upsells_for_category( 'payments', false );
210
211 if ( empty( $gateways ) ) {
212 return;
213 }
214 ?>
215 <div class="everest-forms-options-header">
216 <div class="everest-forms-options-header--top">
217 <span class="evf-forms-options-header-header--top-icon">
218 <?php echo evf_file_get_contents( '/assets/images/settings-icons/payment.svg' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
219 </span>
220 <h3><?php esc_html_e( 'Payment Method', 'everest-forms' ); ?></h3>
221 </div>
222 </div>
223
224 <?php
225 $check_icon = '<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24"'
226 . ' fill="none" stroke="currentColor" stroke-width="2.5"'
227 . ' stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">'
228 . '<polyline points="20 6 9 17 4 12"/>'
229 . '</svg>';
230
231 $pro_badge = '<svg width="14" height="14" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"'
232 . ' style="vertical-align:middle;margin-left:5px;flex-shrink:0;" aria-hidden="true">'
233 . '<path d="M0 2C0 0.895431 0.895431 0 2 0H18C19.1046 0 20 0.895431 20 2V18C20 19.1046 19.1046 20 18 20H2C0.895431 20 0 19.1046 0 18V2Z" fill="#FF8C39"/>'
234 . '<path d="M10 4.1666L13.5 13.4999H6.5L10 4.1666Z" fill="#EFEFEF"/>'
235 . '<path d="M14.9994 15.833H4.99939V14.167H14.9994V15.833ZM15.0004 13.5H5.00037L4.16638 6.5L10.0004 11.3125L15.8334 6.5L15.0004 13.5Z" fill="white"/>'
236 . '</svg>';
237
238 foreach ( $gateways as $id => $gateway ) :
239 $title = $gateway['label'] ?? '';
240 $icon = $gateway['icon'] ?? '';
241 $features = $gateway['features'] ?? array();
242 $upgrade_url = $gateway['upgrade_url'] ?? 'https://wpeverest.com/wordpress-plugins/everest-forms/pricing/';
243 $video_id = $gateway['vedio_id'] ?? '';
244 $docs_url = $gateway['docs_url'] ?? 'https://docs.everestforms.net/docs/';
245 ?>
246 <div class="evf-upsell-integration-card">
247 <div class="evf-upsell-card-header">
248 <?php if ( $icon ) : ?>
249 <span class="evf-upsell-icon">
250 <img src="<?php echo esc_url( $icon ); ?>" alt="<?php echo esc_attr( $title ); ?>">
251 </span>
252 <?php endif; ?>
253 <div class="evf-upsell-card-heading">
254 <h3><?php echo esc_html( $title ); ?></h3>
255 </div>
256 <span class="evf-upsell-lock-icon">
257 <?php echo $pro_badge; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
258 </span>
259 </div>
260
261 <?php if ( ! empty( $features ) ) : ?>
262 <hr class="evf-upsell-divider">
263 <ul class="evf-upsell-features">
264 <?php foreach ( $features as $feature ) : ?>
265 <li><?php echo $check_icon; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?><?php echo esc_html( $feature ); ?></li>
266 <?php endforeach; ?>
267 </ul>
268 <?php endif; ?>
269
270 <div class="evf-upsell-actions">
271 <a href="<?php echo esc_url( $upgrade_url ); ?>"
272 class="evf-upsell-btn evf-upsell-btn-primary"
273 target="_blank" rel="noopener noreferrer">
274 <?php
275 printf(
276 /* translators: %s: payment gateway name */
277 esc_html__( 'Unlock %s — Upgrade to Pro', 'everest-forms' ),
278 esc_html( $title )
279 );
280 ?>
281 <svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24"
282 fill="none" stroke="currentColor" stroke-width="2"
283 stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
284 <line x1="7" y1="17" x2="17" y2="7"/>
285 <polyline points="7 7 17 7 17 17"/>
286 </svg>
287 </a>
288
289 <?php if ( $video_id ) : ?>
290 <a href="<?php echo esc_url( 'https://www.youtube.com/watch?v=' . $video_id ); ?>"
291 class="evf-upsell-btn evf-upsell-upgrade-trigger"
292 data-name="<?php echo esc_attr( $title ); ?>"
293 data-links="<?php echo esc_attr( $video_id ); ?>"
294 data-upgrade-url="<?php echo esc_url( $upgrade_url ); ?>">
295 <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24"
296 fill="currentColor" aria-hidden="true">
297 <path d="M10 16.5l6-4.5-6-4.5v9zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"/>
298 </svg>
299 <?php esc_html_e( 'Watch Demo', 'everest-forms' ); ?>
300 </a>
301 <?php endif; ?>
302
303 <a href="<?php echo esc_url( $docs_url ); ?>"
304 class="evf-upsell-btn evf-upsell-btn-ghost"
305 target="_blank" rel="noopener noreferrer">
306 <?php esc_html_e( 'View Documentation', 'everest-forms' ); ?>
307 </a>
308 </div>
309 </div>
310 <?php endforeach;
311 }
312
313 /**
314 * Save settings.
315 */
316 public function save() {
317 global $current_section;
318
319 $current_section = $this->get_current_section();
320
321 if ( has_action( 'everest_forms_payments_output_' . $current_section ) ) {
322 return;
323 }
324
325 $settings = $this->get_settings();
326 EVF_Admin_Settings::save_fields( $settings );
327 }
328 }
329
330 return new EVF_Settings_Payments();
331