Web.Admin/2014/wordpress/wp-admin/custom-header.php
File custom-header.php
has 305 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
/**
* The custom header image script.
*
* @package WordPress
Method js_1
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function js_1() { ?>
<script type="text/javascript">
var buttons = ['#name', '#desc', '#pickcolor', '#defaultcolor'];
var farbtastic;
Method step_2
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function step_2() {
check_admin_referer('custom-header');
$overrides = array('test_form' => false);
$file = wp_handle_upload($_FILES['import'], $overrides);
Method step_1
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function step_1() {
if ( $_GET['updated'] ) { ?>
<div id="message" class="updated fade">
<p><?php _e('Header updated.') ?></p>
</div>
Method js_2
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function js_2() { ?>
<script type="text/javascript">
function onEndCrop( coords ) {
jQuery( '#x1' ).val(coords.x);
jQuery( '#y1' ).val(coords.y);
Method step_3
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function step_3() {
check_admin_referer('custom-header');
if ( $_POST['oitar'] > 1 ) {
$_POST['x1'] = $_POST['x1'] * $_POST['oitar'];
$_POST['y1'] = $_POST['y1'] * $_POST['oitar'];
Function take_action
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
function take_action() {
if ( isset( $_POST['textcolor'] ) ) {
check_admin_referer('custom-header');
if ( 'blank' == $_POST['textcolor'] ) {
set_theme_mod('header_textcolor', 'blank');
- 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"