Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
= 20260720 =
* Fix: Ensure standard translation checks (I18N) are not bypassed when Polylang functions are present in the same file.
* Fix: Target the theme's main style.css file for header checks rather than parsing combined CSS text.
* Update: Verified compatibility with PHP 8.5+.
* Tested with WordPress 7.0.2

= 20260508 =
* Tested with WordPress 6.9

Expand Down
8 changes: 5 additions & 3 deletions checks/class-i18n-check.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ public function check( $php_files, $css_files, $other_files ) {
$stmts = array();
foreach ( array( '_e(', '__(', '_e (', '__ (' ) as $finder ) {
$search = $phpfile;
while ( ( $pos = strpos( $search, $finder ) ) !== false &&
strpos( $search, 'pll__' ) === false &&
strpos( $search, 'pll_e' ) === false ) {
while ( ( $pos = strpos( $search, $finder ) ) !== false ) {
if ( $pos >= 3 && substr( $search, $pos - 3, 3 ) === 'pll' ) {
$search = substr( $search, $pos + strlen( $finder ) );
continue;
}
$search = substr( $search, $pos );
Comment thread
murshed marked this conversation as resolved.
$open = 1;
$i = strpos( $search, '(' ) + 1;
Expand Down
31 changes: 30 additions & 1 deletion checks/class-style-css-header-check.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,36 @@ class Style_CSS_Header_Check implements themecheck {
*/
public function check( $php_files, $css_files, $other_files ) {

$css = implode( ' ', $css_files );
$css = '';
global $theme_check_current_theme;
if ( $theme_check_current_theme ) {
$style_css_path = function_exists( 'wp_normalize_path' )
? wp_normalize_path( $theme_check_current_theme->get_stylesheet_directory() . '/style.css' )
: $theme_check_current_theme->get_stylesheet_directory() . '/style.css';

foreach ( $css_files as $path => $content ) {
$normalized_path = function_exists( 'wp_normalize_path' ) ? wp_normalize_path( $path ) : $path;
if ( $normalized_path === $style_css_path ) {
$css = $content;
break;
}
}
}

if ( empty( $css ) ) {
// Fallback: look for a file named style.css.
foreach ( $css_files as $path => $content ) {
if ( basename( $path ) === 'style.css' ) {
$css = $content;
Comment thread
murshed marked this conversation as resolved.
break;
}
}
}

if ( empty( $css ) ) {
// Ultimate fallback: implode all CSS files.
$css = implode( ' ', $css_files );
}
$ret = true;

$checks = array(
Expand Down
6 changes: 3 additions & 3 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
=== Theme Check ===
Contributors: Otto42, pross, poena, dingo-d, acosmin, kafleg, joyously
Contributors: Otto42, pross, poena, dingo-d, acosmin, kafleg, joyously, fahimmurshed
Requires at Least: 3.7
Tested Up To: 7.0
Tested Up To: 7.0.2
Tags: themes, guidelines, wordpress.org
Stable tag: 20260508
Stable tag: 20260720

A simple and easy way to test your theme for all the latest WordPress standards and practices. A great theme development tool!

Expand Down
2 changes: 1 addition & 1 deletion theme-check.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Plugin URI: https://github.com/WordPress/theme-check/
* Description: A simple and easy way to test your theme for all the latest WordPress standards and practices. A great theme development tool!
* Author: Themes Team
* Version: 20260508
* Version: 20260720
* Text Domain: theme-check
* License: GPLv2
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
Expand Down
Loading