Nenhuma Descrição

widget-amp.php 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php // phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable
  2. /**
  3. * AMP Widget for Cookies and Consent.
  4. *
  5. * @package automattic/jetpack
  6. */
  7. ?>
  8. <amp-consent id="eu-cookie-consent" layout="nodisplay" class="widget widget_eu_cookie_law_widget<?php echo esc_attr( ! empty( $instance['position'] ) && 'top' === $instance['position'] ? ' top' : '' ); ?>">
  9. <script type="application/json">
  10. {
  11. "consentInstanceId": "eu-cookie-consent",
  12. "consentRequired": true,
  13. "promptUI": "eu-cookie-consent-prompt"
  14. }
  15. </script>
  16. <div class="popupOverlay" id="eu-cookie-consent-prompt">
  17. <div class="consentPopup<?php echo esc_attr( ! empty( $instance['color-scheme'] ) && 'negative' === $instance['color-scheme'] ? ' negative' : '' ); ?>" id="eu-cookie-law">
  18. <form>
  19. <input type="button" on="tap:eu-cookie-consent.accept" class="accept" value="<?php echo esc_attr( $instance['button'] ); ?>" />
  20. </form>
  21. <?php
  22. if ( 'default' === $instance['text'] || empty( $instance['customtext'] ) ) {
  23. echo wp_kses_post( nl2br( $instance['default-text'] ) );
  24. } else {
  25. echo esc_html( $instance['customtext'] );
  26. }
  27. $is_default_policy = 'default' === $instance['policy-url'] || empty( $instance['custom-policy-url'] );
  28. $policy_link_url = $is_default_policy ? $instance['default-policy-url'] : $instance['custom-policy-url'];
  29. $policy_link_rel = $is_default_policy ? 'nofollow' : '';
  30. ?>
  31. <a href="<?php echo esc_url( $policy_link_url ); ?>" rel="<?php echo esc_attr( $policy_link_rel ); ?>">
  32. <?php echo esc_html( $instance['policy-link-text'] ); ?>
  33. </a>
  34. </div>
  35. </div>
  36. </amp-consent>