| @@ -1,17 +1,30 @@ | ||
| 1 | -<div class="acym__subscription__form__lists"> | |
| 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 | +?> | |
| 5 | +<div class="acym__subscription__form__lists" role="group" aria-label="<?php echo esc_attr(acym_translation('ACYM_NEWSLETTERS')); ?>"> | |
| 2 | 6 | <?php |
| 3 | 7 | foreach ($form->settings['lists']['displayed'] as $listId) { |
| 4 | 8 | if (!empty($form->settings['lists']['automatic_subscribe']) && in_array($listId, $form->settings['lists']['automatic_subscribe'])) continue; |
| 5 | - $checked = !empty($form->settings['lists']['checked']) && in_array($listId, $form->settings['lists']['checked']) ? 'checked' : ''; | |
| 6 | - echo '<label><input type="checkbox" value="'.$listId.'" name="subscription[]" '.$checked.'>'.$form->lists[$listId].'</label>'; | |
| 9 | + if (empty($form->lists[$listId])) continue; | |
| 10 | + $label = $form->lists[$listId]; | |
| 11 | + ?> | |
| 12 | + <label> | |
| 13 | + <input type="checkbox" | |
| 14 | + value="<?php echo esc_attr($listId); ?>" | |
| 15 | + name="subscription[]" | |
| 16 | + <?php checked(!empty($form->settings['lists']['checked']) && in_array($listId, $form->settings['lists']['checked'])); ?>> | |
| 17 | + <?php echo esc_html($label); ?> | |
| 18 | + </label> | |
| 19 | + <?php | |
| 7 | 20 | } |
| 8 | 21 | |
| 9 | 22 | $hiddenLists = empty($form->settings['lists']['automatic_subscribe']) ? '' : implode(',', $form->settings['lists']['automatic_subscribe']); |
| 10 | - echo '<input type="hidden" name="hiddenlists" value="'.$hiddenLists.'">'; | |
| 23 | + echo '<input type="hidden" name="hiddenlists" value="'.esc_attr($hiddenLists).'">'; | |
| 11 | 24 | ?> |
| 12 | 25 | <style> |
| 13 | - <?php echo '#acym_fulldiv_'.$form->form_tag_name.' '; ?>.acym__subscription__form__fields .acym__subscription__form__lists{ | |
| 26 | + <?php echo '#acym_fulldiv_'.esc_html($form->form_tag_name).' '; ?>.acym__subscription__form__fields .acym__subscription__form__lists{ | |
| 14 | 27 | display: inline-block; |
| 15 | 28 | width: auto; |
| 16 | 29 | margin: 0 20px; |
| 17 | 30 | text-align: left; |
| @@ -16,15 +29,15 @@ | ||
| 16 | 29 | margin: 0 20px; |
| 17 | 30 | text-align: left; |
| 18 | 31 | } |
| 19 | 32 | |
| 20 | - <?php echo '#acym_fulldiv_'.$form->form_tag_name.' '; ?>.acym__subscription__form__fields .acym__subscription__form__lists label{ | |
| 33 | + <?php echo '#acym_fulldiv_'.esc_html($form->form_tag_name).' '; ?>.acym__subscription__form__fields .acym__subscription__form__lists label{ | |
| 21 | 34 | display: inline-block; |
| 22 | 35 | margin-right: 10px; |
| 23 | 36 | width: auto; |
| 24 | 37 | } |
| 25 | 38 | |
| 26 | - <?php echo '#acym_fulldiv_'.$form->form_tag_name.' '; ?>.acym__subscription__form__fields .acym__subscription__form__lists input[type="checkbox"]{ | |
| 39 | + <?php echo '#acym_fulldiv_'.esc_html($form->form_tag_name).' '; ?>.acym__subscription__form__fields .acym__subscription__form__lists input[type="checkbox"]{ | |
| 27 | 40 | margin-top: 0 !important; |
| 28 | 41 | margin-right: 5px; |
| 29 | 42 | } |
| 30 | 43 | </style> |