CaffGeek/MBACNationals

View on GitHub
Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.php

Summary

Maintainability
F
2 wks
Test Coverage

File ajax-actions.php has 1584 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * WordPress Core Ajax Handlers.
 *
 * @package WordPress
Severity: Major
Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.php - About 4 days to fix

    Function wp_ajax_add_meta has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
    Open

    function wp_ajax_add_meta() {
        check_ajax_referer( 'add-meta', '_ajax_nonce-add-meta' );
        $c = 0;
        $pid = (int) $_POST['post_id'];
        $post = get_post( $pid );
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.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

    Function wp_ajax_replyto_comment has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
    Open

    function wp_ajax_replyto_comment( $action ) {
        global $wp_list_table, $wpdb;
        if ( empty( $action ) )
            $action = 'replyto-comment';
    
    
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.php - About 4 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 _wp_ajax_add_hierarchical_term has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

    function _wp_ajax_add_hierarchical_term() {
        $action = $_POST['action'];
        $taxonomy = get_taxonomy(substr($action, 4));
        check_ajax_referer( $action, '_ajax_nonce-add-' . $taxonomy->name );
        if ( !current_user_can( $taxonomy->cap->edit_terms ) )
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.php - About 4 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 wp_ajax_delete_comment has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

    function wp_ajax_delete_comment() {
        $id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0;
    
        if ( !$comment = get_comment( $id ) )
            wp_die( time() );
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.php - About 3 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 wp_ajax_add_meta has 76 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function wp_ajax_add_meta() {
        check_ajax_referer( 'add-meta', '_ajax_nonce-add-meta' );
        $c = 0;
        $pid = (int) $_POST['post_id'];
        $post = get_post( $pid );
    Severity: Major
    Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.php - About 3 hrs to fix

      Method wp_ajax_replyto_comment has 74 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function wp_ajax_replyto_comment( $action ) {
          global $wp_list_table, $wpdb;
          if ( empty( $action ) )
              $action = 'replyto-comment';
      
      
      Severity: Major
      Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.php - About 2 hrs to fix

        Method _wp_ajax_add_hierarchical_term has 70 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function _wp_ajax_add_hierarchical_term() {
            $action = $_POST['action'];
            $taxonomy = get_taxonomy(substr($action, 4));
            check_ajax_referer( $action, '_ajax_nonce-add-' . $taxonomy->name );
            if ( !current_user_can( $taxonomy->cap->edit_terms ) )
        Severity: Major
        Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.php - About 2 hrs to fix

          Function wp_ajax_save_widget has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

          function wp_ajax_save_widget() {
              global $wp_registered_widgets, $wp_registered_widget_controls, $wp_registered_widget_updates;
          
              check_ajax_referer( 'save-sidebar-widgets', 'savewidgets' );
          
          
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.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 wp_ajax_wp_compression_test has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

          function wp_ajax_wp_compression_test() {
              if ( !current_user_can( 'manage_options' ) )
                  wp_die( -1 );
          
              if ( ini_get('zlib.output_compression') || 'ob_gzhandler' == ini_get('output_handler') ) {
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.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 wp_ajax_inline_save_tax has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

          function wp_ajax_inline_save_tax() {
              global $wp_list_table;
          
              check_ajax_referer( 'taxinlineeditnonce', '_inline_edit' );
          
          
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.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 wp_ajax_inline_save has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

          function wp_ajax_inline_save() {
              global $wp_list_table;
          
              check_ajax_referer( 'inlineeditnonce', '_inline_edit' );
          
          
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.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 wp_ajax_widgets_order has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

          function wp_ajax_widgets_order() {
              check_ajax_referer( 'save-sidebar-widgets', 'savewidgets' );
          
              if ( !current_user_can('edit_theme_options') )
                  wp_die( -1 );
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.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 wp_ajax_upload_attachment has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

          function wp_ajax_upload_attachment() {
              check_ajax_referer( 'media-form' );
          
              if ( ! current_user_can( 'upload_files' ) )
                  wp_die();
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.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 wp_ajax_add_menu_item has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function wp_ajax_add_menu_item() {
              check_ajax_referer( 'add-menu_item', 'menu-settings-column-nonce' );
          
              if ( ! current_user_can( 'edit_theme_options' ) )
                  wp_die( -1 );
          Severity: Major
          Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.php - About 2 hrs to fix

            Method wp_ajax_save_widget has 50 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function wp_ajax_save_widget() {
                global $wp_registered_widgets, $wp_registered_widget_controls, $wp_registered_widget_updates;
            
                check_ajax_referer( 'save-sidebar-widgets', 'savewidgets' );
            
            
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.php - About 2 hrs to fix

              Method wp_ajax_inline_save has 50 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function wp_ajax_inline_save() {
                  global $wp_list_table;
              
                  check_ajax_referer( 'inlineeditnonce', '_inline_edit' );
              
              
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.php - About 2 hrs to fix

                Method wp_ajax_upload_attachment has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function wp_ajax_upload_attachment() {
                    check_ajax_referer( 'media-form' );
                
                    if ( ! current_user_can( 'upload_files' ) )
                        wp_die();
                Severity: Minor
                Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.php - About 1 hr to fix

                  Function wp_ajax_add_link_category has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function wp_ajax_add_link_category( $action ) {
                      if ( empty( $action ) )
                          $action = 'add-link-category';
                      check_ajax_referer( $action );
                      if ( !current_user_can( 'manage_categories' ) )
                  Severity: Minor
                  Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.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 wp_ajax_find_posts has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function wp_ajax_find_posts() {
                      global $wpdb;
                  
                      check_ajax_referer( 'find-posts' );
                  
                  
                  Severity: Minor
                  Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.php - About 1 hr to fix

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

                    function wp_ajax_add_menu_item() {
                        check_ajax_referer( 'add-menu_item', 'menu-settings-column-nonce' );
                    
                        if ( ! current_user_can( 'edit_theme_options' ) )
                            wp_die( -1 );
                    Severity: Minor
                    Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.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 _wp_ajax_delete_comment_response has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function _wp_ajax_delete_comment_response( $comment_id, $delta = -1 ) {
                        $total    = isset( $_POST['_total'] )    ? (int) $_POST['_total']    : 0;
                        $per_page = isset( $_POST['_per_page'] ) ? (int) $_POST['_per_page'] : 0;
                        $page     = isset( $_POST['_page'] )     ? (int) $_POST['_page']     : 0;
                        $url      = isset( $_POST['_url'] )      ? esc_url_raw( $_POST['_url'] ) : '';
                    Severity: Minor
                    Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.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 wp_ajax_save_attachment_order has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function wp_ajax_save_attachment_order() {
                        if ( ! isset( $_REQUEST['post_id'] ) )
                            wp_send_json_error();
                    
                        if ( ! $post_id = absint( $_REQUEST['post_id'] ) )
                    Severity: Minor
                    Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.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 wp_ajax_add_tag has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function wp_ajax_add_tag() {
                        global $wp_list_table;
                    
                        check_ajax_referer( 'add-tag', '_wpnonce_add-tag' );
                        $post_type = !empty($_POST['post_type']) ? $_POST['post_type'] : 'post';
                    Severity: Minor
                    Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.php - About 1 hr to fix

                      Method wp_ajax_wp_compression_test has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function wp_ajax_wp_compression_test() {
                          if ( !current_user_can( 'manage_options' ) )
                              wp_die( -1 );
                      
                          if ( ini_get('zlib.output_compression') || 'ob_gzhandler' == ini_get('output_handler') ) {
                      Severity: Minor
                      Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.php - About 1 hr to fix

                        Method _wp_ajax_delete_comment_response has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function _wp_ajax_delete_comment_response( $comment_id, $delta = -1 ) {
                            $total    = isset( $_POST['_total'] )    ? (int) $_POST['_total']    : 0;
                            $per_page = isset( $_POST['_per_page'] ) ? (int) $_POST['_per_page'] : 0;
                            $page     = isset( $_POST['_page'] )     ? (int) $_POST['_page']     : 0;
                            $url      = isset( $_POST['_url'] )      ? esc_url_raw( $_POST['_url'] ) : '';
                        Severity: Minor
                        Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.php - About 1 hr to fix

                          Method wp_ajax_delete_comment has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function wp_ajax_delete_comment() {
                              $id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0;
                          
                              if ( !$comment = get_comment( $id ) )
                                  wp_die( time() );
                          Severity: Minor
                          Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.php - About 1 hr to fix

                            Method wp_ajax_autocomplete_user has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function wp_ajax_autocomplete_user() {
                                if ( ! is_multisite() || ! current_user_can( 'promote_users' ) || wp_is_large_network( 'users' ) )
                                    wp_die( -1 );
                            
                                /** This filter is documented in wp-admin/user-new.php */
                            Severity: Minor
                            Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.php - About 1 hr to fix

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

                              function wp_ajax_send_attachment_to_editor() {
                                  check_ajax_referer( 'media-send-to-editor', 'nonce' );
                              
                                  $attachment = wp_unslash( $_POST['attachment'] );
                              
                              
                              Severity: Minor
                              Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.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 wp_ajax_get_comments has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                              Open

                              function wp_ajax_get_comments( $action ) {
                                  global $wp_list_table, $post_id;
                                  if ( empty( $action ) )
                                      $action = 'get-comments';
                              
                              
                              Severity: Minor
                              Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.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 wp_ajax_inline_save_tax has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function wp_ajax_inline_save_tax() {
                                  global $wp_list_table;
                              
                                  check_ajax_referer( 'taxinlineeditnonce', '_inline_edit' );
                              
                              
                              Severity: Minor
                              Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.php - About 1 hr to fix

                                Method wp_ajax_send_attachment_to_editor has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                function wp_ajax_send_attachment_to_editor() {
                                    check_ajax_referer( 'media-send-to-editor', 'nonce' );
                                
                                    $attachment = wp_unslash( $_POST['attachment'] );
                                
                                
                                Severity: Minor
                                Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.php - About 1 hr to fix

                                  Method wp_ajax_menu_get_metabox has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  function wp_ajax_menu_get_metabox() {
                                      if ( ! current_user_can( 'edit_theme_options' ) )
                                          wp_die( -1 );
                                  
                                      require_once ABSPATH . 'wp-admin/includes/nav-menu.php';
                                  Severity: Minor
                                  Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.php - About 1 hr to fix

                                    Method wp_ajax_get_comments has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    function wp_ajax_get_comments( $action ) {
                                        global $wp_list_table, $post_id;
                                        if ( empty( $action ) )
                                            $action = 'get-comments';
                                    
                                    
                                    Severity: Minor
                                    Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.php - About 1 hr to fix

                                      Function wp_ajax_find_posts has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      function wp_ajax_find_posts() {
                                          global $wpdb;
                                      
                                          check_ajax_referer( 'find-posts' );
                                      
                                      
                                      Severity: Minor
                                      Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.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 wp_ajax_save_attachment_compat has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      function wp_ajax_save_attachment_compat() {
                                          if ( ! isset( $_REQUEST['id'] ) )
                                              wp_send_json_error();
                                      
                                          if ( ! $id = absint( $_REQUEST['id'] ) )
                                      Severity: Minor
                                      Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.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 wp_ajax_save_attachment has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      function wp_ajax_save_attachment() {
                                          if ( ! isset( $_REQUEST['id'] ) || ! isset( $_REQUEST['changes'] ) )
                                              wp_send_json_error();
                                      
                                          if ( ! $id = absint( $_REQUEST['id'] ) )
                                      Severity: Minor
                                      Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.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 wp_ajax_autocomplete_user has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      function wp_ajax_autocomplete_user() {
                                          if ( ! is_multisite() || ! current_user_can( 'promote_users' ) || wp_is_large_network( 'users' ) )
                                              wp_die( -1 );
                                      
                                          /** This filter is documented in wp-admin/user-new.php */
                                      Severity: Minor
                                      Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.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 wp_ajax_edit_comment has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      function wp_ajax_edit_comment() {
                                          global $wp_list_table;
                                      
                                          check_ajax_referer( 'replyto-comment', '_ajax_nonce-replyto-comment' );
                                      
                                      
                                      Severity: Minor
                                      Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.php - About 1 hr to fix

                                        Method wp_ajax_add_user has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                        function wp_ajax_add_user( $action ) {
                                            global $wp_list_table;
                                            if ( empty( $action ) )
                                                $action = 'add-user';
                                        
                                        
                                        Severity: Minor
                                        Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.php - About 1 hr to fix

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

                                          function wp_ajax_get_tagcloud() {
                                              if ( isset( $_POST['tax'] ) ) {
                                                  $taxonomy = sanitize_key( $_POST['tax'] );
                                                  $tax = get_taxonomy( $taxonomy );
                                                  if ( ! $tax )
                                          Severity: Minor
                                          Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.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 wp_ajax_dim_comment has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                          Open

                                          function wp_ajax_dim_comment() {
                                              $id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0;
                                          
                                              if ( !$comment = get_comment( $id ) ) {
                                                  $x = new WP_Ajax_Response( array(
                                          Severity: Minor
                                          Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.php - About 1 hr to fix

                                            Method wp_ajax_add_link_category has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                            Open

                                            function wp_ajax_add_link_category( $action ) {
                                                if ( empty( $action ) )
                                                    $action = 'add-link-category';
                                                check_ajax_referer( $action );
                                                if ( !current_user_can( 'manage_categories' ) )
                                            Severity: Minor
                                            Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.php - About 1 hr to fix

                                              Method wp_ajax_query_themes has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                              Open

                                              function wp_ajax_query_themes() {
                                                  global $themes_allowedtags, $theme_field_defaults;
                                              
                                                  if ( ! current_user_can( 'install_themes' ) ) {
                                                      wp_send_json_error();
                                              Severity: Minor
                                              Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.php - About 1 hr to fix

                                                Method wp_ajax_wp_fullscreen_save_post has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                                Open

                                                function wp_ajax_wp_fullscreen_save_post() {
                                                    $post_id = isset( $_POST['post_ID'] ) ? (int) $_POST['post_ID'] : 0;
                                                
                                                    $post = $post_type = null;
                                                
                                                
                                                Severity: Minor
                                                Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.php - About 1 hr to fix

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

                                                  function wp_ajax_save_attachment_compat() {
                                                      if ( ! isset( $_REQUEST['id'] ) )
                                                          wp_send_json_error();
                                                  
                                                      if ( ! $id = absint( $_REQUEST['id'] ) )
                                                  Severity: Minor
                                                  Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.php - About 1 hr to fix

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

                                                    function wp_ajax_save_attachment() {
                                                        if ( ! isset( $_REQUEST['id'] ) || ! isset( $_REQUEST['changes'] ) )
                                                            wp_send_json_error();
                                                    
                                                        if ( ! $id = absint( $_REQUEST['id'] ) )
                                                    Severity: Minor
                                                    Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.php - About 1 hr to fix

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

                                                      function wp_ajax_ajax_tag_search() {
                                                          global $wpdb;
                                                      
                                                          if ( isset( $_GET['tax'] ) ) {
                                                              $taxonomy = sanitize_key( $_GET['tax'] );
                                                      Severity: Minor
                                                      Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.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 wp_ajax_wp_fullscreen_save_post has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                      function wp_ajax_wp_fullscreen_save_post() {
                                                          $post_id = isset( $_POST['post_ID'] ) ? (int) $_POST['post_ID'] : 0;
                                                      
                                                          $post = $post_type = null;
                                                      
                                                      
                                                      Severity: Minor
                                                      Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.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 wp_ajax_set_post_thumbnail has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                      function wp_ajax_set_post_thumbnail() {
                                                          $json = ! empty( $_REQUEST['json'] ); // New-style request
                                                      
                                                          $post_ID = intval( $_POST['post_id'] );
                                                          if ( ! current_user_can( 'edit_post', $post_ID ) )
                                                      Severity: Minor
                                                      Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.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

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

                                                      function wp_ajax_send_link_to_editor() {
                                                          check_ajax_referer( 'media-send-to-editor', 'nonce' );
                                                      
                                                          if ( ! $src = wp_unslash( $_POST['src'] ) )
                                                              wp_send_json_error();
                                                      Severity: Minor
                                                      Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.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

                                                      Consider simplifying this complex logical expression.
                                                      Open

                                                          if ( isset($_POST['trash']) && 1 == $_POST['trash'] ) {
                                                              if ( 'trash' == $status )
                                                                  wp_die( time() );
                                                              $r = wp_trash_comment( $comment->comment_ID );
                                                          } elseif ( isset($_POST['untrash']) && 1 == $_POST['untrash'] ) {
                                                      Severity: Major
                                                      Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.php - About 40 mins to fix

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

                                                        function wp_ajax_add_tag() {
                                                            global $wp_list_table;
                                                        
                                                            check_ajax_referer( 'add-tag', '_wpnonce_add-tag' );
                                                            $post_type = !empty($_POST['post_type']) ? $_POST['post_type'] : 'post';
                                                        Severity: Minor
                                                        Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.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 wp_ajax_dim_comment has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                        Open

                                                        function wp_ajax_dim_comment() {
                                                            $id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0;
                                                        
                                                            if ( !$comment = get_comment( $id ) ) {
                                                                $x = new WP_Ajax_Response( array(
                                                        Severity: Minor
                                                        Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.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 wp_ajax_image_editor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                        Open

                                                        function wp_ajax_image_editor() {
                                                            $attachment_id = intval($_POST['postid']);
                                                            if ( empty($attachment_id) || !current_user_can('edit_post', $attachment_id) )
                                                                wp_die( -1 );
                                                        
                                                        
                                                        Severity: Minor
                                                        Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.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 wp_ajax_get_attachment has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                        Open

                                                        function wp_ajax_get_attachment() {
                                                            if ( ! isset( $_REQUEST['id'] ) )
                                                                wp_send_json_error();
                                                        
                                                            if ( ! $id = absint( $_REQUEST['id'] ) )
                                                        Severity: Minor
                                                        Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.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 wp_ajax_trash_post has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                        Open

                                                        function wp_ajax_trash_post( $action ) {
                                                            if ( empty( $action ) )
                                                                $action = 'trash-post';
                                                            $id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0;
                                                        
                                                        
                                                        Severity: Minor
                                                        Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.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

                                                        Similar blocks of code found in 2 locations. Consider refactoring.
                                                        Open

                                                        function wp_ajax_delete_post( $action ) {
                                                            if ( empty( $action ) )
                                                                $action = 'delete-post';
                                                            $id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0;
                                                        
                                                        
                                                        Severity: Major
                                                        Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.php and 1 other location - About 3 hrs to fix
                                                        Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.php on lines 552..568

                                                        Duplicated Code

                                                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                        Tuning

                                                        This issue has a mass of 149.

                                                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                        Refactorings

                                                        Further Reading

                                                        Similar blocks of code found in 2 locations. Consider refactoring.
                                                        Open

                                                        function wp_ajax_delete_page( $action ) {
                                                            if ( empty( $action ) )
                                                                $action = 'delete-page';
                                                            $id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0;
                                                        
                                                        
                                                        Severity: Major
                                                        Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.php and 1 other location - About 3 hrs to fix
                                                        Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.php on lines 505..521

                                                        Duplicated Code

                                                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                        Tuning

                                                        This issue has a mass of 149.

                                                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                        Refactorings

                                                        Further Reading

                                                        Identical blocks of code found in 2 locations. Consider refactoring.
                                                        Open

                                                                foreach ( $_POST['sidebars'] as $key => $val ) {
                                                                    $sb = array();
                                                                    if ( !empty($val) ) {
                                                                        $val = explode(',', $val);
                                                                        foreach ( $val as $k => $v ) {
                                                        Severity: Major
                                                        Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.php and 1 other location - About 2 hrs to fix
                                                        Web.Admin/2014/wordpress/wp-admin/admin-ajax.php on lines 1295..1307

                                                        Duplicated Code

                                                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                        Tuning

                                                        This issue has a mass of 123.

                                                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                        Refactorings

                                                        Further Reading

                                                        Similar blocks of code found in 2 locations. Consider refactoring.
                                                        Open

                                                            if ( isset( $_GET['tax'] ) ) {
                                                                $taxonomy = sanitize_key( $_GET['tax'] );
                                                                $tax = get_taxonomy( $taxonomy );
                                                                if ( ! $tax )
                                                                    wp_die( 0 );
                                                        Severity: Major
                                                        Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.php and 1 other location - About 1 hr to fix
                                                        Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.php on lines 691..700

                                                        Duplicated Code

                                                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                        Tuning

                                                        This issue has a mass of 103.

                                                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                        Refactorings

                                                        Further Reading

                                                        Similar blocks of code found in 2 locations. Consider refactoring.
                                                        Open

                                                            if ( isset( $_POST['tax'] ) ) {
                                                                $taxonomy = sanitize_key( $_POST['tax'] );
                                                                $tax = get_taxonomy( $taxonomy );
                                                                if ( ! $tax )
                                                                    wp_die( 0 );
                                                        Severity: Major
                                                        Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.php and 1 other location - About 1 hr to fix
                                                        Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.php on lines 93..102

                                                        Duplicated Code

                                                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                        Tuning

                                                        This issue has a mass of 103.

                                                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                        Refactorings

                                                        Further Reading

                                                        Similar blocks of code found in 2 locations. Consider refactoring.
                                                        Open

                                                            } elseif ( isset($_POST['unspam']) && 1 == $_POST['unspam'] ) {
                                                                if ( 'spam' != $status )
                                                                    wp_die( time() );
                                                                $r = wp_unspam_comment( $comment->comment_ID );
                                                                if ( ! isset( $_POST['comment_status'] ) || $_POST['comment_status'] != 'spam' ) // undo spam, not in spam
                                                        Severity: Minor
                                                        Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.php and 1 other location - About 40 mins to fix
                                                        Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.php on lines 427..433

                                                        Duplicated Code

                                                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                        Tuning

                                                        This issue has a mass of 93.

                                                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                        Refactorings

                                                        Further Reading

                                                        Similar blocks of code found in 2 locations. Consider refactoring.
                                                        Open

                                                            } elseif ( isset($_POST['untrash']) && 1 == $_POST['untrash'] ) {
                                                                if ( 'trash' != $status )
                                                                    wp_die( time() );
                                                                $r = wp_untrash_comment( $comment->comment_ID );
                                                                if ( ! isset( $_POST['comment_status'] ) || $_POST['comment_status'] != 'trash' ) // undo trash, not in trash
                                                        Severity: Minor
                                                        Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.php and 1 other location - About 40 mins to fix
                                                        Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.php on lines 437..443

                                                        Duplicated Code

                                                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                        Tuning

                                                        This issue has a mass of 93.

                                                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                        Refactorings

                                                        Further Reading

                                                        There are no issues that match your filters.

                                                        Category
                                                        Status