Gravity PDF - Version 6.4.6

Version Description

  • Bug: Adjust Nested Forms and Repeater field PDF markup to ensure a unique ID attribute for any HTML tags
  • Bug: Prevent duplicate grid css classes being added to Nested Forms HTML tags
  • Bug: Process merge tags in Background Image PDF setting before late escaping in the PDF HTML markup
  • Housekeeping: Remove initialized message from Gravity PDF logs
Download this release

Release Info

Developer Blue Liquid Designs
Plugin Icon 128x128 Gravity PDF
Version 6.4.6
Comparing to
See all releases

Code changes from version 6.4.5 to 6.4.6

README.txt CHANGED
@@ -5,7 +5,7 @@ Donate link: https://gravitypdf.com/donate-to-plugin/
5
  Tags: gravityforms, gravity, forms, pdf, automation, attachment, email
6
  Requires at least: 5.3
7
  Tested up to: 6.0
8
- Stable tag: 6.4.5
9
  Requires PHP: 7.3
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl.txt
@@ -107,6 +107,12 @@ If you aren't able to meet the v6 minimum requirements [you can download v5 whic
107
 
108
  == Changelog ==
109
 
 
 
 
 
 
 
110
  = 6.4.5 =
111
  * Bug: Fix image display problem if filename had a space in it
112
  * Bug: Fix Background Image display problem on Windows OS
5
  Tags: gravityforms, gravity, forms, pdf, automation, attachment, email
6
  Requires at least: 5.3
7
  Tested up to: 6.0
8
+ Stable tag: 6.4.6
9
  Requires PHP: 7.3
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl.txt
107
 
108
  == Changelog ==
109
 
110
+ = 6.4.6 =
111
+ * Bug: Adjust Nested Forms and Repeater field PDF markup to ensure a unique ID attribute for any HTML tags
112
+ * Bug: Prevent duplicate grid css classes being added to Nested Forms HTML tags
113
+ * Bug: Process merge tags in Background Image PDF setting before late escaping in the PDF HTML markup
114
+ * Housekeeping: Remove initialized message from Gravity PDF logs
115
+
116
  = 6.4.5 =
117
  * Bug: Fix image display problem if filename had a space in it
118
  * Bug: Fix Background Image display problem on Windows OS
pdf.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Plugin Name: Gravity PDF
4
- Version: 6.4.5
5
  Description: Automatically generate highly-customisable PDF documents using Gravity Forms.
6
  Author: Blue Liquid Designs
7
  Author URI: https://blueliquiddesigns.com.au
