-
Notifications
You must be signed in to change notification settings - Fork 823
AMP Support for Cookies and Consent #15722
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
f9a4a90
AMP Support for Cookies and Consent
MattGeri d11477c
Use em value for AMP cookies and consent offset
MattGeri 2b57eeb
Add AMP widget file to phpcs whitelist
MattGeri e4fd43d
Added cachebuster for stylesheet, and added class_exists checks for J…
ashicus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php // phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable | ||
/** | ||
* AMP Widget for Cookies and Consent. | ||
* | ||
* @package Jetpack | ||
*/ | ||
?> | ||
|
||
<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' : '' ); ?>"> | ||
<script type="application/json"> | ||
{ | ||
"consentInstanceId": "eu-cookie-consent", | ||
"consentRequired": true, | ||
"promptUI": "eu-cookie-consent-prompt" | ||
} | ||
</script> | ||
<div class="popupOverlay" id="eu-cookie-consent-prompt"> | ||
<div class="consentPopup<?php echo esc_attr( ! empty( $instance['color-scheme'] ) && 'negative' === $instance['color-scheme'] ? ' negative' : '' ); ?>" id="eu-cookie-law"> | ||
<form> | ||
<input type="button" on="tap:eu-cookie-consent.accept" class="accept" value="<?php echo esc_attr( $instance['button'] ); ?>" /> | ||
</form> | ||
<?php | ||
if ( 'default' === $instance['text'] || empty( $instance['customtext'] ) ) { | ||
echo wp_kses_post( nl2br( $instance['default-text'] ) ); | ||
} else { | ||
echo esc_html( $instance['customtext'] ); | ||
} | ||
|
||
$policy_link_text = 'default' === $instance['policy-url'] || empty( $instance['custom-policy-url'] ) | ||
? $instance['default-policy-url'] | ||
: $instance['custom-policy-url']; | ||
?> | ||
<a href="<?php echo esc_url( $policy_link_text ); ?>"> | ||
<?php echo esc_html( $instance['policy-link-text'] ); ?> | ||
</a> | ||
</div> | ||
</div> | ||
</amp-consent> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.