wp-plugins/all-in-one-seo-pack

View on GitHub
aioseop_functions.php

Summary

Maintainability
F
1 wk
Test Coverage

File aioseop_functions.php has 682 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * @package All-in-One-SEO-Pack
 */
/**
Severity: Major
Found in aioseop_functions.php - About 1 day to fix

    Function aioseop_ajax_get_menu_links has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
    Open

        function aioseop_ajax_get_menu_links() {
            aioseop_ajax_init();
            $options = Array();
            parse_str( $_POST['options'], $options );
            $_POST = $options;
    Severity: Minor
    Found in aioseop_functions.php - About 1 day 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

    Function aioseop_mrt_exclude_this_page has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
    Open

        function aioseop_mrt_exclude_this_page( $url = null ) {
            static $excluded = false;
            if ( $excluded === false ) {
                global $aioseop_options;
                $ex_pages = '';
    Severity: Minor
    Found in aioseop_functions.php - About 7 hrs 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

    Function aioseop_ajax_scan_header has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
    Open

        function aioseop_ajax_scan_header() {
            $_POST["options"] = "foo";
            aioseop_ajax_init();
            $options = Array();
            parse_str( $_POST['options'], $options );
    Severity: Minor
    Found in aioseop_functions.php - About 6 hrs 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 aioseop_ajax_scan_header has 71 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function aioseop_ajax_scan_header() {
            $_POST["options"] = "foo";
            aioseop_ajax_init();
            $options = Array();
            parse_str( $_POST['options'], $options );
    Severity: Major
    Found in aioseop_functions.php - About 2 hrs to fix

      Function aioseop_addmycolumns has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          function aioseop_addmycolumns() {
              global $aioseop_options, $pagenow;
              $aiosp_posttypecolumns = Array();
              if ( !empty( $aioseop_options) && !empty( $aioseop_options['aiosp_posttypecolumns'] ) ) {
                  $aiosp_posttypecolumns = $aioseop_options['aiosp_posttypecolumns'];            
      Severity: Minor
      Found in aioseop_functions.php - About 2 hrs 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

      Function aioseop_update_settings_check has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          function aioseop_update_settings_check() {
              global $aioseop_options;
              if ( ( isset( $_POST['aioseop_migrate_options'] ) )  ||
                   ( empty( $aioseop_options ) ) )
                  aioseop_mrt_mkarry();
      Severity: Minor
      Found in aioseop_functions.php - About 2 hrs 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 aioseop_admin_head has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function aioseop_admin_head() {
              echo '<script type="text/javascript" src="' . AIOSEOP_PLUGIN_URL . 'quickedit_functions.js" ></script>';
              ?><style>
              .aioseop_edit_button {
                  margin: 0 0 0 5px;
      Severity: Major
      Found in aioseop_functions.php - About 2 hrs to fix

        Function aioseop_add_contactmethods has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            function aioseop_add_contactmethods( $contactmethods ) {
                global $aioseop_options, $aioseop_modules;
                if ( empty( $aioseop_options['aiosp_google_disable_profile'] ) )
                    $contactmethods['googleplus'] = __( 'Google+', 'all-in-one-seo-pack' );
                if ( !empty( $aioseop_modules ) && is_object( $aioseop_modules ) ) {
        Severity: Minor
        Found in aioseop_functions.php - About 2 hrs 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 aioseop_ajax_get_menu_links has 50 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function aioseop_ajax_get_menu_links() {
                aioseop_ajax_init();
                $options = Array();
                parse_str( $_POST['options'], $options );
                $_POST = $options;
        Severity: Minor
        Found in aioseop_functions.php - About 2 hrs to fix

          Function aioseop_mrt_pccolumn has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              function aioseop_mrt_pccolumn($aioseopcn, $aioseoppi) {
                  $id = $aioseoppi;
                  $target = null;
                  if( $aioseopcn == 'seotitle' ) $target = 'title';
                  if( $aioseopcn == 'seokeywords' ) $target = 'keywords';
          Severity: Minor
          Found in aioseop_functions.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

          Function aioseop_mrt_mkarry has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              function aioseop_mrt_mkarry() {
                  global $aiosp;
                  global $aioseop_options;
                  $naioseop_options = $aiosp->default_options();
          
          
          Severity: Minor
          Found in aioseop_functions.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

          Function aioseop_ajax_init has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              function aioseop_ajax_init() {
                  if ( !empty( $_POST ) && !empty( $_POST['settings'] ) && (!empty( $_POST['nonce-aioseop'])||(!empty( $_POST['nonce-aioseop-edit']))) && !empty( $_POST['options'] ) ) {
                      $_POST = stripslashes_deep( $_POST );
                      $settings = esc_attr( $_POST['settings'] );
                      if ( ! defined( 'AIOSEOP_AJAX_MSG_TMPL' ) )
          Severity: Minor
          Found in aioseop_functions.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 aioseop_mrt_exclude_this_page has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function aioseop_mrt_exclude_this_page( $url = null ) {
                  static $excluded = false;
                  if ( $excluded === false ) {
                      global $aioseop_options;
                      $ex_pages = '';
          Severity: Minor
          Found in aioseop_functions.php - About 1 hr to fix

            Method aioseop_ajax_delete_url has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function aioseop_ajax_delete_url() {
                    aioseop_ajax_init();
                    $options = Array();
                    $options = esc_attr( $_POST['options'] );
                    $_POST['action'] = 'aiosp_update_module';
            Severity: Minor
            Found in aioseop_functions.php - About 1 hr to fix

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

                  function aioseop_ajax_delete_url() {
                      aioseop_ajax_init();
                      $options = Array();
                      $options = esc_attr( $_POST['options'] );
                      $_POST['action'] = 'aiosp_update_module';
              Severity: Minor
              Found in aioseop_functions.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 aioseop_mrt_pccolumn has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function aioseop_mrt_pccolumn($aioseopcn, $aioseoppi) {
                      $id = $aioseoppi;
                      $target = null;
                      if( $aioseopcn == 'seotitle' ) $target = 'title';
                      if( $aioseopcn == 'seokeywords' ) $target = 'keywords';
              Severity: Minor
              Found in aioseop_functions.php - About 1 hr to fix

                Method aioseop_addmycolumns has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function aioseop_addmycolumns() {
                        global $aioseop_options, $pagenow;
                        $aiosp_posttypecolumns = Array();
                        if ( !empty( $aioseop_options) && !empty( $aioseop_options['aiosp_posttypecolumns'] ) ) {
                            $aiosp_posttypecolumns = $aioseop_options['aiosp_posttypecolumns'];            
                Severity: Minor
                Found in aioseop_functions.php - About 1 hr to fix

                  Function aioseop_ajax_save_meta has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      function aioseop_ajax_save_meta() {
                          if ( !empty( $_POST['_inline_edit'] ) && ( $_POST['_inline_edit'] != 'undefined' ) )
                              check_ajax_referer( 'inlineeditnonce', '_inline_edit' );
                          $post_id = intval( $_POST['post_id'] );
                          $new_meta = strip_tags( $_POST['new_meta'] );
                  Severity: Minor
                  Found in aioseop_functions.php - About 55 mins 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

                  Function aioseop_filter_callback has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      function aioseop_filter_callback( $matches ) {
                          if ( $matches[1] && !empty( $matches[1] ) ) $postID = $matches[1];
                          if ( empty( $postID ) ) $postID = get_option( "page_on_front" );
                          $title_attrib = stripslashes( get_post_meta($postID, '_aioseop_titleatr', true ) );
                          if ( empty( $title_attrib ) && !empty( $matches[4] ) ) $title_attrib = $matches[4];
                  Severity: Minor
                  Found in aioseop_functions.php - About 55 mins 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

                  Function aioseop_handle_ignore_notice has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      function aioseop_handle_ignore_notice() {
                          if ( !empty( $_GET ) ) {
                              global $current_user;
                              $user_id = $current_user->ID;
                              if ( !empty( $_GET["aioseop_reset_notices"] ) ) {
                  Severity: Minor
                  Found in aioseop_functions.php - About 45 mins 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

                  Avoid deeply nested control flow statements.
                  Open

                                                  if ( $m[$tags['name']] == $tv )
                                                      $meta .= "<tr><th style='color:red;'>" . sprintf( __( 'Duplicate %s Meta'), ucwords( $type ) ) . "</th><td>" . ucwords( $tk ) . "</td><td>{$m[$tags['name']]}</td><td>{$m[$tags['value']]}</td></tr>\n";
                  Severity: Major
                  Found in aioseop_functions.php - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if ( empty( $excluded[$k] ) ) unset( $excluded[$k] );
                    Severity: Major
                    Found in aioseop_functions.php - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                                  if ( empty( $link_list[$l['order']] ) ) $link_list[$l['order']] = Array();
                      Severity: Major
                      Found in aioseop_functions.php - About 45 mins to fix

                        Function aioseop_get_pages has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                            function aioseop_get_pages( $pages ) {
                                global $aioseop_get_pages_start;
                                if ( !$aioseop_get_pages_start ) return $pages;
                                foreach ( $pages as $k => $v ) {
                                    $postID = $v->ID;
                        Severity: Minor
                        Found in aioseop_functions.php - About 35 mins 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

                        Function aioseop_load_json_services has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            function aioseop_load_json_services() {
                                static $services_json = null;
                                if ( $services_json ) return $services_json;
                                if ( !class_exists( 'Services_JSON' ) ) require_once( 'JSON.php' );
                                if ( !$services_json ) $services_json = new Services_JSON();
                        Severity: Minor
                        Found in aioseop_functions.php - About 25 mins 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

                        Function aioseop_list_pages has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            function aioseop_list_pages( $content ) {
                                global $wp_version;
                                $matches = array();
                                if ( preg_match_all( '/<li class="page_item page-item-(\d+)/i', $content, $matches ) ) {
                                    update_postmeta_cache( array_values( $matches[1] ) );
                        Severity: Minor
                        Found in aioseop_functions.php - About 25 mins 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

                        Function aioseop_output_dismissable_notice has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            function aioseop_output_dismissable_notice( $message, $id = "", $class = "updated fade") {
                                global $current_user;
                                if ( !empty( $current_user ) ) {
                                    $user_id = $current_user->ID;
                                    $msgid = md5( $message );
                        Severity: Minor
                        Found in aioseop_functions.php - About 25 mins 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

                        There are no issues that match your filters.

                        Category
                        Status