Skip to content

Commit

Permalink
php format
Browse files Browse the repository at this point in the history
  • Loading branch information
matiasbenedetto authored and creativecoder committed Feb 3, 2024
1 parent 98e8295 commit cd5b338
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
14 changes: 7 additions & 7 deletions lib/compat/wordpress-6.5/fonts/class-wp-font-collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
10 changes: 5 additions & 5 deletions phpunit/tests/fonts/font-library/wpFontCollection/getData.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public function data_create_font_collection() {
'fontFamily' => 'Open Sans, sans-serif<script>alert("xss")</script>',
'slug' => 'open-sans',
'name' => 'Open Sans<script>alert("xss")</script>',
'fontFace' => array(
'fontFace' => array(
array(
'fontFamily' => 'Open Sans',
'fontStyle' => 'normal',
Expand All @@ -130,7 +130,7 @@ public function data_create_font_collection() {
'src' => array(
'https://example.com/src-as-array.woff2?a=<script>alert("xss")</script>',
'https://example.com/src-as-array.ttf',
)
),
),
),
'unwanted_property' => 'potentially evil value',
Expand Down Expand Up @@ -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',
Expand All @@ -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' ),
),
Expand Down

0 comments on commit cd5b338

Please sign in to comment.