@@ -28,7 +28,7 @@ if ( ! defined( 'ABSPATH' ) ) {
28
  /*
29
  * Set base constants we'll use throughout the plugin
30
  */
31
- define( 'PDF_EXTENDED_VERSION', '6.4.5' ); /* the current plugin version */
32
  define( 'PDF_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); /* plugin directory path */
33
  define( 'PDF_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); /* plugin directory url */
34
  define( 'PDF_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); /* the plugin basename */
1
  <?php
2
  /*
3
  Plugin Name: Gravity PDF
4
+ Version: 6.4.6
5
  Description: Automatically generate highly-customisable PDF documents using Gravity Forms.
6
  Author: Blue Liquid Designs
7
  Author URI: https://blueliquiddesigns.com.au
28
  /*
29
  * Set base constants we'll use throughout the plugin
30
  */
31
+ define( 'PDF_EXTENDED_VERSION', '6.4.6' ); /* the current plugin version */
32
  define( 'PDF_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); /* plugin directory path */
33
  define( 'PDF_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); /* plugin directory url */
34
  define( 'PDF_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); /* the plugin basename */
src/Helper/Fields/Field_Form.php CHANGED
@@ -74,17 +74,28 @@ class Field_Form extends Helper_Abstract_Fields {
74
  $html = '';
75
 
76
  /* Get the Nested Form Entries */
77
- $value = explode( ',', $this->value() );
78
- foreach ( $value as $id ) {
 
79
  $entry = $this->gform->get_entry( (int) trim( $id ) );
80
  if ( is_wp_error( $entry ) ) {
81
  continue;
82
  }
83
 
84
  /* Output the entry HTML mark-up */
85
- $html .= parent::html( $this->get_repeater_html( $form, $entry ) );
 
 
 
 
 
 
 
86
  }
87
 
 
 
 
88
  return $html;
89
  }
90
 
74
  $html = '';
75
 
76
  /* Get the Nested Form Entries */
77
+ $value = explode( ',', $this->value() );
78
+ $field_id = $this->field->id;
79
+ foreach ( $value as $key => $id ) {
80
  $entry = $this->gform->get_entry( (int) trim( $id ) );
81
  if ( is_wp_error( $entry ) ) {
82
  continue;
83
  }
84
 
85
  /* Output the entry HTML mark-up */
86
+ $markup = $this->get_repeater_html( $form, $entry );
87
+
88
+ /* Ensure the IDs are all unique by suffixing with the key */
89
+ $markup = preg_replace( '/id="(.+?)"/', 'id="nested-$1-' . esc_attr( $key ) . '"', $markup );
90
+
91
+ $this->field->id = "$field_id-$key";
92
+
93
+ $html .= parent::html( $markup );
94
  }
95
 
96
+ /* Reset the ID back to the original value */
97
+ $this->field->id = $field_id;
98
+
99
  return $html;
100
  }
101
 
src/Helper/Fields/Field_Repeater.php CHANGED
@@ -151,6 +151,21 @@ class Field_Repeater extends Helper_Abstract_Fields {
151
  $this->get_repeater_html( $value, $this->field );
152
  $html = ob_get_clean();
153
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
154
  /* If output wasn't enabled by default, disable again */
155
  if ( ! $output_already_enabled ) {
156
  $this->disable_output();
151
  $this->get_repeater_html( $value, $this->field );
152
  $html = ob_get_clean();
153
 
154
+ /* Ensure a unique ID for all elements in the Repeater field */
155
+ $i = 0;
156
+ $html = preg_replace_callback(
157
+ '/id="(.+?)"/',
158
+ function( $matches ) use ( &$i ) {
159
+ return sprintf(
160
+ 'id="repeater-%s-%s-%s"',
161
+ $this->field->id,
162
+ $matches[1],
163
+ $i++
164
+ );
165
+ },
166
+ $html
167
+ );
168
+
169
  /* If output wasn't enabled by default, disable again */
170
  if ( ! $output_already_enabled ) {
171
  $this->disable_output();
src/Helper/Helper_Field_Container_Gf25.php CHANGED
@@ -60,7 +60,7 @@ class Helper_Field_Container_Gf25 extends Helper_Field_Container {
60
 
61
  parent::generate( $field );
62
 
63
- if ( $this->get_field_width( $field ) < 100 ) {
64
  $field->cssClass .= ' grid grid-' . $field->layoutGridColumnSpan;
65
  }
66
 
60
 
61
  parent::generate( $field );
62
 
63
+ if ( $this->get_field_width( $field ) < 100 && strpos( $field->cssClass, 'grid grid-' ) === false ) {
64
  $field->cssClass .= ' grid grid-' . $field->layoutGridColumnSpan;
65
  }
66
 
src/Helper/Helper_Logger.php CHANGED
@@ -119,8 +119,6 @@ class Helper_Logger {
119
  $this->log->pushProcessor( new IntrospectionProcessor() );
120
  $this->log->pushProcessor( new MemoryPeakUsageProcessor() );
121
 
122
- $this->log->notice( 'Log initialized' );
123
-
124
  return;
125
  }
126
  } catch ( Exception $e ) {
119
  $this->log->pushProcessor( new IntrospectionProcessor() );
120
  $this->log->pushProcessor( new MemoryPeakUsageProcessor() );
121
 
 
 
122
  return;
123
  }
124
  } catch ( Exception $e ) {
src/View/View_PDF.php CHANGED
@@ -614,7 +614,7 @@ class View_PDF extends Helper_Abstract_View {
614
  public function get_core_template_styles( $settings, $entry ) {
615
  $form = apply_filters( 'gfpdf_current_form_object', $this->gform->get_form( $entry['form_id'] ), $entry, __FUNCTION__ );
616
 
617
- $html = $this->load_core_template_styles( $settings );
618
 
619
  $html = apply_filters( 'gfpdf_pdf_core_template_html_output', $html, $form, $entry, $settings );
620
  $html = apply_filters( 'gfpdf_pdf_core_template_html_output_' . $form['id'], $html, $form, $entry, $settings );
@@ -625,14 +625,24 @@ class View_PDF extends Helper_Abstract_View {
625
  /**
626
  * Load our core PDF template settings
627
  *
628
- * @param $settings
 
 
629
  *
630
  * @return string|WP_Error
631
  *
632
  * @since 4.0
633
  */
634
- public function load_core_template_styles( $settings ) {
635
- return $this->load( 'core_template_styles', [ 'settings' => $settings ], false );
 
 
 
 
 
 
 
 
636
  }
637
 
638
  /**
614
  public function get_core_template_styles( $settings, $entry ) {
615
  $form = apply_filters( 'gfpdf_current_form_object', $this->gform->get_form( $entry['form_id'] ), $entry, __FUNCTION__ );
616
 
617
+ $html = $this->load_core_template_styles( $settings, $form, $entry );
618
 
619
  $html = apply_filters( 'gfpdf_pdf_core_template_html_output', $html, $form, $entry, $settings );
620
  $html = apply_filters( 'gfpdf_pdf_core_template_html_output_' . $form['id'], $html, $form, $entry, $settings );
625
  /**
626
  * Load our core PDF template settings
627
  *
628
+ * @param array $settings Current PDF Settings being processed
629
+ * @param array $form Current form being processed (added in 6.5)
630
+ * @param array $entry Current form being processed (added in 6.5)
631
  *
632
  * @return string|WP_Error
633
  *
634
  * @since 4.0
635
  */
636
+ public function load_core_template_styles( $settings, $form = [], $entry = [] ) {
637
+ return $this->load(
638
+ 'core_template_styles',
639
+ [
640
+ 'settings' => $settings,
641
+ 'form' => $form,
642
+ 'entry' => $entry,
643
+ ],
644
+ false
645
+ );
646
  }
647
 
648
  /**
src/View/html/PDF/core_template_styles.php CHANGED
@@ -19,6 +19,8 @@ if ( ! defined( 'ABSPATH' ) ) {
19
 
20
  /**
21
  * @var $settings array
 
 
22
  * @global $gfpdf
23
  */
24
 
@@ -32,7 +34,7 @@ $first_header = $settings['first_header'] ?? '';
32
  $first_footer = $settings['first_footer'] ?? '';
33
 
34
  $background_color = $settings['background_color'] ?? '#FFF';
35
- $background_image = $settings['background_image'] ?? '';
36
  $background_image_path = ! empty( $background_image ) ? $gfpdf->misc->convert_url_to_path( $background_image ) : false;
37
 
38
  $contrast = $gfpdf->misc->get_background_and_border_contrast( $background_color );
19
 
20
  /**
21
  * @var $settings array
22
+ * @var $form array
23
+ * @var $entry array
24
  * @global $gfpdf
25
  */
26
 
34
  $first_footer = $settings['first_footer'] ?? '';
35
 
36
  $background_color = $settings['background_color'] ?? '#FFF';
37
+ $background_image = $gfpdf->gform->process_tags( $settings['background_image'] ?? '', $form, $entry );
38
  $background_image_path = ! empty( $background_image ) ? $gfpdf->misc->convert_url_to_path( $background_image ) : false;
39
 
40
  $contrast = $gfpdf->misc->get_background_and_border_contrast( $background_color );
src/assets/languages/gravity-forms-pdf-extended.pot CHANGED
@@ -6,7 +6,7 @@ msgstr ""
6
  "MIME-Version: 1.0\n"
7
  "Content-Type: text/plain; charset=UTF-8\n"
8
  "Content-Transfer-Encoding: 8bit\n"
9
- "POT-Creation-Date: 2022-08-17 01:49+0000\n"
10
  "X-Poedit-Basepath: ..\n"
11
  "X-Poedit-KeywordsList: __;_e;_ex:1,2c;_n:1,2;_n_noop:1,2;_nx:1,2,4c;_nx_noop:1,2,3c;_x:1,2c;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c\n"
12
  "X-Poedit-SearchPath-0: .\n"
6
  "MIME-Version: 1.0\n"
7
  "Content-Type: text/plain; charset=UTF-8\n"
8
  "Content-Transfer-Encoding: 8bit\n"
9
+ "POT-Creation-Date: 2022-09-06 02:53+0000\n"
10
  "X-Poedit-Basepath: ..\n"
11
  "X-Poedit-KeywordsList: __;_e;_ex:1,2c;_n:1,2;_n_noop:1,2;_nx:1,2,4c;_nx_noop:1,2,3c;_x:1,2c;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c\n"
12
  "X-Poedit-SearchPath-0: .\n"
vendor/composer/installed.json CHANGED
@@ -384,17 +384,17 @@
384
  },
385
  {
386
  "name": "masterminds/html5",
387
- "version": "2.7.5",
388
- "version_normalized": "2.7.5.0",
389
  "source": {
390
  "type": "git",
391
  "url": "https://github.com/Masterminds/html5-php.git",
392
- "reference": "f640ac1bdddff06ea333a920c95bbad8872429ab"
393
  },
394
  "dist": {
395
  "type": "zip",
396
- "url": "https://api.github.com/repos/Masterminds/html5-php/zipball/f640ac1bdddff06ea333a920c95bbad8872429ab",
397
- "reference": "f640ac1bdddff06ea333a920c95bbad8872429ab",
398
  "shasum": ""
399
  },
400
  "require": {
@@ -406,7 +406,7 @@
406
  "require-dev": {
407
  "phpunit/phpunit": "^4.8.35 || ^5.7.21 || ^6 || ^7"
408
  },
409
- "time": "2021-07-01T14:25:37+00:00",
410
  "type": "library",
411
  "extra": {
412
  "branch-alias": {
@@ -450,7 +450,7 @@
450
  ],
451
  "support": {
452
  "issues": "https://github.com/Masterminds/html5-php/issues",
453
- "source": "https://github.com/Masterminds/html5-php/tree/2.7.5"
454
  },
455
  "install-path": "../masterminds/html5"
456
  },
384
  },
385
  {
386
  "name": "masterminds/html5",
387
+ "version": "2.7.6",
388
+ "version_normalized": "2.7.6.0",
389
  "source": {
390
  "type": "git",
391
  "url": "https://github.com/Masterminds/html5-php.git",
392
+ "reference": "897eb517a343a2281f11bc5556d6548db7d93947"
393
  },
394
  "dist": {
395
  "type": "zip",
396
+ "url": "https://api.github.com/repos/Masterminds/html5-php/zipball/897eb517a343a2281f11bc5556d6548db7d93947",
397
+ "reference": "897eb517a343a2281f11bc5556d6548db7d93947",
398
  "shasum": ""
399
  },
400
  "require": {
406
  "require-dev": {
407
  "phpunit/phpunit": "^4.8.35 || ^5.7.21 || ^6 || ^7"
408
  },
409
+ "time": "2022-08-18T16:18:26+00:00",
410
  "type": "library",
411
  "extra": {
412
  "branch-alias": {
450
  ],
451
  "support": {
452
  "issues": "https://github.com/Masterminds/html5-php/issues",
453
+ "source": "https://github.com/Masterminds/html5-php/tree/2.7.6"
454
  },
455
  "install-path": "../masterminds/html5"
456
  },
vendor/composer/installed.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php return array(
2
  'root' => array(
3
  'name' => 'gravitypdf/gravitypdf',
4
- 'pretty_version' => '6.4.5',
5
- 'version' => '6.4.5.0',
6
- 'reference' => '4eda4a5b76ca028da26d96043ae02580dc180b71',
7
  'type' => 'library',
8
  'install_path' => __DIR__ . '/../../',
9
  'aliases' => array(),
@@ -20,9 +20,9 @@
20
  'dev_requirement' => false,
21
  ),
22
  'gravitypdf/gravitypdf' => array(
23
- 'pretty_version' => '6.4.5',
24
- 'version' => '6.4.5.0',
25
- 'reference' => '4eda4a5b76ca028da26d96043ae02580dc180b71',
26
  'type' => 'library',
27
  'install_path' => __DIR__ . '/../../',
28
  'aliases' => array(),
@@ -65,9 +65,9 @@
65
  'dev_requirement' => false,
66
  ),
67
  'masterminds/html5' => array(
68
- 'pretty_version' => '2.7.5',
69
- 'version' => '2.7.5.0',
70
- 'reference' => 'f640ac1bdddff06ea333a920c95bbad8872429ab',
71
  'type' => 'library',
72
  'install_path' => __DIR__ . '/../masterminds/html5',
73
  'aliases' => array(),
1
  <?php return array(
2
  'root' => array(
3
  'name' => 'gravitypdf/gravitypdf',
4
+ 'pretty_version' => '6.4.6',
5
+ 'version' => '6.4.6.0',
6
+ 'reference' => 'f2f992277eed5825b8565175cadf245701c895d6',
7
  'type' => 'library',
8
  'install_path' => __DIR__ . '/../../',
9
  'aliases' => array(),
20
  'dev_requirement' => false,
21
  ),
22
  'gravitypdf/gravitypdf' => array(
23
+ 'pretty_version' => '6.4.6',
24
+ 'version' => '6.4.6.0',
25
+ 'reference' => 'f2f992277eed5825b8565175cadf245701c895d6',
26
  'type' => 'library',
27
  'install_path' => __DIR__ . '/../../',
28
  'aliases' => array(),
65
  'dev_requirement' => false,
66
  ),
67
  'masterminds/html5' => array(
68
+ 'pretty_version' => '2.7.6',
69
+ 'version' => '2.7.6.0',
70
+ 'reference' => '897eb517a343a2281f11bc5556d6548db7d93947',
71
  'type' => 'library',
72
  'install_path' => __DIR__ . '/../masterminds/html5',
73
  'aliases' => array(),
vendor_prefixed/masterminds/html5/src/HTML5/Parser/Scanner.php CHANGED
@@ -90,7 +90,7 @@ class Scanner
90
  */
91
  public function peek()
92
  {
93
- if ($this->char + 1 <= $this->EOF) {
94
  return $this->data[$this->char + 1];
95
  }
96
  return \false;
90
  */
91
  public function peek()
92
  {
93
+ if ($this->char + 1 < $this->EOF) {
94
  return $this->data[$this->char + 1];
95
  }
96
  return \false;
vendor_prefixed/masterminds/html5/src/HTML5/Parser/Tokenizer.php CHANGED
@@ -608,18 +608,24 @@ class Tokenizer
608
  $this->parseError('Unexpected EOF in a comment.');
609
  return \true;
610
  }
611
- // If it doesn't start with -, not the end.
612
- if ('-' != $tok) {
613
  return \false;
614
  }
615
- // Advance one, and test for '->'
616
- if ('-' == $this->scanner->next() && '>' == $this->scanner->peek()) {
 
 
 
 
 
 
617
  $this->scanner->consume();
618
  // Consume the last '>'
619
  return \true;
620
  }
621
- // Unread '-';
622
- $this->scanner->unconsume(1);
623
  return \false;
624
  }
625
  /**
608
  $this->parseError('Unexpected EOF in a comment.');
609
  return \true;
610
  }
611
+ // If next two tokens are not '--', not the end.
612
+ if ('-' != $tok || '-' != $this->scanner->peek()) {
613
  return \false;
614
  }
615
+ $this->scanner->consume(2);
616
+ // Consume '-' and one of '!' or '>'
617
+ // Test for '>'
618
+ if ('>' == $this->scanner->current()) {
619
+ return \true;
620
+ }
621
+ // Test for '!>'
622
+ if ('!' == $this->scanner->current() && '>' == $this->scanner->peek()) {
623
  $this->scanner->consume();
624
  // Consume the last '>'
625
  return \true;
626
  }
627
+ // Unread '-' and one of '!' or '>';
628
+ $this->scanner->unconsume(2);
629
  return \false;
630
  }
631
  /**