Showing 399 of 427 total issues
Function sanitize_options
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
function sanitize_options( $location = null ) {
foreach ( $this->setting_options( $location ) as $k => $v ) {
if ( isset( $this->options[$k] ) ) {
if ( !empty( $v['sanitize'] ) )
$type = $v['sanitize'];
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function aioseop_update_settings_check
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
function aioseop_update_settings_check() {
global $aioseop_options;
if ( ( isset( $_POST['aioseop_migrate_options'] ) ) ||
( empty( $aioseop_options ) ) )
aioseop_mrt_mkarry();
- Read upRead up
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_help_text_links
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
function add_help_text_links() {
if ( !empty( $this->help_text ) ) {
foreach( $this->layout as $k => $v ) {
$this->help_text_helper( $this->default_options, $v['options'], $v['help_link'] );
}
- Read upRead up
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"];
- Read upRead up
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;
- Read upRead up
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 filter_options
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
function filter_options( $options, $location ) {
if ( $location ) $prefix = $this->get_prefix( $location ) . $location . '_';
if ( $location === 'generator' ) {
$optimize = false;
$robotgen = '';
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";
Consider simplifying this complex logical expression. Open
if ( !class_exists( 'All_in_One_SEO_Pack_Module_Manager' ) ) {
class All_in_One_SEO_Pack_Module_Manager {
protected $modules = Array();
protected $settings_update = false;
protected $settings_reset = false;
Method __construct
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
function __construct( ) {
$this->name = __('Bad Bot Blocker', 'all-in-one-seo-pack'); // Human-readable name of the plugin
$this->prefix = 'aiosp_bad_robots_'; // option prefix
$this->file = __FILE__; // the current file
parent::__construct();
Function debug_post_types
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
function debug_post_types( ) {
$post_types = $this->get_post_type_titles( );
$rempost = array( 'attachment' => 1, 'revision' => 1, 'nav_menu_item' => 1 );
$this->default_options['export_post_types']['initial_options'] = array_diff_key( $post_types, $rempost );
- Read upRead up
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_the_image_by_attachment
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
function get_the_image_by_attachment( $p = null ) {
if ( $p === null ) {
global $post;
} else {
- Read upRead up
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 rename_file
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
function rename_file( $filename, $newname ) {
$wpfs = $this->get_filesystem_object();
if ( is_object( $wpfs ) ) {
$file_exists = $wpfs->exists( $filename );
$newfile_exists = $wpfs->exists( $newname );
- Read upRead up
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 filter_settings
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
function filter_settings( $settings, $location, $current ) {
if ( $location == null ) {
$prefix = $this->prefix;
foreach ( Array( 'seopostcol', 'seocustptcol', 'debug_info', 'max_words_excerpt' ) as $opt )
Method add_menu
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
function add_menu( $parent_slug ) {
if ( !empty( $this->menu_name ) )
$name = $this->menu_name;
else
$name = $this->name;
Method aioseop_admin_head
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
function aioseop_admin_head() {
echo '<script type="text/javascript" src="' . AIOSEOP_PLUGIN_URL . 'quickedit_functions.js" ></script>';
?><style>
.aioseop_edit_button {
margin: 0 0 0 5px;
Method setting_options
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
function setting_options( $location = null, $defaults = null ) {
if ( $defaults === null )
$defaults = $this->default_options;
$prefix = $this->get_prefix( $location );
$opts = Array();
Method __construct
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
function __construct( $mod ) {
$this->name = __('Feature Manager', 'all-in-one-seo-pack'); // Human-readable name of the plugin
$this->prefix = 'aiosp_feature_manager_'; // option prefix
$this->file = __FILE__; // the current file
parent::__construct();
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' )
Method get_prev_next_links
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
function get_prev_next_links( $post = null ) {
$prev = $next = '';
$page = $this->get_page_number();
if ( is_home() || is_archive() || is_paged() ) {
global $wp_query;
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';