Completed
Push — update/masterbar-plugins-link ( 9ebb3d...ad8a7a )
by
unknown
11:18
created

twentyeleven.php ➔ jetpack_twentyeleven_has_footer_widgets()   B

Complexity

Conditions 7
Paths 3

Size

Total Lines 11
Code Lines 6

Duplication

Lines 11
Ratio 100 %

Importance

Changes 0
Metric Value
cc 7
eloc 6
nc 3
nop 0
dl 11
loc 11
rs 8.2222
c 0
b 0
f 0
1
<?php
2
/**
3
 * Infinite Scroll Theme Assets
4
 *
5
 * Register support for @Twenty Eleven and enqueue relevant styles.
6
 */
7
8
/**
9
 * Add theme support for infinity scroll
10
 */
11
function jetpack_twentyeleven_infinite_scroll_init() {
12
	add_theme_support( 'infinite-scroll', array(
13
		'container'      => 'content',
14
		'footer'         => 'page',
15
		'footer_widgets' => jetpack_twentyeleven_has_footer_widgets(),
16
	) );
17
}
18
add_action( 'init', 'jetpack_twentyeleven_infinite_scroll_init' );
19
20
/**
21
 * Enqueue CSS stylesheet with theme styles for infinity.
22
 */
23
function jetpack_twentyeleven_infinite_scroll_enqueue_styles() {
24
	if ( wp_script_is( 'the-neverending-homepage' ) ) {
25
		// Add theme specific styles.
26
		wp_enqueue_style( 'infinity-twentyeleven', plugins_url( 'twentyeleven.css', __FILE__ ), array( 'the-neverending-homepage' ), '20121002' );
27
	}
28
}
29
add_action( 'wp_enqueue_scripts', 'jetpack_twentyeleven_infinite_scroll_enqueue_styles', 25 );
30
31
/**
32
 * Do we have footer widgets?
33
 */
34 View Code Duplication
function jetpack_twentyeleven_has_footer_widgets() {
0 ignored issues
show
Duplication introduced by
This function seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
35
	// Are any of the "Footer Area" sidebars active?
36
	if ( is_active_sidebar( 'sidebar-3' ) || is_active_sidebar( 'sidebar-4' ) || is_active_sidebar( 'sidebar-5' ) )
37
		return true;
38
39
	// If we're on mobile and the Main Sidebar has widgets, it falls below the content, so we have footer widgets.
40
	if ( function_exists( 'jetpack_is_mobile' ) && jetpack_is_mobile() && is_active_sidebar( 'sidebar-1' ) )
41
		return true;
42
43
	return false;
44
}
45