PluginProbe
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification / 5.7.0
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification v5.7.0
5.8.0 5.8.1 5.7.0 5.6.2 5.6.3 5.6.1 5.6.0 5.5.0 5.4.0 5.3.2 5.3.1 5.1.6 5.1.5 trunk 2.1.5 2.11 2.12 2.13 2.15 3.0.0 3.0.1 3.0.2 3.0.3 3.0.5 3.0.51 All 41 releases
← All changes | src/EmailTemplates/EmailHtmlGenerator.php +11 -5 trunk → 5.7.0 View file →
@@ -42,8 +42,15 @@
42 42 */
43 43 private array $globalStyles = array();
44 44
45 45 /**
46 + * Block Registry for Pro checks.
47 + *
48 + * @var BlockRegistry|null
49 + */
50 + private ?BlockRegistry $blockRegistry = null;
51 +
52 + /**
46 53 * Generate email HTML from blocks.
47 54 *
48 55 * @param array $blocks Array of block data.
49 56 * @param array $globalStyles Optional. Global styles.
@@ -49,9 +56,10 @@
49 56 * @param array $globalStyles Optional. Global styles.
50 57 * @return string Generated HTML.
51 58 */
52 59 public function generate( array $blocks, array $globalStyles = array() ): string {
53 - $this->globalStyles = wp_parse_args( $globalStyles, $this->defaultStyles );
60 + $this->globalStyles = wp_parse_args( $globalStyles, $this->defaultStyles );
61 + $this->blockRegistry = new BlockRegistry();
54 62
55 63 $contentWidth = (int) $this->globalStyles['contentWidth'];
56 64 $backgroundColor = esc_attr( $this->globalStyles['backgroundColor'] );
57 65 $fontFamily = esc_attr( $this->globalStyles['fontFamily'] );
@@ -145,12 +153,10 @@
145 153 $customCss = $attributes['customCss'] ?? '';
146 154
147 155 $html = $this->renderBlockContent( $type, $attributes, $children, $parentBgColor );
148 156
149 - // Custom CSS saved with the template is always rendered. Only admins
150 - // can store it (the editor add-on, manage_options), and a mail must
151 - // not change its look because a licence ran out.
152 - if ( ! empty( $customCss ) ) {
157 + // Inject custom CSS as inline styles (Pro only)
158 + if ( ! empty( $customCss ) && $this->blockRegistry && $this->blockRegistry->isProActive() ) {
153 159 $html = $this->injectCustomCss( $html, $customCss );
154 160 }
155 161
156 162 return $html;