From 6e70db95e66f370ccc02a225e1acb08f65e6c8a0 Mon Sep 17 00:00:00 2001 From: Mehraz Morshed Date: Sun, 24 Nov 2024 12:14:25 +0600 Subject: [PATCH 1/3] checks/class-title-check.php --- checks/class-title-check.php | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/checks/class-title-check.php b/checks/class-title-check.php index 2d7bae69..533ecc39 100644 --- a/checks/class-title-check.php +++ b/checks/class-title-check.php @@ -54,18 +54,19 @@ public function check( $php_files, $css_files, $other_files ) { // Look for and tags. checkcount(); - if ( ( false !== strpos( $file_content, '' ) ) || ( false !== strpos( $file_content, '' ) ) ) { - $filename = tc_filename( $file_path ); - $grep = tc_grep( '', $file_path ); - $this->error[] = sprintf( - '<span class="tc-lead tc-recommended">%s</span>: %s. %s', - __( 'RECOMMENDED', 'theme-check' ), - sprintf( - __( '<strong><title></strong> tag was found in the file %1$s. Document titles must not be hard coded, use <strong>add_theme_support( "title-tag" )</strong> instead', 'theme-check' ), - '<strong>' . tc_filename( $file_path ) . '</strong>' - ), - $grep - ); + if ( ( is_string( $file_content ) && false !== strpos( $file_content, '<title>' ) ) || + ( is_string( $file_content ) && false !== strpos( $file_content, '' ) ) ) { + $filename = tc_filename( $file_path ); + $grep = tc_grep( '', $file_path ); + $this->error[] = sprintf( + '<span class="tc-lead tc-recommended">%s</span>: %s. %s', + __( 'RECOMMENDED', 'theme-check' ), + sprintf( + __( '<strong><title></strong> tag was found in the file %1$s. Document titles must not be hard coded, use <strong>add_theme_support( "title-tag" )</strong> instead', 'theme-check' ), + '<strong>' . tc_filename( $file_path ) . '</strong>' + ), + $grep + ); } } From f15adf93ac250aea5675cce246f75f5cefa7b6ea Mon Sep 17 00:00:00 2001 From: Mehraz Morshed <mehrazmorshed@gmail.com> Date: Sun, 24 Nov 2024 12:17:20 +0600 Subject: [PATCH 2/3] deprecated issue #476 tested in WP v6.7.1 --- readme.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.txt b/readme.txt index 430b0c22..863711e2 100644 --- a/readme.txt +++ b/readme.txt @@ -1,7 +1,7 @@ === 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.7 Tags: themes, guidelines, wordpress.org Stable tag: 20231220 From ce581d15471fcd8ebbfa7dd0684f2e1f53a3c376 Mon Sep 17 00:00:00 2001 From: Mehraz Morshed <mehrazmorshed@gmail.com> Date: Sun, 24 Nov 2024 12:23:01 +0600 Subject: [PATCH 3/3] checks/class-title-check.php --- checks/class-title-check.php | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/checks/class-title-check.php b/checks/class-title-check.php index 533ecc39..d4c79bf7 100644 --- a/checks/class-title-check.php +++ b/checks/class-title-check.php @@ -54,19 +54,18 @@ public function check( $php_files, $css_files, $other_files ) { // Look for <title> and tags. checkcount(); - if ( ( is_string( $file_content ) && false !== strpos( $file_content, '' ) ) || - ( is_string( $file_content ) && false !== strpos( $file_content, '' ) ) ) { - $filename = tc_filename( $file_path ); - $grep = tc_grep( '', $file_path ); - $this->error[] = sprintf( - '<span class="tc-lead tc-recommended">%s</span>: %s. %s', - __( 'RECOMMENDED', 'theme-check' ), - sprintf( - __( '<strong><title></strong> tag was found in the file %1$s. Document titles must not be hard coded, use <strong>add_theme_support( "title-tag" )</strong> instead', 'theme-check' ), - '<strong>' . tc_filename( $file_path ) . '</strong>' - ), - $grep - ); + if ( ( is_string( $file_content ) && false !== strpos( $file_content, '<title>' ) ) || ( is_string( $file_content ) && false !== strpos( $file_content, '' ) ) ) { + $filename = tc_filename( $file_path ); + $grep = tc_grep( '', $file_path ); + $this->error[] = sprintf( + '<span class="tc-lead tc-recommended">%s</span>: %s. %s', + __( 'RECOMMENDED', 'theme-check' ), + sprintf( + __( '<strong><title></strong> tag was found in the file %1$s. Document titles must not be hard coded, use <strong>add_theme_support( "title-tag" )</strong> instead', 'theme-check' ), + '<strong>' . tc_filename( $file_path ) . '</strong>' + ), + $grep + ); } }