Skip to content

Commit

Permalink
Make clear what it means to accept a validation error
Browse files Browse the repository at this point in the history
  • Loading branch information
westonruter committed May 28, 2018
1 parent 90eff4f commit 69055c0
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion includes/validation/class-amp-invalid-url-post-type.php
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,8 @@ public static function print_validation_errors_meta_box( $post ) {
?>
<style>
.amp-validation-errors .detailed,
.amp-validation-errors .actions {
.amp-validation-errors .actions,
.amp-validation-errors .validation-error-other-urls {
margin-left: 30px;
}
.amp-validation-errors pre {
Expand All @@ -859,6 +860,9 @@ public static function print_validation_errors_meta_box( $post ) {
<?php endif; ?>

<div class="amp-validation-errors">
<p>
<?php esc_html_e( 'An accepted validation error is one that will not block a URL from being served as AMP; the validation error will be sanitized, normally resulting in the offending markup being stripped from the response to ensure AMP validity. A validation error that is accepted here will also be accepted for any other URL it occurs on.', 'amp' ); ?>
</p>
<ul>
<?php foreach ( $validation_errors as $error ) : ?>
<?php
Expand Down Expand Up @@ -913,6 +917,32 @@ public static function print_validation_errors_meta_box( $post ) {
echo implode( ' | ', $actions ); // WPCS: xss ok.
?>
</p>
<?php if ( $term->count > 1 ) : ?>
<p class="validation-error-other-urls">
<?php
$url = admin_url(
add_query_arg(
array(
AMP_Validation_Error_Taxonomy::TAXONOMY_SLUG => $term->slug,
'post_type' => self::POST_TYPE_SLUG,
),
'edit.php'
)
);
printf(
/* translators: %1$s is URL to invalid URL page, and %2$s is the count */
wp_kses_post( _n(
'There is at least <a href="%1$s">%2$s other URL</a> which has this validation error. Accepting or rejecting the error here will also apply to the other URL.',
'There are at least <a href="%1$s">%2$s other URLs</a> which have this validation error. Accepting or rejecting the error here will also apply to the other URLs.',
$term->count - 1,
'amp'
) ),
esc_url( $url ),
esc_html( number_format_i18n( $term->count - 1 ) )
);
?>
</p>
<?php endif; ?>
<ul class="detailed">
<?php if ( AMP_Validation_Error_Taxonomy::INVALID_ELEMENT_CODE === $error['data']['code'] ) : ?>
<li>
Expand Down

0 comments on commit 69055c0

Please sign in to comment.