PluginProbe
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification / 5.8.1
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification v5.8.1
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
double-opt-in / src / EmailTemplates / BlockRegistry.php

BlockRegistry.php in Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification 5.8.1, at src/EmailTemplates/BlockRegistry.php

139 lines 2.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Block Registry
4 *
5 * Which block types the email renderer knows.
6 *
7 * Up to Core 5.7 this class also decided, by licence, which blocks and how
8 * many templates were allowed. Core on wordpress.org may not lock
9 * functionality behind a licence (plugin guideline 5), and editing
10 * templates is the email editor add-on's feature anyway; since 5.8 nothing
11 * here depends on a licence. The methods the add-on up to 1.0.5 calls are
12 * kept so an older add-on keeps working, but they no longer restrict.
13 *
14 * @package Forge12\DoubleOptIn\EmailTemplates
15 * @since 4.2.0
16 */
17
18 namespace Forge12\DoubleOptIn\EmailTemplates;
19
20 if ( ! defined( 'ABSPATH' ) ) {
21 exit;
22 }
23
24 /**
25 * Class BlockRegistry
26 */
27 class BlockRegistry {
28
29 /**
30 * Basic blocks.
31 *
32 * @var string[]
33 */
34 const FREE_BLOCKS = array(
35 'email-wrapper',
36 'row',
37 'columns-1',
38 'heading',
39 'text',
40 'button',
41 'spacer',
42 'divider',
43 'placeholder-confirm-link',
44 'placeholder-optout-link',
45 'placeholder-date',
46 'placeholder-time',
47 'placeholder-url',
48 'placeholder-custom',
49 );
50
51 /**
52 * Blocks the editor add-on labels as Pro. The renderer handles them
53 * like any other block.
54 *
55 * @var string[]
56 */
57 const PRO_BLOCKS = array(
58 'columns-2',
59 'columns-2-sidebar',
60 'columns-3',
61 'image',
62 'social-icons',
63 'header',
64 'footer',
65 'conditional-content',
66 );
67
68 /**
69 * Maximum number of published templates: no limit.
70 *
71 * @deprecated 5.8.0 Kept for the email editor add-on up to 1.0.5.
72 */
73 public function getTemplateLimit(): int {
74 return PHP_INT_MAX;
75 }
76
77 /**
78 * Always true: Core no longer checks licences here.
79 *
80 * @deprecated 5.8.0 Kept for the email editor add-on up to 1.0.5, which
81 * only runs with a licence anyway.
82 */
83 public function isProActive(): bool {
84 return true;
85 }
86
87 /**
88 * Every known block, all available.
89 *
90 * @deprecated 5.8.0 Kept for the email editor add-on up to 1.0.5.
91 *
92 * @return array<string, array{type: string, available: bool, requiresPro: bool}>
93 */
94 public function getBlockAvailability(): array {
95 $availability = array();
96
97 foreach ( self::FREE_BLOCKS as $blockType ) {
98 $availability[ $blockType ] = array(
99 'type' => $blockType,
100 'available' => true,
101 'requiresPro' => false,
102 );
103 }
104
105 foreach ( self::PRO_BLOCKS as $blockType ) {
106 $availability[ $blockType ] = array(
107 'type' => $blockType,
108 'available' => true,
109 'requiresPro' => true,
110 );
111 }
112
113 return $availability;
114 }
115
116 /**
117 * Every block type is available.
118 *
119 * @deprecated 5.8.0
120 *
121 * @param string $blockType The block type to check.
122 */
123 public function isBlockAvailable( string $blockType ): bool {
124 return true;
125 }
126
127 /**
128 * No block is refused.
129 *
130 * @deprecated 5.8.0
131 *
132 * @param array $blocks The blocks array.
133 * @return array Always empty.
134 */
135 public function validateBlocks( array $blocks ): array {
136 return array();
137 }
138 }
139