wp-global-admin/wp-admin/includes/hacks.php
Function _ga_create_global_admin_menu
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
function _ga_create_global_admin_menu() {
global $menu, $submenu, $_wp_real_parent_file, $pagenow;
if ( ! is_global_admin() ) {
return;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method _ga_create_global_admin_menu
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function _ga_create_global_admin_menu() {
global $menu, $submenu, $_wp_real_parent_file, $pagenow;
if ( ! is_global_admin() ) {
return;
Detected usage of a non-validated input variable: $_SERVER Open
Open
$self = preg_replace( '|^.*/wp-admin/global/|i', '', $_SERVER['PHP_SELF'] );
- Exclude checks
Missing wp_unslash() before sanitization. Open
Open
preg_match( '#/wp-admin/global/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches );
- Exclude checks
Overriding WordPress globals is prohibited. Found assignment to $pagenow Open
Open
$pagenow = strtolower( $self_matches[1] );
- Exclude checks
Detected usage of a non-sanitized input variable: $_SERVER Open
Open
$self = preg_replace( '|^.*/wp-admin/global/|i', '', $_SERVER['PHP_SELF'] );
- Exclude checks
Overriding WordPress globals is prohibited. Found assignment to $pagenow Open
Open
$pagenow .= '.php';
- Exclude checks
A gettext call containing placeholders was found, but was not accompanied by a "translators:" comment on the line above to clarify the meaning of the placeholders. Open
Open
$admin_title = sprintf( __( '%1$s — WordPress' ), $new_admin_title );
- Exclude checks
Overriding WordPress globals is prohibited. Found assignment to $pagenow Open
Open
$pagenow = trim( $pagenow, '/' );
- Exclude checks
Overriding WordPress globals is prohibited. Found assignment to $self Open
Open
$self = preg_replace( '|^.*/wp-admin/global/|i', '', $_SERVER['PHP_SELF'] );
- Exclude checks
Detected usage of a non-validated input variable: $_SERVER Open
Open
preg_match( '#/wp-admin/global/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches );
- Exclude checks
Overriding WordPress globals is prohibited. Found assignment to $submenu Open
Open
$submenu = array();
- Exclude checks
Detected usage of a non-sanitized input variable: $_SERVER Open
Open
preg_match( '#/wp-admin/global/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches );
- Exclude checks
Missing wp_unslash() before sanitization. Open
Open
$self = preg_replace( '|^.*/wp-admin/global/|i', '', $_SERVER['PHP_SELF'] );
- Exclude checks
Overriding WordPress globals is prohibited. Found assignment to $menu Open
Open
$menu = array();
- Exclude checks
Overriding WordPress globals is prohibited. Found assignment to $pagenow Open
Open
$pagenow = 'index.php';
- Exclude checks
Overriding WordPress globals is prohibited. Found assignment to $pagenow Open
Open
$pagenow = $self_matches[1];
- Exclude checks
Overriding WordPress globals is prohibited. Found assignment to $pagenow Open
Open
$pagenow = preg_replace( '#\?.*?$#', '', $pagenow );
- Exclude checks
A gettext call containing placeholders was found, but was not accompanied by a "translators:" comment on the line above to clarify the meaning of the placeholders. Open
Open
$admin_title = sprintf( __( '%1$s ‹ %2$s — WordPress' ), $title, $new_admin_title );
- Exclude checks