PluginProbe ʕ •ᴥ•ʔ
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress / 3.1
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress v3.1
4.16.19 4.16.18 4.16.17 4.16.16 trunk 1.0 1.0.1 1.0.2 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.5a 1.1.6 1.1.7 1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.4 1.4.1 1.4.2 1.5 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.6 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.7 1.7.1 1.7.2 1.8 1.8.1 1.8.10 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9 1.9.1 1.9.10 1.9.11 1.9.12 1.9.13 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.1.9 2.2.10 2.2.11 2.2.12 2.2.13 2.2.14 2.2.15 2.2.16 2.2.2 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 3.0 3.1 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 3.1.19 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.10 3.2.11 3.2.12 3.2.13 3.2.14 3.2.15 3.2.16 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 4.0.0 4.0.1 4.0.2 4.0.3 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.10.0 4.10.1 4.10.2 4.10.3 4.11.0 4.12.0 4.13.0 4.13.1 4.13.2 4.13.3 4.13.4 4.14.0 4.14.1 4.14.2 4.14.3 4.14.4 4.15.0 4.15.1 4.15.10 4.15.11 4.15.12 4.15.13 4.15.14 4.15.15 4.15.16 4.15.17 4.15.18 4.15.19 4.15.2 4.15.20 4.15.20.1 4.15.21 4.15.22 4.15.23 4.15.24 4.15.25 4.15.3 4.15.4 4.15.5 4.15.6 4.15.7 4.15.8 4.15.9 4.16.0 4.16.1 4.16.10 4.16.11 4.16.12 4.16.13 4.16.14 4.16.15 4.16.2 4.16.3 4.16.4 4.16.5 4.16.6 4.16.7 4.16.8 4.16.9 4.2.0 4.3.0 4.3.1 4.3.2 4.4.0 4.4.1 4.5.0 4.5.1 4.5.2 4.5.3 4.5.4 4.5.5 4.6.0 4.7.0 4.8.0 4.9.0
wp-user-avatar / src / Themes / DragDrop / AbstractBuildScratch.php
wp-user-avatar / src / Themes / DragDrop Last commit date
EditProfile 5 years ago Login 5 years ago MemberDirectory 5 years ago PasswordReset 5 years ago Registration 5 years ago UserProfile 5 years ago AbstractBuildScratch.php 5 years ago AbstractMemberDirectoryTheme.php 5 years ago AbstractTheme.php 5 years ago FieldListing.php 5 years ago MemberDirectoryListing.php 5 years ago ProfileFieldListing.php 5 years ago ThemeInterface.php 5 years ago ThemesRepository.php 5 years ago index.php 5 years ago
AbstractBuildScratch.php
848 lines
1 <?php
2
3 namespace ProfilePress\Core\Themes\DragDrop;
4
5 use ProfilePress\Core\Admin\SettingsPages\DragDropBuilder\FieldBase;
6 use ProfilePress\Core\Classes\FormRepository as FR;
7
8 abstract class AbstractBuildScratch extends AbstractTheme
9 {
10 public function __construct($form_id, $form_type)
11 {
12 parent::__construct($form_id, $form_type);
13
14 add_filter('ppress_form_builder_field_settings', [$this, 'add_field_properties'], 10, 2);
15
16 add_filter('ppress_form_after_field_listing', [$this, 'add_field_icon'], 10, 2);
17 }
18
19 public function add_field_icon($output, $raw_field_setting)
20 {
21 if (isset($raw_field_setting['password_visibility_icon']) && $raw_field_setting['password_visibility_icon'] === true) {
22 $raw_field_setting['icon'] = 'visibility';
23 }
24
25 if (isset($raw_field_setting['icon']) && ! empty($raw_field_setting['icon'])) {
26 $output .= sprintf('<i class="pp-form-material-icons">%s</i>', $raw_field_setting['icon']);
27 }
28
29 return $output;
30 }
31
32 /**
33 * @param $field
34 * @param FieldBase $fieldBaseInstance
35 *
36 * @return mixed
37 */
38 public function add_field_properties($field, $fieldBaseInstance)
39 {
40 $field_type = $fieldBaseInstance->field_type();
41
42 if ( ! in_array($fieldBaseInstance->field_type(), $this->disallowed_settings_fields())) {
43
44 if (isset($field[FieldBase::GENERAL_TAB])) {
45
46 $column_fields = [];
47
48 if ( ! isset($field[FieldBase::GENERAL_TAB]['label'])) {
49 $column_fields['label'] = [
50 'label' => esc_html__('Label', 'wp-user-avatar'),
51 'field' => FieldBase::INPUT_FIELD,
52 ];
53 } else {
54 $column_fields['label'] = $field[FieldBase::GENERAL_TAB]['label'];
55 unset($field[FieldBase::GENERAL_TAB]['label']);
56 }
57
58 if (isset($field[FieldBase::GENERAL_TAB]['placeholder'])) {
59 $column_fields['placeholder'] = $field[FieldBase::GENERAL_TAB]['placeholder'];
60 unset($field[FieldBase::GENERAL_TAB]['placeholder']);
61 }
62
63 $field[FieldBase::GENERAL_TAB] = array_merge(
64 [FieldBase::COLUMN_SETTINGS => $column_fields],
65 $field[FieldBase::GENERAL_TAB]
66 );
67
68 $field[FieldBase::GENERAL_TAB]['description'] = [
69 'label' => esc_html__('Description', 'wp-user-avatar'),
70 'field' => FieldBase::TEXTAREA_FIELD,
71 ];
72 }
73
74 if (isset($field[FieldBase::STYLE_TAB])) {
75
76 $class_settings = $field[FieldBase::STYLE_TAB]['class'];
77
78 unset($field[FieldBase::STYLE_TAB]['class']);
79
80 $field[FieldBase::STYLE_TAB][FieldBase::COLUMN_SETTINGS] = [];
81
82 $field[FieldBase::STYLE_TAB][FieldBase::COLUMN_SETTINGS]['field_width'] = [
83 'label' => esc_html__('Width', 'wp-user-avatar'),
84 'options' => [
85 'full' => esc_html__('Full', 'wp-user-avatar'),
86 'half' => esc_html__('Half', 'wp-user-avatar'),
87 'third' => esc_html__('One Third', 'wp-user-avatar'),
88 ],
89 'field' => FieldBase::SELECT_FIELD,
90 ];
91
92 // the str_replace sorcery/ritual checks if field type does not contains any of the strings https://stackoverflow.com/a/42311760/2648410
93 if (str_replace(['-select-role', '-select-dropdown', '-checkbox-list', '-radio-buttons', '-single-checkbox', '-country', '-cpf-agreeable', '-cpf-checkbox', '-cpf-radio', '-cpf-select'], '', $field_type) == $field_type) {
94 $field[FieldBase::STYLE_TAB][FieldBase::COLUMN_SETTINGS]['icon'] = [
95 'label' => esc_html__('Icon', 'wp-user-avatar'),
96 'field' => FieldBase::ICON_PICKER_FIELD,
97 ];
98 }
99
100 // if not password meter and password related field
101 if (str_replace(['-password-meter'], '', $field_type) == $field_type && str_replace(['-password'], '', $field_type) != $field_type) {
102
103 $field[FieldBase::STYLE_TAB]['password_visibility_icon'] = [
104 'label' => esc_html__('Enable Password Visibility Icon', 'wp-user-avatar'),
105 'description' => esc_html__('Check to enable visibility icon which when clicked, hides or shows a password.', 'wp-user-avatar'),
106 'type' => 'checkbox',
107 'field' => FieldBase::INPUT_FIELD,
108 ];
109 }
110
111 if (str_replace(['-checkbox', '-radio', '-country', '-select'], '', $field_type) == $field_type) {
112 $field[FieldBase::STYLE_TAB][FieldBase::COLUMN_2_SETTINGS]['label_display'] = [
113 'label' => esc_html__('Label Display', 'wp-user-avatar'),
114 'options' => [
115 'above' => esc_html__('Above', 'wp-user-avatar'),
116 'inside' => esc_html__('Inside', 'wp-user-avatar')
117 ],
118 'field' => FieldBase::SELECT_FIELD,
119 ];
120 }
121
122 $field[FieldBase::STYLE_TAB][FieldBase::COLUMN_2_SETTINGS]['description_appearance'] = [
123 'label' => esc_html__('Description Appearance', 'wp-user-avatar'),
124 'options' => [
125 'standard' => esc_html__('Standard', 'wp-user-avatar'),
126 'reveal' => esc_html__('Reveal on Focus', 'wp-user-avatar'),
127 'tooltip' => esc_html__('Tooltip', 'wp-user-avatar'),
128 ],
129 'field' => FieldBase::SELECT_FIELD,
130 ];
131
132 $field[FieldBase::STYLE_TAB]['class'] = $class_settings;
133 }
134 }
135
136 return $field;
137 }
138
139 public function social_login_buttons()
140 {
141 $html = '';
142
143 if ( ! $this->is_show_social_login()) return $html;
144
145 $active_social_logins = array_filter($this->get_meta('buildscratch_form_social_buttons'));
146
147 foreach ($active_social_logins as $active_social_login) {
148 $html .= "[pp-social-button type=$active_social_login]";
149 }
150
151 return $html;
152 }
153
154 public function default_metabox_settings()
155 {
156 $default_headline = esc_html__('Create an Account', 'wp-user-avatar');
157
158 switch ($this->form_type) {
159 case FR::LOGIN_TYPE:
160 $default_headline = esc_html__('Sign in to Your Account', 'wp-user-avatar');
161 break;
162 case FR::PASSWORD_RESET_TYPE:
163 $default_headline = esc_html__('Reset Your Password', 'wp-user-avatar');
164 break;
165 case FR::EDIT_PROFILE_TYPE:
166 $default_headline = esc_html__('Edit Your Profile', 'wp-user-avatar');
167 break;
168 }
169
170 $data = parent::default_metabox_settings();
171 $data['buildscratch_form_width'] = '400px';
172 $data['buildscratch_form_font_family'] = 'Merriweather';
173 $data['buildscratch_remove_form_frame'] = 'false';
174 $data['buildscratch_hide_required_asterisk'] = 'false';
175 $data['buildscratch_form_bg_color'] = '#ffffff';
176 $data['buildscratch_form_social_buttons'] = ['facebook', 'twitter', 'google'];
177 $data['buildscratch_form_headline'] = $default_headline;
178 $data['buildscratch_forgot_password_label'] = esc_html__('Lost your password?', 'wp-user-avatar');
179 $data['buildscratch_signup_label'] = esc_html__('Register', 'wp-user-avatar');
180 $data['buildscratch_login_label'] = esc_html__('Login', 'wp-user-avatar');
181 if ($this->form_type == FR::REGISTRATION_TYPE) {
182 $data['buildscratch_login_label'] = esc_html__("Have an account? Login", 'wp-user-avatar');
183 }
184
185 if ($this->form_type == FR::PASSWORD_RESET_TYPE) {
186 $data['buildscratch_login_label'] = esc_html__("Return to Login", 'wp-user-avatar');
187 }
188
189 $data['buildscratch_field_layout'] = 'round';
190 $data['buildscratch_label_field_size'] = 'small';
191 $data['buildscratch_label_field_icon_alignment'] = 'right';
192 $data['buildscratch_field_icon_color'] = '#666666';
193 $data['buildscratch_field_border_color'] = '#dbdbdb';
194 $data['buildscratch_field_border_focus_color'] = '#999999';
195 $data['buildscratch_field_bg_color'] = '#ffffff';
196 $data['buildscratch_field_bg_focus_color'] = '#ffffff';
197
198 $data['buildscratch_label_color'] = '#444444';
199 $data['buildscratch_label_font_size'] = '14';
200 $data['buildscratch_label_font_weight'] = 'bold';
201 $data['buildscratch_description_color'] = '#666666';
202 $data['buildscratch_description_alignment'] = 'left';
203 $data['buildscratch_field_value_font_size'] = '14';
204 $data['buildscratch_field_value_color'] = '#69717a';
205 $data['buildscratch_field_placeholder_color'] = '#999999';
206
207 $data['buildscratch_submit_button_layout'] = 'round';
208 $data['buildscratch_submit_button_width'] = 'auto';
209 $data['buildscratch_submit_button_font_size'] = '16';
210 $data['buildscratch_submit_button_font_weight'] = 'bold';
211 $data['buildscratch_submit_button_bg_color'] = '#000000';
212 $data['buildscratch_submit_button_text_color'] = '#ffffff';
213 $data['buildscratch_submit_button_bg_focus_color'] = '#dbdbdb';
214 $data['buildscratch_submit_button_text_focus_color'] = '#000000';
215
216 return $data;
217 }
218
219 public function appearance_settings($settings)
220 {
221 $settings[] = [
222 'id' => 'buildscratch_form_width',
223 'type' => 'text',
224 'label' => esc_html__('Width', 'wp-user-avatar'),
225 'priority' => 10
226 ];
227
228 $settings[] = [
229 'id' => 'buildscratch_form_bg_color',
230 'type' => 'color',
231 'label' => esc_html__('Background', 'wp-user-avatar'),
232 'priority' => 20
233 ];
234
235 $settings[] = [
236 'id' => 'buildscratch_form_font_family',
237 'type' => 'font_family',
238 'label' => esc_html__('Font Family', 'wp-user-avatar'),
239 'priority' => 30
240 ];
241
242 $settings[] = [
243 'id' => 'buildscratch_form_headline',
244 'type' => 'text',
245 'label' => esc_html__('Headline', 'wp-user-avatar'),
246 'priority' => 35
247 ];
248
249 if (in_array($this->form_type, [FR::LOGIN_TYPE])) {
250 $settings[] = [
251 'id' => 'buildscratch_forgot_password_label',
252 'type' => 'text',
253 'label' => esc_html__('Forgot Password Label', 'wp-user-avatar'),
254 'priority' => 37
255 ];
256 }
257
258
259 if (in_array($this->form_type, [FR::LOGIN_TYPE])) {
260 $settings[] = [
261 'id' => 'buildscratch_signup_label',
262 'type' => 'text',
263 'label' => esc_html__('Sign Up Label', 'wp-user-avatar'),
264 'priority' => 39
265 ];
266 }
267
268
269 if (in_array($this->form_type, [FR::REGISTRATION_TYPE, FR::PASSWORD_RESET_TYPE])) {
270 $settings[] = [
271 'id' => 'buildscratch_login_label',
272 'type' => 'text',
273 'label' => esc_html__('Login Label', 'wp-user-avatar'),
274 'priority' => 39
275 ];
276 }
277
278 if ($this->is_show_social_login()) {
279
280 $settings[] = [
281 'id' => 'buildscratch_form_social_buttons',
282 'type' => 'select2',
283 'options' => [
284 'facebook' => esc_html__('Facebook', 'wp-user-avatar'),
285 'twitter' => esc_html__('Twitter', 'wp-user-avatar'),
286 'google' => esc_html__('Google', 'wp-user-avatar'),
287 'linkedin' => esc_html__('LinkedIn', 'wp-user-avatar'),
288 'github' => esc_html__('GitHub', 'wp-user-avatar'),
289 'vk' => esc_html__('VK.com', 'wp-user-avatar')
290 ],
291 'label' => esc_html__('Social Login Buttons', 'wp-user-avatar'),
292 'priority' => 40
293 ];
294 }
295
296 $settings[] = [
297 'id' => 'buildscratch_remove_form_frame',
298 'type' => 'checkbox',
299 'label' => esc_html__('Remove Form Frame', 'wp-user-avatar'),
300 'checkbox_label' => esc_html__('Check to remove'),
301 'priority' => 50
302 ];
303
304 $settings[] = [
305 'id' => 'buildscratch_hide_required_asterisk',
306 'type' => 'checkbox',
307 'label' => sprintf(esc_html__('Hide Required %s'), '<span style="color:red">*</span>'),
308 'checkbox_label' => esc_html__('Check to hide', 'wp-user-avatar'),
309 'priority' => 60
310 ];
311
312 return $settings;
313 }
314
315 public function metabox_settings($settings, $form_type, $DragDropBuilderInstance)
316 {
317 $submit_button_settings = $settings['submit_button'];
318 unset($settings['submit_button']);
319
320 $settings['buildscratch_field_styling'] = [
321 'tab_title' => esc_html__('Field & Styling', 'wp-user-avatar'),
322 [
323 'id' => 'buildscratch_field_layout',
324 'type' => 'tab_radio',
325 'options' => [
326 'round' => esc_html__('Round', 'wp-user-avatar'),
327 'square' => esc_html__('Square', 'wp-user-avatar'),
328 'pill' => esc_html__('Pill', 'wp-user-avatar'),
329 'material' => esc_html__('Material', 'wp-user-avatar'),
330 'flat' => esc_html__('Flat', 'wp-user-avatar'),
331 ],
332 'tab_description' => $this->field_layout_description(),
333 'label' => esc_html__('Layout', 'wp-user-avatar'),
334 'priority' => 20
335 ],
336 [
337 'id' => 'buildscratch_label_field_size',
338 'type' => 'select',
339 'options' => [
340 'small' => esc_html__('Small', 'wp-user-avatar'),
341 'medium' => esc_html__('Medium', 'wp-user-avatar'),
342 'large' => esc_html__('Large', 'wp-user-avatar'),
343 ],
344 'label' => esc_html__('Field Size', 'wp-user-avatar'),
345 'description' => esc_html__('Select the size (in height) of input and textarea form fields.', 'wp-user-avatar')
346 ],
347 [
348 'id' => 'buildscratch_field_icon_color',
349 'type' => 'color',
350 'label' => esc_html__('Icon', 'wp-user-avatar')
351 ],
352 [
353 'id' => 'buildscratch_label_field_icon_alignment',
354 'type' => 'tab_radio',
355 'options' => [
356 'left' => esc_html__('Left', 'wp-user-avatar'),
357 'right' => esc_html__('Right', 'wp-user-avatar'),
358 ],
359 'label' => esc_html__('Icon Alignment', 'wp-user-avatar')
360 ],
361 [
362 'id' => 'buildscratch_field_border_color',
363 'type' => 'color',
364 'label' => esc_html__('Border', 'wp-user-avatar')
365 ],
366 [
367 'id' => 'buildscratch_field_border_focus_color',
368 'type' => 'color',
369 'label' => esc_html__('Border on Focus', 'wp-user-avatar')
370 ],
371 [
372 'id' => 'buildscratch_field_bg_color',
373 'type' => 'color',
374 'label' => esc_html__('Background', 'wp-user-avatar')
375 ],
376 [
377 'id' => 'buildscratch_field_bg_focus_color',
378 'type' => 'color',
379 'label' => esc_html__('Background on Focus', 'wp-user-avatar')
380 ]
381 ];
382
383 $settings['buildscratch_labels_text'] = [
384 // calling label title here in case in future when there is membership and the heading will have the same styling as label
385 // and any additional text will have same styling as description.
386 'tab_title' => esc_html__('Labels & Text', 'wp-user-avatar'),
387 [
388 'id' => 'buildscratch_label_color',
389 'type' => 'color',
390 'label' => esc_html__('Title', 'wp-user-avatar')
391 ],
392 [
393 'id' => 'buildscratch_label_font_size',
394 'type' => 'number',
395 'label' => esc_html__('Title Font Size (px)', 'wp-user-avatar')
396 ],
397 [
398 'id' => 'buildscratch_label_font_weight',
399 'type' => 'select',
400 'options' => [
401 'normal' => esc_html__('Normal', 'wp-user-avatar'),
402 'bold' => esc_html__('Bold', 'wp-user-avatar'),
403 ],
404 'label' => esc_html__('Title Font Weight', 'wp-user-avatar')
405 ],
406 [
407 'id' => 'buildscratch_description_color',
408 'type' => 'color',
409 'label' => esc_html__('Description', 'wp-user-avatar')
410 ],
411 [
412 'id' => 'buildscratch_description_alignment',
413 'type' => 'select',
414 'options' => [
415 'left' => esc_html__('Left', 'wp-user-avatar'),
416 'center' => esc_html__('Center', 'wp-user-avatar'),
417 'right' => esc_html__('Right', 'wp-user-avatar'),
418 ],
419 'label' => esc_html__('Description Alignment', 'wp-user-avatar')
420 ],
421 [
422 'id' => 'buildscratch_field_value_font_size',
423 'type' => 'number',
424 'label' => esc_html__('Value / Text Font Size', 'wp-user-avatar'),
425 'description' => esc_html__('Font size in pixel (px) of field values and text on form.')
426 ],
427 [
428 'id' => 'buildscratch_field_value_color',
429 'type' => 'color',
430 'label' => esc_html__('Value / Text', 'wp-user-avatar'),
431 'description' => esc_html__('Color of the value of a field and text on the form.')
432 ],
433 [
434 'id' => 'buildscratch_field_placeholder_color',
435 'type' => 'color',
436 'label' => esc_html__('Placeholder', 'wp-user-avatar')
437 ],
438 ];
439
440 $settings['submit_button'] = $submit_button_settings;
441
442 return $settings;
443 }
444
445 public function field_layout_description()
446 {
447 $placeholder = esc_html__('Name', 'wp-user-avatar');
448 ob_start();
449 ?>
450 <div class="ppmb-tab"><input type="text" placeholder="<?= $placeholder ?>" class="ppfl ppfl-round" readonly>
451 </div>
452 <div class="ppmb-tab"><input type="text" placeholder="<?= $placeholder ?>" class="ppfl ppfl-square" readonly>
453 </div>
454 <div class="ppmb-tab"><input type="text" placeholder="<?= $placeholder ?>" class="ppfl ppfl-pill" readonly>
455 </div>
456 <div class="ppmb-tab"><input type="text" placeholder="<?= $placeholder ?>" class="ppfl ppfl-material" readonly>
457 </div>
458 <div class="ppmb-tab"><input type="text" placeholder="<?= $placeholder ?>" class="ppfl ppfl-flat" readonly>
459 </div>
460 <?php
461 return ob_get_clean();
462 }
463
464 public function submit_button_layout_description()
465 {
466 $label = esc_html__('Submit', 'wp-user-avatar');
467 ob_start();
468 ?>
469 <div class="ppmb-tab"><input type="button" value="<?= $label ?>" class="ppfl ppfl-round" disabled=""></div>
470 <div class="ppmb-tab"><input type="button" value="<?= $label ?>" class="ppfl ppfl-square" disabled></div>
471 <div class="ppmb-tab"><input type="button" value="<?= $label ?>" class="ppfl ppfl-pill" disabled></div>
472 <div class="ppmb-tab"><input type="button" value="<?= $label ?>" class="ppfl ppfl-flat" disabled></div>
473 <?php
474 return ob_get_clean();
475 }
476
477 public function submit_button_settings($settings)
478 {
479 $settings[] = [
480 'id' => 'buildscratch_submit_button_layout',
481 'type' => 'tab_radio',
482 'options' => [
483 'round' => esc_html__('Round', 'wp-user-avatar'),
484 'square' => esc_html__('Square', 'wp-user-avatar'),
485 'pill' => esc_html__('Pill', 'wp-user-avatar')
486 ],
487 'tab_description' => $this->submit_button_layout_description(),
488 'label' => esc_html__('Layout', 'wp-user-avatar')
489 ];
490
491 $settings[] = [
492 'id' => 'buildscratch_submit_button_width',
493 'type' => 'select',
494 'options' => [
495 'auto' => esc_html__('Auto (Default)', 'wp-user-avatar'),
496 'wide' => esc_html__('Wide', 'wp-user-avatar'),
497 'full-width' => esc_html__('Full Stretched Width', 'wp-user-avatar')
498 ],
499 'label' => esc_html__('Width', 'wp-user-avatar'),
500 ];
501
502 $settings[] = [
503 'id' => 'buildscratch_submit_button_font_size',
504 'type' => 'number',
505 'label' => esc_html__('Font Size (px)', 'wp-user-avatar')
506 ];
507
508 $settings[] = [
509 'id' => 'buildscratch_submit_button_font_weight',
510 'type' => 'select',
511 'options' => [
512 'normal' => esc_html__('Normal', 'wp-user-avatar'),
513 'bold' => esc_html__('Bold', 'wp-user-avatar'),
514 ],
515 'label' => esc_html__('Font Weight', 'wp-user-avatar')
516 ];
517
518 $settings[] = [
519 'id' => 'buildscratch_submit_button_bg_color',
520 'type' => 'color',
521 'label' => esc_html__('Background', 'wp-user-avatar')
522 ];
523
524 $settings[] = [
525 'id' => 'buildscratch_submit_button_bg_focus_color',
526 'type' => 'color',
527 'label' => esc_html__('Background on Focus', 'wp-user-avatar')
528 ];
529
530 $settings[] = [
531 'id' => 'buildscratch_submit_button_text_color',
532 'type' => 'color',
533 'label' => esc_html__('Text', 'wp-user-avatar')
534 ];
535
536 $settings[] = [
537 'id' => 'buildscratch_submit_button_text_focus_color',
538 'type' => 'color',
539 'label' => esc_html__('Text Focused', 'wp-user-avatar')
540 ];
541
542 return $settings;
543 }
544
545 public function form_structure()
546 {
547 $headline = '';
548 $saved_headline = $this->get_meta('buildscratch_form_headline');
549 if ( ! empty($saved_headline)) {
550 $headline = '<div class="ppbs-headline">' . $saved_headline . '</div>';
551 }
552
553 $social_login_buttons = $this->social_login_buttons();
554
555 $fields = (new FieldListing($this->form_id, $this->form_type, true))
556 ->defaults($this->default_fields_settings())
557 ->shortcode_field_wrap_start('<div class="pp-form-field-input-textarea-wrap">')
558 ->shortcode_field_wrap_end('</div>')
559 ->forge();
560
561 $button = $this->form_submit_button();
562
563 $fl = 'ppfl-' . $this->get_meta('buildscratch_field_layout');
564 $rf = $this->get_meta('buildscratch_remove_form_frame') == 'true' ? ' ppf-remove-frame' : '';
565 $hra = $this->get_meta('buildscratch_hide_required_asterisk') == 'true' ? ' ppf-hide-asterisk' : '';
566
567 $fs = ' ppfs-' . $this->get_meta('buildscratch_label_field_size');
568 $fia = ' ppfia-' . $this->get_meta('buildscratch_label_field_icon_alignment');
569
570 $sbl = ' ppsbl-' . $this->get_meta('buildscratch_submit_button_layout');
571 $sbw = ' ppsbw-' . $this->get_meta('buildscratch_submit_button_width');
572
573 $form_link = $this->form_links();
574
575 return <<<HTML
576 [pp-form-wrapper class="ppBuildScratch {$fl}{$sbl}{$sbw}{$rf}{$hra}{$fs}{$fia}"]
577 $headline
578 $social_login_buttons
579 $fields
580 <div class="pp-form-submit-button-wrap">
581 $button
582 </div>
583 [/pp-form-wrapper]
584 $form_link
585 HTML;
586 }
587
588 public function form_links()
589 {
590 $forgot_password_link = ppress_password_reset_url();
591 $signup_link = ppress_registration_url();
592 $login_link = ppress_login_url();
593 $forgot_password_label = $this->get_meta('buildscratch_forgot_password_label');
594 $signup_label = $this->get_meta('buildscratch_signup_label');
595 $login_label = $this->get_meta('buildscratch_login_label');
596
597 $login_form_link = <<<HTML
598 <div class="ppress-form-bottom-links">
599 <a href="$forgot_password_link">$forgot_password_label</a> | <a href="$signup_link">$signup_label</a>
600 </div>
601 HTML;
602
603 $signup_form_link = <<<HTML
604 <div class="ppress-form-bottom-links">
605 <a href="$login_link">$login_label</a>
606 </div>
607 HTML;
608
609 $password_reset_form_link = <<<HTML
610 <div class="ppress-form-bottom-links">
611 <a href="$login_link">$login_label</a>
612 </div>
613 HTML;
614
615 if ($this->form_type == FR::LOGIN_TYPE) return $login_form_link;
616 if ($this->form_type == FR::REGISTRATION_TYPE) return $signup_form_link;
617 if ($this->form_type == FR::PASSWORD_RESET_TYPE) return $password_reset_form_link;
618
619 return '';
620
621 }
622
623 public function form_css()
624 {
625 $form_id = $this->form_id;
626 $form_type = $this->form_type;
627
628 $width = $this->get_meta('buildscratch_form_width');
629 $form_bg_color = $this->get_meta('buildscratch_form_bg_color');
630 $form_font_family = $this->get_meta('buildscratch_form_font_family');
631 $form_font_family_plus_to_space = str_replace('+', ' ', $form_font_family);
632 $value_font_size = $this->get_meta('buildscratch_field_value_font_size');
633 $field_icon_color = $this->get_meta('buildscratch_field_icon_color');
634 $field_border_color = $this->get_meta('buildscratch_field_border_color');
635 $field_border_focus_color = $this->get_meta('buildscratch_field_border_focus_color');
636 $field_bg_color = $this->get_meta('buildscratch_field_bg_color');
637 $field_bg_focus_color = $this->get_meta('buildscratch_field_bg_focus_color');
638 $field_value_color = $this->get_meta('buildscratch_field_value_color');
639 $field_placeholder_color = $this->get_meta('buildscratch_field_placeholder_color');
640 $field_label_color = $this->get_meta('buildscratch_label_color');
641 $field_label_font_size = $this->get_meta('buildscratch_label_font_size');
642 $field_label_font_weight = $this->get_meta('buildscratch_label_font_weight');
643
644 $description_color = $this->get_meta('buildscratch_description_color');
645 $description_alignment = $this->get_meta('buildscratch_description_alignment');
646
647 $submit_button_font_size = $this->get_meta('buildscratch_submit_button_font_size');
648 $submit_button_font_weight = $this->get_meta('buildscratch_submit_button_font_weight');
649 $submit_button_bg_color = $this->get_meta('buildscratch_submit_button_bg_color');
650 $submit_button_bg_focus_color = $this->get_meta('buildscratch_submit_button_bg_focus_color');
651 $submit_button_text_color = $this->get_meta('buildscratch_submit_button_text_color');
652 $submit_button_text_focus_color = $this->get_meta('buildscratch_submit_button_text_focus_color');
653
654 $status_class = '.profilepress-reg-status';
655 switch ($this->form_type) {
656 case FR::LOGIN_TYPE :
657 $status_class = '.profilepress-login-status';
658 break;
659 case FR::PASSWORD_RESET_TYPE :
660 $status_class = '.profilepress-reset-status';
661 break;
662 case FR::EDIT_PROFILE_TYPE :
663 $status_class = '.profilepress-edit-profile-status';
664 break;
665 }
666
667 return <<<CSS
668 @import url('https://fonts.googleapis.com/css?family={$form_font_family}:300,400,600,700&display=swap');
669
670 #pp-$form_type-$form_id-wrap $status_class {
671 border-radius: 5px;
672 font-size: 16px;
673 line-height: 1.471;
674 padding: 10px;
675 background-color: #e74c3c;
676 color: #ffffff;
677 font-weight: normal;
678 text-align: center;
679 vertical-align: middle;
680 margin: 10px 0;
681 -webkit-box-sizing: border-box;
682 -moz-box-sizing: border-box;
683 box-sizing: border-box;
684 max-width: 100%;
685 }
686
687 #pp-$form_type-$form_id-wrap $status_class.success {
688 background-color: #2ecc71;
689 color: #ffffff;
690 }
691
692 #pp-$form_type-$form_id-wrap $status_class a {
693 color: #fff;
694 text-decoration: underline;
695 }
696
697 /* settings CSS */
698 #pp-$form_type-$form_id-wrap.pp-form-container {
699 max-width: $width !important;
700 width: 100%;
701 margin: 0 auto;
702 }
703
704 .pp-form-container #pp-$form_type-$form_id.ppBuildScratch {
705 background: $form_bg_color;
706 color: $field_value_color;
707 font-size: {$value_font_size}px;
708 }
709
710 .pp-form-container #pp-$form_type-$form_id.ppBuildScratch .pp-form-field-wrap .pp-form-field-input-textarea-wrap {
711 position: relative;
712 }
713
714 .pp-form-container #pp-$form_type-$form_id.ppBuildScratch,
715 .pp-form-container #pp-$form_type-$form_id.ppBuildScratch * {
716 font-family: '$form_font_family_plus_to_space',-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;
717 }
718
719 .pp-form-container #pp-$form_type-$form_id.ppBuildScratch .pp-form-field-wrap input,
720 .pp-form-container #pp-$form_type-$form_id.ppBuildScratch .pp-form-field-wrap select,
721 .pp-form-container #pp-$form_type-$form_id.ppBuildScratch .pp-form-field-wrap textarea {
722 font-size: {$value_font_size}px;
723 border-color: $field_border_color;
724 background: $field_bg_color;
725 color :$field_value_color;
726 }
727
728 .pp-form-container #pp-$form_type-$form_id.ppBuildScratch .pp-form-field-wrap .pp-form-material-icons {
729 color: $field_icon_color;
730 }
731
732 .pp-form-container #pp-$form_type-$form_id.ppBuildScratch .pp-checkbox-wrap label,
733 .pp-form-container #pp-$form_type-$form_id.ppBuildScratch .pp-radio-wrap label {
734 font-size: {$value_font_size}px;
735 color :$field_value_color;
736 vertical-align: middle;
737 }
738
739 .pp-form-container #pp-$form_type-$form_id.ppBuildScratch .pp-form-field-wrap input[type=text]:focus,
740 .pp-form-container #pp-$form_type-$form_id.ppBuildScratch .pp-form-field-wrap select:focus,
741 .pp-form-container #pp-$form_type-$form_id.ppBuildScratch .pp-form-field-wrap textarea:focus {
742 outline: 0;
743 background: $field_bg_focus_color;
744 border-color: $field_border_focus_color;
745 box-shadow: 0 0 0 1px $field_border_focus_color;
746 }
747
748 .pp-form-container #pp-$form_type-$form_id.ppBuildScratch .pp-form-field-wrap ::placeholder{
749 color: $field_placeholder_color;
750 }
751
752 .pp-form-container #pp-$form_type-$form_id.ppBuildScratch .pp-form-field-wrap ::-webkit-input-placeholder{
753 color: $field_placeholder_color;
754 }
755
756 .pp-form-container #pp-$form_type-$form_id.ppBuildScratch .pp-form-field-wrap ::-moz-placeholder{
757 color: $field_placeholder_color;
758 }
759
760 .pp-form-container #pp-$form_type-$form_id.ppBuildScratch .pp-form-field-wrap :-moz-placeholder{
761 color: $field_placeholder_color;
762 }
763
764 .pp-form-container #pp-$form_type-$form_id.ppBuildScratch .pp-form-field-wrap :-ms-input-placeholder{
765 color: $field_placeholder_color;
766 }
767
768 .pp-form-container #pp-$form_type-$form_id.ppBuildScratch .ppbs-headline,
769 .pp-form-container #pp-$form_type-$form_id.ppBuildScratch h1,
770 .pp-form-container #pp-$form_type-$form_id.ppBuildScratch h2,
771 .pp-form-container #pp-$form_type-$form_id.ppBuildScratch h3,
772 .pp-form-container #pp-$form_type-$form_id.ppBuildScratch {
773 color: $field_label_color;
774 }
775
776 .pp-form-container #pp-$form_type-$form_id.ppBuildScratch .pp-form-field-wrap .pp-form-label-wrap .pp-form-label {
777 color: $field_label_color;
778 font-size: {$field_label_font_size}px;
779 font-weight: $field_label_font_weight;
780 }
781
782 .pp-form-container #pp-$form_type-$form_id.ppBuildScratch .pp-form-field-description {
783 color: $description_color;
784 text-align: $description_alignment;
785 }
786
787 .pp-form-container #pp-$form_type-$form_id.ppBuildScratch .pp-form-submit-button-wrap input[type="submit"] {
788 font-size: {$submit_button_font_size}px;
789 font-weight: $submit_button_font_weight;
790 background: $submit_button_bg_color;
791 color: $submit_button_text_color;
792 }
793
794 .pp-form-container #pp-$form_type-$form_id.ppBuildScratch .pp-form-submit-button-wrap input[type="submit"]:hover,
795 .pp-form-container #pp-$form_type-$form_id.ppBuildScratch .pp-form-submit-button-wrap input[type="submit"]:focus {
796 background: $submit_button_bg_focus_color;
797 color: $submit_button_text_focus_color;
798 }
799
800 .pp-form-container div#pp-$form_type-$form_id.ppBuildScratch a.pp-button-social-login {
801 margin-right: 6.387%;
802 }
803
804 .pp-form-container div#pp-$form_type-$form_id.ppBuildScratch a.pp-button-social-login {
805 display: block;
806 height: 3em;
807 line-height: 3em;
808 text-decoration: none;
809 margin-bottom: 10px;
810 }
811
812 .pp-form-container div#pp-$form_type-$form_id.ppBuildScratch a.pp-button-social-login .ppsc {
813 width: 3em;
814 height: 3em;
815 }
816
817 .pp-form-container div#pp-$form_type-$form_id.ppBuildScratch a.pp-button-social-login span.ppsc-text {
818 margin-left: 50px;
819 }
820
821 .pp-form-container div#pp-registration-12.ppBuildScratch a.pp-button-social-login:last-of-type {
822 margin-bottom: 20px;
823 }
824
825 .pp-form-container .ppress-form-bottom-links {
826 padding-top: 15px;
827 padding-bottom: 15px;
828 text-align: center;
829 }
830
831 .pp-form-container .ppress-form-bottom-links a {
832 line-height: 22px;
833 font-size: 14px;
834 color: $field_value_color !important;
835 display: inline-block;
836 text-decoration: none!important;
837 font-weight: 400;
838 text-align: center;
839 border-bottom: none!important;
840 }
841
842 .pp-form-container .ppress-form-bottom-links a:hover {
843 text-decoration: underline!important;
844 }
845 CSS;
846
847 }
848 }