説明なし

class-atomic-additional-css-manager.php 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. /**
  3. * WPORG_Additional_CSS_Manager file
  4. *
  5. * Responsible with replacing the Core Additional CSS section with an upgrade nudge on Atomic.
  6. *
  7. * @package Jetpack
  8. */
  9. namespace Automattic\Jetpack\Dashboard_Customizations;
  10. /**
  11. * Class Atomic_Additional_CSS_Manager
  12. *
  13. * @package Automattic\Jetpack\Dashboard_Customizations
  14. */
  15. class Atomic_Additional_CSS_Manager {
  16. /**
  17. * The site domain.
  18. *
  19. * @var string
  20. */
  21. private $domain;
  22. /**
  23. * Atomic_Additional_CSS_Manager constructor.
  24. *
  25. * @param string $domain the Site domain.
  26. */
  27. public function __construct( $domain ) {
  28. $this->domain = $domain;
  29. }
  30. /**
  31. * Replace the Additional CSS section from Customiz¡er with an upgrade nudge.
  32. *
  33. * @param \WP_Customize_Manager $wp_customize_manager Core customize manager.
  34. */
  35. public function register_nudge( \WP_Customize_Manager $wp_customize_manager ) {
  36. $nudge = new CSS_Customizer_Nudge(
  37. $this->get_nudge_url(),
  38. __( 'Purchase a Business Plan to<br> activate CSS customization', 'jetpack' )
  39. );
  40. $wp_customize_manager->remove_control( 'custom_css' );
  41. $wp_customize_manager->remove_section( 'custom_css' );
  42. $nudge->customize_register_nudge( $wp_customize_manager );
  43. }
  44. /**
  45. * Get the Nudge URL.
  46. *
  47. * @return string
  48. */
  49. private function get_nudge_url() {
  50. return '/checkout/' . $this->domain . '/business';
  51. }
  52. }