PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.32.1
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.32.1
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
formidable / classes / helpers / FrmSettingsUpsellHelper.php

FrmSettingsUpsellHelper.php in Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More 6.32.1, at classes/helpers/FrmSettingsUpsellHelper.php

94 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 die( 'You are not allowed to call this page directly.' );
4 }
5
6 /**
7 * Helper class for displaying upsell controls.
8 *
9 * @since 6.30
10 */
11 class FrmSettingsUpsellHelper {
12 /**
13 * @since 6.30
14 *
15 * @param array $field
16 *
17 * @return array
18 */
19 public static function get_unique_element_atts( $field ) {
20 $unique_element_atts = array(
21 'type' => 'checkbox',
22 'name' => 'field_options[unique_' . $field['id'] . ']',
23 'id' => 'frm_uniq_field_' . $field['id'],
24 'value' => '1',
25 'class' => 'frm_mark_unique',
26 );
27
28 if ( FrmAppHelper::pro_is_installed() ) {
29 if ( ! empty( $field['unique'] ) ) {
30 $unique_element_atts['checked'] = 'checked';
31 }
32
33 return $unique_element_atts;
34 }
35
36 $unique_element_atts['data-upgrade'] = __( 'Unique fields', 'formidable' );
37 $unique_element_atts['disabled'] = '1';
38 $unique_element_atts['readonly'] = '1';
39
40 return $unique_element_atts;
41 }
42
43 /**
44 * @since 6.30
45 *
46 * @param array $field
47 *
48 * @return array
49 */
50 public static function get_read_only_element_atts( $field ) {
51 $read_only_element_atts = array(
52 'type' => 'checkbox',
53 'name' => 'field_options[read_only_' . $field['id'] . ']',
54 'id' => 'frm_read_only_field_' . $field['id'],
55 'value' => '1',
56 );
57
58 if ( ! empty( $field['read_only'] ) ) {
59 $read_only_element_atts['checked'] = 'checked';
60 }
61
62 if ( ! FrmAppHelper::pro_is_installed() ) {
63 $read_only_element_atts['data-upgrade'] = __( 'Read only fields', 'formidable' );
64 $read_only_element_atts['disabled'] = '1';
65 }
66
67 return $read_only_element_atts;
68 }
69
70 /**
71 * @since 6.30
72 *
73 * @param array $atts
74 * @param string $utm_content
75 * @param string $upgrade_text
76 * @param string $kb_slug
77 *
78 * @return array
79 */
80 public static function add_upgrade_modal_atts( $atts, $utm_content, $upgrade_text, $kb_slug = '' ) {
81 if ( empty( $atts['class'] ) ) {
82 $atts['class'] = '';
83 }
84
85 $atts['class'] .= ' frm_show_upgrade';
86 $atts['data-medium'] = 'lite';
87 $atts['data-content'] = $utm_content;
88 $atts['data-upgrade'] = $upgrade_text;
89 $atts['data-learn-more'] = 'https://formidableforms.com/knowledgebase' . $kb_slug;
90
91 return $atts;
92 }
93 }
94