← All changes
|
front/FrontViews/Frontusers/tmpl/unsubscribepage.php
+108
-53
10.2.2
→
11.1.0
View file →
| @@ -1,45 +1,64 @@ | ||
| 1 | +<?php | |
| 2 | +// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- View file, its variables are local to the include scope, not true globals. | |
| 3 | +defined('ABSPATH') || die('Restricted Access'); | |
| 4 | +?> | |
| 1 | 5 | <div class="acym__unsubscribe__page grid-x grid-padding-x"> |
| 2 | 6 | <?php if ($this->config->get('display_unsub_image') === '1') { ?> |
| 3 | 7 | <div class="acym__unsubscribe__image__container cell hide-for-small-only"> |
| 4 | 8 | <?php if (!empty($this->config->get('unsubscribe_image'))) { ?> |
| 5 | 9 | <img class="cell padding-3" |
| 6 | - src="<?php echo $this->config->get('unsubscribe_image'); ?>" | |
| 7 | - alt="Unsubscribe Image"> | |
| 10 | + src="<?php echo esc_url($this->config->get('unsubscribe_image')); ?>" | |
| 11 | + alt=""> | |
| 8 | 12 | <?php } else { ?> |
| 9 | 13 | <div class="cell padding-3 acym__unsubscribe__image__svg"> |
| 10 | - <?php echo $data['svgImage']; ?> | |
| 14 | + <?php | |
| 15 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Internal SVG file. | |
| 16 | + echo $data['svgImage']; | |
| 17 | + ?> | |
| 11 | 18 | </div> |
| 12 | 19 | <?php } ?> |
| 13 | 20 | </div> |
| 14 | 21 | <?php } ?> |
| 15 | 22 | <?php $classContainer = $this->config->get('display_unsub_image') === '1' ? '' : 'no-image'; ?> |
| 16 | - <div class="acym__unsubscribe__form__container cell <?php echo $classContainer; ?>"> | |
| 23 | + <div class="acym__unsubscribe__form__container cell <?php echo esc_attr($classContainer); ?>"> | |
| 17 | 24 | <div class="cell"> |
| 18 | - <form action="<?php echo acym_frontendLink('frontusers'); ?>" name="unsubscribepage" class="acym_front_page acym__unsubscribe__form"> | |
| 25 | + <form action="<?php echo esc_url(acym_frontendLink('frontusers')); ?>" name="unsubscribepage" class="acym_front_page acym__unsubscribe__form"> | |
| 19 | 26 | <fieldset class="grid-x grid-margin-x align-center"> |
| 27 | + <legend class="show-for-sr"><?php echo esc_html(acym_translation('ACYM_EMAIL_PREFERENCES')); ?></legend> | |
| 20 | 28 | <div class="acym__unsubscribe__container cell"> |
| 21 | 29 | <div class="acy__unsubscribe__form__header margin-bottom-3"> |
| 22 | 30 | <div class="acym__unsubscribe__form__header__image cell padding-bottom-1"> |
| 23 | 31 | <?php if (!empty($this->config->get('unsubscribe_logo'))) { ?> |
| 24 | - <img class="cell" src="<?php echo $this->config->get('unsubscribe_logo'); ?>" alt="Unsubscribe Logo"> | |
| 32 | + <img class="cell" src="<?php echo esc_attr($this->config->get('unsubscribe_logo')); ?>" alt="<?php echo esc_attr(acym_getCMSConfig('sitename')); ?>"> | |
| 25 | 33 | <?php } ?> |
| 26 | 34 | </div> |
| 27 | - <h2 class="acym__title acym__unsubscribe__title margin-bottom-1"> | |
| 35 | + <h1 class="acym__title acym__unsubscribe__title margin-bottom-1"> | |
| 28 | 36 | <?php if (!empty($this->config->get('unsubscribe_title'))) { |
| 29 | - echo acym_escape($this->config->get('unsubscribe_title')); | |
| 37 | + echo esc_html($this->config->get('unsubscribe_title')); | |
| 30 | 38 | } else { |
| 31 | - echo acym_translation('ACYM_EMAIL_PREFERENCES'); | |
| 39 | + echo esc_html(acym_translation('ACYM_EMAIL_PREFERENCES')); | |
| 32 | 40 | } ?> |
| 33 | - </h2> | |
| 41 | + </h1> | |
| 34 | 42 | <?php if (!empty($data['languages'])) { |
| 35 | - echo acym_select($data['languages'], 'language', $data['lang'], null, 'value', 'text', 'acym__unsubscribe__language__select'); | |
| 43 | + acym_select( | |
| 44 | + $data['languages'], | |
| 45 | + 'language', | |
| 46 | + $data['lang'], | |
| 47 | + ['aria-label' => acym_translation('ACYM_LANGUAGE')], | |
| 48 | + 'value', | |
| 49 | + 'text', | |
| 50 | + 'acym__unsubscribe__language__select', | |
| 51 | + false, | |
| 52 | + true | |
| 53 | + ); | |
| 36 | 54 | } |
| 37 | 55 | ?> |
| 38 | 56 | </div> |
| 39 | 57 | <div class="acym__unsubscribe__lists__container cell margin-bottom-1"> |
| 40 | 58 | <?php if (empty($data['subscriptions'])) { ?> |
| 41 | - <p><?php echo acym_translation('ACYM_NO_DATA_TO_DISPLAY'); ?></p> | |
| 59 | + <p><?php echo esc_html(acym_translation('ACYM_NO_DATA_TO_DISPLAY')); ?></p> | |
| 60 | + <p><?php echo esc_html(acym_translation('ACYM_NO_LIST_FOUND_CAN_UNSUB')); ?></p> | |
| 42 | 61 | <?php } else { ?> |
| 43 | 62 | <div class="acym__unsubscribe__lists__listing margin-bottom-1"> |
| 44 | 63 | <ul class="acym__unsubscribe__lists"> |
| 45 | 64 | <?php foreach ($data['subscriptions'] as $list) { |
| @@ -46,16 +65,26 @@ | ||
| 46 | 65 | if (empty($list->visible)) continue; ?> |
| 47 | 66 | <li class="acym__unsubscribe__list__item grid-x"> |
| 48 | 67 | <div class="acym__unsubscribe__lists__listing cell margin-bottom-1"> |
| 49 | 68 | <p class="acym__unsubscribe__list__display__name"> |
| 50 | - <?php echo !empty($list->display_name) ? $list->display_name : $list->name; ?> | |
| 69 | + <?php echo esc_html(!empty($list->display_name) ? $list->display_name : $list->name); ?> | |
| 51 | 70 | </p> |
| 52 | 71 | <p class="acym__unsubscribe__list__description"> |
| 53 | - <?php echo !empty($list->description) ? $list->description : ''; ?> | |
| 72 | + <?php echo !empty($list->description) ? esc_html($list->description) : ''; ?> | |
| 54 | 73 | </p> |
| 55 | 74 | </div> |
| 56 | 75 | <div class="acym__unsubscribe__list__switch margin-bottom-1 cell"> |
| 57 | - <?php echo acym_switch('lists['.$list->id.']', $list->status, null, ['name' => 'lists['.$list->id.']']); ?> | |
| 76 | + <?php | |
| 77 | + $listName = !empty($list->display_name) ? $list->display_name : $list->name; | |
| 78 | + acym_switch([ | |
| 79 | + 'name' => 'lists['.$list->id.']', | |
| 80 | + 'value' => $list->status, | |
| 81 | + 'attributes' => [ | |
| 82 | + 'name' => 'lists['.$list->id.']', | |
| 83 | + 'aria-label' => $listName, | |
| 84 | + ], | |
| 85 | + ]); | |
| 86 | + ?> | |
| 58 | 87 | </div> |
| 59 | 88 | </li> |
| 60 | 89 | <?php } ?> |
| 61 | 90 | </ul> |
| @@ -62,39 +91,65 @@ | ||
| 62 | 91 | </div> |
| 63 | 92 | <?php } ?> |
| 64 | 93 | <div class="acym__unsubscribe__reason__section cell margin-bottom-1"> |
| 65 | 94 | <div class="acym__unsubscribe__reason__label"> |
| 66 | - <p class="acym__unsubscribe__reason"><?php echo acym_translation('ACYM_SHARE_YOUR_REASONS'); ?></p> | |
| 67 | - <span class="acym__optional"><?php echo acym_translation('ACYM_OPTIONAL'); ?></span> | |
| 95 | + <p class="acym__unsubscribe__reason"><?php echo esc_html(acym_translation('ACYM_SHARE_YOUR_REASONS')); ?></p> | |
| 96 | + <span class="acym__optional"><?php echo esc_html(acym_translation('ACYM_OPTIONAL')); ?></span> | |
| 68 | 97 | </div> |
| 69 | 98 | <?php if (!empty($data['surveyAnswers'])) { |
| 70 | - echo acym_select($data['surveyAnswers'], 'unsubscribe_selector_reason', 'acym__unsubscribe__reason__select'); | |
| 99 | + acym_select( | |
| 100 | + $data['surveyAnswers'], | |
| 101 | + 'unsubscribe_selector_reason', | |
| 102 | + 'acym__unsubscribe__reason__select', | |
| 103 | + ['aria-label' => acym_translation('ACYM_SHARE_YOUR_REASONS')], | |
| 104 | + 'value', | |
| 105 | + 'text', | |
| 106 | + null, | |
| 107 | + false, | |
| 108 | + true | |
| 109 | + ); | |
| 71 | 110 | ?> |
| 72 | 111 | <div class="acym__unsubscribe__reason__label acym__custom__reason__label padding-top-1 is-hidden"> |
| 73 | - <p class="acym__unsubscribe__reason"><?php echo acym_translation('ACYM_CAN_YOU_TELL_MORE'); ?></p> | |
| 74 | - <span class="acym__optional"><?php echo acym_translation('ACYM_OPTIONAL'); ?></span> | |
| 112 | + <p class="acym__unsubscribe__reason"><?php echo esc_html(acym_translation('ACYM_CAN_YOU_TELL_MORE')); ?></p> | |
| 113 | + <span class="acym__optional"><?php echo esc_html(acym_translation('ACYM_OPTIONAL')); ?></span> | |
| 75 | 114 | </div> |
| 76 | - <input type="text" id="acym__custom__unsubscribe__reason" name="unsubscribe_custom_reason" class="is-hidden"> | |
| 115 | + <input type="text" | |
| 116 | + id="acym__custom__unsubscribe__reason" | |
| 117 | + name="unsubscribe_custom_reason" | |
| 118 | + class="is-hidden" | |
| 119 | + aria-label="<?php echo esc_attr(acym_translation('ACYM_CAN_YOU_TELL_MORE')); ?>"> | |
| 77 | 120 | <input type="hidden" name="unsubscribe_reason"> |
| 78 | 121 | <?php } else { ?> |
| 79 | - <input type="text" name="unsubscribe_reason" class="acym__unsubscribe__input__reason"> | |
| 122 | + <input type="text" | |
| 123 | + name="unsubscribe_reason" | |
| 124 | + class="acym__unsubscribe__input__reason" | |
| 125 | + aria-label="<?php echo esc_attr(acym_translation('ACYM_SHARE_YOUR_REASONS')); ?>"> | |
| 80 | 126 | <?php } ?> |
| 81 | 127 | </div> |
| 82 | 128 | <div class="acym__unsubscribe__actions grid-x align-center"> |
| 83 | - <?php if (count($data['subscriptions']) > 1) { ?> | |
| 129 | + <?php if (count($data['subscriptions']) > 1 || empty($data['subscriptions'])) { ?> | |
| 84 | 130 | <button type="button" |
| 85 | - class="button button-secondary cell margin-bottom-1" | |
| 86 | - id="acym__unsub__all" | |
| 87 | - onclick="return acymSubmitForm('unsubscribeAll', this);"> | |
| 88 | - <?php echo acym_translation('ACYM_UNSUBSCRIBE_ALL'); ?> | |
| 131 | + class="button button-secondary cell margin-bottom-1" | |
| 132 | + id="acym__unsub__all" | |
| 133 | + onclick="return acymSubmitForm('unsubscribeAll', this);"> | |
| 134 | + <?php echo esc_html(acym_translation('ACYM_UNSUBSCRIBE_ALL')); ?> | |
| 89 | 135 | </button> |
| 136 | + <?php } | |
| 137 | + if (empty($data['subscriptions'])) { ?> | |
| 138 | + <button type="button" | |
| 139 | + class="button button-primary cell margin-bottom-1" | |
| 140 | + id="acym__unsub__direct" | |
| 141 | + onclick="return acymSubmitForm('unsubscribe', this);"> | |
| 142 | + <?php echo esc_html(acym_translation('ACYM_UNSUBSCRIBE')); ?> | |
| 143 | + </button> | |
| 144 | + <?php } else { ?> | |
| 145 | + <button type="button" | |
| 146 | + class="button button-primary cell margin-bottom-1" | |
| 147 | + id="acym__save" | |
| 148 | + onclick="return acymSubmitForm('saveSubscriptions', this);"> | |
| 149 | + <?php echo esc_html(acym_translation('ACYM_UPDATE_PREFERENCES')); ?> | |
| 150 | + </button> | |
| 90 | 151 | <?php } ?> |
| 91 | - <button type="button" | |
| 92 | - class="button button-primary cell margin-bottom-1" | |
| 93 | - id="acym__save" | |
| 94 | - onclick="return acymSubmitForm('saveSubscriptions', this);"> | |
| 95 | - <?php echo acym_translation('ACYM_UPDATE_PREFERENCES'); ?> | |
| 96 | - </button> | |
| 97 | 152 | </div> |
| 98 | 153 | </div> |
| 99 | 154 | </div> |
| 100 | 155 | <?php |
| @@ -99,17 +154,17 @@ | ||
| 99 | 154 | </div> |
| 100 | 155 | <?php |
| 101 | 156 | if ($this->config->get('display_built_by', 1)) { ?> |
| 102 | 157 | <img class="cell acym__powered__by__image" |
| 103 | - src="<?php echo ACYM_IMAGES.'editor/poweredby_black.png'; ?>" | |
| 104 | - alt="Powered by AcyMailing"> | |
| 158 | + src="<?php echo esc_url(ACYM_IMAGES.'editor/poweredby_black.png'); ?>" | |
| 159 | + alt="Powered by AcyMailing"> | |
| 105 | 160 | <?php } ?> |
| 106 | 161 | |
| 107 | 162 | </fieldset> |
| 108 | 163 | <?php acym_formOptions(); ?> |
| 109 | - <input type="hidden" name="user_id" value="<?php echo $data['user']->id; ?>"> | |
| 110 | - <input type="hidden" name="user_key" value="<?php echo acym_escape($data['user']->key); ?>"> | |
| 111 | - <input type="hidden" name="mail_id" value="<?php echo $data['mail_id']; ?>"> | |
| 164 | + <input type="hidden" name="user_id" value="<?php echo esc_attr($data['user']->id); ?>"> | |
| 165 | + <input type="hidden" name="user_key" value="<?php echo esc_attr($data['user']->key ?? ''); ?>"> | |
| 166 | + <input type="hidden" name="mail_id" value="<?php echo esc_attr($data['mail_id']); ?>"> | |
| 112 | 167 | <input type="hidden" name="displayed_checked_lists" id="displayed_checked_lists"> |
| 113 | 168 | </form> |
| 114 | 169 | </div> |
| 115 | 170 | </div> |
| @@ -116,43 +171,43 @@ | ||
| 116 | 171 | </div> |
| 117 | 172 | |
| 118 | 173 | <style> |
| 119 | 174 | #acym__unsub__all:hover{ |
| 120 | - background-color: <?php echo $data['hoverColor']; ?> !important; | |
| 121 | - border-color: <?php echo $data['hoverColor']; ?> !important; | |
| 175 | + background-color: <?php echo esc_html($data['hoverColor']); ?> !important; | |
| 176 | + border-color: <?php echo esc_html($data['hoverColor']); ?> !important; | |
| 122 | 177 | } |
| 123 | 178 | |
| 124 | 179 | #acym__save:hover{ |
| 125 | - background-color: <?php echo $data['hoverColor']; ?> !important; | |
| 126 | - border-color: <?php echo $data['hoverColor']; ?> !important; | |
| 180 | + background-color: <?php echo esc_html($data['hoverColor']); ?> !important; | |
| 181 | + border-color: <?php echo esc_html($data['hoverColor']); ?> !important; | |
| 127 | 182 | } |
| 128 | 183 | |
| 129 | 184 | .switch input:checked ~ .switch-paddle{ |
| 130 | - background-color: <?php echo $data['unsubscribeColor']; ?> !important; | |
| 131 | - border-color: <?php echo $data['unsubscribeColor']; ?> !important; | |
| 185 | + background-color: <?php echo esc_html($data['unsubscribeColor']); ?> !important; | |
| 186 | + border-color: <?php echo esc_html($data['unsubscribeColor']); ?> !important; | |
| 132 | 187 | } |
| 133 | 188 | |
| 134 | 189 | .acym__unsub__reason__selected{ |
| 135 | - border-color: <?php echo $data['unsubscribeColor']; ?> !important; | |
| 190 | + border-color: <?php echo esc_html($data['unsubscribeColor']); ?> !important; | |
| 136 | 191 | } |
| 137 | 192 | |
| 138 | 193 | .button-primary{ |
| 139 | - background-color: <?php echo $data['unsubscribeColor']; ?> !important; | |
| 140 | - border-color: <?php echo $data['unsubscribeColor']; ?> !important; | |
| 194 | + background-color: <?php echo esc_html($data['unsubscribeColor']); ?> !important; | |
| 195 | + border-color: <?php echo esc_html($data['unsubscribeColor']); ?> !important; | |
| 141 | 196 | } |
| 142 | 197 | |
| 143 | 198 | .button-primary:hover{ |
| 144 | - background-color: <?php echo $data['hoverColor']; ?> !important; | |
| 145 | - border-color: <?php echo $data['hoverColor']; ?> !important; | |
| 199 | + background-color: <?php echo esc_html($data['hoverColor']); ?> !important; | |
| 200 | + border-color: <?php echo esc_html($data['hoverColor']); ?> !important; | |
| 146 | 201 | } |
| 147 | 202 | |
| 148 | 203 | .button-secondary{ |
| 149 | - border-color: <?php echo $data['unsubscribeColor']; ?> !important; | |
| 150 | - color: <?php echo $data['unsubscribeColor']; ?> !important; | |
| 204 | + border-color: <?php echo esc_html($data['unsubscribeColor']); ?> !important; | |
| 205 | + color: <?php echo esc_html($data['unsubscribeColor']); ?> !important; | |
| 151 | 206 | } |
| 152 | 207 | |
| 153 | 208 | .button-secondary:hover{ |
| 154 | - border-color: <?php echo $data['hoverColor']; ?> !important; | |
| 209 | + border-color: <?php echo esc_html($data['hoverColor']); ?> !important; | |
| 155 | 210 | } |
| 156 | 211 | </style> |
| 157 | 212 | |
| 158 | -<?php if ('wordpress' == ACYM_CMS) exit; ?> | |
| 213 | +<?php if ('wordpress' === ACYM_CMS) exit; ?> | |