From 843111a03b4b5806aff3a2177d6772040ace9509 Mon Sep 17 00:00:00 2001 From: Joe McGill Date: Mon, 7 Jan 2019 21:08:03 +0000 Subject: [PATCH] PHPCS: Fix formatting issues. Fixes formatting issues introduced in [44438]. See #45615. git-svn-id: https://develop.svn.wordpress.org/trunk@44441 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/functions.php | 16 +++++++++++----- tests/phpunit/tests/functions.php | 20 ++++++++++---------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php index 8c209ec6bf..b00a47c1d8 100644 --- a/src/wp-includes/functions.php +++ b/src/wp-includes/functions.php @@ -2574,23 +2574,29 @@ function wp_check_filetype_and_ext( $file, $filename, $mimes = null ) { } } elseif ( 'text/plain' === $real_mime ) { // A few common file types are occasionally detected as text/plain; allow those. - if ( ! in_array( $type, array( + if ( ! in_array( + $type, + array( 'text/plain', 'text/csv', 'text/richtext', 'text/tsv', 'text/vtt', - ) ) + ) + ) ) { $type = $ext = false; } - } elseif( 'text/rtf' === $real_mime ) { + } elseif ( 'text/rtf' === $real_mime ) { // Special casing for RTF files. - if ( ! in_array( $type, array( + if ( ! in_array( + $type, + array( 'text/rtf', 'text/plain', 'application/rtf', - ) ) + ) + ) ) { $type = $ext = false; } diff --git a/tests/phpunit/tests/functions.php b/tests/phpunit/tests/functions.php index 6a7c447c28..c7c0b2d1ab 100644 --- a/tests/phpunit/tests/functions.php +++ b/tests/phpunit/tests/functions.php @@ -1341,8 +1341,8 @@ class Tests_Functions extends WP_UnitTestCase { DIR_TESTDATA . '/export/crazy-cdata.xml', 'crazy-cdata.jpg', array( - 'ext' => false, - 'type' => false, + 'ext' => false, + 'type' => false, 'proper_filename' => false, ), ), @@ -1351,8 +1351,8 @@ class Tests_Functions extends WP_UnitTestCase { DIR_TESTDATA . '/export/crazy-cdata.xml', 'crazy-cdata.doc', array( - 'ext' => false, - 'type' => false, + 'ext' => false, + 'type' => false, 'proper_filename' => false, ), ), @@ -1361,8 +1361,8 @@ class Tests_Functions extends WP_UnitTestCase { DIR_TESTDATA . '/uploads/test.vtt', 'test.vtt', array( - 'ext' => 'vtt', - 'type' => 'text/vtt', + 'ext' => 'vtt', + 'type' => 'text/vtt', 'proper_filename' => false, ), ), @@ -1370,8 +1370,8 @@ class Tests_Functions extends WP_UnitTestCase { DIR_TESTDATA . '/uploads/test.csv', 'test.csv', array( - 'ext' => 'csv', - 'type' => 'text/csv', + 'ext' => 'csv', + 'type' => 'text/csv', 'proper_filename' => false, ), ), @@ -1380,8 +1380,8 @@ class Tests_Functions extends WP_UnitTestCase { DIR_TESTDATA . '/uploads/test.rtf', 'test.rtf', array( - 'ext' => 'rtf', - 'type' => 'application/rtf', + 'ext' => 'rtf', + 'type' => 'application/rtf', 'proper_filename' => false, ), ),