| @@ -1,13 +1,14 @@ | ||
| 1 | 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 | +use AcyMailing\Helpers\SecurityHelper; | |
| 6 | + | |
| 2 | 7 | $termspolicy = $form->settings['termspolicy'] ?? []; |
| 3 | 8 | |
| 4 | 9 | if (empty($termspolicy['privacy_type']) || $termspolicy['privacy_type'] === 'article') { |
| 5 | - $privacyURL = acym_getArticleURL( | |
| 6 | - (int)($termspolicy['privacy'] ?? 0), | |
| 7 | - false, | |
| 8 | - 'ACYM_PRIVACY_POLICY' | |
| 9 | - ); | |
| 10 | + $privacyURL = acym_getArticleURL((int)($termspolicy['privacy'] ?? 0), false, 'ACYM_PRIVACY_POLICY'); | |
| 10 | 11 | } elseif ($termspolicy['privacy_type'] === 'url') { |
| 11 | 12 | $privacyURL = $termspolicy['privacy_url'] ?? ''; |
| 12 | 13 | } else { |
| 13 | 14 | $privacyURL = ''; |
| @@ -13,13 +14,9 @@ | ||
| 13 | 14 | $privacyURL = ''; |
| 14 | 15 | } |
| 15 | 16 | |
| 16 | 17 | if (empty($termspolicy['terms_type']) || $termspolicy['terms_type'] === 'article') { |
| 17 | - $termsURL = acym_getArticleURL( | |
| 18 | - (int)($termspolicy['termscond'] ?? 0), | |
| 19 | - false, | |
| 20 | - 'ACYM_TERMS_CONDITIONS' | |
| 21 | - ); | |
| 18 | + $termsURL = acym_getArticleURL((int)($termspolicy['termscond'] ?? 0), false, 'ACYM_TERMS_CONDITIONS'); | |
| 22 | 19 | } elseif ($termspolicy['terms_type'] === 'url') { |
| 23 | 20 | $termsURL = $termspolicy['terms_url'] ?? ''; |
| 24 | 21 | } else { |
| 25 | 22 | $termsURL = ''; |
| @@ -25,13 +22,19 @@ | ||
| 25 | 22 | $termsURL = ''; |
| 26 | 23 | } |
| 27 | 24 | |
| 28 | 25 | if (!empty($termspolicy['privacy_type']) && $termspolicy['privacy_type'] === 'url' && !empty($privacyURL)) { |
| 29 | - $privacyURL = '<a href="'.acym_escapeUrl($privacyURL).'" target="_blank">'.acym_translation('ACYM_PRIVACY_POLICY').'</a>'; | |
| 26 | + $privacyLabel = acym_translation('ACYM_PRIVACY_POLICY'); | |
| 27 | + $privacyURL = '<a href="'.esc_url($privacyURL).'" target="_blank" rel="noopener noreferrer" aria-label="'.esc_attr( | |
| 28 | + $privacyLabel.', '.acym_translation('ACYM_OPENS_NEW_WINDOW') | |
| 29 | + ).'">'.esc_html($privacyLabel).'</a>'; | |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | if (!empty($termspolicy['terms_type']) && $termspolicy['terms_type'] === 'url' && !empty($termsURL)) { |
| 33 | - $termsURL = '<a href="'.acym_escapeUrl($termsURL).'" target="_blank">'.acym_translation('ACYM_TERMS_CONDITIONS').'</a>'; | |
| 33 | + $termsLabel = acym_translation('ACYM_TERMS_CONDITIONS'); | |
| 34 | + $termsURL = '<a href="'.esc_url($termsURL).'" target="_blank" rel="noopener noreferrer" aria-label="'.esc_attr( | |
| 35 | + $termsLabel.', '.acym_translation('ACYM_OPENS_NEW_WINDOW') | |
| 36 | + ).'">'.esc_html($termsLabel).'</a>'; | |
| 34 | 37 | } |
| 35 | 38 | |
| 36 | 39 | |
| 37 | 40 | if (empty($termsURL) && empty($privacyURL)) { |
| @@ -45,11 +48,17 @@ | ||
| 45 | 48 | } |
| 46 | 49 | |
| 47 | 50 | if (!empty($termslink)) { |
| 48 | 51 | echo '<div class="acym__subscription__form__termscond">'; |
| 49 | - echo '<div class="onefield fieldacyterms" id="field_terms_'.$form->form_tag_name.'">'; | |
| 50 | - echo '<label for="mailingdata_terms_'.$form->form_tag_name.'">'; | |
| 51 | - echo '<input id="mailingdata_terms_'.$form->form_tag_name.'" class="checkbox" type="checkbox" name="terms" title="'.acym_translation('ACYM_TERMS_CONDITIONS').'"/> '.$termslink; | |
| 52 | + echo '<div class="onefield fieldacyterms" id="field_terms_'.esc_attr($form->form_tag_name).'">'; | |
| 53 | + echo '<label for="mailingdata_terms_'.esc_attr($form->form_tag_name).'">'; | |
| 54 | + echo '<input id="mailingdata_terms_'.esc_attr($form->form_tag_name).'" class="checkbox" type="checkbox" name="terms" aria-required="true" title="'.esc_attr( | |
| 55 | + acym_translation('ACYM_TERMS_CONDITIONS') | |
| 56 | + ).'"/> '; | |
| 57 | + echo wp_kses( | |
| 58 | + $termslink, | |
| 59 | + SecurityHelper::ALLOWED_HTML_TERMS | |
| 60 | + ); | |
| 52 | 61 | echo '</label>'; |
| 53 | 62 | echo '</div>'; |
| 54 | 63 | ?> |
| 55 | 64 | |
| @@ -58,9 +67,9 @@ | ||
| 58 | 67 | .acym__subscription__form__footer .acym__subscription__form__termscond{ |
| 59 | 68 | max-width: 250px; |
| 60 | 69 | } |
| 61 | 70 | |
| 62 | - <?php echo '#acym_fulldiv_'.$form->form_tag_name.' '; ?>.acym__subscription__form__fields .acym__subscription__form__termscond input[type="checkbox"]{ | |
| 71 | + <?php echo '#acym_fulldiv_'.esc_html($form->form_tag_name).' '; ?>.acym__subscription__form__fields .acym__subscription__form__termscond input[type="checkbox"]{ | |
| 63 | 72 | margin-top: 0 !important; |
| 64 | 73 | } |
| 65 | 74 | </style> |
| 66 | 75 | </div> |