Completed
Push — update/add-csstidy-config-sett... ( 30eb4b...0a5859 )
by
unknown
19:15 queued 09:40
created

WPCOM_Additional_CSS_Manager::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 3
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 3
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * WPCOM_Additional_CSS_Manager file
4
 *
5
 * Is responsible with registering the Additional CSS section in WPCOM.
6
 *
7
 * @package Jetpack
8
 */
9
10
namespace Automattic\Jetpack\Dashboard_Customizations;
11
12
/**
13
 * Class WPCOM_Disable_Additional_CSS
14
 *
15
 * @package Automattic\Jetpack\Dashboard_Customizations
16
 */
17 View Code Duplication
class WPCOM_Additional_CSS_Manager {
0 ignored issues
show
Duplication introduced by
This class 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...
18
19
	/**
20
	 * The site domain.
21
	 *
22
	 * @var string
23
	 */
24
	private $domain;
25
26
	/**
27
	 * WPCOM_Additional_CSS_Manager constructor.
28
	 *
29
	 * @param string $domain the Site domain.
30
	 */
31
	public function __construct( $domain ) {
32
		$this->domain = $domain;
33
	}
34
35
	/**
36
	 * Register the Additional CSS nudge.
37
	 *
38
	 * @param \WP_Customize_Manager $wp_customize_manager The core customize manager.
39
	 */
40
	public function register_nudge( \WP_Customize_Manager $wp_customize_manager ) {
41
		$nudge = new CSS_Customizer_Nudge(
42
			$this->get_nudge_url(),
43
			__( 'Purchase a Premium Plan to<br> activate CSS customization', 'jetpack' ),
44
			'jetpack_custom_css'
45
		);
46
47
		$nudge->customize_register_nudge( $wp_customize_manager );
48
	}
49
50
	/**
51
	 * Get the nudge URL in WPCOM.
52
	 *
53
	 * @return string
54
	 */
55
	private function get_nudge_url() {
56
		return '/checkout/' . $this->domain . '/premium';
57
	}
58
}
59