| @@ -1,25 +1,27 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | +defined('ABSPATH') || die('Restricted Access'); | |
| 4 | + | |
| 3 | 5 | use AcyMailing\Classes\FieldClass; |
| 4 | 6 | use AcyMailing\Classes\ListClass; |
| 5 | 7 | use AcyMailing\Core\AcymParameter; |
| 6 | 8 | |
| 9 | +// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound -- Prefixed and unique class name. | |
| 7 | 10 | class acySubscriptionFormWidget extends \Elementor\Widget_Base |
| 8 | 11 | { |
| 9 | - var $displayMode; | |
| 10 | - var $lists; | |
| 11 | - var $listsPlacement; | |
| 12 | - var $fields = []; | |
| 13 | - var $displayTextMode; | |
| 14 | - var $subscriberInfo; | |
| 15 | - var $posts; | |
| 16 | - var $replaceMessage; | |
| 17 | - var $unsubButton; | |
| 18 | - var $alignment; | |
| 19 | - var $includeJavascript; | |
| 20 | - var $settings; | |
| 21 | - var $borderTypes; | |
| 12 | + private array $displayMode; | |
| 13 | + private array $lists; | |
| 14 | + private array $listsPlacement; | |
| 15 | + private array $fields = []; | |
| 16 | + private array $displayTextMode; | |
| 17 | + private array $subscriberInfo; | |
| 18 | + private array $posts; | |
| 19 | + private array $replaceMessage; | |
| 20 | + private array $unsubButton; | |
| 21 | + private array $alignment; | |
| 22 | + private array $includeJavascript; | |
| 23 | + private array $borderTypes; | |
| 22 | 24 | |
| 23 | 25 | public function initParams() |
| 24 | 26 | { |
| 25 | 27 | $this->displayMode = [ |
| @@ -119,8 +121,9 @@ | ||
| 119 | 121 | protected function register_controls() |
| 120 | 122 | { |
| 121 | 123 | $this->initParams(); |
| 122 | 124 | |
| 125 | + //Main option | |
| 123 | 126 | $this->startControlsSection('main_options', acym_translation('ACYM_MAIN_OPTIONS')); |
| 124 | 127 | $this->getText('title', acym_translation('ACYM_TITLE'), 'Receive our newsletters'); |
| 125 | 128 | $this->getSimpleSelect('mode', acym_translation('ACYM_DISPLAY_MODE'), $this->displayMode, 'inline'); |
| 126 | 129 | $this->getText('subtext', acym_translation('ACYM_SUBSCRIBE_TEXT'), 'Subscribe'); |
| @@ -126,8 +129,9 @@ | ||
| 126 | 129 | $this->getText('subtext', acym_translation('ACYM_SUBSCRIBE_TEXT'), 'Subscribe'); |
| 127 | 130 | $this->getText('subtextlogged', acym_translation('ACYM_SUBSCRIBE_TEXT_LOGGED_IN'), 'Subscribe'); |
| 128 | 131 | $this->end_controls_section(); |
| 129 | 132 | |
| 133 | + //Lists option | |
| 130 | 134 | $this->startControlsSection('lists_options', acym_translation('ACYM_LISTS_OPTIONS')); |
| 131 | 135 | $this->getSelect('hiddenlists', acym_translation('ACYM_AUTO_SUBSCRIBE_TO'), $this->lists, '', true); |
| 132 | 136 | $this->getSelect('displists', acym_translation('ACYM_DISPLAYED_LISTS'), $this->lists, '', true); |
| 133 | 137 | $this->getSelect('listschecked', acym_translation('ACYM_LISTS_CHECKED_DEFAULT'), $this->lists, '', true); |
| @@ -133,8 +137,9 @@ | ||
| 133 | 137 | $this->getSelect('listschecked', acym_translation('ACYM_LISTS_CHECKED_DEFAULT'), $this->lists, '', true); |
| 134 | 138 | $this->getSelect('listposition', acym_translation('ACYM_DISPLAY_LISTS'), $this->listsPlacement, 'before'); |
| 135 | 139 | $this->end_controls_section(); |
| 136 | 140 | |
| 141 | + //Fields option | |
| 137 | 142 | $this->startControlsSection('fields_options', acym_translation('ACYM_FIELDS_OPTIONS')); |
| 138 | 143 | $this->getSelect('fields', acym_translation('ACYM_FIELDS_TO_DISPLAY'), $this->fields, '', true); |
| 139 | 144 | $this->getSimpleSelect('textmode', acym_translation('ACYM_TEXT_MODE'), $this->displayTextMode, '1'); |
| 140 | 145 | $this->getSimpleSelect('userinfo', acym_translation('ACYM_FORM_AUTOFILL_ID'), $this->subscriberInfo, '1'); |
| @@ -139,13 +144,16 @@ | ||
| 139 | 144 | $this->getSimpleSelect('textmode', acym_translation('ACYM_TEXT_MODE'), $this->displayTextMode, '1'); |
| 140 | 145 | $this->getSimpleSelect('userinfo', acym_translation('ACYM_FORM_AUTOFILL_ID'), $this->subscriberInfo, '1'); |
| 141 | 146 | $this->end_controls_section(); |
| 142 | 147 | |
| 148 | + //Terms and policy option | |
| 143 | 149 | $this->startControlsSection('terms_condition_options', acym_translation('ACYM_TERMS_POLICY_OPTIONS')); |
| 144 | 150 | $this->getSimpleSelect('termscontent', acym_translation('ACYM_TERMS_CONDITIONS'), $this->posts, ''); |
| 145 | 151 | $this->getSimpleSelect('privacypolicy', acym_translation('ACYM_PRIVACY_POLICY'), $this->posts, ''); |
| 152 | + $this->getSimpleSelect('trackingconsent', acym_translation('ACYM_DISPLAY_TRACKING_CONSENT'), $this->subscriberInfo, '0'); | |
| 146 | 153 | $this->end_controls_section(); |
| 147 | 154 | |
| 155 | + //Subscribe option | |
| 148 | 156 | $this->startControlsSection('subscribe_options', acym_translation('ACYM_SUBSCRIBE_OPTIONS')); |
| 149 | 157 | $this->getSimpleSelect('successmode', acym_translation('ACYM_SUCCESS_MODE'), $this->replaceMessage, 'replace'); |
| 150 | 158 | $this->getText('confirmation_message', acym_translation('ACYM_CONFIRMATION_MESSAGE')); |
| 151 | 159 | $this->getText('redirect', acym_translation('ACYM_REDIRECT_LINK')); |
| @@ -150,8 +158,9 @@ | ||
| 150 | 158 | $this->getText('confirmation_message', acym_translation('ACYM_CONFIRMATION_MESSAGE')); |
| 151 | 159 | $this->getText('redirect', acym_translation('ACYM_REDIRECT_LINK')); |
| 152 | 160 | $this->end_controls_section(); |
| 153 | 161 | |
| 162 | + //Unsubscribe option | |
| 154 | 163 | $this->startControlsSection('unsubscribe_options', acym_translation('ACYM_UNSUBSCRIBE_OPTIONS')); |
| 155 | 164 | $this->getSimpleSelect('unsub', acym_translation('ACYM_DISPLAY_UNSUB_BUTTON'), $this->unsubButton, '0'); |
| 156 | 165 | $this->getText('unsubtext', acym_translation('ACYM_UNSUBSCRIBE_TEXT'), 'Unsubscribe'); |
| 157 | 166 | $this->getText('unsubredirect', acym_translation('ACYM_REDIRECT_LINK_UNSUB')); |
| @@ -156,8 +165,9 @@ | ||
| 156 | 165 | $this->getText('unsubtext', acym_translation('ACYM_UNSUBSCRIBE_TEXT'), 'Unsubscribe'); |
| 157 | 166 | $this->getText('unsubredirect', acym_translation('ACYM_REDIRECT_LINK_UNSUB')); |
| 158 | 167 | $this->end_controls_section(); |
| 159 | 168 | |
| 169 | + //Advanced option | |
| 160 | 170 | $this->startControlsSection('advanced_options', acym_translation('ACYM_ADVANCED_OPTIONS')); |
| 161 | 171 | $this->getText('introtext', acym_translation('ACYM_INTRO_TEXT')); |
| 162 | 172 | $this->getText('posttext', acym_translation('ACYM_POST_TEXT')); |
| 163 | 173 | $this->getSimpleSelect('alignment', acym_translation('ACYM_ALIGNMENT'), $this->alignment, 'none'); |
| @@ -164,8 +174,9 @@ | ||
| 164 | 174 | $this->getSimpleSelect('includejs', acym_translation('ACYM_MODULE_JS'), $this->includeJavascript, 'header'); |
| 165 | 175 | $this->getText('source', acym_translation('ACYM_SOURCE'), 'elementor_subscription_form'); |
| 166 | 176 | $this->end_controls_section(); |
| 167 | 177 | |
| 178 | + // Style zone | |
| 168 | 179 | $this->startControlsSection('global_options', acym_translation('ACYM_GLOBAL_OPTIONS'), \Elementor\Controls_Manager::TAB_STYLE); |
| 169 | 180 | $this->getColor('background_color', acym_translation('ACYM_BACKGROUND_COLOR')); |
| 170 | 181 | $this->getColor('text_color', acym_translation('ACYM_TEXT_COLOR')); |
| 171 | 182 | $this->end_controls_section(); |
| @@ -275,9 +286,7 @@ | ||
| 275 | 286 | protected function render() |
| 276 | 287 | { |
| 277 | 288 | $settings = $this->get_settings_for_display(); |
| 278 | 289 | $params = new AcymParameter($settings); |
| 279 | - $render = acym_renderForm($params); | |
| 280 | - | |
| 281 | - echo $render; | |
| 290 | + acym_renderForm($params); | |
| 282 | 291 | } |
| 283 | 292 | } |