Version Description
- Add new styles for the block editor. See https://meta.trac.wordpress.org/ticket/3921
Download this release
Release Info
Developer | Otto42 |
Plugin | Theme Check |
Version | 20190208.1 |
Comparing to | |
See all releases |
Code changes from version 20160523.1 to 20190208.1
- checks/adminbar.php +2 -3
- checks/constants.php +13 -6
- checks/include.php +3 -3
- checks/navmenu.php +9 -1
- checks/plugin-territory.php +2 -2
- checks/style_tags.php +22 -1
- checks/tags.php +2 -2
- readme.txt +4 -1
- theme-check.php +2 -2
checks/adminbar.php
CHANGED
@@ -29,9 +29,8 @@ class NoHiddenAdminBar implements themecheck {
|
|
29 |
$filename = tc_filename( $file_path );
|
30 |
|
31 |
if ( preg_match( $css_regex, $file_content, $matches ) ) {
|
32 |
-
$this->error[] = sprintf( '<span class="tc-lead tc-
|
33 |
-
'<strong>' . $filename . '</strong>');
|
34 |
-
$ret = false;
|
35 |
}
|
36 |
}
|
37 |
return $ret;
|
29 |
$filename = tc_filename( $file_path );
|
30 |
|
31 |
if ( preg_match( $css_regex, $file_content, $matches ) ) {
|
32 |
+
$this->error[] = sprintf( '<span class="tc-lead tc-warning">' . __( 'WARNING', 'theme-check').'</span>: ' . __( 'The theme is using `#wpadminbar`. Hiding the admin bar is not allowed.', 'theme-check' ),
|
33 |
+
'<strong>' . $filename . '</strong>');
|
|
|
34 |
}
|
35 |
}
|
36 |
return $ret;
|
checks/constants.php
CHANGED
@@ -8,18 +8,25 @@ class Constants implements themecheck {
|
|
8 |
$ret = true;
|
9 |
|
10 |
$checks = array(
|
11 |
-
'STYLESHEETPATH'
|
12 |
-
'TEMPLATEPATH'
|
13 |
-
'PLUGINDIR'
|
14 |
-
'MUPLUGINDIR'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
);
|
16 |
|
17 |
foreach ( $php_files as $php_key => $phpfile ) {
|
18 |
foreach ( $checks as $key => $check ) {
|
19 |
checkcount();
|
20 |
-
if ( preg_match( '/[\s
|
21 |
$filename = tc_filename( $php_key );
|
22 |
-
$error = ltrim( rtrim( $matches[0], '(' ) );
|
23 |
$grep = tc_grep( $error, $php_key );
|
24 |
$this->error[] = sprintf('<span class="tc-lead tc-required">'.__('REQUIRED','theme-check').'</span>: '.__('%1$s was found in the file %2$s. Use %3$s instead.%4$s', 'theme-check'), '<strong>' . $error . '</strong>', '<strong>' . $filename . '</strong>', '<strong>' . $check . '</strong>', $grep );
|
25 |
$ret = false;
|
8 |
$ret = true;
|
9 |
|
10 |
$checks = array(
|
11 |
+
'STYLESHEETPATH' => 'get_stylesheet_directory()',
|
12 |
+
'TEMPLATEPATH' => 'get_template_directory()',
|
13 |
+
'PLUGINDIR' => 'WP_PLUGIN_DIR',
|
14 |
+
'MUPLUGINDIR' => 'WPMU_PLUGIN_DIR',
|
15 |
+
'HEADER_IMAGE' => 'add_theme_support( \'custom-header\' )',
|
16 |
+
'NO_HEADER_TEXT' => 'add_theme_support( \'custom-header\' )',
|
17 |
+
'HEADER_TEXTCOLOR' => 'add_theme_support( \'custom-header\' )',
|
18 |
+
'HEADER_IMAGE_WIDTH' => 'add_theme_support( \'custom-header\' )',
|
19 |
+
'HEADER_IMAGE_HEIGHT' => 'add_theme_support( \'custom-header\' )',
|
20 |
+
'BACKGROUND_COLOR' => 'add_theme_support( \'custom-background\' )',
|
21 |
+
'BACKGROUND_IMAGE' => 'add_theme_support( \'custom-background\' )',
|
22 |
);
|
23 |
|
24 |
foreach ( $php_files as $php_key => $phpfile ) {
|
25 |
foreach ( $checks as $key => $check ) {
|
26 |
checkcount();
|
27 |
+
if ( preg_match( '/[\s|\'|\"]' . $key . '(?:\'|"|;|\s)/', $phpfile, $matches ) ) {
|
28 |
$filename = tc_filename( $php_key );
|
29 |
+
$error = ltrim( rtrim( $matches[0], '(' ), '\'"' );
|
30 |
$grep = tc_grep( $error, $php_key );
|
31 |
$this->error[] = sprintf('<span class="tc-lead tc-required">'.__('REQUIRED','theme-check').'</span>: '.__('%1$s was found in the file %2$s. Use %3$s instead.%4$s', 'theme-check'), '<strong>' . $error . '</strong>', '<strong>' . $filename . '</strong>', '<strong>' . $check . '</strong>', $grep );
|
32 |
$ret = false;
|
checks/include.php
CHANGED
@@ -7,14 +7,14 @@ class IncludeCheck implements themecheck {
|
|
7 |
|
8 |
$ret = true;
|
9 |
|
10 |
-
$checks = array( '/(?<![a-z0-9_])(?:requir|includ)e(?:_once)?\s?[\'"\(]/' => __( 'The theme appears to use include or require. If these are being used to include separate sections of a template from independent files, then <strong>get_template_part()</strong> should be used instead.', 'theme-check' ) );
|
11 |
|
12 |
foreach ( $php_files as $php_key => $phpfile ) {
|
13 |
foreach ( $checks as $key => $check ) {
|
14 |
checkcount();
|
15 |
if ( preg_match( $key, $phpfile, $matches ) ) {
|
16 |
$filename = tc_filename( $php_key );
|
17 |
-
$error = '/(?<![a-z0-9_])(?:requir|includ)e(?:_once)?\s?[\'"\(]/';
|
18 |
$grep = tc_preg( $error, $php_key );
|
19 |
if ( basename($filename) !== 'functions.php' ) $this->error[] = sprintf ( '<span class="tc-lead tc-info">'.__('INFO','theme-check').'</span>: '.__('%1$s %2$s %3$s', 'theme-check' ), '<strong>' . $filename . '</strong>', $check, $grep );
|
20 |
}
|
@@ -26,4 +26,4 @@ class IncludeCheck implements themecheck {
|
|
26 |
|
27 |
function getError() { return $this->error; }
|
28 |
}
|
29 |
-
$themechecks[] = new IncludeCheck;
|
7 |
|
8 |
$ret = true;
|
9 |
|
10 |
+
$checks = array( '/(?<![a-z0-9_\'"])(?:requir|includ)e(?:_once)?\s?[\'"\(]/' => __( 'The theme appears to use include or require. If these are being used to include separate sections of a template from independent files, then <strong>get_template_part()</strong> should be used instead.', 'theme-check' ) );
|
11 |
|
12 |
foreach ( $php_files as $php_key => $phpfile ) {
|
13 |
foreach ( $checks as $key => $check ) {
|
14 |
checkcount();
|
15 |
if ( preg_match( $key, $phpfile, $matches ) ) {
|
16 |
$filename = tc_filename( $php_key );
|
17 |
+
$error = '/(?<![a-z0-9_\'"])(?:requir|includ)e(?:_once)?\s?[\'"\(]/';
|
18 |
$grep = tc_preg( $error, $php_key );
|
19 |
if ( basename($filename) !== 'functions.php' ) $this->error[] = sprintf ( '<span class="tc-lead tc-info">'.__('INFO','theme-check').'</span>: '.__('%1$s %2$s %3$s', 'theme-check' ), '<strong>' . $filename . '</strong>', $check, $grep );
|
20 |
}
|
26 |
|
27 |
function getError() { return $this->error; }
|
28 |
}
|
29 |
+
$themechecks[] = new IncludeCheck;
|
checks/navmenu.php
CHANGED
@@ -14,10 +14,18 @@ class NavMenuCheck implements themecheck {
|
|
14 |
$this->error[] = '<span class="tc-lead tc-recommended">'.__('RECOMMENDED','theme-check').'</span>: '.__("No reference to nav_menu's was found in the theme. Note that if your theme has a menu bar, it is required to use the WordPress nav_menu functionality for it.", 'theme-check' );
|
15 |
}
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
return $ret;
|
18 |
}
|
19 |
|
20 |
function getError() { return $this->error; }
|
21 |
}
|
22 |
|
23 |
-
$themechecks[] = new NavMenuCheck;
|
14 |
$this->error[] = '<span class="tc-lead tc-recommended">'.__('RECOMMENDED','theme-check').'</span>: '.__("No reference to nav_menu's was found in the theme. Note that if your theme has a menu bar, it is required to use the WordPress nav_menu functionality for it.", 'theme-check' );
|
15 |
}
|
16 |
|
17 |
+
// Look for add_theme_support( 'menus' ).
|
18 |
+
checkcount();
|
19 |
+
if ( preg_match( '/add_theme_support\s*\(\s?("|\')menus("|\')\s?\)/', $php ) ) {
|
20 |
+
/* translators: 1: function found, 2: function to be used */
|
21 |
+
$this->error[] = '<span class="tc-lead tc-required">' . __( 'REQUIRED', 'theme-check') . '</span>: ' . sprintf( __( 'Reference to %1$s was found in the theme. This should be removed and %2$s used instead.', 'theme-check' ), '<strong>add_theme_support( "menus" )</strong>', '<a href="https://developer.wordpress.org/reference/functions/register_nav_menus/">register_nav_menus()</a>' );
|
22 |
+
$ret = false;
|
23 |
+
}
|
24 |
+
|
25 |
return $ret;
|
26 |
}
|
27 |
|
28 |
function getError() { return $this->error; }
|
29 |
}
|
30 |
|
31 |
+
$themechecks[] = new NavMenuCheck;
|
checks/plugin-territory.php
CHANGED
@@ -20,7 +20,7 @@ class Plugin_Territory implements themecheck {
|
|
20 |
|
21 |
foreach ( $forbidden_functions as $function ) {
|
22 |
checkcount();
|
23 |
-
if ( preg_match( '/[\s?]' . $function . '\(/', $php ) ) {
|
24 |
$this->error[] = '<span class="tc-lead tc-required">' . __( 'REQUIRED', 'theme-check').'</span>: ' . sprintf( __( 'The theme uses the %s function, which is plugin-territory functionality.', 'theme-check' ), '<strong>' . esc_html( $function ) . '()</strong>' ) ;
|
25 |
$ret = false;
|
26 |
}
|
@@ -35,7 +35,7 @@ class Plugin_Territory implements themecheck {
|
|
35 |
|
36 |
return $ret;
|
37 |
}
|
38 |
-
|
39 |
function getError() { return $this->error; }
|
40 |
}
|
41 |
$themechecks[] = new Plugin_Territory;
|
20 |
|
21 |
foreach ( $forbidden_functions as $function ) {
|
22 |
checkcount();
|
23 |
+
if ( preg_match( '/[\s?]' . $function . '\s?\(/', $php ) ) {
|
24 |
$this->error[] = '<span class="tc-lead tc-required">' . __( 'REQUIRED', 'theme-check').'</span>: ' . sprintf( __( 'The theme uses the %s function, which is plugin-territory functionality.', 'theme-check' ), '<strong>' . esc_html( $function ) . '()</strong>' ) ;
|
25 |
$ret = false;
|
26 |
}
|
35 |
|
36 |
return $ret;
|
37 |
}
|
38 |
+
|
39 |
function getError() { return $this->error; }
|
40 |
}
|
41 |
$themechecks[] = new Plugin_Territory;
|
checks/style_tags.php
CHANGED
@@ -17,7 +17,10 @@ class Style_Tags implements themecheck {
|
|
17 |
return $ret;
|
18 |
}
|
19 |
$deprecated_tags = 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");
|
20 |
-
$allowed_tags = array('grid-layout',"one-column","two-columns","three-columns","four-columns","left-sidebar","right-sidebar","flexible-header",'footer-widgets',"accessibility-ready","buddypress","custom-background","custom-colors","custom-header","custom-menu","custom-logo","editor-style","featured-image-header","featured-images","front-page-post-form","full-width-template","microformats","post-formats","rtl-language-support","sticky-post","theme-options","threaded-comments","translation-ready",'blog','e-commerce','education','entertainment','food-and-drink','holiday','news','photography','portfolio');
|
|
|
|
|
|
|
21 |
|
22 |
foreach( $data[ 'Tags' ] as $tag ) {
|
23 |
|
@@ -33,6 +36,24 @@ class Style_Tags implements themecheck {
|
|
33 |
$ret = false;
|
34 |
}
|
35 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
}
|
37 |
|
38 |
return $ret;
|
17 |
return $ret;
|
18 |
}
|
19 |
$deprecated_tags = 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");
|
20 |
+
$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-styles","buddypress","custom-background","custom-colors","custom-header","custom-menu","custom-logo","editor-style","featured-image-header","featured-images","front-page-post-form","full-width-template","microformats","post-formats","rtl-language-support","sticky-post","theme-options","threaded-comments","translation-ready",'blog','e-commerce','education','entertainment','food-and-drink','holiday','news','photography','portfolio');
|
21 |
+
$subject_tags = array('blog','e-commerce','education','entertainment','food-and-drink','holiday','news','photography','portfolio');
|
22 |
+
$subject_tags_count = 0;
|
23 |
+
$subject_tags_name = "";
|
24 |
|
25 |
foreach( $data[ 'Tags' ] as $tag ) {
|
26 |
|
36 |
$ret = false;
|
37 |
}
|
38 |
}
|
39 |
+
|
40 |
+
if ( in_array( strtolower( $tag ), $subject_tags ) ) {
|
41 |
+
$subject_tags_name .= strtolower( $tag ) . ', ';
|
42 |
+
$subject_tags_count++;
|
43 |
+
}
|
44 |
+
|
45 |
+
if ( in_array( strtolower( $tag ), $allowed_tags ) ) {
|
46 |
+
if ( count( array_keys ($data[ 'Tags' ], $tag ) ) > 1) {
|
47 |
+
$this->error[] = '<span class="tc-lead tc-required">'. __('REQUIRED','theme-check'). '</span>: ' . sprintf( __('The tag %s is being used more than once, please remove it from your style.css header.', 'theme-check'), '<strong>' . $tag . '</strong>' );
|
48 |
+
$ret = false;
|
49 |
+
}
|
50 |
+
}
|
51 |
+
|
52 |
+
}
|
53 |
+
|
54 |
+
if ( $subject_tags_count > 3 ) {
|
55 |
+
$this->error[] = '<span class="tc-lead tc-required">'. __('REQUIRED','theme-check'). '</span>: ' . 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, '<strong>' . rtrim( $subject_tags_name, ', ' ) . '</strong>' ) . ' ' . '<a target="_blank" href="https://make.wordpress.org/themes/handbook/review/required/theme-tags/">' . __( 'See Theme Tags', 'theme-check' ) . '</a>';
|
56 |
+
$ret = false;
|
57 |
}
|
58 |
|
59 |
return $ret;
|
checks/tags.php
CHANGED
@@ -9,7 +9,7 @@ class TagCheck implements themecheck {
|
|
9 |
$php = implode( ' ', $php_files );
|
10 |
checkcount();
|
11 |
$ret = true;
|
12 |
-
if ( strpos( $php, 'the_tags' ) === false && strpos( $php, 'get_the_tag_list' ) === false && strpos( $php, 'get_the_term_list' ) === false ) {
|
13 |
$this->error[] = "<span class='tc-lead tc-required'>" . __( 'REQUIRED', 'theme-check' ) . '</span>: '. __( "This theme doesn't seem to display tags. Modify it to display tags in appropriate locations.", "theme-check" );
|
14 |
$ret = false;
|
15 |
}
|
@@ -19,4 +19,4 @@ class TagCheck implements themecheck {
|
|
19 |
|
20 |
function getError() { return $this->error; }
|
21 |
}
|
22 |
-
$themechecks[] = new TagCheck;
|
9 |
$php = implode( ' ', $php_files );
|
10 |
checkcount();
|
11 |
$ret = true;
|
12 |
+
if ( strpos( $php, 'the_tags' ) === false && strpos( $php, 'the_taxonomies' ) === false && strpos( $php, 'get_the_tag_list' ) === false && strpos( $php, 'get_the_term_list' ) === false ) {
|
13 |
$this->error[] = "<span class='tc-lead tc-required'>" . __( 'REQUIRED', 'theme-check' ) . '</span>: '. __( "This theme doesn't seem to display tags. Modify it to display tags in appropriate locations.", "theme-check" );
|
14 |
$ret = false;
|
15 |
}
|
19 |
|
20 |
function getError() { return $this->error; }
|
21 |
}
|
22 |
+
$themechecks[] = new TagCheck;
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Plugin URL: http://ottopress.com/wordpress-plugins/theme-check/
|
|
5 |
Requires at Least: 3.7
|
6 |
Tested Up To: 4.9
|
7 |
Tags: template, theme, check, checker, tool, wordpress, wordpress.org, upload, uploader, test, guideline, review
|
8 |
-
Stable tag:
|
9 |
|
10 |
A simple and easy way to test your theme for all the latest WordPress standards and practices. A great theme development tool!
|
11 |
|
@@ -54,6 +54,9 @@ comments, or feedback:[[br]]
|
|
54 |
If **either** of these two vars are defined a new trac tickbox will appear next to the *Check it!* button.
|
55 |
|
56 |
== Changelog ==
|
|
|
|
|
|
|
57 |
= 20160523.1 =
|
58 |
* Fix for theme-names with dashes in them
|
59 |
* Comments stripping changes
|
5 |
Requires at Least: 3.7
|
6 |
Tested Up To: 4.9
|
7 |
Tags: template, theme, check, checker, tool, wordpress, wordpress.org, upload, uploader, test, guideline, review
|
8 |
+
Stable tag: 20190208.1
|
9 |
|
10 |
A simple and easy way to test your theme for all the latest WordPress standards and practices. A great theme development tool!
|
11 |
|
54 |
If **either** of these two vars are defined a new trac tickbox will appear next to the *Check it!* button.
|
55 |
|
56 |
== Changelog ==
|
57 |
+
= 20190208.1 =
|
58 |
+
* Add new styles for the block editor. See https://meta.trac.wordpress.org/ticket/3921
|
59 |
+
|
60 |
= 20160523.1 =
|
61 |
* Fix for theme-names with dashes in them
|
62 |
* Comments stripping changes
|
theme-check.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://ottopress.com/wordpress-plugins/theme-check/
|
|
5 |
Description: A simple and easy way to test your theme for all the latest WordPress standards and practices. A great theme development tool!
|
6 |
Author: Otto42, pross
|
7 |
Author URI: http://ottopress.com
|
8 |
-
Version:
|
9 |
Text Domain: theme-check
|
10 |
License: GPLv2
|
11 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
@@ -58,7 +58,7 @@ class ThemeCheckMain {
|
|
58 |
|
59 |
if ( isset( $_POST[ 'themename' ] ) ) {
|
60 |
if ( isset( $_POST[ 'trac' ] ) ) define( 'TC_TRAC', true );
|
61 |
-
if ( defined( 'WP_MAX_MEMORY_LIMIT' ) ) {
|
62 |
@ini_set( 'memory_limit', WP_MAX_MEMORY_LIMIT );
|
63 |
}
|
64 |
check_main( $_POST[ 'themename' ] );
|
5 |
Description: A simple and easy way to test your theme for all the latest WordPress standards and practices. A great theme development tool!
|
6 |
Author: Otto42, pross
|
7 |
Author URI: http://ottopress.com
|
8 |
+
Version: 20190208.1
|
9 |
Text Domain: theme-check
|
10 |
License: GPLv2
|
11 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
58 |
|
59 |
if ( isset( $_POST[ 'themename' ] ) ) {
|
60 |
if ( isset( $_POST[ 'trac' ] ) ) define( 'TC_TRAC', true );
|
61 |
+
if ( defined( 'WP_MAX_MEMORY_LIMIT' ) ) {
|
62 |
@ini_set( 'memory_limit', WP_MAX_MEMORY_LIMIT );
|
63 |
}
|
64 |
check_main( $_POST[ 'themename' ] );
|