PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 11.1.0
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v11.1.0
11.1.1 11.1.0 11.0.5 11.0.4 11.0.3 11.0.2 11.0.1 11.0.0 10.11.1 10.11.0 10.10.2 10.10.1 10.10.0 10.9.1 trunk 10.0.0 10.0.1 10.1.0 10.1.1 10.1.2 10.1.3 10.1.4 10.2.0 10.2.1 10.2.2 All 62 releases
← All changes | WpInit/Forms.php +15 -7 10.2.2 → 11.1.0 View file →
@@ -1,14 +1,15 @@
1 1 <?php
2 2
3 3 namespace AcyMailing\WpInit;
4 4
5 +defined('ABSPATH') || die('Restricted Access');
6 +
5 7 use AcyMailing\Classes\FormClass;
6 8
7 9 class Forms
8 10 {
9 - var $formToDisplay = [];
10 - var $formClass;
11 + private array $formToDisplay = [];
11 12
12 13 public function __construct()
13 14 {
14 15 $isPreview = acym_getVar('bool', 'acym_preview', false);
@@ -13,10 +14,12 @@
13 14 {
14 15 $isPreview = acym_getVar('bool', 'acym_preview', false);
15 16 if ($isPreview) return;
16 17
17 - add_action('wp_head', [$this, 'prepareFormsToDisplay']);
18 - add_action('wp_footer', [$this, 'displayForms']);
18 + if (acym_level(ACYM_ENTERPRISE)) {
19 + add_action('wp_head', [$this, 'prepareFormsToDisplay']);
20 + add_action('wp_footer', [$this, 'displayForms']);
21 + }
19 22 $this->registerShortcodes();
20 23 }
21 24
22 25 public function prepareFormsToDisplay()
@@ -34,15 +37,20 @@
34 37 $this->formToDisplay[] = $formClass->renderForm($form);
35 38 }
36 39 }
37 40
38 - if (!empty($this->formToDisplay)) acym_initModule();
41 + if (!empty($this->formToDisplay)) {
42 + acym_initModule();
43 + }
39 44 }
40 45
41 46 public function displayForms()
42 47 {
43 - if (empty($this->formToDisplay)) return;
48 + if (empty($this->formToDisplay)) {
49 + return;
50 + }
44 51
52 + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Generated in partial folder "forms", escaped there.
45 53 echo implode('', $this->formToDisplay);
46 54 }
47 55
48 56 public function registerShortcodes()
@@ -65,9 +73,9 @@
65 73
66 74 $formClass = new FormClass();
67 75 $form = $formClass->getOneById($params['id']);
68 76
69 - if (empty($form) || empty($form->active)) return;
77 + if (empty($form->active)) return;
70 78
71 79 return $formClass->renderForm($form, false, true);
72 80 }
73 81 }