felixarntz/global-admin

View on GitHub
wp-global-admin/wp-admin/includes/hacks.php

Summary

Maintainability
A
2 hrs
Test Coverage

Function _ga_create_global_admin_menu has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function _ga_create_global_admin_menu() {
    global $menu, $submenu, $_wp_real_parent_file, $pagenow;

    if ( ! is_global_admin() ) {
        return;
Severity: Minor
Found in wp-global-admin/wp-admin/includes/hacks.php - About 1 hr to fix

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

function _ga_create_global_admin_menu() {
    global $menu, $submenu, $_wp_real_parent_file, $pagenow;

    if ( ! is_global_admin() ) {
        return;
Severity: Minor
Found in wp-global-admin/wp-admin/includes/hacks.php - About 1 hr to fix

    Detected usage of a non-validated input variable: $_SERVER
    Open

            $self = preg_replace( '|^.*/wp-admin/global/|i', '', $_SERVER['PHP_SELF'] );

    Missing wp_unslash() before sanitization.
    Open

            preg_match( '#/wp-admin/global/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches );

    Overriding WordPress globals is prohibited. Found assignment to $pagenow
    Open

                $pagenow = strtolower( $self_matches[1] );

    Detected usage of a non-sanitized input variable: $_SERVER
    Open

            $self = preg_replace( '|^.*/wp-admin/global/|i', '', $_SERVER['PHP_SELF'] );

    Overriding WordPress globals is prohibited. Found assignment to $pagenow
    Open

                    $pagenow .= '.php';

    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

            $admin_title = sprintf( __( '%1$s — WordPress' ), $new_admin_title );

    Overriding WordPress globals is prohibited. Found assignment to $pagenow
    Open

            $pagenow = trim( $pagenow, '/' );

    Overriding WordPress globals is prohibited. Found assignment to $self
    Open

            $self = preg_replace( '|^.*/wp-admin/global/|i', '', $_SERVER['PHP_SELF'] );

    Detected usage of a non-validated input variable: $_SERVER
    Open

            preg_match( '#/wp-admin/global/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches );

    Overriding WordPress globals is prohibited. Found assignment to $submenu
    Open

        $submenu = array();

    Detected usage of a non-sanitized input variable: $_SERVER
    Open

            preg_match( '#/wp-admin/global/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches );

    Missing wp_unslash() before sanitization.
    Open

            $self = preg_replace( '|^.*/wp-admin/global/|i', '', $_SERVER['PHP_SELF'] );

    Overriding WordPress globals is prohibited. Found assignment to $menu
    Open

        $menu    = array();

    Overriding WordPress globals is prohibited. Found assignment to $pagenow
    Open

                $pagenow = 'index.php';

    Overriding WordPress globals is prohibited. Found assignment to $pagenow
    Open

            $pagenow = $self_matches[1];

    Overriding WordPress globals is prohibited. Found assignment to $pagenow
    Open

            $pagenow = preg_replace( '#\?.*?$#', '', $pagenow );

    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

            $admin_title = sprintf( __( '%1$s ‹ %2$s — WordPress' ), $title, $new_admin_title );

    There are no issues that match your filters.

    Category
    Status