Web.Admin/2014/wordpress/wp-admin/includes/meta-boxes.php
Function post_submit_meta_box
has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring. Open
Open
function post_submit_meta_box($post) {
global $action;
$post_type = $post->post_type;
$can_publish = current_user_can("publish_${post_type}s");
- 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
File meta-boxes.php
has 566 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
// -- Post related Meta Boxes
/**
Method post_submit_meta_box
has 188 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function post_submit_meta_box($post) {
global $action;
$post_type = $post->post_type;
$can_publish = current_user_can("publish_${post_type}s");
Method link_xfn_meta_box
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function link_xfn_meta_box($link) {
?>
<table class="editform" style="width: 100%;" cellspacing="2" cellpadding="5">
<tr>
<th style="width: 20%;" scope="row"><label for="link_rel"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('rel:') ?></label></th>
Method link_submit_meta_box
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function link_submit_meta_box($link) {
?>
<div class="submitbox" id="submitlink">
<div id="minor-publishing">
Function xfn_check
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
function xfn_check($class, $value = '', $deprecated = '') {
global $link;
$link_rel = isset( $link->link_rel ) ? $link->link_rel : ''; // In PHP 5.3: $link_rel = $link->link_rel ?: '';
$rels = preg_split('/\s+/', $link_rel);
- 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 link_categories_meta_box
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function link_categories_meta_box($link) { ?>
<ul id="category-tabs">
<li class="tabs"><a href="#categories-all"><?php _e( 'All Categories' ); ?></a></li>
<li class="hide-if-no-js"><a href="#categories-pop"><?php _e( 'Most Used' ); ?></a></li>
</ul>
Method link_advanced_meta_box
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function link_advanced_meta_box($link) {
?>
<table class="form-table" style="width: 100%;" cellspacing="2" cellpadding="5">
<tr class="form-field">
<th valign="top" scope="row"><label for="link_image"><?php _e('Image Address') ?></label></th>
Method post_categories_meta_box
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function post_categories_meta_box($post) {
?>
<ul id="category-tabs">
<li class="tabs"><a href="#categories-all" tabindex="3"><?php _e( 'All Categories' ); ?></a></li>
<li class="hide-if-no-js"><a href="#categories-pop" tabindex="3"><?php _e( 'Most Used' ); ?></a></li>
Consider simplifying this complex logical expression. Open
Open
if ('family' == $class && strpos($link_rel, 'child') === false && strpos($link_rel, 'parent') === false && strpos($link_rel, 'sibling') === false && strpos($link_rel, 'spouse') === false && strpos($link_rel, 'kin') === false) echo ' checked="checked"';