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

twentytwelve.php ➔ jetpack_twentytwelve_has_footer_widgets()   B

Complexity

Conditions 7
Paths 4

Size

Total Lines 10
Code Lines 7

Duplication

Lines 10
Ratio 100 %

Importance

Changes 0
Metric Value
cc 7
eloc 7
nc 4
nop 0
dl 10
loc 10
rs 8.2222
c 0
b 0
f 0
1
<?php
2
/**
3
 * Infinite Scroll Theme Assets
4
 *
5
 * Register support for Twenty Twelve and enqueue relevant styles.
6
 */
7
8
/**
9
 * Add theme support for infinite scroll
10
 */
11
function jetpack_twentytwelve_infinite_scroll_init() {
12
	add_theme_support( 'infinite-scroll', array(
13
		'container'      => 'content',
14
		'footer'         => 'page',
15
		'footer_widgets' => jetpack_twentytwelve_has_footer_widgets(),
16
	) );
17
}
18
add_action( 'after_setup_theme', 'jetpack_twentytwelve_infinite_scroll_init' );
19
20
/**
21
 * Enqueue CSS stylesheet with theme styles for infinity.
22
 */
23
function jetpack_twentytwelve_infinite_scroll_enqueue_styles() {
24
	if ( wp_script_is( 'the-neverending-homepage' ) ) {
25
		// Add theme specific styles.
26
		wp_enqueue_style( 'infinity-twentytwelve', plugins_url( 'twentytwelve.css', __FILE__ ), array( 'the-neverending-homepage' ), '20120817' );
27
	}
28
}
29
add_action( 'wp_enqueue_scripts', 'jetpack_twentytwelve_infinite_scroll_enqueue_styles', 25 );
30
31
/**
32
 * Do we have footer widgets?
33
 */
34 View Code Duplication
function jetpack_twentytwelve_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
	if ( function_exists( 'jetpack_is_mobile' ) && jetpack_is_mobile() ) {
36
		if ( is_front_page() && ( is_active_sidebar( 'sidebar-2' ) || is_active_sidebar( 'sidebar-3' ) ) )
37
			return true;
38
		elseif ( is_active_sidebar( 'sidebar-1' ) )
39
			return true;
40
	}
41
42
	return false;
43
}
44