PluginProbe ʕ •ᴥ•ʔ
Strong Testimonials / 2.38
Strong Testimonials v2.38
3.3.3 3.3.2 3.3.1 trunk 1.0.1 2.30.9 2.31.10 2.32 2.32.1 2.32.2 2.32.3 2.32.4 2.33 2.34 2.35 2.36 2.37 2.38 2.38.1 2.39 2.39.1 2.39.2 2.39.3 2.40.0 2.40.1 2.40.2 2.40.3 2.40.4 2.40.5 2.40.6 2.40.7 2.41.0 2.41.1 2.50.0 2.50.1 2.50.2 2.50.3 2.50.4 2.51.0 2.51.1 2.51.2 2.51.3 2.51.4 2.51.5 2.51.6 2.51.7 2.51.8 2.51.9 3.0.0 3.0.1 3.0.2 3.0.3 3.1.0 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.20 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.17 3.2.18 3.2.19 3.2.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 3.3.0
strong-testimonials / admin / form-preview.php
strong-testimonials / admin Last commit date
about 7 years ago css 7 years ago img 7 years ago js 7 years ago menu 7 years ago partials 7 years ago scss 7 years ago settings 7 years ago admin-notices.php 7 years ago admin.php 7 years ago class-strong-testimonials-addons.php 7 years ago class-strong-testimonials-admin-category-list.php 7 years ago class-strong-testimonials-admin-list.php 7 years ago class-strong-testimonials-admin-scripts.php 7 years ago class-strong-testimonials-defaults.php 7 years ago class-strong-testimonials-exporter.php 7 years ago class-strong-testimonials-help.php 7 years ago class-strong-testimonials-list-table.php 7 years ago class-strong-testimonials-page-shortcodes.php 7 years ago class-strong-testimonials-post-editor.php 7 years ago class-strong-testimonials-updater.php 7 years ago class-strong-testimonials-upsell.php 7 years ago class-strong-views-list-table.php 7 years ago class-walker-strong-category-checklist.php 7 years ago class-walker-strong-form-category-checklist.php 7 years ago compat.php 7 years ago custom-fields-ajax.php 7 years ago custom-fields.php 7 years ago form-preview.php 7 years ago view-list-order.php 7 years ago views-ajax.php 7 years ago views-validate.php 7 years ago views.php 7 years ago
form-preview.php
52 lines
1 <?php
2
3 function wpmtst_get_form_preview() {
4 if ( ! isset( $_POST['fields'] ) ) exit;
5
6 // parse_str decodes too; no need to use urldecode
7 parse_str( stripslashes_deep( $_POST['fields'] ), $preview );
8
9 $new_fields = array();
10 $fields = apply_filters( 'wpmtst_fields', get_option( 'wpmtst_fields' ) );
11
12 foreach ( $preview['fields'] as $key => $field ) {
13 /*
14 * Before merging onto base field, catch fields that are "off"
15 * which the form does not submit. Otherwise, the default "on"
16 * would override the requested (but not submitted) "off".
17 */
18 $field['show_label'] = isset( $field['show_label'] ) ? 1 : 0;
19 $field['required'] = isset( $field['required'] ) ? 1 : 0;
20
21 $field = array_merge( $fields['field_base'], $field );
22
23 if ( 'none' == $field['input_type'] ) {
24 $field['input_type'] = 'text';
25 }
26
27 $field['name'] = sanitize_text_field( $field['name'] );
28 $field['label'] = sanitize_text_field( $field['label'] );
29 // TODO Replace this special handling
30 if ( 'checkbox' == $field['input_type'] ) {
31 $field['default_form_value'] = wpmtst_sanitize_checkbox( $field, 'default_form_value' );
32 } else {
33 $field['default_form_value'] = sanitize_text_field( $field['default_form_value'] );
34 }
35 $field['placeholder'] = sanitize_text_field( $field['placeholder'] );
36 $field['before'] = sanitize_text_field( $field['before'] );
37 $field['after'] = sanitize_text_field( $field['after'] );
38
39 // add to fields array in display order
40 $new_fields[] = $field;
41 }
42
43 ob_start();
44 include WPMTST_ADMIN . 'partials/templates/form-preview-template.php';
45 $html = ob_get_contents();
46 ob_end_clean();
47 echo $html;
48
49 exit;
50 }
51 add_action( 'wp_ajax_wpmtst_get_form_preview', 'wpmtst_get_form_preview' );
52