__( 'User levels were deprecated in 2.0. Please see Roles_and_Capabilities', 'theme-check' ),
'/[^a-z0-9](current_user_can\s?\(\s?[\'\"]level_[0-9][\'\"]\s?\))[^\r|\r\n]*/' => __( 'User levels were deprecated in 2.0. Please see Roles_and_Capabilities', 'theme-check' )
);
foreach ( $php_files as $php_key => $phpfile ) {
foreach ( $checks as $key => $check ) {
checkcount();
if ( preg_match( $key, $phpfile, $matches ) ) {
$filename = tc_filename( $php_key );
$grep = ( isset( $matches[2] ) ) ? tc_grep( $matches[2], $php_key ) : tc_grep( $matches[1], $php_key );
$this->error[] = sprintf(''.__( 'WARNING', 'theme-check' ) . ': %1$s. %2$s%3$s', $filename, $check, $grep );
$ret = false;
}
}
}
// check for add_admin_page's, except for add_theme_page
// Note to TGMPA: Stop trying to bypass theme check.
$checks = array(
'/(?:](add_[^_\'",();]+?_page)/' => __( 'Themes should use add_theme_page() for adding admin pages.', 'theme-check' )
);
foreach ( $php_files as $php_key => $phpfile ) {
foreach ( $checks as $key => $check ) {
checkcount();
if ( preg_match_all( $key, $phpfile, $matches ) ) {
foreach ($matches[1] as $match) {
if ($match == 'add_theme_page') {
continue;
}
$filename = tc_filename( $php_key );
$error = ltrim( rtrim( $match, '(' ) );
$grep = tc_grep( $error, $php_key );
$this->error[] = sprintf(''.__( 'REQUIRED', 'theme-check' ) .': %1$s. %2$s%3$s', $filename, $check, $grep);
$ret = false;
}
}
}
}
return $ret;
}
function getError() { return $this->error; }
}
$themechecks[] = new AdminMenu;