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

View on GitHub

Showing 399 of 427 total issues

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

    function trim_excerpt_without_filters( $text, $max = 0 ) {
        $text = str_replace( ']]>', ']]>', $text );
                $text = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $text );
        $text = wp_strip_all_tags( $text );
        if ( !$max ) $max = $this->maximum_description_length;
Severity: Minor
Found in aioseop_class.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_option_div has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

        function display_option_div( $buf, $args ) {
            $name = $img = $desc = $checkbox = $class = '';
            if ( isset( $args['options']['help_text'] ) && !empty( $args['options']['help_text'] ) )
                $desc .= '<p class="aioseop_desc">' . $args['options']['help_text'] . '</p>';
            if ($args['value']) $class = ' active';
Severity: Minor
Found in aioseop_feature_manager.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_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

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

    function aioseop_add_contactmethods( $contactmethods ) {
        global $aioseop_options, $aioseop_modules;
        if ( empty( $aioseop_options['aiosp_google_disable_profile'] ) )
            $contactmethods['googleplus'] = __( 'Google+', 'all-in-one-seo-pack' );
        if ( !empty( $aioseop_modules ) && is_object( $aioseop_modules ) ) {
Severity: Minor
Found in aioseop_functions.php - About 2 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Method parse_annotated_robots has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function parse_annotated_robots( $robots ) {
                $state = 0;
                $rules = Array();
                $opts = Array( 'sitemap', 'crawl-delay', 'user-agent', 'allow', 'disallow', 'comment' );
                $rule = Array();
Severity: Major
Found in aioseop_robots.php - About 2 hrs to fix

    Method All_in_One_SEO_Pack_Performance has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            function All_in_One_SEO_Pack_Performance( $mod ) {
                $this->name = __('Performance', 'all-in-one-seo-pack');        // Human-readable name of the plugin
                $this->prefix = 'aiosp_performance_';                        // option prefix
                $this->file = __FILE__;                                    // the current file
                parent::__construct();
    Severity: Major
    Found in aioseop_performance.php - About 2 hrs to fix

      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_keywords has 51 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function get_all_keywords() {
                global $posts;
                global $aioseop_options;
                if ( is_404() ) return null;
                // if we are on synthetic pages
        Severity: Major
        Found in aioseop_class.php - About 2 hrs to fix

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

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

            Consider simplifying this complex logical expression.
            Open

                        if ( $aiosp_noindex || $aiosp_nofollow || $aiosp_noodp || $aiosp_noydir || !empty( $aioseop_options['aiosp_cpostnoindex'] ) 
                            || !empty( $aioseop_options['aiosp_cpostnofollow'] ) || !empty( $aioseop_options['aiosp_cpostnoodp'] ) || !empty( $aioseop_options['aiosp_cpostnoydir'] )
                            || !empty( $aioseop_options['aiosp_paginated_noindex'] ) || !empty( $aioseop_options['aiosp_paginated_nofollow'] ) ) {
                            if ( ( $aiosp_noindex == 'on' ) || ( ( !empty( $aioseop_options['aiosp_paginated_noindex'] ) ) && ( ( $page > 1 ) ) ) ||
                                 ( ( $aiosp_noindex == '' ) && ( !empty( $aioseop_options['aiosp_cpostnoindex'] ) ) && ( in_array( $post_type, $aioseop_options['aiosp_cpostnoindex'] ) ) ) )
            Severity: Critical
            Found in aioseop_class.php - About 2 hrs to fix

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

                      function do_multi_input( $args ) {
                          extract( $args );
                          $buf1 = '';
                          $type = $options['type'];
                          if ( ( $type == 'radio' ) || ( $type == 'checkbox' ) ) {
              Severity: Minor
              Found in aioseop_module_class.php - About 2 hrs to fix

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

                        function get_current_options( $opts = Array(), $location = null, $defaults = null, $post = null ) {
                            $prefix = $this->get_prefix( $location );
                            $get_opts = '';
                            if ( empty( $location ) )
                                $type = 'settings';
                Severity: Minor
                Found in aioseop_module_class.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_filesystem_object has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                        function get_filesystem_object( ) {
                            $cred = get_transient( 'aioseop_fs_credentials' );
                            if ( !empty( $cred ) ) $this->credentials = $cred;
                            
                            if ( function_exists( 'WP_Filesystem' ) && ( WP_Filesystem( $this->credentials ) ) ) {
                Severity: Minor
                Found in aioseop_module_class.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 settings_page_init has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                        function settings_page_init() {
                            add_filter( 'aiosp_output_option', Array( $this, 'display_custom_options' ), 10, 2 );
                            $cat = $this->options["{$this->prefix}categories"];
                            if ( !empty( $cat ) ) {
                                if ( $cat == 'blog' ) {
                Severity: Minor
                Found in aioseop_opengraph.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_post_title_format has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                    function get_post_title_format( $title_type = 'post', $p = null ) {
                        global $aioseop_options;
                        if ( ( $title_type != 'post' ) && ( $title_type != 'archive' ) ) return false;
                        $title_format = "%{$title_type}_title% | %blog_title%";
                        if ( isset( $aioseop_options["aiosp_{$title_type}_title_format"] ) )
                Severity: Minor
                Found in aioseop_class.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_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 get_robots_meta has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function get_robots_meta() {
                          global $aioseop_options;
                          $opts = $this->meta_opts;
                          $page = $this->get_page_number();
                          $robots_meta = $tax_noindex = '';
                  Severity: Minor
                  Found in aioseop_class.php - About 1 hr to fix

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

                            function annotate_robots_html( $file, $show_help = false, $title = '' ) {
                                $robots = $this->annotate_robots( $file );
                                if( !empty( $robots ) ){
                                    $buf = '<table class="widefat" ><thead>';
                                    if ( !empty( $title ) ) {
                    Severity: Minor
                    Found in aioseop_robots.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
                          Severity
                          Category
                          Status
                          Source
                          Language