designfly_body_classes()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 12
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 5
c 1
b 0
f 0
nc 4
nop 1
dl 0
loc 12
rs 10
1
<?php
2
/**
3
 * Functions which enhance the theme by hooking into WordPress
4
 *
5
 * @package DesignFly
6
 */
7
8
/**
9
 * Adds custom classes to the array of body classes.
10
 *
11
 * @param array $classes Classes for the body element.
12
 * @return array
13
 */
14
function designfly_body_classes( $classes ) {
15
	// Adds a class of hfeed to non-singular pages.
16
	if ( ! is_singular() ) {
0 ignored issues
show
Bug introduced by
The function is_singular was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

16
	if ( ! /** @scrutinizer ignore-call */ is_singular() ) {
Loading history...
17
		$classes[] = 'hfeed';
18
	}
19
20
	// Adds a class of no-sidebar when there is no sidebar present.
21
	if ( ! is_active_sidebar( 'sidebar-1' ) ) {
0 ignored issues
show
Bug introduced by
The function is_active_sidebar was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

21
	if ( ! /** @scrutinizer ignore-call */ is_active_sidebar( 'sidebar-1' ) ) {
Loading history...
22
		$classes[] = 'no-sidebar';
23
	}
24
25
	return $classes;
26
}
27
add_filter( 'body_class', 'designfly_body_classes' );
0 ignored issues
show
Bug introduced by
The function add_filter was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

27
/** @scrutinizer ignore-call */ 
28
add_filter( 'body_class', 'designfly_body_classes' );
Loading history...
28
29
/**
30
 * Add a pingback url auto-discovery header for single posts, pages, or attachments.
31
 */
32
function designfly_pingback_header() {
33
	if ( is_singular() && pings_open() ) {
0 ignored issues
show
Bug introduced by
The function is_singular was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

33
	if ( /** @scrutinizer ignore-call */ is_singular() && pings_open() ) {
Loading history...
Bug introduced by
The function pings_open was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

33
	if ( is_singular() && /** @scrutinizer ignore-call */ pings_open() ) {
Loading history...
34
		printf( '<link rel="pingback" href="%s">', esc_url( get_bloginfo( 'pingback_url' ) ) );
0 ignored issues
show
Bug introduced by
The function esc_url was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

34
		printf( '<link rel="pingback" href="%s">', /** @scrutinizer ignore-call */ esc_url( get_bloginfo( 'pingback_url' ) ) );
Loading history...
Bug introduced by
The function get_bloginfo was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

34
		printf( '<link rel="pingback" href="%s">', esc_url( /** @scrutinizer ignore-call */ get_bloginfo( 'pingback_url' ) ) );
Loading history...
35
	}
36
}
37
add_action( 'wp_head', 'designfly_pingback_header' );
0 ignored issues
show
Bug introduced by
The function add_action was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

37
/** @scrutinizer ignore-call */ 
38
add_action( 'wp_head', 'designfly_pingback_header' );
Loading history...
38