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

View on GitHub

Showing 399 of 427 total issues

Avoid deeply nested control flow statements.
Open

                            if ( !$siteurl ) $siteurl = get_home_url( $blog_id );
Severity: Major
Found in aioseop_sitemap.php - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                                if ( $sitemap_options["{$this->prefix}gzipped"] ) $url .= '.gz';
    Severity: Major
    Found in aioseop_sitemap.php - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                                  if ( defined( 'SUNRISE' ) && SUNRISE && is_object( $wpdb ) && isset( $wpdb->dmtable ) && !empty( $wpdb->dmtable ) ) {
                                      $domain = $wpdb->get_var( "SELECT domain FROM {$wpdb->dmtable} WHERE blog_id = '$blog_id' AND active = 1 LIMIT 1" );
                                      if ( $domain ) {
                                          if ( false == isset( $_SERVER[ 'HTTPS' ] ) )
                                              $_SERVER[ 'HTTPS' ] = 'Off';
      Severity: Major
      Found in aioseop_sitemap.php - About 45 mins to fix

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

                function cache_options() {
                    static $start = true;
                    if ( $start ) {
                        $this->cache_struct = get_option( 'permalink_structure' );
                        if ( !empty( $this->cache_struct ) ) add_filter( 'pre_option_permalink_structure', Array( $this, 'cache_structure' ) );
        Severity: Minor
        Found in aioseop_sitemap.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 All_in_One_SEO_Pack_File_Editor has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

                function All_in_One_SEO_Pack_File_Editor( ) {
                    $this->name = __('File Editor', 'all-in-one-seo-pack');        // Human-readable name of the plugin
                    $this->prefix = 'aiosp_file_editor_';                        // option prefix
                    $this->file = __FILE__;                                        // the current file
                    parent::__construct();
        Severity: Minor
        Found in aioseop_file_editor.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 do_write_sitemap has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

                function do_write_sitemap( $sitemap_type, $page = 0, $filename = '', $comment = '' ) {
                    if ( empty( $filename ) ) {
                        if ( $sitemap_type == 'root' ) {
                            $filename = $this->options["{$this->prefix}filename"];                    
                        } else {
        Severity: Minor
        Found in aioseop_sitemap.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 ( !empty( $keywords ) && !empty( $tag ) ) {
                                    $tag .= ',' . $keywords;
                                } elseif ( empty( $tag ) ) {
                                    $tag = $keywords;
                                }
        Severity: Major
        Found in aioseop_opengraph.php - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                      if ( !empty( $legacy[$thumbnail] ) )
                                          $thumbnail = $legacy[$thumbnail];
          Severity: Major
          Found in aioseop_opengraph.php - About 45 mins to fix

            Method get_default_values has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    function get_default_values( $defaults, $prefix, &$cache, $item, $nodefaults = false, $type = '' ) {
            Severity: Minor
            Found in aioseop_sitemap.php - About 45 mins to fix

              Consider simplifying this complex logical expression.
              Open

                              if ( ( $aiosp_nofollow == 'on' ) || ( ( !empty( $aioseop_options['aiosp_paginated_nofollow'] ) ) && ( ( $page > 1 ) ) ) ||
                                   ( ( $aiosp_nofollow == '' ) && ( !empty( $aioseop_options['aiosp_cpostnofollow'] ) ) && ( in_array( $post_type, $aioseop_options['aiosp_cpostnofollow'] ) ) ) )
                                  $nofollow = "no" . $nofollow;
              Severity: Major
              Found in aioseop_class.php - About 40 mins to fix

                Consider simplifying this complex logical expression.
                Open

                                if ( ( $aiosp_noindex == 'on' ) || ( ( !empty( $aioseop_options['aiosp_paginated_noindex'] ) ) && ( ( $page > 1 ) ) ) ||
                                     ( ( $aiosp_noindex == '' ) && ( !empty( $aioseop_options['aiosp_cpostnoindex'] ) ) && ( in_array( $post_type, $aioseop_options['aiosp_cpostnoindex'] ) ) ) )
                                    $noindex = "no" . $noindex;
                Severity: Major
                Found in aioseop_class.php - About 40 mins to fix

                  Consider simplifying this complex logical expression.
                  Open

                                  if ( ( ( $title_type == 'archive' ) && is_post_type_archive( $wp_post_types ) && $prefix = "aiosp_{$title_type}_" ) ||
                                       ( ( $title_type == 'post' ) && $this->is_singular( $wp_post_types, $p ) && $prefix = "aiosp_" ) ) {
                                          $post_type = get_post_type( $p );
                                          if ( !empty( $aioseop_options["{$prefix}{$post_type}_title_format"] ) ) {
                                              $title_format = $aioseop_options["{$prefix}{$post_type}_title_format"];
                  Severity: Major
                  Found in aioseop_class.php - About 40 mins to fix

                    Consider simplifying this complex logical expression.
                    Open

                            if ( !is_object( $post ) && is_admin() && !empty( $_GET ) && !empty( $_GET['post_type'] ) && !empty( $_GET['taxonomy'] ) && !empty( $_GET['tag_ID'] ) ) {
                                $term = get_term_by( 'id', $_GET['tag_ID'], $_GET['taxonomy'] );
                            }
                    Severity: Major
                    Found in aioseop_class.php - About 40 mins to fix

                      Consider simplifying this complex logical expression.
                      Open

                                      if ( empty( $description ) && $first_page && ( !empty( $this->options['aiosp_opengraph_generate_descriptions'] ) ) && !empty( $post ) && !empty( $post->post_content ) && !post_password_required( $post ) )
                                          $description = $aiosp->trim_excerpt_without_filters( $aiosp->internationalize( preg_replace( '/\s+/', ' ', $post->post_content ) ), 1000 );
                      Severity: Major
                      Found in aioseop_opengraph.php - About 40 mins to fix

                        Method title_placeholder_helper has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            function title_placeholder_helper( $title, $post, $type = 'post', $title_format = '', $category = '' ) {
                        Severity: Minor
                        Found in aioseop_class.php - About 35 mins to fix

                          Method Services_JSON_Error has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                                  function Services_JSON_Error($message = 'unknown error', $code = null,
                                                               $mode = null, $options = null, $userinfo = null)
                          Severity: Minor
                          Found in JSON.php - About 35 mins to fix

                            Method Services_JSON_Error has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                    function Services_JSON_Error($message = 'unknown error', $code = null,
                                                                 $mode = null, $options = null, $userinfo = null)
                            Severity: Minor
                            Found in JSON.php - About 35 mins to fix

                              Method from_consumer_and_token has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                    public static function from_consumer_and_token($consumer, $token, $http_method, $http_url, $parameters=NULL) {
                              Severity: Minor
                              Found in OAuth.php - About 35 mins to fix

                                Method load_file has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                        function load_file( $filename, $use_include_path = false, $context = null, $offset = -1, $maxlen = -1 ) {
                                Severity: Minor
                                Found in aioseop_module_class.php - About 35 mins to fix

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

                                      function add_page_icon() {
                                          wp_enqueue_script( 'wp-pointer', false, array( 'jquery' ) );
                                          wp_enqueue_style( 'wp-pointer' );
                                          $this->add_admin_pointers();
                                          ?>
                                  Severity: Minor
                                  Found in aioseop_class.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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language