From 85d1ed1ac45b88309b357ef10d94de90ac9f667b Mon Sep 17 00:00:00 2001 From: KafleG Date: Tue, 11 Apr 2023 09:53:02 +0545 Subject: [PATCH 1/2] Fix the code issue --- checks/class-style-tags-check.php | 223 ------------------------------ 1 file changed, 223 deletions(-) diff --git a/checks/class-style-tags-check.php b/checks/class-style-tags-check.php index 6c3f2288..62a5b767 100644 --- a/checks/class-style-tags-check.php +++ b/checks/class-style-tags-check.php @@ -256,229 +256,6 @@ private function get_deprecated_tags() 'seasonal', ); } -======= -class Style_Tags_Check implements themecheck { - /** - * Error messages, warnings and info notices. - * - * @var array $error - */ - protected $error = array(); - - /** - * Array of theme tags in style.css - * - * @var array $tags - */ - protected $tags = array(); - - function set_context( $data ) { - if ( isset( $data['theme'] ) ) { - $this->tags = $data['theme']['Tags']; - } - } - - /** - * Check that return true for good/okay/acceptable, false for bad/not-okay/unacceptable. - * - * @param array $php_files File paths and content for PHP files. - * @param array $css_files File paths and content for CSS files. - * @param array $other_files Folder names, file paths and content for other files. - */ - public function check( $php_files, $css_files, $other_files ) { - checkcount(); - - if ( ! $this->tags ) { - $this->error[] = sprintf( - '%s %s', - __( 'INFO', 'theme-check' ), - __( 'Tags: is either empty or missing in style.css header.', 'theme-check' ) - ); - } else { - $deprecated_tags = $this->get_deprecated_tags(); - $allowed_tags = $this->get_allowed_tags(); - $subject_tags = $this->get_subject_tags(); - $subject_tags_count = 0; - $subject_tags_name = ''; - - foreach ( $this->tags as $tag ) { - - if ( strpos( strtolower( $tag ), 'accessibility-ready' ) !== false ) { - $this->error[] = sprintf( - '%s %s', - __( 'INFO', 'theme-check' ), - __( 'Themes that use the tag accessibility-ready will need to undergo an accessibility review.', 'theme-check' ) . ' ' . __( 'See https://make.wordpress.org/themes/handbook/review/accessibility/', 'theme-check' ) - ); - } - - if ( ! in_array( strtolower( $tag ), $allowed_tags ) ) { - if ( in_array( strtolower( $tag ), $deprecated_tags ) ) { - $this->error[] = sprintf( - '%s %s', - __( 'INFO', 'theme-check' ), - sprintf( - __( 'The tag %s has been deprecated, please remove it from your style.css header.', 'theme-check' ), - '' . $tag . '' - ) - ); - } else { - $this->error[] = sprintf( - '%s %s', - __( 'INFO', 'theme-check' ), - sprintf( - __( 'Found wrong tag, remove %s from your style.css header.', 'theme-check' ), - '' . $tag . '' - ) - ); - } - } - - if ( in_array( strtolower( $tag ), $subject_tags ) ) { - $subject_tags_name .= strtolower( $tag ) . ', '; - $subject_tags_count++; - } - - if ( in_array( strtolower( $tag ), $allowed_tags ) ) { - if ( count( array_keys( $this->tags, $tag ) ) > 1 ) { - $this->error[] = sprintf( - '%s %s', - __( 'INFO', 'theme-check' ), - sprintf( - __( 'The tag %s is being used more than once, please remove it from your style.css header.', 'theme-check' ), - '' . $tag . '' - ) - ); - } - } - } - - if ( $subject_tags_count > 3 ) { - $this->error[] = sprintf( - '%s: %s %s', - __( 'INFO', 'theme-check' ), - sprintf( - __( 'A maximum of 3 subject tags are allowed. The theme has %1$u subjects tags ( %2$s ). Please remove the subject tags, which do not directly apply to the theme.', 'theme-check' ), - $subject_tags_count, - '' . rtrim( $subject_tags_name, ', ' ) . '' - ), - sprintf( - '%s', - 'https://make.wordpress.org/themes/handbook/review/required/theme-tags/', - __( 'See Theme Tags', 'theme-check' ) - ) - ); - } - } - - return true; - } - - /** - * Get error messages from the checks. - * - * @return array Error message. - */ - public function getError() { - return $this->error; - } - - /** - * Get full list of allowed tags - including subject tags. - * - * @return array - */ - private function get_allowed_tags() { - $allowed_tags = array( - 'grid-layout', - 'one-column', - 'two-columns', - 'three-columns', - 'four-columns', - 'left-sidebar', - 'right-sidebar', - 'wide-blocks', - 'flexible-header', - 'footer-widgets', - 'accessibility-ready', - 'block-patterns', - 'block-styles', - 'buddypress', - 'custom-background', - 'custom-colors', - 'custom-header', - 'custom-logo', - 'custom-menu', - 'editor-style', - 'featured-image-header', - 'featured-images', - 'front-page-post-form', - 'full-width-template', - 'full-site-editing', - 'microformats', - 'post-formats', - 'rtl-language-support', - 'sticky-post', - 'style-variations', - 'template-editing', - 'theme-options', - 'threaded-comments', - 'translation-ready', - ); - return array_merge( $allowed_tags, self::get_subject_tags() ); - } - - /** - * Get the list of subject tags. - * - * @return array - */ - private function get_subject_tags() { - return array( - 'blog', - 'e-commerce', - 'education', - 'entertainment', - 'food-and-drink', - 'holiday', - 'news', - 'photography', - 'portfolio', - ); - } - - /** - * Get the list of deprecated tags. - * - * @return array - */ - private function get_deprecated_tags() { - return array( - 'flexible-width', - 'fixed-width', - 'black', - 'blue', - 'brown', - 'gray', - 'green', - 'orange', - 'pink', - 'purple', - 'red', - 'silver', - 'tan', - 'white', - 'yellow', - 'dark', - 'light', - 'fixed-layout', - 'fluid-layout', - 'responsive-layout', - 'blavatar', - 'holiday', - 'photoblogging', - 'seasonal', - ); - } } $themechecks[] = new Style_Tags_Check(); \ No newline at end of file From ab824274c07273a6e32da7192bfdfe24b3edd8a9 Mon Sep 17 00:00:00 2001 From: Ganga Kafle Date: Fri, 8 May 2026 07:28:45 +1000 Subject: [PATCH 2/2] Tested with current WordPRess version 6.9.4 --- changelog.txt | 3 +++ readme.txt | 4 ++-- theme-check.php | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/changelog.txt b/changelog.txt index 4ff451a3..ab0be913 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,6 @@ += 20260508 = + * Tested with WordPress 6.9 + = 20231220 = * Added checks: Style Variations tag for block theme * Update: Team name from Theme Review Team to Themes Team diff --git a/readme.txt b/readme.txt index 430b0c22..111649bc 100644 --- a/readme.txt +++ b/readme.txt @@ -1,9 +1,9 @@ === Theme Check === Contributors: Otto42, pross, poena, dingo-d, acosmin, kafleg, joyously Requires at Least: 3.7 -Tested Up To: 6.6 +Tested Up To: 6.9 Tags: themes, guidelines, wordpress.org -Stable tag: 20231220 +Stable tag: 20260508 A simple and easy way to test your theme for all the latest WordPress standards and practices. A great theme development tool! diff --git a/theme-check.php b/theme-check.php index aaa818e7..293e1aee 100644 --- a/theme-check.php +++ b/theme-check.php @@ -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: 20231220 + * Version: 20260508 * Text Domain: theme-check * License: GPLv2 * License URI: https://www.gnu.org/licenses/gpl-2.0.html