| @@ 17-61 (lines=45) @@ | ||
| 14 | * |
|
| 15 | * @package Automattic\Jetpack\Dashboard_Customizations |
|
| 16 | */ |
|
| 17 | class Atomic_Additional_CSS_Manager { |
|
| 18 | ||
| 19 | /** |
|
| 20 | * The site domain. |
|
| 21 | * |
|
| 22 | * @var string |
|
| 23 | */ |
|
| 24 | private $domain; |
|
| 25 | ||
| 26 | /** |
|
| 27 | * Atomic_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 | * Replace the Additional CSS section from Customiz”er with an upgrade nudge. |
|
| 37 | * |
|
| 38 | * @param \WP_Customize_Manager $wp_customize_manager Core customize manager. |
|
| 39 | */ |
|
| 40 | public function register_nudge( \WP_Customize_Manager $wp_customize_manager ) { |
|
| 41 | ||
| 42 | $nudge = new CSS_Customizer_Nudge( |
|
| 43 | $this->get_nudge_url(), |
|
| 44 | __( 'Purchase a Business Plan to<br> activate CSS customization', 'jetpack' ) |
|
| 45 | ); |
|
| 46 | ||
| 47 | $wp_customize_manager->remove_control( 'custom_css' ); |
|
| 48 | $wp_customize_manager->remove_section( 'custom_css' ); |
|
| 49 | ||
| 50 | $nudge->customize_register_nudge( $wp_customize_manager ); |
|
| 51 | } |
|
| 52 | ||
| 53 | /** |
|
| 54 | * Get the Nudge URL. |
|
| 55 | * |
|
| 56 | * @return string |
|
| 57 | */ |
|
| 58 | private function get_nudge_url() { |
|
| 59 | return '/checkout/' . $this->domain . '/business'; |
|
| 60 | } |
|
| 61 | } |
|
| 62 | ||
| @@ 17-58 (lines=42) @@ | ||
| 14 | * |
|
| 15 | * @package Automattic\Jetpack\Dashboard_Customizations |
|
| 16 | */ |
|
| 17 | class WPCOM_Additional_CSS_Manager { |
|
| 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 | ||