PluginProbe
weForms – Easy Drag & Drop Contact Form Builder For WordPress / 1.1.0
weForms – Easy Drag & Drop Contact Form Builder For WordPress v1.1.0
1.6.7 1.6.8 1.6.9 1.6.12 1.6.13 1.6.14 1.6.15 1.6.16 1.6.17 1.6.18 1.6.19 1.6.2 1.6.20 1.6.21 1.6.22 1.6.23 1.6.24 1.6.25 1.6.26 1.6.27 1.6.28 1.6.3 1.6.4 1.6.5 1.6.6 All 74 releases
weforms / includes / templates / class-abstract-template.php

class-abstract-template.php in weForms – Easy Drag & Drop Contact Form Builder For WordPress 1.1.0, at includes/templates/class-abstract-template.php

204 lines 4.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Form template abstract class
5 *
6 * @since 1.1.0
7 */
8 abstract class WeForms_Form_Template {
9
10 /**
11 * If the form is enabled
12 *
13 * @var boolean
14 */
15 public $enabled = true;
16
17 /**
18 * Template title
19 *
20 * @var string
21 */
22 public $title;
23
24 /**
25 * Template description
26 *
27 * @var string
28 */
29 public $description;
30
31 /**
32 * Conditional logic
33 *
34 * @var array
35 */
36 protected $conditionals;
37
38 /**
39 * Form fields
40 *
41 * @var array
42 */
43 protected $form_fields;
44
45 /**
46 * Form settings
47 *
48 * @var array
49 */
50 protected $form_settings;
51
52 /**
53 * Form Template Category
54 *
55 * @var array
56 */
57 public $category = 'default';
58
59
60 /**
61 * Form Template Image
62 *
63 * @var array
64 */
65 public $image;
66
67 /**
68 * Form notifications
69 *
70 * @since 2.5.2
71 *
72 * @var array
73 */
74 protected $form_notifications;
75
76 public function __construct() {
77 $this->conditionals = array(
78 'condition_status' => 'no',
79 'cond_field' => array(),
80 'cond_operator' => array( '=' ),
81 'cond_option' => array( '- select -' ),
82 'cond_logic' => 'all'
83 );
84 }
85
86 /**
87 * Get the template title
88 *
89 * @return string
90 */
91 public function get_title() {
92 return $this->title;
93 }
94
95 /**
96 * Get the description
97 *
98 * @return string
99 */
100 public function get_description() {
101 return $this->description;
102 }
103
104 /**
105 * Get the form fields
106 *
107 * @return array
108 */
109 public function get_form_fields() {
110 return $this->form_fields;
111 }
112
113 /**
114 * Get all available fields
115 *
116 * @return array
117 */
118 public function get_available_fields() {
119 return weforms()->fields->get_fields();
120 }
121
122 /**
123 * Get the form settings
124 *
125 * @return array
126 */
127 public function get_form_settings() {
128 return $this->get_default_settings();
129 }
130
131 /**
132 * Get form notifications
133 *
134 * @since 2.5.2
135 *
136 * @return array
137 */
138 public function get_form_notifications() {
139 return $this->get_default_notification();
140 }
141
142 /**
143 * Check if the template is enabled
144 *
145 * @return boolean
146 */
147 public function is_enabled() {
148 return $this->enabled;
149 }
150
151 /**
152 * Get default settings
153 *
154 * @return array
155 */
156 public function get_default_settings() {
157 return array(
158 'redirect_to' => 'same',
159 'message' => __( 'Thanks for contacting us! We will get in touch with you shortly.', 'weforms' ),
160 'page_id' => '',
161 'url' => '',
162 'submit_text' => __( 'Submit Query', 'weforms' ),
163 'schedule_form' => 'false',
164 'schedule_start' => '',
165 'schedule_end' => '',
166 'sc_pending_message' => __( 'Form submission hasn\'t been started yet', 'weforms' ),
167 'sc_expired_message' => __( 'Form submission is now closed.', 'weforms' ),
168 'require_login' => 'false',
169 'req_login_message' => __( 'You need to login to submit a query.', 'weforms' ),
170 'limit_entries' => 'false',
171 'limit_number' => '100',
172 'limit_message' => __( 'Sorry, we have reached the maximum number of submissions.', 'weforms' ),
173 'label_position' => 'above',
174
175 'enable_multistep' => false,
176 'multistep_progressbar_type' => 'progressive',
177 );
178 }
179
180 /**
181 * Get notifications of contact form template
182 *
183 * @return array
184 */
185 function get_default_notification() {
186 return array(
187 array(
188 'active' => 'true',
189 'name' => __( 'Admin Notification', 'weforms' ),
190 'subject' => '[{form_name}] ' . __( 'New Form Submission', 'weforms' ) . ' #{entry_id}',
191 'to' => '{admin_email}',
192 'replyTo' => '{field:email}',
193 'message' => '{all_fields}',
194 'fromName' => '{site_name}',
195 'fromAddress' => '{admin_email}',
196 'cc' => '',
197 'bcc' => '',
198 ),
199 );
200 }
201
202 }
203
204