From 297a92e18e586b3813a4737f981a3dbde80356d6 Mon Sep 17 00:00:00 2001 From: Jeff Ong Date: Thu, 2 Jun 2022 12:23:30 +0100 Subject: [PATCH 1/3] Only check for index.php if wordpress version is below 6.0. --- checks/class-file-check.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/checks/class-file-check.php b/checks/class-file-check.php index 90607752..ac6ac666 100644 --- a/checks/class-file-check.php +++ b/checks/class-file-check.php @@ -66,7 +66,11 @@ public function check( $php_files, $css_files, $other_files ) { 'favicon\.ico' => __( 'Favicon', 'theme-check' ), ); - $musthave = array( 'index.php', 'style.css', 'readme.txt' ); + $musthave = array( 'style.css', 'readme.txt' ); + + if ( get_bloginfo( 'version' ) < '6.0' ) { + $musthave[] = 'index.php'; + } checkcount(); From 2ee635beb1979866db7f112cec5f2ee48f86e674 Mon Sep 17 00:00:00 2001 From: Jeff Ong Date: Thu, 2 Jun 2022 15:48:04 +0100 Subject: [PATCH 2/3] Check for index.php or templates/index.html. --- checks/class-file-check.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/checks/class-file-check.php b/checks/class-file-check.php index ac6ac666..365dfb3e 100644 --- a/checks/class-file-check.php +++ b/checks/class-file-check.php @@ -68,10 +68,6 @@ public function check( $php_files, $css_files, $other_files ) { $musthave = array( 'style.css', 'readme.txt' ); - if ( get_bloginfo( 'version' ) < '6.0' ) { - $musthave[] = 'index.php'; - } - checkcount(); foreach ( $blocklist as $file => $reason ) { @@ -113,6 +109,15 @@ public function check( $php_files, $css_files, $other_files ) { } } + if ( ! in_array( 'index.php', $filenames ) && ! in_array( 'templates/index.html', $filenames ) { + $this->error[] = sprintf( + '%s: %s', + __( 'REQUIRED', 'theme-check' ), + __( 'Theme must contain an index.php or templates/index.html file.', 'theme-check' ), + ); + $ret = false; + } + return $ret; } From 79c2c841ede8f84b671a5318fe9c8d24a9214c49 Mon Sep 17 00:00:00 2001 From: Jeff Ong Date: Thu, 2 Jun 2022 15:59:27 +0100 Subject: [PATCH 3/3] Fix syntax bugs. --- checks/class-file-check.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/checks/class-file-check.php b/checks/class-file-check.php index 365dfb3e..72b90c6b 100644 --- a/checks/class-file-check.php +++ b/checks/class-file-check.php @@ -109,11 +109,11 @@ public function check( $php_files, $css_files, $other_files ) { } } - if ( ! in_array( 'index.php', $filenames ) && ! in_array( 'templates/index.html', $filenames ) { + if ( ! in_array( 'index.php', $filenames ) && ! in_array( 'templates/index.html', $filenames ) ) { $this->error[] = sprintf( '%s: %s', __( 'REQUIRED', 'theme-check' ), - __( 'Theme must contain an index.php or templates/index.html file.', 'theme-check' ), + __( 'Theme must contain an index.php or templates/index.html file.', 'theme-check' ) ); $ret = false; }