From 7ad9c916e8fdd9eae0df788e27edfd32856735bd Mon Sep 17 00:00:00 2001 From: Ari Stathopoulos Date: Wed, 8 Dec 2021 09:27:46 +0200 Subject: [PATCH] remove font-style validation --- lib/class-wp-webfonts.php | 6 ------ phpunit/class-wp-webfonts-test.php | 7 ------- 2 files changed, 13 deletions(-) diff --git a/lib/class-wp-webfonts.php b/lib/class-wp-webfonts.php index c019be7e8dbb3..b9d377c543ebb 100644 --- a/lib/class-wp-webfonts.php +++ b/lib/class-wp-webfonts.php @@ -142,12 +142,6 @@ public function validate_font( $font ) { } } - // Check the font-style. - $valid_font_styles = array( 'normal', 'italic', 'oblique', 'inherit', 'initial', 'revert', 'unset' ); - if ( ! in_array( $font['font-style'], $valid_font_styles, true ) && ! preg_match( '/^oblique\s+(\d+)%/', $font['font-style'] ) ) { - return false; - } - // Check the font-weight. if ( ! is_string( $font['font-weight'] ) && ! is_int( $font['font-weight'] ) ) { trigger_error( __( 'Webfont font weight must be a properly formatted string or integer.', 'gutenberg' ) ); diff --git a/phpunit/class-wp-webfonts-test.php b/phpunit/class-wp-webfonts-test.php index 8ce645e8b7953..5fbc014e286b8 100644 --- a/phpunit/class-wp-webfonts-test.php +++ b/phpunit/class-wp-webfonts-test.php @@ -90,13 +90,6 @@ public function test_validate_font() { $font['src'] = '//example.com/SourceSerif4Variable-Roman.ttf.woff2'; $this->assertEquals( wp_webfonts()->validate_font( $font )['src'], $font['src'] ); - - // Test font-style. - $font['font-style'] = 'invalid'; - $this->assertFalse( wp_webfonts()->validate_font( $font ) ); - $font['font-style'] = 'italic'; - $this->assertNotEmpty( wp_webfonts()->validate_font( $font ) ); - // Test font-weight. $font_weights = array( 100, '100', '100 900', 'normal' ); foreach ( $font_weights as $value ) {