Completed
Push — gm-17/payment-widget ( cb2702...55e70e )
by
unknown
13:32 queued 03:19
created

  B

Complexity

Conditions 7
Paths 2

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 7
eloc 6
nc 2
nop 1
dl 0
loc 9
rs 8.2222
c 0
b 0
f 0
1
<?php
2
/**
3
 * Infinite Scroll Theme Assets
4
 *
5
 * Register support for Twenty Fourteen.
6
 */
7
8
/**
9
 * Add theme support for infinite scroll
10
 */
11
function jetpack_twentyfourteen_infinite_scroll_init() {
12
	add_theme_support( 'infinite-scroll', array(
13
		'container'      => 'content',
14
		'footer'         => 'page',
15
		'footer_widgets' => jetpack_twentyfourteen_has_footer_widgets(),
16
	) );
17
}
18
add_action( 'after_setup_theme', 'jetpack_twentyfourteen_infinite_scroll_init' );
19
20
/**
21
 * Switch to the "click to load" type IS with the following cases
22
 * 1. Viewed from iPad and the primary sidebar is active.
23
 * 2. Viewed from mobile and either the primary or the content sidebar is active.
24
 * 3. The footer widget is active.
25
 *
26
 * @return bool
27
 */
28 View Code Duplication
function jetpack_twentyfourteen_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...
29
	if ( function_exists( 'jetpack_is_mobile' ) ) {
30
		if ( ( Jetpack_User_Agent_Info::is_ipad() && is_active_sidebar( 'sidebar-1' ) )
31
			|| ( jetpack_is_mobile( '', true ) && ( is_active_sidebar( 'sidebar-1' ) || is_active_sidebar( 'sidebar-2' ) ) )
32
			|| is_active_sidebar( 'sidebar-3' ) )
33
34
			return true;
35
	}
36
37
	return false;
38
}
39
40
/**
41
 * Enqueue CSS stylesheet with theme styles for Infinite Scroll.
42
 */
43
function jetpack_twentyfourteen_infinite_scroll_enqueue_styles() {
44
	if ( wp_script_is( 'the-neverending-homepage' ) ) {
45
		wp_enqueue_style( 'infinity-twentyfourteen', plugins_url( 'twentyfourteen.css', __FILE__ ), array( 'the-neverending-homepage' ), '20131118' );
46
	}
47
}
48
add_action( 'wp_enqueue_scripts', 'jetpack_twentyfourteen_infinite_scroll_enqueue_styles', 25 );
49