. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
| Server IP : 172.67.135.14 / Your IP :
216.73.216.221 [
Web Server : LiteSpeed System : Linux premium35.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64 User : lasanffc ( 2331) PHP Version : 8.0.30 Disable Function : NONE Domains : 1 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/lasanffc/public_html/wp-content/themes/theme-check/checks/ |
Upload File : |
<?php
/**
* Check if widgets are supported in classic themes
*
* @package Theme Check
*/
/**
* Check if widgets are supported in classic themes.
*/
class Widgets_Check implements themecheck {
/**
* Error messages, warnings and info notices.
*
* @var array $error
*/
protected $error = array();
/**
* 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 ) {
$ret = true;
// Combine all the php files into one string to make it easier to search.
$php = implode( ' ', $php_files );
checkcount();
// No widgets registered or used.
if (
strpos( $php, 'register_sidebar' ) === false &&
strpos( $php, 'dynamic_sidebar' ) === false
) {
$this->error[] = sprintf(
'<span class="tc-lead tc-recommended">%s</span> %s',
__( 'RECOMMENDED', 'theme-check' ),
__( "This theme contains no sidebars/widget areas. See <a href='https://codex.wordpress.org/Widgets_API'>Widgets API</a>", 'theme-check' )
);
$ret = true;
}
// Widget area is registered but not used.
if (
strpos( $php, 'register_sidebar' ) !== false &&
strpos( $php, 'dynamic_sidebar' ) === false
) {
$this->error[] = sprintf(
'<span class="tc-lead tc-required">%s</span> %s',
__( 'REQUIRED', 'theme-check' ),
__( "The theme appears to use <strong>register_sidebar()</strong> but no <strong>dynamic_sidebar()</strong> was found. See: <a href='https://developer.wordpress.org/reference/functions/dynamic_sidebar/'>dynamic_sidebar</a><pre> <?php dynamic_sidebar( \$index ); ?></pre>", 'theme-check' )
);
$ret = false;
}
// Widget area is used but not registered.
if (
strpos( $php, 'register_sidebar' ) === false &&
strpos( $php, 'dynamic_sidebar' ) !== false
) {
$this->error[] = sprintf(
'<span class="tc-lead tc-required">%s</span> %s',
__( 'REQUIRED', 'theme-check' ),
__( "The theme appears to use <strong>dynamic_sidebars()</strong> but no <strong>register_sidebar()</strong> was found. See: <a href='https://developer.wordpress.org/reference/functions/register_sidebar/'>register_sidebar</a><pre> <?php register_sidebar( \$args ); ?></pre>", 'theme-check' )
);
$ret = false;
}
/**
* There are widgets registered, is the widgets_init action present?
*/
if (
strpos( $php, 'register_sidebar' ) !== false &&
preg_match( '/add_action\s*\(\s*("|\')widgets_init("|\')\s*,/', $php ) == false
) {
$this->error[] = sprintf(
'<span class="tc-lead tc-required">%s</span> %s',
__( 'REQUIRED', 'theme-check' ),
sprintf(
__( 'Sidebars need to be registered in a custom function hooked to the <strong>widgets_init</strong> action. See: %s.', 'theme-check' ),
'<a href="https://developer.wordpress.org/reference/functions/register_sidebar/">register_sidebar()</a>'
)
);
$ret = false;
}
return $ret;
}
/**
* Get error messages from the checks.
*
* @return array Error message.
*/
public function getError() {
return $this->error;
}
}
$themechecks[] = new Widgets_Check();