From cd5b3386d4a720d33e821ffee7e996ee2261fb2c Mon Sep 17 00:00:00 2001 From: Matias Benedetto Date: Fri, 2 Feb 2024 20:17:43 -0300 Subject: [PATCH] php format --- .../fonts/class-wp-font-collection.php | 14 +++++++------- .../font-library/wpFontCollection/getData.php | 10 +++++----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/compat/wordpress-6.5/fonts/class-wp-font-collection.php b/lib/compat/wordpress-6.5/fonts/class-wp-font-collection.php index f614d7faf3a2d..f628b90d31b00 100644 --- a/lib/compat/wordpress-6.5/fonts/class-wp-font-collection.php +++ b/lib/compat/wordpress-6.5/fonts/class-wp-font-collection.php @@ -269,20 +269,20 @@ private function validate_andd_sanitize( $data ) { /** * Sanitizes a src property. - * + * * Font faces can have a src property consisting on a string or an array of strings. * This method sanitizes the src property value. - * + * * @since 6.5.0 - * + * * @param string|array $value src property value to sanitize. - * + * * @return string|array Sanitized URL value. */ public static function sanitize_src_property( $value ) { - if( is_array( $value ) ) { - foreach( $value as $key => $val ) { - $value[$key] = sanitize_url( $val ); + if ( is_array( $value ) ) { + foreach ( $value as $key => $val ) { + $value[ $key ] = sanitize_url( $val ); } return $value; } diff --git a/phpunit/tests/fonts/font-library/wpFontCollection/getData.php b/phpunit/tests/fonts/font-library/wpFontCollection/getData.php index 7fdfb329fd846..c77456dde1405 100644 --- a/phpunit/tests/fonts/font-library/wpFontCollection/getData.php +++ b/phpunit/tests/fonts/font-library/wpFontCollection/getData.php @@ -116,7 +116,7 @@ public function data_create_font_collection() { 'fontFamily' => 'Open Sans, sans-serif', 'slug' => 'open-sans', 'name' => 'Open Sans', - 'fontFace' => array( + 'fontFace' => array( array( 'fontFamily' => 'Open Sans', 'fontStyle' => 'normal', @@ -130,7 +130,7 @@ public function data_create_font_collection() { 'src' => array( 'https://example.com/src-as-array.woff2?a=', 'https://example.com/src-as-array.ttf', - ) + ), ), ), 'unwanted_property' => 'potentially evil value', @@ -162,7 +162,7 @@ public function data_create_font_collection() { 'fontFamily' => 'Open Sans, sans-serif', 'slug' => 'open-sans', 'name' => 'Open Sans', - 'fontFace' => array( + 'fontFace' => array( array( 'fontFamily' => 'Open Sans', 'fontStyle' => 'normal', @@ -176,9 +176,9 @@ public function data_create_font_collection() { 'src' => array( 'https://example.com/src-as-array.woff2?a=scriptalert(xss)/script', 'https://example.com/src-as-array.ttf', - ) + ), ), - ) + ), ), 'categories' => array( 'sans-serifalertxss' ), ),