| 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 |
|
| 7 |
$termspolicy = $form->settings['termspolicy'] ?? []; |
| 8 |
|
| 9 |
if (empty($termspolicy['privacy_type']) || $termspolicy['privacy_type'] === 'article') { |
| 10 |
$privacyURL = acym_getArticleURL((int)($termspolicy['privacy'] ?? 0), false, 'ACYM_PRIVACY_POLICY'); |
| 11 |
} elseif ($termspolicy['privacy_type'] === 'url') { |
| 12 |
$privacyURL = $termspolicy['privacy_url'] ?? ''; |
| 13 |
} else { |
| 14 |
$privacyURL = ''; |
| 15 |
} |
| 16 |
|
| 17 |
if (empty($termspolicy['terms_type']) || $termspolicy['terms_type'] === 'article') { |
| 18 |
$termsURL = acym_getArticleURL((int)($termspolicy['termscond'] ?? 0), false, 'ACYM_TERMS_CONDITIONS'); |
| 19 |
} elseif ($termspolicy['terms_type'] === 'url') { |
| 20 |
$termsURL = $termspolicy['terms_url'] ?? ''; |
| 21 |
} else { |
| 22 |
$termsURL = ''; |
| 23 |
} |
| 24 |
|
| 25 |
if (!empty($termspolicy['privacy_type']) && $termspolicy['privacy_type'] === 'url' && !empty($privacyURL)) { |
| 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 |
} |
| 31 |
|
| 32 |
if (!empty($termspolicy['terms_type']) && $termspolicy['terms_type'] === 'url' && !empty($termsURL)) { |
| 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>'; |
| 37 |
} |
| 38 |
|
| 39 |
|
| 40 |
if (empty($termsURL) && empty($privacyURL)) { |
| 41 |
$termslink = ''; |
| 42 |
} elseif (empty($privacyURL)) { |
| 43 |
$termslink = acym_translationSprintf('ACYM_I_AGREE_TERMS', $termsURL); |
| 44 |
} elseif (empty($termsURL)) { |
| 45 |
$termslink = acym_translationSprintf('ACYM_I_AGREE_PRIVACY', $privacyURL); |
| 46 |
} else { |
| 47 |
$termslink = acym_translationSprintf('ACYM_I_AGREE_BOTH', $termsURL, $privacyURL); |
| 48 |
} |
| 49 |
|
| 50 |
if (!empty($termslink)) { |
| 51 |
echo '<div class="acym__subscription__form__termscond">'; |
| 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 |
); |
| 61 |
echo '</label>'; |
| 62 |
echo '</div>'; |
| 63 |
?> |
| 64 |
|
| 65 |
<style> |
| 66 |
.acym__subscription__form__header .acym__subscription__form__termscond, |
| 67 |
.acym__subscription__form__footer .acym__subscription__form__termscond{ |
| 68 |
max-width: 250px; |
| 69 |
} |
| 70 |
|
| 71 |
<?php echo '#acym_fulldiv_'.esc_html($form->form_tag_name).' '; ?>.acym__subscription__form__fields .acym__subscription__form__termscond input[type="checkbox"]{ |
| 72 |
margin-top: 0 !important; |
| 73 |
} |
| 74 |
</style> |
| 75 |
</div> |
| 76 |
<?php } ?> |
| 77 |
|