From ba158001e8fbb6a8d243f0eef729e0dc9c4715bf Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Tue, 4 Jun 2019 17:27:05 -0700 Subject: [PATCH] Eliminate CSS tree shaking from being optional --- .../options/class-amp-options-manager.php | 2 - includes/options/class-amp-options-menu.php | 30 ----- .../sanitizers/class-amp-style-sanitizer.php | 121 ++++++------------ .../class-amp-validated-url-post-type.php | 3 - .../class-amp-validation-manager.php | 24 +--- tests/test-amp-style-sanitizer.php | 118 +++++------------ tests/test-class-amp-options-manager.php | 1 - ...test-class-amp-validated-url-post-type.php | 7 - .../test-class-amp-validation-manager.php | 15 +-- 9 files changed, 75 insertions(+), 246 deletions(-) diff --git a/includes/options/class-amp-options-manager.php b/includes/options/class-amp-options-manager.php index 02f73c84d6c..ab2bc8792a0 100644 --- a/includes/options/class-amp-options-manager.php +++ b/includes/options/class-amp-options-manager.php @@ -27,7 +27,6 @@ class AMP_Options_Manager { 'supported_post_types' => array( 'post' ), 'analytics' => array(), 'auto_accept_sanitization' => true, - 'accept_tree_shaking' => true, 'all_templates_supported' => true, 'supported_templates' => array( 'is_singular' ), 'enable_response_caching' => true, @@ -135,7 +134,6 @@ public static function validate_options( $new_options ) { } $options['auto_accept_sanitization'] = ! empty( $new_options['auto_accept_sanitization'] ); - $options['accept_tree_shaking'] = ! empty( $new_options['accept_tree_shaking'] ); $options['enable_amp_stories'] = ! empty( $new_options['enable_amp_stories'] ); // Validate post type support. diff --git a/includes/options/class-amp-options-menu.php b/includes/options/class-amp-options-menu.php index 86214d667a7..0fe5726f5d8 100644 --- a/includes/options/class-amp-options-menu.php +++ b/includes/options/class-amp-options-menu.php @@ -270,15 +270,8 @@ public function render_validation_handling() { 'code' => 'non_existent', ) ); - remove_filter( 'amp_validation_error_sanitized', array( 'AMP_Validation_Manager', 'filter_tree_shaking_validation_error_as_accepted' ) ); - $tree_shaking_sanitization = AMP_Validation_Error_Taxonomy::get_validation_error_sanitization( - array( - 'code' => AMP_Style_Sanitizer::TREE_SHAKING_ERROR_CODE, - ) - ); $forced_sanitization = 'with_filter' === $auto_sanitization['forced']; - $forced_tree_shaking = $forced_sanitization || 'with_filter' === $tree_shaking_sanitization['forced']; ?> @@ -320,22 +313,6 @@ public function render_validation_handling() { - - - -
-

- -

-

- -

-
- -