PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-beta
Jetpack – WP Security, Backup, Speed, & Growth v16.3-beta
16.3-beta 16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 All 507 releases
jetpack / jetpack_vendor / automattic / jetpack-masterbar / src / nudges / additional-css / class-wpcom-additional-css-manager.php

class-wpcom-additional-css-manager.php in Jetpack – WP Security, Backup, Speed, & Growth 16.3-beta, at jetpack_vendor/automattic/jetpack-masterbar/src/nudges/additional-css/class-wpcom-additional-css-manager.php

74 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * WPCOM_Additional_CSS_Manager file
4 *
5 * Is responsible with registering the Additional CSS section in WPCOM.
6 *
7 * @package automattic/jetpack-masterbar
8 */
9
10 namespace Automattic\Jetpack\Masterbar;
11
12 /**
13 * Class WPCOM_Disable_Additional_CSS
14 */
15 class WPCOM_Additional_CSS_Manager {
16
17 /**
18 * The site domain.
19 *
20 * @var string
21 */
22 private $domain;
23
24 /**
25 * WPCOM_Additional_CSS_Manager constructor.
26 *
27 * @param string $domain the Site domain.
28 */
29 public function __construct( $domain ) {
30 $this->domain = $domain;
31 }
32
33 /**
34 * Register the Additional CSS nudge.
35 *
36 * @param \WP_Customize_Manager $wp_customize_manager The core customize manager.
37 */
38 public function register_nudge( \WP_Customize_Manager $wp_customize_manager ) {
39 $plan_name = $this->get_plan()->product_name_short;
40
41 $nudge_url = $this->get_nudge_url();
42 /* translators: %s is the plan name. */
43 $nudge_text = sprintf( __( 'Purchase the %s plan to<br> activate CSS customization', 'jetpack-masterbar' ), $plan_name );
44
45 $nudge = new CSS_Customizer_Nudge(
46 $nudge_url,
47 $nudge_text,
48 'jetpack_custom_css'
49 );
50
51 $nudge->customize_register_nudge( $wp_customize_manager );
52 }
53
54 /**
55 * Get the nudge URL in WPCOM.
56 *
57 * @return string
58 */
59 private function get_nudge_url() {
60 return '/checkout/' . $this->domain . '/' . $this->get_plan()->path_slug;
61 }
62
63 /**
64 * Get the plan.
65 *
66 * @return mixed
67 */
68 protected function get_plan() {
69 $plan_slug = apply_filters( 'wpcom_customize_css_plan_slug', 'value_bundle' );
70
71 return \Automattic\Jetpack\Plans::get_plan( $plan_slug );
72 }
73 }
74