Changeset 3077542
- Timestamp:
- 04/26/2024 10:50:03 AM (22 months ago)
- Location:
- pinpointe-form-integration/trunk
- Files:
-
- 2 edited
-
assets/js/pinpointe-admin.js (modified) (4 diffs)
-
pinpointe-signup-form.php (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
pinpointe-form-integration/trunk/assets/js/pinpointe-admin.js
r3074988 r3077542 100 100 } 101 101 102 jQuery('.pinpointe_forms_overide_confirmation').click(function() { 102 function form_fields_on_change_handler(current_select_id, current_field_id, value, merge_fields, has_chosen_values = false) 103 { 104 FormEditorChanged(); 105 regenerate_tag_chosen(current_field_id); 106 107 if (has_chosen_values) { 108 var values = value.split(','); 109 value = values[values.length - 1]; 110 } 111 112 var select_id = current_select_id.replace('pinpointe_field_tag', ''); 113 114 if (merge_fields[value]) { 115 116 jQuery('#pinpointe_forms_fields_type' + select_id).val(merge_fields[value]['type']); 117 jQuery('#pinpointe_forms_fields_req' + select_id).val(merge_fields[value]['req']); 118 jQuery('#pinpointe_forms_fields_us_phone' + select_id).val(merge_fields[value]['us_phone']); 119 jQuery('#pinpointe_forms_fields_choices' + select_id).val(merge_fields[value]['choices']); 120 } 121 } 122 123 jQuery('.pinpointe_forms_overide_confirmation').click(function () { 103 124 pinpointe_hide_confirmation_email_tr(this); 104 125 }); … … 137 158 if (typeof non_selected_keys[this_key] !== 'undefined') { 138 159 non_selected_keys[this_key]++; 139 } 140 else { 160 } else { 141 161 non_selected_keys[this_key] = 1; 142 162 } … … 799 819 placeholder: pinpointe_label_select_tag ?? "Select a field", 800 820 onChange(value) { 801 FormEditorChanged(); 802 regenerate_tag_chosen(current_field_id); 803 804 // use this to support old browsers 805 // otherwise merge_fields[value]?.['type'] ?? '' for modern browsers 806 jQuery('#pinpointe_forms_fields_type' + current_select_id).val( 807 merge_fields[value] && merge_fields[value]['type'] || '' 808 ); 809 jQuery('#pinpointe_forms_fields_req' + current_select_id).val( 810 merge_fields[value] && merge_fields[value]['req'] || '' 811 ); 812 jQuery('#pinpointe_forms_fields_us_phone' + current_select_id).val( 813 merge_fields[value] && merge_fields[value]['us_phone'] || '' 814 ); 815 jQuery('#pinpointe_forms_fields_choices' + current_select_id).val( 816 merge_fields[value] && merge_fields[value]['choices'] || '' 817 ); 821 form_fields_on_change_handler(current_select_id, current_field_id, value, merge_fields); 818 822 } 819 823 }); … … 901 905 hidePlaceholder: false, 902 906 } 903 907 var current_select = jQuery('#pinpointe_field_tag_' + current_field_id + '_' + current_id); 904 908 new TomSelect( 905 "#" + jQuery('#pinpointe_field_tag_' + current_field_id + '_' + current_id).attr('id'),909 "#" + current_select.attr('id'), 906 910 { 907 911 ...tomSelectOptions, 908 items: curruent_field_tag_select_value 912 items: curruent_field_tag_select_value, 913 onChange(value) { 914 form_fields_on_change_handler(current_select.prop('id'), current_field_id, value, merge_fields); 915 916 } 909 917 } 910 918 ); 911 919 new TomSelect( 912 "#" + jQuery('#pinpointe_field_tag_' + current_field_id + '_' + next_id).attr('id'), 913 tomSelectOptions 920 "#" + cloned_select.prop('id'), 921 { 922 ...tomSelectOptions, 923 924 onChange(value) { 925 form_fields_on_change_handler(cloned_select.prop('id'), next_id, value, merge_fields, true); 926 } 927 } 914 928 ); 915 929 -
pinpointe-form-integration/trunk/pinpointe-signup-form.php
r3074988 r3077542 1 1 <?php 2 3 2 /** 4 3 * Plugin Name: Pinpointe Form Integration … … 27 26 } 28 27 28 session_start(); // Start the session first 29 29 30 // Define Constants 30 31 define('PINPOINTE_PLUGIN_PATH', untrailingslashit(plugin_dir_path(__FILE__))); … … 108 109 109 110 // Load scripts/styles conditionally 110 $query_string = filter_input(INPUT_SERVER, 'QUERY_STRING', FILTER_SANITIZE_STRING);111 $query_string = htmlspecialchars($_SERVER['QUERY_STRING'], ENT_QUOTES); 111 112 if (isset($query_string) && preg_match('/page=pinpointe/i', $query_string) && !preg_match('/page=pinpointe_lite/i', $query_string)) { 112 113 add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts_and_styles')); … … 155 156 */ 156 157 157 // Start session on init hook.158 add_action('init',[$this,'init_session']);159 158 160 159 add_action('widgets_init', function () { … … 185 184 add_action('wp_ajax_nopriv_pinpointe_subscribe', array($this, 'ajax_subscribe')); 186 185 187 }188 function init_session() {189 if (!session_id()) {190 session_start();191 }192 186 } 193 187 … … 579 573 <input type="hidden" name="current_tab" value="<?php echo esc_attr($current_tab); ?>" /> 580 574 <?php wp_nonce_field("ajax_pinpointe_status","pinpointe_status");?> 575 <?php wp_nonce_field('ajax_get_lists', 'pinpointe_get_lists');?> 581 576 582 577 <?php … … 2670 2665 public static function select_form_by_conditions($forms, $allowed_forms = array()) 2671 2666 { 2672 $selected_form = false;2667 $selected_form = []; 2673 2668 2674 2669 // Iterate over forms and return the first form that matches conditions … … 2676 2671 2677 2672 // Check if form is enabled and has mailing list set 2678 if ($form['condition'] == 'disable' || empty($form['list'])) {2673 if ($form['condition'] === 'disable' || empty($form['list'])) { 2679 2674 continue; 2680 2675 } … … 2707 2702 2708 2703 /** 2709 * PAGES 2704 * PAGES/POSTS 2710 2705 */ 2706 case 'posts': 2711 2707 case 'pages': 2712 2708 global $post; … … 2742 2738 2743 2739 break; 2744 2745 /** 2746 * POSTS 2747 */ 2748 case 'posts': 2749 global $post; 2750 2751 // Check if we have any pages selected 2752 if (!$post || !isset($post->ID) || !array($form['condition']['value']) || empty($form['condition']['value'])) { 2753 break; 2754 } 2755 2756 // Check if current post is within selected posts 2757 if (in_array($post->ID, $form['condition']['value'])) { 2758 $selected_form[$form_key] = $form; 2759 } 2760 2761 break; 2762 2740 2763 2741 /** 2764 2742 * POSTS NOT … … 2849 2827 if (in_array($single_cat_id, $post_category_ids)) { 2850 2828 $found = true; 2829 break; 2851 2830 } 2852 2831 } … … 2862 2841 */ 2863 2842 case 'url': 2864 $request_url = sanitize_url(($_SERVER['HTTPS'] ? 'https' : 'http') . '://' .$_SERVER[ HTTP_HOST] . $_SERVER[REQUEST_URI]);2843 $request_url = sanitize_url(($_SERVER['HTTPS'] ? 'https' : 'http') . '://' .$_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); 2865 2844 2866 2845 if (preg_match('/' . preg_quote($form['condition']['value']) . '/i', $request_url)) { … … 2874 2853 */ 2875 2854 case 'url_not': 2876 $request_url = sanitize_url(($_SERVER['HTTPS'] ? 'https' : 'http') . '://' . $_SERVER[ HTTP_HOST] . $_SERVER[REQUEST_URI]);2855 $request_url = sanitize_url(($_SERVER['HTTPS'] ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); 2877 2856 2878 2857 if (!preg_match('/' . preg_quote($form['condition']['value']) . '/i', $request_url)) { … … 2890 2869 2891 2870 // Check if we have selected this form 2892 if ( $selected_form) {2871 if (!empty($selected_form)) { 2893 2872 break; 2894 2873 } … … 4296 4275 <?php 4297 4276 4298 echo wp_kses_post($form_html); 4277 // Output the sanitized form HTML 4278 echo $form_html; 4299 4279 } 4300 4280
Note: See TracChangeset
for help on using the changeset viewer.