Changeset 3265807
- Timestamp:
- 04/02/2025 05:17:52 PM (11 months ago)
- Location:
- pdf-forms-for-wpforms/trunk
- Files:
-
- 3 edited
-
css/admin.css (modified) (1 diff)
-
pdf-forms-for-wpforms.php (modified) (9 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
pdf-forms-for-wpforms/trunk/css/admin.css
r3214289 r3265807 115 115 .pdf-forms-for-wpforms-admin .mapping-table 116 116 { 117 table-layout: fixed;118 117 width: 100%; 119 118 } -
pdf-forms-for-wpforms/trunk/pdf-forms-for-wpforms.php
r3246282 r3265807 4 4 * Plugin URI: https://pdfformsfiller.org/ 5 5 * Description: Build WPForms from PDF forms. Get PDFs filled automatically and attached to email messages and/or website responses on form submissions. 6 * Version: 1. 2.06 * Version: 1.3.0 7 7 * Requires at least: 5.4 8 8 * Requires PHP: 5.5 … … 25 25 class Pdf_Forms_For_WPForms 26 26 { 27 const VERSION = '1. 2.0';27 const VERSION = '1.3.0'; 28 28 const MIN_WPFORMS_VERSION = '1.6.9'; 29 29 const MAX_WPFORMS_VERSION = '1.9.99'; … … 38 38 private $tmp_dir = null; 39 39 private $wpforms_mail_attachments = array(); 40 private $need_plaintext_smart_tag_value_flag = false; 40 41 41 42 private function __construct() … … 79 80 80 81 add_filter( 'wpforms_save_form_args', array( $this, 'wpforms_save_form_args' ), 10, 3 ); 82 83 add_filter( 'wpforms_smarttags_process_value', array( $this, 'plaintext_smart_tag_value_workaround_filter' ), PHP_INT_MAX, 6 ); 81 84 // fill_pdfs: we can't use wpforms_process_complete (because notifications have already been sent) and wpforms_process because uploaded files haven't been processed yet 82 85 add_filter( 'wpforms_process_after_filter', array( $this, 'fill_pdfs' ), 999999, 3 ); … … 841 844 842 845 /** 846 * Wrapper for WPForms' wpforms_process_smart_tags() 847 * 848 * The function wpforms_process_smart_tags() formats smart tag values for HTML output (via `wp_kses_post()`), but we need plain text. 849 * Additional issue is that the content we are passing into wpforms_process_smart_tags() is plain text mixed with smart tags, but the smart tags will be formatted in HTML. 850 * So, we need to use a workaround to make sure we get plain text smart tag values. 851 */ 852 public function wpforms_process_smart_tags( $content, $form_data, $fields = [], $entry_id = '', $context = '' ) 853 { 854 // enable flag to convert smart tag values from HTML to plain text 855 $this->need_plaintext_smart_tag_value_flag = true; 856 857 $value = wpforms_process_smart_tags( $content, $form_data, $fields, $entry_id, $context ); 858 859 // disable conversion 860 $this->need_plaintext_smart_tag_value_flag = false; 861 862 return $value; 863 } 864 865 /** 866 * Filter the smart tag values late to convert HTML to plain text when we are inside our own wpforms_process_smart_tags call 867 */ 868 public function plaintext_smart_tag_value_workaround_filter( $value, $tag_name, $form_data, $fields, $entry_id, $smart_tag_object ) 869 { 870 if( $this->need_plaintext_smart_tag_value_flag ) 871 return html_entity_decode( strip_tags( $value ), ENT_QUOTES, 'UTF-8' ); 872 else 873 return $value; 874 } 875 876 /** 843 877 * We need to fill the pdf's document fields and then create attachment file and attach them 844 878 */ … … 882 916 $url = $wpforms_fields[$embed["wpf_field"]]['value']; 883 917 if( isset( $embed['smart_tags'] ) ) 884 $url = wpforms_process_smart_tags( $embed["smart_tags"], $form_data, $wpforms_fields, $entry_id );918 $url = $this->wpforms_process_smart_tags( $embed["smart_tags"], $form_data, $wpforms_fields, $entry_id ); 885 919 886 920 if( $url != null ) … … 1035 1069 1036 1070 if( isset( $mapping["smart_tags"] ) ) 1037 $data[$field] = wpforms_process_smart_tags( $mapping["smart_tags"], $form_data, $wpforms_fields, $entry_id );1071 $data[$field] = $this->wpforms_process_smart_tags( $mapping["smart_tags"], $form_data, $wpforms_fields, $entry_id ); 1038 1072 1039 1073 if( $multiple ) … … 1282 1316 $destfilename = strval( $attachment['options']['filename'] ); 1283 1317 if( $destfilename != "" ) 1284 $destfilename = strval( wpforms_process_smart_tags( $destfilename, $form_data, $wpforms_fields, $entry_id ) );1318 $destfilename = strval( $this->wpforms_process_smart_tags( $destfilename, $form_data, $wpforms_fields, $entry_id ) ); 1285 1319 if( $destfilename == "" ) 1286 1320 $destfilename = sanitize_file_name( get_the_title( $attachment_id ) ); … … 1357 1391 $tag_replaced_path_elements = array(); 1358 1392 foreach ( $path_elements as $key => $value ) 1359 $tag_replaced_path_elements[$key] = wpforms_process_smart_tags( $value, $form_data, $wpforms_fields, $entry_id );1393 $tag_replaced_path_elements[$key] = $this->wpforms_process_smart_tags( $value, $form_data, $wpforms_fields, $entry_id ); 1360 1394 1361 1395 foreach( $tag_replaced_path_elements as $elmid => &$new_element ) -
pdf-forms-for-wpforms/trunk/readme.txt
r3246282 r3265807 1 1 === PDF Forms Filler for WPForms === 2 Version: 1. 2.03 Stable tag: 1. 2.04 Tested up to: 6. 72 Version: 1.3.0 3 Stable tag: 1.3.0 4 Tested up to: 6.8 5 5 Tags: pdf, form, wpforms, email, download 6 6 Plugin URI: https://pdfformsfiller.org/ … … 52 52 == Changelog == 53 53 54 = 1.3.0 = 55 56 * Release date: April 2, 2025 57 58 * WARNING: This version includes changes that may affect plugin behavior. Please test your forms thoroughly after updating. 59 * Fixed an issue with smart tags rendering: smart tag values were HTML-escaped when we need plain text 60 * Field Mapper Tool UI issue fixed (column widths). 61 54 62 = 1.2.0 = 55 63 … … 172 180 == Upgrade Notice == 173 181 182 = 1.3.0 = 183 WARNING: This version includes changes that may affect plugin behavior. Please test your forms thoroughly after updating. 184 The specific issue is that (in previous versions) smart tag values were HTML-escaped, causing unwanted HTML escape sequences to appear when smart tag containing strings were rendered. 185 This version fixes the issue by unescaping smart tag values. Smart tag mappings and image embeds are affected, as well as PDF filenames and save paths that have smart tags. 186 174 187 = 1.2.0 = 175 188 WARNING: This version includes changes that may affect plugin behavior. Please test your forms thoroughly after updating.
Note: See TracChangeset
for help on using the changeset viewer.