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

View on GitHub
aioseop_sitemap.php

Summary

Maintainability
F
1 mo
Test Coverage

File aioseop_sitemap.php has 1561 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * @package All-in-One-SEO-Pack
 */
/**
Severity: Major
Found in aioseop_sitemap.php - About 4 days to fix

    Function output_sitemap has a Cognitive Complexity of 98 (exceeds 5 allowed). Consider refactoring.
    Open

            function output_sitemap( $urls, $comment = '' ) {
                $max_items = 50000;
                if ( !is_array( $urls ) ) return null;
                echo '<?xml version="1.0" encoding="UTF-8"?>' . "\r\n\r\n";
                echo "<!-- " . sprintf( $this->comment_string, $comment, AIOSEOP_VERSION, date('D, d M Y H:i:s e') ) . " -->\r\n";
    Severity: Minor
    Found in aioseop_sitemap.php - About 1 day to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    All_in_One_SEO_Pack_Sitemap has 81 functions (exceeds 20 allowed). Consider refactoring.
    Open

        class All_in_One_SEO_Pack_Sitemap extends All_in_One_SEO_Pack_Module {
            var $cache_struct = null;
            var $cache_home = null;
            var $comment_string;
            var $start_memory_usage = 0;
    Severity: Major
    Found in aioseop_sitemap.php - About 1 day to fix

      Function get_prio_from_posts has a Cognitive Complexity of 73 (exceeds 5 allowed). Consider refactoring.
      Open

              function get_prio_from_posts( $posts, $prio_override = false, $freq_override = false, $linkfunc = 'get_permalink' ) {
                  $prio = Array();
                  $args = Array( 'prio_override' => $prio_override, 'freq_override' => $freq_override, 'linkfunc' => $linkfunc );
                  if ( ( $prio_override ) && ( $freq_override ) )
                      $stats = 0;
      Severity: Minor
      Found in aioseop_sitemap.php - About 1 day to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function get_sitemap_index_filenames has a Cognitive Complexity of 72 (exceeds 5 allowed). Consider refactoring.
      Open

              function get_sitemap_index_filenames() {
                  $files = Array();
                  $options = $this->options;
                  $prefix = $options["{$this->prefix}filename"];
                  $suffix = '.xml';
      Severity: Minor
      Found in aioseop_sitemap.php - About 1 day to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function do_indexed_sitemaps has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
      Open

              function do_indexed_sitemaps() {
                  $this->start_memory_usage = memory_get_peak_usage();
                  $options = $this->options;
                  
                  $this->do_write_sitemap( 'root' );
      Severity: Minor
      Found in aioseop_sitemap.php - About 1 day to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function do_sitemap_scan has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
      Open

              function do_sitemap_scan() {
                  $msg = '';
                  if ( !empty(  $this->options["{$this->prefix}rewrite"] ) && ( get_option('permalink_structure') == '' ) ) { 
                      $msg = '<p>' . __( 'Warning: dynamic sitemap generation must have permalinks enabled.', 'all-in-one-seo-pack' ) . '</p>';
                  }
      Severity: Minor
      Found in aioseop_sitemap.php - About 1 day to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function get_problem_files has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
      Open

              function get_problem_files( $files, &$msg ) {
                  $problem_files = Array();
                  $use_wpfs = true;
                  $wpfs = $this->get_filesystem_object();
                  if ( !is_object( $wpfs ) ) {
      Severity: Minor
      Found in aioseop_sitemap.php - About 1 day to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function get_child_sitemap_urls has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
      Open

              function get_child_sitemap_urls() {
                  $siteurls = Array();
                  $blogs = $this->get_child_blogs();
                  if ( !empty( $blogs ) ) {
                      $option_name = $this->get_option_name();
      Severity: Minor
      Found in aioseop_sitemap.php - About 7 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function filter_options has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
      Open

              function filter_options( $options ) {
                  if ( !isset( $this->default_options['posttypes' ]['initial_options'] ) ) $this->add_post_types();
                  if ( is_array( $options["{$this->prefix}posttypes"] ) && in_array( 'all', $options["{$this->prefix}posttypes"] ) && is_array( $this->default_options['posttypes' ]['initial_options'] ) )
                      $options["{$this->prefix}posttypes"] = array_keys( $this->default_options['posttypes' ]['initial_options'] );
                  if ( is_array( $options["{$this->prefix}taxonomies"] ) && in_array( 'all', $options["{$this->prefix}taxonomies"] ) && is_array( $this->default_options['taxonomies' ]['initial_options'] ) )
      Severity: Minor
      Found in aioseop_sitemap.php - About 7 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method __construct has 170 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              function __construct( ) {
                  if ( get_class( $this ) === 'All_in_One_SEO_Pack_Sitemap' ) { // Set this up only when instantiated as this class
                      $this->name = __( 'XML Sitemap', 'all-in-one-seo-pack' ); // Human-readable name of the plugin
                      $this->prefix = 'aiosp_sitemap_';                          // option prefix
                      $this->file = __FILE__;                                      // the current file
      Severity: Major
      Found in aioseop_sitemap.php - About 6 hrs to fix

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

                function get_simple_sitemap() {
                    $home = Array(
                                'loc' => get_home_url(),
                                'priority' => $this->get_default_priority( 'homepage' ),
                                'changefreq' => $this->get_default_frequency( 'homepage' )
        Severity: Minor
        Found in aioseop_sitemap.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 get_all_post_counts has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
        Open

                function get_all_post_counts( $args ) {
                    $post_counts = null;
                    $status = 'inherit';
                    if ( !empty( $args['post_status'] ) ) $status = $args['post_status'];
                    if ( !empty( $args ) && !empty( $args['post_type'] ) )
        Severity: Minor
        Found in aioseop_sitemap.php - About 5 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 get_all_post_type_data has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
        Open

                function get_all_post_type_data( $args ) {
                    $defaults = array(
                        'numberposts' => $this->max_posts, 'offset' => 0,
                        'category' => 0, 'orderby' => 'post_date',
                        'order' => 'DESC', 'include' => array(),
        Severity: Minor
        Found in aioseop_sitemap.php - About 5 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 get_default_values has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
        Open

                function get_default_values( $defaults, $prefix, &$cache, $item, $nodefaults = false, $type = '' ) {
                    if ( !empty( $cache[ $item . $type ] ) ) return $cache[ $item . $type ];
                    if ( !empty( $defaults[ $item ] ) ) {
                        $field = $this->prefix . $prefix . $item;
                        if ( $this->option_isset( $prefix . $item ) && $this->options[ $field ] != 'no' ) {
        Severity: Minor
        Found in aioseop_sitemap.php - About 5 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 get_addl_pages_only has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
        Open

                function get_addl_pages_only() {
                    $pages = Array();
                    if ( !empty( $this->options[ $this->prefix . 'addl_pages' ] ) ) {
                        $siteurl = parse_url( get_home_url() );
                        foreach( $this->options[ $this->prefix . 'addl_pages' ] as $k => $v ) {
        Severity: Minor
        Found in aioseop_sitemap.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 sitemap_output_hook has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

                function sitemap_output_hook($query) {
                    $page = 0;
                    if ( ( $this->options["{$this->prefix}rewrite"] ) )
                        if( !empty( $query->query_vars["{$this->prefix}path"] ) ) {
                            if( !empty( $query->query_vars["{$this->prefix}page"] ) )
        Severity: Minor
        Found in aioseop_sitemap.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 get_comment_count_stats has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

                function get_comment_count_stats( $posts ) {
                    $count = 0;
                    $total = 0.0;
                    $min = null;
                    $max = 0;
        Severity: Minor
        Found in aioseop_sitemap.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

        Function scan_match_files has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

                function scan_match_files() {
                    $scan1 = $scan2 = '';
                    $files = Array();
                    
                    if ( !empty( $this->options["{$this->prefix}filename"] ) ) {
        Severity: Minor
        Found in aioseop_sitemap.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

        Function get_prio_calc has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
        Open

                function get_prio_calc( $date, $stats = 0 ) {
                    static $cur_time = null;
                    if ($cur_time === null) $cur_time = time();
                    $time = $cur_time - mysql2date( 'U', $date );
                    if ( !empty( $stats ) && isset( $stats['max'] ) && ( $stats['max'] ) ) {
        Severity: Minor
        Found in aioseop_sitemap.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

        Function do_notify has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

                function do_notify() {
                    $notify_url = Array(    'google' => 'http://www.google.com/webmasters/sitemaps/ping?sitemap=', 
                                            'bing' => 'http://www.bing.com/webmaster/ping.aspx?siteMap='
                                );
        
        
        Severity: Minor
        Found in aioseop_sitemap.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

        Function get_sitemap_data has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

                function get_sitemap_data( $sitemap_type, $page = 0 ) {
                    $sitemap_data = Array();
                    if ( $this->options["{$this->prefix}indexes"] ) {
                        $posttypes = $this->options["{$this->prefix}posttypes"];
                        if ( empty( $posttypes ) ) $posttypes = Array();
        Severity: Minor
        Found in aioseop_sitemap.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

        Function get_archive_prio_from_posts has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

                function get_archive_prio_from_posts( $posts ) {
                    $archives = Array();
                    if ( is_array( $posts ) )
                        foreach( $posts as $p ) {
                            if ( $p->post_type != 'post' ) continue;
        Severity: Minor
        Found in aioseop_sitemap.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

        Function __construct has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

                function __construct( ) {
                    if ( get_class( $this ) === 'All_in_One_SEO_Pack_Sitemap' ) { // Set this up only when instantiated as this class
                        $this->name = __( 'XML Sitemap', 'all-in-one-seo-pack' ); // Human-readable name of the plugin
                        $this->prefix = 'aiosp_sitemap_';                          // option prefix
                        $this->file = __FILE__;                                      // the current file
        Severity: Minor
        Found in aioseop_sitemap.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

        Function output_sitemap_index has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

                function output_sitemap_index( $urls, $comment = '' ) {
                    $max_items = 50000;
                    if ( !is_array( $urls ) ) return null;
                    echo '<?xml version="1.0" encoding="UTF-8"?>' . "\r\n\r\n";
                    echo "<!-- " . sprintf( $this->comment_string, $comment, AIOSEOP_VERSION, date('D, d M Y H:i:s e') ) . " -->\r\n";
        Severity: Minor
        Found in aioseop_sitemap.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

        Function get_all_term_counts has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

                function get_all_term_counts( $args ) {
                    $term_counts = null;
                    if ( !empty( $args ) && !empty( $args['taxonomy'] ) )
                        if ( !is_array( $args['taxonomy'] ) || ( count( $args['taxonomy'] ) == 1 ) ) {
                            if ( is_array( $args['taxonomy'] ) )
        Severity: Minor
        Found in aioseop_sitemap.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

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

                function filter_display_options( $options ) {
                    if ( is_multisite() ) $options[ $this->prefix . 'rewrite'] = 'On';
                    if ( isset( $options[ $this->prefix . 'max_posts'] ) && ( ( $options[ $this->prefix . 'max_posts'] <= 0 ) || ( $options[ $this->prefix . 'max_posts'] >= 50000 ) ) )
                        $options[ $this->prefix . 'max_posts'] = 50000;
                    $url = trailingslashit( get_home_url() ) . $options[ $this->prefix . 'filename' ] . '.xml';
        Severity: Minor
        Found in aioseop_sitemap.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 get_author_prio_from_posts has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

                function get_author_prio_from_posts( $posts ) {
                    $authors = Array();
                    if ( is_array( $posts ) )
                        foreach( $posts as $p ) {
                            if ( $p->post_type != 'post' ) continue;
        Severity: Minor
        Found in aioseop_sitemap.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 display_custom_options has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

                function display_custom_options( $buf, $args ) {
                    if ( $args['name'] == "{$this->prefix}addl_pages" ) {
                        $buf .= "<div id='{$this->prefix}addl_pages'>";
                        if ( !empty( $args['value'] ) ) {
                            $buf .= "<table class='aioseop_table' cellpadding=0 cellspacing=0>\n";
        Severity: Minor
        Found in aioseop_sitemap.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 load_sitemap_options has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

                function load_sitemap_options() {
                    // load initial options / set defaults
                    $this->update_options( );
                    if ( !empty( $this->options["{$this->prefix}indexes"] ) && !empty( $this->options["{$this->prefix}paginate"] ) ) {
                        $this->paginate = true;
        Severity: Minor
        Found in aioseop_sitemap.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 do_sitemaps has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

                function do_sitemaps( $message = '' ) {
                    if ( !empty( $this->options["{$this->prefix}indexes"] ) && !empty( $this->options["{$this->prefix}paginate"] ) ) {
                        $this->paginate = true;
                        if ( ( $this->options["{$this->prefix}max_posts"] ) && ( $this->options["{$this->prefix}max_posts"] > 0 ) && ( $this->options["{$this->prefix}max_posts"] < 50000 ) )
                            $this->max_posts = $this->options["{$this->prefix}max_posts"];
        Severity: Minor
        Found in aioseop_sitemap.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 output_sitemap has 59 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                function output_sitemap( $urls, $comment = '' ) {
                    $max_items = 50000;
                    if ( !is_array( $urls ) ) return null;
                    echo '<?xml version="1.0" encoding="UTF-8"?>' . "\r\n\r\n";
                    echo "<!-- " . sprintf( $this->comment_string, $comment, AIOSEOP_VERSION, date('D, d M Y H:i:s e') ) . " -->\r\n";
        Severity: Major
        Found in aioseop_sitemap.php - About 2 hrs to fix

          Method get_simple_sitemap has 54 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  function get_simple_sitemap() {
                      $home = Array(
                                  'loc' => get_home_url(),
                                  'priority' => $this->get_default_priority( 'homepage' ),
                                  'changefreq' => $this->get_default_frequency( 'homepage' )
          Severity: Major
          Found in aioseop_sitemap.php - About 2 hrs to fix

            Method get_sitemap_index_filenames has 53 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    function get_sitemap_index_filenames() {
                        $files = Array();
                        $options = $this->options;
                        $prefix = $options["{$this->prefix}filename"];
                        $suffix = '.xml';
            Severity: Major
            Found in aioseop_sitemap.php - About 2 hrs to fix

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

                      function get_term_priority_data( $terms ) {
                          $prio = Array();
                          if (is_array( $terms ) ) {
                              $def_prio = $this->get_default_priority( 'taxonomies' );
                              $def_freq = $this->get_default_frequency( 'taxonomies' );
              Severity: Minor
              Found in aioseop_sitemap.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 get_prio_from_posts has 51 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      function get_prio_from_posts( $posts, $prio_override = false, $freq_override = false, $linkfunc = 'get_permalink' ) {
                          $prio = Array();
                          $args = Array( 'prio_override' => $prio_override, 'freq_override' => $freq_override, 'linkfunc' => $linkfunc );
                          if ( ( $prio_override ) && ( $freq_override ) )
                              $stats = 0;
              Severity: Major
              Found in aioseop_sitemap.php - About 2 hrs to fix

                Method get_all_post_type_data has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        function get_all_post_type_data( $args ) {
                            $defaults = array(
                                'numberposts' => $this->max_posts, 'offset' => 0,
                                'category' => 0, 'orderby' => 'post_date',
                                'order' => 'DESC', 'include' => array(),
                Severity: Minor
                Found in aioseop_sitemap.php - About 1 hr to fix

                  Method do_indexed_sitemaps has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          function do_indexed_sitemaps() {
                              $this->start_memory_usage = memory_get_peak_usage();
                              $options = $this->options;
                              
                              $this->do_write_sitemap( 'root' );
                  Severity: Minor
                  Found in aioseop_sitemap.php - About 1 hr to fix

                    Method filter_options has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            function filter_options( $options ) {
                                if ( !isset( $this->default_options['posttypes' ]['initial_options'] ) ) $this->add_post_types();
                                if ( is_array( $options["{$this->prefix}posttypes"] ) && in_array( 'all', $options["{$this->prefix}posttypes"] ) && is_array( $this->default_options['posttypes' ]['initial_options'] ) )
                                    $options["{$this->prefix}posttypes"] = array_keys( $this->default_options['posttypes' ]['initial_options'] );
                                if ( is_array( $options["{$this->prefix}taxonomies"] ) && in_array( 'all', $options["{$this->prefix}taxonomies"] ) && is_array( $this->default_options['taxonomies' ]['initial_options'] ) )
                    Severity: Minor
                    Found in aioseop_sitemap.php - About 1 hr to fix

                      Method get_prio_calc has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              function get_prio_calc( $date, $stats = 0 ) {
                                  static $cur_time = null;
                                  if ($cur_time === null) $cur_time = time();
                                  $time = $cur_time - mysql2date( 'U', $date );
                                  if ( !empty( $stats ) && isset( $stats['max'] ) && ( $stats['max'] ) ) {
                      Severity: Minor
                      Found in aioseop_sitemap.php - About 1 hr to fix

                        Method get_problem_files has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                function get_problem_files( $files, &$msg ) {
                                    $problem_files = Array();
                                    $use_wpfs = true;
                                    $wpfs = $this->get_filesystem_object();
                                    if ( !is_object( $wpfs ) ) {
                        Severity: Minor
                        Found in aioseop_sitemap.php - About 1 hr to fix

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

                                  function do_sitemap_scan() {
                                      $msg = '';
                                      if ( !empty(  $this->options["{$this->prefix}rewrite"] ) && ( get_option('permalink_structure') == '' ) ) { 
                                          $msg = '<p>' . __( 'Warning: dynamic sitemap generation must have permalinks enabled.', 'all-in-one-seo-pack' ) . '</p>';
                                      }
                          Severity: Minor
                          Found in aioseop_sitemap.php - About 1 hr to fix

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

                                    function do_build_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 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 get_addl_pages has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                            Open

                                    function get_addl_pages() {
                                        $home = Array();
                                        $home = Array(
                                                    'loc' => get_home_url(),
                                                    'priority' => $this->get_default_priority( 'homepage' ),
                            Severity: Minor
                            Found in aioseop_sitemap.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 get_child_sitemap_urls has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    function get_child_sitemap_urls() {
                                        $siteurls = Array();
                                        $blogs = $this->get_child_blogs();
                                        if ( !empty( $blogs ) ) {
                                            $option_name = $this->get_option_name();
                            Severity: Minor
                            Found in aioseop_sitemap.php - About 1 hr to fix

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

                                      function add_post_types() {
                                          $post_type_titles = $this->get_post_type_titles( Array( 'public' => true ) );
                                          $taxonomy_titles = $this->get_taxonomy_titles(  Array( 'public' => true ) );
                                          if ( isset( $post_type_titles['attachment'] ) ) $post_type_titles['attachment'] = __( "Media / Attachments", 'all-in-one-seo-pack' );
                                          $this->default_options['posttypes' ]['initial_options'] = array_merge( Array( 'all' => __( 'All Post Types', 'all-in-one-seo-pack' ) ), $post_type_titles );
                              Severity: Minor
                              Found in aioseop_sitemap.php - About 1 hr to fix

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

                                        function do_sitemaps( $message = '' ) {
                                            if ( !empty( $this->options["{$this->prefix}indexes"] ) && !empty( $this->options["{$this->prefix}paginate"] ) ) {
                                                $this->paginate = true;
                                                if ( ( $this->options["{$this->prefix}max_posts"] ) && ( $this->options["{$this->prefix}max_posts"] > 0 ) && ( $this->options["{$this->prefix}max_posts"] < 50000 ) )
                                                    $this->max_posts = $this->options["{$this->prefix}max_posts"];
                                Severity: Minor
                                Found in aioseop_sitemap.php - About 1 hr to fix

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

                                          function filter_display_options( $options ) {
                                              if ( is_multisite() ) $options[ $this->prefix . 'rewrite'] = 'On';
                                              if ( isset( $options[ $this->prefix . 'max_posts'] ) && ( ( $options[ $this->prefix . 'max_posts'] <= 0 ) || ( $options[ $this->prefix . 'max_posts'] >= 50000 ) ) )
                                                  $options[ $this->prefix . 'max_posts'] = 50000;
                                              $url = trailingslashit( get_home_url() ) . $options[ $this->prefix . 'filename' ] . '.xml';
                                  Severity: Minor
                                  Found in aioseop_sitemap.php - About 1 hr to fix

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

                                            function sitemap_output_hook($query) {
                                                $page = 0;
                                                if ( ( $this->options["{$this->prefix}rewrite"] ) )
                                                    if( !empty( $query->query_vars["{$this->prefix}path"] ) ) {
                                                        if( !empty( $query->query_vars["{$this->prefix}page"] ) )
                                    Severity: Minor
                                    Found in aioseop_sitemap.php - About 1 hr to fix

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

                                              function get_total_post_count( $args ) {
                                                  $total = 0;
                                                  $counts = $this->get_all_post_counts( $args );
                                                  if ( !empty( $counts ) )
                                                      if ( is_array( $counts ) )
                                      Severity: Minor
                                      Found in aioseop_sitemap.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 get_rewrite_url has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                              function get_rewrite_url( $url ) {
                                                  global $wp_rewrite;
                                                  $url = parse_url( esc_url( $url ), PHP_URL_PATH );
                                                  $url = ltrim( $url, '/' );
                                                  if ( !empty( $wp_rewrite ) ) {
                                      Severity: Minor
                                      Found in aioseop_sitemap.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 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 ( !$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

                                            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

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

                                                      function get_all_post_priority_data( $include = 'any', $status = 'publish', $page = 0 ) {
                                                          $posts = $page_query = Array();
                                                          if ( $this->paginate )
                                                              $page_query = Array( 'offset' => $page * $this->max_posts );
                                                          if ( ( $status == 'publish' ) && ( $include == 'attachment' ) ) $status = 'inherit';
                                              Severity: Minor
                                              Found in aioseop_sitemap.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 get_archive_permalinks has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                      function get_archive_permalinks( $posts ) {
                                                          $links = Array();
                                                          $archives = Array();
                                                          if (is_array( $posts) )
                                                              foreach ( $posts as $post ) {
                                              Severity: Minor
                                              Found in aioseop_sitemap.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 get_author_permalinks has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                      function get_author_permalinks( $posts ) {
                                                          $links = Array();
                                                          $authors = Array();
                                                          if (is_array( $posts) )
                                                              foreach ( $posts as $post )
                                              Severity: Minor
                                              Found in aioseop_sitemap.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 set_post_args has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                      function set_post_args( $args ) {
                                                          if ( $this->option_isset( 'excl_categories' ) ) {
                                                              $cats = Array();
                                                              foreach( $this->options[ $this->prefix . 'excl_categories'] as $c ) $cats[] = -$c;
                                                              $args['category'] = implode( ',', $cats );
                                              Severity: Minor
                                              Found in aioseop_sitemap.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 sitemap_warning has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                      function sitemap_warning( $files ) {
                                                          $msg = '';
                                                          $conflict = false;
                                                          $problem_files = $this->get_problem_files( $files, $msg );
                                                          if ( !empty( $problem_files ) ) $conflict = true;
                                              Severity: Minor
                                              Found in aioseop_sitemap.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 debug_message has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                      function debug_message( $msg ) {
                                                          if ( empty( $this->options["{$this->prefix}debug"] ) ) $this->options["{$this->prefix}debug"] = '';
                                                          $this->options["{$this->prefix}debug"] = date( 'Y-m-d H:i:s' ) . " {$msg}\n" . $this->options["{$this->prefix}debug"];
                                                          if ( $this->strlen( $this->options["{$this->prefix}debug"] ) > 2048 ) {
                                                              $end = $this->strrpos( $this->options["{$this->prefix}debug"], "\n" );
                                              Severity: Minor
                                              Found in aioseop_sitemap.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

                                              Avoid too many return statements within this method.
                                              Open

                                                                  return $cache[ $item . $type ];
                                              Severity: Major
                                              Found in aioseop_sitemap.php - About 30 mins to fix

                                                Avoid too many return statements within this method.
                                                Open

                                                                        if ( $this->options[ $field ] == 'sel' ) return false;
                                                Severity: Major
                                                Found in aioseop_sitemap.php - About 30 mins to fix

                                                  Avoid too many return statements within this method.
                                                  Open

                                                                  if ( $nodefaults ) return false;
                                                  Severity: Major
                                                  Found in aioseop_sitemap.php - About 30 mins to fix

                                                    Avoid too many return statements within this method.
                                                    Open

                                                                    return $defaults[ $item ];
                                                    Severity: Major
                                                    Found in aioseop_sitemap.php - About 30 mins to fix

                                                      Avoid too many return statements within this method.
                                                      Open

                                                                  return false;
                                                      Severity: Major
                                                      Found in aioseop_sitemap.php - About 30 mins to fix

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

                                                                function flush_rules_hook() {
                                                                    global $wp_rewrite;
                                                                    $sitemap_rules = $this->get_rewrite_rules( $wp_rewrite );
                                                                    if ( !empty( $sitemap_rules ) ) {
                                                                        $rules = get_option( 'rewrite_rules' );
                                                        Severity: Minor
                                                        Found in aioseop_sitemap.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 add_post_types has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                        Open

                                                                function add_post_types() {
                                                                    $post_type_titles = $this->get_post_type_titles( Array( 'public' => true ) );
                                                                    $taxonomy_titles = $this->get_taxonomy_titles(  Array( 'public' => true ) );
                                                                    if ( isset( $post_type_titles['attachment'] ) ) $post_type_titles['attachment'] = __( "Media / Attachments", 'all-in-one-seo-pack' );
                                                                    $this->default_options['posttypes' ]['initial_options'] = array_merge( Array( 'all' => __( 'All Post Types', 'all-in-one-seo-pack' ) ), $post_type_titles );
                                                        Severity: Minor
                                                        Found in aioseop_sitemap.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

                                                                    foreach( $taxonomy_titles as $k => $v ) {
                                                                        $key = 'prio_taxonomies_' . $k;
                                                                        $this->default_options = aioseop_array_insert_after( $this->default_options, 'prio_taxonomies', Array( $key => Array( 'name' => $v . $tax_name, 'help_text' => $prio_help . $v . $tax_name, 'type' => 'select', 'initial_options' => $this->prio, 'default' => 'no', 'condshow' => Array( "{$this->prefix}prio_taxonomies" => 'sel' ) ) ) );                
                                                                        $this->layout['priorities']['options'][] = $key;
                                                                        $key = 'freq_taxonomies_' . $k;
                                                        Severity: Major
                                                        Found in aioseop_sitemap.php and 1 other location - About 7 hrs to fix
                                                        aioseop_sitemap.php on lines 304..311

                                                        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 240.

                                                        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

                                                                    foreach( $post_type_titles as $k => $v ) {
                                                                        $key = 'prio_post_' . $k;
                                                                        $this->default_options = aioseop_array_insert_after( $this->default_options, 'prio_post', Array( $key => Array( 'name' => $v . $post_name, 'help_text' => $prio_help . $v . $post_name, 'type' => 'select', 'initial_options' => $this->prio, 'default' => 'no', 'condshow' => Array( "{$this->prefix}prio_post" => 'sel' ) ) ) );                
                                                                        $this->layout['priorities']['options'][] = $key;
                                                                        $key = 'freq_post_' . $k;
                                                        Severity: Major
                                                        Found in aioseop_sitemap.php and 1 other location - About 7 hrs to fix
                                                        aioseop_sitemap.php on lines 312..319

                                                        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 240.

                                                        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 debug_message( $msg ) {
                                                                    if ( empty( $this->options["{$this->prefix}debug"] ) ) $this->options["{$this->prefix}debug"] = '';
                                                                    $this->options["{$this->prefix}debug"] = date( 'Y-m-d H:i:s' ) . " {$msg}\n" . $this->options["{$this->prefix}debug"];
                                                                    if ( $this->strlen( $this->options["{$this->prefix}debug"] ) > 2048 ) {
                                                                        $end = $this->strrpos( $this->options["{$this->prefix}debug"], "\n" );
                                                        Severity: Major
                                                        Found in aioseop_sitemap.php and 1 other location - About 6 hrs to fix
                                                        aioseop_bad_robots.php on lines 128..137

                                                        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 216.

                                                        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 ( ( $this->options[ $this->prefix . 'freq_post' ] == 'sel' ) && ( isset( $this->options[ $this->prefix . 'freq_post_' . $post->post_type ] ) ) ) {
                                                                                if ( ( $this->options[ $this->prefix . 'freq_post_' . $post->post_type ] != 'no' ) && ( $this->options[ $this->prefix . 'freq_post_' . $post->post_type ] != 'sel' ) )
                                                                                    $pr_info[ 'changefreq' ] = $this->options[ $this->prefix . 'freq_post_' . $post->post_type ];
                                                                            }
                                                        Severity: Major
                                                        Found in aioseop_sitemap.php and 1 other location - About 2 hrs to fix
                                                        aioseop_sitemap.php on lines 1521..1524

                                                        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 127.

                                                        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 ( ( $this->options[ $this->prefix . 'prio_post' ] == 'sel' ) && ( isset( $this->options[ $this->prefix . 'prio_post_' . $post->post_type ] ) ) ) {
                                                                                if ( ( $this->options[ $this->prefix . 'prio_post_' . $post->post_type ] != 'no' ) && ( $this->options[ $this->prefix . 'prio_post_' . $post->post_type ] != 'sel' ) )
                                                                                    $pr_info[ 'priority' ] = $this->options[ $this->prefix . 'prio_post_' . $post->post_type ];
                                                                            }
                                                        Severity: Major
                                                        Found in aioseop_sitemap.php and 1 other location - About 2 hrs to fix
                                                        aioseop_sitemap.php on lines 1525..1528

                                                        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 127.

                                                        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 ( ( $this->options[ $this->prefix . 'freq_taxonomies' ] == 'sel' ) && ( isset( $this->options[ $this->prefix . 'freq_taxonomies_' . $term->taxonomy ] ) ) && ( $this->options[ $this->prefix . 'freq_taxonomies_' . $term->taxonomy ] != 'no' ) ) {
                                                                                    $pr_info['changefreq'] = $this->options[ $this->prefix . 'freq_taxonomies_' . $term->taxonomy ];
                                                                            } else $pr_info['changefreq'] = $def_freq;
                                                        Severity: Major
                                                        Found in aioseop_sitemap.php and 1 other location - About 1 hr to fix
                                                        aioseop_sitemap.php on lines 1230..1232

                                                        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 114.

                                                        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 ( ( $this->options[ $this->prefix . 'prio_taxonomies' ] == 'sel' ) && ( isset( $this->options[ $this->prefix . 'prio_taxonomies_' . $term->taxonomy ] ) ) && ( $this->options[ $this->prefix . 'prio_taxonomies_' . $term->taxonomy ] != 'no' ) ) {
                                                                                    $pr_info['priority'] = $this->options[ $this->prefix . 'prio_taxonomies_' . $term->taxonomy ];
                                                                            } else $pr_info['priority'] = $def_prio;
                                                        Severity: Major
                                                        Found in aioseop_sitemap.php and 1 other location - About 1 hr to fix
                                                        aioseop_sitemap.php on lines 1233..1235

                                                        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 114.

                                                        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 get_default_priority( $item, $nodefaults = false, $type = '' ) {
                                                                    $defaults = Array( 'homepage' => '1.0', 'blog' => '0.9', 'sitemap' => '0.8', 'post' => '0.7', 'archive' => '0.5', 'author' => '0.3', 'taxonomies' => '0.3' );
                                                                    static $cache = Array();
                                                                    return $this->get_default_values( $defaults, 'prio_', $cache, $item, $nodefaults, $type );
                                                                }
                                                        Severity: Minor
                                                        Found in aioseop_sitemap.php and 1 other location - About 55 mins to fix
                                                        aioseop_sitemap.php on lines 898..902

                                                        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 98.

                                                        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 ( is_array( $options["{$this->prefix}taxonomies"] ) && in_array( 'all', $options["{$this->prefix}taxonomies"] ) && is_array( $this->default_options['taxonomies' ]['initial_options'] ) )
                                                                        $options["{$this->prefix}taxonomies"] = array_keys( $this->default_options['taxonomies' ]['initial_options'] );
                                                        Severity: Minor
                                                        Found in aioseop_sitemap.php and 1 other location - About 55 mins to fix
                                                        aioseop_sitemap.php on lines 395..396

                                                        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 98.

                                                        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 ( is_array( $options["{$this->prefix}posttypes"] ) && in_array( 'all', $options["{$this->prefix}posttypes"] ) && is_array( $this->default_options['posttypes' ]['initial_options'] ) )
                                                                        $options["{$this->prefix}posttypes"] = array_keys( $this->default_options['posttypes' ]['initial_options'] );
                                                        Severity: Minor
                                                        Found in aioseop_sitemap.php and 1 other location - About 55 mins to fix
                                                        aioseop_sitemap.php on lines 397..398

                                                        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 98.

                                                        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 get_default_frequency( $item, $nodefaults = false, $type = '' ) {
                                                                    $defaults = Array( 'homepage' => 'always', 'blog' => 'daily', 'sitemap' => 'hourly', 'post' => 'weekly', 'archive' => 'monthly', 'author' => 'weekly', 'taxonomies' => 'monthly' );
                                                                    static $cache = Array();
                                                                    return $this->get_default_values( $defaults, 'freq_', $cache, $item, $nodefaults, $type );
                                                                }
                                                        Severity: Minor
                                                        Found in aioseop_sitemap.php and 1 other location - About 55 mins to fix
                                                        aioseop_sitemap.php on lines 891..895

                                                        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 98.

                                                        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