Skip to content
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

Fix handling responses to form submissions from an AMP Cache #1382

Merged
merged 3 commits into from
Aug 30, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions amp.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ function amp_init() {

add_rewrite_endpoint( amp_get_slug(), EP_PERMALINK );

add_filter( 'allowed_redirect_hosts', array( 'AMP_HTTP', 'filter_allowed_redirect_hosts' ) );
AMP_HTTP::purge_amp_query_vars();
AMP_HTTP::send_cors_headers();
AMP_HTTP::handle_xhr_request();
AMP_Theme_Support::init();
AMP_Validation_Manager::init();
AMP_Post_Type_Support::add_post_type_support();
Expand Down
14 changes: 14 additions & 0 deletions includes/amp-helper-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -888,3 +888,17 @@ function amp_print_schemaorg_metadata() {
<script type="application/ld+json"><?php echo wp_json_encode( $metadata ); ?></script>
<?php
}

/**
* Filters content and keeps only allowable HTML elements by amp-mustache.
*
* @see wp_kses()
* @since 1.0
*
* @param string $markup Markup to sanitize.
* @return string HTML markup with tags allowed by amp-mustache.
*/
function amp_wp_kses_mustache( $markup ) {
$amp_mustache_allowed_html_tags = array( 'strong', 'b', 'em', 'i', 'u', 's', 'small', 'mark', 'del', 'ins', 'sup', 'sub' );
return wp_kses( $markup, array_fill_keys( $amp_mustache_allowed_html_tags, array() ) );
}
2 changes: 1 addition & 1 deletion includes/class-amp-autoloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class AMP_Autoloader {
private static $_classmap = array(
'AMP_Editor_Blocks' => 'includes/admin/class-amp-editor-blocks',
'AMP_Theme_Support' => 'includes/class-amp-theme-support',
'AMP_Response_Headers' => 'includes/class-amp-response-headers',
'AMP_HTTP' => 'includes/class-amp-http',
'AMP_Comment_Walker' => 'includes/class-amp-comment-walker',
'AMP_Template_Customizer' => 'includes/admin/class-amp-customizer',
'AMP_Post_Meta_Box' => 'includes/admin/class-amp-post-meta-box',
Expand Down
Loading