| @@ -1,11 +1,12 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace AcyMailing\WpInit; |
| 4 | 4 | |
| 5 | +defined('ABSPATH') || die('Restricted Access'); | |
| 6 | + | |
| 5 | 7 | use AcyMailing\Classes\FieldClass; |
| 6 | 8 | use AcyMailing\Classes\ListClass; |
| 7 | -use AcyMailing\Classes\UserClass; | |
| 8 | 9 | use AcyMailing\Core\AcymParameter; |
| 9 | 10 | |
| 10 | 11 | class Gutenberg |
| 11 | 12 | { |
| @@ -43,15 +44,21 @@ | ||
| 43 | 44 | public function registerBlockSubscription() |
| 44 | 45 | { |
| 45 | 46 | wp_register_script( |
| 46 | 47 | 'gutenberg-acymailing-subscription-form', |
| 47 | - ACYM_JS.'gutenberg/subscription.min.js?time='.time() | |
| 48 | + ACYM_JS.'gutenberg/subscription.min.js?time='.time(), | |
| 49 | + [], | |
| 50 | + '11.1.0', | |
| 51 | + [ | |
| 52 | + 'in_footer' => false, | |
| 53 | + ] | |
| 48 | 54 | ); |
| 49 | 55 | wp_add_inline_script( |
| 50 | 56 | 'gutenberg-acymailing-subscription-form', |
| 51 | 57 | 'var acym_lists = '.json_encode($this->lists).'; |
| 52 | 58 | var ACYM_JS_TXT = '.acym_getJSMessages().'; |
| 53 | - var acym_fields = '.json_encode($this->fields).';' | |
| 59 | + var acym_fields = '.json_encode($this->fields).'; | |
| 60 | + var acym_subscription_nonce = '.json_encode(wp_create_nonce('acymnonce')).';' | |
| 54 | 61 | ); |
| 55 | 62 | |
| 56 | 63 | $basicAttribute = [ |
| 57 | 64 | 'title' => [ |
| @@ -89,8 +96,20 @@ | ||
| 89 | 96 | 'privacypolicy' => [ |
| 90 | 97 | 'type' => 'string', |
| 91 | 98 | 'default' => '', |
| 92 | 99 | ], |
| 100 | + 'termscontentURL' => [ | |
| 101 | + 'type' => 'string', | |
| 102 | + 'default' => '', | |
| 103 | + ], | |
| 104 | + 'privacypolicyURL' => [ | |
| 105 | + 'type' => 'string', | |
| 106 | + 'default' => '', | |
| 107 | + ], | |
| 108 | + 'trackingconsent' => [ | |
| 109 | + 'type' => 'string', | |
| 110 | + 'default' => '0', | |
| 111 | + ], | |
| 93 | 112 | 'unsub' => [ |
| 94 | 113 | 'type' => 'string', |
| 95 | 114 | 'default' => '0', |
| 96 | 115 | ], |
| @@ -190,12 +209,15 @@ | ||
| 190 | 209 | $block_attributes = array_merge($block_attributes, $moreBlockAttributes); |
| 191 | 210 | } |
| 192 | 211 | $params = new AcymParameter($block_attributes); |
| 193 | 212 | |
| 194 | - return acym_renderForm( | |
| 213 | + ob_start(); | |
| 214 | + acym_renderForm( | |
| 195 | 215 | $params, |
| 196 | 216 | ['disableButtons' => strpos(acym_currentURL(), 'block-renderer') !== false] |
| 197 | 217 | ); |
| 218 | + | |
| 219 | + return ob_get_clean(); | |
| 198 | 220 | } |
| 199 | 221 | |
| 200 | 222 | public function registerBlockProfile() |
| 201 | 223 | { |
| @@ -202,9 +224,14 @@ | ||
| 202 | 224 | if (!function_exists('register_block_type')) return; |
| 203 | 225 | |
| 204 | 226 | wp_register_script( |
| 205 | 227 | 'gutenberg-acymailing-profile', |
| 206 | - ACYM_JS.'gutenberg/profile.min.js?time='.time() | |
| 228 | + ACYM_JS.'gutenberg/profile.min.js?time='.time(), | |
| 229 | + [], | |
| 230 | + '11.1.0', | |
| 231 | + [ | |
| 232 | + 'in_footer' => false, | |
| 233 | + ] | |
| 207 | 234 | ); |
| 208 | 235 | wp_add_inline_script( |
| 209 | 236 | 'gutenberg-acymailing-profile', |
| 210 | 237 | 'var acym_lists_profile = '.json_encode($this->lists).'; |
| @@ -269,9 +296,14 @@ | ||
| 269 | 296 | if (!function_exists('register_block_type')) return; |
| 270 | 297 | |
| 271 | 298 | wp_register_script( |
| 272 | 299 | 'gutenberg-acymailing-archive', |
| 273 | - ACYM_JS.'gutenberg/archive.min.js?time='.time() | |
| 300 | + ACYM_JS.'gutenberg/archive.min.js?time='.time(), | |
| 301 | + [], | |
| 302 | + '11.1.0', | |
| 303 | + [ | |
| 304 | + 'in_footer' => false, | |
| 305 | + ] | |
| 274 | 306 | ); |
| 275 | 307 | wp_add_inline_script( |
| 276 | 308 | 'gutenberg-acymailing-archive', |
| 277 | 309 | 'var acym_lists_archive = '.json_encode($this->lists).'; |